scandir.inc 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427
  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. nextaktlocalswitches:=aktlocalswitches-[sw]
  558. else
  559. nextaktlocalswitches:=aktlocalswitches+[sw];
  560. localswitcheschanged:=true;
  561. end;
  562. end;
  563. procedure dir_include(t:tdirectivetoken);
  564. var
  565. hs : string;
  566. path : dirstr;
  567. name : namestr;
  568. ext : extstr;
  569. hp : pinputfile;
  570. i : longint;
  571. found : boolean;
  572. begin
  573. current_scanner^.skipspace;
  574. hs:=current_scanner^.readcomment;
  575. i:=length(hs);
  576. while (i>0) and (hs[i]=' ') do
  577. dec(i);
  578. Delete(hs,i+1,length(hs)-i);
  579. if hs='' then
  580. exit;
  581. if (hs[1]='%') then
  582. begin
  583. { case insensitive }
  584. hs:=upper(hs);
  585. { remove %'s }
  586. Delete(hs,1,1);
  587. if hs[length(hs)]='%' then
  588. Delete(hs,length(hs),1);
  589. { save old }
  590. path:=hs;
  591. { first check for internal macros }
  592. if hs='TIME' then
  593. hs:=gettimestr
  594. else
  595. if hs='DATE' then
  596. hs:=getdatestr
  597. else
  598. if hs='FILE' then
  599. hs:=current_module^.sourcefiles^.get_file_name(aktfilepos.fileindex)
  600. else
  601. if hs='LINE' then
  602. hs:=tostr(aktfilepos.line)
  603. else
  604. if hs='FPCVERSION' then
  605. hs:=version_string
  606. else
  607. if hs='FPCTARGET' then
  608. hs:=target_cpu_string
  609. else
  610. hs:=getenv(hs);
  611. if hs='' then
  612. Message1(scan_w_include_env_not_found,path);
  613. { make it a stringconst }
  614. hs:=''''+hs+'''';
  615. current_scanner^.insertmacro(path,@hs[1],length(hs));
  616. end
  617. else
  618. begin
  619. hs:=FixFileName(hs);
  620. fsplit(hs,path,name,ext);
  621. { look for the include file
  622. 1. specified path,path of current inputfile,current dir
  623. 2. local includepath
  624. 3. global includepath }
  625. found:=false;
  626. if path<>'' then
  627. path:=path+';';
  628. path:=FindFile(name+ext,path+current_scanner^.inputfile^.path^+';.'+DirSep,found);
  629. if (not found) then
  630. path:=current_module^.localincludesearchpath.FindFile(name+ext,found);
  631. if (not found) then
  632. path:=includesearchpath.FindFile(name+ext,found);
  633. { shutdown current file }
  634. current_scanner^.tempcloseinputfile;
  635. { load new file }
  636. hp:=new(pinputfile,init(path+name+ext));
  637. current_scanner^.addfile(hp);
  638. if not current_scanner^.openinputfile then
  639. Message1(scan_f_cannot_open_includefile,hs);
  640. Message1(scan_t_start_include_file,current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^);
  641. current_scanner^.reload;
  642. { process first read char }
  643. case c of
  644. #26 : current_scanner^.reload;
  645. #10,
  646. #13 : current_scanner^.linebreak;
  647. end;
  648. { register for refs }
  649. current_module^.sourcefiles^.register_file(hp);
  650. end;
  651. end;
  652. procedure dir_description(t:tdirectivetoken);
  653. begin
  654. if not (target_info.target in [target_i386_os2,target_i386_win32]) then
  655. Message(scan_w_decription_not_support);
  656. { change description global var in all cases }
  657. { it not used but in win32 and os2 }
  658. current_scanner^.skipspace;
  659. description:=current_scanner^.readcomment;
  660. end;
  661. procedure dir_version(t:tdirectivetoken);
  662. var
  663. major, minor : longint;
  664. error : integer;
  665. begin
  666. if not (target_info.target in [target_i386_os2,target_i386_win32]) then
  667. begin
  668. Message(scan_n_version_not_support);
  669. exit;
  670. end;
  671. if (compile_level<>1) then
  672. Message(scan_n_only_exe_version)
  673. else
  674. begin
  675. { change description global var in all cases }
  676. { it not used but in win32 and os2 }
  677. current_scanner^.skipspace;
  678. { we should only accept Major.Minor format }
  679. current_scanner^.readnumber;
  680. major:=0;
  681. minor:=0;
  682. valint(pattern,major,error);
  683. if error<>0 then
  684. begin
  685. Message1(scan_w_wrong_version_ignored,pattern);
  686. exit;
  687. end;
  688. if c='.' then
  689. begin
  690. current_scanner^.readchar;
  691. current_scanner^.readnumber;
  692. valint(pattern,minor,error);
  693. if error<>0 then
  694. begin
  695. Message1(scan_w_wrong_version_ignored,tostr(major)+'.'+pattern);
  696. exit;
  697. end;
  698. dllmajor:=major;
  699. dllminor:=minor;
  700. dllversion:=tostr(major)+'.'+tostr(minor);
  701. end
  702. else
  703. dllversion:=tostr(major);
  704. end;
  705. end;
  706. procedure dir_linkobject(t:tdirectivetoken);
  707. var
  708. s : string;
  709. begin
  710. current_scanner^.skipspace;
  711. s:=AddExtension(FixFileName(current_scanner^.readcomment),target_info.objext);
  712. {$IFDEF NEWST}
  713. current_module^.linkotherofiles.
  714. insert(new(Plinkitem,init(s,link_allways)));
  715. {$ELSE}
  716. current_module^.linkotherofiles.
  717. insert(s,link_allways);
  718. {$ENDIF NEWST}
  719. end;
  720. procedure dir_resource(t:tdirectivetoken);
  721. var
  722. s : string;
  723. begin
  724. current_scanner^.skipspace;
  725. s:=current_scanner^.readcomment;
  726. { replace * with current module name.
  727. This should always be defined. }
  728. if s[1]='*' then
  729. if Assigned(Current_Module) then
  730. begin
  731. delete(S,1,1);
  732. insert(lower(current_module^.modulename^),S,1);
  733. end;
  734. s:=AddExtension(FixFileName(s),target_info.resext);
  735. if target_info.res<>res_none then
  736. current_module^.resourcefiles.insert(FixFileName(s))
  737. else
  738. Message(scan_e_resourcefiles_not_supported);
  739. end;
  740. procedure dir_linklib(t:tdirectivetoken);
  741. var
  742. s : string;
  743. quote : char;
  744. begin
  745. current_scanner^.skipspace;
  746. { This way spaces are also allowed in library names
  747. if quoted PM }
  748. if (c='''') or (c='"') then
  749. begin
  750. quote:=c;
  751. current_scanner^.readchar;
  752. s:=current_scanner^.readcomment;
  753. if pos(quote,s)>0 then
  754. s:=copy(s,1,pos(quote,s)-1);
  755. end
  756. else
  757. begin
  758. current_scanner^.readstring;
  759. s:=orgpattern;
  760. if c='.' then
  761. begin
  762. s:=s+'.';
  763. current_scanner^.readchar;
  764. current_scanner^.readstring;
  765. s:=s+orgpattern;
  766. end;
  767. end;
  768. {$IFDEF NEWST}
  769. current_module^.linkOtherSharedLibs.
  770. insert(new(Plinkitem,init(s,link_allways)));
  771. {$ELSE}
  772. current_module^.linkOtherSharedLibs.
  773. insert(s,link_allways);
  774. {$ENDIF}
  775. end;
  776. procedure dir_outputformat(t:tdirectivetoken);
  777. begin
  778. if not current_module^.in_global then
  779. Message(scan_w_switch_is_global)
  780. else
  781. begin
  782. current_scanner^.skipspace;
  783. if set_string_asm(current_scanner^.readid) then
  784. aktoutputformat:=target_asm.id
  785. else
  786. Message(scan_w_illegal_switch);
  787. end;
  788. end;
  789. procedure dir_unitpath(t:tdirectivetoken);
  790. begin
  791. if not current_module^.in_global then
  792. Message(scan_w_switch_is_global)
  793. else
  794. begin
  795. current_scanner^.skipspace;
  796. current_module^.localunitsearchpath.AddPath(current_scanner^.readcomment,false);
  797. end;
  798. end;
  799. procedure dir_includepath(t:tdirectivetoken);
  800. begin
  801. if not current_module^.in_global then
  802. Message(scan_w_switch_is_global)
  803. else
  804. begin
  805. current_scanner^.skipspace;
  806. current_module^.localincludesearchpath.AddPath(current_scanner^.readcomment,false);
  807. end;
  808. end;
  809. procedure dir_librarypath(t:tdirectivetoken);
  810. begin
  811. if not current_module^.in_global then
  812. Message(scan_w_switch_is_global)
  813. else
  814. begin
  815. current_scanner^.skipspace;
  816. current_module^.locallibrarysearchpath.AddPath(current_scanner^.readcomment,false);
  817. end;
  818. end;
  819. procedure dir_objectpath(t:tdirectivetoken);
  820. begin
  821. if not current_module^.in_global then
  822. Message(scan_w_switch_is_global)
  823. else
  824. begin
  825. current_scanner^.skipspace;
  826. current_module^.localobjectsearchpath.AddPath(current_scanner^.readcomment,false);
  827. end;
  828. end;
  829. procedure dir_mode(t:tdirectivetoken);
  830. begin
  831. if not current_module^.in_global then
  832. Message(scan_w_switch_is_global)
  833. else
  834. begin
  835. current_scanner^.skipspace;
  836. current_scanner^.readstring;
  837. if pattern='DEFAULT' then
  838. aktmodeswitches:=initmodeswitches
  839. else
  840. if pattern='DELPHI' then
  841. aktmodeswitches:=delphimodeswitches
  842. else
  843. if pattern='TP' then
  844. aktmodeswitches:=tpmodeswitches
  845. else
  846. if pattern='FPC' then
  847. aktmodeswitches:=fpcmodeswitches
  848. else
  849. if pattern='OBJFPC' then
  850. aktmodeswitches:=objfpcmodeswitches
  851. else
  852. if pattern='GPC' then
  853. aktmodeswitches:=gpcmodeswitches
  854. else
  855. Message(scan_w_illegal_switch);
  856. end;
  857. end;
  858. procedure dir_packrecords(t:tdirectivetoken);
  859. var
  860. hs : string;
  861. begin
  862. current_scanner^.skipspace;
  863. if not(c in ['0'..'9']) then
  864. begin
  865. hs:=current_scanner^.readid;
  866. if (hs='C') then
  867. aktpackrecords:=packrecord_C
  868. else
  869. if (hs='NORMAL') or (hs='DEFAULT') then
  870. aktpackrecords:=packrecord_2
  871. else
  872. Message(scan_w_only_pack_records);
  873. end
  874. else
  875. begin
  876. case current_scanner^.readval of
  877. 1 : aktpackrecords:=packrecord_1;
  878. 2 : aktpackrecords:=packrecord_2;
  879. 4 : aktpackrecords:=packrecord_4;
  880. 8 : aktpackrecords:=packrecord_8;
  881. 16 : aktpackrecords:=packrecord_16;
  882. 32 : aktpackrecords:=packrecord_32;
  883. else
  884. Message(scan_w_only_pack_records);
  885. end;
  886. end;
  887. end;
  888. procedure dir_maxfpuregisters(t:tdirectivetoken);
  889. var
  890. l : longint;
  891. hs : string;
  892. begin
  893. current_scanner^.skipspace;
  894. if not(c in ['0'..'9']) then
  895. begin
  896. hs:=current_scanner^.readid;
  897. if (hs='NORMAL') or (hs='DEFAULT') then
  898. aktmaxfpuregisters:=-1
  899. else
  900. Message(scan_e_invalid_maxfpureg_value);
  901. end
  902. else
  903. begin
  904. l:=current_scanner^.readval;
  905. case l of
  906. 0..8:
  907. aktmaxfpuregisters:=l;
  908. else
  909. Message(scan_e_invalid_maxfpureg_value);
  910. end;
  911. end;
  912. end;
  913. procedure dir_packenum(t:tdirectivetoken);
  914. var
  915. hs : string;
  916. begin
  917. if t in [_DIR_Z1,_DIR_Z2,_DIR_Z4] then
  918. begin
  919. aktpackenum:=ord(pattern[2])-ord('0');
  920. exit;
  921. end;
  922. current_scanner^.skipspace;
  923. if not(c in ['0'..'9']) then
  924. begin
  925. hs:=current_scanner^.readid;
  926. if (hs='NORMAL') or (hs='DEFAULT') then
  927. aktpackenum:=4
  928. else
  929. Message(scan_w_only_pack_enum);
  930. end
  931. else
  932. begin
  933. case current_scanner^.readval of
  934. 1 : aktpackenum:=1;
  935. 2 : aktpackenum:=2;
  936. 4 : aktpackenum:=4;
  937. else
  938. Message(scan_w_only_pack_enum);
  939. end;
  940. end;
  941. end;
  942. {$ifdef testvarsets}
  943. procedure dir_setalloc(t:tdirectivetoken);
  944. var
  945. hs : string;
  946. begin
  947. current_scanner^.skipspace;
  948. if not(c in ['1','2','4']) then
  949. begin
  950. hs:=current_scanner^.readid;
  951. if (hs='FIXED') or ((hs='DEFAULT') OR (hs='NORMAL')) then
  952. aktsetalloc:=0 {Fixed mode, sets are 4 or 32 bytes}
  953. else
  954. Message(scan_w_only_packset);
  955. end
  956. else
  957. begin
  958. case current_scanner^.readval of
  959. 1 : aktpackenum:=1;
  960. 2 : aktpackenum:=2;
  961. 4 : aktpackenum:=4;
  962. else
  963. Message(scan_w_only_packset);
  964. end;
  965. end;
  966. end;
  967. {$ENDIF}
  968. procedure dir_apptype(t:tdirectivetoken);
  969. var
  970. hs : string;
  971. begin
  972. if target_info.target<>target_i386_win32 then
  973. Message(scan_w_app_type_not_support);
  974. if not current_module^.in_global then
  975. Message(scan_w_switch_is_global)
  976. else
  977. begin
  978. current_scanner^.skipspace;
  979. hs:=current_scanner^.readid;
  980. if hs='GUI' then
  981. apptype:=at_gui
  982. else if hs='CONSOLE' then
  983. apptype:=at_cui
  984. else
  985. Message1(scan_w_unsupported_app_type,hs);
  986. end;
  987. end;
  988. procedure dir_wait(t:tdirectivetoken);
  989. var had_info : boolean;
  990. begin
  991. had_info:=(status.verbosity and V_Info)<>0;
  992. { this message should allways appear !! }
  993. status.verbosity:=status.verbosity or V_Info;
  994. Message(scan_i_press_enter);
  995. readln;
  996. If not(had_info) then
  997. status.verbosity:=status.verbosity and (not V_Info);
  998. end;
  999. procedure dir_asmmode(t:tdirectivetoken);
  1000. var
  1001. s : string;
  1002. begin
  1003. current_scanner^.skipspace;
  1004. s:=current_scanner^.readid;
  1005. If Inside_asm_statement then
  1006. Message1(scan_w_no_asm_reader_switch_inside_asm,s);
  1007. if s='DEFAULT' then
  1008. aktasmmode:=initasmmode
  1009. else
  1010. if not set_string_asmmode(s,aktasmmode) then
  1011. Message1(scan_w_unsupported_asmmode_specifier,s);
  1012. end;
  1013. procedure dir_oldasmmode(t:tdirectivetoken);
  1014. begin
  1015. If Inside_asm_statement then
  1016. Message1(scan_w_no_asm_reader_switch_inside_asm,directive[t]);
  1017. {$ifdef i386}
  1018. case t of
  1019. _DIR_I386_ATT : aktasmmode:=asmmode_i386_att;
  1020. _DIR_I386_DIRECT : aktasmmode:=asmmode_i386_direct;
  1021. _DIR_I386_INTEL : aktasmmode:=asmmode_i386_intel;
  1022. end;
  1023. {$endif i386}
  1024. end;
  1025. procedure dir_delphiswitch(t:tdirectivetoken);
  1026. var
  1027. sw,state : char;
  1028. begin
  1029. case t of
  1030. _DIR_ALIGN : sw:='A';
  1031. _DIR_ASSERTIONS : sw:='C';
  1032. _DIR_BOOLEVAL : sw:='B';
  1033. _DIR_DEBUGINFO : sw:='D';
  1034. _DIR_IOCHECKS : sw:='I';
  1035. _DIR_LOCALSYMBOLS : sw:='L';
  1036. _DIR_LONGSTRINGS : sw:='H';
  1037. _DIR_OPENSTRINGS : sw:='P';
  1038. _DIR_OVERFLOWCHECKS : sw:='Q';
  1039. _DIR_RANGECHECKS : sw:='R';
  1040. _DIR_REFERENCEINFO : sw:='Y';
  1041. _DIR_STACKFRAMES : sw:='W';
  1042. _DIR_TYPEDADDRESS : sw:='T';
  1043. _DIR_TYPEINFO : sw:='M';
  1044. _DIR_VARSTRINGCHECKS : sw:='V';
  1045. else
  1046. exit;
  1047. end;
  1048. { c contains the next char, a + or - would be fine }
  1049. state:=current_scanner^.readstate;
  1050. if state in ['-','+'] then
  1051. HandleSwitch(sw,state);
  1052. end;
  1053. procedure dir_memory(t:tdirectivetoken);
  1054. var
  1055. l : longint;
  1056. begin
  1057. current_scanner^.skipspace;
  1058. l:=current_scanner^.readval;
  1059. if l>1024 then
  1060. stacksize:=l;
  1061. current_scanner^.skipspace;
  1062. if c=',' then
  1063. begin
  1064. current_scanner^.readchar;
  1065. current_scanner^.skipspace;
  1066. l:=current_scanner^.readval;
  1067. if l>1024 then
  1068. heapsize:=l;
  1069. end;
  1070. if c=',' then
  1071. begin
  1072. current_scanner^.readchar;
  1073. current_scanner^.skipspace;
  1074. l:=current_scanner^.readval;
  1075. { Ignore this value, because the limit is set by the OS
  1076. info and shouldn't be changed by the user (PFV) }
  1077. end;
  1078. end;
  1079. procedure dir_setverbose(t:tdirectivetoken);
  1080. var
  1081. flag,
  1082. state : char;
  1083. begin
  1084. case t of
  1085. _DIR_HINTS : flag:='H';
  1086. _DIR_WARNINGS : flag:='W';
  1087. _DIR_NOTES : flag:='N';
  1088. else
  1089. exit;
  1090. end;
  1091. { support ON/OFF }
  1092. state:=current_scanner^.ReadState;
  1093. SetVerbosity(flag+state);
  1094. end;
  1095. type
  1096. tdirectiveproc=procedure(t:tdirectivetoken);
  1097. const
  1098. directiveproc:array[tdirectivetoken] of tdirectiveproc=(
  1099. {_DIR_NONE} nil,
  1100. {_DIR_ALIGN} dir_delphiswitch,
  1101. {_DIR_APPTYPE} dir_apptype,
  1102. {_DIR_ASMMODE} dir_asmmode,
  1103. {_DIR_ASSERTION} dir_delphiswitch,
  1104. {_DIR_BOOLEVAL} dir_delphiswitch,
  1105. {_DIR_D} dir_description,
  1106. {_DIR_DEBUGINFO} dir_delphiswitch,
  1107. {_DIR_DEFINE} dir_define,
  1108. {_DIR_DESCRIPTION} dir_description,
  1109. {_DIR_ELSE} dir_conditional,
  1110. {_DIR_ENDIF} dir_conditional,
  1111. {_DIR_ERROR} dir_message,
  1112. {_DIR_EXTENDEDSYNTAX} dir_delphiswitch,
  1113. {_DIR_FATAL} dir_message,
  1114. {_DIR_GOTO} dir_moduleswitch,
  1115. {_DIR_HINT} dir_message,
  1116. {_DIR_HINTS} dir_setverbose,
  1117. {_DIR_I} dir_include,
  1118. {_DIR_I386_ATT} dir_oldasmmode,
  1119. {_DIR_I386_DIRECT} dir_oldasmmode,
  1120. {_DIR_I386_INTEL} dir_oldasmmode,
  1121. {_DIR_IOCHECKS} dir_delphiswitch,
  1122. {_DIR_IF} dir_conditional,
  1123. {_DIR_IFDEF} dir_conditional,
  1124. {_DIR_IFNDEF} dir_conditional,
  1125. {_DIR_IFOPT} dir_conditional,
  1126. {_DIR_INCLUDE} dir_include,
  1127. {_DIR_INCLUDEPATH} dir_includepath,
  1128. {_DIR_INFO} dir_message,
  1129. {_DIR_INLINE} dir_moduleswitch,
  1130. {_DIR_L} dir_linkobject,
  1131. {_DIR_LIBRARYPATH} dir_librarypath,
  1132. {_DIR_LINK} dir_linkobject,
  1133. {_DIR_LINKLIB} dir_linklib,
  1134. {_DIR_LOCALSYMBOLS} dir_delphiswitch,
  1135. {_DIR_LONGSTRINGS} dir_delphiswitch,
  1136. {_DIR_M} dir_memory,
  1137. {_DIR_MACRO} dir_moduleswitch,
  1138. {_DIR_MAXFPUREGISTERS} dir_maxfpuregisters,
  1139. {_DIR_MEMORY} dir_memory,
  1140. {_DIR_MESSAGE} dir_message,
  1141. {_DIR_MINENUMSIZE} dir_packenum,
  1142. {_DIR_MMX} dir_localswitch,
  1143. {_DIR_MODE} dir_mode,
  1144. {_DIR_NOTE} dir_message,
  1145. {_DIR_NOTES} dir_setverbose,
  1146. {_DIR_OBJECTPATH} dir_objectpath,
  1147. {_DIR_OPENSTRINGS} dir_delphiswitch,
  1148. {_DIR_OUTPUT_FORMAT} dir_outputformat,
  1149. {_DIR_OVERFLOWCHECKS} dir_delphiswitch,
  1150. {_DIR_PACKENUM} dir_packenum,
  1151. {_DIR_PACKRECORDS} dir_packrecords,
  1152. {$IFDEF TestVarsets}
  1153. {_DIR_PACKSET} dir_packset,
  1154. {$ENDIF}
  1155. {_DIR_R} dir_resource,
  1156. {_DIR_RANGECHECKS} dir_delphiswitch,
  1157. {_DIR_REFERENCEINFO} dir_delphiswitch,
  1158. {_DIR_SATURATION} dir_localswitch,
  1159. {_DIR_SMARTLINK} dir_moduleswitch,
  1160. {_DIR_STACKFRAMES} dir_delphiswitch,
  1161. {_DIR_STATIC} dir_moduleswitch,
  1162. {_DIR_STOP} dir_message,
  1163. {_DIR_TYPEDADDRESS} dir_delphiswitch,
  1164. {_DIR_TYPEINFO} dir_delphiswitch,
  1165. {_DIR_UNDEF} dir_undef,
  1166. {_DIR_UNITPATH} dir_unitpath,
  1167. {_DIR_VARSTRINGCHECKS} dir_delphiswitch,
  1168. {_DIR_VERSION} dir_version,
  1169. {_DIR_WAIT} dir_wait,
  1170. {_DIR_WARNING} dir_message,
  1171. {_DIR_WARNINGS} dir_setverbose,
  1172. {_DIR_Z1} dir_packenum,
  1173. {_DIR_Z2} dir_packenum,
  1174. {_DIR_Z4} dir_packenum
  1175. );
  1176. {-------------------------------------------
  1177. Main switches handling
  1178. -------------------------------------------}
  1179. procedure handledirectives;
  1180. var
  1181. t : tdirectivetoken;
  1182. p : tdirectiveproc;
  1183. hs : string;
  1184. begin
  1185. current_scanner^.gettokenpos;
  1186. current_scanner^.readchar; {Remove the $}
  1187. hs:=current_scanner^.readid;
  1188. if parapreprocess then
  1189. begin
  1190. t:=Get_Directive(hs);
  1191. if not(is_conditional(t) or (t=_DIR_DEFINE) or (t=_DIR_UNDEF)) then
  1192. begin
  1193. preprocfile^.AddSpace;
  1194. preprocfile^.Add('{$'+hs+current_scanner^.readcomment+'}');
  1195. exit;
  1196. end;
  1197. end;
  1198. Message1(scan_d_handling_switch,'$'+hs);
  1199. if hs='' then
  1200. Message1(scan_w_illegal_switch,'$'+hs);
  1201. { Check for compiler switches }
  1202. while (length(hs)=1) and (c in ['-','+']) do
  1203. begin
  1204. HandleSwitch(hs[1],c);
  1205. current_scanner^.readchar; {Remove + or -}
  1206. if c=',' then
  1207. begin
  1208. current_scanner^.readchar; {Remove , }
  1209. { read next switch, support $v+,$+}
  1210. hs:=current_scanner^.readid;
  1211. if (hs='') then
  1212. begin
  1213. if (c='$') and (m_fpc in aktmodeswitches) then
  1214. begin
  1215. current_scanner^.readchar; { skip $ }
  1216. hs:=current_scanner^.readid;
  1217. end;
  1218. if (hs='') then
  1219. Message1(scan_w_illegal_directive,'$'+c);
  1220. end
  1221. else
  1222. Message1(scan_d_handling_switch,'$'+hs);
  1223. end
  1224. else
  1225. hs:='';
  1226. end;
  1227. { directives may follow switches after a , }
  1228. if hs<>'' then
  1229. begin
  1230. t:=Get_Directive(hs);
  1231. if t<>_DIR_NONE then
  1232. begin
  1233. p:=directiveproc[t];
  1234. {$ifndef TP}
  1235. if assigned(p) then
  1236. {$else}
  1237. if @p<>nil then
  1238. {$endif}
  1239. p(t);
  1240. end
  1241. else
  1242. Message1(scan_w_illegal_directive,'$'+hs);
  1243. { conditionals already read the comment }
  1244. if (current_scanner^.comment_level>0) then
  1245. current_scanner^.readcomment;
  1246. { we've read the whole comment }
  1247. aktcommentstyle:=comment_none;
  1248. end;
  1249. end;
  1250. {
  1251. $Log$
  1252. Revision 1.79 2000-05-03 14:36:58 pierre
  1253. * fix for tests/test/testrang.pp bug
  1254. Revision 1.78 2000/04/14 11:16:10 pierre
  1255. * partial linklib change
  1256. I could not use Pavel's code because it broke the current way
  1257. linklib is used, which is messy :(
  1258. + add postw32 call if external linking on win32
  1259. Revision 1.77 2000/04/08 20:18:53 michael
  1260. * Fixed bug in readcomment that was dropping * characters
  1261. Revision 1.76 2000/02/28 17:23:57 daniel
  1262. * Current work of symtable integration committed. The symtable can be
  1263. activated by defining 'newst', but doesn't compile yet. Changes in type
  1264. checking and oop are completed. What is left is to write a new
  1265. symtablestack and adapt the parser to use it.
  1266. Revision 1.75 2000/02/14 20:58:43 marco
  1267. * Basic structures for new sethandling implemented.
  1268. Revision 1.74 2000/02/09 13:23:03 peter
  1269. * log truncated
  1270. Revision 1.73 2000/01/14 14:28:40 pierre
  1271. * avoid searching of include file in start dir first
  1272. Revision 1.72 2000/01/07 01:14:37 peter
  1273. * updated copyright to 2000
  1274. Revision 1.71 2000/01/04 15:15:53 florian
  1275. + added compiler switch $maxfpuregisters
  1276. + fixed a small problem in secondvecn
  1277. Revision 1.70 1999/12/20 23:23:30 pierre
  1278. + $description $version
  1279. Revision 1.69 1999/12/02 17:34:34 peter
  1280. * preprocessor support. But it fails on the caret in type blocks
  1281. Revision 1.68 1999/11/24 11:39:53 pierre
  1282. * asmmode message was placed too early
  1283. Revision 1.67 1999/11/12 11:03:50 peter
  1284. * searchpaths changed to stringqueue object
  1285. Revision 1.66 1999/11/06 14:34:26 peter
  1286. * truncated log to 20 revs
  1287. Revision 1.65 1999/10/30 12:32:30 peter
  1288. * fixed line counter when the first line had #10 only. This was buggy
  1289. for both the main file as for include files
  1290. Revision 1.64 1999/09/27 23:38:17 peter
  1291. * bracket support for macro define
  1292. Revision 1.63 1999/09/20 16:39:02 peter
  1293. * cs_create_smart instead of cs_smartlink
  1294. * -CX is create smartlink
  1295. * -CD is create dynamic, but does nothing atm.
  1296. Revision 1.62 1999/09/03 10:00:49 peter
  1297. * included the 1.60 version of Pierre which was lost !
  1298. Revision 1.61 1999/09/02 18:47:46 daniel
  1299. * Could not compile with TP, some arrays moved to heap
  1300. * NOAG386BIN default for TP
  1301. * AG386* files were not compatible with TP, fixed.
  1302. Revision 1.60 1999/08/31 15:55:45 pierre
  1303. + tmacrosym.is_used set
  1304. Revision 1.59 1999/08/05 16:53:10 peter
  1305. * V_Fatal=1, all other V_ are also increased
  1306. * Check for local procedure when assigning procvar
  1307. * fixed comment parsing because directives
  1308. * oldtp mode directives better supported
  1309. * added some messages to errore.msg
  1310. Revision 1.58 1999/08/04 13:03:03 jonas
  1311. * all tokens now start with an underscore
  1312. * PowerPC compiles!!
  1313. Revision 1.57 1999/07/26 14:55:36 florian
  1314. * $mode gives now a warning if an unknown mode keyword follows
  1315. Revision 1.56 1999/07/23 16:05:27 peter
  1316. * alignment is now saved in the symtable
  1317. * C alignment added for records
  1318. * PPU version increased to solve .12 <-> .13 probs
  1319. }