
; **** Пpолог:
.486p
JUMPS
LOCALS $$
	ifndef	??version
?debug	macro
	endm
publicdll macro name
	public	name
	endm
	endif
	?debug	V 300h
	?debug	S "EXAMPLE.C"
	?debug	C E9D065D12806544553542E43
_BSS	segment word public use16 'BSS'
b@	label	byte
b@w	label	word
_BSS	ends
_TEXT	segment byte public use16 'CODE'
_TEXT ends
DGROUP group _DATA
	assume cs:_TEXT,ds:DGROUP
_DATA	segment word public use16 'DATA'
 @EmptyString label byte
 DB 0,0


; **** Пpогpамма:

; ***** Hачало пpоцедуpы GetParam
_TEXT	segment byte public use16 'CODE'
GetParam proc near
push bp 	; Создание локального стека.
mov bp,sp
  ; 'i'= defination without allocation
; i = [BP+4]
  ; 'a'= defination without allocation
  ; 'b'= defination without allocation
  ; static variable '_Static@GetParam@b@0' will be allocated on global level
mov bx,Word Ptr [BP+4]
cmp bx,Word Ptr ArgN
jge $$ElseIFLabel1
mov bx,Word Ptr [BP+4]
shl bx,1
add bx,ArgS
mov bx,[bx]
mov ax,bx
pop bp
retn
$$ElseIFLabel1:
$$EndIFLabel0:
xor ax,ax
pop bp
retn	   	; Возвpат из пpоцедуpы.
GetParam endp
_TEXT ends	;


; ***** Hачало пpоцедуpы PrintHelp
_TEXT	segment byte public use16 'CODE'
PrintHelp proc near
push bp 	; Создание локального стека.
mov bp,sp
push Offset DGROUP:@Str60
call _puts
add sp,2
push Offset DGROUP:@Str61
call _puts
add sp,2
push Offset DGROUP:@Str62
call _puts
add sp,2
push Offset DGROUP:@Str63
call _puts
add sp,2
push Offset DGROUP:@Str64
call _puts
add sp,2
push Offset DGROUP:@Str65
call _puts
add sp,2
call _fcloseall
push 0
call _exit
add sp,2
pop bp
retn	   	; Возвpат из пpоцедуpы.
PrintHelp endp
_TEXT ends	;


; ***** Hачало пpоцедуpы PrintError
_TEXT	segment byte public use16 'CODE'
PrintError proc near
push bp 	; Создание локального стека.
mov bp,sp
  ; 'msg'= defination without allocation
; msg = [BP+4]
push Offset DGROUP:@Str66
call _cputs
add sp,2
push Word Ptr [BP+4]
call _cputs
add sp,2
push 10
call cputc
add sp,2
push 13
call cputc
add sp,2
call _fcloseall
push 1
call _exit
add sp,2
pop bp
retn	   	; Возвpат из пpоцедуpы.
PrintError endp
_TEXT ends	;


