1 ;*******************************************************************
3 ;*******************************************************************
5 %OUT INCLUDING COMP=COMMON DSN=PSDATA.INC...;AN000;
8 ;**** Default assemble switches definition *************************
11 FarSW equ 0 ;AN000; Near call expected
15 DateSW equ 1 ;AN000; Check date format
19 TimeSW equ 1 ;AN000; Check time format
23 FileSW equ 1 ;AN000; Check file specification
27 CAPSW equ 1 ;AN000; Perform CAPS if specified
31 CmpxSW equ 1 ;AN000; Check complex list
35 NumSW equ 1 ;AN000; Check numeric value
39 KeySW equ 1 ;AN000; Support keywords
43 SwSW equ 1 ;AN000; Support switches
47 Val1SW equ 1 ;AN000; Support value definition 1
51 Val2SW equ 1 ;AN000; Support value definition 2
55 Val3SW equ 1 ;AN000; Support value definition 3
59 DrvSW equ 1 ;AN000; Support drive only format
63 QusSW equ 1 ;AN000; Support quoted string format
66 IFNDEF LFEOLSW ;AN028;
67 LFEOLSW EQU 1 ;AN028; Accept Line feed (0AH) as end of line
71 ;-------- Character code definition
73 $P_DBSP1 equ 81h ;AN000; 1st byte of DBCS blank
74 $P_DBSP2 equ 40h ;AN000; 2nd byte of DBCS blank
75 $P_Period equ "." ;AN020;
76 $P_Slash equ "/" ;AN020;
77 $P_Space equ " " ;AN000; SBCS blank
78 $P_Comma equ "," ;AN000;
79 $P_Switch equ "/" ;AN000;
80 $P_Keyword equ "=" ;AN000;
81 $P_Colon equ ":" ;AN000;
82 $P_Plus equ "+" ;AN000;
83 $P_Minus equ "-" ;AN000;
84 $P_Rparen equ ")" ;AN000;
85 $P_Lparen equ "(" ;AN000;
86 ;(deleted ;AN025;) $P_SQuote equ "'"
87 $P_DQuote equ '"' ;AN000;
92 $P_ASCII80 equ 80h ;AN000; ASCII 80h character code
95 $P_Make_Lower equ 20h ;AN000; make lower case character
96 $P_Make_Upper equ 0ffh-$P_Make_Lower ;AN000; make upper case character
99 ;-------- DOS function call related equs
101 $P_DOS_Get_CDI equ 3800h ;AN000; get country dependent information
102 ; by this call, following information
103 $P_CDI struc ;AN000; is returned.
104 $P_CDI_DateF dw 0 ;AN000;
105 $P_CDI_Money db 0,0,0,0,0 ;AN000;
106 $P_CDI_1000 db 0,0 ;AN000;
107 $P_CDI_Dec db 0,0 ;AN000;
108 $P_CDI_DateS db 0,0 ;AN000;
109 $P_CDI_TimeS db 0,0 ;AN000;
112 $P_CDI_TimeF db 0 ;AN000;
118 $P_Date_MDY equ 0 ;AN000;
119 $P_Date_DMY equ 1 ;AN000;
120 $P_Date_YMD equ 2 ;AN000;
122 $P_DOS_GetEV equ 6300h ;AN000; get DBCS EV call
123 ;AN000; DS:SI will points to DBCS EV
125 $P_DOS_Get_TBL equ 65h ;AN000; get uppercase table call
126 ;AN000; following parameters are set
127 ;AN000; to get casemap table.
128 $P_DOSTBL_Def equ -1 ;AN000; get default
129 $P_DOSTBL_BL equ 5 ;AN000; buffer length for Tbl pointer
130 $P_DOSTBL_File equ 4 ;AN000; get file uppercase table
131 $P_DOSTBL_Char equ 2 ;AN000; get character uppercase table
132 ; By this call following information
134 $P_DOS_TBL struc ;AN000;
135 $P_DOS_InfoID db 0 ;AN000; information id for the table
136 $P_DOS_TBL_Off dw 0 ;AN000; offset address of the table
137 $P_DOS_TBL_Seg dw 0 ;AN000; segment address of the table
138 $P_DOS_TBL ends ;AN000;
140 ;---------------------------------------------------------------------------------------------------------
143 ; DB 2 ; NUMBER OF STRINGS (0, 1, 2)
144 ; DB length ; LENGTH OF THE NEXT LIST, 0 IF NONE
145 ; DB " .. " ; EXTRA DELIMITER LIST,
146 ; ; TYPICAL ARE ";", "="
147 ; ; "," & WHITESPACE ALWAYS
148 ; DB length ; LENGTH OF THE NEXT LIST, 0 IF NONE
149 ; DB " .. " ; EXTRA END OF LINE LIST, CR, LF OR 0 ALWAYS
150 ;---------------------------------------------------------------------------------------------------------
152 ;-------------------------------- PARMS block structure
153 $P_PARMS_Blk struc ;AN000;
154 $P_PARMSX_Address dw 0 ;AN000; Address of PARMSX
155 $P_Num_Extra db 0 ;AN000; Number of extra stuff
156 $P_Len_Extra_Delim db 0 ;AN000; Length of extra delimiter
157 $P_PARMS_Blk ends ;AN000;
159 $P_Len_PARMS equ 4 ;AN000;
160 $P_I_Use_Default equ 0 ;AN000; no extra stuff specified
161 $P_I_Have_Delim equ 1 ;AN000; extra delimiter specified
162 $P_I_Have_EOL equ 2 ;AN000; extra EOL specified
164 ;---------------------------------------------------------------------------------------------------------
166 ; DB minp,maxp ; MIN, MAX POSITIONAL OPERANDS ALLOWED
167 ; DW CONTROL ; DESCRIPTION OF POSITIONAL 1
168 ; : ; REPEATS maxp-1 TIMES
169 ; DB maxs ; # OF SWITCHES
170 ; DW CONTROL ; DESCRIPTION OF SWITCH 1
171 ; : ; REPEATS maxs-1 TIMES
172 ; DB maxk ; # OF KEYWORD
173 ; DW CONTROL ; DESCRIPTION OF KEYWORD 1
174 ; : ; REPEATS maxk-1 TIMES
175 ;---------------------------------------------------------------------------------------------------------
177 ;-------------------------------- PARMSX block structure
178 $P_PARMSX_Blk struc ;AN000;
179 $P_MinP db 0 ;AN000; Minimum positional number
180 $P_Maxp db 0 ;AN000; Maximum positional number
181 $P_1st_Control dw 0 ;AN000; Address of the 1st CONTROL block
182 $P_PARMSX_Blk ends ;AN000;
184 ;---------------------------------------------------------------------------------------------------------
185 ; << Control field definition >>
189 ; DW MATCH_FLAGS ; CONTROLS TYPE MATCHED
190 ; ; 8000H=NUMERIC VALUE, (VALUE LIST WILL BE CHECKED)
191 ; ; 4000H=SIGNED NUMERIC VALUE (VALUE LIST WILL BE CHECKED)
192 ; ; 2000H=SIMPLE STRING(VALUE LIST WILL BE CHECKED)
193 ; ; 1000H=DATE STRING (VALUE LIST WON'T BE CHECKED)
194 ; ; 0800H=TIME STRING (VALUE LIST WON'T BE CHECKED)
195 ; ; 0400H=COMPLEX LIST (VALUE LIST WON'T BE CHECKED)
196 ; ; 0200H=FILE SPEC (VALUE LIST WON'T BE CHECKED)
197 ; ; 0100H=DRIVE ONLY (VALUE LIST WON'T BE CHECKED)
198 ; ; 0080H=QUOTED STRING (VALUE LIST WON'T BE CHECKED)
199 ; ; 0010H=IGNORE ":" AT END IN MATCH
200 ; ; 0002H=REPEATS ALLOWED
203 ; ; 0001H=CAP RESULT BY FILE TABLE
204 ; ; 0002H=CAP RESULT BY CHAR TABLE
205 ; ; 0010H=REMOVE ":" AT END
206 ; (tm10) ; 0020H=colon is not necessary for switch
207 ; DW RESULT ; RESULT BUFFER
208 ; DW VALUES ; VALUE LISTS
209 ; DB nid ; NUMBER OF KEYWORD/SWITCH SYNONYMS IN FOLLOWING LIST
210 ; DB "...",0 ; IF n >0, KEYWORD 1
214 ; - The MATCH_FLAG is bit significant. You can set, for example, TIME bit and
215 ; DATE bit simalteniously.
217 ; The parser examins each bit along with the following priority.
219 ; COMPLEX -> DATE -> TIME -> NUMERIC VAL -> SIGNED NUMERIC VAL -> DRIVE ->
220 ; FILE SPEC -> SIMPLE STRING.
223 ; - When the FUNCTION_FLAG is 0001 or 0002, the STRING pointed to by a pointer
224 ; in the result buffer is capitalized.
226 ; - Match_Flags 0001H and 0002H have meaning only for the positional.
229 ; - The "...",0 (bottom most line) does require '=' or '/'. When you need a
230 ; switch, for example, '/A', then STRING points to;
232 ; DB 1 ; number of following synonyms
235 ; When you need a keyword, for example, 'CODEPAGE=', then "...",0 will be;
237 ; DB 1 ; number of following synonyms
241 ; - "..." must consist of upper case characters only because the parser
242 ; performs pattern matching after converting input to upper case (by
243 ; using the current country upper case table)
246 ; - One "..." can contain only one switch or keyword. If you need, for
247 ; example /A and /B, the format will be;
249 ; DB 2 ; number of following synonyms
252 ;---------------------------------------------------------------------------------------------------------
256 $P_Num_Val equ 8000h ;AN000; Numeric Value
257 $P_SNum_Val equ 4000h ;AN000; Signed numeric value
258 $P_Simple_S equ 2000h ;AN000; Simple string
259 $P_Date_S equ 1000h ;AN000; Date string
260 $P_Time_S equ 0800h ;AN000; Time string
261 $P_Cmpx_S equ 0400h ;AN000; Complex string
262 $P_File_Spc equ 0200h ;AN000; File Spec
263 $P_Drv_Only equ 0100h ;AN000; Drive Only
264 $P_Qu_String equ 0080h ;AN000; Quoted string
265 $P_Ig_Colon equ 0010h ;AN000; Ignore colon at end in match
266 $P_Repeat equ 0002h ;AN000; Repeat allowed
267 $P_Optional equ 0001h ;AN000; Optional
271 $P_CAP_File equ 0001h ;AN000; CAP result by file table
272 $P_CAP_Char equ 0002h ;AN000; CAP result by character table
273 $P_Rm_Colon equ 0010h ;AN000; Remove ":" at the end
274 $P_colon_is_not_necessary equ 0020h ;AN000;(tm10) /+10 and /+:10
276 ;-------------------------------- Control block structure
277 $P_Control_Blk struc ;AN000;
278 $P_Match_Flag dw 0 ;AN000; Controls type matched
279 $P_Function_Flag dw 0 ;AN000; Function should be taken
280 $P_Result_Buf dw 0 ;AN000; Result buffer address
281 $P_Value_List dw 0 ;AN000; Value list address
282 $P_nid db 0 ;AN000; # of keyword/SW synonyms
283 $P_KeyorSW db 0 ;AN000; keyword or sw
284 $P_Control_Blk ends ;AN000;
286 ;---------------------------------------------------------------------------------------------------------
287 ; << Value List Definition >>
290 ; DB nval ; NUMBER OF VALUE DEFINITIONS (0 - 3)
292 ; ³ DB nrng ; NUMBER OF RANGES
293 ; ³ ÚDB ITEM_TAG ; RETURN VALUE IF RANGE MATCHED
294 ; ³ ÀDD X,Y ; RANGE OF VALUES
296 ; ³ DB nnval ; NUMBER OF CHOICES
297 ; ³ ÚDB ITEM_TAG ; RETURN VALUE IF NUMBER CHOICE MATCHED
298 ; ³ ÀDD VALUE ; SPECIFIC CHOICE IF NUMBER
300 ; ³ DB nstrval ; NUMBER OF CHOICES
301 ; ³ ÚDB ITEM_TAG ; RETURN VALUE IF STRING CHOICE MATCHED
302 ; ³ ÀDW STRING ; SPECIFIC CHOICE IF STING
305 ;STRING DB "...",0 ; ASCIIZ STRING IMAGE
308 ; - ITEM_TAG must not be 0FFH, which will be used in the result buffer
309 ; when no choice lists are provided.
311 ; - STRING must consist of upper case characters only because the parser
312 ; performs pattern matching after converting input to upper case (by
313 ; using the current country upper case table)
314 ;---------------------------------------------------------------------------------------------------------
316 $P_nval_None equ 0 ;AN000; no value list ID
317 $P_nval_Range equ 1 ;AN000; range list ID
318 $P_nval_Value equ 2 ;AN000; value list ID
319 $P_nval_String equ 3 ;AN000; string list ID
320 $P_Len_Range equ 9 ;AN000; Length of a range choice(two DD plus one DB)
321 $P_Len_Value equ 5 ;AN000; Length of a value choice(one DD plus one DB)
322 $P_Len_String equ 3 ;AN000; Length of a string choice(one DW plus one DB)
323 $P_No_nrng equ 0 ;AN000; (tm07) no nrng. nnval must not be 0.
325 $P_Val_List struc ;AN000;
326 $P_NumofList db 0 ;AN000; number of following choice
327 $P_Val_XL dw 0 ;AN000; lower word of value
328 $P_Val_XH dw 0 ;AN000; higher word of value
329 $P_Val_YL dw 0 ;AN000; lower word of another value
330 $P_Val_YH dw 0 ;AN000; higher word of another value
331 $P_Val_List ends ;AN000;
333 ;---------------------------------------------------------------------------------------------------------
334 ; << Result Buffer Definition >>
336 ;RESULT LABEL BYTE ; BELOW FILLED IN FOR DEFAULTS
337 ; DB type ; TYPE RETURNED: 0=RESERVED,
338 ; ; 1=NUMBER, 2=LIST INDEX,
339 ; ; 3=STRING, 4=COMPLEX,
340 ; ; 5=FILESPEC, 6=DRIVE
343 ; DB ITEM_TAG ; MATCHED ITEM TAG
345 ; dw synonym@ ; es:@ points to found SYNONYM if provided.
348 ; Ú DD n ; VALUE IF NUMBER
350 ; ³ DW i ; INDEX (OFFSET) INTO VALUE LIST
351 ; ³ ; (ES presents Segment address)
353 ; ³ DD STRING ; OFFSET OF STRING VALUE
355 ; ³ DB drv ; DRIVE NUMBER (1-A, 2-B,..., 26-Z)
357 ; ³ DW YEAR ;(1980-2099) IN CASE OF DATE
358 ; ³ DB MONTH ;(1-12) Note: Range check is not performed.
359 ; ³ DB DATE ;(1-31) 0 is filled when the corresponding field was not specified.
361 ; ³ DB HOUR ;(0-23) IN CASE OF TIME
362 ; ³ DB MINUTES ;(0-59) Note: Range check is not performed .
363 ; ³ DB SECONDS ;(0-59) 0 is filled when the corresponding field was not specified .
364 ; ³ DB HUNDREDTHS ;(0-99)
368 ;Note: ITEM_TAG is 0FFH when the caller does not specify the choice
371 ; YEAR: If the input value for the year is less than 100, parser
372 ; adds 1900 to it. For example, when 87 is input to parser for
373 ; the year value, he returns 1987.
374 ;---------------------------------------------------------------------------------------------------------
376 ;-------------------------------- Result block structure
377 $P_Result_Blk struc ;AN000;
378 $P_Type db 0 ;AN000; Type returned
379 $P_Item_Tag db 0 ;AN000; Matched item tag
380 $P_SYNONYM_Ptr dw 0 ;AN000; pointer to Synonym list returned
381 $P_Picked_Val db 0,0,0,0 ;AN000; value
382 $P_Result_Blk ends ;AN000;
383 ;--------------------------------
384 ;**** values for the type field in the result block
386 $P_EOL equ 0 ;AN000; End of line
387 $P_Number equ 1 ;AN000; Number
388 $P_List_Idx equ 2 ;AN000; List Index
389 $P_String equ 3 ;AN000; String
390 $P_Complex equ 4 ;AN000; Complex
391 $P_File_Spec equ 5 ;AN000; File Spec
392 $P_Drive equ 6 ;AN000; Drive
393 $P_Date_F equ 7 ;AN000; Date
394 $P_Time_F equ 8 ;AN000; Time
395 $P_Quoted_String equ 9 ;AN000; Quoted String
397 $P_No_Tag equ 0FFH ;AN000; No ITEM_TAG found
400 ; following return code will be returned in the AX register.
402 $P_No_Error equ 0 ;AN000; No error
403 $P_Too_Many equ 1 ;AN000; Too many operands
404 $P_Op_Missing equ 2 ;AN000; Required operand missing
405 $P_Not_In_SW equ 3 ;AN000; Not in switch list provided
406 $P_Not_In_Key equ 4 ;AN000; Not in keyword list provided
407 $P_Out_Of_Range equ 6 ;AN000; Out of range specified
408 $P_Not_In_Val equ 7 ;AN000; Not in value list provided
409 $P_Not_In_Str equ 8 ;AN000; Not in string list provided
410 $P_Syntax equ 9 ;AN000; Syntax error
411 $P_RC_EOL equ -1 ;AN000; End of command line
414 ;********************** Local Data *************************************
415 $P_ORDINAL dw 0 ;AN000; Operand ordinal save area
416 $P_RC dw 0 ;AN000; Return code from parser
417 $P_SI_Save dw 0 ;AN000; Pointer of command buffer
418 $P_DX dw 0 ;AN000; Return result buffer address
419 $P_Terminator db 0 ;AN000; Terminator code (ASCII)
420 $P_DBCSEV_OFF dw 0 ;AN000; Offset of DBCS EV
421 $P_DBCSEV_SEG dw 0 ;AN000; Segment of DBCS EV
422 $P_Flags dw 0 ;AN000; Parser internal flags
423 $P_Flags1 equ byte ptr $P_Flags ;AN038; to reference first byte flags
424 $P_Flags2 equ byte ptr $P_Flags+1 ;AN038; to reference second byte flags only
426 ;in second byte of $P_Flags, referenced as $P_Flags2:
427 $P_equ equ 01h ;AN000; "=" packed in string buffet
428 $P_Neg equ 02h ;AN000; Negative value
429 $P_Time12 equ 04h ;AN000; set when PM is specified
430 $P_Key_Cmp equ 08h ;AN000; set when keyword compare
431 $P_SW_Cmp equ 10h ;AN000; set when switch compare
432 $P_Extra equ 20h ;AN000; set when extra delimiter found
433 $P_SW equ 40h ;AN000; set when switch found (tm08)
434 $P_Signed equ 80h ;AN000; signed numeric specified
436 ;in first byte of $P_Flags, referenced as $P_Flags1:
437 $P_time12am equ 01h ;AN038; set when AM is specified on time
438 $P_TIME_AGAIN EQU 02H ;AN039; SET WHEN READY TO RE-PARSE TIME
440 $P_SaveSI_Cmpx dw 0 ;AN000; save si for later use by complex
441 $P_KEYorSW_Ptr dw 0 ;AN000; points next to "=" or ":" code
442 $P_Save_EOB dw 0 ;AN000; save pointer to EOB
443 $P_Found_SYNONYM dw 0 ;AN000; es:@ points to found synonym
445 $P_STRING_BUF db 128 dup(0) ;AN000; Pick a operand from command line
446 $P_STRING_BUF_END equ $ ;AN000;
447 IF TimeSw ;AN039; For TIME only
448 $P_ORIG_ORD DW 0 ;AN039; ORIGINAL ORDINAL FROM CX
449 $P_ORIG_STACK DW 0 ;AN039; ORIGINAL VALUE OF STACK FROM SP
450 $P_ORIG_SI DW 0 ;AN039; ORIGINAL START PARSE POINTER FROM SI
452 IF DateSw+TimeSw ;AN000;(Check if date or time format is supported)
453 ;------------------------------
455 $P_Got_Time db 0 ;AN023; if 1, use Time delimiters
456 $P_NeedToBeRead equ 0ffffh ;AN000;
458 $P_COUNTRY_INFO $P_CDI <$P_NeedToBeRead> ;AN000;
460 $P_1st_Val dw 0 ;AN000; used when process date or time
461 $P_2nd_Val dw 0 ;AN000; used when process date or time
462 $P_3rd_Val dw 0 ;AN000; used when process date or time
463 $P_4th_Val dw 0 ;AN000; used when process date or time
464 ;------------------------------
465 ENDIF ;AN000;(of DateSW+TimeSW)
466 $P_Char_CAP_Ptr db 0ffh ;AN000; info id
467 dw 0 ;AN000; offset of char case map table
468 dw 0 ;AN000; segment of char case map table
469 IF CAPSW ;AN000;(Check if uppercase conversion is supported)
470 $P_File_CAP_Ptr db 0ffh ;AN000; info id
471 dw 0 ;AN000; offset of file case map table
472 dw 0 ;AN000; segment of file case map table
473 ENDIF ;AN000;(of CAPSW)
474 ; (tm06) IF FileSW ;AN000;(Check if file spec is supported)
475 IF FileSW+DrvSW ;AN000;(Check if file spec is supported)
476 $P_FileSp_Char db '[]|<>+=;"' ;AN000; delimitter of file spec
477 $P_FileSp_Len equ $-$P_FileSp_Char ;AN000;
478 ENDIF ;AN000;(of FileSW)
479 ; (tm05) IF QusSW ;AN000;(Check if quoted string is supported)
480 ;(deleted ;AN025;) IF QusSW+CmpxSW ; (tm05) ;AN000;(Check if quoted string is supported)
481 ;(deleted ;AN025;) $P_SorD_Quote db 0 ;AN000; keep double or single quote
482 ;(deleted ;AN025;) ENDIF ;AN000;(of QueSW)
483 IF KeySW ;AN029; if keywords supported
484 $P_count_to_eol dw 0 ;AN029; count of chars not including EOL
485 ; REGISTER EQUATES - SPECIAL USAGE FOR REGISTERS
486 $P_REG_BH_CG_SW EQU BH ;AN029;0="NO CHANGES MADE", FF=CHANGES MADE
487 $P_REG_BL_DQ_SW EQU BL ;AN029;0=NOT IN QUOTES,FF=IN QUOTES
489 $P_DOUBLE_QUOTE EQU """" ;AN029;
490 $P_BL_EQ EQU " =" ;AN029;
491 $P_EQ_BL EQU "= " ;AN029;
492 $P_TB_EQ EQU 093DH ;AN029; ;"<TAB>="
493 $P_EQ_TB EQU 3D09H ;AN029; ;"=<TAB>"
494 ENDIF ;AN029; IF KeySW Supported
497 $P_colon_period equ 01 ;AN032; check for colon & period
498 $P_period_only equ 02 ;AN032; check only for period
501 $P_err_flag db 00 ;AN033; flag set if filespec parsing error
502 ;AN033; was detected.
503 $P_error_filespec equ 01 ;AN033; mask to set flag
504 ;***********************************************************************