scanner.pas 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678
  1. {
  2. $Id$
  3. Copyright (c) 1993,97 by Florian Klaempfl
  4. This unit implements the scanner part and handling of the switches
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. {$ifdef tp}
  19. {$F+,N+,E+,R-}
  20. {$endif}
  21. unit scanner;
  22. interface
  23. uses
  24. cobjects,globals,verbose,files;
  25. const
  26. {$ifdef TP}
  27. maxmacrolen=1024;
  28. InputFileBufSize=1024;
  29. linebufincrease=64;
  30. {$else}
  31. maxmacrolen=16*1024;
  32. InputFileBufSize=32*1024;
  33. linebufincrease=512;
  34. {$endif}
  35. id_len = 14;
  36. Newline = #10;
  37. type
  38. ident = string[id_len];
  39. const
  40. max_keywords = 70;
  41. anz_keywords : longint = max_keywords;
  42. { the following keywords are no keywords in TP, they
  43. are internal procedures
  44. CONTINUE, DISPOSE, EXIT, FAIL, FALSE, NEW, SELF
  45. TRUE
  46. }
  47. { INLINE is a keyword in TP, but only an modifier in FPC }
  48. keyword : array[1..max_keywords] of ident = (
  49. { 'ABSOLUTE',}
  50. 'AND',
  51. 'ARRAY','AS','ASM',
  52. { 'ASSEMBLER',}
  53. 'BEGIN',
  54. 'CASE','CLASS',
  55. 'CONST','CONSTRUCTOR',
  56. 'DESTRUCTOR','DISPOSE','DIV','DO','DOWNTO','ELSE','END',
  57. 'EXCEPT',
  58. 'EXIT',
  59. { 'EXPORT',}
  60. 'EXPORTS',
  61. { 'EXTERNAL',}
  62. 'FAIL','FALSE',
  63. { 'FAR',}
  64. 'FILE','FINALIZATION','FINALLY','FOR',
  65. { 'FORWARD',}
  66. 'FUNCTION','GOTO','IF','IMPLEMENTATION','IN',
  67. 'INHERITED','INITIALIZATION',
  68. { 'INLINE',} {INLINE is a reserved word in TP. Why?}
  69. 'INTERFACE',
  70. { 'INTERRUPT',}
  71. 'IS',
  72. 'LABEL','LIBRARY','MOD',
  73. { 'NEAR',}
  74. 'NEW','NIL','NOT','OBJECT',
  75. 'OF','ON','OPERATOR','OR','OTHERWISE','PACKED',
  76. 'PROCEDURE','PROGRAM','PROPERTY',
  77. 'RAISE','RECORD','REPEAT','SELF',
  78. 'SET','SHL','SHR','STRING','THEN','TO',
  79. 'TRUE','TRY','TYPE','UNIT','UNTIL',
  80. 'USES','VAR',
  81. { 'VIRTUAL',}
  82. 'WHILE','WITH','XOR');
  83. keyword_token : array[1..max_keywords] of ttoken = (
  84. { _ABSOLUTE,}
  85. _AND,
  86. _ARRAY,_AS,_ASM,
  87. { _ASSEMBLER,}
  88. _BEGIN,
  89. _CASE,_CLASS,
  90. _CONST,_CONSTRUCTOR,
  91. _DESTRUCTOR,_DISPOSE,_DIV,_DO,_DOWNTO,
  92. _ELSE,_END,_EXCEPT,
  93. _EXIT,
  94. { _EXPORT,}
  95. _EXPORTS,
  96. { _EXTERNAL,}
  97. _FAIL,_FALSE,
  98. { _FAR,}
  99. _FILE,_FINALIZATION,_FINALLY,_FOR,
  100. { _FORWARD,}
  101. _FUNCTION,_GOTO,_IF,_IMPLEMENTATION,_IN,
  102. _INHERITED,_INITIALIZATION,
  103. { _INLINE,}
  104. _INTERFACE,
  105. { _INTERRUPT,}
  106. _IS,
  107. _LABEL,_LIBRARY,_MOD,
  108. { _NEAR,}
  109. _NEW,_NIL,_NOT,_OBJECT,
  110. _OF,_ON,_OPERATOR,_OR,_OTHERWISE,_PACKED,
  111. _PROCEDURE,_PROGRAM,_PROPERTY,
  112. _RAISE,_RECORD,_REPEAT,_SELF,
  113. _SET,_SHL,_SHR,_STRING,_THEN,_TO,
  114. _TRUE,_TRY,_TYPE,_UNIT,_UNTIL,
  115. _USES,_VAR,
  116. { _VIRTUAL,}
  117. _WHILE,_WITH,_XOR);
  118. type
  119. pmacrobuffer = ^tmacrobuffer;
  120. tmacrobuffer = array[0..maxmacrolen-1] of char;
  121. ppreprocstack = ^tpreprocstack;
  122. tpreprocstack = object
  123. accept : boolean;
  124. next : ppreprocstack;
  125. name : stringid;
  126. line_nb : longint;
  127. constructor init(a:boolean;n:ppreprocstack);
  128. destructor done;
  129. end;
  130. pscannerfile = ^tscannerfile;
  131. tscannerfile = object
  132. inputfile : pinputfile; { current inputfile list }
  133. f : file; { current file handle }
  134. filenotatend, { still bytes left to read }
  135. closed : boolean; { is the file closed }
  136. inputbufsize : longint; { max size of the input buffer }
  137. inputbuffer,
  138. inputpointer : pchar;
  139. bufstart,
  140. bufsize : longint;
  141. line_no,
  142. lasttokenpos,
  143. lastlinepos : longint;
  144. lasttoken : ttoken;
  145. maxlinebuf : longint;
  146. linebuf : plongint;
  147. do_special, { 1=point after nr, 2=caret after id }
  148. comment_level,
  149. yylexcount : longint;
  150. lastasmgetchar : char;
  151. preprocstack : ppreprocstack;
  152. constructor init(const fn:string);
  153. destructor done;
  154. { File buffer things }
  155. function open:boolean;
  156. procedure close;
  157. function reopen:boolean;
  158. procedure seekbuf(fpos:longint);
  159. procedure readbuf;
  160. procedure saveinputfile;
  161. procedure restoreinputfile;
  162. procedure nextfile;
  163. procedure addfile(hp:pinputfile);
  164. procedure reload;
  165. procedure setbuf(p:pchar;l:longint);
  166. { Scanner things }
  167. procedure gettokenpos;
  168. procedure inc_comment_level;
  169. procedure dec_comment_level;
  170. procedure checkpreprocstack;
  171. procedure poppreprocstack;
  172. procedure addpreprocstack(a:boolean;const s:string;w:tmsgconst);
  173. procedure elsepreprocstack;
  174. procedure linebreak;
  175. procedure readchar;
  176. procedure readstring;
  177. procedure readnumber;
  178. function readid:string;
  179. function readval:longint;
  180. function readcomment:string;
  181. procedure skipspace;
  182. procedure skipuntildirective;
  183. procedure skipcomment;
  184. procedure skipdelphicomment;
  185. procedure skipoldtpcomment;
  186. function yylex:ttoken;
  187. function readpreproc:ttoken;
  188. function asmgetchar:char;
  189. end;
  190. var
  191. c : char;
  192. orgpattern,
  193. pattern : string;
  194. current_scanner : pscannerfile;
  195. { changes to keywords to be tp compatible }
  196. procedure change_to_tp_keywords;
  197. implementation
  198. uses
  199. dos,systems,symtable,switches;
  200. {*****************************************************************************
  201. Helper routines
  202. *****************************************************************************}
  203. function is_keyword(var token : ttoken) : boolean;
  204. var
  205. high,low,mid : longint;
  206. begin
  207. low:=1;
  208. high:=anz_keywords;
  209. while low<high do
  210. begin
  211. mid:=(high+low+1) shr 1;
  212. if pattern<keyword[mid] then
  213. high:=mid-1
  214. else
  215. low:=mid;
  216. end;
  217. if pattern=keyword[high] then
  218. begin
  219. token:=keyword_token[high];
  220. is_keyword:=true;
  221. end
  222. else
  223. is_keyword:=false;
  224. end;
  225. procedure remove_keyword(const s : string);
  226. var
  227. i,j : longint;
  228. begin
  229. for i:=1 to anz_keywords do
  230. begin
  231. if keyword[i]=s then
  232. begin
  233. for j:=i to anz_keywords-1 do
  234. begin
  235. keyword[j]:=keyword[j+1];
  236. keyword_token[j]:=keyword_token[j+1];
  237. end;
  238. dec(anz_keywords);
  239. break;
  240. end;
  241. end;
  242. end;
  243. procedure change_to_tp_keywords;
  244. const
  245. non_tp : array[0..14] of string[id_len] = (
  246. 'AS','CLASS','EXCEPT','FINALLY','INITIALIZATION','IS',
  247. 'ON','OPERATOR','OTHERWISE','PROPERTY','RAISE','TRY',
  248. 'EXPORTS','LIBRARY','FINALIZATION');
  249. var
  250. i : longint;
  251. begin
  252. for i:=0 to 13 do
  253. remove_keyword(non_tp[i]);
  254. end;
  255. {*****************************************************************************
  256. TPreProcStack
  257. *****************************************************************************}
  258. constructor tpreprocstack.init(a:boolean;n:ppreprocstack);
  259. begin
  260. accept:=a;
  261. next:=n;
  262. end;
  263. destructor tpreprocstack.done;
  264. begin
  265. end;
  266. {****************************************************************************
  267. TSCANNERFILE
  268. ****************************************************************************}
  269. constructor tscannerfile.init(const fn:string);
  270. begin
  271. inputfile:=new(pinputfile,init(fn));
  272. current_module^.sourcefiles.register_file(inputfile);
  273. current_module^.current_index:=inputfile^.ref_index;
  274. { reset scanner }
  275. preprocstack:=nil;
  276. comment_level:=0;
  277. do_special:=0;
  278. block_type:=bt_general;
  279. { reset buf }
  280. closed:=true;
  281. filenotatend:=true;
  282. inputbufsize:=InputFileBufSize;
  283. inputbuffer:=nil;
  284. inputpointer:=nil;
  285. bufstart:=0;
  286. bufsize:=0;
  287. { line }
  288. line_no:=0;
  289. lastlinepos:=0;
  290. lasttokenpos:=0;
  291. linebuf:=nil;
  292. maxlinebuf:=0;
  293. { load block }
  294. if not open then
  295. Message(scan_f_cannot_open_input);
  296. reload;
  297. end;
  298. destructor tscannerfile.done;
  299. begin
  300. checkpreprocstack;
  301. { close file }
  302. if not closed then
  303. close;
  304. end;
  305. procedure tscannerfile.seekbuf(fpos:longint);
  306. begin
  307. if closed then
  308. exit;
  309. seek(f,fpos);
  310. bufstart:=fpos;
  311. bufsize:=0;
  312. end;
  313. procedure tscannerfile.readbuf;
  314. {$ifdef TP}
  315. var
  316. w : word;
  317. {$endif}
  318. begin
  319. if closed then
  320. exit;
  321. inc(bufstart,bufsize);
  322. {$ifdef TP}
  323. blockread(f,inputbuffer^,inputbufsize-1,w);
  324. bufsize:=w;
  325. {$else}
  326. blockread(f,inputbuffer^,inputbufsize-1,bufsize);
  327. {$endif}
  328. inputbuffer[bufsize]:=#0;
  329. Filenotatend:=(bufsize=inputbufsize-1);
  330. end;
  331. function tscannerfile.open:boolean;
  332. var
  333. ofm : byte;
  334. begin
  335. open:=false;
  336. if not closed then
  337. exit;
  338. ofm:=filemode;
  339. filemode:=0;
  340. Assign(f,inputfile^.path^+inputfile^.name^);
  341. {$I-}
  342. reset(f,1);
  343. {$I+}
  344. filemode:=ofm;
  345. if ioresult<>0 then
  346. exit;
  347. { file }
  348. closed:=false;
  349. filenotatend:=true;
  350. Getmem(inputbuffer,inputbufsize);
  351. inputpointer:=inputbuffer;
  352. bufstart:=0;
  353. bufsize:=0;
  354. { line }
  355. line_no:=0;
  356. lastlinepos:=0;
  357. lasttokenpos:=0;
  358. open:=true;
  359. end;
  360. procedure tscannerfile.close;
  361. var
  362. i : word;
  363. begin
  364. inc(bufstart,inputpointer-inputbuffer);
  365. if not closed then
  366. begin
  367. {$I-}
  368. system.close(f);
  369. {$I+}
  370. i:=ioresult;
  371. Freemem(inputbuffer,InputFileBufSize);
  372. inputbuffer:=nil;
  373. inputpointer:=nil;
  374. closed:=true;
  375. end;
  376. end;
  377. function tscannerfile.reopen:boolean;
  378. var
  379. ofm : byte;
  380. begin
  381. reopen:=false;
  382. if not closed then
  383. exit;
  384. ofm:=filemode;
  385. filemode:=0;
  386. Assign(f,inputfile^.path^+inputfile^.name^);
  387. {$I-}
  388. reset(f,1);
  389. {$I+}
  390. filemode:=ofm;
  391. if ioresult<>0 then
  392. exit;
  393. closed:=false;
  394. { get new mem }
  395. Getmem(inputbuffer,inputbufsize);
  396. inputpointer:=inputbuffer;
  397. { restore state }
  398. seek(f,BufStart);
  399. bufsize:=0;
  400. readbuf;
  401. reopen:=true;
  402. end;
  403. procedure tscannerfile.saveinputfile;
  404. begin
  405. inputfile^.savebufstart:=bufstart;
  406. inputfile^.savebufsize:=bufsize;
  407. inputfile^.savelastlinepos:=lastlinepos;
  408. inputfile^.saveline_no:=line_no;
  409. inputfile^.saveinputbuffer:=inputbuffer;
  410. inputfile^.saveinputpointer:=inputpointer;
  411. inputfile^.linebuf:=linebuf;
  412. inputfile^.maxlinebuf:=maxlinebuf;
  413. end;
  414. procedure tscannerfile.restoreinputfile;
  415. begin
  416. bufstart:=inputfile^.savebufstart;
  417. bufsize:=inputfile^.savebufsize;
  418. lastlinepos:=inputfile^.savelastlinepos;
  419. line_no:=inputfile^.saveline_no;
  420. inputbuffer:=inputfile^.saveinputbuffer;
  421. inputpointer:=inputfile^.saveinputpointer;
  422. linebuf:=inputfile^.linebuf;
  423. maxlinebuf:=inputfile^.maxlinebuf;
  424. end;
  425. procedure tscannerfile.nextfile;
  426. begin
  427. if assigned(inputfile^.next) then
  428. begin
  429. inputfile:=inputfile^.next;
  430. restoreinputfile;
  431. end;
  432. end;
  433. procedure tscannerfile.addfile(hp:pinputfile);
  434. begin
  435. saveinputfile;
  436. { add to list }
  437. hp^.next:=inputfile;
  438. inputfile:=hp;
  439. { load new inputfile }
  440. restoreinputfile;
  441. end;
  442. procedure tscannerfile.reload;
  443. begin
  444. { safety check }
  445. if closed then
  446. exit;
  447. repeat
  448. { still more to read, then we have an illegal char }
  449. if (bufsize>0) and (inputpointer-inputbuffer<bufsize) then
  450. begin
  451. gettokenpos;
  452. Message(scan_f_illegal_char);
  453. end;
  454. { can we read more from this file ? }
  455. if filenotatend then
  456. begin
  457. readbuf;
  458. if line_no=0 then
  459. line_no:=1;
  460. inputpointer:=inputbuffer;
  461. end
  462. else
  463. begin
  464. close;
  465. { no next module, than EOF }
  466. if not assigned(inputfile^.next) then
  467. begin
  468. c:=#26;
  469. exit;
  470. end;
  471. { load next file and reopen it }
  472. nextfile;
  473. reopen;
  474. { status }
  475. Message1(scan_d_back_in,inputfile^.name^);
  476. { load some current_module fields }
  477. current_module^.current_index:=inputfile^.ref_index;
  478. end;
  479. { load next char }
  480. c:=inputpointer^;
  481. inc(longint(inputpointer));
  482. until c<>#0; { if also end, then reload again }
  483. end;
  484. procedure tscannerfile.setbuf(p:pchar;l:longint);
  485. begin
  486. inputbuffer:=p;
  487. inputbufsize:=l;
  488. inputpointer:=inputbuffer;
  489. end;
  490. procedure tscannerfile.gettokenpos;
  491. { load the values of tokenpos and lasttokenpos }
  492. begin
  493. lasttokenpos:=bufstart+(inputpointer-inputbuffer);
  494. tokenpos.line:=line_no;
  495. tokenpos.column:=lasttokenpos-lastlinepos+1;
  496. tokenpos.fileindex:=current_module^.current_index;
  497. aktfilepos:=tokenpos;
  498. end;
  499. procedure tscannerfile.inc_comment_level;
  500. begin
  501. inc(comment_level);
  502. if (comment_level>1) then
  503. Message1(scan_w_comment_level,tostr(comment_level));
  504. end;
  505. procedure tscannerfile.dec_comment_level;
  506. begin
  507. if (cs_tp_compatible in aktswitches) or
  508. (cs_delphi2_compatible in aktswitches) then
  509. comment_level:=0
  510. else
  511. dec(comment_level);
  512. end;
  513. procedure tscannerfile.linebreak;
  514. var
  515. cur : char;
  516. {$ifdef SourceLine}
  517. hp : plongint;
  518. {$endif SourceLine}
  519. begin
  520. if (byte(inputpointer^)=0) and
  521. filenotatend then
  522. begin
  523. cur:=c;
  524. reload;
  525. if byte(cur)+byte(c)<>23 then
  526. dec(longint(inputpointer));
  527. end
  528. else
  529. begin
  530. { Fix linebreak to be only newline (=#10) for all types of linebreaks }
  531. if (byte(inputpointer^)+byte(c)=23) then
  532. inc(longint(inputpointer));
  533. end;
  534. c:=newline;
  535. { increase line counters }
  536. lastlinepos:=bufstart+(inputpointer-inputbuffer);
  537. inc(line_no);
  538. { update linebuffer }
  539. {$ifdef SourceLine}
  540. if line_no>maxlinebuf then
  541. begin
  542. { create new linebuf and move old info }
  543. getmem(hp,maxlinebuf+linebufincrease);
  544. if assigned(linebuf) then
  545. begin
  546. move(linebuf^,hp^,maxlinebuf shl 2);
  547. freemem(linebuf,maxlinebuf);
  548. end;
  549. { set new linebuf }
  550. linebuf:=hp;
  551. inc(maxlinebuf,linebufincrease);
  552. end;
  553. plongint(longint(linebuf)+line_no*2)^:=lastlinepos;
  554. {$endif SourceLine}
  555. { update for status }
  556. aktfilepos.line:=line_no; { update for v_status }
  557. inc(status.compiledlines);
  558. Comment(V_Status,'');
  559. end;
  560. procedure tscannerfile.checkpreprocstack;
  561. begin
  562. { check for missing ifdefs }
  563. while assigned(preprocstack) do
  564. begin
  565. Message3(scan_e_endif_expected,'$IF(N)(DEF)',preprocstack^.name,tostr(preprocstack^.line_nb));
  566. poppreprocstack;
  567. end;
  568. end;
  569. procedure tscannerfile.poppreprocstack;
  570. var
  571. hp : ppreprocstack;
  572. begin
  573. if assigned(preprocstack) then
  574. begin
  575. hp:=preprocstack^.next;
  576. dispose(preprocstack,done);
  577. preprocstack:=hp;
  578. end
  579. else
  580. Message(scan_e_endif_without_if);
  581. end;
  582. procedure tscannerfile.addpreprocstack(a:boolean;const s:string;w:tmsgconst);
  583. begin
  584. preprocstack:=new(ppreprocstack,init(((preprocstack=nil) or preprocstack^.accept) and a,preprocstack));
  585. preprocstack^.name:=s;
  586. preprocstack^.line_nb:=line_no;
  587. if preprocstack^.accept then
  588. Message2(w,preprocstack^.name,'accepted')
  589. else
  590. Message2(w,preprocstack^.name,'rejected');
  591. end;
  592. procedure tscannerfile.elsepreprocstack;
  593. begin
  594. if assigned(preprocstack) then
  595. begin
  596. if not(assigned(preprocstack^.next)) or (preprocstack^.next^.accept) then
  597. preprocstack^.accept:=not preprocstack^.accept;
  598. if preprocstack^.accept then
  599. Message2(scan_c_else_found,preprocstack^.name,'accepted')
  600. else
  601. Message2(scan_c_else_found,preprocstack^.name,'rejected');
  602. end
  603. else
  604. Message(scan_e_endif_without_if);
  605. end;
  606. procedure tscannerfile.readchar;
  607. begin
  608. c:=inputpointer^;
  609. if c=#0 then
  610. reload
  611. else
  612. inc(longint(inputpointer));
  613. if c in [#10,#13] then
  614. linebreak;
  615. end;
  616. procedure tscannerfile.readstring;
  617. var
  618. i : longint;
  619. begin
  620. i:=0;
  621. repeat
  622. case c of
  623. '_',
  624. '0'..'9',
  625. 'A'..'Z' : begin
  626. if i<255 then
  627. begin
  628. inc(i);
  629. orgpattern[i]:=c;
  630. pattern[i]:=c;
  631. end;
  632. c:=inputpointer^;
  633. inc(longint(inputpointer));
  634. end;
  635. 'a'..'z' : begin
  636. if i<255 then
  637. begin
  638. inc(i);
  639. orgpattern[i]:=c;
  640. pattern[i]:=chr(ord(c)-32)
  641. end;
  642. c:=inputpointer^;
  643. inc(longint(inputpointer));
  644. end;
  645. #0 : reload;
  646. #13,#10 : begin
  647. linebreak;
  648. break;
  649. end;
  650. else
  651. break;
  652. end;
  653. until false;
  654. orgpattern[0]:=chr(i);
  655. pattern[0]:=chr(i);
  656. end;
  657. procedure tscannerfile.readnumber;
  658. var
  659. base,
  660. i : longint;
  661. begin
  662. case c of
  663. '%' : begin
  664. readchar;
  665. base:=2;
  666. pattern[1]:='%';
  667. i:=1;
  668. end;
  669. '$' : begin
  670. readchar;
  671. base:=16;
  672. pattern[1]:='$';
  673. i:=1;
  674. end;
  675. else
  676. begin
  677. base:=10;
  678. i:=0;
  679. end;
  680. end;
  681. while ((base>=10) and (c in ['0'..'9'])) or
  682. ((base=16) and (c in ['A'..'F','a'..'f'])) or
  683. ((base=2) and (c in ['0'..'1'])) do
  684. begin
  685. if i<255 then
  686. begin
  687. inc(i);
  688. pattern[i]:=c;
  689. end;
  690. { get next char }
  691. c:=inputpointer^;
  692. if c=#0 then
  693. reload
  694. else
  695. inc(longint(inputpointer));
  696. end;
  697. { was the next char a linebreak ? }
  698. if c in [#10,#13] then
  699. linebreak;
  700. pattern[0]:=chr(i);
  701. end;
  702. function tscannerfile.readid:string;
  703. begin
  704. readstring;
  705. readid:=pattern;
  706. end;
  707. function tscannerfile.readval:longint;
  708. var
  709. l : longint;
  710. w : word;
  711. begin
  712. readnumber;
  713. valint(pattern,l,w);
  714. readval:=l;
  715. end;
  716. function tscannerfile.readcomment:string;
  717. var
  718. i : longint;
  719. begin
  720. i:=0;
  721. repeat
  722. case c of
  723. '}' : begin
  724. readchar;
  725. dec_comment_level;
  726. break;
  727. end;
  728. #26 : Message(scan_f_end_of_file);
  729. else
  730. begin
  731. if (i<255) then
  732. begin
  733. inc(i);
  734. readcomment[i]:=c;
  735. end;
  736. end;
  737. end;
  738. c:=inputpointer^;
  739. if c=#0 then
  740. reload
  741. else
  742. inc(longint(inputpointer));
  743. if c in [#10,#13] then
  744. linebreak;
  745. until false;
  746. readcomment[0]:=chr(i);
  747. end;
  748. procedure tscannerfile.skipspace;
  749. begin
  750. while c in [' ',#9..#13] do
  751. begin
  752. c:=inputpointer^;
  753. if c=#0 then
  754. reload
  755. else
  756. inc(longint(inputpointer));
  757. if c in [#10,#13] then
  758. linebreak;
  759. end;
  760. end;
  761. procedure tscannerfile.skipuntildirective;
  762. var
  763. found : longint;
  764. begin
  765. found:=0;
  766. repeat
  767. case c of
  768. #26 : Message(scan_f_end_of_file);
  769. '{' : begin
  770. if comment_level=0 then
  771. found:=1;
  772. inc_comment_level;
  773. end;
  774. '}' : begin
  775. dec_comment_level;
  776. found:=0;
  777. end;
  778. '$' : begin
  779. if found=1 then
  780. found:=2;
  781. end;
  782. else
  783. found:=0;
  784. end;
  785. c:=inputpointer^;
  786. if c=#0 then
  787. reload
  788. else
  789. inc(longint(inputpointer));
  790. if c in [#10,#13] then
  791. linebreak;
  792. until (found=2);
  793. end;
  794. {$i scandir.inc}
  795. procedure tscannerfile.skipcomment;
  796. begin
  797. readchar;
  798. inc_comment_level;
  799. { handle compiler switches }
  800. if (c='$') then
  801. handledirectives;
  802. { handle_switches can dec comment_level, }
  803. while (comment_level>0) do
  804. begin
  805. case c of
  806. '{' : inc_comment_level;
  807. '}' : dec_comment_level;
  808. #26 : Message(scan_f_end_of_file);
  809. end;
  810. c:=inputpointer^;
  811. if c=#0 then
  812. reload
  813. else
  814. inc(longint(inputpointer));
  815. if c in [#10,#13] then
  816. linebreak;
  817. end;
  818. end;
  819. procedure tscannerfile.skipdelphicomment;
  820. begin
  821. inc_comment_level;
  822. readchar;
  823. { this is currently not supported }
  824. if c='$' then
  825. Message(scan_e_wrong_styled_switch);
  826. { skip comment }
  827. while c<>newline do
  828. begin
  829. if c=#26 then
  830. Message(scan_f_end_of_file);
  831. readchar;
  832. end;
  833. dec_comment_level;
  834. end;
  835. procedure tscannerfile.skipoldtpcomment;
  836. var
  837. found : longint;
  838. begin
  839. inc_comment_level;
  840. readchar;
  841. { this is currently not supported }
  842. if c='$' then
  843. Message(scan_e_wrong_styled_switch);
  844. { skip comment }
  845. while (comment_level>0) do
  846. begin
  847. found:=0;
  848. repeat
  849. case c of
  850. #26 : Message(scan_f_end_of_file);
  851. '*' : begin
  852. if found=3 then
  853. inc_comment_level
  854. else
  855. found:=1;
  856. end;
  857. ')' : begin
  858. if found=1 then
  859. begin
  860. dec_comment_level;
  861. if comment_level=0 then
  862. found:=2;
  863. end;
  864. end;
  865. '(' : found:=3;
  866. else
  867. found:=0;
  868. end;
  869. c:=inputpointer^;
  870. if c=#0 then
  871. reload
  872. else
  873. inc(longint(inputpointer));
  874. if c in [#10,#13] then
  875. linebreak;
  876. until (found=2);
  877. end;
  878. end;
  879. function tscannerfile.yylex : ttoken;
  880. var
  881. y : ttoken;
  882. code : word;
  883. l : longint;
  884. mac : pmacrosym;
  885. hp : pinputfile;
  886. macbuf : pchar;
  887. asciinr : string[3];
  888. label
  889. exit_label;
  890. begin
  891. { was the last character a point ? }
  892. { this code is needed because the scanner if there is a 1. found if }
  893. { this is a floating point number or range like 1..3 }
  894. if do_special>0 then
  895. begin
  896. gettokenpos;
  897. l:=do_special;
  898. do_special:=0;
  899. case l of
  900. 1 : begin
  901. if c='.' then
  902. begin
  903. readchar;
  904. yylex:=POINTPOINT;
  905. goto exit_label;
  906. end;
  907. yylex:=POINT;
  908. goto exit_label;
  909. end;
  910. 2 : begin
  911. yylex:=CARET;
  912. readchar;
  913. goto exit_label;
  914. end;
  915. end;
  916. end;
  917. { Skip all spaces and comments }
  918. repeat
  919. case c of
  920. '{' : skipcomment;
  921. ' ',#9..#13 : skipspace;
  922. else
  923. break;
  924. end;
  925. until false;
  926. { Save current token position }
  927. gettokenpos;
  928. { Check first for a identifier/keyword, this is 20+% faster (PFV) }
  929. if c in ['_','A'..'Z','a'..'z'] then
  930. begin
  931. readstring;
  932. if (length(pattern) in [2..id_len]) and is_keyword(y) then
  933. yylex:=y
  934. else
  935. begin
  936. { this takes some time ... }
  937. if support_macros then
  938. begin
  939. mac:=pmacrosym(macros^.search(pattern));
  940. if assigned(mac) and (assigned(mac^.buftext)) then
  941. begin
  942. { don't forget the last char }
  943. dec(longint(inputpointer));
  944. hp:=new(pinputfile,init('Macro '+pattern));
  945. addfile(hp);
  946. getmem(macbuf,mac^.buflen+1);
  947. setbuf(macbuf,mac^.buflen+1);
  948. { copy text }
  949. move(mac^.buftext^,inputbuffer^,mac^.buflen);
  950. { put end sign }
  951. inputbuffer[mac^.buflen+1]:=#0;
  952. { load c }
  953. c:=inputbuffer^;
  954. inputpointer:=inputbuffer+1;
  955. { handle empty macros }
  956. if c=#0 then
  957. reload;
  958. { play it again ... }
  959. inc(yylexcount);
  960. if yylexcount>16 then
  961. Message(scan_w_macro_deep_ten);
  962. {$ifdef TP}
  963. yylex:=yylex;
  964. {$else}
  965. yylex:=yylex();
  966. {$endif}
  967. { that's all folks }
  968. dec(yylexcount);
  969. exit;
  970. end;
  971. end;
  972. yylex:=ID;
  973. end;
  974. if (c='^') then
  975. do_special:=2;
  976. goto exit_label;
  977. end
  978. else
  979. begin
  980. case c of
  981. '$' : begin
  982. readnumber;
  983. yylex:=INTCONST;
  984. goto exit_label;
  985. end;
  986. '%' : begin
  987. readnumber;
  988. yylex:=INTCONST;
  989. goto exit_label;
  990. end;
  991. '0'..'9' : begin
  992. readnumber;
  993. if (c in ['.','e','E']) then
  994. begin
  995. { first check for a . }
  996. if c='.' then
  997. begin
  998. readchar;
  999. if not(c in ['0'..'9']) then
  1000. begin
  1001. do_special:=1;
  1002. yylex:=INTCONST;
  1003. goto exit_label;
  1004. end;
  1005. pattern:=pattern+'.';
  1006. while c in ['0'..'9'] do
  1007. begin
  1008. pattern:=pattern+c;
  1009. readchar;
  1010. end;
  1011. end;
  1012. { E can also follow after a point is scanned }
  1013. if c in ['e','E'] then
  1014. begin
  1015. pattern:=pattern+'E';
  1016. readchar;
  1017. if c in ['-','+'] then
  1018. begin
  1019. pattern:=pattern+c;
  1020. readchar;
  1021. end;
  1022. if not(c in ['0'..'9']) then
  1023. Message(scan_f_illegal_char);
  1024. while c in ['0'..'9'] do
  1025. begin
  1026. pattern:=pattern+c;
  1027. readchar;
  1028. end;
  1029. end;
  1030. yylex:=REALNUMBER;
  1031. goto exit_label;
  1032. end;
  1033. yylex:=INTCONST;
  1034. goto exit_label;
  1035. end;
  1036. ';' : begin
  1037. readchar;
  1038. yylex:=SEMICOLON;
  1039. goto exit_label;
  1040. end;
  1041. '[' : begin
  1042. readchar;
  1043. yylex:=LECKKLAMMER;
  1044. goto exit_label;
  1045. end;
  1046. ']' : begin
  1047. readchar;
  1048. yylex:=RECKKLAMMER;
  1049. goto exit_label;
  1050. end;
  1051. '(' : begin
  1052. readchar;
  1053. if c='*' then
  1054. begin
  1055. skipoldtpcomment;
  1056. {$ifndef TP}
  1057. yylex:=yylex();
  1058. {$else}
  1059. yylex:=yylex;
  1060. {$endif}
  1061. exit;
  1062. end;
  1063. yylex:=LKLAMMER;
  1064. goto exit_label;
  1065. end;
  1066. ')' : begin
  1067. readchar;
  1068. yylex:=RKLAMMER;
  1069. goto exit_label;
  1070. end;
  1071. '+' : begin
  1072. readchar;
  1073. if (c='=') and support_c_operators then
  1074. begin
  1075. readchar;
  1076. yylex:=_PLUSASN;
  1077. goto exit_label;
  1078. end;
  1079. yylex:=PLUS;
  1080. goto exit_label;
  1081. end;
  1082. '-' : begin
  1083. readchar;
  1084. if (c='=') and support_c_operators then
  1085. begin
  1086. readchar;
  1087. yylex:=_MINUSASN;
  1088. goto exit_label;
  1089. end;
  1090. yylex:=MINUS;
  1091. goto exit_label;
  1092. end;
  1093. ':' : begin
  1094. readchar;
  1095. if c='=' then
  1096. begin
  1097. readchar;
  1098. yylex:=ASSIGNMENT;
  1099. goto exit_label;
  1100. end;
  1101. yylex:=COLON;
  1102. goto exit_label;
  1103. end;
  1104. '*' : begin
  1105. readchar;
  1106. if (c='=') and support_c_operators then
  1107. begin
  1108. readchar;
  1109. yylex:=_STARASN;
  1110. end
  1111. else
  1112. if c='*' then
  1113. begin
  1114. readchar;
  1115. yylex:=STARSTAR;
  1116. end
  1117. else
  1118. yylex:=STAR;
  1119. goto exit_label;
  1120. end;
  1121. '/' : begin
  1122. readchar;
  1123. case c of
  1124. '=' : begin
  1125. if support_c_operators then
  1126. begin
  1127. readchar;
  1128. yylex:=_SLASHASN;
  1129. goto exit_label;
  1130. end;
  1131. end;
  1132. '/' : begin
  1133. skipdelphicomment;
  1134. {$ifndef TP}
  1135. yylex:=yylex();
  1136. {$else TP}
  1137. yylex:=yylex;
  1138. {$endif TP}
  1139. exit;
  1140. end;
  1141. end;
  1142. yylex:=SLASH;
  1143. goto exit_label;
  1144. end;
  1145. '=' : begin
  1146. readchar;
  1147. yylex:=EQUAL;
  1148. goto exit_label;
  1149. end;
  1150. '.' : begin
  1151. readchar;
  1152. if c='.' then
  1153. begin
  1154. readchar;
  1155. yylex:=POINTPOINT;
  1156. goto exit_label;
  1157. end
  1158. else
  1159. yylex:=POINT;
  1160. goto exit_label;
  1161. end;
  1162. '@' : begin
  1163. readchar;
  1164. if c='@' then
  1165. begin
  1166. readchar;
  1167. yylex:=DOUBLEADDR;
  1168. end
  1169. else
  1170. yylex:=KLAMMERAFFE;
  1171. goto exit_label;
  1172. end;
  1173. ',' : begin
  1174. readchar;
  1175. yylex:=COMMA;
  1176. goto exit_label;
  1177. end;
  1178. '''','#','^' : begin
  1179. if c='^' then
  1180. begin
  1181. readchar;
  1182. c:=upcase(c);
  1183. if not(block_type=bt_type) and (c in ['A'..'Z']) then
  1184. begin
  1185. pattern:=chr(ord(c)-64);
  1186. readchar;
  1187. end
  1188. else
  1189. begin
  1190. yylex:=CARET;
  1191. goto exit_label;
  1192. end;
  1193. end
  1194. else
  1195. pattern:='';
  1196. repeat
  1197. case c of
  1198. '#' : begin
  1199. readchar; { read # }
  1200. if c='$' then
  1201. begin
  1202. readchar; { read leading $ }
  1203. asciinr:='$';
  1204. while (upcase(c) in ['A'..'F','0'..'9']) and (length(asciinr)<3) do
  1205. begin
  1206. asciinr:=asciinr+c;
  1207. readchar;
  1208. end;
  1209. end
  1210. else
  1211. begin
  1212. asciinr:='';
  1213. while (c in ['0'..'9']) and (length(asciinr)<3) do
  1214. begin
  1215. asciinr:=asciinr+c;
  1216. readchar;
  1217. end;
  1218. end;
  1219. valint(asciinr,l,code);
  1220. if (asciinr='') or (code<>0) or
  1221. (l<0) or (l>255) then
  1222. Message(scan_e_illegal_char_const);
  1223. pattern:=pattern+chr(l);
  1224. end;
  1225. '''' : begin
  1226. repeat
  1227. readchar;
  1228. case c of
  1229. #26 : Message(scan_f_end_of_file);
  1230. newline : Message(scan_f_string_exceeds_line);
  1231. '''' : begin
  1232. readchar;
  1233. if c<>'''' then
  1234. break;
  1235. end;
  1236. end;
  1237. pattern:=pattern+c;
  1238. until false;
  1239. end;
  1240. '^' : begin
  1241. readchar;
  1242. if c<#64 then
  1243. c:=chr(ord(c)+64)
  1244. else
  1245. c:=chr(ord(c)-64);
  1246. pattern:=pattern+c;
  1247. readchar;
  1248. end;
  1249. else
  1250. break;
  1251. end;
  1252. until false;
  1253. { strings with length 1 become const chars }
  1254. if length(pattern)=1 then
  1255. yylex:=CCHAR
  1256. else
  1257. yylex:=CSTRING;
  1258. goto exit_label;
  1259. end;
  1260. '>' : begin
  1261. readchar;
  1262. case c of
  1263. '=' : begin
  1264. readchar;
  1265. yylex:=GTE;
  1266. goto exit_label;
  1267. end;
  1268. '>' : begin
  1269. readchar;
  1270. yylex:=_SHR;
  1271. goto exit_label;
  1272. end;
  1273. '<' : begin { >< is for a symetric diff for sets }
  1274. readchar;
  1275. yylex:=SYMDIF;
  1276. goto exit_label;
  1277. end;
  1278. end;
  1279. yylex:=GT;
  1280. goto exit_label;
  1281. end;
  1282. '<' : begin
  1283. readchar;
  1284. case c of
  1285. '>' : begin
  1286. readchar;
  1287. yylex:=UNEQUAL;
  1288. goto exit_label;
  1289. end;
  1290. '=' : begin
  1291. readchar;
  1292. yylex:=LTE;
  1293. goto exit_label;
  1294. end;
  1295. '<' : begin
  1296. readchar;
  1297. yylex:=_SHL;
  1298. goto exit_label;
  1299. end;
  1300. end;
  1301. yylex:=LT;
  1302. goto exit_label;
  1303. end;
  1304. #26 : begin
  1305. yylex:=_EOF;
  1306. goto exit_label;
  1307. end;
  1308. else
  1309. begin
  1310. Message(scan_f_illegal_char);
  1311. end;
  1312. end;
  1313. end;
  1314. exit_label:
  1315. end;
  1316. function tscannerfile.readpreproc:ttoken;
  1317. begin
  1318. skipspace;
  1319. case c of
  1320. 'A'..'Z',
  1321. 'a'..'z',
  1322. '_','0'..'9' : begin
  1323. preprocpat:=readid;
  1324. readpreproc:=ID;
  1325. end;
  1326. '(' : begin
  1327. readchar;
  1328. readpreproc:=LKLAMMER;
  1329. end;
  1330. ')' : begin
  1331. readchar;
  1332. readpreproc:=RKLAMMER;
  1333. end;
  1334. '+' : begin
  1335. readchar;
  1336. readpreproc:=PLUS;
  1337. end;
  1338. '-' : begin
  1339. readchar;
  1340. readpreproc:=MINUS;
  1341. end;
  1342. '*' : begin
  1343. readchar;
  1344. readpreproc:=STAR;
  1345. end;
  1346. '/' : begin
  1347. readchar;
  1348. readpreproc:=SLASH;
  1349. end;
  1350. '=' : begin
  1351. readchar;
  1352. readpreproc:=EQUAL;
  1353. end;
  1354. '>' : begin
  1355. readchar;
  1356. if c='=' then
  1357. begin
  1358. readchar;
  1359. readpreproc:=GTE;
  1360. end
  1361. else
  1362. readpreproc:=GT;
  1363. end;
  1364. '<' : begin
  1365. readchar;
  1366. case c of
  1367. '>' : begin
  1368. readchar;
  1369. readpreproc:=UNEQUAL;
  1370. end;
  1371. '=' : begin
  1372. readchar;
  1373. readpreproc:=LTE;
  1374. end;
  1375. else readpreproc:=LT;
  1376. end;
  1377. end;
  1378. #26 : Message(scan_f_end_of_file);
  1379. else
  1380. begin
  1381. readpreproc:=_EOF;
  1382. end;
  1383. end;
  1384. end;
  1385. function tscannerfile.asmgetchar : char;
  1386. begin
  1387. if lastasmgetchar<>#0 then
  1388. begin
  1389. c:=lastasmgetchar;
  1390. lastasmgetchar:=#0;
  1391. end
  1392. else
  1393. readchar;
  1394. case c of
  1395. '{' : begin
  1396. skipcomment;
  1397. lastasmgetchar:=c;
  1398. asmgetchar:=';';
  1399. exit;
  1400. end;
  1401. '/' : begin
  1402. readchar;
  1403. if c='/' then
  1404. begin
  1405. skipdelphicomment;
  1406. asmgetchar:=';';
  1407. end
  1408. else
  1409. asmgetchar:='/';
  1410. lastasmgetchar:=c;
  1411. exit;
  1412. end;
  1413. '(' : begin
  1414. readchar;
  1415. if c='*' then
  1416. begin
  1417. skipoldtpcomment;
  1418. asmgetchar:=';';
  1419. end
  1420. else
  1421. asmgetchar:='(';
  1422. lastasmgetchar:=c;
  1423. exit;
  1424. end;
  1425. else
  1426. begin
  1427. asmgetchar:=c;
  1428. end;
  1429. end;
  1430. end;
  1431. end.
  1432. {
  1433. $Log$
  1434. Revision 1.37 1998-07-23 12:40:41 michael
  1435. No nested comments in Delphi mode.
  1436. Revision 1.36 1998/07/20 22:17:17 florian
  1437. * hex constants in numeric char (#$54#$43 ...) are now allowed
  1438. * there was a bug in record_var_dec which prevents the used
  1439. of nested variant records (for example drivers.tevent of tv)
  1440. Revision 1.35 1998/07/14 21:38:13 peter
  1441. + support for with p^do constructs
  1442. Revision 1.34 1998/07/14 14:47:04 peter
  1443. * released NEWINPUT
  1444. Revision 1.33 1998/07/10 10:48:40 peter
  1445. * fixed realnumber scanning
  1446. * [] after asmblock was not uppercased anymore
  1447. Revision 1.31 1998/07/07 17:39:38 peter
  1448. * fixed $I with following eof
  1449. Revision 1.30 1998/07/07 12:32:55 peter
  1450. * status.currentsource is now calculated in verbose (more accurated)
  1451. Revision 1.29 1998/07/07 11:20:11 peter
  1452. + NEWINPUT for a better inputfile and scanner object
  1453. Revision 1.28 1998/07/01 15:26:57 peter
  1454. * better bufferfile.reset error handling
  1455. Revision 1.27 1998/06/25 08:48:19 florian
  1456. * first version of rtti support
  1457. Revision 1.26 1998/06/16 08:56:30 peter
  1458. + targetcpu
  1459. * cleaner pmodules for newppu
  1460. Revision 1.25 1998/06/13 00:10:15 peter
  1461. * working browser and newppu
  1462. * some small fixes against crashes which occured in bp7 (but not in
  1463. fpc?!)
  1464. Revision 1.24 1998/06/12 10:32:36 pierre
  1465. * column problem hopefully solved
  1466. + C vars declaration changed
  1467. Revision 1.23 1998/06/03 22:49:02 peter
  1468. + wordbool,longbool
  1469. * rename bis,von -> high,low
  1470. * moved some systemunit loading/creating to psystem.pas
  1471. Revision 1.21 1998/05/27 00:20:32 peter
  1472. * some scanner optimizes
  1473. * automaticly aout2exe for go32v1
  1474. * fixed dynamiclinker option which was added at the wrong place
  1475. Revision 1.20 1998/05/23 01:21:30 peter
  1476. + aktasmmode, aktoptprocessor, aktoutputformat
  1477. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1478. + $LIBNAME to set the library name where the unit will be put in
  1479. * splitted cgi386 a bit (codeseg to large for bp7)
  1480. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1481. Revision 1.19 1998/05/20 09:42:37 pierre
  1482. + UseTokenInfo now default
  1483. * unit in interface uses and implementation uses gives error now
  1484. * only one error for unknown symbol (uses lastsymknown boolean)
  1485. the problem came from the label code !
  1486. + first inlined procedures and function work
  1487. (warning there might be allowed cases were the result is still wrong !!)
  1488. * UseBrower updated gives a global list of all position of all used symbols
  1489. with switch -gb
  1490. Revision 1.18 1998/05/12 10:47:00 peter
  1491. * moved printstatus to verb_def
  1492. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1493. prefix like error: warning: and is included in V_Default
  1494. * fixed some messages
  1495. * first time parameter scan is only for -v and -T
  1496. - removed old style messages
  1497. Revision 1.17 1998/05/06 08:38:47 pierre
  1498. * better position info with UseTokenInfo
  1499. UseTokenInfo greatly simplified
  1500. + added check for changed tree after first time firstpass
  1501. (if we could remove all the cases were it happen
  1502. we could skip all firstpass if firstpasscount > 1)
  1503. Only with ExtDebug
  1504. Revision 1.16 1998/05/04 17:54:28 peter
  1505. + smartlinking works (only case jumptable left todo)
  1506. * redesign of systems.pas to support assemblers and linkers
  1507. + Unitname is now also in the PPU-file, increased version to 14
  1508. Revision 1.15 1998/05/01 16:38:46 florian
  1509. * handling of private and protected fixed
  1510. + change_keywords_to_tp implemented to remove
  1511. keywords which aren't supported by tp
  1512. * break and continue are now symbols of the system unit
  1513. + widestring, longstring and ansistring type released
  1514. Revision 1.14 1998/04/30 15:59:42 pierre
  1515. * GDB works again better :
  1516. correct type info in one pass
  1517. + UseTokenInfo for better source position
  1518. * fixed one remaining bug in scanner for line counts
  1519. * several little fixes
  1520. Revision 1.13 1998/04/29 13:42:27 peter
  1521. + $IOCHECKS and $ALIGN to test already, other will follow soon
  1522. * fixed the wrong linecounting with comments
  1523. Revision 1.12 1998/04/29 10:34:04 pierre
  1524. + added some code for ansistring (not complete nor working yet)
  1525. * corrected operator overloading
  1526. * corrected nasm output
  1527. + started inline procedures
  1528. + added starstarn : use ** for exponentiation (^ gave problems)
  1529. + started UseTokenInfo cond to get accurate positions
  1530. Revision 1.11 1998/04/27 23:10:29 peter
  1531. + new scanner
  1532. * $makelib -> if smartlink
  1533. * small filename fixes pmodule.setfilename
  1534. * moved import from files.pas -> import.pas
  1535. }