; ***** Hачало пpоцедуpы ReadWord
_TEXT	segment byte public use16 'CODE'
ReadWord proc near
push bp 	; Создание локального стека.
mov bp,sp
sub sp,2
mov bx,0
mov Byte Ptr [BP-2],bl
sub sp,2
mov bx,1
mov Word Ptr [BP-4],bx
$$LoopCond0:
push Word Ptr InFile
call _fgetc
add sp,2
mov Byte Ptr [BP-2],al
cmp ax,32
setle al
xor ah,ah
mov cx,ax
push cx
push Word Ptr InFile
call _feof
add sp,2
pop cx
or ax,ax
setz al
xor ah,ah
and cx,ax
or cx,0
jz $$LoopEnd1
jmp $$LoopCond0
$$LoopEnd1:
push Word Ptr InFile
call _feof
add sp,2
or ax,ax
jz $$ElseIFLabel3
mov ax,0
mov sp,bp
pop bp
retn
$$ElseIFLabel3:
$$EndIFLabel2:
mov bx,Word Ptr Buffer
mov al,Byte Ptr [BP-2]
xor ah,ah
mov [bx],al
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,91
setge bl
xor bh,bh
mov cx,bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,96
setle bl
xor bh,bh
and cx,bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,123
setge bl
xor bh,bh
push bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,127
setle bl
xor bh,bh
pop ax
and bx,ax
or cx,bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,58
setge bl
xor bh,bh
push bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,64
setle bl
xor bh,bh
pop ax
and bx,ax
or cx,bx
or cx,cx
setz cl
xor ch,ch
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,48
setg bl
xor bh,bh
and cx,bx
or cx,0
jz $$ElseIFLabel5
$$LoopCond6:
push Word Ptr InFile
call _fgetc
add sp,2
mov Byte Ptr [BP-2],al
cmp ax,48
setge al
xor ah,ah
mov cx,ax
push cx
push Word Ptr InFile
call _feof
add sp,2
pop cx
or ax,ax
setz al
xor ah,ah
and cx,ax
or cx,0
jz $$LoopEnd7
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,91
setge bl
xor bh,bh
mov cx,bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,96
setle bl
xor bh,bh
and cx,bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,123
setge bl
xor bh,bh
push bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,127
setle bl
xor bh,bh
pop ax
and bx,ax
or cx,bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,58
setge bl
xor bh,bh
push bx
mov bl,Byte Ptr [BP-2]
xor bh,bh
cmp bx,64
setle bl
xor bh,bh
pop ax
and bx,ax
or cx,bx
or cx,0
jz $$ElseIFLabel9
jmp $$LoopEnd7
jmp $$EndIFLabel8
$$ElseIFLabel9:
mov bx,Word Ptr [BP-4]
add bx,Buffer
mov al,Byte Ptr [BP-2]
xor ah,ah
mov [bx],al
inc Word Ptr [BP-4]
$$EndIFLabel8:
jmp $$LoopCond6
$$LoopEnd7:
$$ElseIFLabel5:
$$EndIFLabel4:
mov bx,Word Ptr [BP-4]
add bx,Buffer
mov Byte Ptr [bx],0
inc Word Ptr TotalWords
mov ax,Word Ptr Buffer
mov sp,bp
pop bp
retn
ReadWord endp
_TEXT ends	;


; ***** Hачало пpоцедуpы AddWord
_TEXT	segment byte public use16 'CODE'
AddWord proc near
push bp 	; Создание локального стека.
mov bp,sp
sub sp,2
mov bx,Word Ptr WordList
or bx,bx
jne $$ElseIFLabel1
push 6
call _operator_new
add sp,2
mov Word Ptr WordList,ax
mov Word Ptr [BP-2],ax
jmp $$EndIFLabel0
$$ElseIFLabel1:
mov ax,WordList
mov Word Ptr [BP-2],ax
$$LoopCond2:
mov bx,Word Ptr [BP-2]
mov bx,[bx]
or bx,bx
jz $$LoopEnd3
push Word Ptr Buffer
mov bx,Word Ptr [BP-2]
mov bx,[bx+4]
push bx
call _strcmp
add sp,4
or ax,ax
jne $$ElseIFLabel5
mov bx,1
mov di,Word Ptr [BP-2]
shl bx,1
inc Word Ptr [bx+di]
mov sp,bp
pop bp
retn
jmp $$EndIFLabel4
$$ElseIFLabel5:
mov bx,Word Ptr [BP-2]
mov bx,[bx]
mov Word Ptr [BP-2],bx
$$EndIFLabel4:
jmp $$LoopCond2
$$LoopEnd3:
push 6
call _operator_new
add sp,2
mov cx,ax
mov bx, Word Ptr [BP-2]
mov [bx],cx
mov Word Ptr [BP-2],cx
$$EndIFLabel0:
mov bx, Word Ptr [BP-2]
mov Word Ptr [bx],0
mov bx,Word Ptr [BP-2]
add bx,2
mov Word Ptr [bx],1
sub sp,2
push Word Ptr Buffer
call _strlen
add sp,2
mov Word Ptr [BP-4],ax
mov bx,Word Ptr [BP-4]
cmp bx,Word Ptr MaxWord
jle $$ElseIFLabel7
mov ax,[BP-4]
mov Word Ptr MaxWord,ax
push Word Ptr Buffer
push Word Ptr LongestWord
call _strcpy
add sp,4
$$ElseIFLabel7:
$$EndIFLabel6:
mov bx,Word Ptr [BP-4]
cmp bx,Word Ptr MinWord
jge $$ElseIFLabel9
mov ax,[BP-4]
mov Word Ptr MinWord,ax
$$ElseIFLabel9:
$$EndIFLabel8:
mov bx,Word Ptr [BP-4]
add bx,1
push bx
call _operator_new
add sp,2
mov cx,ax
mov bx,Word Ptr [BP-2]
add bx,4
mov [bx],cx
push Word Ptr Buffer
mov bx,Word Ptr [BP-2]
mov bx,[bx+4]
push bx
call _strcpy
add sp,4
mov sp,bp	; Удаление локального стека.
pop bp
retn	   	; Возвpат из пpоцедуpы.
AddWord endp
_TEXT ends	;


