fpcompil.pas 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Compiler call routines for the IDE
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$i globdir.inc}
  13. unit FPCompil;
  14. interface
  15. { don't redir under linux, because all stdout (also from the ide!) will
  16. then be redired (PFV) }
  17. { this should work now correctly because
  18. RedirDisableAll and RedirEnableAll function are added in fpredir (PM) }
  19. { $define VERBOSETXT}
  20. uses
  21. Objects,
  22. finput,
  23. Drivers,Views,Dialogs,
  24. WViews,WCEdit,
  25. FPSymbol,
  26. FPViews;
  27. type
  28. TCompileMode = (cBuild,cMake,cCompile,cRun);
  29. type
  30. PCompilerMessage = ^TCompilerMessage;
  31. TCompilerMessage = object(TMessageItem)
  32. function GetText(MaxLen: Sw_Integer): String; virtual;
  33. end;
  34. PCompilerMessageListBox = ^TCompilerMessageListBox;
  35. TCompilerMessageListBox = object(TMessageListBox)
  36. function GetPalette: PPalette; virtual;
  37. procedure SelectFirstError;
  38. end;
  39. PCompilerMessageWindow = ^TCompilerMessageWindow;
  40. TCompilerMessageWindow = object(TFPWindow)
  41. constructor Init;
  42. procedure HandleEvent(var Event: TEvent); virtual;
  43. function GetPalette: PPalette; virtual;
  44. procedure Close;virtual;
  45. destructor Done; virtual;
  46. procedure SizeLimits(var Min, Max: TPoint); virtual;
  47. procedure AddMessage(AClass: longint;const Msg, Module: string; Line, Column: longint);
  48. procedure ClearMessages;
  49. constructor Load(var S: TStream);
  50. procedure Store(var S: TStream);
  51. procedure SetState(AState: Word; Enable: Boolean); virtual;
  52. procedure UpdateCommands; virtual;
  53. private
  54. {CompileShowed : boolean;}
  55. {Mode : TCompileMode;}
  56. MsgLB : PCompilerMessageListBox;
  57. {CurrST,
  58. InfoST : PColorStaticText;}
  59. end;
  60. PCompilerStatusDialog = ^TCompilerStatusDialog;
  61. TCompilerStatusDialog = object(TCenterDialog)
  62. ST : PAdvancedStaticText;
  63. KeyST : PColorStaticText;
  64. constructor Init;
  65. procedure Update;
  66. end;
  67. PFPInputFile = ^TFPInputFile;
  68. TFPInputFile = object(tinputfile)
  69. constructor Init(AEditor: PFileEditor);
  70. {$ifdef FPC}protected{$else}public{$endif}
  71. function fileopen(const filename: string): boolean; virtual;
  72. function fileseek(pos: longint): boolean; virtual;
  73. function fileread(var databuf; maxsize: longint): longint; virtual;
  74. function fileeof: boolean; virtual;
  75. function fileclose: boolean; virtual;
  76. private
  77. Editor: PFileEditor;
  78. S: PStream;
  79. end;
  80. const
  81. CompilerMessageWindow : PCompilerMessageWindow = nil;
  82. CompilerStatusDialog : PCompilerStatusDialog = nil;
  83. CompileStamp : longint = 0;
  84. procedure DoCompile(Mode: TCompileMode);
  85. function NeedRecompile(verbose : boolean): boolean;
  86. procedure ParseUserScreen;
  87. procedure RegisterFPCompile;
  88. {$ifndef GABOR}
  89. var
  90. StopJmp : Jmp_Buf;
  91. const
  92. StopJmpValid : boolean = false;
  93. {$endif}
  94. implementation
  95. uses
  96. {$ifdef Unix}
  97. Linux,
  98. {$endif}
  99. {$ifdef go32v2}
  100. dpmiexcp,
  101. {$endif}
  102. {$ifdef win32}
  103. signals,
  104. {$endif}
  105. Dos,Video,
  106. App,Commands,tokens,
  107. Globals, CompHook, Compiler, systems, browcol,
  108. WUtils,WEditor,
  109. FPString,FPRedir,FPDesk,FPUsrScr,FPHelp,
  110. FPConst,FPVars,FPUtils,FPIntf,FPSwitch;
  111. {$ifndef NOOBJREG}
  112. const
  113. RCompilerMessageListBox: TStreamRec = (
  114. ObjType: 1211;
  115. VmtLink: Ofs(TypeOf(TCompilerMessageListBox)^);
  116. Load: @TCompilerMessageListBox.Load;
  117. Store: @TCompilerMessageListBox.Store
  118. );
  119. RCompilerMessageWindow: TStreamRec = (
  120. ObjType: 1212;
  121. VmtLink: Ofs(TypeOf(TCompilerMessageWindow)^);
  122. Load: @TCompilerMessageWindow.Load;
  123. Store: @TCompilerMessageWindow.Store
  124. );
  125. {$endif}
  126. procedure ParseUserScreen;
  127. var
  128. y : longint;
  129. Text,Attr : String;
  130. DisplayCompilerWindow : boolean;
  131. cc: integer;
  132. procedure SearchBackTrace;
  133. var AText,ModuleName,st : String;
  134. row : longint;
  135. begin
  136. if pos(' 0x',Text)=1 then
  137. begin
  138. AText:=Text;
  139. Delete(Text,1,10);
  140. While pos(' ',Text)=1 do
  141. Delete(Text,1,1);
  142. if pos('of ',Text)>0 then
  143. begin
  144. ModuleName:=Copy(Text,pos('of ',Text)+3,255);
  145. While ModuleName[Length(ModuleName)]=' ' do
  146. Delete(ModuleName,Length(ModuleName),1);
  147. end
  148. else
  149. ModuleName:='';
  150. if pos('line ',Text)>0 then
  151. begin
  152. Text:=Copy(Text,Pos('line ',Text)+5,255);
  153. st:=Copy(Text,1,Pos(' ',Text)-1);
  154. Val(st,row,cc);
  155. end
  156. else
  157. row:=0;
  158. CompilerMessageWindow^.AddMessage(V_Fatal,AText
  159. ,ModuleName,row,1);
  160. DisplayCompilerWindow:=true;
  161. end;
  162. end;
  163. procedure InsertInMessages(Const TypeStr : String;_Type : longint;EnableDisplay : boolean);
  164. var p,p2,col,row : longint;
  165. St,ModuleName : string;
  166. begin
  167. p:=pos(TypeStr,Text);
  168. p2:=Pos('(',Text);
  169. if (p>0) and (p2>0) and (p2<p) then
  170. begin
  171. ModuleName:=Copy(Text,1,p2-1);
  172. st:=Copy(Text,p2+1,255);
  173. Val(Copy(st,1,pos(',',st)-1),row,cc);
  174. st:=Copy(st,Pos(',',st)+1,255);
  175. Val(Copy(st,1,pos(')',st)-1),col,cc);
  176. CompilerMessageWindow^.AddMessage(_type,Copy(Text,pos(':',Text)+1,255)
  177. ,ModuleName,row,col);
  178. If EnableDisplay then
  179. DisplayCompilerWindow:=true;
  180. end;
  181. end;
  182. begin
  183. if not assigned(UserScreen) then
  184. exit;
  185. DisplayCompilerWindow:=false;
  186. PushStatus('Parsing User Screen');
  187. for Y:=0 to UserScreen^.GetHeight do
  188. begin
  189. UserScreen^.GetLine(Y,Text,Attr);
  190. SearchBackTrace;
  191. InsertInMessages(' Fatal:',v_Fatal,true);
  192. InsertInMessages(' Error:',v_Error,true);
  193. InsertInMessages(' Warning:',v_Warning,false);
  194. InsertInMessages(' Note:',v_Note,false);
  195. InsertInMessages(' Info:',v_Info,false);
  196. InsertInMessages(' Hint:',v_Hint,false);
  197. end;
  198. if DisplayCompilerWindow then
  199. begin
  200. if not CompilerMessageWindow^.GetState(sfVisible) then
  201. CompilerMessageWindow^.Show;
  202. CompilerMessageWindow^.MakeFirst;
  203. CompilerMessageWindow^.MsgLB^.SelectFirstError;
  204. end;
  205. PopStatus;
  206. end;
  207. {*****************************************************************************
  208. TCompilerMessage
  209. *****************************************************************************}
  210. function TCompilerMessage.GetText(MaxLen: Sw_Integer): String;
  211. var
  212. ClassS: string[20];
  213. S: string;
  214. begin
  215. if TClass=
  216. V_Fatal then ClassS:=msg_class_Fatal else if TClass =
  217. V_Error then ClassS:=msg_class_Error else if TClass =
  218. V_Normal then ClassS:=msg_class_Normal else if TClass =
  219. V_Warning then ClassS:=msg_class_Warning else if TClass =
  220. V_Note then ClassS:=msg_class_Note else if TClass =
  221. V_Hint then ClassS:=msg_class_Hint
  222. {$ifdef VERBOSETXT}
  223. else if TClass =
  224. V_Macro then ClassS:=msg_class_macro else if TClass =
  225. V_Procedure then ClassS:=msg_class_procedure else if TClass =
  226. V_Conditional then ClassS:=msg_class_conditional else if TClass =
  227. V_Info then ClassS:=msg_class_info else if TClass =
  228. V_Status then ClassS:=msg_class_status else if TClass =
  229. V_Used then ClassS:=msg_class_used else if TClass =
  230. V_Tried then ClassS:=msg_class_tried else if TClass =
  231. V_Debug then ClassS:=msg_class_debug
  232. else
  233. ClassS:='???';
  234. {$else}
  235. else
  236. ClassS:='';
  237. {$endif}
  238. if ClassS<>'' then
  239. ClassS:=RExpand(ClassS,0)+': ';
  240. if assigned(Module) and
  241. (TClass<=V_ShowFile)
  242. {and (status.currentsource<>'') and (status.currentline>0)} then
  243. begin
  244. if Row>0 then
  245. begin
  246. if Col>0 then
  247. S:=NameAndExtOf(Module^)+'('+IntToStr(Row)+','+IntToStr(Col)+') '+ClassS
  248. else
  249. S:=NameAndExtOf(Module^)+'('+IntToStr(Row)+') '+ClassS;
  250. end
  251. else
  252. S:=NameAndExtOf(Module^)+'('+IntToStr(Row)+') '+ClassS
  253. end
  254. else
  255. S:=ClassS;
  256. if assigned(Text) then
  257. S:=S+Text^;
  258. if length(S)>MaxLen then
  259. S:=copy(S,1,MaxLen-2)+'..';
  260. GetText:=S;
  261. end;
  262. {*****************************************************************************
  263. TCompilerMessageListBox
  264. *****************************************************************************}
  265. function TCompilerMessageListBox.GetPalette: PPalette;
  266. const
  267. P: string[length(CBrowserListBox)] = CBrowserListBox;
  268. begin
  269. GetPalette:=@P;
  270. end;
  271. procedure TCompilerMessageListBox.SelectFirstError;
  272. function IsError(P : PCompilerMessage) : boolean;
  273. begin
  274. IsError:=(P^.TClass and (V_Fatal or V_Error))<>0;
  275. end;
  276. var
  277. P : PCompilerMessage;
  278. begin
  279. P:=List^.FirstThat(@IsError);
  280. If Assigned(P) then
  281. Begin
  282. FocusItem(List^.IndexOf(P));
  283. DrawView;
  284. End;
  285. end;
  286. {*****************************************************************************
  287. TCompilerMessageWindow
  288. *****************************************************************************}
  289. constructor TCompilerMessageWindow.Init;
  290. var R: TRect;
  291. HSB,VSB: PScrollBar;
  292. begin
  293. Desktop^.GetExtent(R);
  294. R.A.Y:=R.B.Y-7;
  295. inherited Init(R,dialog_compilermessages,{SearchFreeWindowNo}wnNoNumber);
  296. HelpCtx:=hcMessagesWindow;
  297. AutoNumber:=true;
  298. HSB:=StandardScrollBar(sbHorizontal+sbHandleKeyboard);
  299. HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY;
  300. Insert(HSB);
  301. VSB:=StandardScrollBar(sbVertical+sbHandleKeyboard);
  302. VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
  303. Insert(VSB);
  304. GetExtent(R);
  305. R.Grow(-1,-1);
  306. New(MsgLB, Init(R, HSB, VSB));
  307. MsgLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
  308. Insert(MsgLB);
  309. CompilerMessageWindow:=@self;
  310. end;
  311. procedure TCompilerMessageWindow.AddMessage(AClass: longint;const Msg, Module: string; Line, Column: longint);
  312. begin
  313. if AClass>=V_Info then
  314. Line:=0;
  315. MsgLB^.AddItem(New(PCompilerMessage,Init(AClass, Msg, MsgLB^.AddModuleName(Module), Line, Column)));
  316. end;
  317. procedure TCompilerMessageWindow.ClearMessages;
  318. begin
  319. MsgLB^.Clear;
  320. ReDraw;
  321. end;
  322. {procedure TCompilerMessageWindow.Updateinfo;
  323. begin
  324. if CompileShowed then
  325. begin
  326. InfoST^.SetText(
  327. RExpand(' Main file : '#1#$7f+Copy(SmartPath(MainFile),1,39),40)+#2+
  328. 'Total lines : '#1#$7e+IntToStr(Status.CompiledLines)+#2#13+
  329. RExpand(' Target : '#1#$7f+KillTilde(TargetSwitches^.ItemName(TargetSwitches^.GetCurrSel)),40)+#2+
  330. 'Total errors : '#1#$7e+IntToStr(Status.ErrorCount)
  331. );
  332. if status.currentline>0 then
  333. CurrST^.SetText(' Status: '#1#$7e+status.currentsource+'('+IntToStr(status.currentline)+')'#2)
  334. else
  335. CurrST^.SetText(' Status: '#1#$7e+status.currentsource+#2);
  336. end;
  337. ReDraw;
  338. end;}
  339. procedure TCompilerMessageWindow.HandleEvent(var Event: TEvent);
  340. begin
  341. case Event.What of
  342. evBroadcast :
  343. case Event.Command of
  344. cmListFocusChanged :
  345. if Event.InfoPtr=MsgLB then
  346. Message(Application,evBroadcast,cmClearLineHighlights,@Self);
  347. end;
  348. end;
  349. inherited HandleEvent(Event);
  350. end;
  351. procedure TCompilerMessageWindow.SizeLimits(var Min, Max: TPoint);
  352. begin
  353. inherited SizeLimits(Min,Max);
  354. Min.X:=20;
  355. Min.Y:=4;
  356. end;
  357. procedure TCompilerMessageWindow.Close;
  358. begin
  359. Hide;
  360. end;
  361. function TCompilerMessageWindow.GetPalette: PPalette;
  362. const
  363. S : string[length(CBrowserWindow)] = CBrowserWindow;
  364. begin
  365. GetPalette:=@S;
  366. end;
  367. constructor TCompilerMessageWindow.Load(var S: TStream);
  368. begin
  369. inherited Load(S);
  370. GetSubViewPtr(S,MsgLB);
  371. end;
  372. procedure TCompilerMessageWindow.Store(var S: TStream);
  373. begin
  374. if MsgLB^.List=nil then
  375. MsgLB^.NewList(New(PCollection, Init(100,100)));
  376. inherited Store(S);
  377. PutSubViewPtr(S,MsgLB);
  378. end;
  379. procedure TCompilerMessageWindow.UpdateCommands;
  380. var Active: boolean;
  381. begin
  382. Active:=GetState(sfActive);
  383. SetCmdState(CompileCmds,Active);
  384. Message(Application,evBroadcast,cmCommandSetChanged,nil);
  385. end;
  386. procedure TCompilerMessageWindow.SetState(AState: Word; Enable: Boolean);
  387. var OldState: word;
  388. begin
  389. OldState:=State;
  390. inherited SetState(AState,Enable);
  391. if ((AState and sfActive)<>0) and (((OldState xor State) and sfActive)<>0) then
  392. UpdateCommands;
  393. end;
  394. destructor TCompilerMessageWindow.Done;
  395. begin
  396. CompilerMessageWindow:=nil;
  397. inherited Done;
  398. end;
  399. {****************************************************************************
  400. CompilerStatusDialog
  401. ****************************************************************************}
  402. constructor TCompilerStatusDialog.Init;
  403. var R: TRect;
  404. begin
  405. R.Assign(0,0,50,11);
  406. ClearFormatParams; AddFormatParamStr(KillTilde(SwitchesModeName[SwitchesMode]));
  407. inherited Init(R, FormatStrF(dialog_compilingwithmode, FormatParams));
  408. GetExtent(R); R.B.Y:=11;
  409. R.Grow(-3,-2);
  410. New(ST, Init(R, ''));
  411. Insert(ST);
  412. GetExtent(R); R.B.Y:=11;
  413. R.Grow(-1,-1); R.A.Y:=R.B.Y-1;
  414. New(KeyST, Init(R, '', Blue*16+White+longint($80+Blue*16+White)*256,true));
  415. Insert(KeyST);
  416. end;
  417. procedure TCompilerStatusDialog.Update;
  418. var
  419. StatusS,KeyS: string;
  420. begin
  421. {$ifdef TEMPHEAP}
  422. switch_to_base_heap;
  423. {$endif TEMPHEAP}
  424. case CompilationPhase of
  425. cpCompiling :
  426. begin
  427. ClearFormatParams; AddFormatParamStr(SmartPath(Status.CurrentSource));
  428. StatusS:=FormatStrF(msg_compilingfile,FormatParams);
  429. KeyS:=msg_hint_pressesctocancel;
  430. end;
  431. cpLinking :
  432. begin
  433. ClearFormatParams; AddFormatParamStr(ExeFile);
  434. StatusS:=FormatStrF(msg_linkingfile,FormatParams);
  435. KeyS:=msg_hint_pleasewait;
  436. end;
  437. cpDone :
  438. begin
  439. StatusS:=msg_compiledone;
  440. KeyS:=msg_hint_compilesuccessfulpressenter;
  441. end;
  442. cpFailed :
  443. begin
  444. StatusS:=msg_failedtocompile;
  445. KeyS:=msg_hint_compilefailed;
  446. end;
  447. cpAborted :
  448. begin
  449. StatusS:=msg_compilationaborted;
  450. KeyS:=msg_hint_compileaborted;
  451. end;
  452. end;
  453. ClearFormatParams;
  454. AddFormatParamStr(SmartPath(MainFile));
  455. AddFormatParamStr(StatusS);
  456. AddFormatParamStr(KillTilde(TargetSwitches^.ItemName(TargetSwitches^.GetCurrSel)));
  457. AddFormatParamInt(Status.CurrentLine);
  458. AddFormatParamInt(MemAvail div 1024);
  459. AddFormatParamInt(Status.CompiledLines);
  460. AddFormatParamInt(Status.ErrorCount);
  461. ST^.SetText(
  462. FormatStrF(
  463. 'Main file: %s'#13+
  464. '%s'+#13#13+
  465. 'Target: %12s '+ 'Line number: %7d'+#13+
  466. 'Free memory: %6dK '+'Total lines: %7d'+#13+
  467. 'Total errors: %5d',
  468. FormatParams)
  469. );
  470. KeyST^.SetText(^C+KeyS);
  471. {$ifdef TEMPHEAP}
  472. switch_to_temp_heap;
  473. {$endif TEMPHEAP}
  474. end;
  475. {****************************************************************************
  476. Compiler Hooks
  477. ****************************************************************************}
  478. function CompilerStatus: boolean; {$ifndef FPC}far;{$endif}
  479. var
  480. event : tevent;
  481. begin
  482. GetKeyEvent(Event);
  483. if (Event.What=evKeyDown) and (Event.KeyCode=kbEsc) then
  484. begin
  485. CompilationPhase:=cpAborted;
  486. { update info messages }
  487. if assigned(CompilerStatusDialog) then
  488. begin
  489. {$ifdef redircompiler}
  490. RedirDisableAll;
  491. {$endif}
  492. CompilerStatusDialog^.Update;
  493. {$ifdef redircompiler}
  494. RedirEnableAll;
  495. {$endif}
  496. end;
  497. CompilerStatus:=true;
  498. exit;
  499. end;
  500. { only display line info every 100 lines, ofcourse all other messages
  501. will be displayed directly }
  502. if (status.currentline mod 100=0) then
  503. begin
  504. { update info messages }
  505. {$ifdef redircompiler}
  506. RedirDisableAll;
  507. {$endif}
  508. if assigned(CompilerStatusDialog) then
  509. CompilerStatusDialog^.Update;
  510. {$ifdef redircompiler}
  511. RedirEnableAll;
  512. {$endif}
  513. { update memory usage }
  514. { HeapView^.Update; }
  515. end;
  516. CompilerStatus:=false;
  517. end;
  518. procedure CompilerStop; {$ifndef FPC}far;{$endif}
  519. begin
  520. {$ifndef GABOR}
  521. if StopJmpValid then
  522. Longjmp(StopJmp,1)
  523. else
  524. Halt(1);
  525. {$endif}
  526. end;
  527. Function CompilerGetNamedFileTime(const filename : string) : Longint; {$ifndef FPC}far;{$endif}
  528. var t: longint;
  529. W: PSourceWindow;
  530. begin
  531. W:=EditorWindowFile(FExpand(filename));
  532. if Assigned(W) and (W^.Editor^.GetModified) then
  533. t:=Now
  534. else
  535. t:=def_getnamedfiletime(filename);
  536. CompilerGetNamedFileTime:=t;
  537. end;
  538. function CompilerOpenInputFile(const filename: string): pinputfile; {$ifndef FPC}far;{$endif}
  539. var f: pinputfile;
  540. W: PSourceWindow;
  541. begin
  542. W:=EditorWindowFile(FExpand(filename));
  543. if Assigned(W) and (W^.Editor^.GetModified) then
  544. f:=new(PFPInputFile, Init(W^.Editor))
  545. else
  546. f:={$ifndef GABOR}def_openinputfile(filename){$else}nil{$endif};
  547. if assigned(W) then
  548. W^.Editor^.CompileStamp:=CompileStamp;
  549. CompilerOpenInputFile:=f;
  550. end;
  551. function CompilerComment(Level:Longint; const s:string):boolean; {$ifndef FPC}far;{$endif}
  552. begin
  553. {$ifdef TEMPHEAP}
  554. switch_to_base_heap;
  555. {$endif TEMPHEAP}
  556. CompilerComment:=false;
  557. {$ifndef DEV}
  558. if (status.verbosity and Level)=Level then
  559. {$endif}
  560. begin
  561. {$ifdef redircompiler}
  562. RedirDisableAll;
  563. {$endif}
  564. if not CompilerMessageWindow^.GetState(sfVisible) then
  565. CompilerMessageWindow^.Show;
  566. if Desktop^.First<>PView(CompilerMessageWindow) then
  567. CompilerMessageWindow^.MakeFirst;
  568. CompilerMessageWindow^.AddMessage(Level,S,status.currentsourcepath+status.currentsource,
  569. status.currentline,status.currentcolumn);
  570. { update info messages }
  571. if assigned(CompilerStatusDialog) then
  572. CompilerStatusDialog^.Update;
  573. {$ifdef DEBUG}
  574. {$ifndef NODEBUG}
  575. def_gdb_stop(level);
  576. {$endif}
  577. {$endif DEBUG}
  578. {$ifdef redircompiler}
  579. RedirEnableAll;
  580. {$endif}
  581. { update memory usage }
  582. { HeapView^.Update; }
  583. end;
  584. {$ifdef TEMPHEAP}
  585. switch_to_temp_heap;
  586. {$endif TEMPHEAP}
  587. end;
  588. {****************************************************************************
  589. DoCompile
  590. ****************************************************************************}
  591. { This function must return '' if
  592. "Options|Directories|Exe and PPU directory" is empty }
  593. function GetExePath: string;
  594. var Path: string;
  595. I: Sw_integer;
  596. begin
  597. Path:='';
  598. if DirectorySwitches<>nil then
  599. with DirectorySwitches^ do
  600. for I:=0 to ItemCount-1 do
  601. begin
  602. if ItemParam(I)='-FE' then
  603. begin
  604. Path:=GetStringItem(I);
  605. Break;
  606. end;
  607. end;
  608. if Path<>'' then
  609. GetExePath:=CompleteDir(FExpand(Path))
  610. else
  611. GetExePath:='';
  612. end;
  613. function GetMainFile: string;
  614. var FileName: string;
  615. P : PSourceWindow;
  616. begin
  617. P:=Message(Desktop,evBroadcast,cmSearchWindow,nil);
  618. if (PrimaryFileMain='') and (P=nil) then
  619. FileName:='' { nothing to compile }
  620. else
  621. begin
  622. if PrimaryFileMain<>'' then
  623. FileName:=PrimaryFileMain
  624. else
  625. begin
  626. (* if P^.Editor^.GetModified and (not P^.Editor^.Save) then
  627. FileName:='*' { file not saved }
  628. else*) { no longer needed - Gabor }
  629. FileName:=P^.Editor^.FileName;
  630. end;
  631. end;
  632. FileName:=FixFileName(FExpand(FileName));
  633. GetMainFile:=FileName;
  634. end;
  635. procedure DoCompile(Mode: TCompileMode);
  636. function IsExitEvent(E: TEvent): boolean;
  637. begin
  638. IsExitEvent:=(E.What=evKeyDown) and
  639. ((E.KeyCode=kbEnter) or (E.KeyCode=kbEsc)) or
  640. ((E.What=evCommand) and (E.command=cmClose));
  641. end;
  642. var
  643. s,FileName: string;
  644. ErrFile : Text;
  645. JmpRet,Error,LinkErrorCount : longint;
  646. E : TEvent;
  647. DummyView: PView;
  648. const
  649. PpasFile = 'ppas';
  650. begin
  651. { Get FileName }
  652. FileName:=GetMainFile;
  653. if FileName='' then
  654. begin
  655. ErrorBox(msg_nothingtocompile,nil);
  656. Exit;
  657. end else
  658. if FileName='*' then
  659. begin
  660. ErrorBox(msg_cantcompileunsavedfile,nil);
  661. Exit;
  662. end;
  663. PushStatus('Beginning compilation...');
  664. { Show Compiler Messages Window }
  665. { if not CompilerMessageWindow^.GetState(sfVisible) then
  666. CompilerMessageWindow^.Show;
  667. CompilerMessageWindow^.MakeFirst;}
  668. CompilerMessageWindow^.ClearMessages;
  669. { Tell why we compile }
  670. NeedRecompile(true);
  671. MainFile:=FileName;
  672. SetStatus('Writing switches to file...');
  673. WriteSwitches(SwitchesPath);
  674. { leaving open browsers leads to crashes !! (PM) }
  675. SetStatus('Preparing symbol info...');
  676. CloseAllBrowsers;
  677. if ((DesktopFileFlags and dfSymbolInformation)<>0) then
  678. WriteSymbolsFile(BrowserName);
  679. { MainFile:=FixFileName(FExpand(FileName));}
  680. SetStatus('Preparing to compile...'+NameOf(MainFile));
  681. If GetEXEPath<>'' then
  682. EXEFile:=FixFileName(GetEXEPath+NameOf(MainFile)+ExeExt)
  683. else
  684. EXEFile:=DirOf(MainFile)+NameOf(MainFile)+ExeExt;
  685. { Reset }
  686. CtrlBreakHit:=false;
  687. { Create Compiler Status Dialog }
  688. CompilationPhase:=cpCompiling;
  689. New(CompilerStatusDialog, Init);
  690. CompilerStatusDialog^.SetState(sfModal,true);
  691. Application^.Insert(CompilerStatusDialog);
  692. CompilerStatusDialog^.Update;
  693. { hook compiler output }
  694. {$ifdef TP}
  695. do_status:=CompilerStatus;
  696. do_stop:=CompilerStop;
  697. do_comment:=CompilerComment;
  698. {$ifndef GABOR}do_openinputfile:=CompilerOpenInputFile;{$endif}
  699. do_getnamedfiletime:=CompilerGetNamedFileTime;
  700. {$else not TP}
  701. do_status:=@CompilerStatus;
  702. do_stop:=@CompilerStop;
  703. do_comment:=@CompilerComment;
  704. do_openinputfile:=@CompilerOpenInputFile;
  705. do_getnamedfiletime:=@CompilerGetNamedFileTime;
  706. {$endif TP}
  707. do_initsymbolinfo:=InitBrowserCol;
  708. do_donesymbolinfo:=DoneBrowserCol;
  709. do_extractsymbolinfo:=CreateBrowserCol;
  710. { Compile ! }
  711. {$ifdef redircompiler}
  712. ChangeRedirOut(FPOutFileName,false);
  713. ChangeRedirError(FPErrFileName,false);
  714. {$endif}
  715. {$ifdef TEMPHEAP}
  716. split_heap;
  717. switch_to_temp_heap;
  718. {$endif TEMPHEAP}
  719. { insert "" around name so that spaces are allowed }
  720. { only supported in compiler after 2000/01/14 PM }
  721. if pos(' ',FileName)>0 then
  722. FileName:='"'+FileName+'"';
  723. if mode=cBuild then
  724. FileName:='-B '+FileName;
  725. { tokens are created and distroed by compiler.compile !! PM }
  726. DoneTokens;
  727. { it doesn't matter if ppas does not exist
  728. DeleteFile will just retrun the errorcode }
  729. DeleteFile(GetExePath+PpasFile+source_os.scriptext);
  730. SetStatus('Compiling...');
  731. {$ifndef GABOR}
  732. StopJmpValid:=true;
  733. JmpRet:=SetJmp(StopJmp);
  734. if JmpRet=0 then
  735. begin
  736. inc(CompileStamp);
  737. FpIntF.Compile(FileName,SwitchesPath);
  738. SetStatus('Finished compiling...');
  739. end
  740. else
  741. begin
  742. Inc(status.errorCount);
  743. {$ifdef HasSignal}
  744. Case JmpRet of
  745. SIGINT : s := 'Interrupted by Ctrl-C';
  746. SIGILL : s := 'Illegal instruction';
  747. SIGSEGV : s := 'Signal Segmentation violation';
  748. SIGFPE : s:='Floating point signal';
  749. else
  750. s:='Undetermined signal '+inttostr(JmpRet);
  751. end;
  752. CompilerMessageWindow^.AddMessage(V_error,s+' during compilation','',0,0);
  753. {$endif HasSignal}
  754. CompilerMessageWindow^.AddMessage(V_error,'Long jumped out of compilation...','',0,0);
  755. SetStatus('Long jumped out of compilation...');
  756. end;
  757. StopJmpValid:=false;
  758. {$endif}
  759. { tokens are created and distroed by compiler.compile !! PM }
  760. InitTokens;
  761. if LinkAfter and
  762. ExistsFile(GetExePath+PpasFile+source_os.scriptext) and
  763. (CompilationPhase<>cpAborted) and
  764. (status.errorCount=0) then
  765. begin
  766. CompilationPhase:=cpLinking;
  767. CompilerStatusDialog^.Update;
  768. SetStatus('Assembling and/or linking...');
  769. {$ifndef redircompiler}
  770. { At least here we want to catch output
  771. of batch file PM }
  772. ChangeRedirOut(FPOutFileName,false);
  773. ChangeRedirError(FPErrFileName,false);
  774. {$endif}
  775. {$ifdef Unix}
  776. Shell(GetExePath+PpasFile+source_os.scriptext);
  777. Error:=LinuxError;
  778. {$else}
  779. DosExecute(GetEnv('COMSPEC'),'/C '+GetExePath+PpasFile+source_os.scriptext);
  780. Error:=DosError;
  781. {$endif}
  782. SetStatus('Finished linking...');
  783. {$ifndef redircompiler}
  784. RestoreRedirOut;
  785. RestoreRedirError;
  786. {$endif}
  787. if Error<>0 then
  788. Inc(status.errorCount);
  789. if IsExe and not ExistsFile(EXEFile) then
  790. begin
  791. Inc(status.errorCount);
  792. ClearFormatParams; AddFormatParamStr(ExeFile);
  793. CompilerMessageWindow^.AddMessage(V_error,FormatStrF(msg_couldnotcreatefile,FormatParams),'',0,0);
  794. {$I-}
  795. Assign(ErrFile,FPErrFileName);
  796. Reset(ErrFile);
  797. if EatIO<>0 then
  798. ErrorBox(FormatStrStr(msg_cantopenfile,FPErrFileName),nil)
  799. else
  800. begin
  801. LinkErrorCount:=0;
  802. While not eof(ErrFile) and (LinkErrorCount<25) do
  803. begin
  804. readln(ErrFile,s);
  805. CompilerMessageWindow^.AddMessage(V_error,s,'',0,0);
  806. inc(LinkErrorCount);
  807. end;
  808. if not eof(ErrFile) then
  809. begin
  810. ClearFormatParams; AddFormatParamStr(FPErrFileName);
  811. CompilerMessageWindow^.AddMessage(V_error,
  812. FormatStrF(msg_therearemoreerrorsinfile,FormatParams),'',0,0);
  813. end;
  814. Close(ErrFile);
  815. end;
  816. EatIO;
  817. {$I+}
  818. end;
  819. end;
  820. {$ifdef TEMPHEAP}
  821. switch_to_base_heap;
  822. {$endif TEMPHEAP}
  823. {$ifdef redircompiler}
  824. RestoreRedirOut;
  825. RestoreRedirError;
  826. {$endif}
  827. PopStatus;
  828. { Set end status }
  829. if CompilationPhase<>cpAborted then
  830. if (status.errorCount=0) then
  831. CompilationPhase:=cpDone
  832. else
  833. CompilationPhase:=cpFailed;
  834. { Show end status }
  835. CompilerStatusDialog^.Update;
  836. CompilerStatusDialog^.SetState(sfModal,false);
  837. if ((CompilationPhase in[cpAborted,cpDone,cpFailed]) or (ShowStatusOnError)) and (Mode<>cRun) then
  838. repeat
  839. CompilerStatusDialog^.GetEvent(E);
  840. if IsExitEvent(E)=false then
  841. CompilerStatusDialog^.HandleEvent(E);
  842. until IsExitEvent(E);
  843. Application^.Delete(CompilerStatusDialog);
  844. Dispose(CompilerStatusDialog, Done);
  845. CompilerStatusDialog:=nil;
  846. { end compilation returns true if the messagewindow should be removed }
  847. if CompilationPhase=cpDone then
  848. begin
  849. CompilerMessageWindow^.Hide;
  850. { This is the last compiled main file }
  851. PrevMainFile:=MainFile;
  852. MainHasDebugInfo:=DebugInfoSwitches^.GetCurrSelParam<>'-';
  853. end;
  854. { Update the app }
  855. Message(Application,evCommand,cmUpdate,nil);
  856. {$ifdef TEMPHEAP}
  857. releasetempheap;
  858. unsplit_heap;
  859. {$endif TEMPHEAP}
  860. DummyView:=Desktop^.First;
  861. while (DummyView<>nil) and (DummyView^.GetState(sfVisible)=false) do
  862. begin
  863. DummyView:=DummyView^.NextView;
  864. end;
  865. with DummyView^ do
  866. if GetState(sfVisible) then
  867. begin
  868. SetState(sfSelected,false);
  869. SetState(sfSelected,true);
  870. end;
  871. if Assigned(CompilerMessageWindow) then
  872. with CompilerMessageWindow^ do
  873. begin
  874. if GetState(sfVisible) then
  875. begin
  876. SetState(sfSelected,false);
  877. SetState(sfSelected,true);
  878. end;
  879. if (status.errorCount>0) then
  880. MsgLB^.SelectFirstError;
  881. end;
  882. { ^^^ we need this trick to reactivate the desktop }
  883. EditorModified:=false;
  884. { Try to read Browser info in again if compilation failure !! }
  885. if Not Assigned(Modules) and (CompilationPhase<>cpDone) and
  886. ((DesktopFileFlags and dfSymbolInformation)<>0) then
  887. ReadSymbolsFile(BrowserName);
  888. end;
  889. function NeedRecompile(verbose : boolean): boolean;
  890. var Need: boolean;
  891. I: sw_integer;
  892. SF: PSourceFile;
  893. SourceTime,PPUTime,ObjTime: longint;
  894. W: PSourceWindow;
  895. begin
  896. if Assigned(SourceFiles)=false then
  897. Need:={(EditorModified=true)}true
  898. else
  899. begin
  900. Need:=(PrevMainFile<>GetMainFile) and (PrevMainFile<>'');
  901. if Need then
  902. begin
  903. if verbose then
  904. begin
  905. ClearFormatParams; AddFormatParamStr(GetMainFile);
  906. CompilerMessageWindow^.AddMessage(V_info,
  907. FormatStrF(msg_firstcompilationof,FormatParams),
  908. '',0,0);
  909. end;
  910. end
  911. else
  912. for I:=0 to SourceFiles^.Count-1 do
  913. begin
  914. SF:=SourceFiles^.At(I);
  915. SourceTime:=GetFileTime(SF^.GetSourceFileName);
  916. PPUTime:=GetFileTime(SF^.GetPPUFileName);
  917. ObjTime:=GetFileTime(SF^.GetObjFileName);
  918. { writeln('S: ',SF^.GetSourceFileName,' - ',SourceTime);
  919. writeln('P: ',SF^.GetPPUFileName,' - ',PPUTime);
  920. writeln('O: ',SF^.GetObjFileName,' - ',ObjTime);
  921. writeln('------');}
  922. { some units don't generate object files }
  923. W:=EditorWindowFile(SF^.GetSourceFileName);
  924. if (SourceTime<>-1) then
  925. if ((SourceTime>PPUTime) or
  926. ((SourceTime>ObjTime) and
  927. (ObjTime<>-1))) or
  928. (assigned(W) and (W^.Editor^.CompileStamp<0)) then
  929. begin
  930. Need:=true;
  931. if verbose then
  932. begin
  933. ClearFormatParams; AddFormatParamStr(SF^.GetSourceFileName);
  934. CompilerMessageWindow^.AddMessage(V_info,
  935. FormatStrF(msg_recompilingbecauseof,FormatParams),
  936. SF^.GetSourceFileName,1,1);
  937. end;
  938. Break;
  939. end;
  940. end;
  941. { writeln('Need?', Need); system.readln;}
  942. end;
  943. NeedRecompile:=Need;
  944. end;
  945. constructor TFPInputFile.Init(AEditor: PFileEditor);
  946. begin
  947. if not Assigned(AEditor) then Fail;
  948. if inherited Init(AEditor^.FileName)=false then
  949. Fail;
  950. Editor:=AEditor;
  951. end;
  952. function TFPInputFile.fileopen(const filename: string): boolean;
  953. var OK: boolean;
  954. begin
  955. S:=New(PMemoryStream, Init(0,0));
  956. OK:=Assigned(S) and (S^.Status=stOK);
  957. if OK then OK:=Editor^.SaveToStream(S);
  958. if OK then
  959. S^.Seek(0)
  960. else
  961. begin
  962. if Assigned(S) then Dispose(S, Done);
  963. S:=nil;
  964. end;
  965. fileopen:=OK;
  966. end;
  967. function TFPInputFile.fileseek(pos: longint): boolean;
  968. var OK: boolean;
  969. begin
  970. OK:=assigned(S);
  971. if OK then
  972. begin
  973. S^.Reset;
  974. S^.Seek(pos);
  975. OK:=(S^.Status=stOK);
  976. end;
  977. fileseek:=OK;
  978. end;
  979. function TFPInputFile.fileread(var databuf; maxsize: longint): longint;
  980. var
  981. size: longint;
  982. begin
  983. if not assigned(S) then size:=0 else
  984. begin
  985. size:=min(maxsize,(S^.GetSize-S^.GetPos));
  986. S^.Read(databuf,size);
  987. if S^.Status<>stOK then size:=0;
  988. end;
  989. fileread:=size;
  990. end;
  991. function TFPInputFile.fileeof: boolean;
  992. var EOF: boolean;
  993. begin
  994. EOF:=not assigned(S);
  995. if not EOF then
  996. EOF:=(S^.Status<>stOK) or (S^.GetPos=S^.GetSize);
  997. fileeof:=EOF;
  998. end;
  999. function TFPInputFile.fileclose: boolean;
  1000. var OK: boolean;
  1001. begin
  1002. OK:=assigned(S);
  1003. if OK then
  1004. begin
  1005. S^.Reset;
  1006. Dispose(S, Done);
  1007. OK:=true;
  1008. end;
  1009. fileclose:=OK;
  1010. end;
  1011. procedure RegisterFPCompile;
  1012. begin
  1013. {$ifndef NOOBJREG}
  1014. RegisterType(RCompilerMessageListBox);
  1015. RegisterType(RCompilerMessageWindow);
  1016. {$endif}
  1017. end;
  1018. end.
  1019. {
  1020. $Log$
  1021. Revision 1.7 2000-11-15 00:14:10 pierre
  1022. new merge
  1023. Revision 1.1.2.11 2000/11/14 17:40:02 pierre
  1024. * fix the linking problem in another directory
  1025. Revision 1.1.2.10 2000/11/14 09:23:55 marco
  1026. * Second batch
  1027. Revision 1.6 2000/11/13 17:37:41 pierre
  1028. merges from fixes branch
  1029. Revision 1.1.2.9 2000/11/06 16:55:48 pierre
  1030. * fix failure to recompile when file changed
  1031. Revision 1.5 2000/10/31 22:35:54 pierre
  1032. * New big merge from fixes branch
  1033. Revision 1.1.2.8 2000/10/31 07:51:58 pierre
  1034. * recover gracefully if compiler generates a signal
  1035. Revision 1.1.2.7 2000/10/18 21:53:26 pierre
  1036. * several Gabor fixes
  1037. Revision 1.1.2.6 2000/10/09 16:28:24 pierre
  1038. * several linux enhancements
  1039. Revision 1.4 2000/10/04 15:01:11 pierre
  1040. * fix IsExe problem
  1041. Revision 1.1.2.5 2000/10/03 16:15:57 pierre
  1042. * Use LongJmp in CompilerStop
  1043. Revision 1.3 2000/09/01 21:33:25 peter
  1044. * files to finput
  1045. Revision 1.2 2000/08/22 09:41:39 pierre
  1046. * first big merge from fixes branch
  1047. Revision 1.1.2.4 2000/08/16 18:46:14 peter
  1048. [*] double clicking on a droplistbox caused GPF (due to invalid recurson)
  1049. [*] Make, Build now possible even in Compiler Messages Window
  1050. [+] when started in a new dir the IDE now ask whether to create a local
  1051. config, or to use the one located in the IDE dir
  1052. Revision 1.1.2.3 2000/08/15 03:40:53 peter
  1053. [*] no more fatal exits when the IDE can't find the error file (containing
  1054. the redirected assembler/linker output) after compilation
  1055. [*] hidden windows are now added always at the end of the Window List
  1056. [*] TINIFile parsed entries encapsulated in string delimiters incorrectly
  1057. [*] selection was incorrectly adjusted when typing in overwrite mode
  1058. [*] the line wasn't expanded when it's end was reached in overw. mode
  1059. [*] the IDE now tries to locate source files also in the user specified
  1060. unit dirs (for ex. as a response to 'Open at cursor' (Ctrl+Enter) )
  1061. [*] 'Open at cursor' is now aware of the extension (if specified)
  1062. Revision 1.1.2.2 2000/08/10 07:10:37 michael
  1063. * 'Auto save editor files' option did the opposite than expected, due
  1064. to a typo in FPIDE.PAS
  1065. + saving of source files before compilation is no longer neccessary.
  1066. When a modified editor file is involved in the compilation, then the
  1067. IDE saves it's contents to a memory stream and passes this to the
  1068. compiler (instead of the file on the disk)
  1069. Revision 1.1.2.1 2000/07/18 05:50:22 michael
  1070. + Merged Gabors fixes
  1071. Revision 1.1 2000/07/13 09:48:34 michael
  1072. + Initial import
  1073. Revision 1.60 2000/06/22 09:07:11 pierre
  1074. * Gabor changes: see fixes.txt
  1075. Revision 1.59 2000/06/16 08:50:40 pierre
  1076. + new bunch of Gabor's changes
  1077. Revision 1.58 2000/05/29 10:44:56 pierre
  1078. + New bunch of Gabor's changes: see fixes.txt
  1079. Revision 1.57 2000/05/02 08:42:27 pierre
  1080. * new set of Gabor changes: see fixes.txt
  1081. Revision 1.56 2000/04/25 08:42:32 pierre
  1082. * New Gabor changes : see fixes.txt
  1083. Revision 1.55 2000/04/18 11:42:36 pierre
  1084. lot of Gabor changes : see fixes.txt
  1085. Revision 1.54 2000/03/23 22:23:21 pierre
  1086. + Use PushStatus in ParseUserScreen
  1087. Revision 1.53 2000/03/21 23:33:18 pierre
  1088. adapted to wcedit addition by Gabor
  1089. Revision 1.52 2000/03/08 16:48:07 pierre
  1090. + Read BackTrace from UseScreen
  1091. Revision 1.51 2000/03/07 21:54:26 pierre
  1092. + ParseUserScreen
  1093. Revision 1.50 2000/02/06 23:41:42 pierre
  1094. + TCompilerMessageListBox.SelectFirstError
  1095. Revision 1.49 2000/01/25 00:26:35 pierre
  1096. + Browser info saving
  1097. Revision 1.48 2000/01/14 15:38:28 pierre
  1098. + support for long filenames with spaces for compilation
  1099. * avoid too long linker error output
  1100. Revision 1.47 2000/01/03 11:38:33 michael
  1101. Changes from Gabor
  1102. Revision 1.46 1999/12/01 17:08:19 pierre
  1103. * GetFileTime moved to wutils unit
  1104. Revision 1.45 1999/11/22 15:58:40 pierre
  1105. * fix for web bug 633
  1106. Revision 1.44 1999/11/21 01:44:34 pierre
  1107. + Use def_gdb_stop for easy GDB debugging
  1108. Revision 1.43 1999/11/18 13:49:56 pierre
  1109. + use IsExe var to know if we need to call ppas
  1110. Revision 1.42 1999/11/10 17:20:41 pierre
  1111. * Use fpredir.dosexecute
  1112. Revision 1.41 1999/10/25 16:34:19 pierre
  1113. * some units have no object files
  1114. led to wrong NeedRecompile result
  1115. Revision 1.40 1999/09/20 15:36:38 pierre
  1116. * adapted to new tokens unit
  1117. Revision 1.39 1999/09/16 14:34:57 pierre
  1118. + TBreakpoint and TWatch registering
  1119. + WatchesCollection and BreakpointsCollection stored in desk file
  1120. * Syntax highlighting was broken
  1121. Revision 1.38 1999/09/13 16:24:43 peter
  1122. + clock
  1123. * backspace unident like tp7
  1124. Revision 1.37 1999/09/09 14:19:16 pierre
  1125. * status should not be present in TCompilerMessage.GetText
  1126. Revision 1.36 1999/09/07 11:32:13 pierre
  1127. * fix for Linux ./ prepended to ppas.sh
  1128. * Build add '-B' option
  1129. * if linkAfter is set, get errors from linker
  1130. by redirecting files
  1131. Revision 1.35 1999/08/22 22:27:30 pierre
  1132. * not ppas call on compile failure
  1133. Revision 1.34 1999/08/16 18:25:13 peter
  1134. * Adjusting the selection when the editor didn't contain any line.
  1135. * Reserved word recognition redesigned, but this didn't affect the overall
  1136. syntax highlight speed remarkably (at least not on my Amd-K6/350).
  1137. The syntax scanner loop is a bit slow but the main problem is the
  1138. recognition of special symbols. Switching off symbol processing boosts
  1139. the performance up to ca. 200%...
  1140. * The editor didn't allow copying (for ex to clipboard) of a single character
  1141. * 'File|Save as' caused permanently run-time error 3. Not any more now...
  1142. * Compiler Messages window (actually the whole desktop) did not act on any
  1143. keypress when compilation failed and thus the window remained visible
  1144. + Message windows are now closed upon pressing Esc
  1145. + At 'Run' the IDE checks whether any sources are modified, and recompiles
  1146. only when neccessary
  1147. + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
  1148. + LineSelect (Ctrl+K+L) implemented
  1149. * The IDE had problems closing help windows before saving the desktop
  1150. Revision 1.33 1999/08/03 20:22:26 peter
  1151. + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
  1152. + Desktop saving should work now
  1153. - History saved
  1154. - Clipboard content saved
  1155. - Desktop saved
  1156. - Symbol info saved
  1157. * syntax-highlight bug fixed, which compared special keywords case sensitive
  1158. (for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
  1159. * with 'whole words only' set, the editor didn't found occourences of the
  1160. searched text, if the text appeared previously in the same line, but didn't
  1161. satisfied the 'whole-word' condition
  1162. * ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
  1163. (ie. the beginning of the selection)
  1164. * when started typing in a new line, but not at the start (X=0) of it,
  1165. the editor inserted the text one character more to left as it should...
  1166. * TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
  1167. * Shift shouldn't cause so much trouble in TCodeEditor now...
  1168. * Syntax highlight had problems recognizing a special symbol if it was
  1169. prefixed by another symbol character in the source text
  1170. * Auto-save also occours at Dos shell, Tool execution, etc. now...
  1171. Revision 1.32 1999/07/12 13:14:13 pierre
  1172. * LineEnd bug corrected, now goes end of text even if selected
  1173. + Until Return for debugger
  1174. + Code for Quit inside GDB Window
  1175. Revision 1.31 1999/06/28 19:32:17 peter
  1176. * fixes from gabor
  1177. Revision 1.30 1999/06/28 15:59:04 pierre
  1178. * View Linking stage if external linking
  1179. Revision 1.29 1999/06/28 12:39:14 pierre
  1180. + close all browsers before compiling
  1181. Revision 1.28 1999/06/21 23:42:16 pierre
  1182. + LinkAfter and Esc to abort support added
  1183. Revision 1.27 1999/05/22 13:44:29 peter
  1184. * fixed couple of bugs
  1185. Revision 1.26 1999/05/02 14:29:35 peter
  1186. * fixed typo disableredir -> redirdisable
  1187. Revision 1.25 1999/04/29 22:58:09 pierre
  1188. + disabling of redirction in compiler dialogs
  1189. Revision 1.24 1999/04/29 09:36:11 peter
  1190. * fixed hotkeys with Compiler switches
  1191. * fixed compiler status dialog
  1192. * Run shows again the output
  1193. Revision 1.23 1999/04/07 21:55:43 peter
  1194. + object support for browser
  1195. * html help fixes
  1196. * more desktop saving things
  1197. * NODEBUG directive to exclude debugger
  1198. Revision 1.22 1999/04/01 10:27:07 pierre
  1199. + file(line) in start of message added
  1200. Revision 1.21 1999/04/01 10:15:17 pierre
  1201. * CurrSt,InfoSt and LineSt were not disposed correctly in done
  1202. * TComiplerMessage destructor first calls SetCompileShow(false)
  1203. to get proper cleaning up
  1204. Revision 1.20 1999/03/23 16:16:38 peter
  1205. * linux fixes
  1206. Revision 1.19 1999/03/19 16:04:27 peter
  1207. * new compiler dialog
  1208. Revision 1.18 1999/03/16 12:38:07 peter
  1209. * tools macro fixes
  1210. + tph writer
  1211. + first things for resource files
  1212. Revision 1.17 1999/03/12 01:13:56 peter
  1213. * flag if trytoopen should look for other extensions
  1214. + browser tab in the tools-compiler
  1215. Revision 1.16 1999/03/07 23:00:47 pierre
  1216. * Fix for path of executable
  1217. Revision 1.15 1999/03/01 15:41:50 peter
  1218. + Added dummy entries for functions not yet implemented
  1219. * MenuBar didn't update itself automatically on command-set changes
  1220. * Fixed Debugging/Profiling options dialog
  1221. * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
  1222. set
  1223. * efBackSpaceUnindents works correctly
  1224. + 'Messages' window implemented
  1225. + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
  1226. + Added TP message-filter support (for ex. you can call GREP thru
  1227. GREP2MSG and view the result in the messages window - just like in TP)
  1228. * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
  1229. so topic search didn't work...
  1230. * In FPHELP.PAS there were still context-variables defined as word instead
  1231. of THelpCtx
  1232. * StdStatusKeys() was missing from the statusdef for help windows
  1233. + Topic-title for index-table can be specified when adding a HTML-files
  1234. Revision 1.14 1999/02/22 12:46:56 peter
  1235. * small fixes for linux and grep
  1236. Revision 1.13 1999/02/22 11:51:33 peter
  1237. * browser updates from gabor
  1238. Revision 1.12 1999/02/22 11:29:36 pierre
  1239. + added col info in MessageItem
  1240. + grep uses HighLightExts and should work for linux
  1241. Revision 1.11 1999/02/08 09:31:00 florian
  1242. + some split heap stuff, in $ifdef TEMPHEAP
  1243. Revision 1.10 1999/02/05 13:51:39 peter
  1244. * unit name of FPSwitches -> FPSwitch which is easier to use
  1245. * some fixes for tp7 compiling
  1246. Revision 1.9 1999/02/05 13:06:28 pierre
  1247. * allow cmClose for Compilation Dialog box
  1248. Revision 1.8 1999/02/04 13:32:01 pierre
  1249. * Several things added (I cannot commit them independently !)
  1250. + added TBreakpoint and TBreakpointCollection
  1251. + added cmResetDebugger,cmGrep,CmToggleBreakpoint
  1252. + Breakpoint list in INIFile
  1253. * Select items now also depend of SwitchMode
  1254. * Reading of option '-g' was not possible !
  1255. + added search for -Fu args pathes in TryToOpen
  1256. + added code for automatic opening of FileDialog
  1257. if source not found
  1258. Revision 1.7 1999/01/21 11:54:11 peter
  1259. + tools menu
  1260. + speedsearch in symbolbrowser
  1261. * working run command
  1262. Revision 1.6 1999/01/15 16:12:43 peter
  1263. * fixed crash after compile
  1264. Revision 1.5 1999/01/14 21:42:19 peter
  1265. * source tracking from Gabor
  1266. Revision 1.4 1999/01/12 14:29:32 peter
  1267. + Implemented still missing 'switch' entries in Options menu
  1268. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  1269. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  1270. ASCII chars and inserted directly in the text.
  1271. + Added symbol browser
  1272. * splitted fp.pas to fpide.pas
  1273. Revision 1.3 1999/01/04 11:49:42 peter
  1274. * 'Use tab characters' now works correctly
  1275. + Syntax highlight now acts on File|Save As...
  1276. + Added a new class to syntax highlight: 'hex numbers'.
  1277. * There was something very wrong with the palette managment. Now fixed.
  1278. + Added output directory (-FE<xxx>) support to 'Directories' dialog...
  1279. * Fixed some possible bugs in Running/Compiling, and the compilation/run
  1280. process revised
  1281. Revision 1.2 1998/12/28 15:47:42 peter
  1282. + Added user screen support, display & window
  1283. + Implemented Editor,Mouse Options dialog
  1284. + Added location of .INI and .CFG file
  1285. + Option (INI) file managment implemented (see bottom of Options Menu)
  1286. + Switches updated
  1287. + Run program
  1288. Revision 1.3 1998/12/22 10:39:40 peter
  1289. + options are now written/read
  1290. + find and replace routines
  1291. }