fp.pas 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 IDEHeapTrc}
  15. HeapTrc,
  16. {$endif IDEHeapTrc}
  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.10 1999-02-15 09:07:10 pierre
  94. * HEAPTRC conditionnal renamed IDEHEAPTRC
  95. Revision 1.9 1999/02/10 09:55:43 pierre
  96. + Memory tracing if compiled with -dHEAPTRC
  97. * Many memory leaks removed
  98. Revision 1.8 1999/02/08 09:30:59 florian
  99. + some split heap stuff, in $ifdef TEMPHEAP
  100. Revision 1.7 1999/02/05 13:51:38 peter
  101. * unit name of FPSwitches -> FPSwitch which is easier to use
  102. * some fixes for tp7 compiling
  103. Revision 1.6 1999/01/21 11:54:10 peter
  104. + tools menu
  105. + speedsearch in symbolbrowser
  106. * working run command
  107. Revision 1.5 1999/01/12 14:29:31 peter
  108. + Implemented still missing 'switch' entries in Options menu
  109. + Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
  110. ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
  111. ASCII chars and inserted directly in the text.
  112. + Added symbol browser
  113. * splitted fp.pas to fpide.pas
  114. }