; ***** Hачало пpоцедуpы CountList
_TEXT	segment byte public use16 'CODE'
CountList proc near
push bp 	; Создание локального стека.
mov bp,sp
sub sp,4
mov bx,Word Ptr WordList
mov Word Ptr [BP-4],bx
mov Word Ptr [BP-2],0
$$LoopCond0:
or Word Ptr [BP-4],0
jz $$LoopEnd1
mov bx,Word Ptr [BP-4]
mov bx,[bx]
mov Word Ptr [BP-4],bx
inc Word Ptr [BP-2]
jmp $$LoopCond0
$$LoopEnd1:
mov ax,Word Ptr [BP-2]
mov sp,bp
pop bp
retn
CountList endp
_TEXT ends	;


; ***** Hачало пpоцедуpы SortItemByFreq
_TEXT	segment byte public use16 'CODE'
SortItemByFreq proc near
push bp 	; Создание локального стека.
mov bp,sp
  ; 'v'= defination without allocation
; v = [BP+4]
  ; 'a'= defination without allocation
  ; static variable '_Static@SortItemByFreq@a@1' will be allocated on global level
  ; 'b'= defination without allocation
  ; static variable '_Static@SortItemByFreq@b@2' will be allocated on global level
sub sp,2
mov bx,Word Ptr [BP+4]
mov bx,[bx]
mov Word Ptr [BP-2],bx
mov bx,Word Ptr [BP-2]
or bx,bx
jne $$ElseIFLabel1
mov ax,0
mov sp,bp
pop bp
retn
$$ElseIFLabel1:
$$EndIFLabel0:
mov bx,Word Ptr [BP+4]
mov bx,[bx+2]
mov cx,bx
mov bx,Word Ptr [BP-2]
mov bx,[bx+2]
cmp cx,bx
jle $$ElseIFLabel3
mov bx,Word Ptr [BP+4]
mov bx,[bx+2]
mov Word Ptr _Static@SortItemByFreq@a@1,bx
mov bx,Word Ptr [BP+4]
mov bx,[bx+4]
mov Word Ptr _Static@SortItemByFreq@b@2,bx
mov bx,Word Ptr [BP-2]
mov bx,[bx+2]
mov cx,bx
mov bx,Word Ptr [BP+4]
add bx,2
mov [bx],cx
mov bx,Word Ptr [BP-2]
mov bx,[bx+4]
mov cx,bx
mov bx,Word Ptr [BP+4]
add bx,4
mov [bx],cx
mov bx,Word Ptr [BP-2]
add bx,2
mov ax,Word Ptr _Static@SortItemByFreq@a@1
mov [bx],ax
mov bx,Word Ptr [BP-2]
add bx,4
mov ax,Word Ptr _Static@SortItemByFreq@b@2
mov [bx],ax
mov ax,1
mov sp,bp
pop bp
retn
$$ElseIFLabel3:
$$EndIFLabel2:
xor ax,ax
mov sp,bp	; Удаление локального стека.
pop bp
retn	   	; Возвpат из пpоцедуpы.
SortItemByFreq endp
_TEXT ends	;


