scanner.pas 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684
  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,comphook,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 change the #0 to a space so its seen
  449. as a seperator }
  450. if (bufsize>0) and (inputpointer-inputbuffer<bufsize) then
  451. begin
  452. c:=' ';
  453. inc(longint(inputpointer));
  454. exit;
  455. end;
  456. { can we read more from this file ? }
  457. if filenotatend then
  458. begin
  459. readbuf;
  460. if line_no=0 then
  461. line_no:=1;
  462. inputpointer:=inputbuffer;
  463. end
  464. else
  465. begin
  466. close;
  467. { no next module, than EOF }
  468. if not assigned(inputfile^.next) then
  469. begin
  470. c:=#26;
  471. exit;
  472. end;
  473. { load next file and reopen it }
  474. nextfile;
  475. reopen;
  476. { status }
  477. Message1(scan_d_back_in,inputfile^.name^);
  478. { load some current_module fields }
  479. current_module^.current_index:=inputfile^.ref_index;
  480. end;
  481. { load next char }
  482. c:=inputpointer^;
  483. inc(longint(inputpointer));
  484. until c<>#0; { if also end, then reload again }
  485. end;
  486. procedure tscannerfile.setbuf(p:pchar;l:longint);
  487. begin
  488. inputbuffer:=p;
  489. inputbufsize:=l;
  490. inputpointer:=inputbuffer;
  491. end;
  492. procedure tscannerfile.gettokenpos;
  493. { load the values of tokenpos and lasttokenpos }
  494. begin
  495. lasttokenpos:=bufstart+(inputpointer-inputbuffer);
  496. tokenpos.line:=line_no;
  497. tokenpos.column:=lasttokenpos-lastlinepos;
  498. tokenpos.fileindex:=current_module^.current_index;
  499. aktfilepos:=tokenpos;
  500. end;
  501. procedure tscannerfile.inc_comment_level;
  502. begin
  503. inc(comment_level);
  504. if (comment_level>1) then
  505. Message1(scan_w_comment_level,tostr(comment_level));
  506. end;
  507. procedure tscannerfile.dec_comment_level;
  508. begin
  509. if (cs_tp_compatible in aktmoduleswitches) or
  510. (cs_delphi2_compatible in aktmoduleswitches) then
  511. comment_level:=0
  512. else
  513. dec(comment_level);
  514. end;
  515. procedure tscannerfile.linebreak;
  516. var
  517. cur : char;
  518. {$ifdef SourceLine}
  519. hp : plongint;
  520. {$endif SourceLine}
  521. begin
  522. if (byte(inputpointer^)=0) and
  523. filenotatend then
  524. begin
  525. cur:=c;
  526. reload;
  527. if byte(cur)+byte(c)<>23 then
  528. dec(longint(inputpointer));
  529. end
  530. else
  531. begin
  532. { Fix linebreak to be only newline (=#10) for all types of linebreaks }
  533. if (byte(inputpointer^)+byte(c)=23) then
  534. inc(longint(inputpointer));
  535. end;
  536. c:=newline;
  537. { increase line counters }
  538. lastlinepos:=bufstart+(inputpointer-inputbuffer);
  539. inc(line_no);
  540. { update linebuffer }
  541. {$ifdef SourceLine}
  542. if line_no>maxlinebuf then
  543. begin
  544. { create new linebuf and move old info }
  545. getmem(hp,maxlinebuf+linebufincrease);
  546. if assigned(linebuf) then
  547. begin
  548. move(linebuf^,hp^,maxlinebuf shl 2);
  549. freemem(linebuf,maxlinebuf);
  550. end;
  551. { set new linebuf }
  552. linebuf:=hp;
  553. inc(maxlinebuf,linebufincrease);
  554. end;
  555. plongint(longint(linebuf)+line_no*2)^:=lastlinepos;
  556. {$endif SourceLine}
  557. { update for status and call the show status routine }
  558. aktfilepos.line:=line_no; { update for v_status }
  559. inc(status.compiledlines);
  560. ShowStatus;
  561. end;
  562. procedure tscannerfile.checkpreprocstack;
  563. begin
  564. { check for missing ifdefs }
  565. while assigned(preprocstack) do
  566. begin
  567. Message3(scan_e_endif_expected,'$IF(N)(DEF)',preprocstack^.name,tostr(preprocstack^.line_nb));
  568. poppreprocstack;
  569. end;
  570. end;
  571. procedure tscannerfile.poppreprocstack;
  572. var
  573. hp : ppreprocstack;
  574. begin
  575. if assigned(preprocstack) then
  576. begin
  577. hp:=preprocstack^.next;
  578. dispose(preprocstack,done);
  579. preprocstack:=hp;
  580. end
  581. else
  582. Message(scan_e_endif_without_if);
  583. end;
  584. procedure tscannerfile.addpreprocstack(a:boolean;const s:string;w:tmsgconst);
  585. begin
  586. preprocstack:=new(ppreprocstack,init(((preprocstack=nil) or preprocstack^.accept) and a,preprocstack));
  587. preprocstack^.name:=s;
  588. preprocstack^.line_nb:=line_no;
  589. if preprocstack^.accept then
  590. Message2(w,preprocstack^.name,'accepted')
  591. else
  592. Message2(w,preprocstack^.name,'rejected');
  593. end;
  594. procedure tscannerfile.elsepreprocstack;
  595. begin
  596. if assigned(preprocstack) then
  597. begin
  598. if not(assigned(preprocstack^.next)) or (preprocstack^.next^.accept) then
  599. preprocstack^.accept:=not preprocstack^.accept;
  600. if preprocstack^.accept then
  601. Message2(scan_c_else_found,preprocstack^.name,'accepted')
  602. else
  603. Message2(scan_c_else_found,preprocstack^.name,'rejected');
  604. end
  605. else
  606. Message(scan_e_endif_without_if);
  607. end;
  608. procedure tscannerfile.readchar;
  609. begin
  610. c:=inputpointer^;
  611. if c=#0 then
  612. reload
  613. else
  614. inc(longint(inputpointer));
  615. if c in [#10,#13] then
  616. linebreak;
  617. end;
  618. procedure tscannerfile.readstring;
  619. var
  620. i : longint;
  621. begin
  622. i:=0;
  623. repeat
  624. case c of
  625. '_',
  626. '0'..'9',
  627. 'A'..'Z' : begin
  628. if i<255 then
  629. begin
  630. inc(i);
  631. orgpattern[i]:=c;
  632. pattern[i]:=c;
  633. end;
  634. c:=inputpointer^;
  635. inc(longint(inputpointer));
  636. end;
  637. 'a'..'z' : begin
  638. if i<255 then
  639. begin
  640. inc(i);
  641. orgpattern[i]:=c;
  642. pattern[i]:=chr(ord(c)-32)
  643. end;
  644. c:=inputpointer^;
  645. inc(longint(inputpointer));
  646. end;
  647. #0 : reload;
  648. #13,#10 : begin
  649. linebreak;
  650. break;
  651. end;
  652. else
  653. break;
  654. end;
  655. until false;
  656. orgpattern[0]:=chr(i);
  657. pattern[0]:=chr(i);
  658. end;
  659. procedure tscannerfile.readnumber;
  660. var
  661. base,
  662. i : longint;
  663. begin
  664. case c of
  665. '%' : begin
  666. readchar;
  667. base:=2;
  668. pattern[1]:='%';
  669. i:=1;
  670. end;
  671. '$' : begin
  672. readchar;
  673. base:=16;
  674. pattern[1]:='$';
  675. i:=1;
  676. end;
  677. else
  678. begin
  679. base:=10;
  680. i:=0;
  681. end;
  682. end;
  683. while ((base>=10) and (c in ['0'..'9'])) or
  684. ((base=16) and (c in ['A'..'F','a'..'f'])) or
  685. ((base=2) and (c in ['0'..'1'])) do
  686. begin
  687. if i<255 then
  688. begin
  689. inc(i);
  690. pattern[i]:=c;
  691. end;
  692. { get next char }
  693. c:=inputpointer^;
  694. if c=#0 then
  695. reload
  696. else
  697. inc(longint(inputpointer));
  698. end;
  699. { was the next char a linebreak ? }
  700. if c in [#10,#13] then
  701. linebreak;
  702. pattern[0]:=chr(i);
  703. end;
  704. function tscannerfile.readid:string;
  705. begin
  706. readstring;
  707. readid:=pattern;
  708. end;
  709. function tscannerfile.readval:longint;
  710. var
  711. l : longint;
  712. w : word;
  713. begin
  714. readnumber;
  715. valint(pattern,l,w);
  716. readval:=l;
  717. end;
  718. function tscannerfile.readcomment:string;
  719. var
  720. i : longint;
  721. begin
  722. i:=0;
  723. repeat
  724. case c of
  725. '}' : begin
  726. readchar;
  727. dec_comment_level;
  728. break;
  729. end;
  730. #26 : Message(scan_f_end_of_file);
  731. else
  732. begin
  733. if (i<255) then
  734. begin
  735. inc(i);
  736. readcomment[i]:=c;
  737. end;
  738. end;
  739. end;
  740. c:=inputpointer^;
  741. if c=#0 then
  742. reload
  743. else
  744. inc(longint(inputpointer));
  745. if c in [#10,#13] then
  746. linebreak;
  747. until false;
  748. readcomment[0]:=chr(i);
  749. end;
  750. procedure tscannerfile.skipspace;
  751. begin
  752. while c in [' ',#9..#13] do
  753. begin
  754. c:=inputpointer^;
  755. if c=#0 then
  756. reload
  757. else
  758. inc(longint(inputpointer));
  759. if c in [#10,#13] then
  760. linebreak;
  761. end;
  762. end;
  763. procedure tscannerfile.skipuntildirective;
  764. var
  765. found : longint;
  766. begin
  767. found:=0;
  768. repeat
  769. case c of
  770. #26 : Message(scan_f_end_of_file);
  771. '{' : begin
  772. if comment_level=0 then
  773. found:=1;
  774. inc_comment_level;
  775. end;
  776. '}' : begin
  777. dec_comment_level;
  778. found:=0;
  779. end;
  780. '$' : begin
  781. if found=1 then
  782. found:=2;
  783. end;
  784. else
  785. found:=0;
  786. end;
  787. c:=inputpointer^;
  788. if c=#0 then
  789. reload
  790. else
  791. inc(longint(inputpointer));
  792. if c in [#10,#13] then
  793. linebreak;
  794. until (found=2);
  795. end;
  796. {$i scandir.inc}
  797. procedure tscannerfile.skipcomment;
  798. begin
  799. readchar;
  800. inc_comment_level;
  801. { handle compiler switches }
  802. if (c='$') then
  803. handledirectives;
  804. { handle_switches can dec comment_level, }
  805. while (comment_level>0) do
  806. begin
  807. case c of
  808. '{' : inc_comment_level;
  809. '}' : dec_comment_level;
  810. #26 : Message(scan_f_end_of_file);
  811. end;
  812. c:=inputpointer^;
  813. if c=#0 then
  814. reload
  815. else
  816. inc(longint(inputpointer));
  817. if c in [#10,#13] then
  818. linebreak;
  819. end;
  820. end;
  821. procedure tscannerfile.skipdelphicomment;
  822. begin
  823. inc_comment_level;
  824. readchar;
  825. { this is currently not supported }
  826. if c='$' then
  827. Message(scan_e_wrong_styled_switch);
  828. { skip comment }
  829. while c<>newline do
  830. begin
  831. if c=#26 then
  832. Message(scan_f_end_of_file);
  833. readchar;
  834. end;
  835. dec_comment_level;
  836. end;
  837. procedure tscannerfile.skipoldtpcomment;
  838. var
  839. found : longint;
  840. begin
  841. inc_comment_level;
  842. readchar;
  843. { this is currently not supported }
  844. if c='$' then
  845. Message(scan_e_wrong_styled_switch);
  846. { skip comment }
  847. while (comment_level>0) do
  848. begin
  849. found:=0;
  850. repeat
  851. case c of
  852. #26 : Message(scan_f_end_of_file);
  853. '*' : begin
  854. if found=3 then
  855. inc_comment_level
  856. else
  857. found:=1;
  858. end;
  859. ')' : begin
  860. if found=1 then
  861. begin
  862. dec_comment_level;
  863. if comment_level=0 then
  864. found:=2;
  865. end;
  866. end;
  867. '(' : found:=3;
  868. else
  869. found:=0;
  870. end;
  871. c:=inputpointer^;
  872. if c=#0 then
  873. reload
  874. else
  875. inc(longint(inputpointer));
  876. if c in [#10,#13] then
  877. linebreak;
  878. until (found=2);
  879. end;
  880. end;
  881. function tscannerfile.yylex : ttoken;
  882. var
  883. y : ttoken;
  884. code : word;
  885. l : longint;
  886. mac : pmacrosym;
  887. hp : pinputfile;
  888. macbuf : pchar;
  889. asciinr : string[3];
  890. label
  891. exit_label;
  892. begin
  893. { was the last character a point ? }
  894. { this code is needed because the scanner if there is a 1. found if }
  895. { this is a floating point number or range like 1..3 }
  896. if do_special>0 then
  897. begin
  898. gettokenpos;
  899. l:=do_special;
  900. do_special:=0;
  901. case l of
  902. 1 : begin
  903. if c='.' then
  904. begin
  905. readchar;
  906. yylex:=POINTPOINT;
  907. goto exit_label;
  908. end;
  909. yylex:=POINT;
  910. goto exit_label;
  911. end;
  912. 2 : begin
  913. yylex:=CARET;
  914. readchar;
  915. goto exit_label;
  916. end;
  917. end;
  918. end;
  919. { Skip all spaces and comments }
  920. repeat
  921. case c of
  922. '{' : skipcomment;
  923. ' ',#9..#13 : skipspace;
  924. else
  925. break;
  926. end;
  927. until false;
  928. { Save current token position }
  929. gettokenpos;
  930. { Check first for a identifier/keyword, this is 20+% faster (PFV) }
  931. if c in ['_','A'..'Z','a'..'z'] then
  932. begin
  933. readstring;
  934. if (length(pattern) in [2..id_len]) and is_keyword(y) then
  935. yylex:=y
  936. else
  937. begin
  938. { this takes some time ... }
  939. if (cs_support_macro in aktmoduleswitches) then
  940. begin
  941. mac:=pmacrosym(macros^.search(pattern));
  942. if assigned(mac) and (assigned(mac^.buftext)) then
  943. begin
  944. { don't forget the last char }
  945. dec(longint(inputpointer));
  946. hp:=new(pinputfile,init('Macro '+pattern));
  947. addfile(hp);
  948. getmem(macbuf,mac^.buflen+1);
  949. setbuf(macbuf,mac^.buflen+1);
  950. { copy text }
  951. move(mac^.buftext^,inputbuffer^,mac^.buflen);
  952. { put end sign }
  953. inputbuffer[mac^.buflen+1]:=#0;
  954. { load c }
  955. c:=inputbuffer^;
  956. inputpointer:=inputbuffer+1;
  957. { handle empty macros }
  958. if c=#0 then
  959. reload;
  960. { play it again ... }
  961. inc(yylexcount);
  962. if yylexcount>16 then
  963. Message(scan_w_macro_deep_ten);
  964. {$ifdef TP}
  965. yylex:=yylex;
  966. {$else}
  967. yylex:=yylex();
  968. {$endif}
  969. { that's all folks }
  970. dec(yylexcount);
  971. exit;
  972. end;
  973. end;
  974. yylex:=ID;
  975. end;
  976. if (c='^') then
  977. do_special:=2;
  978. goto exit_label;
  979. end
  980. else
  981. begin
  982. case c of
  983. '$' : begin
  984. readnumber;
  985. yylex:=INTCONST;
  986. goto exit_label;
  987. end;
  988. '%' : begin
  989. readnumber;
  990. yylex:=INTCONST;
  991. goto exit_label;
  992. end;
  993. '0'..'9' : begin
  994. readnumber;
  995. if (c in ['.','e','E']) then
  996. begin
  997. { first check for a . }
  998. if c='.' then
  999. begin
  1000. readchar;
  1001. if not(c in ['0'..'9']) then
  1002. begin
  1003. do_special:=1;
  1004. yylex:=INTCONST;
  1005. goto exit_label;
  1006. end;
  1007. pattern:=pattern+'.';
  1008. while c in ['0'..'9'] do
  1009. begin
  1010. pattern:=pattern+c;
  1011. readchar;
  1012. end;
  1013. end;
  1014. { E can also follow after a point is scanned }
  1015. if c in ['e','E'] then
  1016. begin
  1017. pattern:=pattern+'E';
  1018. readchar;
  1019. if c in ['-','+'] then
  1020. begin
  1021. pattern:=pattern+c;
  1022. readchar;
  1023. end;
  1024. if not(c in ['0'..'9']) then
  1025. Message(scan_f_illegal_char);
  1026. while c in ['0'..'9'] do
  1027. begin
  1028. pattern:=pattern+c;
  1029. readchar;
  1030. end;
  1031. end;
  1032. yylex:=REALNUMBER;
  1033. goto exit_label;
  1034. end;
  1035. yylex:=INTCONST;
  1036. goto exit_label;
  1037. end;
  1038. ';' : begin
  1039. readchar;
  1040. yylex:=SEMICOLON;
  1041. goto exit_label;
  1042. end;
  1043. '[' : begin
  1044. readchar;
  1045. yylex:=LECKKLAMMER;
  1046. goto exit_label;
  1047. end;
  1048. ']' : begin
  1049. readchar;
  1050. yylex:=RECKKLAMMER;
  1051. goto exit_label;
  1052. end;
  1053. '(' : begin
  1054. readchar;
  1055. if c='*' then
  1056. begin
  1057. skipoldtpcomment;
  1058. {$ifndef TP}
  1059. yylex:=yylex();
  1060. {$else}
  1061. yylex:=yylex;
  1062. {$endif}
  1063. exit;
  1064. end;
  1065. yylex:=LKLAMMER;
  1066. goto exit_label;
  1067. end;
  1068. ')' : begin
  1069. readchar;
  1070. yylex:=RKLAMMER;
  1071. goto exit_label;
  1072. end;
  1073. '+' : begin
  1074. readchar;
  1075. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1076. begin
  1077. readchar;
  1078. yylex:=_PLUSASN;
  1079. goto exit_label;
  1080. end;
  1081. yylex:=PLUS;
  1082. goto exit_label;
  1083. end;
  1084. '-' : begin
  1085. readchar;
  1086. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1087. begin
  1088. readchar;
  1089. yylex:=_MINUSASN;
  1090. goto exit_label;
  1091. end;
  1092. yylex:=MINUS;
  1093. goto exit_label;
  1094. end;
  1095. ':' : begin
  1096. readchar;
  1097. if c='=' then
  1098. begin
  1099. readchar;
  1100. yylex:=ASSIGNMENT;
  1101. goto exit_label;
  1102. end;
  1103. yylex:=COLON;
  1104. goto exit_label;
  1105. end;
  1106. '*' : begin
  1107. readchar;
  1108. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1109. begin
  1110. readchar;
  1111. yylex:=_STARASN;
  1112. end
  1113. else
  1114. if c='*' then
  1115. begin
  1116. readchar;
  1117. yylex:=STARSTAR;
  1118. end
  1119. else
  1120. yylex:=STAR;
  1121. goto exit_label;
  1122. end;
  1123. '/' : begin
  1124. readchar;
  1125. case c of
  1126. '=' : begin
  1127. if (cs_support_c_operators in aktmoduleswitches) then
  1128. begin
  1129. readchar;
  1130. yylex:=_SLASHASN;
  1131. goto exit_label;
  1132. end;
  1133. end;
  1134. '/' : begin
  1135. skipdelphicomment;
  1136. {$ifndef TP}
  1137. yylex:=yylex();
  1138. {$else TP}
  1139. yylex:=yylex;
  1140. {$endif TP}
  1141. exit;
  1142. end;
  1143. end;
  1144. yylex:=SLASH;
  1145. goto exit_label;
  1146. end;
  1147. '=' : begin
  1148. readchar;
  1149. yylex:=EQUAL;
  1150. goto exit_label;
  1151. end;
  1152. '.' : begin
  1153. readchar;
  1154. if c='.' then
  1155. begin
  1156. readchar;
  1157. yylex:=POINTPOINT;
  1158. goto exit_label;
  1159. end
  1160. else
  1161. yylex:=POINT;
  1162. goto exit_label;
  1163. end;
  1164. '@' : begin
  1165. readchar;
  1166. if c='@' then
  1167. begin
  1168. readchar;
  1169. yylex:=DOUBLEADDR;
  1170. end
  1171. else
  1172. yylex:=KLAMMERAFFE;
  1173. goto exit_label;
  1174. end;
  1175. ',' : begin
  1176. readchar;
  1177. yylex:=COMMA;
  1178. goto exit_label;
  1179. end;
  1180. '''','#','^' : begin
  1181. if c='^' then
  1182. begin
  1183. readchar;
  1184. c:=upcase(c);
  1185. if not(block_type=bt_type) and (c in ['A'..'Z']) then
  1186. begin
  1187. pattern:=chr(ord(c)-64);
  1188. readchar;
  1189. end
  1190. else
  1191. begin
  1192. yylex:=CARET;
  1193. goto exit_label;
  1194. end;
  1195. end
  1196. else
  1197. pattern:='';
  1198. repeat
  1199. case c of
  1200. '#' : begin
  1201. readchar; { read # }
  1202. if c='$' then
  1203. begin
  1204. readchar; { read leading $ }
  1205. asciinr:='$';
  1206. while (upcase(c) in ['A'..'F','0'..'9']) and (length(asciinr)<3) do
  1207. begin
  1208. asciinr:=asciinr+c;
  1209. readchar;
  1210. end;
  1211. end
  1212. else
  1213. begin
  1214. asciinr:='';
  1215. while (c in ['0'..'9']) and (length(asciinr)<3) do
  1216. begin
  1217. asciinr:=asciinr+c;
  1218. readchar;
  1219. end;
  1220. end;
  1221. valint(asciinr,l,code);
  1222. if (asciinr='') or (code<>0) or
  1223. (l<0) or (l>255) then
  1224. Message(scan_e_illegal_char_const);
  1225. pattern:=pattern+chr(l);
  1226. end;
  1227. '''' : begin
  1228. repeat
  1229. readchar;
  1230. case c of
  1231. #26 : Message(scan_f_end_of_file);
  1232. newline : Message(scan_f_string_exceeds_line);
  1233. '''' : begin
  1234. readchar;
  1235. if c<>'''' then
  1236. break;
  1237. end;
  1238. end;
  1239. pattern:=pattern+c;
  1240. until false;
  1241. end;
  1242. '^' : begin
  1243. readchar;
  1244. if c<#64 then
  1245. c:=chr(ord(c)+64)
  1246. else
  1247. c:=chr(ord(c)-64);
  1248. pattern:=pattern+c;
  1249. readchar;
  1250. end;
  1251. else
  1252. break;
  1253. end;
  1254. until false;
  1255. { strings with length 1 become const chars }
  1256. if length(pattern)=1 then
  1257. yylex:=CCHAR
  1258. else
  1259. yylex:=CSTRING;
  1260. goto exit_label;
  1261. end;
  1262. '>' : begin
  1263. readchar;
  1264. case c of
  1265. '=' : begin
  1266. readchar;
  1267. yylex:=GTE;
  1268. goto exit_label;
  1269. end;
  1270. '>' : begin
  1271. readchar;
  1272. yylex:=_SHR;
  1273. goto exit_label;
  1274. end;
  1275. '<' : begin { >< is for a symetric diff for sets }
  1276. readchar;
  1277. yylex:=SYMDIF;
  1278. goto exit_label;
  1279. end;
  1280. end;
  1281. yylex:=GT;
  1282. goto exit_label;
  1283. end;
  1284. '<' : begin
  1285. readchar;
  1286. case c of
  1287. '>' : begin
  1288. readchar;
  1289. yylex:=UNEQUAL;
  1290. goto exit_label;
  1291. end;
  1292. '=' : begin
  1293. readchar;
  1294. yylex:=LTE;
  1295. goto exit_label;
  1296. end;
  1297. '<' : begin
  1298. readchar;
  1299. yylex:=_SHL;
  1300. goto exit_label;
  1301. end;
  1302. end;
  1303. yylex:=LT;
  1304. goto exit_label;
  1305. end;
  1306. #26 : begin
  1307. yylex:=_EOF;
  1308. goto exit_label;
  1309. end;
  1310. else
  1311. begin
  1312. Message(scan_f_illegal_char);
  1313. end;
  1314. end;
  1315. end;
  1316. exit_label:
  1317. end;
  1318. function tscannerfile.readpreproc:ttoken;
  1319. begin
  1320. skipspace;
  1321. case c of
  1322. 'A'..'Z',
  1323. 'a'..'z',
  1324. '_','0'..'9' : begin
  1325. preprocpat:=readid;
  1326. readpreproc:=ID;
  1327. end;
  1328. '(' : begin
  1329. readchar;
  1330. readpreproc:=LKLAMMER;
  1331. end;
  1332. ')' : begin
  1333. readchar;
  1334. readpreproc:=RKLAMMER;
  1335. end;
  1336. '+' : begin
  1337. readchar;
  1338. readpreproc:=PLUS;
  1339. end;
  1340. '-' : begin
  1341. readchar;
  1342. readpreproc:=MINUS;
  1343. end;
  1344. '*' : begin
  1345. readchar;
  1346. readpreproc:=STAR;
  1347. end;
  1348. '/' : begin
  1349. readchar;
  1350. readpreproc:=SLASH;
  1351. end;
  1352. '=' : begin
  1353. readchar;
  1354. readpreproc:=EQUAL;
  1355. end;
  1356. '>' : begin
  1357. readchar;
  1358. if c='=' then
  1359. begin
  1360. readchar;
  1361. readpreproc:=GTE;
  1362. end
  1363. else
  1364. readpreproc:=GT;
  1365. end;
  1366. '<' : begin
  1367. readchar;
  1368. case c of
  1369. '>' : begin
  1370. readchar;
  1371. readpreproc:=UNEQUAL;
  1372. end;
  1373. '=' : begin
  1374. readchar;
  1375. readpreproc:=LTE;
  1376. end;
  1377. else readpreproc:=LT;
  1378. end;
  1379. end;
  1380. #26 : Message(scan_f_end_of_file);
  1381. else
  1382. begin
  1383. readpreproc:=_EOF;
  1384. end;
  1385. end;
  1386. end;
  1387. function tscannerfile.asmgetchar : char;
  1388. begin
  1389. if lastasmgetchar<>#0 then
  1390. begin
  1391. c:=lastasmgetchar;
  1392. lastasmgetchar:=#0;
  1393. end
  1394. else
  1395. readchar;
  1396. case c of
  1397. '{' : begin
  1398. skipcomment;
  1399. lastasmgetchar:=c;
  1400. asmgetchar:=';';
  1401. exit;
  1402. end;
  1403. '/' : begin
  1404. readchar;
  1405. if c='/' then
  1406. begin
  1407. skipdelphicomment;
  1408. asmgetchar:=';';
  1409. end
  1410. else
  1411. asmgetchar:='/';
  1412. lastasmgetchar:=c;
  1413. exit;
  1414. end;
  1415. '(' : begin
  1416. readchar;
  1417. if c='*' then
  1418. begin
  1419. skipoldtpcomment;
  1420. asmgetchar:=';';
  1421. end
  1422. else
  1423. asmgetchar:='(';
  1424. lastasmgetchar:=c;
  1425. exit;
  1426. end;
  1427. else
  1428. begin
  1429. asmgetchar:=c;
  1430. end;
  1431. end;
  1432. end;
  1433. end.
  1434. {
  1435. $Log$
  1436. Revision 1.39 1998-08-10 14:50:26 peter
  1437. + localswitches, moduleswitches, globalswitches splitting
  1438. Revision 1.38 1998/08/10 10:18:34 peter
  1439. + Compiler,Comphook unit which are the new interface units to the
  1440. compiler
  1441. Revision 1.37 1998/07/23 12:40:41 michael
  1442. No nested comments in Delphi mode.
  1443. Revision 1.36 1998/07/20 22:17:17 florian
  1444. * hex constants in numeric char (#$54#$43 ...) are now allowed
  1445. * there was a bug in record_var_dec which prevents the used
  1446. of nested variant records (for example drivers.tevent of tv)
  1447. Revision 1.35 1998/07/14 21:38:13 peter
  1448. + support for with p^do constructs
  1449. Revision 1.34 1998/07/14 14:47:04 peter
  1450. * released NEWINPUT
  1451. Revision 1.33 1998/07/10 10:48:40 peter
  1452. * fixed realnumber scanning
  1453. * [] after asmblock was not uppercased anymore
  1454. Revision 1.31 1998/07/07 17:39:38 peter
  1455. * fixed $I with following eof
  1456. Revision 1.30 1998/07/07 12:32:55 peter
  1457. * status.currentsource is now calculated in verbose (more accurated)
  1458. Revision 1.29 1998/07/07 11:20:11 peter
  1459. + NEWINPUT for a better inputfile and scanner object
  1460. Revision 1.28 1998/07/01 15:26:57 peter
  1461. * better bufferfile.reset error handling
  1462. Revision 1.27 1998/06/25 08:48:19 florian
  1463. * first version of rtti support
  1464. Revision 1.26 1998/06/16 08:56:30 peter
  1465. + targetcpu
  1466. * cleaner pmodules for newppu
  1467. Revision 1.25 1998/06/13 00:10:15 peter
  1468. * working browser and newppu
  1469. * some small fixes against crashes which occured in bp7 (but not in
  1470. fpc?!)
  1471. Revision 1.24 1998/06/12 10:32:36 pierre
  1472. * column problem hopefully solved
  1473. + C vars declaration changed
  1474. Revision 1.23 1998/06/03 22:49:02 peter
  1475. + wordbool,longbool
  1476. * rename bis,von -> high,low
  1477. * moved some systemunit loading/creating to psystem.pas
  1478. Revision 1.21 1998/05/27 00:20:32 peter
  1479. * some scanner optimizes
  1480. * automaticly aout2exe for go32v1
  1481. * fixed dynamiclinker option which was added at the wrong place
  1482. Revision 1.20 1998/05/23 01:21:30 peter
  1483. + aktasmmode, aktoptprocessor, aktoutputformat
  1484. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1485. + $LIBNAME to set the library name where the unit will be put in
  1486. * splitted cgi386 a bit (codeseg to large for bp7)
  1487. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1488. Revision 1.19 1998/05/20 09:42:37 pierre
  1489. + UseTokenInfo now default
  1490. * unit in interface uses and implementation uses gives error now
  1491. * only one error for unknown symbol (uses lastsymknown boolean)
  1492. the problem came from the label code !
  1493. + first inlined procedures and function work
  1494. (warning there might be allowed cases were the result is still wrong !!)
  1495. * UseBrower updated gives a global list of all position of all used symbols
  1496. with switch -gb
  1497. Revision 1.18 1998/05/12 10:47:00 peter
  1498. * moved printstatus to verb_def
  1499. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1500. prefix like error: warning: and is included in V_Default
  1501. * fixed some messages
  1502. * first time parameter scan is only for -v and -T
  1503. - removed old style messages
  1504. Revision 1.17 1998/05/06 08:38:47 pierre
  1505. * better position info with UseTokenInfo
  1506. UseTokenInfo greatly simplified
  1507. + added check for changed tree after first time firstpass
  1508. (if we could remove all the cases were it happen
  1509. we could skip all firstpass if firstpasscount > 1)
  1510. Only with ExtDebug
  1511. Revision 1.16 1998/05/04 17:54:28 peter
  1512. + smartlinking works (only case jumptable left todo)
  1513. * redesign of systems.pas to support assemblers and linkers
  1514. + Unitname is now also in the PPU-file, increased version to 14
  1515. Revision 1.15 1998/05/01 16:38:46 florian
  1516. * handling of private and protected fixed
  1517. + change_keywords_to_tp implemented to remove
  1518. keywords which aren't supported by tp
  1519. * break and continue are now symbols of the system unit
  1520. + widestring, longstring and ansistring type released
  1521. Revision 1.14 1998/04/30 15:59:42 pierre
  1522. * GDB works again better :
  1523. correct type info in one pass
  1524. + UseTokenInfo for better source position
  1525. * fixed one remaining bug in scanner for line counts
  1526. * several little fixes
  1527. Revision 1.13 1998/04/29 13:42:27 peter
  1528. + $IOCHECKS and $ALIGN to test already, other will follow soon
  1529. * fixed the wrong linecounting with comments
  1530. Revision 1.12 1998/04/29 10:34:04 pierre
  1531. + added some code for ansistring (not complete nor working yet)
  1532. * corrected operator overloading
  1533. * corrected nasm output
  1534. + started inline procedures
  1535. + added starstarn : use ** for exponentiation (^ gave problems)
  1536. + started UseTokenInfo cond to get accurate positions
  1537. Revision 1.11 1998/04/27 23:10:29 peter
  1538. + new scanner
  1539. * $makelib -> if smartlink
  1540. * small filename fixes pmodule.setfilename
  1541. * moved import from files.pas -> import.pas
  1542. }