From 390fc9063d87bf8b7735d7f217ddb41ce938f1a8 Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 12 Jun 1998 10:32:22 +0000 Subject: [PATCH] * column problem hopefully solved + C vars declaration changed --- compiler/cg68k.pas | 22 +- compiler/cgi386.pas | 21 +- compiler/depend | 637 +----------------------------------------- compiler/files.pas | 14 +- compiler/pass_1.pas | 19 +- compiler/pdecl.pas | 93 +++--- compiler/ra68k.pas | 8 +- compiler/radi386.pas | 8 +- compiler/rai386.pas | 8 +- compiler/ratti386.pas | 8 +- compiler/scanner.pas | 83 ++++-- 11 files changed, 179 insertions(+), 742 deletions(-) diff --git a/compiler/cg68k.pas b/compiler/cg68k.pas index 0d01c3a971..1c15b7613c 100644 --- a/compiler/cg68k.pas +++ b/compiler/cg68k.pas @@ -73,6 +73,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister); implementation {***************************************************************************} + uses + scanner; + const never_copy_const_param : boolean = false; bytes2Sxx:array[1..4] of Topsize=(S_B,S_W,S_NO,S_L); @@ -4859,19 +4862,15 @@ end; var oldcodegenerror : boolean; oldswitches : Tcswitches; - oldis : pinputfile; - oldnr : longint; + oldpos : tfileposinfo; begin oldcodegenerror:=codegenerror; oldswitches:=aktswitches; - oldis:=current_module^.current_inputfile; - oldnr:=current_module^.current_inputfile^.line_no; + get_cur_file_pos(oldpos); codegenerror:=false; - current_module^.current_inputfile:= - pinputfile(current_module^.sourcefiles.get_file(p^.fileinfo.fileindex)); - current_module^.current_inputfile^.line_no:=p^.fileinfo.line; + set_cur_file_pos(p^.fileinfo); aktswitches:=p^.pragmas; if not(p^.error) then begin @@ -4882,8 +4881,7 @@ end; else codegenerror:=true; aktswitches:=oldswitches; - current_module^.current_inputfile:=oldis; - current_module^.current_inputfile^.line_no:=oldnr; + set_cur_file_pos(oldpos); end; @@ -5137,7 +5135,11 @@ end. { $Log$ - Revision 1.7 1998-06-09 16:01:36 pierre + Revision 1.8 1998-06-12 10:32:22 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.7 1998/06/09 16:01:36 pierre + added procedure directive parsing for procvars (accepted are popstack cdecl and pascal) + added C vars with the following syntax diff --git a/compiler/cgi386.pas b/compiler/cgi386.pas index ac287c60e7..5f866512d1 100644 --- a/compiler/cgi386.pas +++ b/compiler/cgi386.pas @@ -58,7 +58,7 @@ implementation uses verbose,cobjects,systems,globals,files, - symtable,types,aasm, + symtable,types,aasm,scanner, pass_1,hcodegen,temp_gen {$ifdef GDB} ,gdb @@ -230,19 +230,15 @@ implementation var oldcodegenerror : boolean; oldswitches : Tcswitches; - oldis : pinputfile; - oldnr : longint; + oldpos : tfileposinfo; begin oldcodegenerror:=codegenerror; oldswitches:=aktswitches; - oldis:=current_module^.current_inputfile; - oldnr:=current_module^.current_inputfile^.line_no; + get_cur_file_pos(oldpos); codegenerror:=false; - current_module^.current_inputfile:= - pinputfile(current_module^.sourcefiles.get_file(p^.fileinfo.fileindex)); - current_module^.current_inputfile^.line_no:=p^.fileinfo.line; + set_cur_file_pos(p^.fileinfo); aktswitches:=p^.pragmas; if not(p^.error) then begin @@ -253,8 +249,7 @@ implementation else codegenerror:=true; aktswitches:=oldswitches; - current_module^.current_inputfile:=oldis; - current_module^.current_inputfile^.line_no:=oldnr; + set_cur_file_pos(oldpos); end; @@ -516,7 +511,11 @@ implementation end. { $Log$ - Revision 1.38 1998-06-09 16:01:37 pierre + Revision 1.39 1998-06-12 10:32:23 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.38 1998/06/09 16:01:37 pierre + added procedure directive parsing for procvars (accepted are popstack cdecl and pascal) + added C vars with the following syntax diff --git a/compiler/depend b/compiler/depend index 26b1dfbacb..152f9ed5aa 100644 --- a/compiler/depend +++ b/compiler/depend @@ -1,636 +1 @@ -pp: pp.pas \ - cobjects.ppu \ - globals.ppu \ - parser.ppu \ - systems.ppu \ - tree.ppu \ - symtable.ppu \ - options.ppu \ - link.ppu \ - import.ppu \ - files.ppu \ - verb_def.ppu \ - verbose.ppu - $(COMPILER) pp - -cobjects.ppu: cobjects.pas - -globals.ppu: globals.pas \ - cobjects.ppu \ - systems.ppu - -systems.ppu: systems.pas - -parser.ppu: parser.pas \ - systems.ppu \ - cobjects.ppu \ - globals.ppu \ - verbose.ppu \ - symtable.ppu \ - files.ppu \ - aasm.ppu \ - hcodegen.ppu \ - import.ppu \ - assemble.ppu \ - link.ppu \ - script.ppu \ - gendef.ppu \ - scanner.ppu \ - pbase.ppu \ - pdecl.ppu \ - psystem.ppu \ - pmodules.ppu - -verbose.ppu: verbose.pas \ - messages.ppu \ - globals.ppu - -messages.ppu: messages.pas - -symtable.ppu: symtable.pas \ - cobjects.ppu \ - verbose.ppu \ - systems.ppu \ - globals.ppu \ - aasm.ppu \ - files.ppu \ - gendef.ppu \ - i386.ppu \ - gdb.ppu \ - types.ppu - -aasm.ppu: aasm.pas \ - cobjects.ppu \ - files.ppu \ - globals.ppu \ - verbose.ppu \ - systems.ppu - -files.ppu: files.pas \ - cobjects.ppu \ - globals.ppu \ - verbose.ppu \ - systems.ppu - -gendef.ppu: gendef.pas \ - cobjects.ppu \ - systems.ppu \ - globals.ppu - -i386.ppu: i386.pas \ - cobjects.ppu \ - aasm.ppu \ - globals.ppu \ - verbose.ppu - -gdb.ppu: gdb.pas \ - i386.ppu \ - cobjects.ppu \ - globals.ppu \ - aasm.ppu - -types.ppu: types.pas \ - cobjects.ppu \ - globals.ppu \ - symtable.ppu \ - tree.ppu \ - verbose.ppu \ - aasm.ppu - -tree.ppu: tree.pas \ - cobjects.ppu \ - globals.ppu \ - symtable.ppu \ - aasm.ppu \ - i386.ppu \ - types.ppu \ - verbose.ppu \ - files.ppu - -hcodegen.ppu: hcodegen.pas \ - aasm.ppu \ - tree.ppu \ - symtable.ppu \ - i386.ppu \ - systems.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - files.ppu - -import.ppu: import.pas \ - cobjects.ppu \ - systems.ppu \ - verbose.ppu \ - os2_targ.ppu \ - win_targ.ppu - -os2_targ.ppu: os2_targ.pas \ - import.ppu \ - globals.ppu \ - link.ppu \ - files.ppu - -link.ppu: link.pas \ - cobjects.ppu \ - script.ppu \ - globals.ppu \ - systems.ppu \ - verbose.ppu - -script.ppu: script.pas \ - cobjects.ppu \ - globals.ppu \ - systems.ppu - -win_targ.ppu: win_targ.pas \ - import.ppu \ - aasm.ppu \ - files.ppu \ - globals.ppu \ - cobjects.ppu \ - i386.ppu - -assemble.ppu: assemble.pas \ - cobjects.ppu \ - globals.ppu \ - aasm.ppu \ - script.ppu \ - files.ppu \ - systems.ppu \ - verbose.ppu \ - ag386att.ppu \ - ag386int.ppu \ - ag386nsm.ppu - -ag386att.ppu: ag386att.pas \ - aasm.ppu \ - assemble.ppu \ - globals.ppu \ - systems.ppu \ - cobjects.ppu \ - i386.ppu \ - files.ppu \ - verbose.ppu \ - gdb.ppu - -ag386int.ppu: ag386int.pas \ - aasm.ppu \ - assemble.ppu \ - globals.ppu \ - systems.ppu \ - cobjects.ppu \ - i386.ppu \ - files.ppu \ - verbose.ppu \ - gdb.ppu - -ag386nsm.ppu: ag386nsm.pas \ - aasm.ppu \ - assemble.ppu \ - globals.ppu \ - systems.ppu \ - cobjects.ppu \ - i386.ppu \ - files.ppu \ - verbose.ppu \ - gdb.ppu - -scanner.ppu: scanner.pas \ - cobjects.ppu \ - globals.ppu \ - files.ppu \ - verbose.ppu \ - systems.ppu \ - symtable.ppu \ - switches.ppu - -switches.ppu: switches.pas \ - globals.ppu \ - verbose.ppu \ - files.ppu \ - systems.ppu - -pbase.ppu: pbase.pas \ - cobjects.ppu \ - globals.ppu \ - symtable.ppu \ - files.ppu \ - scanner.ppu \ - systems.ppu \ - verbose.ppu - -pdecl.ppu: pdecl.pas \ - globals.ppu \ - symtable.ppu \ - cobjects.ppu \ - scanner.ppu \ - aasm.ppu \ - tree.ppu \ - pass_1.ppu \ - files.ppu \ - types.ppu \ - hcodegen.ppu \ - verbose.ppu \ - systems.ppu \ - gdb.ppu \ - pbase.ppu \ - ptconst.ppu \ - pexpr.ppu \ - psub.ppu \ - pexports.ppu \ - i386.ppu - -pass_1.ppu: pass_1.pas \ - tree.ppu \ - scanner.ppu \ - cobjects.ppu \ - verbose.ppu \ - systems.ppu \ - globals.ppu \ - aasm.ppu \ - symtable.ppu \ - types.ppu \ - hcodegen.ppu \ - files.ppu \ - i386.ppu \ - tgeni386.ppu - -tgeni386.ppu: tgeni386.pas \ - cobjects.ppu \ - globals.ppu \ - tree.ppu \ - hcodegen.ppu \ - verbose.ppu \ - files.ppu \ - aasm.ppu \ - i386.ppu - -ptconst.ppu: ptconst.pas \ - symtable.ppu \ - cobjects.ppu \ - globals.ppu \ - scanner.ppu \ - aasm.ppu \ - tree.ppu \ - pass_1.ppu \ - hcodegen.ppu \ - types.ppu \ - verbose.ppu \ - pbase.ppu \ - pexpr.ppu \ - i386.ppu - -pexpr.ppu: pexpr.pas \ - symtable.ppu \ - tree.ppu \ - cobjects.ppu \ - globals.ppu \ - scanner.ppu \ - aasm.ppu \ - pass_1.ppu \ - systems.ppu \ - hcodegen.ppu \ - types.ppu \ - verbose.ppu \ - pbase.ppu \ - pdecl.ppu \ - i386.ppu - -psub.ppu: psub.pas \ - cobjects.ppu \ - globals.ppu \ - scanner.ppu \ - symtable.ppu \ - aasm.ppu \ - tree.ppu \ - pass_1.ppu \ - types.ppu \ - hcodegen.ppu \ - files.ppu \ - verbose.ppu \ - systems.ppu \ - import.ppu \ - gendef.ppu \ - gdb.ppu \ - i386.ppu \ - cgi386.ppu \ - tgeni386.ppu \ - cgai386.ppu \ - aopt386.ppu \ - pbase.ppu \ - pdecl.ppu \ - pexpr.ppu \ - pstatmnt.ppu - -cgi386.ppu: cgi386.pas \ - tree.ppu \ - verbose.ppu \ - cobjects.ppu \ - systems.ppu \ - globals.ppu \ - files.ppu \ - symtable.ppu \ - types.ppu \ - aasm.ppu \ - pass_1.ppu \ - hcodegen.ppu \ - gdb.ppu \ - i386.ppu \ - tgeni386.ppu \ - cgai386.ppu \ - cg386con.ppu \ - cg386mat.ppu \ - cg386cnv.ppu \ - cg386set.ppu \ - cg386add.ppu \ - cg386mem.ppu \ - cg386cal.ppu \ - cg386ld.ppu \ - cg386flw.ppu - -cgai386.ppu: cgai386.pas \ - cobjects.ppu \ - tree.ppu \ - i386.ppu \ - aasm.ppu \ - symtable.ppu \ - systems.ppu \ - globals.ppu \ - verbose.ppu \ - files.ppu \ - types.ppu \ - pbase.ppu \ - tgeni386.ppu \ - hcodegen.ppu \ - gdb.ppu - -cg386con.ppu: cg386con.pas \ - tree.ppu \ - cobjects.ppu \ - verbose.ppu \ - symtable.ppu \ - aasm.ppu \ - i386.ppu \ - hcodegen.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - cgi386.ppu - -cg386mat.ppu: cg386mat.pas \ - tree.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - symtable.ppu \ - aasm.ppu \ - i386.ppu \ - types.ppu \ - cgi386.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - hcodegen.ppu - -cg386cnv.ppu: cg386cnv.pas \ - tree.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - symtable.ppu \ - aasm.ppu \ - i386.ppu \ - cgi386.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - hcodegen.ppu - -cg386set.ppu: cg386set.pas \ - tree.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - systems.ppu \ - symtable.ppu \ - aasm.ppu \ - i386.ppu \ - types.ppu \ - cgi386.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - hcodegen.ppu - -cg386add.ppu: cg386add.pas \ - tree.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - symtable.ppu \ - aasm.ppu \ - i386.ppu \ - types.ppu \ - cgi386.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - hcodegen.ppu - -cg386mem.ppu: cg386mem.pas \ - tree.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - systems.ppu \ - symtable.ppu \ - aasm.ppu \ - i386.ppu \ - types.ppu \ - cgi386.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - hcodegen.ppu - -cg386cal.ppu: cg386cal.pas \ - symtable.ppu \ - tree.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - systems.ppu \ - aasm.ppu \ - i386.ppu \ - types.ppu \ - cgi386.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - hcodegen.ppu \ - cg386ld.ppu - -cg386ld.ppu: cg386ld.pas \ - tree.ppu \ - i386.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - symtable.ppu \ - aasm.ppu \ - types.ppu \ - cgi386.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - hcodegen.ppu - -cg386flw.ppu: cg386flw.pas \ - tree.ppu \ - cobjects.ppu \ - verbose.ppu \ - globals.ppu \ - systems.ppu \ - symtable.ppu \ - aasm.ppu \ - i386.ppu \ - types.ppu \ - cgi386.ppu \ - cgai386.ppu \ - tgeni386.ppu \ - hcodegen.ppu - -aopt386.ppu: aopt386.pas \ - aasm.ppu \ - cobjects.ppu \ - globals.ppu \ - systems.ppu \ - symtable.ppu \ - verbose.ppu \ - hcodegen.ppu \ - i386.ppu \ - cgi386.ppu - -pstatmnt.ppu: pstatmnt.pas \ - tree.ppu \ - cobjects.ppu \ - scanner.ppu \ - globals.ppu \ - symtable.ppu \ - aasm.ppu \ - pass_1.ppu \ - types.ppu \ - hcodegen.ppu \ - files.ppu \ - verbose.ppu \ - systems.ppu \ - i386.ppu \ - rai386.ppu \ - ratti386.ppu \ - radi386.ppu \ - tgeni386.ppu \ - pbase.ppu \ - pexpr.ppu \ - pdecl.ppu - -rai386.ppu: rai386.pas \ - tree.ppu \ - i386.ppu \ - systems.ppu \ - files.ppu \ - aasm.ppu \ - globals.ppu \ - asmutils.ppu \ - hcodegen.ppu \ - scanner.ppu \ - cobjects.ppu \ - verbose.ppu \ - types.ppu - -asmutils.ppu: asmutils.pas \ - symtable.ppu \ - aasm.ppu \ - hcodegen.ppu \ - verbose.ppu \ - systems.ppu \ - globals.ppu \ - files.ppu \ - cobjects.ppu \ - i386.ppu - -ratti386.ppu: ratti386.pas \ - i386.ppu \ - tree.ppu \ - files.ppu \ - aasm.ppu \ - globals.ppu \ - asmutils.ppu \ - hcodegen.ppu \ - scanner.ppu \ - systems.ppu \ - cobjects.ppu \ - verbose.ppu \ - symtable.ppu \ - types.ppu - -radi386.ppu: radi386.pas \ - tree.ppu \ - files.ppu \ - i386.ppu \ - hcodegen.ppu \ - globals.ppu \ - scanner.ppu \ - aasm.ppu \ - cobjects.ppu \ - symtable.ppu \ - types.ppu \ - verbose.ppu \ - asmutils.ppu - -pexports.ppu: pexports.pas \ - cobjects.ppu \ - globals.ppu \ - scanner.ppu \ - symtable.ppu \ - pbase.ppu \ - verbose.ppu - -psystem.ppu: psystem.pas \ - symtable.ppu \ - globals.ppu \ - tree.ppu - -pmodules.ppu: pmodules.pas \ - files.ppu \ - cobjects.ppu \ - verbose.ppu \ - systems.ppu \ - globals.ppu \ - symtable.ppu \ - aasm.ppu \ - hcodegen.ppu \ - link.ppu \ - assemble.ppu \ - i386.ppu \ - scanner.ppu \ - pbase.ppu \ - psystem.ppu \ - pdecl.ppu \ - psub.ppu \ - parser.ppu - -options.ppu: options.pas \ - cobjects.ppu \ - globals.ppu \ - systems.ppu \ - verbose.ppu \ - scanner.ppu \ - link.ppu \ - verb_def.ppu \ - messages.ppu \ - gendef.ppu \ - opts386.ppu - -verb_def.ppu: verb_def.pas \ - verbose.ppu \ - globals.ppu \ - files.ppu - -opts386.ppu: opts386.pas \ - options.ppu \ - systems.ppu \ - globals.ppu - + \ No newline at end of file diff --git a/compiler/files.pas b/compiler/files.pas index 346d7e5825..8f7b43f698 100644 --- a/compiler/files.pas +++ b/compiler/files.pas @@ -58,8 +58,9 @@ unit files; pinputfile = ^tinputfile; tinputfile = object(textfile) filenotatend : boolean; - line_no : longint; - line_count : longint; { second counter for unimportant tokens } + line_no : longint; { position to give out } + true_line : longint; { real line counter } + column : longint; next : pinputfile; { next input file in the stack of input files } ref_count : longint; { to handle the browser refs } constructor init(const p,n,e : string); @@ -259,7 +260,8 @@ unit files; inherited init(p,n,e); filenotatend:=true; line_no:=1; - line_count:=0; + true_line:=1; + column:=1; next:=nil; end; @@ -938,7 +940,11 @@ unit files; end. { $Log$ - Revision 1.18 1998-06-11 13:58:07 peter + Revision 1.19 1998-06-12 10:32:26 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.18 1998/06/11 13:58:07 peter * small fix to let newppu compile Revision 1.17 1998/06/09 16:01:40 pierre diff --git a/compiler/pass_1.pas b/compiler/pass_1.pas index 23e266f2bb..77f98c2e43 100644 --- a/compiler/pass_1.pas +++ b/compiler/pass_1.pas @@ -4928,8 +4928,7 @@ unit pass_1; oldcodegenerror : boolean; oldswitches : Tcswitches; { there some calls of do_firstpass in the parser } - oldis : pinputfile; - oldnr : longint; + oldpos : tfileposinfo; {$ifdef extdebug} str1,str2 : string; oldp : ptree; @@ -4943,8 +4942,7 @@ unit pass_1; {$endif extdebug} { if we save there the whole stuff, } { line numbers become more correct } - oldis:=current_module^.current_inputfile; - oldnr:=current_module^.current_inputfile^.line_no; + get_cur_file_pos(oldpos); oldcodegenerror:=codegenerror; oldswitches:=aktswitches; {$ifdef extdebug} @@ -4961,9 +4959,7 @@ unit pass_1; {$endif extdebug} codegenerror:=false; - current_module^.current_inputfile:= - pinputfile(current_module^.sourcefiles.get_file(p^.fileinfo.fileindex)); - current_module^.current_inputfile^.line_no:=p^.fileinfo.line; + set_cur_file_pos(p^.fileinfo); aktswitches:=p^.pragmas; if not(p^.error) then @@ -4991,8 +4987,7 @@ unit pass_1; inc(p^.firstpasscount); {$endif extdebug} aktswitches:=oldswitches; - current_module^.current_inputfile:=oldis; - current_module^.current_inputfile^.line_no:=oldnr; + set_cur_file_pos(oldpos); end; function do_firstpass(var p : ptree) : boolean; @@ -5017,7 +5012,11 @@ unit pass_1; end. { $Log$ - Revision 1.29 1998-06-09 16:01:44 pierre + Revision 1.30 1998-06-12 10:32:28 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.29 1998/06/09 16:01:44 pierre + added procedure directive parsing for procvars (accepted are popstack cdecl and pascal) + added C vars with the following syntax diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 286bbb5468..2c2e4bbb48 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -1575,6 +1575,8 @@ unit pdecl; filepos : tfileposinfo; Csym : pvarsym; + is_cdecl,extern_Csym,export_Csym : boolean; + C_name : string; begin hs:=''; @@ -1590,32 +1592,11 @@ unit pdecl; (pattern<>'PUBLISHED') and (pattern<>'PROTECTED') do begin + C_name:=orgpattern; sc:=idlist; consume(COLON); p:=read_type(''); - if do_absolute and (token=ID) and (pattern='CALIAS') then - begin - s:=sc^.get_with_tokeninfo(filepos); - if sc^.get<>'' then - Message(parser_e_absolute_only_one_var); - dispose(sc,done); - consume(ID); - if (token<>CCHAR) and (token<>CSTRING) then - consume(CSTRING) - else - begin - Csym:=new(pvarsym,init_C(s,pattern,p)); - consume(token); - consume(SEMICOLON); - if (token=ID) and (pattern='EXTERNAL') then - begin - Csym^.var_options:=Csym^.var_options or vo_is_external; - Consume(ID); - end; - symtablestack^.insert(Csym); - end; - end - else if do_absolute and (token=ID) and (pattern='ABSOLUTE') then + if do_absolute and (token=ID) and (pattern='ABSOLUTE') then begin s:=sc^.get_with_tokeninfo(filepos); if sc^.get<>'' then @@ -1685,12 +1666,56 @@ unit pdecl; end else begin - if token=SEMICOLON then + if not(is_record) then + consume(token); + if do_absolute and (token=ID) and + ((pattern='EXPORT') or (pattern='EXTERNAL') + or (pattern='CDECL')) then begin - if (symtablestack^.symtabletype=objectsymtable) then + if pattern='CDECL' then begin + consume(ID); consume(SEMICOLON); - if (token=ID) and (pattern='STATIC') and + is_cdecl:=true; + end + else + is_cdecl:=false; + + extern_Csym:=(pattern='EXTERNAL'); + if not is_cdecl then + export_Csym:=(pattern='EXPORT') + else + export_Csym:=false; + s:=sc^.get_with_tokeninfo(filepos); + if sc^.get<>'' then + Message(parser_e_absolute_only_one_var); + dispose(sc,done); + if extern_Csym or export_Csym then + consume(ID); + { external and export need a name after } + if not is_cdecl then + begin + if (token<>CCHAR) and (token<>CSTRING) then + consume(CSTRING); + C_name:=pattern; + consume(token); + consume(SEMICOLON); + end; + if is_cdecl and extern_Csym then + consume(SEMICOLON); + Csym:=new(pvarsym,init_C(s,C_name,p)); + if extern_Csym then + begin + Csym^.var_options:=Csym^.var_options or vo_is_external; + { correct type ?? } + externals^.concat(new(pai_external,init(Csym^.mangledname,EXT_NEAR))); + end; + symtablestack^.insert(Csym); + end + else + if (symtablestack^.symtabletype=objectsymtable) then + begin + if (token=ID) and (pattern='STATIC') and (cs_static_keyword in aktswitches) then begin current_object_option:=current_object_option or sp_static; @@ -1707,15 +1732,7 @@ unit pdecl; begin { at the right line } insert_syms(symtablestack,sc,p); - consume(SEMICOLON); - end - end - else - begin - insert_syms(symtablestack,sc,p); - if not(is_record) then - consume(SEMICOLON); - end; + end; end; while token=SEMICOLON do consume(SEMICOLON); @@ -1860,7 +1877,11 @@ unit pdecl; end. { $Log$ - Revision 1.25 1998-06-09 16:01:45 pierre + Revision 1.26 1998-06-12 10:32:30 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.25 1998/06/09 16:01:45 pierre + added procedure directive parsing for procvars (accepted are popstack cdecl and pascal) + added C vars with the following syntax diff --git a/compiler/ra68k.pas b/compiler/ra68k.pas index 31940db701..24f3cab520 100644 --- a/compiler/ra68k.pas +++ b/compiler/ra68k.pas @@ -250,7 +250,7 @@ var { Possiblities for first token in a statement: } { Local Label, Label, Directive, Prefix or Opcode.... } tokenpos.line:=current_module^.current_inputfile^.line_no; - tokenpos.column:=get_current_col; + tokenpos.column:=get_file_col; tokenpos.fileindex:=current_module^.current_index; if firsttoken and not (c in [newline,#13,'{',';']) then begin @@ -2172,7 +2172,11 @@ Begin end. { $Log$ - Revision 1.4 1998-06-04 23:51:56 peter + Revision 1.5 1998-06-12 10:32:31 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.4 1998/06/04 23:51:56 peter * m68k compiles + .def file creation moved to gendef.pas so it could also be used for win32 diff --git a/compiler/radi386.pas b/compiler/radi386.pas index d4fe355ede..b91a1cc57b 100644 --- a/compiler/radi386.pas +++ b/compiler/radi386.pas @@ -78,7 +78,7 @@ unit radi386; while not(ende) do begin tokenpos.line:=current_module^.current_inputfile^.line_no; - tokenpos.column:=get_current_col; + tokenpos.column:=get_file_col; tokenpos.fileindex:=current_module^.current_index; case c of 'A'..'Z','a'..'z','_' : begin @@ -239,7 +239,11 @@ unit radi386; end. { $Log$ - Revision 1.4 1998-06-04 23:51:58 peter + Revision 1.5 1998-06-12 10:32:32 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.4 1998/06/04 23:51:58 peter * m68k compiles + .def file creation moved to gendef.pas so it could also be used for win32 diff --git a/compiler/rai386.pas b/compiler/rai386.pas index b73df2930a..bc06417e65 100644 --- a/compiler/rai386.pas +++ b/compiler/rai386.pas @@ -351,7 +351,7 @@ var { Possiblities for first token in a statement: } { Local Label, Label, Directive, Prefix or Opcode.... } tokenpos.line:=current_module^.current_inputfile^.line_no; - tokenpos.column:=get_current_col; + tokenpos.column:=get_file_col; tokenpos.fileindex:=current_module^.current_index; if firsttoken and not (c in [newline,#13,'{',';']) then begin @@ -3376,7 +3376,11 @@ Begin end. { $Log$ - Revision 1.9 1998-05-31 14:13:32 peter + Revision 1.10 1998-06-12 10:32:33 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.9 1998/05/31 14:13:32 peter * fixed call bugs with assembler readers + OPR_SYMBOL to hold a symbol in the asm parser * fixed staticsymtable vars which were acessed through %ebp instead of diff --git a/compiler/ratti386.pas b/compiler/ratti386.pas index 175a5b4ec0..a17f818bd1 100644 --- a/compiler/ratti386.pas +++ b/compiler/ratti386.pas @@ -328,7 +328,7 @@ const { Possiblities for first token in a statement: } { Local Label, Label, Directive, Prefix or Opcode.... } tokenpos.line:=current_module^.current_inputfile^.line_no; - tokenpos.column:=get_current_col; + tokenpos.column:=get_file_col; tokenpos.fileindex:=current_module^.current_index; if firsttoken and not (c in [newline,#13,'{',';']) then begin @@ -3691,7 +3691,11 @@ end. { $Log$ - Revision 1.11 1998-05-31 14:13:35 peter + Revision 1.12 1998-06-12 10:32:35 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.11 1998/05/31 14:13:35 peter * fixed call bugs with assembler readers + OPR_SYMBOL to hold a symbol in the asm parser * fixed staticsymtable vars which were acessed through %ebp instead of diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 467644e0ed..a9415f9a1e 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -163,7 +163,10 @@ unit scanner; procedure syntaxerror(const s : string); function yylex : ttoken; function asmgetchar : char; + { column position of last token } function get_current_col : longint; + { column position of file } + function get_file_col : longint; procedure get_cur_file_pos(var fileinfo : tfileposinfo); procedure set_cur_file_pos(const fileinfo : tfileposinfo); @@ -252,16 +255,27 @@ unit scanner; end; + const + current_column : longint = 1; + function get_current_col : longint; + begin + get_current_col:=current_column; + end; + + function get_file_col : longint; + begin +(* how was expecting files larger than 2Go ??? {$ifdef TP} if lastlinepos<=lasttokenpos then - get_current_col:=longint(lasttokenpos)-longint(lastlinepos) + get_file_col:=longint(lasttokenpos)-longint(lastlinepos) else - get_current_col:=longint(lastlinepos)-longint(lasttokenpos); + get_file_col:=longint(lastlinepos)-longint(lasttokenpos); {$else} - get_current_col:=cardinal(lasttokenpos)-cardinal(lastlinepos); -{$endif} + get_file_col:=cardinal(lasttokenpos)-cardinal(lastlinepos); +{$endif} *) + get_file_col:=longint(lasttokenpos)-longint(lastlinepos); end; @@ -308,7 +322,7 @@ unit scanner; if readsize > 0 then begin { force proper line counting } - saveline:=current_module^.current_inputfile^.line_no; + saveline:=current_module^.current_inputfile^.true_line; i:=0; inputpointer:=inputbuffer; while ifileinfo.fileindex then + begin + current_module^.current_index:=fileinfo.fileindex; + current_module^.current_inputfile:= + pinputfile(current_module^.sourcefiles.get_file(fileinfo.fileindex)); + end; if assigned(current_module^.current_inputfile) then - current_module^.current_inputfile^.line_no:=fileinfo.line; - {fileinfo.fileindex:=current_module^.current_inputfile^.ref_index;} - { should allways be the same !! } - { fileinfo.column:=get_current_col; } + begin + current_module^.current_inputfile^.line_no:=fileinfo.line; + current_module^.current_inputfile^.column:=fileinfo.column; + current_column:=fileinfo.column; + end; end; procedure DoneScanner(testendif:boolean); @@ -1256,7 +1281,11 @@ exit_label: end. { $Log$ - Revision 1.23 1998-06-03 22:49:02 peter + Revision 1.24 1998-06-12 10:32:36 pierre + * column problem hopefully solved + + C vars declaration changed + + Revision 1.23 1998/06/03 22:49:02 peter + wordbool,longbool * rename bis,von -> high,low * moved some systemunit loading/creating to psystem.pas