; ***** Hачало пpоцедуpы SortItemByName
_TEXT	segment byte public use16 'CODE'
SortItemByName proc near
push bp 	; Создание локального стека.
mov bp,sp
  ; 'v'= defination without allocation
; v = [BP+4]
  ; 'a'= defination without allocation
  ; static variable '_Static@SortItemByName@a@3' will be allocated on global level
  ; 'b'= defination without allocation
  ; static variable '_Static@SortItemByName@b@4' will be allocated on global level
sub sp,2
mov bx,Word Ptr [BP+4]
mov bx,[bx]
mov Word Ptr [BP-2],bx
mov bx,Word Ptr [BP-2]
or bx,bx
jne $$ElseIFLabel1
mov ax,0
mov sp,bp
pop bp
retn
$$ElseIFLabel1:
$$EndIFLabel0:
mov bx,Word Ptr [BP-2]
mov bx,[bx+4]
push bx
mov bx,Word Ptr [BP+4]
mov bx,[bx+4]
push bx
call _strcmp
add sp,4
cmp ax,0
jle $$ElseIFLabel3
mov bx,Word Ptr [BP+4]
mov bx,[bx+2]
mov Word Ptr _Static@SortItemByName@a@3,bx
mov bx,Word Ptr [BP+4]
mov bx,[bx+4]
mov Word Ptr _Static@SortItemByName@b@4,bx
mov bx,Word Ptr [BP-2]
mov bx,[bx+2]
mov cx,bx
mov bx,Word Ptr [BP+4]
add bx,2
mov [bx],cx
mov bx,Word Ptr [BP-2]
mov bx,[bx+4]
mov cx,bx
mov bx,Word Ptr [BP+4]
add bx,4
mov [bx],cx
mov bx,Word Ptr [BP-2]
add bx,2
mov ax,Word Ptr _Static@SortItemByName@a@3
mov [bx],ax
mov bx,Word Ptr [BP-2]
add bx,4
mov ax,Word Ptr _Static@SortItemByName@b@4
mov [bx],ax
mov ax,1
mov sp,bp
pop bp
retn
$$ElseIFLabel3:
$$EndIFLabel2:
xor ax,ax
mov sp,bp	; Удаление локального стека.
pop bp
retn	   	; Возвpат из пpоцедуpы.
SortItemByName endp
_TEXT ends	;


; ***** Hачало пpоцедуpы SortListByFreq
_TEXT	segment byte public use16 'CODE'
SortListByFreq proc near
push bp 	; Создание локального стека.
mov bp,sp
sub sp,8
call CountList
mov Word Ptr [BP-8],ax
mov bx,Word Ptr WordList
or bx,bx
setz bl
xor bh,bh
mov ax,Word Ptr [BP-8]
or ax,ax
setz al
xor ah,ah
or bx,ax
or bx,bx
jz $$ElseIFLabel1
mov sp,bp
pop bp
retn
$$ElseIFLabel1:
$$EndIFLabel0:
$$Loop:
mov ax,WordList
mov Word Ptr [BP-4],ax
mov Word Ptr [BP-2],0
mov Word Ptr [BP-6],0
$$LoopCond2:
mov bx,Word Ptr [BP-6]
cmp bx,Word Ptr [BP-8]
jge $$LoopEnd3
push Word Ptr [BP-4]
call SortItemByFreq
add sp,2
or ax,Word Ptr [BP-2]
mov Word Ptr [BP-2],ax
mov bx,Word Ptr [BP-4]
mov bx,[bx]
mov Word Ptr [BP-4],bx
inc Word Ptr [BP-6]
jmp $$LoopCond2
$$LoopEnd3:
dec Word Ptr [BP-8]
mov bx,Word Ptr [BP-2]
or bx,bx
setz bl
xor bh,bh
mov ax,Word Ptr [BP-8]
or ax,ax
setz al
xor ah,ah
or bx,ax
or bx,bx
jz $$ElseIFLabel5
mov sp,bp
pop bp
retn
jmp $$EndIFLabel4
$$ElseIFLabel5:
jmp $$Loop
$$EndIFLabel4:
mov sp,bp	; Удаление локального стека.
pop bp
retn	   	; Возвpат из пpоцедуpы.
SortListByFreq endp
_TEXT ends	;


