scanner.pas 51 KB

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