1\ Test the Global-Scope directive and a few of its effects. 2\ Updated Thu, 12 Jan 2006 at 16:06 PST by David L. Paktor 3\ GlobScopErrTst_02.fth -- Right variant relative to GlobScopErrTst.fth 4 5fcode-version2 6 7headers 8 9[ifexists] coconuts 10 [message] Why a duck? 11[endif] 12 13alias [testdict] [ifexists] 14 15[testdict] coconuts 16 [message] Boy, can you get stucco! 17[else] 18 [message] Why a fence? 19[endif] 20 21global-definitions 22 23\ Bypass warning about Instance without altering LocalValuesSupport file 24alias generic-instance instance 25overload [macro] instance f[ noop .( Shminstance!) f] noop 26 27\ This is right. The "bypass" has Global scope 28 29fload LocalValuesSupport.fth 30 31\ Replace normal meaning of Instance, also in Global scope. 32overload alias instance generic-instance 33 34: $CAT ( _max _str1 _len1 _str2 _len2 -- _max _str1 _len1' ) 35 { _max _str1 _len1 _str2 _len2 } 36 _len1 _max < if \ there is room 37 _str2 _str1 _len1 + _len2 _max _len1 - min move 38 then 39 _max _str1 _len1 _len2 + _max min \ always leave total length 40; 41 42instance variable fussel [message] Expected error; scope is still global. 43h# 3afe fussel ! 44 45device-definitions 46 47h# 5afe instance value dumont [message] Device scope in effect. SB Legit. 48: ducksoup ( n1 n2 n3 n4 -- m1 m2 ) 49 { \ Declare some locals 50 _harpo ( the quiet one) _chico 51 _groucho | \ He's funny, right? 52 _zeppo ( who? ) _karl \ Is he part of the act? 53 } 54 d# 64 _groucho dup count dup -> _zeppo 55 _harpo dup count $cat 56 dup -> _karl 57 rot _karl = if type exit then 58 _groucho + swap _zeppo + 59; 60 61global-definitions 62 63: garbanzo 64 ." Should be unrecognized." cr 65 ducksoup 66; 67 68new-device [message] Missing a finish-device 69 70: fazooule! 71 ." Lima enter tain you..." cr 72 ducksoup 73 garbanzo 74; 75 76h# deadc0de instance value quaack [message] Instance should be legit here. 77 78global-definitions 79 80: frijoles 81 ." Holy ... beans?" cr 82 fazooule! 83 garbanzo 84 ducksoup 85; 86 87finish-device 88 89finish-device 90 91fcode-end 92