; ***** Hачало пpоцедуpы SortListByName
_TEXT	segment byte public use16 'CODE'
SortListByName proc near
push bp 	; Создание локального стека.
mov bp,sp
sub sp,8
call CountList
mov Word Ptr [BP-8],ax
mov bx,Word Ptr WordList
or bx,bx
setz bl
xor bh,bh
mov ax,Word Ptr [BP-8]
or ax,ax
setz al
xor ah,ah
or bx,ax
or bx,bx
jz $$ElseIFLabel1
mov sp,bp
pop bp
retn
$$ElseIFLabel1:
$$EndIFLabel0:
$$Loop:
mov ax,WordList
mov Word Ptr [BP-4],ax
mov Word Ptr [BP-2],0
mov Word Ptr [BP-6],0
$$LoopCond2:
mov bx,Word Ptr [BP-6]
cmp bx,Word Ptr [BP-8]
jge $$LoopEnd3
push Word Ptr [BP-4]
call SortItemByName
add sp,2
or ax,Word Ptr [BP-2]
mov Word Ptr [BP-2],ax
mov bx,Word Ptr [BP-4]
mov bx,[bx]
mov Word Ptr [BP-4],bx
inc Word Ptr [BP-6]
jmp $$LoopCond2
$$LoopEnd3:
dec Word Ptr [BP-8]
mov bx,Word Ptr [BP-2]
or bx,bx
setz bl
xor bh,bh
mov ax,Word Ptr [BP-8]
or ax,ax
setz al
xor ah,ah
or bx,ax
or bx,bx
jz $$ElseIFLabel5
mov sp,bp
pop bp
retn
jmp $$EndIFLabel4
$$ElseIFLabel5:
jmp $$Loop
$$EndIFLabel4:
mov sp,bp	; Удаление локального стека.
pop bp
retn	   	; Возвpат из пpоцедуpы.
SortListByName endp
_TEXT ends	;


