fp.pas 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Integrated Development Environment
  4. Copyright (c) 1998 by Berczi Gabor
  5. Main program of 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. program FP;
  13. uses
  14. {$ifdef HeapTrc}
  15. HeapTrc,
  16. {$endif HeapTrc}
  17. Dos,
  18. BrowCol,
  19. FPIni,FPViews,FPConst,FPVars,FPUtils,FPIde,FPHelp,FPSwitch,FPUsrScr,
  20. FPTools,FPDebug
  21. {$ifdef TEMPHEAP}
  22. ,dpmiexcp
  23. {$endif TEMPHEAP}
  24. ;
  25. procedure ProcessParams(BeforeINI: boolean);
  26. function IsSwitch(const Param: string): boolean;
  27. begin
  28. IsSwitch:=(Param<>'') and (Param[1]<>DirSep) { <- allow UNIX root-relative paths }
  29. and (Param[1] in ['-','/']); { <- but still accept dos switch char, eg. '/' }
  30. end;
  31. var I: integer;
  32. Param: string;
  33. begin
  34. for I:=1 to ParamCount do
  35. begin
  36. Param:=ParamStr(I);
  37. if IsSwitch(Param) then
  38. begin
  39. Param:=copy(Param,2,255);
  40. if Param<>'' then
  41. case Upcase(Param[1]) of
  42. 'C' : { custom config file (BP compatiblity) }
  43. if BeforeINI then
  44. INIPath:=copy(Param,2,255);
  45. 'R' : { enter the directory last exited from (BP comp.) }
  46. begin
  47. Param:=copy(Param,2,255);
  48. if (Param='') or (Param='+') then
  49. StartupOptions:=StartupOptions or soReturnToLastDir
  50. else
  51. if (Param='-') then
  52. StartupOptions:=StartupOptions and (not soReturnToLastDir);
  53. end;
  54. end;
  55. end
  56. else
  57. if not BeforeINI then
  58. MyApp.Open(Param);
  59. end;
  60. end;
  61. BEGIN
  62. {$ifdef DEV}HeapLimit:=4096;{$endif}
  63. writeln('þ Free Pascal IDE Version '+VersionStr);
  64. StartupDir:=CompleteDir(FExpand('.'));
  65. ProcessParams(true);
  66. InitBreakpoints;
  67. InitReservedWords;
  68. InitHelpFiles;
  69. InitSwitches;
  70. InitINIFile;
  71. InitUserScreen;
  72. InitTools;
  73. { load old options }
  74. ReadINIFile;
  75. ReadSwitches(SwitchesPath);
  76. MyApp.Init;
  77. ProcessParams(false);
  78. MyApp.Run;
  79. MyApp.Done;
  80. WriteSwitches(SwitchesPath);
  81. WriteINIFile;
  82. DoneTools;
  83. DoneUserScreen;
  84. DoneSwitches;
  85. DoneHelpFiles;
  86. DoneReservedWords;
  87. DoneBrowserCol;
  88. DoneDebugger;
  89. DoneBreakpoints;
  90. END.
  91. {
  92. $Log$
  93. Revision 1.9 1999-02-10 09:55:43 pierre
  94. + Memory tracing if compiled with -dHEAPTRC
  95. * Many memory leaks removed
  96. Revision 1.8 1999/02/08 09:30:59 florian
  97. + some split heap stuff, in $ifdef TEMPHEAP
  98. Revision 1.7 1999/02/05 13:51:38 peter
  99. * unit name of FPSwitches -> FPSwitch which is easier to use
  100. * some fixes for tp7 compiling
  101. Revision 1.6 1999/01/21 11:54:10 peter
  102. + tools menu
  103. + speedsearch in symbolbrowser
  104. * working run command
  105. Revision 1.5 1999/01/12 14:29:31 peter
  106. + Implemented still missing 'switch' entries in Options menu
  107. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  108. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  109. ASCII chars and inserted directly in the text.
  110. + Added symbol browser
  111. * splitted fp.pas to fpide.pas
  112. }