/[james]/territories/Source/TestTerr
ViewVC logotype

Annotation of /territories/Source/TestTerr

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (hide annotations) (download)
Tue Feb 11 11:05:25 2003 UTC (21 years, 8 months ago) by james
File size: 9245 byte(s)
Initial import.

1 james 19 REM > TestTerr
2    
3     ON ERROR ON ERROR OFF: REPORT: PRINT ERL: END
4    
5     DIM b% 1000, DATE$(6), FMT$(3), PROP$(10)
6    
7     DATE$(0) = "%cs %se %mi %12 %24 %am %pm %we %w3 %wn"
8     DATE$(1) = "%CS %SE %MI %12 %24 %AM %PM %WE %W3 %WN"
9     DATE$(2) = "%dy %st %mo %m3 %mn %ce %yr %wk %dn %tz"
10     DATE$(3) = "%DY %ST %MO %M3 %MN %CE %YR %WK %DN %TZ"
11     DATE$(4) = "%zcs %zse %zmi %z12 %z24 %zam %zpm %zwe %zw3 %zwn"
12     DATE$(5) = "%zdy %zst %zmo %zm3 %zmn %zce %zyr %zwk %zdn %ztz"
13     DATE$(6) = "%% abc 123 cs se zmi"
14    
15     FMT$(1) = "%24:%MI:%SE"
16     FMT$(2) = "%W3, %DY-%M3-%CE%YR"
17     FMT$(3) = "%W3, %DY-%M3-%CE%YR.%24:%MI:%SE"
18    
19     PROP$() = "control", "uppercase", "lowercase", "alphabetic", "punctuation", "white space", "digit", "hex digit", "has accent", "same direction", "opposite direction"
20    
21     REM------------------------------------------------------------
22     PRINT "Territory manager SWIs"
23     REM------------------------------------------------------------
24     PRINT " Territory_Number"
25    
26     SYS"Territory_Number" TO test%
27     PRINT " Current territory's number: "; STR$test%
28    
29     REM------------------------------------------------------------
30     PRINT " Territory_NumberToName"
31    
32     FOR terr% = 1 TO 50
33     SYS"XTerritory_NumberToName", terr%, b%, 1000 TO err%, name$; flags%
34     IF flags% AND 1 THEN
35     REM PRINT " "; STR$terr%; ": Error: "; STR$(!err%); ": "; FNstr(err% + 4)
36     ELSE
37     PRINT " "; STR$terr%; ": "; name$
38     ENDIF
39     NEXT
40    
41     REM------------------------------------------------------------
42     PRINT " Territory_Exists"'" ";
43    
44     FOR terr% = 1 TO 50
45     SYS"Territory_Exists", terr% TO ; flags%
46     IF flags% AND 2 THEN PRINT STR$terr%; " ";
47     NEXT
48    
49     REM------------------------------------------------------------
50     PRINT '" Territory_AlphabetNumberToName"
51    
52     FOR alph% = 100 TO 120
53     SYS"XTerritory_AlphabetNumberToName", alph%, b%, 1000 TO err%, name$; flags%
54     IF flags% AND 1 THEN
55     REM PRINT " "; STR$alph%; ": Error: "; STR$(!err%); ": "; FNstr(err% + 4)
56     ELSE
57     PRINT " "; STR$alph%; ": "; name$
58     ENDIF
59     NEXT
60    
61     REM------------------------------------------------------------
62     PRINT " Territory_SelectAlphabet"
63    
64     SYS"Territory_Alphabet", -1
65    
66     REM------------------------------------------------------------
67     PRINT " Territory_SetTime"
68    
69     PROCprinttime
70    
71     b%?0 = 3
72     SYS"OS_Word", 14, b%
73    
74     b%?10 = 0
75     b%?11 = 0
76     b%?12 = &ef
77     b%?13 = &cd
78     b%?14 = &ab
79     PRINT " Setting time to: "; FNtime(b%+10)
80     SYS"Territory_SetTime", b%+10
81    
82     PROCprinttime
83    
84     PRINT " Setting time back"
85     SYS"Territory_SetTime", b%
86    
87     PROCprinttime
88    
89     REM------------------------------------------------------------
90     PRINT " Territory_ReadCurrentTimeZone"
91    
92     SYS"Territory_ReadCurrentTimeZone" TO name$, offset%
93     PRINT " name: '"; name$; "', offset/cs: "; STR$offset%
94    
95     REM------------------------------------------------------------
96     PRINT " Territory_ConvertTimeToUTCOrdinals"
97    
98     SYS"Territory_ConvertTimeToUTCOrdinals",, b%, b%+100
99     PRINT " centiseconds: "; STR$b%!100
100     PRINT " seconds: "; STR$b%!104
101     PRINT " minutes: "; STR$b%!108
102     PRINT " hours: "; STR$b%!112
103     PRINT " day: "; STR$b%!116
104     PRINT " month: "; STR$b%!120
105     PRINT " year: "; STR$b%!124
106     PRINT " day of week: "; STR$b%!128
107     PRINT " day of year: "; STR$b%!132
108    
109     REM------------------------------------------------------------
110     PRINT "Territory module SWIs"
111     REM------------------------------------------------------------
112     PRINT " Territory_ReadTimeZones"
113    
114     SYS"Territory_ReadTimeZones", -1 TO zone$, dst$, zone%, dst%
115     PRINT " standard: '"; zone$; "', offset/cs: "; STR$zone%
116     PRINT " dst: '"; dst$; "', offset/cs: "; STR$dst%
117    
118     REM------------------------------------------------------------
119     PRINT " Territory_ConvertDateAndTime"
120    
121     b%?0 = 3
122     SYS"OS_Word", 14, b%
123     FOR i% = 0 TO 6
124     SYS"Territory_ConvertDateAndTime", -1, b%, b%+10, 990, DATE$(i%) TO date$
125     PRINT " '"; DATE$(i%) "' -> '"; date$; "'"
126     NEXT
127    
128     REM------------------------------------------------------------
129     PRINT " Territory_ConvertStandardDateAndTime"
130    
131     SYS"Territory_ConvertStandardDateAndTime", -1, b%, b%+10, 990 TO date$
132     PRINT " '"; date$; "'"
133    
134     REM------------------------------------------------------------
135     PRINT " Territory_ConvertStandardDate"
136    
137     SYS"Territory_ConvertStandardDate", -1, b%, b%+10, 990 TO date$
138     PRINT " '"; date$; "'"
139    
140     REM------------------------------------------------------------
141     PRINT " Territory_ConvertStandardTime"
142    
143     SYS"Territory_ConvertStandardTime", -1, b%, b%+10, 990 TO date$
144     PRINT " '"; date$; "'"
145    
146     REM------------------------------------------------------------
147     PRINT " Territory_ConvertTimeToOrdinals"
148    
149     SYS"Territory_ConvertTimeToOrdinals", -1, b%, b%+100
150     PRINT " centiseconds: "; STR$b%!100
151     PRINT " seconds: "; STR$b%!104
152     PRINT " minutes: "; STR$b%!108
153     PRINT " hours: "; STR$b%!112
154     PRINT " day: "; STR$b%!116
155     PRINT " month: "; STR$b%!120
156     PRINT " year: "; STR$b%!124
157     PRINT " day of week: "; STR$b%!128
158     PRINT " day of year: "; STR$b%!132
159    
160     REM------------------------------------------------------------
161     PRINT " Territory_ConvertTimeStringToOrdinals"
162    
163     FOR i% = 1 TO 3
164     SYS"Territory_ConvertDateAndTime", -1, b%, b%+10, 990, FMT$(i%) TO date$
165     PRINT " "; STR$i%; " '"; FMT$(i%); "' -> '"; date$; "'"
166     SYS"Territory_ConvertTimeStringToOrdinals", -1, i%, date$, b%+100
167     PRINT " centiseconds: "; STR$b%!100
168     PRINT " seconds: "; STR$b%!104
169     PRINT " minutes: "; STR$b%!108
170     PRINT " hours: "; STR$b%!112
171     PRINT " day: "; STR$b%!116
172     PRINT " month: "; STR$b%!120
173     PRINT " year: "; STR$b%!124
174     NEXT
175    
176     REM------------------------------------------------------------
177     PRINT " Territory_ConvertOrdinalsToTime"
178    
179     SYS"Territory_ConvertTimeToOrdinals", -1, b%, b%+100
180     SYS"Territory_ConvertOrdinalsToTime", -1, b%+10, b%+100
181     PRINT " Original time : "; FNtime(b%)
182     PRINT " Converted to ordinals and back"
183     PRINT " Converted time: "; FNtime(b%+10)
184    
185     REM------------------------------------------------------------
186     PRINT " Territory_Alphabet"
187    
188     SYS"Territory_Alphabet", -1 TO alph%
189     PRINT " Alphabet number: "; STR$alph%
190    
191     REM------------------------------------------------------------
192     PRINT " Territory_AlphabetIdentifier"
193    
194     SYS"Territory_AlphabetIdentifier", -1 TO alph$
195     PRINT " Alphabet name: "; alph$
196    
197     REM------------------------------------------------------------
198     PRINT " Territory_SelectKeyboardHandler"
199    
200     SYS"Territory_SelectKeyboardHandler", -1
201    
202     REM------------------------------------------------------------
203     PRINT " Territory_WriteDirection"
204    
205     SYS"Territory_WriteDirection", -1 TO dir%
206     PRINT " &"; STR$~dir%; ": ";
207     IF dir% AND 1 THEN PRINT "right to left, "; ELSE PRINT "left to right, ";
208     IF dir% AND 2 THEN PRINT "bottom to top, "; ELSE PRINT "top to bottom, ";
209     IF dir% AND 4 THEN PRINT "vertical" ELSE PRINT "horizontal"
210    
211     REM------------------------------------------------------------
212     PRINT " Territory_CharacterPropertyTable"
213    
214     FOR i% = 0 TO 10
215     PRINT " "; STR$i%; " "; PROP$(i%); ": ";
216     SYS"Territory_CharacterPropertyTable", -1, i% TO table%
217     FOR c% = 0 TO 255
218     IF table%?(c% >> 3) AND (1 << (c% AND 7)) THEN PRINT FNchar(c%);
219     NEXT
220     PRINT
221     NEXT
222    
223     REM------------------------------------------------------------
224     PRINT " Territory_LowerCaseTable"
225    
226     SYS"Territory_LowerCaseTable", -1 TO table%
227     PROCtable(table%)
228    
229     REM------------------------------------------------------------
230     PRINT " Territory_UpperCaseTable"
231    
232     SYS"Territory_UpperCaseTable", -1 TO table%
233     PROCtable(table%)
234    
235     REM------------------------------------------------------------
236     PRINT " Territory_ControlTable"
237    
238     SYS"Territory_ControlTable", -1 TO table%
239     PROCtable(table%)
240    
241     REM------------------------------------------------------------
242     PRINT " Territory_PlainTable"
243    
244     SYS"Territory_PlainTable", -1 TO table%
245     PROCtable(table%)
246    
247     REM------------------------------------------------------------
248     PRINT " Territory_ValueTable"
249    
250     SYS"Territory_ValueTable", -1 TO table%
251     PROCtable(table%)
252    
253     REM------------------------------------------------------------
254     PRINT " Territory_RepresentationTable"
255    
256     SYS"Territory_RepresentationTable", -1 TO table%
257     PRINT " ";
258     FOR i% = 0 TO 15
259     PRINT FNchar(table%?i%);
260     NEXT
261     PRINT
262    
263     REM------------------------------------------------------------
264    
265     END
266    
267     REM------------------------------------------------------------
268    
269     DEF FNstr(addr%)
270     LOCAL s$
271     WHILE ?addr% > 31
272     s$ += CHR$(?addr%)
273     addr% += 1
274     ENDWHILE
275     =s$
276    
277     REM------------------------------------------------------------
278    
279     DEF FNtime(z%)
280     LOCAL i%, s$
281     FOR i% = 4 TO 0 STEP -1
282     s$ += RIGHT$("0" + STR$~z%?i%, 2)
283     NEXT
284     =s$
285    
286     REM------------------------------------------------------------
287    
288     DEF PROCprinttime
289     b%?100 = 3
290     SYS"OS_Word", 14, b%+100
291     PRINT " 5-byte UTC time now: "; FNtime(b%+100)
292     ENDPROC
293    
294     REM------------------------------------------------------------
295    
296     DEF FNchar(c%)
297     IF c% < 33 OR c% = 127 THEN
298     ="[" + STR$~c% + "]"
299     ENDIF
300     =CHR$c%
301    
302     REM------------------------------------------------------------
303    
304     DEF PROCtable(table%)
305     LOCAL from$, to$, c%
306     FOR c% = 0 TO 255
307     IF table%?c% <> c% THEN
308     from$ += FNchar(c%)
309     to$ += FNchar(table%?c%)
310     ENDIF
311     IF LENto$ > 60 THEN
312     PRINT " "; from$
313     PRINT " "; to$
314     from$ = ""
315     to$ = ""
316     ENDIF
317     NEXT
318     PRINT " "; from$
319     PRINT " "; to$
320     ENDPROC

  ViewVC Help
Powered by ViewVC 1.1.26