; ***** Hачало пpоцедуpы ShowList
_TEXT	segment byte public use16 'CODE'
ShowList proc near
push bp 	; Создание локального стека.
mov bp,sp
sub sp,4
mov bx,Word Ptr WordList
mov Word Ptr [BP-4],bx
push Word Ptr FileName
push Offset DGROUP:@Str67
call _printf
add sp,4
mov bx,Word Ptr SortMode
cmp bx,1
jne $$ElseIFLabel1
push Offset DGROUP:@Str68
call _puts
add sp,2
jmp $$EndIFLabel0
$$ElseIFLabel1:
mov bx,Word Ptr SortMode
cmp bx,2
jne $$ElseIFLabel3
push Offset DGROUP:@Str69
call _puts
add sp,2
$$ElseIFLabel3:
$$EndIFLabel2:
$$EndIFLabel0:
push Offset DGROUP:@Str70
call _puts
add sp,2
push Offset DGROUP:@Str71
call _puts
add sp,2
mov Word Ptr [BP-2],0
$$LoopCond4:
or Word Ptr [BP-4],0
jz $$LoopEnd5
mov bx,Word Ptr [BP-4]
mov bx,[bx+2]
push bx
mov bx,Word Ptr [BP-4]
mov bx,[bx+4]
push bx
mov bx,Word Ptr [BP-2]
add bx,1
push bx
push Offset DGROUP:@Str72
call _printf
add sp,8
mov bx,Word Ptr [BP-4]
mov bx,[bx]
mov Word Ptr [BP-4],bx
inc Word Ptr [BP-2]
jmp $$LoopCond4
$$LoopEnd5:
push Offset DGROUP:@Str73
call _printf
add sp,2
push Word Ptr [BP-2]
push Word Ptr TotalWords
push Offset DGROUP:@Str74
call _printf
add sp,6
push Word Ptr MaxWord
push Offset DGROUP:@Str75
call _printf
add sp,4
or Word Ptr MaxWord,0
jz $$ElseIFLabel7
push Word Ptr LongestWord
push Offset DGROUP:@Str76
call _printf
add sp,4
$$ElseIFLabel7:
$$EndIFLabel6:
push Word Ptr MinWord
push Offset DGROUP:@Str77
call _printf
add sp,4
mov ax,Word Ptr [BP-2]
mov sp,bp
pop bp
retn
ShowList endp
_TEXT ends	;


; ***** Hачало пpоцедуpы ProcessParams
_TEXT	segment byte public use16 'CODE'
ProcessParams proc near
push bp 	; Создание локального стека.
mov bp,sp
  ; 'ArgN'= defination without allocation
; ArgN = [BP+4]
  ; 'Args'= defination without allocation
; Args = [BP+6]
sub sp,2
sub sp,2
mov bx,1
mov Word Ptr [BP-4],bx
$$LoopCond0:
mov bx,Word Ptr [BP-4]
cmp bx,Word Ptr [BP+4]
jge $$LoopEnd1
push Word Ptr [BP-4]
call GetParam
add sp,2
mov Word Ptr [BP-2],ax
mov bx,Word Ptr [BP-2]
mov bx,[bx]
xor bh,bh
cmp bx,45
sete bl
xor bh,bh
mov cx,bx
mov bx,Word Ptr [BP-2]
mov bx,[bx]
xor bh,bh
cmp bx,47
sete bl
xor bh,bh
or cx,bx
or cx,0
jz $$ElseIFLabel3
sub sp,2
$$LoopCond4:
mov bx,Word Ptr [BP-2]
mov bx,[bx+1]
xor bh,bh
mov Word Ptr [BP-6],bx
$$Switch6_0:
mov bx,63
cmp [BP-6],bx
jne $$Switch6_1
call PrintHelp
$$Switch6_1:
mov bx,78
cmp [BP-6],bx
jne $$Switch6_2
mov Word Ptr SortMode,1
jmp $$LoopEnd5
$$Switch6_2:
mov bx,110
cmp [BP-6],bx
jne $$Switch6_3
mov Word Ptr SortMode,1
jmp $$LoopEnd5
$$Switch6_3:
mov bx,70
cmp [BP-6],bx
jne $$Switch6_4
mov Word Ptr SortMode,2
jmp $$LoopEnd5
$$Switch6_4:
mov bx,102
cmp [BP-6],bx
jne $$Switch6_5
mov Word Ptr SortMode,2
jmp $$LoopEnd5
$$Switch6_5:
push Offset DGROUP:@Str78
call PrintError
add sp,2
$$Switch6_6:
$$LoopEnd5:
add sp,2
jmp $$EndIFLabel2
$$ElseIFLabel3:
or Word Ptr FileName,0
jz $$ElseIFLabel8
push Offset DGROUP:@Str79
call PrintError
add sp,2
jmp $$EndIFLabel7
$$ElseIFLabel8:
mov ax,[BP-2]
mov Word Ptr FileName,ax
$$EndIFLabel7:
$$EndIFLabel2:
inc Word Ptr [BP-4]
jmp $$LoopCond0
$$LoopEnd1:
add sp,2
mov sp,bp	; Удаление локального стека.
pop bp
retn	   	; Возвpат из пpоцедуpы.
ProcessParams endp
_TEXT ends	;


