scandir.inc 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Peter Vreman
  4. This unit implements directive parsing for the scanner
  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. const
  19. directivelen=15;
  20. type
  21. directivestr=string[directivelen];
  22. tdirectivetoken=(
  23. _DIR_NONE,
  24. _DIR_ALIGN,_DIR_APPTYPE,_DIR_ASMMODE,_DIR_ASSERTIONS,
  25. _DIR_BOOLEVAL,
  26. _DIR_D,_DIR_DEBUGINFO,_DIR_DEFINE,_DIR_DESCRIPTION,
  27. _DIR_ELSE,_DIR_ENDIF,_DIR_ERROR,_DIR_EXTENDEDSYNTAX,
  28. _DIR_FATAL,
  29. _DIR_GOTO,
  30. _DIR_HINT,_DIR_HINTS,
  31. _DIR_I,_DIR_I386_ATT,_DIR_I386_DIRECT,_DIR_I386_INTEL,_DIR_IOCHECKS,
  32. _DIR_IF,_DIR_IFDEF,_DIR_IFNDEF,_DIR_IFOPT,_DIR_INCLUDE,_DIR_INCLUDEPATH,
  33. _DIR_INFO,_DIR_INLINE,
  34. _DIR_L,_DIR_LIBRARYPATH,_DIR_LINK,_DIR_LINKLIB,_DIR_LOCALSYMBOLS,
  35. _DIR_LONGSTRINGS,
  36. _DIR_M,_DIR_MACRO,_DIR_MAXFPUREGISTERS,_DIR_MEMORY,_DIR_MESSAGE,_DIR_MINENUMSIZE,_DIR_MMX,_DIR_MODE,
  37. _DIR_NOTE,_DIR_NOTES,
  38. _DIR_OBJECTPATH,_DIR_OPENSTRINGS,_DIR_OUTPUT_FORMAT,_DIR_OVERFLOWCHECKS,
  39. _DIR_PACKENUM,_DIR_PACKRECORDS,
  40. {$IFDEF Testvarsets}
  41. _DIR_PACKSET,
  42. {$ENDIF}
  43. _DIR_R,_DIR_RANGECHECKS,_DIR_REFERENCEINFO,
  44. _DIR_SATURATION,_DIR_SMARTLINK,_DIR_STACKFRAMES,_DIR_STATIC,_DIR_STOP,
  45. _DIR_TYPEDADDRESS,_DIR_TYPEINFO,
  46. _DIR_UNDEF,_DIR_UNITPATH,
  47. _DIR_VARSTRINGCHECKS,_DIR_VERSION,
  48. _DIR_WAIT,_DIR_WARNING,_DIR_WARNINGS,
  49. _DIR_Z1,_DIR_Z2,_DIR_Z4
  50. );
  51. const
  52. firstdirective=_DIR_NONE;
  53. lastdirective=_DIR_Z4;
  54. directive:array[tdirectivetoken] of directivestr=(
  55. {12345678901234567890 (To determine longest string.)}
  56. '',
  57. 'ALIGN',
  58. 'APPTYPE',
  59. 'ASMMODE',
  60. 'ASSERTIONS',
  61. 'BOOLEVAL',
  62. 'D',
  63. 'DEBUGINFO',
  64. 'DEFINE',
  65. 'DESCRIPTION',
  66. 'ELSE',
  67. 'ENDIF',
  68. 'ERROR',
  69. 'EXTENDEDSYNTAX',
  70. 'FATAL',
  71. 'GOTO',
  72. 'HINT',
  73. 'HINTS',
  74. 'I',
  75. {12345678901234567890 (To determine longest string.)}
  76. 'I386_ATT',
  77. 'I386_DIRECT',
  78. 'I386_INTEL',
  79. 'IOCHECKS',
  80. 'IF',
  81. 'IFDEF',
  82. 'IFNDEF',
  83. 'IFOPT',
  84. 'INCLUDE',
  85. 'INCLUDEPATH',
  86. 'INFO',
  87. 'INLINE',
  88. 'L',
  89. 'LIBRARYPATH',
  90. 'LINK',
  91. 'LINKLIB',
  92. 'LOCALSYMBOLS',
  93. 'LONGSTRINGS',
  94. 'M',
  95. {12345678901234567890 (To determine longest string.)}
  96. 'MACRO',
  97. 'MAXFPUREGISTERS',
  98. 'MEMORY',
  99. 'MESSAGE',
  100. 'MINENUMSIZE',
  101. 'MMX',
  102. 'MODE',
  103. 'NOTE',
  104. 'NOTES',
  105. 'OBJECTPATH',
  106. 'OPENSTRINGS',
  107. 'OUTPUT_FORMAT',
  108. 'OVERFLOWCHECKS',
  109. 'PACKENUM',
  110. 'PACKRECORDS',
  111. {$IFDEF testvarsets}
  112. 'PACKSET',
  113. {$ENDIF}
  114. 'R',
  115. 'RANGECHECKS',
  116. 'REFERENCEINFO',
  117. 'SATURATION',
  118. 'SMARTLINK',
  119. {12345678901234567890 (To determine longest string.)}
  120. 'STACKFRAMES',
  121. 'STATIC',
  122. 'STOP',
  123. 'TYPEDADDRESS',
  124. 'TYPEINFO',
  125. 'UNDEF',
  126. 'UNITPATH',
  127. 'VARSTRINGCHECKS',
  128. 'VERSION',
  129. 'WAIT',
  130. 'WARNING',
  131. 'WARNINGS',
  132. 'Z1',
  133. 'Z2',
  134. 'Z4'
  135. );
  136. function Get_Directive(const hs:string):tdirectivetoken;
  137. var
  138. i : tdirectivetoken;
  139. begin
  140. for i:=firstdirective to lastdirective do
  141. if directive[i]=hs then
  142. begin
  143. Get_Directive:=i;
  144. exit;
  145. end;
  146. Get_Directive:=_DIR_NONE;
  147. end;
  148. {-------------------------------------------
  149. IF Conditional Handling
  150. -------------------------------------------}
  151. var
  152. preprocpat : string;
  153. preproc_token : ttoken;
  154. procedure preproc_consume(t : ttoken);
  155. begin
  156. if t<>preproc_token then
  157. Message(scan_e_preproc_syntax_error);
  158. preproc_token:=current_scanner^.readpreproc;
  159. end;
  160. function read_expr : string;forward;
  161. function read_factor : string;
  162. var
  163. hs : string;
  164. mac : pmacrosym;
  165. len : byte;
  166. begin
  167. if preproc_token=_ID then
  168. begin
  169. if preprocpat='NOT' then
  170. begin
  171. preproc_consume(_ID);
  172. hs:=read_expr;
  173. if hs='0' then
  174. read_factor:='1'
  175. else
  176. read_factor:='0';
  177. end
  178. else
  179. begin
  180. mac:=pmacrosym(macros^.search(hs));
  181. hs:=preprocpat;
  182. preproc_consume(_ID);
  183. if assigned(mac) then
  184. begin
  185. if mac^.defined and assigned(mac^.buftext) then
  186. begin
  187. if mac^.buflen>255 then
  188. begin
  189. len:=255;
  190. Message(scan_w_marco_cut_after_255_chars);
  191. end
  192. else
  193. len:=mac^.buflen;
  194. {$ifndef TP}
  195. {$ifopt H+}
  196. setlength(hs,len);
  197. {$else}
  198. hs[0]:=char(len);
  199. {$endif}
  200. {$else}
  201. hs[0]:=char(len);
  202. {$endif}
  203. move(mac^.buftext^,hs[1],len);
  204. end
  205. else
  206. read_factor:='';
  207. end
  208. else
  209. read_factor:=hs;
  210. end
  211. end
  212. else if preproc_token=_LKLAMMER then
  213. begin
  214. preproc_consume(_LKLAMMER);
  215. read_factor:=read_expr;
  216. preproc_consume(_RKLAMMER);
  217. end
  218. else
  219. Message(scan_e_error_in_preproc_expr);
  220. end;
  221. function read_term : string;
  222. var
  223. hs1,hs2 : string;
  224. begin
  225. hs1:=read_factor;
  226. while true do
  227. begin
  228. if (preproc_token=_ID) then
  229. begin
  230. if preprocpat='AND' then
  231. begin
  232. preproc_consume(_ID);
  233. hs2:=read_factor;
  234. if (hs1<>'0') and (hs2<>'0') then
  235. hs1:='1';
  236. end
  237. else
  238. break;
  239. end
  240. else
  241. break;
  242. end;
  243. read_term:=hs1;
  244. end;
  245. function read_simple_expr : string;
  246. var
  247. hs1,hs2 : string;
  248. begin
  249. hs1:=read_term;
  250. while true do
  251. begin
  252. if (preproc_token=_ID) then
  253. begin
  254. if preprocpat='OR' then
  255. begin
  256. preproc_consume(_ID);
  257. hs2:=read_term;
  258. if (hs1<>'0') or (hs2<>'0') then
  259. hs1:='1';
  260. end
  261. else
  262. break;
  263. end
  264. else
  265. break;
  266. end;
  267. read_simple_expr:=hs1;
  268. end;
  269. function read_expr : string;
  270. var
  271. hs1,hs2 : string;
  272. b : boolean;
  273. t : ttoken;
  274. w : integer;
  275. l1,l2 : longint;
  276. begin
  277. hs1:=read_simple_expr;
  278. t:=preproc_token;
  279. if not(t in [_EQUAL,_UNEQUAL,_LT,_GT,_LTE,_GTE]) then
  280. begin
  281. read_expr:=hs1;
  282. exit;
  283. end;
  284. preproc_consume(t);
  285. hs2:=read_simple_expr;
  286. if is_number(hs1) and is_number(hs2) then
  287. begin
  288. valint(hs1,l1,w);
  289. valint(hs2,l2,w);
  290. case t of
  291. _EQUAL : b:=l1=l2;
  292. _UNEQUAL : b:=l1<>l2;
  293. _LT : b:=l1<l2;
  294. _GT : b:=l1>l2;
  295. _GTE : b:=l1>=l2;
  296. _LTE : b:=l1<=l2;
  297. end;
  298. end
  299. else
  300. begin
  301. case t of
  302. _EQUAL : b:=hs1=hs2;
  303. _UNEQUAL : b:=hs1<>hs2;
  304. _LT : b:=hs1<hs2;
  305. _GT : b:=hs1>hs2;
  306. _GTE : b:=hs1>=hs2;
  307. _LTE : b:=hs1<=hs2;
  308. end;
  309. end;
  310. if b then
  311. read_expr:='1'
  312. else
  313. read_expr:='0';
  314. end;
  315. {-------------------------------------------
  316. Directives
  317. -------------------------------------------}
  318. function is_conditional(t:tdirectivetoken):boolean;
  319. begin
  320. is_conditional:=(t in [_DIR_ENDIF,_DIR_IFDEF,_DIR_IFNDEF,_DIR_IFOPT,_DIR_IF,_DIR_ELSE]);
  321. end;
  322. procedure dir_conditional(t:tdirectivetoken);
  323. var
  324. hs : string;
  325. mac : pmacrosym;
  326. found : boolean;
  327. state : char;
  328. oldaktfilepos : tfileposinfo;
  329. begin
  330. oldaktfilepos:=aktfilepos;
  331. while true do
  332. begin
  333. current_scanner^.gettokenpos;
  334. case t of
  335. _DIR_ENDIF : begin
  336. current_scanner^.poppreprocstack;
  337. end;
  338. _DIR_ELSE : begin
  339. current_scanner^.elsepreprocstack;
  340. end;
  341. _DIR_IFDEF : begin
  342. current_scanner^.skipspace;
  343. hs:=current_scanner^.readid;
  344. mac:=pmacrosym(macros^.search(hs));
  345. if assigned(mac) then
  346. mac^.is_used:=true;
  347. current_scanner^.addpreprocstack(pp_ifdef,assigned(mac) and mac^.defined,hs,scan_c_ifdef_found);
  348. end;
  349. _DIR_IFOPT : begin
  350. current_scanner^.skipspace;
  351. hs:=current_scanner^.readid;
  352. if (length(hs)>1) then
  353. Message(scan_w_illegal_switch)
  354. else
  355. begin
  356. state:=current_scanner^.ReadState;
  357. if state in ['-','+'] then
  358. found:=CheckSwitch(hs[1],state);
  359. end;
  360. current_scanner^.addpreprocstack(pp_ifopt,found,hs,scan_c_ifopt_found);
  361. end;
  362. _DIR_IF : begin
  363. current_scanner^.skipspace;
  364. { start preproc expression scanner }
  365. preproc_token:=current_scanner^.readpreproc;
  366. hs:=read_expr;
  367. current_scanner^.addpreprocstack(pp_if,hs<>'0',hs,scan_c_if_found);
  368. end;
  369. _DIR_IFNDEF : begin
  370. current_scanner^.skipspace;
  371. hs:=current_scanner^.readid;
  372. mac:=pmacrosym(macros^.search(hs));
  373. if assigned(mac) then
  374. mac^.is_used:=true;
  375. current_scanner^.addpreprocstack(pp_ifndef,not(assigned(mac) and mac^.defined),hs,scan_c_ifndef_found);
  376. end;
  377. end;
  378. { accept the text ? }
  379. if (current_scanner^.preprocstack=nil) or current_scanner^.preprocstack^.accept then
  380. break
  381. else
  382. begin
  383. current_scanner^.gettokenpos;
  384. Message(scan_c_skipping_until);
  385. repeat
  386. current_scanner^.skipuntildirective;
  387. t:=Get_Directive(current_scanner^.readid);
  388. until is_conditional(t);
  389. current_scanner^.gettokenpos;
  390. Message1(scan_d_handling_switch,'$'+directive[t]);
  391. end;
  392. end;
  393. aktfilepos:=oldaktfilepos;
  394. end;
  395. procedure dir_define(t:tdirectivetoken);
  396. var
  397. hs : string;
  398. bracketcount : longint;
  399. mac : pmacrosym;
  400. macropos : longint;
  401. macrobuffer : pmacrobuffer;
  402. begin
  403. current_scanner^.skipspace;
  404. hs:=current_scanner^.readid;
  405. mac:=pmacrosym(macros^.search(hs));
  406. if not assigned(mac) then
  407. begin
  408. mac:=new(pmacrosym,init(hs));
  409. mac^.defined:=true;
  410. Message1(parser_m_macro_defined,mac^.name);
  411. macros^.insert(mac);
  412. end
  413. else
  414. begin
  415. Message1(parser_m_macro_defined,mac^.name);
  416. mac^.defined:=true;
  417. { delete old definition }
  418. if assigned(mac^.buftext) then
  419. begin
  420. freemem(mac^.buftext,mac^.buflen);
  421. mac^.buftext:=nil;
  422. end;
  423. end;
  424. mac^.is_used:=true;
  425. if (cs_support_macro in aktmoduleswitches) then
  426. begin
  427. { key words are never substituted }
  428. if is_keyword(hs) then
  429. Message(scan_e_keyword_cant_be_a_macro);
  430. { !!!!!! handle macro params, need we this? }
  431. current_scanner^.skipspace;
  432. { may be a macro? }
  433. if c=':' then
  434. begin
  435. current_scanner^.readchar;
  436. if c='=' then
  437. begin
  438. new(macrobuffer);
  439. macropos:=0;
  440. { parse macro, brackets are counted so it's possible
  441. to have a $ifdef etc. in the macro }
  442. bracketcount:=0;
  443. repeat
  444. current_scanner^.readchar;
  445. case c of
  446. '}' :
  447. if (bracketcount=0) then
  448. break
  449. else
  450. dec(bracketcount);
  451. '{' :
  452. inc(bracketcount);
  453. #26 :
  454. current_scanner^.end_of_file;
  455. end;
  456. macrobuffer^[macropos]:=c;
  457. inc(macropos);
  458. if macropos>maxmacrolen then
  459. Message(scan_f_macro_buffer_overflow);
  460. until false;
  461. { free buffer of macro ?}
  462. if assigned(mac^.buftext) then
  463. freemem(mac^.buftext,mac^.buflen);
  464. { get new mem }
  465. getmem(mac^.buftext,macropos);
  466. mac^.buflen:=macropos;
  467. { copy the text }
  468. move(macrobuffer^,mac^.buftext^,macropos);
  469. dispose(macrobuffer);
  470. end;
  471. end;
  472. end;
  473. end;
  474. procedure dir_undef(t:tdirectivetoken);
  475. var
  476. hs : string;
  477. mac : pmacrosym;
  478. begin
  479. current_scanner^.skipspace;
  480. hs:=current_scanner^.readid;
  481. mac:=pmacrosym(macros^.search(hs));
  482. if not assigned(mac) then
  483. begin
  484. mac:=new(pmacrosym,init(hs));
  485. Message1(parser_m_macro_undefined,mac^.name);
  486. mac^.defined:=false;
  487. macros^.insert(mac);
  488. end
  489. else
  490. begin
  491. Message1(parser_m_macro_undefined,mac^.name);
  492. mac^.defined:=false;
  493. { delete old definition }
  494. if assigned(mac^.buftext) then
  495. begin
  496. freemem(mac^.buftext,mac^.buflen);
  497. mac^.buftext:=nil;
  498. end;
  499. end;
  500. mac^.is_used:=true;
  501. end;
  502. procedure dir_message(t:tdirectivetoken);
  503. var
  504. w : tmsgconst;
  505. begin
  506. case t of
  507. _DIR_STOP,
  508. _DIR_FATAL : w:=scan_f_user_defined;
  509. _DIR_ERROR : w:=scan_e_user_defined;
  510. _DIR_WARNING : w:=scan_w_user_defined;
  511. _DIR_HINT : w:=scan_h_user_defined;
  512. _DIR_NOTE : w:=scan_n_user_defined;
  513. _DIR_MESSAGE,
  514. _DIR_INFO : w:=scan_i_user_defined;
  515. end;
  516. current_scanner^.skipspace;
  517. Message1(w,current_scanner^.readcomment);
  518. end;
  519. procedure dir_moduleswitch(t:tdirectivetoken);
  520. var
  521. sw : tmoduleswitch;
  522. state : char;
  523. begin
  524. sw:=cs_modulenone;
  525. case t of
  526. _DIR_GOTO : sw:=cs_support_goto;
  527. _DIR_MACRO : sw:=cs_support_macro;
  528. _DIR_INLINE : sw:=cs_support_inline;
  529. _DIR_SMARTLINK : sw:=cs_create_smart;
  530. _DIR_STATIC : sw:=cs_static_keyword;
  531. end;
  532. state:=current_scanner^.readstate;
  533. if (sw<>cs_modulenone) and (state in ['-','+']) then
  534. begin
  535. if state='-' then
  536. aktmoduleswitches:=aktmoduleswitches-[sw]
  537. else
  538. aktmoduleswitches:=aktmoduleswitches+[sw];
  539. end;
  540. end;
  541. procedure dir_localswitch(t:tdirectivetoken);
  542. var
  543. sw : tlocalswitch;
  544. state : char;
  545. begin
  546. sw:=cs_localnone;
  547. {$ifdef SUPPORT_MMX}
  548. case t of
  549. _DIR_MMX : sw:=cs_mmx;
  550. _DIR_SATURATION : sw:=cs_mmx_saturation;
  551. end;
  552. {$endif}
  553. state:=current_scanner^.readstate;
  554. if (sw<>cs_localnone) and (state in ['-','+']) then
  555. begin
  556. if state='-' then
  557. aktlocalswitches:=aktlocalswitches-[sw]
  558. else
  559. aktlocalswitches:=aktlocalswitches+[sw];
  560. end;
  561. end;
  562. procedure dir_include(t:tdirectivetoken);
  563. var
  564. hs : string;
  565. path : dirstr;
  566. name : namestr;
  567. ext : extstr;
  568. hp : pinputfile;
  569. i : longint;
  570. found : boolean;
  571. begin
  572. current_scanner^.skipspace;
  573. hs:=current_scanner^.readcomment;
  574. i:=length(hs);
  575. while (i>0) and (hs[i]=' ') do
  576. dec(i);
  577. Delete(hs,i+1,length(hs)-i);
  578. if hs='' then
  579. exit;
  580. if (hs[1]='%') then
  581. begin
  582. { case insensitive }
  583. hs:=upper(hs);
  584. { remove %'s }
  585. Delete(hs,1,1);
  586. if hs[length(hs)]='%' then
  587. Delete(hs,length(hs),1);
  588. { save old }
  589. path:=hs;
  590. { first check for internal macros }
  591. if hs='TIME' then
  592. hs:=gettimestr
  593. else
  594. if hs='DATE' then
  595. hs:=getdatestr
  596. else
  597. if hs='FILE' then
  598. hs:=current_module^.sourcefiles^.get_file_name(aktfilepos.fileindex)
  599. else
  600. if hs='LINE' then
  601. hs:=tostr(aktfilepos.line)
  602. else
  603. if hs='FPCVERSION' then
  604. hs:=version_string
  605. else
  606. if hs='FPCTARGET' then
  607. hs:=target_cpu_string
  608. else
  609. hs:=getenv(hs);
  610. if hs='' then
  611. Message1(scan_w_include_env_not_found,path);
  612. { make it a stringconst }
  613. hs:=''''+hs+'''';
  614. current_scanner^.insertmacro(path,@hs[1],length(hs));
  615. end
  616. else
  617. begin
  618. hs:=FixFileName(hs);
  619. fsplit(hs,path,name,ext);
  620. { look for the include file
  621. 1. specified path,path of current inputfile,current dir
  622. 2. local includepath
  623. 3. global includepath }
  624. found:=false;
  625. if path<>'' then
  626. path:=path+';';
  627. path:=FindFile(name+ext,path+current_scanner^.inputfile^.path^+';.'+DirSep,found);
  628. if (not found) then
  629. path:=current_module^.localincludesearchpath.FindFile(name+ext,found);
  630. if (not found) then
  631. path:=includesearchpath.FindFile(name+ext,found);
  632. { shutdown current file }
  633. current_scanner^.tempcloseinputfile;
  634. { load new file }
  635. hp:=new(pinputfile,init(path+name+ext));
  636. current_scanner^.addfile(hp);
  637. if not current_scanner^.openinputfile then
  638. Message1(scan_f_cannot_open_includefile,hs);
  639. Message1(scan_t_start_include_file,current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^);
  640. current_scanner^.reload;
  641. { process first read char }
  642. case c of
  643. #26 : current_scanner^.reload;
  644. #10,
  645. #13 : current_scanner^.linebreak;
  646. end;
  647. { register for refs }
  648. current_module^.sourcefiles^.register_file(hp);
  649. end;
  650. end;
  651. procedure dir_description(t:tdirectivetoken);
  652. begin
  653. if not (target_info.target in [target_i386_os2,target_i386_win32]) then
  654. Message(scan_w_decription_not_support);
  655. { change description global var in all cases }
  656. { it not used but in win32 and os2 }
  657. current_scanner^.skipspace;
  658. description:=current_scanner^.readcomment;
  659. end;
  660. procedure dir_version(t:tdirectivetoken);
  661. var
  662. major, minor : longint;
  663. error : integer;
  664. begin
  665. if not (target_info.target in [target_i386_os2,target_i386_win32]) then
  666. begin
  667. Message(scan_n_version_not_support);
  668. exit;
  669. end;
  670. if (compile_level<>1) then
  671. Message(scan_n_only_exe_version)
  672. else
  673. begin
  674. { change description global var in all cases }
  675. { it not used but in win32 and os2 }
  676. current_scanner^.skipspace;
  677. { we should only accept Major.Minor format }
  678. current_scanner^.readnumber;
  679. major:=0;
  680. minor:=0;
  681. valint(pattern,major,error);
  682. if error<>0 then
  683. begin
  684. Message1(scan_w_wrong_version_ignored,pattern);
  685. exit;
  686. end;
  687. if c='.' then
  688. begin
  689. current_scanner^.readchar;
  690. current_scanner^.readnumber;
  691. valint(pattern,minor,error);
  692. if error<>0 then
  693. begin
  694. Message1(scan_w_wrong_version_ignored,tostr(major)+'.'+pattern);
  695. exit;
  696. end;
  697. dllmajor:=major;
  698. dllminor:=minor;
  699. dllversion:=tostr(major)+'.'+tostr(minor);
  700. end
  701. else
  702. dllversion:=tostr(major);
  703. end;
  704. end;
  705. procedure dir_linkobject(t:tdirectivetoken);
  706. var
  707. s : string;
  708. begin
  709. current_scanner^.skipspace;
  710. s:=AddExtension(FixFileName(current_scanner^.readcomment),target_info.objext);
  711. {$IFDEF NEWST}
  712. current_module^.linkotherofiles.
  713. insert(new(Plinkitem,init(s,link_allways)));
  714. {$ELSE}
  715. current_module^.linkotherofiles.
  716. insert(s,link_allways);
  717. {$ENDIF NEWST}
  718. end;
  719. procedure dir_resource(t:tdirectivetoken);
  720. var
  721. s : string;
  722. begin
  723. current_scanner^.skipspace;
  724. s:=current_scanner^.readcomment;
  725. { replace * with current module name.
  726. This should always be defined. }
  727. if s[1]='*' then
  728. if Assigned(Current_Module) then
  729. begin
  730. delete(S,1,1);
  731. insert(lower(current_module^.modulename^),S,1);
  732. end;
  733. s:=AddExtension(FixFileName(s),target_info.resext);
  734. if target_info.res<>res_none then
  735. current_module^.resourcefiles.insert(FixFileName(s))
  736. else
  737. Message(scan_e_resourcefiles_not_supported);
  738. end;
  739. procedure dir_linklib(t:tdirectivetoken);
  740. var
  741. s : string;
  742. quote : char;
  743. begin
  744. current_scanner^.skipspace;
  745. { This way spaces are also allowed in library names
  746. if quoted PM }
  747. if (c='''') or (c='"') then
  748. begin
  749. quote:=c;
  750. current_scanner^.readchar;
  751. s:=current_scanner^.readcomment;
  752. if pos(quote,s)>0 then
  753. s:=copy(s,1,pos(quote,s)-1);
  754. end
  755. else
  756. begin
  757. current_scanner^.readstring;
  758. s:=orgpattern;
  759. if c='.' then
  760. begin
  761. s:=s+'.';
  762. current_scanner^.readchar;
  763. current_scanner^.readstring;
  764. s:=s+orgpattern;
  765. end;
  766. end;
  767. {$IFDEF NEWST}
  768. current_module^.linkOtherSharedLibs.
  769. insert(new(Plinkitem,init(s,link_allways)));
  770. {$ELSE}
  771. current_module^.linkOtherSharedLibs.
  772. insert(s,link_allways);
  773. {$ENDIF}
  774. end;
  775. procedure dir_outputformat(t:tdirectivetoken);
  776. begin
  777. if not current_module^.in_global then
  778. Message(scan_w_switch_is_global)
  779. else
  780. begin
  781. current_scanner^.skipspace;
  782. if set_string_asm(current_scanner^.readid) then
  783. aktoutputformat:=target_asm.id
  784. else
  785. Message(scan_w_illegal_switch);
  786. end;
  787. end;
  788. procedure dir_unitpath(t:tdirectivetoken);
  789. begin
  790. if not current_module^.in_global then
  791. Message(scan_w_switch_is_global)
  792. else
  793. begin
  794. current_scanner^.skipspace;
  795. current_module^.localunitsearchpath.AddPath(current_scanner^.readcomment,false);
  796. end;
  797. end;
  798. procedure dir_includepath(t:tdirectivetoken);
  799. begin
  800. if not current_module^.in_global then
  801. Message(scan_w_switch_is_global)
  802. else
  803. begin
  804. current_scanner^.skipspace;
  805. current_module^.localincludesearchpath.AddPath(current_scanner^.readcomment,false);
  806. end;
  807. end;
  808. procedure dir_librarypath(t:tdirectivetoken);
  809. begin
  810. if not current_module^.in_global then
  811. Message(scan_w_switch_is_global)
  812. else
  813. begin
  814. current_scanner^.skipspace;
  815. current_module^.locallibrarysearchpath.AddPath(current_scanner^.readcomment,false);
  816. end;
  817. end;
  818. procedure dir_objectpath(t:tdirectivetoken);
  819. begin
  820. if not current_module^.in_global then
  821. Message(scan_w_switch_is_global)
  822. else
  823. begin
  824. current_scanner^.skipspace;
  825. current_module^.localobjectsearchpath.AddPath(current_scanner^.readcomment,false);
  826. end;
  827. end;
  828. procedure dir_mode(t:tdirectivetoken);
  829. begin
  830. if not current_module^.in_global then
  831. Message(scan_w_switch_is_global)
  832. else
  833. begin
  834. current_scanner^.skipspace;
  835. current_scanner^.readstring;
  836. if pattern='DEFAULT' then
  837. aktmodeswitches:=initmodeswitches
  838. else
  839. if pattern='DELPHI' then
  840. aktmodeswitches:=delphimodeswitches
  841. else
  842. if pattern='TP' then
  843. aktmodeswitches:=tpmodeswitches
  844. else
  845. if pattern='FPC' then
  846. aktmodeswitches:=fpcmodeswitches
  847. else
  848. if pattern='OBJFPC' then
  849. aktmodeswitches:=objfpcmodeswitches
  850. else
  851. if pattern='GPC' then
  852. aktmodeswitches:=gpcmodeswitches
  853. else
  854. Message(scan_w_illegal_switch);
  855. end;
  856. end;
  857. procedure dir_packrecords(t:tdirectivetoken);
  858. var
  859. hs : string;
  860. begin
  861. current_scanner^.skipspace;
  862. if not(c in ['0'..'9']) then
  863. begin
  864. hs:=current_scanner^.readid;
  865. if (hs='C') then
  866. aktpackrecords:=packrecord_C
  867. else
  868. if (hs='NORMAL') or (hs='DEFAULT') then
  869. aktpackrecords:=packrecord_2
  870. else
  871. Message(scan_w_only_pack_records);
  872. end
  873. else
  874. begin
  875. case current_scanner^.readval of
  876. 1 : aktpackrecords:=packrecord_1;
  877. 2 : aktpackrecords:=packrecord_2;
  878. 4 : aktpackrecords:=packrecord_4;
  879. 8 : aktpackrecords:=packrecord_8;
  880. 16 : aktpackrecords:=packrecord_16;
  881. 32 : aktpackrecords:=packrecord_32;
  882. else
  883. Message(scan_w_only_pack_records);
  884. end;
  885. end;
  886. end;
  887. procedure dir_maxfpuregisters(t:tdirectivetoken);
  888. var
  889. l : longint;
  890. hs : string;
  891. begin
  892. current_scanner^.skipspace;
  893. if not(c in ['0'..'9']) then
  894. begin
  895. hs:=current_scanner^.readid;
  896. if (hs='NORMAL') or (hs='DEFAULT') then
  897. aktmaxfpuregisters:=-1
  898. else
  899. Message(scan_e_invalid_maxfpureg_value);
  900. end
  901. else
  902. begin
  903. l:=current_scanner^.readval;
  904. case l of
  905. 0..8:
  906. aktmaxfpuregisters:=l;
  907. else
  908. Message(scan_e_invalid_maxfpureg_value);
  909. end;
  910. end;
  911. end;
  912. procedure dir_packenum(t:tdirectivetoken);
  913. var
  914. hs : string;
  915. begin
  916. if t in [_DIR_Z1,_DIR_Z2,_DIR_Z4] then
  917. begin
  918. aktpackenum:=ord(pattern[2])-ord('0');
  919. exit;
  920. end;
  921. current_scanner^.skipspace;
  922. if not(c in ['0'..'9']) then
  923. begin
  924. hs:=current_scanner^.readid;
  925. if (hs='NORMAL') or (hs='DEFAULT') then
  926. aktpackenum:=4
  927. else
  928. Message(scan_w_only_pack_enum);
  929. end
  930. else
  931. begin
  932. case current_scanner^.readval of
  933. 1 : aktpackenum:=1;
  934. 2 : aktpackenum:=2;
  935. 4 : aktpackenum:=4;
  936. else
  937. Message(scan_w_only_pack_enum);
  938. end;
  939. end;
  940. end;
  941. {$ifdef testvarsets}
  942. procedure dir_setalloc(t:tdirectivetoken);
  943. var
  944. hs : string;
  945. begin
  946. current_scanner^.skipspace;
  947. if not(c in ['1','2','4']) then
  948. begin
  949. hs:=current_scanner^.readid;
  950. if (hs='FIXED') or ((hs='DEFAULT') OR (hs='NORMAL')) then
  951. aktsetalloc:=0 {Fixed mode, sets are 4 or 32 bytes}
  952. else
  953. Message(scan_w_only_packset);
  954. end
  955. else
  956. begin
  957. case current_scanner^.readval of
  958. 1 : aktpackenum:=1;
  959. 2 : aktpackenum:=2;
  960. 4 : aktpackenum:=4;
  961. else
  962. Message(scan_w_only_packset);
  963. end;
  964. end;
  965. end;
  966. {$ENDIF}
  967. procedure dir_apptype(t:tdirectivetoken);
  968. var
  969. hs : string;
  970. begin
  971. if target_info.target<>target_i386_win32 then
  972. Message(scan_w_app_type_not_support);
  973. if not current_module^.in_global then
  974. Message(scan_w_switch_is_global)
  975. else
  976. begin
  977. current_scanner^.skipspace;
  978. hs:=current_scanner^.readid;
  979. if hs='GUI' then
  980. apptype:=at_gui
  981. else if hs='CONSOLE' then
  982. apptype:=at_cui
  983. else
  984. Message1(scan_w_unsupported_app_type,hs);
  985. end;
  986. end;
  987. procedure dir_wait(t:tdirectivetoken);
  988. var had_info : boolean;
  989. begin
  990. had_info:=(status.verbosity and V_Info)<>0;
  991. { this message should allways appear !! }
  992. status.verbosity:=status.verbosity or V_Info;
  993. Message(scan_i_press_enter);
  994. readln;
  995. If not(had_info) then
  996. status.verbosity:=status.verbosity and (not V_Info);
  997. end;
  998. procedure dir_asmmode(t:tdirectivetoken);
  999. var
  1000. s : string;
  1001. begin
  1002. current_scanner^.skipspace;
  1003. s:=current_scanner^.readid;
  1004. If Inside_asm_statement then
  1005. Message1(scan_w_no_asm_reader_switch_inside_asm,s);
  1006. if s='DEFAULT' then
  1007. aktasmmode:=initasmmode
  1008. else
  1009. if not set_string_asmmode(s,aktasmmode) then
  1010. Message1(scan_w_unsupported_asmmode_specifier,s);
  1011. end;
  1012. procedure dir_oldasmmode(t:tdirectivetoken);
  1013. begin
  1014. If Inside_asm_statement then
  1015. Message1(scan_w_no_asm_reader_switch_inside_asm,directive[t]);
  1016. {$ifdef i386}
  1017. case t of
  1018. _DIR_I386_ATT : aktasmmode:=asmmode_i386_att;
  1019. _DIR_I386_DIRECT : aktasmmode:=asmmode_i386_direct;
  1020. _DIR_I386_INTEL : aktasmmode:=asmmode_i386_intel;
  1021. end;
  1022. {$endif i386}
  1023. end;
  1024. procedure dir_delphiswitch(t:tdirectivetoken);
  1025. var
  1026. sw,state : char;
  1027. begin
  1028. case t of
  1029. _DIR_ALIGN : sw:='A';
  1030. _DIR_ASSERTIONS : sw:='C';
  1031. _DIR_BOOLEVAL : sw:='B';
  1032. _DIR_DEBUGINFO : sw:='D';
  1033. _DIR_IOCHECKS : sw:='I';
  1034. _DIR_LOCALSYMBOLS : sw:='L';
  1035. _DIR_LONGSTRINGS : sw:='H';
  1036. _DIR_OPENSTRINGS : sw:='P';
  1037. _DIR_OVERFLOWCHECKS : sw:='Q';
  1038. _DIR_RANGECHECKS : sw:='R';
  1039. _DIR_REFERENCEINFO : sw:='Y';
  1040. _DIR_STACKFRAMES : sw:='W';
  1041. _DIR_TYPEDADDRESS : sw:='T';
  1042. _DIR_TYPEINFO : sw:='M';
  1043. _DIR_VARSTRINGCHECKS : sw:='V';
  1044. else
  1045. exit;
  1046. end;
  1047. { c contains the next char, a + or - would be fine }
  1048. state:=current_scanner^.readstate;
  1049. if state in ['-','+'] then
  1050. HandleSwitch(sw,state);
  1051. end;
  1052. procedure dir_memory(t:tdirectivetoken);
  1053. var
  1054. l : longint;
  1055. begin
  1056. current_scanner^.skipspace;
  1057. l:=current_scanner^.readval;
  1058. if l>1024 then
  1059. stacksize:=l;
  1060. current_scanner^.skipspace;
  1061. if c=',' then
  1062. begin
  1063. current_scanner^.readchar;
  1064. current_scanner^.skipspace;
  1065. l:=current_scanner^.readval;
  1066. if l>1024 then
  1067. heapsize:=l;
  1068. end;
  1069. if c=',' then
  1070. begin
  1071. current_scanner^.readchar;
  1072. current_scanner^.skipspace;
  1073. l:=current_scanner^.readval;
  1074. { Ignore this value, because the limit is set by the OS
  1075. info and shouldn't be changed by the user (PFV) }
  1076. end;
  1077. end;
  1078. procedure dir_setverbose(t:tdirectivetoken);
  1079. var
  1080. flag,
  1081. state : char;
  1082. begin
  1083. case t of
  1084. _DIR_HINTS : flag:='H';
  1085. _DIR_WARNINGS : flag:='W';
  1086. _DIR_NOTES : flag:='N';
  1087. else
  1088. exit;
  1089. end;
  1090. { support ON/OFF }
  1091. state:=current_scanner^.ReadState;
  1092. SetVerbosity(flag+state);
  1093. end;
  1094. type
  1095. tdirectiveproc=procedure(t:tdirectivetoken);
  1096. const
  1097. directiveproc:array[tdirectivetoken] of tdirectiveproc=(
  1098. {_DIR_NONE} nil,
  1099. {_DIR_ALIGN} dir_delphiswitch,
  1100. {_DIR_APPTYPE} dir_apptype,
  1101. {_DIR_ASMMODE} dir_asmmode,
  1102. {_DIR_ASSERTION} dir_delphiswitch,
  1103. {_DIR_BOOLEVAL} dir_delphiswitch,
  1104. {_DIR_D} dir_description,
  1105. {_DIR_DEBUGINFO} dir_delphiswitch,
  1106. {_DIR_DEFINE} dir_define,
  1107. {_DIR_DESCRIPTION} dir_description,
  1108. {_DIR_ELSE} dir_conditional,
  1109. {_DIR_ENDIF} dir_conditional,
  1110. {_DIR_ERROR} dir_message,
  1111. {_DIR_EXTENDEDSYNTAX} dir_delphiswitch,
  1112. {_DIR_FATAL} dir_message,
  1113. {_DIR_GOTO} dir_moduleswitch,
  1114. {_DIR_HINT} dir_message,
  1115. {_DIR_HINTS} dir_setverbose,
  1116. {_DIR_I} dir_include,
  1117. {_DIR_I386_ATT} dir_oldasmmode,
  1118. {_DIR_I386_DIRECT} dir_oldasmmode,
  1119. {_DIR_I386_INTEL} dir_oldasmmode,
  1120. {_DIR_IOCHECKS} dir_delphiswitch,
  1121. {_DIR_IF} dir_conditional,
  1122. {_DIR_IFDEF} dir_conditional,
  1123. {_DIR_IFNDEF} dir_conditional,
  1124. {_DIR_IFOPT} dir_conditional,
  1125. {_DIR_INCLUDE} dir_include,
  1126. {_DIR_INCLUDEPATH} dir_includepath,
  1127. {_DIR_INFO} dir_message,
  1128. {_DIR_INLINE} dir_moduleswitch,
  1129. {_DIR_L} dir_linkobject,
  1130. {_DIR_LIBRARYPATH} dir_librarypath,
  1131. {_DIR_LINK} dir_linkobject,
  1132. {_DIR_LINKLIB} dir_linklib,
  1133. {_DIR_LOCALSYMBOLS} dir_delphiswitch,
  1134. {_DIR_LONGSTRINGS} dir_delphiswitch,
  1135. {_DIR_M} dir_memory,
  1136. {_DIR_MACRO} dir_moduleswitch,
  1137. {_DIR_MAXFPUREGISTERS} dir_maxfpuregisters,
  1138. {_DIR_MEMORY} dir_memory,
  1139. {_DIR_MESSAGE} dir_message,
  1140. {_DIR_MINENUMSIZE} dir_packenum,
  1141. {_DIR_MMX} dir_localswitch,
  1142. {_DIR_MODE} dir_mode,
  1143. {_DIR_NOTE} dir_message,
  1144. {_DIR_NOTES} dir_setverbose,
  1145. {_DIR_OBJECTPATH} dir_objectpath,
  1146. {_DIR_OPENSTRINGS} dir_delphiswitch,
  1147. {_DIR_OUTPUT_FORMAT} dir_outputformat,
  1148. {_DIR_OVERFLOWCHECKS} dir_delphiswitch,
  1149. {_DIR_PACKENUM} dir_packenum,
  1150. {_DIR_PACKRECORDS} dir_packrecords,
  1151. {$IFDEF TestVarsets}
  1152. {_DIR_PACKSET} dir_packset,
  1153. {$ENDIF}
  1154. {_DIR_R} dir_resource,
  1155. {_DIR_RANGECHECKS} dir_delphiswitch,
  1156. {_DIR_REFERENCEINFO} dir_delphiswitch,
  1157. {_DIR_SATURATION} dir_localswitch,
  1158. {_DIR_SMARTLINK} dir_moduleswitch,
  1159. {_DIR_STACKFRAMES} dir_delphiswitch,
  1160. {_DIR_STATIC} dir_moduleswitch,
  1161. {_DIR_STOP} dir_message,
  1162. {_DIR_TYPEDADDRESS} dir_delphiswitch,
  1163. {_DIR_TYPEINFO} dir_delphiswitch,
  1164. {_DIR_UNDEF} dir_undef,
  1165. {_DIR_UNITPATH} dir_unitpath,
  1166. {_DIR_VARSTRINGCHECKS} dir_delphiswitch,
  1167. {_DIR_VERSION} dir_version,
  1168. {_DIR_WAIT} dir_wait,
  1169. {_DIR_WARNING} dir_message,
  1170. {_DIR_WARNINGS} dir_setverbose,
  1171. {_DIR_Z1} dir_packenum,
  1172. {_DIR_Z2} dir_packenum,
  1173. {_DIR_Z4} dir_packenum
  1174. );
  1175. {-------------------------------------------
  1176. Main switches handling
  1177. -------------------------------------------}
  1178. procedure handledirectives;
  1179. var
  1180. t : tdirectivetoken;
  1181. p : tdirectiveproc;
  1182. hs : string;
  1183. begin
  1184. current_scanner^.gettokenpos;
  1185. current_scanner^.readchar; {Remove the $}
  1186. hs:=current_scanner^.readid;
  1187. if parapreprocess then
  1188. begin
  1189. t:=Get_Directive(hs);
  1190. if not(is_conditional(t) or (t=_DIR_DEFINE) or (t=_DIR_UNDEF)) then
  1191. begin
  1192. preprocfile^.AddSpace;
  1193. preprocfile^.Add('{$'+hs+current_scanner^.readcomment+'}');
  1194. exit;
  1195. end;
  1196. end;
  1197. Message1(scan_d_handling_switch,'$'+hs);
  1198. if hs='' then
  1199. Message1(scan_w_illegal_switch,'$'+hs);
  1200. { Check for compiler switches }
  1201. while (length(hs)=1) and (c in ['-','+']) do
  1202. begin
  1203. HandleSwitch(hs[1],c);
  1204. current_scanner^.readchar; {Remove + or -}
  1205. if c=',' then
  1206. begin
  1207. current_scanner^.readchar; {Remove , }
  1208. { read next switch, support $v+,$+}
  1209. hs:=current_scanner^.readid;
  1210. if (hs='') then
  1211. begin
  1212. if (c='$') and (m_fpc in aktmodeswitches) then
  1213. begin
  1214. current_scanner^.readchar; { skip $ }
  1215. hs:=current_scanner^.readid;
  1216. end;
  1217. if (hs='') then
  1218. Message1(scan_w_illegal_directive,'$'+c);
  1219. end
  1220. else
  1221. Message1(scan_d_handling_switch,'$'+hs);
  1222. end
  1223. else
  1224. hs:='';
  1225. end;
  1226. { directives may follow switches after a , }
  1227. if hs<>'' then
  1228. begin
  1229. t:=Get_Directive(hs);
  1230. if t<>_DIR_NONE then
  1231. begin
  1232. p:=directiveproc[t];
  1233. {$ifndef TP}
  1234. if assigned(p) then
  1235. {$else}
  1236. if @p<>nil then
  1237. {$endif}
  1238. p(t);
  1239. end
  1240. else
  1241. Message1(scan_w_illegal_directive,'$'+hs);
  1242. { conditionals already read the comment }
  1243. if (current_scanner^.comment_level>0) then
  1244. current_scanner^.readcomment;
  1245. { we've read the whole comment }
  1246. aktcommentstyle:=comment_none;
  1247. end;
  1248. end;
  1249. {
  1250. $Log$
  1251. Revision 1.78 2000-04-14 11:16:10 pierre
  1252. * partial linklib change
  1253. I could not use Pavel's code because it broke the current way
  1254. linklib is used, which is messy :(
  1255. + add postw32 call if external linking on win32
  1256. Revision 1.77 2000/04/08 20:18:53 michael
  1257. * Fixed bug in readcomment that was dropping * characters
  1258. Revision 1.76 2000/02/28 17:23:57 daniel
  1259. * Current work of symtable integration committed. The symtable can be
  1260. activated by defining 'newst', but doesn't compile yet. Changes in type
  1261. checking and oop are completed. What is left is to write a new
  1262. symtablestack and adapt the parser to use it.
  1263. Revision 1.75 2000/02/14 20:58:43 marco
  1264. * Basic structures for new sethandling implemented.
  1265. Revision 1.74 2000/02/09 13:23:03 peter
  1266. * log truncated
  1267. Revision 1.73 2000/01/14 14:28:40 pierre
  1268. * avoid searching of include file in start dir first
  1269. Revision 1.72 2000/01/07 01:14:37 peter
  1270. * updated copyright to 2000
  1271. Revision 1.71 2000/01/04 15:15:53 florian
  1272. + added compiler switch $maxfpuregisters
  1273. + fixed a small problem in secondvecn
  1274. Revision 1.70 1999/12/20 23:23:30 pierre
  1275. + $description $version
  1276. Revision 1.69 1999/12/02 17:34:34 peter
  1277. * preprocessor support. But it fails on the caret in type blocks
  1278. Revision 1.68 1999/11/24 11:39:53 pierre
  1279. * asmmode message was placed too early
  1280. Revision 1.67 1999/11/12 11:03:50 peter
  1281. * searchpaths changed to stringqueue object
  1282. Revision 1.66 1999/11/06 14:34:26 peter
  1283. * truncated log to 20 revs
  1284. Revision 1.65 1999/10/30 12:32:30 peter
  1285. * fixed line counter when the first line had #10 only. This was buggy
  1286. for both the main file as for include files
  1287. Revision 1.64 1999/09/27 23:38:17 peter
  1288. * bracket support for macro define
  1289. Revision 1.63 1999/09/20 16:39:02 peter
  1290. * cs_create_smart instead of cs_smartlink
  1291. * -CX is create smartlink
  1292. * -CD is create dynamic, but does nothing atm.
  1293. Revision 1.62 1999/09/03 10:00:49 peter
  1294. * included the 1.60 version of Pierre which was lost !
  1295. Revision 1.61 1999/09/02 18:47:46 daniel
  1296. * Could not compile with TP, some arrays moved to heap
  1297. * NOAG386BIN default for TP
  1298. * AG386* files were not compatible with TP, fixed.
  1299. Revision 1.60 1999/08/31 15:55:45 pierre
  1300. + tmacrosym.is_used set
  1301. Revision 1.59 1999/08/05 16:53:10 peter
  1302. * V_Fatal=1, all other V_ are also increased
  1303. * Check for local procedure when assigning procvar
  1304. * fixed comment parsing because directives
  1305. * oldtp mode directives better supported
  1306. * added some messages to errore.msg
  1307. Revision 1.58 1999/08/04 13:03:03 jonas
  1308. * all tokens now start with an underscore
  1309. * PowerPC compiles!!
  1310. Revision 1.57 1999/07/26 14:55:36 florian
  1311. * $mode gives now a warning if an unknown mode keyword follows
  1312. Revision 1.56 1999/07/23 16:05:27 peter
  1313. * alignment is now saved in the symtable
  1314. * C alignment added for records
  1315. * PPU version increased to solve .12 <-> .13 probs
  1316. }