globals.pas 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544
  1. {
  2. $Id$
  3. Copyright (C) 1998-2000 by Florian Klaempfl
  4. This unit implements some support functions and global variables
  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. unit globals;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. {$ifdef win32}
  23. windows,
  24. {$endif}
  25. {$ifdef unix}
  26. {$ifdef ver1_0}
  27. linux,
  28. {$else}
  29. unix,
  30. {$endif}
  31. {$endif}
  32. {$ifdef os2}
  33. doscalls,
  34. {$endif}
  35. {$ifdef Delphi}
  36. SysUtils,
  37. dmisc,
  38. {$else}
  39. strings,
  40. dos,
  41. {$endif}
  42. cutils,cclasses,
  43. globtype,version,systems;
  44. const
  45. {$ifdef Splitheap}
  46. testsplit : boolean = false;
  47. {$endif Splitheap}
  48. delphimodeswitches : tmodeswitches=
  49. [m_delphi,m_tp,m_all,m_class,m_objpas,m_result,m_string_pchar,
  50. m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
  51. m_out,m_default_para,m_hintdirective];
  52. fpcmodeswitches : tmodeswitches=
  53. [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
  54. m_cvar_support,m_initfinal,m_add_pointer];
  55. objfpcmodeswitches : tmodeswitches=
  56. [m_objfpc,m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment,
  57. m_repeat_forward,m_cvar_support,m_initfinal,m_add_pointer,m_out,m_default_para];
  58. tpmodeswitches : tmodeswitches=
  59. [m_tp7,m_tp,m_all,m_tp_procvar];
  60. gpcmodeswitches : tmodeswitches=
  61. [m_gpc,m_all];
  62. type
  63. pfileposinfo = ^tfileposinfo;
  64. tfileposinfo = record
  65. line : longint;
  66. column : word;
  67. fileindex : word;
  68. end;
  69. TSearchPathList = class(TStringList)
  70. procedure AddPath(s:string;addfirst:boolean);
  71. procedure AddList(list:TSearchPathList;addfirst:boolean);
  72. function FindFile(const f : string;var foundfile:string):boolean;
  73. end;
  74. var
  75. { specified inputfile }
  76. inputdir : dirstr;
  77. inputfile : namestr;
  78. inputextension : extstr;
  79. { specified outputfile with -o parameter }
  80. outputfile : namestr;
  81. { specified with -FE or -FU }
  82. outputexedir : dirstr;
  83. outputunitdir : dirstr;
  84. { things specified with parameters }
  85. paralinkoptions,
  86. paradynamiclinker : string;
  87. parapreprocess : boolean;
  88. { directory where the utils can be found (options -FD) }
  89. utilsdirectory : dirstr;
  90. { some flags for global compiler switches }
  91. do_build,
  92. do_release,
  93. do_make : boolean;
  94. not_unit_proc : boolean;
  95. { path for searching units, different paths can be seperated by ; }
  96. exepath : dirstr; { Path to ppc }
  97. librarysearchpath,
  98. unitsearchpath,
  99. objectsearchpath,
  100. includesearchpath : TSearchPathList;
  101. { deffile }
  102. usewindowapi : boolean;
  103. description : string;
  104. dllversion : string;
  105. dllmajor,dllminor,dllrevision : word; { revision only for netware }
  106. akttokenpos, { position of the last token }
  107. aktfilepos : tfileposinfo; { current position }
  108. { ad 18.05.2001: Screen and Threadname for Netware }
  109. nwscreenname : string;
  110. nwthreadname : string;
  111. nwcopyright : string;
  112. { type of currently parsed block }
  113. { isn't full implemented (FK) }
  114. block_type : tblock_type;
  115. in_args : boolean; { arguments must be checked especially }
  116. parsing_para_level : integer; { parameter level, used to convert
  117. proc calls to proc loads in firstcalln }
  118. compile_level : word;
  119. make_ref : boolean;
  120. resolving_forward : boolean; { used to add forward reference as second ref }
  121. use_esp_stackframe : boolean; { to test for call with ESP as stack frame }
  122. inlining_procedure : boolean; { are we inlining a procedure }
  123. statement_level : integer;
  124. aktexceptblock : integer; { each except block gets a number check gotos }
  125. { commandline values }
  126. initdefines : tstringlist;
  127. initglobalswitches : tglobalswitches;
  128. initmoduleswitches : tmoduleswitches;
  129. initlocalswitches : tlocalswitches;
  130. initmodeswitches : tmodeswitches;
  131. {$IFDEF testvarsets}
  132. Initsetalloc, {0=fixed, 1 =var}
  133. {$ENDIF}
  134. initpackenum : longint;
  135. initalignment : talignmentinfo;
  136. initoptprocessor,
  137. initspecificoptprocessor : tprocessors;
  138. initasmmode : tasmmode;
  139. initinterfacetype : tinterfacetypes;
  140. initoutputformat : tasm;
  141. { current state values }
  142. aktglobalswitches : tglobalswitches;
  143. aktmoduleswitches : tmoduleswitches;
  144. aktlocalswitches : tlocalswitches;
  145. nextaktlocalswitches : tlocalswitches;
  146. localswitcheschanged : boolean;
  147. aktmodeswitches : tmodeswitches;
  148. {$IFDEF testvarsets}
  149. aktsetalloc,
  150. {$ENDIF}
  151. aktpackenum : longint;
  152. aktmaxfpuregisters : longint;
  153. aktalignment : talignmentinfo;
  154. aktoptprocessor,
  155. aktspecificoptprocessor : tprocessors;
  156. aktasmmode : tasmmode;
  157. aktinterfacetype : tinterfacetypes;
  158. aktoutputformat : tasm;
  159. { Memory sizes }
  160. heapsize,
  161. maxheapsize,
  162. stacksize : longint;
  163. {$Ifdef EXTDEBUG}
  164. total_of_firstpass,
  165. firstpass_several : longint;
  166. {$ifdef FPC}
  167. EntryMemUsed : longint;
  168. {$endif FPC}
  169. { parameter switches }
  170. debugstop : boolean;
  171. {$EndIf EXTDEBUG}
  172. { windows / OS/2 application type }
  173. apptype : tapptype;
  174. const
  175. RelocSection : boolean = true;
  176. RelocSectionSetExplicitly : boolean = false;
  177. LinkTypeSetExplicitly : boolean = false;
  178. DLLsource : boolean = false;
  179. DLLImageBase : pstring = nil;
  180. UseDeffileForExport : boolean = true;
  181. ForceDeffileForExport : boolean = false;
  182. { used to set all registers used for each global function
  183. this should dramatically decrease the number of
  184. recompilations needed PM }
  185. simplify_ppu : boolean = true;
  186. { should we allow non static members ? }
  187. allow_only_static : boolean = false;
  188. Inside_asm_statement : boolean = false;
  189. global_unit_count : word = 0;
  190. { for error info in pp.pas }
  191. parser_current_file : string = '';
  192. {$ifdef m68k}
  193. { PalmOS resources }
  194. palmos_applicationname : string = 'FPC Application';
  195. palmos_applicationid : string[4] = 'FPCA';
  196. {$endif m68k}
  197. procedure abstract;
  198. function bstoslash(const s : string) : string;
  199. function getdatestr:string;
  200. function gettimestr:string;
  201. function filetimestring( t : longint) : string;
  202. procedure DefaultReplacements(var s:string);
  203. function GetCurrentDir:string;
  204. function path_absolute(const s : string) : boolean;
  205. Function PathExists ( F : String) : Boolean;
  206. Function FileExists ( Const F : String) : Boolean;
  207. Function RemoveFile(const f:string):boolean;
  208. Function RemoveDir(d:string):boolean;
  209. Function GetFileTime ( Var F : File) : Longint;
  210. Function GetNamedFileTime ( Const F : String) : Longint;
  211. Function SplitPath(const s:string):string;
  212. Function SplitFileName(const s:string):string;
  213. Function SplitName(const s:string):string;
  214. Function SplitExtension(Const HStr:String):String;
  215. Function AddExtension(Const HStr,ext:String):String;
  216. Function ForceExtension(Const HStr,ext:String):String;
  217. Function FixPath(s:string;allowdot:boolean):string;
  218. function FixFileName(const s:string):string;
  219. function TargetFixPath(s:string;allowdot:boolean):string;
  220. function TargetFixFileName(const s:string):string;
  221. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  222. function FindFile(const f : string;path : string;var foundfile:string):boolean;
  223. function FindExe(const bin:string;var foundfile:string):boolean;
  224. function GetShortName(const n:string):string;
  225. Procedure Shell(const command:string);
  226. function GetEnvPChar(const envname:string):pchar;
  227. procedure FreeEnvPChar(p:pchar);
  228. Function SetCompileMode(const s:string; changeInit: boolean):boolean;
  229. procedure InitGlobals;
  230. procedure DoneGlobals;
  231. function string2guid(const s: string; var GUID: TGUID): boolean;
  232. function guid2string(const GUID: TGUID): string;
  233. function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
  234. implementation
  235. uses
  236. comphook;
  237. procedure abstract;
  238. begin
  239. do_internalerror(255);
  240. end;
  241. function bstoslash(const s : string) : string;
  242. {
  243. return string s with all \ changed into /
  244. }
  245. var
  246. i : longint;
  247. begin
  248. for i:=1to length(s) do
  249. if s[i]='\' then
  250. bstoslash[i]:='/'
  251. else
  252. bstoslash[i]:=s[i];
  253. bstoslash[0]:=s[0];
  254. end;
  255. {****************************************************************************
  256. Time Handling
  257. ****************************************************************************}
  258. Function L0(l:longint):string;
  259. {
  260. return the string of value l, if l<10 then insert a zero, so
  261. the string is always at least 2 chars '01','02',etc
  262. }
  263. var
  264. s : string;
  265. begin
  266. Str(l,s);
  267. if l<10 then
  268. s:='0'+s;
  269. L0:=s;
  270. end;
  271. function gettimestr:string;
  272. {
  273. get the current time in a string HH:MM:SS
  274. }
  275. var
  276. hour,min,sec,hsec : word;
  277. begin
  278. {$ifdef delphi}
  279. dmisc.gettime(hour,min,sec,hsec);
  280. {$else delphi}
  281. dos.gettime(hour,min,sec,hsec);
  282. {$endif delphi}
  283. gettimestr:=L0(Hour)+':'+L0(min)+':'+L0(sec);
  284. end;
  285. function getdatestr:string;
  286. {
  287. get the current date in a string YY/MM/DD
  288. }
  289. var
  290. Year,Month,Day,Wday : Word;
  291. begin
  292. {$ifdef delphi}
  293. dmisc.getdate(year,month,day,wday);
  294. {$else}
  295. dos.getdate(year,month,day,wday);
  296. {$endif}
  297. getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
  298. end;
  299. function filetimestring( t : longint) : string;
  300. {
  301. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  302. }
  303. var
  304. DT : DateTime;
  305. begin
  306. if t=-1 then
  307. begin
  308. FileTimeString:='Not Found';
  309. exit;
  310. end;
  311. unpacktime(t,DT);
  312. filetimestring:=L0(dt.Year)+'/'+L0(dt.Month)+'/'+L0(dt.Day)+' '+L0(dt.Hour)+':'+L0(dt.min)+':'+L0(dt.sec);
  313. end;
  314. {****************************************************************************
  315. Default Macro Handling
  316. ****************************************************************************}
  317. procedure DefaultReplacements(var s:string);
  318. begin
  319. { Replace some macro's }
  320. Replace(s,'$FPCVER',version_string);
  321. Replace(s,'$VERSION',version_string);
  322. Replace(s,'$FULLVERSION',full_version_string);
  323. Replace(s,'$FPCDATE',date_string);
  324. Replace(s,'$FPCTARGET',target_cpu_string);
  325. Replace(s,'$FPCCPU',target_cpu_string);
  326. Replace(s,'$TARGET',target_path);
  327. Replace(s,'$FPCOS',target_path);
  328. end;
  329. {****************************************************************************
  330. File Handling
  331. ****************************************************************************}
  332. function GetCurrentDir:string;
  333. var
  334. CurrentDir : string;
  335. begin
  336. GetDir(0,CurrentDir);
  337. GetCurrentDir:=FixPath(CurrentDir,false);
  338. end;
  339. function path_absolute(const s : string) : boolean;
  340. {
  341. is path s an absolute path?
  342. }
  343. begin
  344. path_absolute:=false;
  345. {$ifdef unix}
  346. if (length(s)>0) and (s[1]='/') then
  347. path_absolute:=true;
  348. {$else unix}
  349. {$ifdef amiga}
  350. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or (Pos(':',s) = length(s)) then
  351. path_absolute:=true;
  352. {$else}
  353. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or
  354. ((length(s)>2) and (s[2]=':') and ((s[3]='\') or (s[3]='/'))) then
  355. path_absolute:=true;
  356. {$endif amiga}
  357. {$endif unix}
  358. end;
  359. {$ifndef FPC}
  360. Procedure FindClose(var Info : SearchRec);
  361. Begin
  362. End;
  363. {$endif not FPC}
  364. Function FileExists ( Const F : String) : Boolean;
  365. {$ifndef delphi}
  366. Var
  367. Info : SearchRec;
  368. {$endif}
  369. begin
  370. {$ifdef delphi}
  371. FileExists:=sysutils.FileExists(f);
  372. {$else}
  373. findfirst(F,readonly+archive+hidden,info);
  374. FileExists:=(doserror=0);
  375. findclose(Info);
  376. {$endif delphi}
  377. end;
  378. Function PathExists ( F : String) : Boolean;
  379. Var
  380. Info : SearchRec;
  381. begin
  382. if F[Length(f)] in ['/','\'] then
  383. Delete(f,length(f),1);
  384. findfirst(F,readonly+archive+hidden+directory,info);
  385. PathExists:=(doserror=0) and ((info.attr and directory)=directory);
  386. findclose(Info);
  387. end;
  388. Function RemoveFile(const f:string):boolean;
  389. var
  390. g : file;
  391. begin
  392. assign(g,f);
  393. {$I-}
  394. erase(g);
  395. {$I+}
  396. RemoveFile:=(ioresult=0);
  397. end;
  398. Function RemoveDir(d:string):boolean;
  399. begin
  400. if d[length(d)]=source_info.DirSep then
  401. Delete(d,length(d),1);
  402. {$I-}
  403. rmdir(d);
  404. {$I+}
  405. RemoveDir:=(ioresult=0);
  406. end;
  407. Function SplitPath(const s:string):string;
  408. var
  409. i : longint;
  410. begin
  411. i:=Length(s);
  412. while (i>0) and not(s[i] in ['/','\']) do
  413. dec(i);
  414. SplitPath:=Copy(s,1,i);
  415. end;
  416. Function SplitFileName(const s:string):string;
  417. var
  418. p : dirstr;
  419. n : namestr;
  420. e : extstr;
  421. begin
  422. FSplit(s,p,n,e);
  423. SplitFileName:=n+e;
  424. end;
  425. Function SplitName(const s:string):string;
  426. var
  427. i,j : longint;
  428. begin
  429. i:=Length(s);
  430. j:=Length(s);
  431. while (i>0) and not(s[i] in ['/','\']) do
  432. dec(i);
  433. while (j>0) and (s[j]<>'.') do
  434. dec(j);
  435. if j<=i then
  436. j:=255;
  437. SplitName:=Copy(s,i+1,j-(i+1));
  438. end;
  439. Function SplitExtension(Const HStr:String):String;
  440. var
  441. j : longint;
  442. begin
  443. j:=length(Hstr);
  444. while (j>0) and (Hstr[j]<>'.') do
  445. begin
  446. if hstr[j]=source_info.DirSep then
  447. j:=0
  448. else
  449. dec(j);
  450. end;
  451. if j=0 then
  452. j:=254;
  453. SplitExtension:=Copy(Hstr,j,255);
  454. end;
  455. Function AddExtension(Const HStr,ext:String):String;
  456. begin
  457. if (Ext<>'') and (SplitExtension(HStr)='') then
  458. AddExtension:=Hstr+Ext
  459. else
  460. AddExtension:=Hstr;
  461. end;
  462. Function ForceExtension(Const HStr,ext:String):String;
  463. var
  464. j : longint;
  465. begin
  466. j:=length(Hstr);
  467. while (j>0) and (Hstr[j]<>'.') do
  468. dec(j);
  469. if j=0 then
  470. j:=255;
  471. ForceExtension:=Copy(Hstr,1,j-1)+Ext;
  472. end;
  473. Function FixPath(s:string;allowdot:boolean):string;
  474. var
  475. i : longint;
  476. begin
  477. { Fix separator }
  478. for i:=1 to length(s) do
  479. if s[i] in ['/','\'] then
  480. s[i]:=source_info.DirSep;
  481. { Fix ending / }
  482. if (length(s)>0) and (s[length(s)]<>source_info.DirSep) and
  483. (s[length(s)]<>':') then
  484. s:=s+source_info.DirSep;
  485. { Remove ./ }
  486. if (not allowdot) and (s='.'+source_info.DirSep) then
  487. s:='';
  488. { return }
  489. if source_info.files_case_relevent then
  490. FixPath:=s
  491. else
  492. FixPath:=Lower(s);
  493. end;
  494. function FixFileName(const s:string):string;
  495. var
  496. i : longint;
  497. begin
  498. if source_info.files_case_relevent then
  499. begin
  500. for i:=1 to length(s) do
  501. begin
  502. case s[i] of
  503. '/','\' :
  504. FixFileName[i]:=source_info.dirsep;
  505. else
  506. FixFileName[i]:=s[i];
  507. end;
  508. end;
  509. end
  510. else
  511. begin
  512. for i:=1 to length(s) do
  513. begin
  514. case s[i] of
  515. '/','\' :
  516. FixFileName[i]:=source_info.dirsep;
  517. 'A'..'Z' :
  518. FixFileName[i]:=char(byte(s[i])+32);
  519. else
  520. FixFileName[i]:=s[i];
  521. end;
  522. end;
  523. end;
  524. FixFileName[0]:=s[0];
  525. end;
  526. Function TargetFixPath(s:string;allowdot:boolean):string;
  527. var
  528. i : longint;
  529. begin
  530. { Fix separator }
  531. for i:=1 to length(s) do
  532. if s[i] in ['/','\'] then
  533. s[i]:=target_info.DirSep;
  534. { Fix ending / }
  535. if (length(s)>0) and (s[length(s)]<>target_info.DirSep) and
  536. (s[length(s)]<>':') then
  537. s:=s+target_info.DirSep;
  538. { Remove ./ }
  539. if (not allowdot) and (s='.'+target_info.DirSep) then
  540. s:='';
  541. { return }
  542. if target_info.files_case_relevent then
  543. TargetFixPath:=s
  544. else
  545. TargetFixPath:=Lower(s);
  546. end;
  547. function TargetFixFileName(const s:string):string;
  548. var
  549. i : longint;
  550. begin
  551. if target_info.files_case_relevent then
  552. begin
  553. for i:=1 to length(s) do
  554. begin
  555. case s[i] of
  556. '/','\' :
  557. TargetFixFileName[i]:=target_info.dirsep;
  558. else
  559. TargetFixFileName[i]:=s[i];
  560. end;
  561. end;
  562. end
  563. else
  564. begin
  565. for i:=1 to length(s) do
  566. begin
  567. case s[i] of
  568. '/','\' :
  569. TargetFixFileName[i]:=target_info.dirsep;
  570. 'A'..'Z' :
  571. TargetFixFileName[i]:=char(byte(s[i])+32);
  572. else
  573. TargetFixFileName[i]:=s[i];
  574. end;
  575. end;
  576. end;
  577. TargetFixFileName[0]:=s[0];
  578. end;
  579. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  580. var
  581. i : longint;
  582. begin
  583. i:=pos(' ',s);
  584. if i>0 then
  585. begin
  586. bstr:=Copy(s,1,i-1);
  587. cstr:=Copy(s,i+1,length(s)-i);
  588. end
  589. else
  590. begin
  591. bstr:=s;
  592. cstr:='';
  593. end;
  594. end;
  595. procedure TSearchPathList.AddPath(s:string;addfirst:boolean);
  596. var
  597. j : longint;
  598. hs,hsd,
  599. CurrentDir,
  600. CurrPath : string;
  601. dir : searchrec;
  602. hp : TStringListItem;
  603. procedure addcurrpath;
  604. begin
  605. if addfirst then
  606. begin
  607. Remove(currPath);
  608. Insert(currPath);
  609. end
  610. else
  611. begin
  612. { Check if already in path, then we don't add it }
  613. hp:=Find(currPath);
  614. if not assigned(hp) then
  615. Concat(currPath);
  616. end;
  617. end;
  618. begin
  619. if s='' then
  620. exit;
  621. { Support default macro's }
  622. DefaultReplacements(s);
  623. { get current dir }
  624. CurrentDir:=GetCurrentDir;
  625. repeat
  626. { get currpath }
  627. if addfirst then
  628. begin
  629. j:=length(s);
  630. while (j>0) and (s[j]<>';') do
  631. dec(j);
  632. CurrPath:=FixPath(Copy(s,j+1,length(s)-j),false);
  633. if j=0 then
  634. s:=''
  635. else
  636. System.Delete(s,j,length(s)-j+1);
  637. end
  638. else
  639. begin
  640. j:=Pos(';',s);
  641. if j=0 then
  642. j:=255;
  643. CurrPath:=FixPath(Copy(s,1,j-1),false);
  644. System.Delete(s,1,j);
  645. end;
  646. { fix pathname }
  647. if CurrPath='' then
  648. CurrPath:='.'+source_info.DirSep
  649. else
  650. begin
  651. CurrPath:=FixPath(FExpand(CurrPath),false);
  652. if (CurrentDir<>'') and (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then
  653. CurrPath:='.'+source_info.DirSep+Copy(CurrPath,length(CurrentDir)+1,255);
  654. end;
  655. { wildcard adding ? }
  656. if pos('*',currpath)>0 then
  657. begin
  658. if currpath[length(currpath)]=source_info.dirsep then
  659. hs:=Copy(currpath,1,length(CurrPath)-1)
  660. else
  661. hs:=currpath;
  662. hsd:=SplitPath(hs);
  663. findfirst(hs,directory,dir);
  664. while doserror=0 do
  665. begin
  666. if (dir.name<>'.') and
  667. (dir.name<>'..') and
  668. ((dir.attr and directory)<>0) then
  669. begin
  670. currpath:=hsd+dir.name+source_info.dirsep;
  671. hp:=Find(currPath);
  672. if not assigned(hp) then
  673. AddCurrPath;
  674. end;
  675. findnext(dir);
  676. end;
  677. FindClose(dir);
  678. end
  679. else
  680. begin
  681. if PathExists(currpath) then
  682. addcurrpath;
  683. end;
  684. until (s='');
  685. end;
  686. procedure TSearchPathList.AddList(list:TSearchPathList;addfirst:boolean);
  687. var
  688. s : string;
  689. hl : TSearchPathList;
  690. hp,hp2 : TStringListItem;
  691. begin
  692. if list.empty then
  693. exit;
  694. { create temp and reverse the list }
  695. if addfirst then
  696. begin
  697. hl:=TSearchPathList.Create;
  698. hp:=TStringListItem(list.first);
  699. while assigned(hp) do
  700. begin
  701. hl.insert(hp.Str);
  702. hp:=TStringListItem(hp.next);
  703. end;
  704. while not hl.empty do
  705. begin
  706. s:=hl.GetFirst;
  707. Remove(s);
  708. Insert(s);
  709. end;
  710. hl.Free;
  711. end
  712. else
  713. begin
  714. hp:=TStringListItem(list.first);
  715. while assigned(hp) do
  716. begin
  717. hp2:=Find(hp.Str);
  718. { Check if already in path, then we don't add it }
  719. if not assigned(hp2) then
  720. Concat(hp.Str);
  721. hp:=TStringListItem(hp.next);
  722. end;
  723. end;
  724. end;
  725. function TSearchPathList.FindFile(const f : string;var foundfile:string):boolean;
  726. Var
  727. p : TStringListItem;
  728. begin
  729. FindFile:=false;
  730. p:=TStringListItem(first);
  731. while assigned(p) do
  732. begin
  733. {
  734. Search order for case sensitive systems:
  735. 1. lowercase
  736. 2. NormalCase
  737. 3. UPPERCASE
  738. None case sensitive only lowercase
  739. }
  740. FoundFile:=p.Str+Lower(f);
  741. If FileExists(FoundFile) then
  742. begin
  743. FindFile:=true;
  744. exit;
  745. end;
  746. {$ifdef UNIX}
  747. FoundFile:=p.Str+f;
  748. If FileExists(FoundFile) then
  749. begin
  750. FindFile:=true;
  751. exit;
  752. end;
  753. FoundFile:=p.Str+Upper(f);
  754. If FileExists(FoundFile) then
  755. begin
  756. FindFile:=true;
  757. exit;
  758. end;
  759. {$endif UNIX}
  760. p:=TStringListItem(p.next);
  761. end;
  762. { Return original filename if not found }
  763. FoundFile:=f;
  764. end;
  765. Function GetFileTime ( Var F : File) : Longint;
  766. Var
  767. {$ifdef unix}
  768. Info : Stat;
  769. {$endif}
  770. L : longint;
  771. begin
  772. {$ifdef unix}
  773. FStat (F,Info);
  774. L:=Info.Mtime;
  775. {$else}
  776. GetFTime(f,l);
  777. {$endif}
  778. GetFileTime:=L;
  779. end;
  780. Function GetNamedFileTime (Const F : String) : Longint;
  781. begin
  782. GetNamedFileTime:=do_getnamedfiletime(F);
  783. end;
  784. function FindFile(const f : string;path : string;var foundfile:string):boolean;
  785. Var
  786. singlepathstring : string;
  787. i : longint;
  788. begin
  789. {$ifdef Unix}
  790. for i:=1 to length(path) do
  791. if path[i]=':' then
  792. path[i]:=';';
  793. {$endif Unix}
  794. FindFile:=false;
  795. repeat
  796. i:=pos(';',path);
  797. if i=0 then
  798. i:=256;
  799. singlepathstring:=FixPath(copy(path,1,i-1),false);
  800. delete(path,1,i);
  801. {
  802. Search order for case sensitive systems:
  803. 1. lowercase
  804. 2. NormalCase
  805. 3. UPPERCASE
  806. None case sensitive only lowercase
  807. }
  808. FoundFile:=singlepathstring+Lower(f);
  809. If FileExists(FoundFile) then
  810. begin
  811. FindFile:=true;
  812. exit;
  813. end;
  814. {$ifdef UNIX}
  815. FoundFile:=singlepathstring+f;
  816. If FileExists(FoundFile) then
  817. begin
  818. FindFile:=true;
  819. exit;
  820. end;
  821. FoundFile:=singlepathstring+Upper(f);
  822. If FileExists(FoundFile) then
  823. begin
  824. FindFile:=true;
  825. exit;
  826. end;
  827. {$endif UNIX}
  828. until path='';
  829. FoundFile:=f;
  830. end;
  831. function FindExe(const bin:string;var foundfile:string):boolean;
  832. begin
  833. {$ifdef delphi}
  834. FindExe:=FindFile(FixFileName(AddExtension(bin,source_info.exeext)),'.;'+exepath+';'+dmisc.getenv('PATH'),foundfile);
  835. {$else delphi}
  836. FindExe:=FindFile(FixFileName(AddExtension(bin,source_info.exeext)),'.;'+exepath+';'+dos.getenv('PATH'),foundfile);
  837. {$endif delphi}
  838. end;
  839. function GetShortName(const n:string):string;
  840. {$ifdef win32}
  841. var
  842. hs,hs2 : string;
  843. i : longint;
  844. {$endif}
  845. {$ifdef go32v2}
  846. var
  847. hs : string;
  848. {$endif}
  849. begin
  850. GetShortName:=n;
  851. {$ifdef win32}
  852. hs:=n+#0;
  853. i:=Windows.GetShortPathName(@hs[1],@hs2[1],high(hs2));
  854. if (i>0) and (i<=high(hs2)) then
  855. begin
  856. hs2[0]:=chr(strlen(@hs2[1]));
  857. GetShortName:=hs2;
  858. end;
  859. {$endif}
  860. {$ifdef go32v2}
  861. hs:=n;
  862. if Dos.GetShortName(hs) then
  863. GetShortName:=hs;
  864. {$endif}
  865. end;
  866. {****************************************************************************
  867. OS Dependent things
  868. ****************************************************************************}
  869. function GetEnvPChar(const envname:string):pchar;
  870. {$ifdef win32}
  871. var
  872. s : string;
  873. i,len : longint;
  874. hp,p,p2 : pchar;
  875. {$endif}
  876. {$ifdef os2}
  877. var
  878. P1, P2: PChar;
  879. {$endif}
  880. begin
  881. {$ifdef unix}
  882. GetEnvPchar:={$ifdef ver1_0}Linux{$else}Unix{$endif}.Getenv(envname);
  883. {$define GETENVOK}
  884. {$endif}
  885. {$ifdef win32}
  886. GetEnvPchar:=nil;
  887. p:=GetEnvironmentStrings;
  888. hp:=p;
  889. while hp^<>#0 do
  890. begin
  891. s:=strpas(hp);
  892. i:=pos('=',s);
  893. len:=strlen(hp);
  894. if upper(copy(s,1,i-1))=upper(envname) then
  895. begin
  896. GetMem(p2,len-length(envname));
  897. Move(hp[i],p2^,len-length(envname));
  898. GetEnvPchar:=p2;
  899. break;
  900. end;
  901. { next string entry}
  902. hp:=hp+len+1;
  903. end;
  904. FreeEnvironmentStrings(p);
  905. {$define GETENVOK}
  906. {$endif}
  907. {$ifdef os2}
  908. P1 := StrPNew (EnvName);
  909. if Assigned (P1) then
  910. begin
  911. if DosCalls.DosScanEnv (P1, P2) = 0 then
  912. GetEnvPChar := P2
  913. else
  914. GetEnvPChar := nil;
  915. StrDispose (P1);
  916. end else GetEnvPChar := nil;
  917. {$define GETENVOK}
  918. {$endif}
  919. {$ifdef GETENVOK}
  920. {$undef GETENVOK}
  921. {$else}
  922. GetEnvPchar:=StrPNew({$ifdef delphi}DMisc{$else}Dos{$endif}.Getenv(envname));
  923. {$endif}
  924. end;
  925. procedure FreeEnvPChar(p:pchar);
  926. begin
  927. {$ifndef unix}
  928. {$ifndef os2}
  929. StrDispose(p);
  930. {$endif}
  931. {$endif}
  932. end;
  933. Procedure Shell(const command:string);
  934. { This is already defined in the linux.ppu for linux, need for the *
  935. expansion under linux }
  936. {$ifdef unix}
  937. begin
  938. {$ifdef ver1_0}Linux{$else}Unix{$endif}.Shell(command);
  939. end;
  940. {$else}
  941. var
  942. comspec : string;
  943. begin
  944. comspec:=getenv('COMSPEC');
  945. Exec(comspec,' /C '+command);
  946. end;
  947. {$endif}
  948. Function SetCompileMode(const s:string; changeInit: boolean):boolean;
  949. var
  950. b : boolean;
  951. begin
  952. b:=true;
  953. if s='DEFAULT' then
  954. aktmodeswitches:=initmodeswitches
  955. else
  956. if s='DELPHI' then
  957. aktmodeswitches:=delphimodeswitches
  958. else
  959. if s='TP' then
  960. aktmodeswitches:=tpmodeswitches
  961. else
  962. if s='FPC' then
  963. aktmodeswitches:=fpcmodeswitches
  964. else
  965. if s='OBJFPC' then
  966. aktmodeswitches:=objfpcmodeswitches
  967. else
  968. if s='GPC' then
  969. aktmodeswitches:=gpcmodeswitches
  970. else
  971. b:=false;
  972. if b and changeInit then
  973. initmodeswitches := aktmodeswitches;
  974. if b then
  975. begin
  976. { turn ansistrings on by default ? }
  977. if (m_delphi in aktmodeswitches) then
  978. begin
  979. include(aktlocalswitches,cs_ansistrings);
  980. if changeinit then
  981. include(initlocalswitches,cs_ansistrings);
  982. end
  983. else
  984. begin
  985. exclude(aktlocalswitches,cs_ansistrings);
  986. if changeinit then
  987. exclude(initlocalswitches,cs_ansistrings);
  988. end;
  989. { enum packing }
  990. if (m_tp7 in aktmodeswitches) then
  991. aktpackenum:=1
  992. else
  993. aktpackenum:=4;
  994. if changeinit then
  995. initpackenum:=aktpackenum;
  996. end;
  997. SetCompileMode:=b;
  998. end;
  999. { '('D1:'00000000-'D2:'0000-'D3:'0000-'D4:'0000-000000000000)' }
  1000. function string2guid(const s: string; var GUID: TGUID): boolean;
  1001. function ishexstr(const hs: string): boolean;
  1002. var
  1003. i: integer;
  1004. begin
  1005. ishexstr:=false;
  1006. for i:=1 to Length(hs) do begin
  1007. if not (hs[i] in ['0'..'9','A'..'F','a'..'f']) then
  1008. exit;
  1009. end;
  1010. ishexstr:=true;
  1011. end;
  1012. function hexstr2longint(const hexs: string): longint;
  1013. var
  1014. i: integer;
  1015. rl: longint;
  1016. begin
  1017. rl:=0;
  1018. for i:=1 to length(hexs) do begin
  1019. rl:=rl shl 4;
  1020. case hexs[i] of
  1021. '0'..'9' : inc(rl,ord(hexs[i])-ord('0'));
  1022. 'A'..'F' : inc(rl,ord(hexs[i])-ord('A')+10);
  1023. 'a'..'f' : inc(rl,ord(hexs[i])-ord('a')+10);
  1024. end
  1025. end;
  1026. hexstr2longint:=rl;
  1027. end;
  1028. var
  1029. i: integer;
  1030. begin
  1031. if (Length(s)=38) and (s[1]='{') and (s[38]='}') and
  1032. (s[10]='-') and (s[15]='-') and (s[20]='-') and (s[25]='-') and
  1033. ishexstr(copy(s,2,8)) and ishexstr(copy(s,11,4)) and
  1034. ishexstr(copy(s,16,4)) and ishexstr(copy(s,21,4)) and
  1035. ishexstr(copy(s,26,12)) then begin
  1036. GUID.D1:=dword(hexstr2longint(copy(s,2,8)));
  1037. GUID.D2:=hexstr2longint(copy(s,11,4));
  1038. GUID.D3:=hexstr2longint(copy(s,16,4));
  1039. for i:=0 to 1 do
  1040. GUID.D4[i]:=hexstr2longint(copy(s,21+i*2,2));
  1041. for i:=2 to 7 do
  1042. GUID.D4[i]:=hexstr2longint(copy(s,22+i*2,2));
  1043. string2guid:=true;
  1044. end
  1045. else
  1046. string2guid:=false;
  1047. end;
  1048. function guid2string(const GUID: TGUID): string;
  1049. function long2hex(l, len: longint): string;
  1050. const
  1051. hextbl: array[0..15] of char = '0123456789ABCDEF';
  1052. var
  1053. rs: string;
  1054. i: integer;
  1055. begin
  1056. rs[0]:=chr(len);
  1057. for i:=len downto 1 do begin
  1058. rs[i]:=hextbl[l and $F];
  1059. l:=l shr 4;
  1060. end;
  1061. long2hex:=rs;
  1062. end;
  1063. begin
  1064. guid2string:=
  1065. '{'+long2hex(GUID.D1,8)+
  1066. '-'+long2hex(GUID.D2,4)+
  1067. '-'+long2hex(GUID.D3,4)+
  1068. '-'+long2hex(GUID.D4[0],2)+long2hex(GUID.D4[1],2)+
  1069. '-'+long2hex(GUID.D4[2],2)+long2hex(GUID.D4[3],2)+
  1070. long2hex(GUID.D4[4],2)+long2hex(GUID.D4[5],2)+
  1071. long2hex(GUID.D4[6],2)+long2hex(GUID.D4[7],2)+
  1072. '}';
  1073. end;
  1074. function UpdateAlignmentStr(s:string;var a:talignmentinfo):boolean;
  1075. var
  1076. tok : string;
  1077. vstr : string;
  1078. l : longint;
  1079. code : integer;
  1080. b : talignmentinfo;
  1081. begin
  1082. UpdateAlignmentStr:=true;
  1083. uppervar(s);
  1084. fillchar(b,sizeof(b),0);
  1085. repeat
  1086. tok:=GetToken(s,'=');
  1087. if tok='' then
  1088. break;
  1089. vstr:=GetToken(s,',');
  1090. val(vstr,l,code);
  1091. if tok='PROC' then
  1092. b.procalign:=l
  1093. else if tok='JUMP' then
  1094. b.jumpalign:=l
  1095. else if tok='LOOP' then
  1096. b.loopalign:=l
  1097. else if tok='CONSTMIN' then
  1098. b.constalignmin:=l
  1099. else if tok='CONSTMAX' then
  1100. b.constalignmax:=l
  1101. else if tok='VARMIN' then
  1102. b.varalignmin:=l
  1103. else if tok='VARMAX' then
  1104. b.varalignmax:=l
  1105. else if tok='LOCALMIN' then
  1106. b.localalignmin:=l
  1107. else if tok='LOCALMAX' then
  1108. b.localalignmax:=l
  1109. else if tok='RECORDMIN' then
  1110. b.recordalignmin:=l
  1111. else if tok='RECORDMAX' then
  1112. b.recordalignmax:=l
  1113. else if tok='PARAALIGN' then
  1114. b.paraalign:=l
  1115. else { Error }
  1116. UpdateAlignmentStr:=false;
  1117. until false;
  1118. UpdateAlignment(a,b);
  1119. end;
  1120. {****************************************************************************
  1121. Init
  1122. ****************************************************************************}
  1123. {$ifdef unix}
  1124. {$define need_path_search}
  1125. {$endif unix}
  1126. {$ifdef os2}
  1127. {$define need_path_search}
  1128. {$endif os2}
  1129. procedure get_exepath;
  1130. var
  1131. hs1 : namestr;
  1132. hs2 : extstr;
  1133. begin
  1134. {$ifdef delphi}
  1135. exepath:=dmisc.getenv('PPC_EXEC_PATH');
  1136. {$else delphi}
  1137. exepath:=dos.getenv('PPC_EXEC_PATH');
  1138. {$endif delphi}
  1139. if exepath='' then
  1140. fsplit(FixFileName(system.paramstr(0)),exepath,hs1,hs2);
  1141. {$ifdef need_path_search}
  1142. if exepath='' then
  1143. begin
  1144. if pos(source_info.exeext,hs1) <>
  1145. (length(hs1) - length(source_info.exeext)+1) then
  1146. hs1 := hs1 + source_info.exeext;
  1147. {$ifdef delphi}
  1148. findfile(hs1,dmisc.getenv('PATH'),exepath);
  1149. {$else delphi}
  1150. findfile(hs1,dos.getenv('PATH'),exepath);
  1151. {$endif delphi}
  1152. exepath:=SplitPath(exepath);
  1153. end;
  1154. {$endif need_path_search}
  1155. exepath:=FixPath(exepath,false);
  1156. end;
  1157. procedure DoneGlobals;
  1158. begin
  1159. initdefines.free;
  1160. if assigned(DLLImageBase) then
  1161. StringDispose(DLLImageBase);
  1162. RelocSection:=true;
  1163. RelocSectionSetExplicitly:=false;
  1164. UseDeffileForExport:=true;
  1165. librarysearchpath.Free;
  1166. unitsearchpath.Free;
  1167. objectsearchpath.Free;
  1168. includesearchpath.Free;
  1169. end;
  1170. procedure InitGlobals;
  1171. begin
  1172. get_exepath;
  1173. { set global switches }
  1174. do_build:=false;
  1175. do_release:=false;
  1176. do_make:=true;
  1177. compile_level:=0;
  1178. DLLsource:=false;
  1179. { Output }
  1180. OutputFile:='';
  1181. OutputExeDir:='';
  1182. OutputUnitDir:='';
  1183. { Utils directory }
  1184. utilsdirectory:='';
  1185. { Search Paths }
  1186. librarysearchpath:=TSearchPathList.Create;
  1187. unitsearchpath:=TSearchPathList.Create;
  1188. includesearchpath:=TSearchPathList.Create;
  1189. objectsearchpath:=TSearchPathList.Create;
  1190. { Def file }
  1191. usewindowapi:=false;
  1192. description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
  1193. dllversion:='';
  1194. nwscreenname := '';
  1195. nwthreadname := '';
  1196. nwcopyright := '';
  1197. { Init values }
  1198. initmodeswitches:=fpcmodeswitches;
  1199. initlocalswitches:=[cs_check_io];
  1200. initmoduleswitches:=[cs_extsyntax,cs_browser];
  1201. initglobalswitches:=[cs_check_unit_name,cs_link_static];
  1202. initoutputformat:=target_asm.id;
  1203. fillchar(initalignment,sizeof(talignmentinfo),0);
  1204. {$ifdef i386}
  1205. initoptprocessor:=Class386;
  1206. initspecificoptprocessor:=Class386;
  1207. initpackenum:=4;
  1208. {$IFDEF testvarsets}
  1209. initsetalloc:=0;
  1210. {$ENDIF}
  1211. initasmmode:=asmmode_i386_att;
  1212. {$else not i386}
  1213. {$ifdef m68k}
  1214. initoptprocessor:=MC68000;
  1215. include(initmoduleswitches,cs_fp_emulation);
  1216. initpackenum:=4;
  1217. {$IFDEF testvarsets}
  1218. initsetalloc:=0;
  1219. {$ENDIF}
  1220. initasmmode:=asmmode_m68k_mot;
  1221. {$endif m68k}
  1222. {$endif i386}
  1223. initinterfacetype:=it_interfacecom;
  1224. initdefines:=TStringList.Create;
  1225. { memory sizes, will be overriden by parameter or default for target
  1226. in options or init_parser }
  1227. stacksize:=0;
  1228. heapsize:=0;
  1229. maxheapsize:=0;
  1230. { compile state }
  1231. in_args:=false;
  1232. { must_be_valid:=true; obsolete PM }
  1233. not_unit_proc:=true;
  1234. apptype:=app_cui;
  1235. end;
  1236. {$ifdef EXTDEBUG}
  1237. begin
  1238. {$ifdef FPC}
  1239. EntryMemUsed:=system.HeapSize-MemAvail;
  1240. {$endif FPC}
  1241. {$endif}
  1242. end.
  1243. {
  1244. $Log$
  1245. Revision 1.43 2001-09-18 11:30:47 michael
  1246. * Fixes win32 linking problems with import libraries
  1247. * LINKLIB Libraries are now looked for using C file extensions
  1248. * get_exepath fix
  1249. Revision 1.42 2001/09/17 21:29:11 peter
  1250. * merged netbsd, fpu-overflow from fixes branch
  1251. Revision 1.41 2001/08/19 11:22:22 peter
  1252. * palmos support from v10 merged
  1253. Revision 1.40 2001/08/04 10:23:54 peter
  1254. * updates so it works with the ide
  1255. Revision 1.39 2001/07/01 20:16:15 peter
  1256. * alignmentinfo record added
  1257. * -Oa argument supports more alignment settings that can be specified
  1258. per type: PROC,LOOP,VARMIN,VARMAX,CONSTMIN,CONSTMAX,RECORDMIN
  1259. RECORDMAX,LOCALMIN,LOCALMAX. It is possible to set the mimimum
  1260. required alignment and the maximum usefull alignment. The final
  1261. alignment will be choosen per variable size dependent on these
  1262. settings
  1263. Revision 1.38 2001/06/18 20:36:24 peter
  1264. * -Ur switch (merged)
  1265. * masm fixes (merged)
  1266. * quoted filenames for go32v2 and win32
  1267. Revision 1.37 2001/06/03 21:57:35 peter
  1268. + hint directive parsing support
  1269. Revision 1.36 2001/06/03 20:21:08 peter
  1270. * Kylix fixes, mostly case names of units
  1271. Revision 1.35 2001/05/30 21:35:48 peter
  1272. * netware patches for copyright, screenname, threadname directives
  1273. Revision 1.34 2001/05/12 12:11:31 peter
  1274. * simplify_ppu is now the default, a recompile of the compiler now
  1275. only compiles pp.pas
  1276. Revision 1.33 2001/05/06 14:49:17 peter
  1277. * ppu object to class rewrite
  1278. * move ppu read and write stuff to fppu
  1279. Revision 1.32 2001/04/18 22:01:53 peter
  1280. * registration of targets and assemblers
  1281. Revision 1.31 2001/04/15 09:48:29 peter
  1282. * fixed crash in labelnode
  1283. * easier detection of goto and label in try blocks
  1284. Revision 1.30 2001/04/13 01:22:07 peter
  1285. * symtable change to classes
  1286. * range check generation and errors fixed, make cycle DEBUG=1 works
  1287. * memory leaks fixed
  1288. Revision 1.29 2001/04/04 21:30:42 florian
  1289. * applied several fixes to get the DD8 Delphi Unit compiled
  1290. e.g. "forward"-interfaces are working now
  1291. Revision 1.28 2001/02/20 21:41:16 peter
  1292. * new fixfilename, findfile for unix. Look first for lowercase, then
  1293. NormalCase and last for UPPERCASE names.
  1294. Revision 1.27 2001/02/09 23:05:45 peter
  1295. * default packenum=1 for tp7 mode
  1296. Revision 1.26 2001/02/05 20:47:00 peter
  1297. * support linux unit for ver1_0 compilers
  1298. Revision 1.25 2001/01/21 20:32:45 marco
  1299. * Renamefest. Compiler part. Not that hard.
  1300. Revision 1.24 2001/01/20 18:32:52 hajny
  1301. + APPTYPE support under OS/2, app_fs, GetEnvPChar for OS/2
  1302. Revision 1.23 2001/01/13 00:03:41 peter
  1303. * fixed findexe to also support already extension in name
  1304. Revision 1.22 2000/12/26 15:57:25 peter
  1305. * use system.paramstr()
  1306. Revision 1.21 2000/12/25 00:07:26 peter
  1307. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  1308. tlinkedlist objects)
  1309. Revision 1.20 2000/11/13 15:26:12 marco
  1310. * Renamefest
  1311. Revision 1.19 2000/11/12 22:20:37 peter
  1312. * create generic toutputsection for binary writers
  1313. Revision 1.18 2000/11/04 14:25:19 florian
  1314. + merged Attila's changes for interfaces, not tested yet
  1315. Revision 1.17 2000/10/31 22:02:46 peter
  1316. * symtable splitted, no real code changes
  1317. Revision 1.16 2000/10/04 14:51:08 pierre
  1318. * IsExe restored
  1319. Revision 1.15 2000/09/27 21:20:56 peter
  1320. * also set initlocalswitches in setcompilemode (merged)
  1321. Revision 1.14 2000/09/26 10:50:41 jonas
  1322. * initmodeswitches is changed is you change the compiler mode from the
  1323. command line (the -S<x> switches didn't work anymore for changing the
  1324. compiler mode) (merged from fixes branch)
  1325. Revision 1.13 2000/09/24 21:33:46 peter
  1326. * message updates merges
  1327. Revision 1.12 2000/09/24 21:19:50 peter
  1328. * delphi compile fixes
  1329. Revision 1.11 2000/09/24 15:12:40 peter
  1330. * fixed typo
  1331. Revision 1.10 2000/09/24 15:06:16 peter
  1332. * use defines.inc
  1333. Revision 1.9 2000/09/24 10:33:07 peter
  1334. * searching of exe in path also for OS/2
  1335. * fixed searching of exe in path.
  1336. Revision 1.8 2000/09/11 17:00:22 florian
  1337. + first implementation of Netware Module support, thanks to
  1338. Armin Diehl ([email protected]) for providing the patches
  1339. Revision 1.7 2000/08/27 16:11:51 peter
  1340. * moved some util functions from globals,cobjects to cutils
  1341. * splitted files into finput,fmodule
  1342. Revision 1.6 2000/08/12 19:14:58 peter
  1343. * ELF writer works now also with -g
  1344. * ELF writer is default again for linux
  1345. Revision 1.5 2000/08/12 15:30:44 peter
  1346. * IDE patch for stream reading (merged)
  1347. Revision 1.4 2000/08/02 19:49:59 peter
  1348. * first things for default parameters
  1349. Revision 1.3 2000/07/13 12:08:25 michael
  1350. + patched to 1.1.0 with former 1.09patch from peter
  1351. Revision 1.2 2000/07/13 11:32:41 michael
  1352. + removed logs
  1353. }