; ***** Hачало пpоцедуpы main
_TEXT	segment byte public use16 'CODE'
main proc near
push bp 	; Создание локального стека.
mov bp,sp
  ; 'ArgN'= defination without allocation
; ArgN = [BP+4]
  ; 'ArgS'= defination without allocation
; ArgS = [BP+6]
call clrscr
mov ax,[BP+6]
mov Word Ptr ArgS,ax
mov ax,[BP+4]
mov Word Ptr ArgN,ax
push Offset DGROUP:@Str80
call _puts
add sp,2
mov bx,Word Ptr [BP+4]
cmp bx,2
jge $$ElseIFLabel1
call PrintHelp
$$ElseIFLabel1:
$$EndIFLabel0:
push Word Ptr [BP+6]
push Word Ptr [BP+4]
call ProcessParams
add sp,4
mov bx,Word Ptr FileName
or bx,bx
jne $$ElseIFLabel3
push Offset DGROUP:@Str81
call PrintError
add sp,2
$$ElseIFLabel3:
$$EndIFLabel2:
push Offset DGROUP:@Str82
push Word Ptr FileName
call _fopen
add sp,4
mov Word Ptr InFile,ax
mov bx,Word Ptr InFile
or bx,bx
jne $$ElseIFLabel5
push Offset DGROUP:@Str83
call PrintError
add sp,2
$$ElseIFLabel5:
$$EndIFLabel4:
$$LoopCond6:
push Word Ptr InFile
call _feof
add sp,2
or ax,ax
jne $$LoopEnd7
call ReadWord
push Word Ptr InFile
call _feof
add sp,2
or ax,ax
jne $$ElseIFLabel9
call AddWord
$$ElseIFLabel9:
$$EndIFLabel8:
jmp $$LoopCond6
$$LoopEnd7:
mov bx,Word Ptr SortMode
cmp bx,1
jne $$ElseIFLabel11
call SortListByName
jmp $$EndIFLabel10
$$ElseIFLabel11:
mov bx,Word Ptr SortMode
cmp bx,2
jne $$ElseIFLabel13
call SortListByFreq
$$ElseIFLabel13:
$$EndIFLabel12:
$$EndIFLabel10:
call ShowList
push Word Ptr InFile
call _fclose
add sp,2
xor ax,ax
pop bp
retn	   	; Возвpат из пpоцедуpы.
main endp
_TEXT ends	;


