]>
wirehaze git hosting - MS-DOS.git/blob - v2.0/source/CPARSE.ASM
15 DATARES
SEGMENT PUBLIC
18 TRANDATA
SEGMENT PUBLIC
22 TRANSPACE
SEGMENT PUBLIC
23 EXTRN CURDRV
:BYTE,ELPOS
:BYTE,STARTEL
:WORD
24 EXTRN SKPDEL
:BYTE,SWITCHAR
:BYTE,ELCNT
:BYTE
28 TRANCODE
SEGMENT PUBLIC BYTE
30 ASSUME
CS:TRANGROUP
,DS:TRANGROUP
,ES:TRANGROUP
32 EXTRN DELIM
:NEAR,UPCONV
:NEAR,PATHCHRCMP
:NEAR
33 EXTRN SWLIST
:BYTE,BADCDERR
:NEAR,SCANOFF
:NEAR,CERROR
:NEAR
45 ;-----------------------------------------------------------------------;
47 ; DS:SI Points input buffer ;
48 ; ES:DI Points to the token buffer ;
49 ; BL Special delimiter for this call ;
50 ; Always checked last ;
51 ; set it to space if there is no special delimiter ;
53 ; DS:SI Points to next char in the input buffer ;
54 ; ES:DI Points to the token buffer ;
55 ; [STARTEL] Points to start of last element of path in token ;
56 ; points to a NUL for no element strings 'd:' 'd:/' ;
57 ; CX Character count ;
59 ; Bit 1H of BH set if switch character ;
60 ; Token buffer contains char after ;
62 ; BP has switch bits set (ORing only) ;
63 ; Bit 2H of BH set if ? or * in token ;
64 ; if * found element ? filled ;
65 ; Bit 4H of BH set if path sep in token ;
66 ; Bit 80H of BH set if the special delimiter ;
67 ; was skipped at the start of this token ;
68 ; Token buffer always starts d: for non switch tokens ;
71 ; token buffer not altered ;
73 ; DOES NOT RETURN ON BAD PATH ERROR ;
75 ; CX, SI, AX, BH, DX and the Carry Flag ; ;
77 ; -----------------------------------------------------------------------;
80 mov [STARTEL
],DI ; No path element (Is DI correct?)
81 mov [ELPOS
],al ; Start in 8 char prefix
82 mov [SKPDEL
],al ; No skip delimiter yet
83 mov bh,al ; Init nothing
85 push di ; save the token buffer addrss
86 xor cx,cx ; no chars in token buffer
97 jz moredelim
; One non space/tab delimiter allowed
98 JMP x_done
; Nul argument
106 cmp al,bl ; Special delimiter?
116 cmp al,[SWITCHAR
] ; is the char the switch char?
117 jne na_switch
; yes, process...
120 cmp byte ptr [si],':'
121 jne anum_chard
; Drive not specified
136 mov [ELCNT
],0 ; Store of this char sets it to one
137 call PATHCHRCMP
; Starts with a pathchar?
140 mov al,[CURDRV
] ; Insert drive spec
163 inc [ELPOS
] ; flag in extension
164 mov [ELCNT
],0FFH ; Store of the '.' resets it to 0
194 test bh,2 ; If just hit a '/', cannot have ? or * yet
196 mov [STARTEL
],di ; New element
197 INC [STARTEL
] ; Point to char after /
198 mov [ELCNT
],0FFH ; Store of '/' sets it to 0
201 call move_char
; just an alphanum string
217 cmp al,':' ; ':' allowed as trailer because
227 mov byte ptr [si-1],' ' ; Change the trailing ':' to a space
231 mov dx,offset trangroup
:BADCPMES
238 dec si ; adjust the pointer
239 pop di ; retrive token buffer address
241 stc ; set the carry bit
245 dec si ; adjust for next round
249 OR BH,1 ; Indicate switch
255 call move_char
; store the character
263 MOV DI,OFFSET TRANGROUP
:SWLIST
277 stosb ; null at the end
278 pop di ; restore token buffer pointer
280 clc ; clear carry flag
284 stosb ; store char in token buffer
285 inc cx ; increment char count
286 inc [ELCNT
] ; increment element count for * substi