DIRECTORY File, FileInternal, Random, Rope, SafeStorage; PropertiesExtendTester: CEDAR PROGRAM IMPORTS File, Random, SafeStorage = BEGIN DoTest: PROC [numberOfExtends: INT, maxNumberOfPages: INT ] = { file: File.Handle; fileFP: File.FP; propPages: File.PageCount; props: File.PropertyStorage; randomStream: Random.RandomStream; volume: File.Volume; offset: WORD; randomStream _ Random.Create[range: 10000, seed: -1] ; offset _ Random.ChooseInt[randomStream, 1, 1000]; volume _ File.SystemVolume[]; file _ File.Create[volume: volume, size: 30] ; [fp: fileFP] _ File.Info[file]; [prop: props, nPages: propPages] _ File.GetProperties[file: file]; IF propPages # 1 THEN ERROR; setProps[file, offset, props, File.wordsPerPage]; file _ NIL; SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE]; SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE]; FOR loopCount: INT IN [0 .. numberOfExtends) DO growAmount: INT; nowProps: File.PropertyStorage; nowPropPages: File.PageCount; nowWords: CARDINAL; growAmount _ Random.ChooseInt[randomStream, 1, maxNumberOfPages]; file _ File.Open[volume: volume, fp: fileFP]; [prop: nowProps, nPages: nowPropPages] _ File.GetProperties[file: file]; IF nowPropPages # propPages THEN ERROR; nowWords _ nowPropPages * File.wordsPerPage; testProps[offset, nowProps, nowWords]; propPages _ propPages + growAmount; file.SetPropertiesSize[nPages: propPages]; [prop: nowProps, nPages: nowPropPages] _ File.GetProperties[file: file]; IF nowPropPages # propPages THEN ERROR; setProps[file, offset, nowProps, propPages*File.wordsPerPage]; file _ NIL; SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE]; SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE]; SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE]; SafeStorage.ReclaimCollectibleObjects[suspendMe: TRUE, traceAndSweep: FALSE]; ENDLOOP; file _ File.Open[volume: volume, fp: fileFP]; file.Delete[]; }; testProps: PROC [offset: WORD, props: File.PropertyStorage, propWords: CARDINAL] = TRUSTED { FOR ptr: CARDINAL IN [0..propWords) DO IF props[ptr] # ptr+offset THEN ERROR; ENDLOOP; }; setProps: PROC [file: File.Handle, offset: WORD, props: File.PropertyStorage, propWords: CARDINAL] = TRUSTED { FOR ptr: CARDINAL IN [0..propWords) DO props[ptr] _ ptr+offset; ENDLOOP; file.WriteProperties[]; }; END. jPropertiesExtendTester.mesa Last Edited by: Bob Hagmann, March 20, 1985 11:35:18 am PST Start code Êõ˜Icode1šœ™™K™+—šÏk ˜ J˜J˜ Jšœ˜Kšœ˜Kšœ ˜ —šœœ˜%Kšœ˜!Kšœ˜K˜K˜K˜K˜šÐbnœœœœ˜?Kšœ˜Kšœ œ˜Kšœ˜Kšœ˜Kšœ"˜"Kšœ˜Kšœœ˜ K˜Kšœ6˜6Kšœ1˜1Kšœ˜Kšœ.˜.Kšœ˜KšœB˜BKšœœœ˜Kšœ1˜1Kšœœ˜ Kšœ1œœ˜MKšœ1œœ˜MK˜šœ œœ˜/Kšœ œ˜Kšœ˜Kšœ˜Kšœ œ˜KšœA˜AKšœ-˜-KšœH˜HKšœœœ˜'Kšœ,˜,Kšœ&˜&Kšœ#˜#Kšœ*˜*KšœH˜HKšœœœ˜'Kšœ>˜>Kšœœ˜ Kšœ1œœ˜MKšœ1œœ˜MKšœ1œœ˜MKšœ1œœ˜MKšœ˜—K˜Kšœ-˜-Kšœ˜K˜—K˜š œ œ œ*œœ˜\šœœœ˜&Kšœœœ˜&Kšœ˜—K˜—K˜š œ œœ*œœ˜nšœœœ˜&Kšœ˜Kšœ˜—Kšœ˜K˜—K˜K˜K˜K™ K˜K˜Kšœ˜K™—K˜J˜—…— r Ñ