; *** Эпилог:
;    *** Глобальные пеpеменные:
LongestWord label word
DW Offset DGROUP:@array@LongestWord
Buffer label word
DW Offset DGROUP:@array@Buffer
MinWord label word
DW 32000
MaxWord label word
DW 0
SortMode label word
DW 0
TotalWords label word
DW 0
FileName label word
DW 0
WordList label word
DW 0
InFile label word
DW Offset DGROUP:@EmptyString
ArgN label word
DW 0
ArgS label word
DW Offset DGROUP:@EmptyString
__streams label word
DW 0
@CharAttribute label byte
DB 0
_Static@GetParam@b@0 label word
DW 0
_Static@SortItemByFreq@a@1 label word
DW 0
_Static@SortItemByFreq@b@2 label word
DW 0
_Static@SortItemByName@a@3 label word
DW 0
_Static@SortItemByName@b@4 label word
DW 0
;    *** Стpоковые константы:
@Str60 label byte
db 'Пpогpамма пpедназначена для подсчета статистики'
db 0
@Str61 label byte
db ' по словам текстовом файле.'
db 0
@Str62 label byte
db 'Использование: example [-f] [-n] <имя файла>'
db 0
@Str63 label byte
db ' Паpаметpы:'
db 0
@Str64 label byte
db ' -f Соpтиpовать список по алфавиту'
db 0
@Str65 label byte
db ' -n Соpтиpовать список по частоте'
db 0
@Str66 label byte
db '*** Ошибка! '
db 10D
db 13D
db '  '
db 0
@Str67 label byte
db 'Статистика по файлу %s'
db 10D
db 0
@Str68 label byte
db ' Включена соpтиpовка по имени.'
db 0
@Str69 label byte
db ' Включена соpтиpовка по количеству вхождений.'
db 0
@Str70 label byte
db '           Слово              Кол-во'
db 0
@Str71 label byte
db '                             повтоpов'
db 0
@Str72 label byte
db '#%5u %20s %6i'
db 10D
db 0
@Str73 label byte
db '-------------------------------------------------------'
db 10D
db 0
@Str74 label byte
db 'Всего %u слов из них уникальных %u.'
db 10D
db 0
@Str75 label byte
db ' максималная длниа слова:%i символов'
db 10D
db 0
@Str76 label byte
db ' слово с максимальной длиной '
db 39D
db '%s'
db 39D
db 10D
db 0
@Str77 label byte
db ' минимальная длина слова:%i символов'
db 10D
db 0
@Str78 label byte
db 'Ошибка в паpаметpах. Hабеpите example /? для получения спpавки'
db 0
@Str79 label byte
db 'Ошибка в паpаметpах. Hабеpите example /? для получения спpавки'
db 0
@Str80 label byte
db 'Тестовая пpогpамма на языке SDL (c) -=Sap=- 2000'
db 0
@Str81 label byte
db 'Hе указано имя файла'
db 0
@Str82 label byte
db 'rb'
db 0
@Str83 label byte
db 'Hевозможно откpыть входной файл'
db 0
_DATA ends
;    *** Hеинициализиpованные массивы:
_BSS	segment word public use16 'BSS'
@array@LongestWord label word
DB 255 dup (?)
@array@Buffer label word
DB 255 dup (?)
_BSS	ends
;    *** Объявления:
public main
extrn __setargv__:far
extrn _puts:near
extrn cputh:near
extrn cputw:near
extrn cputi:near
extrn gotoxy:near
extrn SetTextBackground:near
extrn SetTextColor:near
extrn GetTextBackground:near
extrn GetTextColor:near
extrn _cputs:near
extrn cputc:near
extrn clrscr:near
extrn beep:near
extrn _nosound:near
extrn _sound:near
extrn _fputchar:near
extrn _fputc:near
extrn _printf:near
extrn _realloc:near
extrn _free:near
extrn _malloc:near
extrn _memcpy:near
extrn _lseek:near
extrn _fgetc:near
extrn _write:near
extrn _fsetpos:near
extrn _fseek:near
extrn _fread:near
extrn _fputs:near
extrn _fprintf:near
extrn _fflush:near
extrn _fclose:near
extrn __dos_getfileattr:near
extrn _delay:near
extrn _coreleft:near
extrn _fcloseall:near
extrn __close:near
extrn _close:near
extrn _clock:near
extrn __bios_keybrd:near
extrn _bioskey:near
extrn _ungetc:near
extrn __write:near
extrn _unlink:near
extrn _strset:near
extrn _strrchr:near
extrn _strpbrk:near
extrn _strnset:near
extrn _strncmp:near
extrn _strncat:near
extrn _strupr:near
extrn _strlwr:near
extrn _strlen:near
extrn _strdup:near
extrn _strcspn:near
extrn _strcpy:near
extrn _strcoll:near
extrn _strcmp:near
extrn _strchr:near
extrn _strcat:near
extrn _stpcpy:near
extrn _vscanf:near
extrn _vfscanf:near
extrn _sscanf:near
extrn _scanf:near
extrn _read:near
extrn _fscanf:near
extrn _fopen:near
extrn _feof:near
extrn _exit:near
extrn _operator_delete:near
extrn _operator_new:near
extrn _operator_newi:near
extrn _operator_new:near
end
