diff --git a/BIN/DWEDOVL.EXE b/BIN/DWEDOVL.EXE index 7f6bd4c..cb73c39 100644 Binary files a/BIN/DWEDOVL.EXE and b/BIN/DWEDOVL.EXE differ diff --git a/BIN/DWEDOVLP.EXE b/BIN/DWEDOVLP.EXE index 8fb3a5c..87cf2fe 100644 Binary files a/BIN/DWEDOVLP.EXE and b/BIN/DWEDOVLP.EXE differ diff --git a/SRC/DWED.PAS b/SRC/DWED.PAS index 5d4c904..30ca10c 100644 --- a/SRC/DWED.PAS +++ b/SRC/DWED.PAS @@ -29,4 +29,4 @@ const exename : string = 'DWEDOVL.EXE'; begin launcher(exename); -end. \ No newline at end of file +end. diff --git a/SRC/DWED16.PAS b/SRC/DWED16.PAS index a23a889..ebbe699 100644 --- a/SRC/DWED16.PAS +++ b/SRC/DWED16.PAS @@ -29,4 +29,4 @@ const exename : string = 'DWEDOVLP.EXE'; begin launcher(exename); -end. \ No newline at end of file +end. diff --git a/SRC/DWEDADDO.PAS b/SRC/DWEDADDO.PAS index 43c6975..deddd2f 100644 --- a/SRC/DWEDADDO.PAS +++ b/SRC/DWEDADDO.PAS @@ -84,12 +84,11 @@ end; const ascii_tbl_sel : byte = 0; procedure ascii_table(var ctx : TEditorContext); -var x, y, i, j : integer; - b : boolean; - color : byte; - cb : byte; - ch : char; - e : TEvent; +var x, y, i, j : integer; + b : boolean; + color, cb : byte; + ch : char; + e : TEvent; begin x := (scr.getwidth - 50) shr 1; y := (scr.getheight - 22) shr 1; scrui.box(x, y, 50, 22, $1b); @@ -167,7 +166,7 @@ calc_op : char = ' '; radix : RadixType = RADIX10; procedure calculator(var ctx : TEditorContext); -var x, y, i : integer; +var x, y, i : integer; key : word; ch : char; insertStr : string; diff --git a/SRC/DWEDHELP.PAS b/SRC/DWEDHELP.PAS index 19bd650..f6dac3e 100644 --- a/SRC/DWEDHELP.PAS +++ b/SRC/DWEDHELP.PAS @@ -120,12 +120,11 @@ begin end; procedure init; -var t : PHelpTopicList; - maxlen : integer; - len : integer; - totallen : integer; - topicname : string; - i, pos : integer; +var t : PHelpTopicList; + len, maxlen : integer; + totallen : integer; + i, pos : integer; + topicname : string; begin topic_list := from_memory(Pointer(@helpbin)); maxlen := 0; diff --git a/SRC/DWEDHL.PAS b/SRC/DWEDHL.PAS index 93172e0..f640ebe 100644 --- a/SRC/DWEDHL.PAS +++ b/SRC/DWEDHL.PAS @@ -138,7 +138,7 @@ begin end; procedure add_keyword(st : SourceType; keyword : string); -var lng : PLangDesc; +var lng : PLangDesc; entry : PVocabEntry; begin lng := langs; @@ -282,6 +282,7 @@ begin hl_menu[pos] := #$0; end; +procedure init; var i : integer; s : string; begin dwedhl.add_lang(SRC_DISABLE, '|%?%|', false, '', ' DISABLE (Use this, if too slow)'); @@ -698,4 +699,8 @@ begin dwedhl.add_keyword(SRC_NONE, 'note'); create_menu; +end; + +begin + init; end. diff --git a/SRC/DWEDHNDL.PAS b/SRC/DWEDHNDL.PAS index 7693103..d1e9fcd 100644 --- a/SRC/DWEDHNDL.PAS +++ b/SRC/DWEDHNDL.PAS @@ -33,11 +33,7 @@ implementation uses scr, kbd, scrui, lfn, strs, strutil, dwedscru, dwedutil, dwedaddo, dwedhl, dwedlnch; -{$F+} - -const handlers : PEventHandler = nil; - -{$F+} +{$F+}const handlers : PEventHandler = nil;{$F+} procedure reg_handler(scancode : byte; is_ctrl, is_shift, is_alt, reset_selection : boolean; proc : pointer); var h : PEventHandler; @@ -71,8 +67,8 @@ end; {$F+} function process_event(var ctx : TEditorContext; var e : TEvent) : integer; -var h : PEventHandler; - r : integer; +var h : PEventHandler; + r : integer; xofs : integer; proc : TEventProc; begin @@ -104,12 +100,9 @@ begin end; {$F+} - function goto_mouse(var ctx : TEditorContext; event : PEvent) : integer; -var r : integer; - step : integer; - line : EditorStr; - steps : integer; +var r, step, steps : integer; + line : EditorStr; begin commit(ctx); dec(event^.mouse_y); @@ -137,13 +130,11 @@ MM_T2 : string[24] = ' Cut '+#$0a+' Copy ' + #0; MM_T3 : string[24] = ' Cut '+#$0a+' Copy '+#$0a+' Paste ' + #0; function handle_mouse(var ctx : TEditorContext; event : PEvent) : integer; -var r : integer; - mt : integer; - menu : string; - have_cb : boolean; - key : word; - selItem : integer; - x, y : integer; +var r, mt, x, y : integer; + menu : string; + have_cb : boolean; + key : word; + selItem : integer; begin r := SCRU_NONE; if event^.etype = MOUSE_PRESS_B1 then begin @@ -380,9 +371,8 @@ begin end; function hk_enter(var ctx:TEditorContext; event:PEvent):integer; -var s : string; - i : integer; - r : integer; +var s : string; + i, r : integer; begin commit(ctx); if ctx.current^.editor.selection then begin @@ -412,10 +402,8 @@ begin end; function hk_esc(var ctx:TEditorContext; event:PEvent):integer; -var r : integer; - c : PFileContext; - srcctx : PFileContext; - errCode : integer; +var r, errCode : integer; + c, srcctx : PFileContext; begin r := SCRU_QUIT; commit(ctx); @@ -496,10 +484,9 @@ end; function hk_save_as(var ctx:TEditorContext; event:PEvent):integer; -var errCode : integer; - newname : string; - start_save : boolean; - msg : string; +var errCode : integer; + newname, msg : string; + start_save : boolean; begin commit(ctx); @@ -540,7 +527,7 @@ begin end; function hk_bs(var ctx:TEditorContext; event:PEvent):integer; -var r : integer; +var r : integer; s : string; begin r := SCRU_NONE; @@ -620,8 +607,8 @@ begin end; function hk_cb_cutline(var ctx:TEditorContext; event:PEvent):integer; -var clinenum : longint; - r, x : integer; +var clinenum : longint; + r, x : integer; begin if (not ctx.current^.editor.selection) and (not strs.is_last(ctx.current^.cline)) then begin commit(ctx); @@ -647,7 +634,7 @@ begin end; function hk_cb_paste(var ctx:TEditorContext; event:PEvent):integer; -var lnum: word; +var lnum : word; isfist : boolean; begin commit(ctx); @@ -732,7 +719,7 @@ begin end; function hk_tab(var ctx:TEditorContext; event:PEvent):integer; -var i, r : integer; +var i, r : integer; sb_y, se_y, clinenum : longint; sb_x, se_x : integer; line : EditorStr; @@ -778,7 +765,7 @@ begin end; function hk_shift_tab(var ctx:TEditorContext; event:PEvent):integer; -var i, r : integer; +var i, r : integer; sb_y, se_y, clinenum : longint; sb_x, se_x : integer; line : EditorStr; @@ -827,7 +814,7 @@ begin end; function hk_default(var ctx:TEditorContext; event:PEvent):integer; -var r, len : integer; +var r, len : integer; c : char; changed : boolean; begin @@ -865,8 +852,7 @@ begin end; function search(var ctx:TEditorContext; is_replace : boolean):EditorStr; -var - line : EditorStr; +var line : EditorStr; searchText : string; lineStr : string; start_col : integer; @@ -905,7 +891,7 @@ begin end; function hk_find_again(var ctx:TEditorContext; event:PEvent):integer; -var r : integer; +var r : integer; line : EditorStr; lineStr : string; searchText : string; @@ -982,7 +968,7 @@ begin end; function hk_start_find(var ctx:TEditorContext; event:PEvent):integer; -var r : integer; +var r : integer; sb_y, se_y, clinenum : longint; sb_x, se_x : integer; msg : string; @@ -1066,7 +1052,7 @@ begin end; function hk_cb_save(var ctx:TEditorContext; event:PEvent):integer; -var fname : string; +var fname : string; msg : string; start_save : boolean; errCode : integer; @@ -1092,7 +1078,7 @@ begin end; function hk_cb_load(var ctx:TEditorContext; event:PEvent):integer; -var fname : string; +var fname : string; msg : string; start_load : boolean; errCode : integer; @@ -1131,11 +1117,11 @@ end; function hk_close(var ctx:TEditorContext; event:PEvent):integer; -var canclose:boolean; +var canclose : boolean; r, next, prev : PFileContext; - msg : string; - res : integer; - errCode : integer; + msg : string; + res : integer; + errCode : integer; begin res := SCRU_FULL; commit(ctx); @@ -1188,11 +1174,10 @@ begin end; function hk_load(var ctx:TEditorContext; event:PEvent):integer; -var r : integer; +var r, errCode : integer; msg : string; fname : string; start_load : boolean; - errCode : integer; begin commit(ctx); r := SCRU_CLINE; @@ -1243,13 +1228,11 @@ begin end; function hk_userdef(var ctx:TEditorContext; event:PEvent):integer; -var cmd : string; - r : integer; - t : word; - writed : word; - can_run : boolean; - srcctx : PFileContext; - errCode : integer; +var cmd : string; + r, errCode : integer; + t, writed : word; + can_run : boolean; + srcctx : PFileContext; begin cmd := ''; r := SCRU_NONE; @@ -1315,9 +1298,8 @@ begin end; function hk_move_line_up(var ctx:TEditorContext; event:PEvent):integer; -var r : integer; - s1 : string; - s2 : string; +var r : integer; + s1, s2 : string; begin r := SCRU_NONE; if not strs.is_first(ctx.current^.cline) then begin @@ -1337,9 +1319,8 @@ begin end; function hk_move_line_down(var ctx:TEditorContext; event:PEvent):integer; -var r : integer; - s1 : string; - s2 : string; +var r : integer; + s1, s2 : string; begin r := SCRU_NONE; if not strs.is_last(ctx.current^.cline) then begin diff --git a/SRC/DWEDLNCH.PAS b/SRC/DWEDLNCH.PAS index 32f4e83..2c512fe 100644 --- a/SRC/DWEDLNCH.PAS +++ b/SRC/DWEDLNCH.PAS @@ -27,7 +27,7 @@ interface const DEVFILE : string = 'DWED:'; -procedure launcher(var exename:string); +procedure launcher(var exename : string); function is_installed : boolean; implementation @@ -259,11 +259,10 @@ begin rfname := r; end; -var - cur_drive : byte; +var cur_drive : byte; cur_dir : string; -procedure launcher(var exename:string); +procedure launcher(var exename : string); var params : string; i : integer; begin @@ -297,4 +296,4 @@ begin halt(code); end; -end. \ No newline at end of file +end. diff --git a/SRC/DWEDMAIN.PAS b/SRC/DWEDMAIN.PAS index 7dd6274..e8baaff 100644 --- a/SRC/DWEDMAIN.PAS +++ b/SRC/DWEDMAIN.PAS @@ -138,7 +138,7 @@ begin end; procedure split(var param, key, value : string); -var i : integer; +var i : integer; begin key := ''; value := ''; @@ -224,13 +224,11 @@ begin end; procedure dwed_main(exe_path : string); -var ctx : TEditorContext; - i, pCount : integer; - param : string; - key, value : string; - errCode : integer; - welcome_msg : boolean; - params : ParamsContext; +var ctx : TEditorContext; + i, pCount, errCode : integer; + param, key, value : string; + welcome_msg : boolean; + params : ParamsContext; begin if not dwedlnch.is_installed then begin writeln('This is overlay. Run DWED.EXE or join to the Dark Side.'); diff --git a/SRC/DWEDOVL.EXE b/SRC/DWEDOVL.EXE index 7f6bd4c..cb73c39 100644 Binary files a/SRC/DWEDOVL.EXE and b/SRC/DWEDOVL.EXE differ diff --git a/SRC/DWEDOVLP.EXE b/SRC/DWEDOVLP.EXE index 8fb3a5c..87cf2fe 100644 Binary files a/SRC/DWEDOVLP.EXE and b/SRC/DWEDOVLP.EXE differ diff --git a/SRC/DWEDPAR.PAS b/SRC/DWEDPAR.PAS index eed5f16..e085e80 100644 --- a/SRC/DWEDPAR.PAS +++ b/SRC/DWEDPAR.PAS @@ -59,11 +59,10 @@ begin end; function pnext(var ctx : ParamsContext) : string; -var res : string; - rres : string; - i : integer; - cur, prev : char; - inquote : boolean; +var res, rres : string; + i : integer; + cur, prev : char; + inquote : boolean; begin res := ''; i := ctx.pos; diff --git a/SRC/DWEDSCRU.PAS b/SRC/DWEDSCRU.PAS index 48b6b2e..5875984 100644 --- a/SRC/DWEDSCRU.PAS +++ b/SRC/DWEDSCRU.PAS @@ -21,6 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. } +{$B-} unit dwedscru; interface @@ -52,15 +53,15 @@ begin end; procedure update_full(var ctx : TEditorContext); -var h, w, i, x1, len : integer; - p : EditorStr; - s : string; +var h, w, i, x1, len : integer; + p : EditorStr; + s : string; sb_y, se_y, clinenum : longint; - sb_x, se_x : integer; - scrx : integer; - text_color : byte; - text_sel_color : byte; - selection : boolean; + sb_x, se_x, scrx : integer; + text_color : byte; + text_sel_color : byte; + selection : boolean; + scrbufofs : pchar; begin with ctx.current^ do begin h := config^.height; @@ -71,9 +72,9 @@ begin selection := editor.selection; end; scrx := ctx.current^.scrx; + if selection then get_sel_coord(ctx, sb_x, sb_y, se_x, se_y); - get_sel_coord(ctx, sb_x, sb_y, se_x, se_y); - + scrbufofs := scr.screen + w shl 1; for i := 1 to h - 1 do begin clinenum := strs.get_num(p); strs.get(p, s); @@ -98,8 +99,8 @@ begin high_light(ctx.current^.st, w , ctx.config.color.text_hl , text_color - , @scr.screen[(w * i) shl 1]); - + , scrbufofs); + inc(scrbufofs, w shl 1); p := strs.go_next(p); end; end; @@ -107,11 +108,10 @@ end; procedure update_cline(var ctx : TEditorContext); var sb_y, se_y, clinenum : longint; - sb_x, se_x : integer; - x, xe, len : integer; - line : string; - scrx : integer; - width : integer; + sb_x, se_x : integer; + x, xe, len : integer; + scrx, width : integer; + line : string; begin with ctx.current^ do begin scr.cln(0, scry + 1, config^.color.text); @@ -171,17 +171,17 @@ begin end; procedure update_top(var ctx : TEditorContext); -var ch, i : char; - endline : string; - fname : string; - total : string; +var ch, i : char; + endline : string; + fname : string; + total : string; char_code : string; begin ch := ' '; i := 'O'; if ctx.current^.chg or ctx.current^.editor.chg then ch := '*'; if ctx.ins then i := 'I'; - if ctx.current^.editor.x < length(ctx.current^.editor.line) then begin + if ctx.current^.editor.x <= length(ctx.current^.editor.line) then begin char_code := hexb(ord(ctx.current^.editor.line[ctx.current^.editor.x])); end else char_code := ''; total := ltoa(ctx.current^.total); diff --git a/SRC/HELP.PAS b/SRC/HELP.PAS index ef3b899..8e86520 100644 --- a/SRC/HELP.PAS +++ b/SRC/HELP.PAS @@ -28,20 +28,20 @@ interface type -PHelpTopic=^THelpTopic; -THelpTopic=record - name : array[1..12] of char; +PHelpTopic = ^THelpTopic; +THelpTopic = record + name : array[1..12] of char; recno : word; - ofs : byte; - lvl : byte; + ofs : byte; + lvl : byte; end; -PHelpTopicList=^THelpTopicList; -THelpTopicList=record - topic :THelpTopic; - htext :pchar; - hlen :word; - next :PHelpTopicList; +PHelpTopicList = ^THelpTopicList; +THelpTopicList = record + topic : THelpTopic; + htext : pchar; + hlen : word; + next : PHelpTopicList; end; function from_file(fname : string):PHelpTopicList; @@ -57,28 +57,28 @@ implementation type -PHelpIntTopic=^THelpIntTopic; -THelpIntTopic=record - name :string; - ofs :longint; - lvl :byte; - next :PHelpIntTopic; +PHelpIntTopic = ^THelpIntTopic; +THelpIntTopic = record + name : string; + ofs : longint; + lvl : byte; + next : PHelpIntTopic; end; -function is_digit(c:char):boolean; +function is_digit(c : char):boolean; begin is_digit := c in ['0'..'9']; end; procedure compile(ifname, ofname : string); -var ifile:text; +var ifile : text; ofile : file; - s : string; - tcount : word; + s : string; + tcount : word; root, last, cur : PHelpIntTopic; - ofs : longint; + ofs : longint; topic : THelpTopic; - i, l : integer; + i, l : integer; begin tcount := 0; root := nil; last := nil; ofs := 0; assign(ifile, ifname); @@ -160,11 +160,10 @@ begin end; end; -function find(root:PHelpTopicList; topic_name:string):PHelpTopicList; -var - name : array[1..12] of char; - i, l : integer; - found : boolean; +function find(root : PHelpTopicList; topic_name : string) : PHelpTopicList; +var name : array[1..12] of char; + i, l : integer; + found : boolean; r : PHelpTopicList; begin fillchar(name, 12, ' '); @@ -176,19 +175,22 @@ begin found := false; while (not found) and (r <> nil) do begin found := true; - for i:=1 to 12 do if name[i] <> r^.topic.name[i] then begin found := false; break; end; - if found then break; + i := 1; + while i <= 12 do begin + if name[i] <> r^.topic.name[i] then begin found := false; break; end; + inc(i); + end; + if found then begin find := r; exit; end; r := r^.next; end; - if not found then r := nil; - find := r; + find := nil; end; -function from_file(fname:string):PHelpTopicList; +function from_file(fname : string) : PHelpTopicList; var f : file; - r, l, c : PHelpTopicList; - nt, fs : longint; + r, l, c : PHelpTopicList; + nt, fs : longint; begin r := nil; c := nil; l := nil; assign(f, fname); @@ -223,11 +225,10 @@ begin from_file := r; end; -function from_memory(p:pointer):PHelpTopicList; -var - rp, ep : pchar; - r, l, c : PHelpTopicList; - nt, fs : longint; +function from_memory(p : pointer) : PHelpTopicList; +var rp, ep : pchar; + r, l, c : PHelpTopicList; + nt, fs : longint; begin r := nil; c := nil; l := nil; rp := p; @@ -261,8 +262,8 @@ begin from_memory := r; end; -procedure free(hlp:PHelpTopicList); -var h:PHelpTopicList; +procedure free(hlp : PHelpTopicList); +var h : PHelpTopicList; begin while hlp <> nil do begin h := hlp; diff --git a/SRC/KBD.PAS b/SRC/KBD.PAS index 3ed68a0..4afaf0c 100644 --- a/SRC/KBD.PAS +++ b/SRC/KBD.PAS @@ -277,7 +277,7 @@ asm end; begin - have_ext_kb := false; - have_122_kb := false; + kbd.have_ext_kb := false; + kbd.have_122_kb := false; kbd.check; end. diff --git a/SRC/MOUSE.PAS b/SRC/MOUSE.PAS index d82763c..9acd4b6 100644 --- a/SRC/MOUSE.PAS +++ b/SRC/MOUSE.PAS @@ -31,23 +31,22 @@ MOUSE_B2 = 2; procedure mshow; procedure mhide; -function mvisible:boolean; -function mbuttons:byte; -function mgetx:integer; -function mgety:integer; -function mavail:boolean; +function mvisible : boolean; +function mbuttons : byte; +function mgetx : integer; +function mgety : integer; +function mavail : boolean; implementation -var present : boolean; -state : boolean; +var present, state : boolean; -function mavail:boolean;assembler; +function mavail : boolean;assembler; asm mov al, present end; -function mvisible:boolean;assembler; +function mvisible : boolean;assembler; asm mov al, present or al, al @@ -79,7 +78,7 @@ asm @nomouse: end; -function mbuttons:byte;assembler; +function mbuttons : byte;assembler; asm mov al, present or al, al @@ -91,7 +90,7 @@ asm @nomouse: end; -function mgetx:integer;assembler; +function mgetx : integer;assembler; asm mov al, present or al, al @@ -104,7 +103,7 @@ asm @nomouse: end; -function mgety:integer;assembler; +function mgety : integer;assembler; asm mov al, present or al, al @@ -123,4 +122,4 @@ asm int $33 mov present, al end; -end. \ No newline at end of file +end. diff --git a/SRC/SCR.PAS b/SRC/SCR.PAS index a3f2bb3..ce93700 100644 --- a/SRC/SCR.PAS +++ b/SRC/SCR.PAS @@ -80,13 +80,10 @@ TScr=record buf : byte; end; -const - -last_scr_buf : PScr = nil; - +const last_scr_buf : PScr = nil; var screen_size, line_size : word; -function getheight:integer;assembler; +function getheight : integer;assembler; asm push ds mov ax, seg0040 @@ -97,7 +94,7 @@ asm pop ds end; -function getwidth:integer;assembler; +function getwidth : integer;assembler; asm push ds mov ax, seg0040 @@ -309,7 +306,7 @@ asm int $10 end; -function getx:integer;assembler; +function getx : integer;assembler; asm push ds mov ax, word ptr [seg0040] @@ -323,7 +320,7 @@ asm xor ah,ah end; -function gety:integer;assembler; +function gety : integer;assembler; asm push ds mov ax, word ptr [seg0040] @@ -338,7 +335,7 @@ asm end; procedure push; -var p : PScr; +var p : PScr; begin getmem(p, screen_size + sizeof(TScr) - 1); p^.size := screen_size; @@ -374,7 +371,7 @@ asm int $10 end; -function get_cursor:word;assembler; +function get_cursor : word;assembler; asm mov ah, $0f int $10 @@ -406,7 +403,7 @@ asm int $10 end; -function is_monochrome:boolean;assembler; +function is_monochrome : boolean;assembler; asm push ds mov ax, word ptr [seg0040] @@ -451,11 +448,11 @@ begin end; begin - cursor := get_cursor; - if is_monochrome then vseg := segb000 else vseg := segb800; - set_blink(false); - screen_size := (getwidth * getheight) shl 1; - line_size := getwidth shl 1; + cursor := scr.get_cursor; + if scr.is_monochrome then vseg := segb000 else vseg := segb800; + scr.set_blink(false); + screen_size := (scr.getwidth * scr.getheight) shl 1; + line_size := scr.getwidth shl 1; getmem(screen, screen_size); move(mem[vseg:0], screen[0], screen_size); mouse.mshow; diff --git a/SRC/STRUTIL.PAS b/SRC/STRUTIL.PAS index 0ca611e..8759561 100644 --- a/SRC/STRUTIL.PAS +++ b/SRC/STRUTIL.PAS @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. } -{$F+,R-} +{$F-,R-} unit strutil; interface @@ -77,7 +77,7 @@ implementation function get_filename_ext(s : string):string; var r : string; - i : integer; + i : integer; begin r := ''; i := length(s); @@ -178,8 +178,8 @@ asm pop ds end; -function basename(s:string):string; -var i : integer; +function basename(s : string):string; +var i : integer; begin for i := length(s) downto 0 do begin @@ -189,8 +189,8 @@ begin basename := s; end; -function getpathname(s:string):string; -var i : integer; +function getpathname(s : string):string; +var i : integer; begin for i := length(s) downto 0 do begin @@ -200,9 +200,9 @@ begin getpathname := s; end; -function change_ext(s:string; new_ext:string):string; -var r : string; - i, p, l : integer; +function change_ext(s : string; new_ext : string):string; +var r : string; + i, p, l : integer; begin l := length(s); p := 0; @@ -271,9 +271,9 @@ begin hexp := hexw(seg(p[0])) + ':' + hexw(ofs(p[0])); end; -function binb(b:byte):string; +function binb(b : byte):string; var s : string[8]; - i : integer; + i : integer; begin s[0] := #8; for i := 7 downto 0 do if (b and (1 shl i)) <> 0 then s[8-i] := '1' else s[8-i] := '0'; @@ -297,7 +297,7 @@ begin octb := s; end; -function is_blank(c:char):boolean;assembler; +function is_blank(c : char) : boolean;assembler; asm xor al, al mov ah, c @@ -307,7 +307,7 @@ asm @end: end; -function is_digit(c:char):boolean;assembler; +function is_digit(c : char):boolean;assembler; asm xor al, al mov ah, c @@ -317,10 +317,9 @@ asm jg @cont1 dec al @cont1: - xor ah, ah end; -function is_alpha(c:char):boolean;assembler; +function is_alpha(c : char):boolean;assembler; asm xor al, al mov ah, c @@ -338,7 +337,6 @@ asm dec al @cont2: @end: - xor ah, ah end; function is_hdigit(c : char):boolean;assembler; @@ -365,7 +363,6 @@ asm jg @end dec al @end: - xor ah, ah end; function is_id(c : char):boolean;assembler; @@ -396,7 +393,6 @@ asm jnz @end dec al @end: - xor ah, ah end; function ltrim(s : string):string; @@ -411,7 +407,7 @@ begin ltrim := s; end; -function rtrim(s:string):string; +function rtrim(s : string):string; var k, l : integer; begin l := length(s); k := l; @@ -423,40 +419,40 @@ begin rtrim := s; end; -function trim(s:string):string; +function trim(s : string):string; begin trim := ltrim(rtrim(s)); end; -function rpad(s:string; len:integer):string; +function rpad(s : string; len : integer):string; begin if length(s) > len then s := copy(s, 1, len) else while length(s) < len do s := s + ' '; rpad := s; end; -function lpad(s:string; len:integer):string; +function lpad(s : string; len : integer):string; begin if length(s) > len then s := copy(s, 1, len) else while length(s) < len do s := ' ' + s; lpad := s; end; -function itoa(i:integer):string; +function itoa(i : integer):string; var s : string; begin str(i, s); itoa := s; end; -function wtoa(w:word):string; +function wtoa(w : word):string; var s : string; begin str(w, s); wtoa := s; end; -function ltoa(l:longint):string; +function ltoa(l : longint):string; var s : string; begin str(l, s); @@ -481,7 +477,7 @@ asm pop ds end; -function atol(s:string; default_val : longint) : longint; +function atol(s : string; default_val : longint) : longint; var res : longint; err_pos : integer; begin val(s, res, err_pos); @@ -498,10 +494,10 @@ begin end; function ahtob(str : string) : byte; -var r : byte; - i : integer; - c : char; - k : byte; +var r : byte; + i : integer; + c : char; + k : byte; begin r := 0; if length(str) = 1 then str := '0' + str;