* Merge IDE changes from 2.1

git-svn-id: branches/fixes_2_0@3573 -
This commit is contained in:
daniel 2006-05-18 21:57:23 +00:00
parent 566f41e621
commit 57b7c43ff0
14 changed files with 425 additions and 219 deletions

View File

@ -284,6 +284,16 @@ begin
{$ENDIF}
end;
{The square bullet needs an MS-DOS code page. On Unix it is for sure the code
page is not available before video is initialized. (And only in certain
circumstances after that, so, use a plain ascii character as bullet on Unix.)}
{$ifdef unix}
const bullet='*';
{$else}
const bullet='þ';
{$endif}
BEGIN
{$IFDEF HasSignal}
EnableCatchSignals;
@ -294,12 +304,12 @@ BEGIN
HistorySize:=16384;
{ Startup info }
writeln('þ Free Pascal IDE Version '+VersionStr+' ['+{$i %date%}+']');
writeln('þ Compiler Version '+Version_String);
writeln(bullet+' Free Pascal IDE Version '+VersionStr+' ['+{$i %date%}+']');
writeln(bullet+' Compiler Version '+Version_String);
{$ifndef NODEBUG}
writeln('þ GBD Version '+GDBVersion);
writeln(bullet+' GBD Version '+GDBVersion);
{$ifdef win32}
writeln('þ Cygwin "',GetCygwinFullName,'" version ',GetCygwinVersionString);
writeln(bullet+' Cygwin "',GetCygwinFullName,'" version ',GetCygwinVersionString);
CheckCygwinVersion;
{$endif win32}
{$endif NODEBUG}
@ -480,8 +490,8 @@ BEGIN
{$ifdef unix}
Video.ClearScreen;
{$endif unix}
Video.DoneVideo;
Keyboard.DoneKeyboard;
{ Video.DoneVideo;
Keyboard.DoneKeyboard;}
{$endif fpc}
{$ifdef VESA}
DoneVESAScreenModes;

View File

@ -21,7 +21,7 @@ uses Views,App,
WViews,WEditor,WHTMLHlp;
const
VersionStr = '1.0.6';
VersionStr = '1.0.8';
MaxRecentFileCount = 9;
MaxToolCount = 16;
@ -81,11 +81,7 @@ const
WinHelpExt = '.hlp';
HelpFileExts = '*.tph;*.htm*;*'+HTMLIndexExt+';*'+NGExt+';*'+WinHelpExt+';*'+INFExt;
{$ifdef UNIX}
EnterSign = '<'+#196#217;
{$else}
EnterSign = #17#196#217;
{$endif}
{ Main menu submenu indexes }
menuFile = 0;

View File

@ -442,8 +442,8 @@ begin
NewItem(menu_options_env_codetemplates,'', kbNoKey, cmCodeTemplateOptions, hcCodeTemplateOptions,
NewItem(menu_options_env_desktop,'', kbNoKey, cmDesktopOptions, hcDesktopOptions,
NewItem(menu_options_env_keybmouse,'', kbNoKey, cmMouse, hcMouse,
NewItem(menu_options_env_startup,'', kbNoKey, cmStartup, hcStartup,
NewItem(menu_options_env_colors,'', kbNoKey, cmColors, hcColors,
{ NewItem(menu_options_env_startup,'', kbNoKey, cmStartup, hcStartup,
NewItem(menu_options_env_colors,'', kbNoKey, cmColors, hcColors,}
{$ifdef Unix}
NewItem(menu_options_learn_keys,'', kbNoKey, cmKeys, hcKeys,
{$endif Unix}
@ -451,7 +451,7 @@ begin
{$ifdef Unix}
)
{$endif Unix}
))))))))),
{))}))))))),
NewLine(
NewItem(menu_options_open,'', kbNoKey, cmOpenINI, hcOpenINI,
NewItem(menu_options_save,'', kbNoKey, cmSaveINI, hcSaveINI,
@ -534,7 +534,7 @@ begin
StdStatusKeys(
NewStatusKey('~Cursor~ Move', kbNoKey, 65535,
NewStatusKey('~Shift+Cursor~ Size', kbNoKey, 65535,
NewStatusKey('~<ÄÙ~ Done', kbNoKey, 65535,
NewStatusKey('~'#17'ÄÙ~ Done', kbNoKey, 65535, {#17 = left arrow}
NewStatusKey('~Esc~ Cancel', kbNoKey, 65535,
nil)))))),
NewStatusDef(hcStackWindow, hcStackWindow,
@ -606,7 +606,6 @@ procedure TIDEApp.Idle;
begin
inherited Idle;
Message(Application,evIdle,0,nil);
GiveUpTimeSlice;
end;
procedure TIDEApp.GetEvent(var Event: TEvent);
@ -880,7 +879,7 @@ begin
{ DoneKeyboard should be called last to
restore the keyboard correctly PM }
{$ifndef go32v2}
DoneScreen;
donevideo;
{$endif ndef go32v2}
DoneKeyboard;
If UseMouse then
@ -905,7 +904,7 @@ begin
else
ButtonCount:=0;
{$ifndef go32v2}
InitScreen;
initvideo;
{$endif ndef go32v2}
{$ifdef win32}
{ write the empty screen to dummy console handle }

View File

@ -209,9 +209,7 @@ var C: string;
begin
C:='';
for I:=1 to length(S) do
begin
Insert('#$'+IntToHex(ord(S[I]),2),C,Length(C)+1);
end;
Insert('#$'+hexstr(ord(S[I]),2),C,Length(C)+1);
PaletteToStr:=C;
end;

View File

@ -287,7 +287,7 @@ begin
if (OldKey=WantedKeys[i]) and (i<>j) then
begin
If ConfirmBox('"'+St+'" is used for'+#13+
'key $'+IntToHex(OldKey,4)+' '+WantedKeysLabels[i]+#13+
'key $'+hexstr(oldKey,4)+' '+WantedKeysLabels[i]+#13+
'Change it to '+WantedKeysLabels[j],nil,true)=cmYes then
begin
KeyEscape[i]:='';

View File

@ -63,14 +63,14 @@ procedure TIDEApp.DoCompilerSwitch;
var R,R2,R3,TabR,TabIR: TRect;
D: PCenterDialog;
CB1,CB2,CB3,CB4,CB5: PCheckBoxes;
RB1,{RB2,}RB3,RB4,RB5,RB6: PRadioButtons;
RB1,RB2,RB3,RB4,RB5,RB6: PRadioButtons;
Items: PSItem;
IL: PEditorInputLine;
IL2: PEditorInputLine;
Count : integer;
I,L: longint;
Tab: PTab;
Label11,{Label12,}
Label11,Label12,
Label21,Label22,Label23,
Label31,Label41,
Label51,Label52,Label53: PLabel;
@ -93,8 +93,9 @@ begin
Count:=SyntaxSwitches^.ItemCount;
R.Copy(TabIR);
R2.Copy(R);
{ R2.B.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-2;} R2.B.X:=R2.B.X-4;
R2.B.Y:=R2.A.Y+((Count+1) div 2);
R2.B.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-3;{ R2.B.X:=R2.B.X-4;}
{ R2.B.Y:=R2.A.Y+((Count+1) div 2);}
R2.B.Y:=R2.A.Y+Count;
Items:=nil;
for I:=Count-1 downto 0 do
Items:=NewSItem(SyntaxSwitches^.ItemName(I), Items);
@ -106,6 +107,23 @@ begin
R2.B.Y:=R2.A.Y+1;
New(Label11, Init(R2, label_compiler_syntaxswitches, CB1));
Count:=CompilerModeSwitches^.ItemCount;
R.Copy(TabIR);
R2.Copy(R);
R2.A.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-2;
R2.B.X:=R2.B.X-3;
{ R2.B.Y:=R2.A.Y+((Count+1) div 2);}
R2.B.Y:=R2.A.Y+Count;
Items:=nil;
for I:=Count-1 downto 0 do
Items:=NewSItem(CompilerModeSwitches^.ItemName(I), Items);
New(RB2, Init(R2, Items));
L:=CompilerModeSwitches^.GetCurrSel;
RB2^.SetData(L);
Dec(R2.A.Y);
R2.B.Y:=R2.A.Y+1;
New(Label12, Init(R2, label_compiler_mode, RB2));
{ --- Sheet 2 --- }
Count:=CodegenSwitches^.ItemCount;
R2.Copy(TabIR);
@ -254,7 +272,9 @@ begin
NewTabDef(page_compiler_syntax,CB1,
NewTabItem(Label11,
NewTabItem(CB1,
nil)),
NewTabItem(Label12,
NewTabItem(RB2,
nil)))),
NewTabDef(page_compiler_codegeneration,CB3,
NewTabItem(Label21,
NewTabItem(CB3,
@ -309,6 +329,7 @@ begin
begin
for I:=0 to SyntaxSwitches^.ItemCount-1 do
SyntaxSwitches^.SetBooleanItem(I,CB1^.Mark(I));
CompilerModeSwitches^.SetCurrSel(RB2^.Value);
for I:=0 to CodeGenSwitches^.ItemCount-1 do
CodegenSwitches^.SetBooleanItem(I,CB3^.Mark(I));
for I:=0 to OptimizationSwitches^.ItemCount-1 do
@ -635,45 +656,174 @@ begin
end;
{$endif SUPPORT_REMOTE}
procedure TIDEApp.Directories;
var R,R2: TRect;
D: PCenterDialog;
IL : array[0..11] of PEditorInputLine;
Count,I : integer;
const
LW = 25;
procedure TIDEApp.directories;
{Shows a window where the user can configure the directories the compilerproc
will search files or output files to.}
var tab:Ptab;
tabR,R,R2:Trect;
D:PCenterDialog;
s,misc_string:string;
E_units,E_includes,E_libraries,E_objects,e:Pfpmemo;
L_units,L_includes,L_libraries,L_objects:Plabel;
c:PunsortedStringCollection;
count,i,j:integer;
IL:array[0..11] of PEditorInputLine;
misc_items:PTabItem;
misc_tabfocus:Pview;
const LW=25;
begin
Count:=DirectorySwitches^.ItemCount;
R.Assign(0,0,round(ScreenWidth*64/80),2+Count*2);
New(D, Init(R, dialog_directories));
with D^ do
begin
HelpCtx:=hcdirectories;
GetExtent(R);
R.Grow(-2,-2);
Dec(R.B.X);
R.B.Y:=R.A.Y+1;
for i:=Count-1 downto 0 do
begin
R2.Copy(R);
R2.A.X:=LW;
New(IL[i], Init(R2, 255));
IL[i]^.Data^:=DirectorySwitches^.GetStringItem(i);
Insert(IL[i]);
R2.Copy(R);
R2.B.X:=LW;
Insert(New(PLabel, Init(R2, DirectorySwitches^.ItemName(i), IL[i])));
R.Move(0,2);
end;
end;
InsertButtons(D);
IL[Count-1]^.Select;
if Desktop^.ExecView(D)=cmOK then
begin
for i:=Count-1 downto 0 do
DirectorySwitches^.SetStringItem(i,IL[i]^.Data^);
end;
Dispose(D, Done);
R.assign(0,0,screenwidth*64 div 80,18);
new(D,init(R,dialog_directories));
if d^.size.x<72 then
misc_string:='~M~isc.'
else
misc_string:='~M~iscellaneous';
{Create editors.}
R.assign(1,4,d^.size.x-4,d^.size.y-4);
new(E_units,init(R,nil,nil,nil));
R.assign(1,3,d^.size.x-4,4);
new(L_units,init(R,'Unit ~d~irectories:',E_units));
R.assign(1,4,d^.size.x-4,d^.size.y-4);
new(E_includes,init(R,nil,nil,nil));
R.assign(1,3,d^.size.x-4,4);
new(L_includes,init(R,'Include ~d~irectories:',E_includes));
R.assign(1,4,d^.size.x-4,d^.size.y-4);
new(E_libraries,init(R,nil,nil,nil));
R.assign(1,3,d^.size.x-4,4);
new(L_libraries,init(R,'Library ~d~irectories:',E_libraries));
R.assign(1,4,d^.size.x-4,d^.size.y-4);
new(E_objects,init(R,nil,nil,nil));
R.assign(1,3,d^.size.x-4,4);
new(L_objects,init(R,'Object file ~d~irectories:',E_objects));
{The switches that are put into the editors are of type multistring.
We add multistrings to the editor. Other inputboxes are created on
demand on the "Miscellaneous" tab.}
R.assign(1,4,d^.size.x-5,5);
count:=DirectorySwitches^.ItemCount;
misc_items:=nil;
misc_tabfocus:=nil;
for i:=0 to count-1 do
begin
if directorySwitches^.GetItemTyp(i)=ot_MultiString then
begin
case directorySwitches^.itemParam(i)[3] of
'u':
e:=E_units;
'i':
e:=E_includes;
'l':
e:=E_libraries;
'o':
e:=E_objects;
else
messagebox('Internal error: Unknown switch.',nil,mfOkButton);
end;
e^.setcontent(directorySwitches^.getMultiStringItem(i));
e^.addline(''); {Empty line so user can scroll below existing dirs.}
IL[i]:=nil;
end
else
begin
R2.copy(R);
R2.A.X:=LW;
new(IL[i],init(R2,255));
IL[i]^.data^:=DirectorySwitches^.GetStringItem(i);
misc_items:=newTabItem(IL[i],misc_items);
if misc_tabfocus=nil then
misc_tabfocus:=IL[i];
R2.copy(R);
R2.B.X:=LW;
misc_items:=newTabItem(
new(Plabel,init(R2,
DirectorySwitches^.ItemName(i),
IL[i])),
misc_items);
R.move(0,2);
end;
end;
{Create some tabs in the window.}
tabR.assign(1,1,d^.size.x-2,d^.size.y-1);
new(tab,init(tabR,
newtabdef('~U~nits',e_units,
NewTabItem(L_units,
NewTabItem(E_units,
nil)),
NewTabDef('~I~nclude files',E_includes,
NewTabItem(L_includes,
NewTabItem(E_includes,
nil)),
NewTabDef('~L~ibraries',E_libraries,
NewTabItem(L_libraries,
NewTabItem(E_libraries,
nil)),
NewTabDef('~O~bject files',E_objects,
NewTabItem(L_objects,
NewTabItem(E_objects,
nil)),
NewTabDef(misc_string,misc_tabfocus,
misc_items,
nil)))))
));
tab^.growmode:=0;
d^.insert(tab);
insertbuttons(D);
if desktop^.execview(D)=cmOK then
begin
{Move the data from the window back into the switches.}
for i:=0 to count-1 do
if directorySwitches^.GetItemTyp(i)=ot_MultiString then
begin
case directorySwitches^.itemParam(i)[3] of
'u':
e:=E_units;
'i':
e:=E_includes;
'l':
e:=E_libraries;
'o':
e:=E_objects;
else
messagebox('Internal error: Unknown switch.',nil,mfOkButton);
end;
c:=directorySwitches^.getMultiStringItem(i);
c^.freeall;
for j:=0 to e^.getlinecount-1 do
begin
s:=e^.getlinetext(j);
{Strip string.}
while (length(s)>0) and (s[length(s)]=' ') do
dec(s[0]);
while (length(s)>0) and (s[1]=' ') do
system.delete(s,1,1);
if s<>'' then
c^.insert(newstr(s));
end;
end
else
begin
s:=IL[i]^.data^;
{Strip string.}
while (length(s)>0) and (s[length(s)]=' ') do
dec(s[0]);
while (length(s)>0) and (s[1]=' ') do
system.delete(s,1,1);
DirectorySwitches^.SetStringItem(i,s);
end;
end;
dispose(D,done);
end;
procedure TIDEApp.Tools;

View File

@ -111,7 +111,7 @@ begin
HelpCtx:=hcWindowList;
New(C, Init(20,10));
GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.X:=R.B.X-13;
GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.X:=R.B.X-14;
R2.Copy(R); R2.Move(1,0); R2.A.X:=R2.B.X-1;
New(SB, Init(R2)); Insert(SB);
New(LB, Init(R, SB));

View File

@ -254,7 +254,6 @@ begin
dup2:=false;
end;
{$ifndef ver1_0}
function fpdup(fh:longint):longint;
begin
if not dup(fh,fpdup) then
@ -268,33 +267,32 @@ begin
else
fpdup2:=-1;
end;
{$endif ver1_0}
Function {$ifdef ver1_0}fdclose{$else}fpclose{$endif} (Handle : Longint) : boolean;
function fpclose(Handle : Longint) : boolean;
var Regs: registers;
begin
Regs.Eax := $3e00;
Regs.Ebx := Handle;
MsDos(Regs);
{$ifdef ver1_0}fdclose{$else}fpclose{$endif}:=(Regs.Flags and fCarry)=0;
fpclose:=(Regs.Flags and fCarry)=0;
end;
{$endif def go32v2}
{$ifdef win32}
Function {$ifdef ver1_0}fdclose{$else}fpclose{$endif} (Handle : Longint) : boolean;
Function fpclose(Handle : Longint) : boolean;
begin
{ Do we need this ?? }
{$ifdef ver1_0}fdclose{$else}fpclose{$endif}:=true;
fpclose:=true;
end;
{$endif}
{$ifdef os2}
Function {$ifdef ver1_0}fdclose{$else}fpclose{$endif} (Handle : Longint) : boolean;
Function fpclose (Handle : Longint) : boolean;
begin
{ Do we need this ?? }
{$ifdef ver1_0}fdclose{$else}fpclose{$endif}:=true;
fpclose:=true;
end;
{$endif}
@ -302,9 +300,8 @@ end;
Function {$ifdef ver1_0}fdclose{$else}fpclose{$endif} (Handle : Longint) : boolean;
begin
{ if executed as under GO32 this hangs the DOS-prompt }
{$ifdef ver1_0}fdclose{$else}fpclose{$endif}:=true;
fpclose:=true;
end;
{$endif}
{$I-}
@ -397,13 +394,8 @@ function ChangeRedirOut(Const Redir : String; AppendToFile : Boolean) : Boolean;
{$ifdef win32}
if SetStdHandle(Std_Output_Handle,FileRec(FOUT^).Handle) then
{$else not win32}
{$ifdef ver1_0}
dup(StdOutputHandle,TempHOut);
dup2(FileRec(FOUT^).Handle,StdOutputHandle);
{$else}
TempHOut:=fpdup(StdOutputHandle);
fpdup2(FileRec(FOUT^).Handle,StdOutputHandle);
{$endif}
if (TempHOut<>UnusedHandle) and
(StdOutputHandle<>UnusedHandle) then
{$endif not win32}
@ -435,13 +427,8 @@ function ChangeRedirIn(Const Redir : String) : Boolean;
{$ifdef win32}
if SetStdHandle(Std_Input_Handle,FileRec(FIN^).Handle) then
{$else not win32}
{$ifdef ver1_0}
dup(StdInputHandle,TempHIn);
dup2(FileRec(FIn^).Handle,StdInputHandle);
{$else}
TempHIn:=fpdup(StdInputHandle);
fpdup2(FileRec(FIn^).Handle,StdInputHandle);
{$endif}
if (TempHIn<>UnusedHandle) and
(StdInputHandle<>UnusedHandle) then
{$endif not win32}
@ -477,13 +464,8 @@ function ChangeRedirError(Const Redir : String; AppendToFile : Boolean) : Boolea
{$ifdef win32}
if SetStdHandle(Std_Error_Handle,FileRec(FERR^).Handle) then
{$else not win32}
{$ifdef ver1_0}
dup(StdErrorHandle,TempHError);
dup2(FileRec(FERR^).Handle,StdErrorHandle);
{$else}
TempHError:=fpdup(StdErrorHandle);
fpdup2(FileRec(FERR^).Handle,StdErrorHandle);
{$endif}
if (TempHError<>UnusedHandle) and
(StdErrorHandle<>UnusedHandle) then
{$endif not win32}
@ -541,11 +523,11 @@ end;
{$ifdef win32}
SetStdHandle(Std_Output_Handle,StdOutputHandle);
{$else not win32}
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(TempHOut,StdOutputHandle);
fpdup2(TempHOut,StdOutputHandle);
{$endif not win32}
{$endif FPC}
Close (FOUT^);
{$ifdef ver1_0}fdclose{$else}fpclose{$endif}(TempHOut);
fpclose(TempHOut);
RedirChangedOut:=false;
end;
@ -562,11 +544,11 @@ end;
{$ifdef win32}
SetStdHandle(Std_Input_Handle,StdInputHandle);
{$else not win32}
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(TempHIn,StdInputHandle);
fpdup2(TempHIn,StdInputHandle);
{$endif not win32}
{$endif}
Close (FIn^);
{$ifdef ver1_0}fdclose{$else}fpclose{$endif}(TempHIn);
fpclose(TempHIn);
RedirChangedIn:=false;
end;
@ -583,7 +565,7 @@ end;
{$ifdef win32}
SetStdHandle(Std_Input_Handle,StdInputHandle);
{$else not win32}
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(TempHIn,StdInputHandle);
fpdup2(TempHIn,StdInputHandle);
{$endif not win32}
{$endif}
InRedirDisabled:=True;
@ -603,7 +585,7 @@ end;
{$ifdef win32}
SetStdHandle(Std_Input_Handle,FileRec(FIn^).Handle);
{$else not win32}
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(FileRec(FIn^).Handle,StdInputHandle);
fpdup2(FileRec(FIn^).Handle,StdInputHandle);
{$endif not win32}
{$endif}
InRedirDisabled:=False;
@ -622,7 +604,7 @@ end;
{$ifdef win32}
SetStdHandle(Std_Output_Handle,StdOutputHandle);
{$else not win32}
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(TempHOut,StdOutputHandle);
fpdup2(TempHOut,StdOutputHandle);
{$endif not win32}
{$endif}
OutRedirDisabled:=True;
@ -642,7 +624,7 @@ end;
{$ifdef win32}
SetStdHandle(Std_Output_Handle,FileRec(FOut^).Handle);
{$else not win32}
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(FileRec(FOut^).Handle,StdOutputHandle);
fpdup2(FileRec(FOut^).Handle,StdOutputHandle);
{$endif not win32}
{$endif}
OutRedirDisabled:=False;
@ -661,11 +643,11 @@ end;
{$ifdef win32}
SetStdHandle(Std_Error_Handle,StdErrorHandle);
{$else not win32}
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(TempHError,StdErrorHandle);
fpdup2(TempHError,StdErrorHandle);
{$endif not win32}
{$endif}
Close (FERR^);
{$ifdef ver1_0}fdclose{$else}fpclose{$endif}(TempHError);
fpclose(TempHError);
RedirChangedError:=false;
end;
@ -962,20 +944,11 @@ end;
{$ifdef UNIX}
IOStatus:=0;
ExecuteResult:=Shell(MaybeQuoted(FixPath(Progname))+' '+Comline);
{$ifdef ver1_0}
{ Signal that causes the stop of the shell }
IOStatus:=ExecuteResult and $7F;
{ Exit Code seems to be in the second byte,
is this also true for BSD ??
$80 bit is a CoreFlag apparently }
ExecuteResult:=(ExecuteResult and $ff00) shr 8;
{$else}
if ExecuteResult<0 then
begin
IOStatus:=(-ExecuteResult) and $7f;
ExecuteResult:=((-ExecuteResult) and $ff00) shr 8;
end;
{$endif}
{$else}
{$ifdef win32}
StoreInherit:=ExecInheritsHandles;

View File

@ -548,7 +548,8 @@ const
static_switchesmode_switchesmode = 'Switches Mode';
dialog_compilerswitches = 'Compiler Switches';
label_compiler_syntaxswitches = 'Syntax Switches';
label_compiler_syntaxswitches = 'S~y~ntax Switches';
label_compiler_mode = 'Compiler ~m~ode';
label_compiler_runtimechecks = 'Run-time checks';
label_compiler_optimizations = 'Optimizations';
label_compiler_targetprocessor = 'Target processor';
@ -774,18 +775,25 @@ const
msg_automaticallycreateddontedit = 'Automaticly created file, don''t edit.';
{ Compiler options }
opt_objectpascal = '~O~bject pascal support';
opt_clikeoperators = '~C~-like operators';
opt_stopafterfirsterror = 'S~t~op after first error';
opt_allowlabelandgoto = 'Allo~w~ LABEL and GOTO';
opt_cplusplusstyledinline = 'C++ styled ~i~nline';
opt_globalcmacros = 'Global C ~m~acros';
opt_tp7compatibility = 'TP/BP ~7~.0 compatibility';
opt_delphicompatibility = 'Del~p~hi compatibility';
opt_allowstaticinobjects = 'A~l~low STATIC in objects';
opt_strictvarstrings = 'Strict ~v~ar-strings';
opt_extendedsyntax = 'E~x~tended syntax';
opt_allowmmxoperations = 'Allow MMX op~e~rations';
opt_objectpascal = 'Object pascal support';
opt_clikeoperators = 'C-like operators';
opt_stopafterfirsterror = 'Stop after first error';
opt_allowlabelandgoto = 'Allow LABEL and GOTO';
opt_cplusplusstyledinline = 'Allow inline';
opt_globalcmacros = 'Enable macros';
opt_allowstaticinobjects = 'Allow STATIC in objects';
opt_assertions = 'Include assertion code';
opt_kylix = 'Load Kylix compat. unit';
opt_strictvarstrings = 'Strict var-strings';
opt_extendedsyntax = 'Extended syntax';
opt_allowmmxoperations = 'Allow MMX operations';
opt_mode_freepascal = 'Free Pascal dialect';
opt_mode_objectpascal = 'Object Pascal extension on';
opt_mode_turbopascal = 'Turbo Pascal compatible';
opt_mode_delphi = 'Delphi compatible';
opt_mode_macpascal = 'Macintosh Pascal dialect';
opt_mode_gnupascal = 'GNU Pascal';
{ Verbose options }
opt_warnings = '~W~arnings';
opt_notes = 'N~o~tes';
@ -799,6 +807,9 @@ const
opt_stackchecking = '~S~tack checking';
opt_iochecking = '~I~/O checking';
opt_overflowchecking = 'Integer ~o~verflow checking';
opt_objmethcallvalid = 'Object ~m~ethod call checking';
{ Code generation }
opt_pic = '~P~osition independend code';
{ Code options }
opt_generatefastercode = 'Generate ~f~aster code';
opt_generatesmallercode = 'Generate s~m~aller code';
@ -846,6 +857,7 @@ const
opt_exeppudirectories = '~E~XE output directory';
opt_ppuoutputdirectory = '~P~PU output directory';
opt_cross_tools_directory = '~C~ross tools directory';
opt_dynamic_linker = '~D~ynamic linker path';
{ Library options }
opt_librariesdefault = '~T~arget default';
opt_dynamiclibraries = 'Link to ~D~ynamic libraries';

View File

@ -29,7 +29,8 @@ const
type
TParamID =
(idNone,idAlign,idRangeChecks,idStackChecks,idIOChecks,
idOverflowChecks,idAsmDirect,idAsmATT,idAsmIntel,idAsmMot,
idOverflowChecks,idObjMethCallChecks,
idAsmDirect,idAsmATT,idAsmIntel,idAsmMot,
idSymInfNone,idSymInfGlobalOnly,idSymInfGlobalLocal,
idStackSize,idHeapSize,idStrictVarStrings,idExtendedSyntax,
idMMXOps,idTypedAddress,idPackRecords,idPackEnum,idStackFrames,
@ -38,7 +39,7 @@ type
TSwitchMode = (om_Normal,om_Debug,om_Release);
TSwitchItemTyp = (ot_Select,ot_Boolean,ot_String,ot_Longint);
TSwitchItemTyp = (ot_Select,ot_Boolean,ot_String,ot_MultiString,ot_Longint);
PSwitchItem = ^TSwitchItem;
TSwitchItem = object(TObject)
@ -48,8 +49,9 @@ type
ParamID : TParamID;
constructor Init(const n,p:string; AID: TParamID);
function NeedParam:boolean;virtual;
function ParamValue:string;virtual;
function ParamValue(nr:sw_integer):string;virtual;
function ParamValueBool(SM: TSwitchMode):boolean;virtual;
function ParamCount:sw_integer;virtual;
function GetSwitchStr(SM: TSwitchMode): string; virtual;
function GetNumberStr(SM: TSwitchMode): string; virtual;
function GetOptionStr(SM: TSwitchMode): string; virtual;
@ -81,10 +83,22 @@ type
SeparateSpaces : boolean;
constructor Init(const n,p:string;AID: TParamID; mult,allowspaces:boolean);
function NeedParam:boolean;virtual;
function ParamValue:string;virtual;
function ParamValue(nr:sw_integer):string;virtual;
procedure Reset;virtual;
end;
PMultiStringItem = ^TMultiStringItem;
TMultiStringItem = object(TSwitchItem)
MultiStr : array[TSwitchMode] of PunsortedStringCollection;
constructor Init(const n,p:string;AID: TParamID);
function NeedParam:boolean;virtual;
function ParamValue(nr:sw_integer):string;virtual;
function ParamCount:sw_integer;virtual;
procedure Reset;virtual;
destructor done;virtual;
end;
PLongintItem = ^TLongintItem;
TLongintItem = object(TSwitchItem)
Val : array[TSwitchMode] of longint;
@ -110,13 +124,16 @@ type
procedure AddBooleanItem(const name,param:string; AID: TParamID);
procedure AddLongintItem(const name,param:string; AID: TParamID);
procedure AddStringItem(const name,param:string;AID: TParamID;mult,allowspaces:boolean);
procedure AddMultiStringItem(const name,param:string;AID: TParamID);
function GetCurrSel:integer;
function GetCurrSelParam : String;
function GetBooleanItem(index:integer):boolean;
function GetLongintItem(index:integer):longint;
function GetStringItem(index:integer):string;
function GetMultiStringItem(index:integer):PunsortedStringCollection;
function GetItemTyp(index:integer):TSwitchItemTyp;
procedure SetCurrSel(index:integer);
function SetCurrSelParam(const s : String) : boolean;
function SetCurrSelParam(const s:string) : boolean;
procedure SetBooleanItem(index:integer;b:boolean);
procedure SetLongintItem(index:integer;l:longint);
procedure SetStringItem(index:integer;const s:string);
@ -148,6 +165,7 @@ var
ProfileInfoSwitches,
{MemorySizeSwitches, doubled !! }
SyntaxSwitches,
CompilerModeSwitches,
VerboseSwitches,
CodegenSwitches,
OptimizationSwitches,
@ -203,7 +221,7 @@ begin
end;
function TSwitchItem.ParamValue:string;
function TSwitchItem.ParamValue(nr:sw_integer):string;
begin
ParamValue:='';
end;
@ -214,6 +232,12 @@ begin
ParamValueBool:=false;
end;
function TSwitchItem.ParamCount:sw_integer;
begin
ParamCount:=1;
end;
function TSwitchItem.GetSwitchStr(SM: TSwitchMode): string;
begin
Abstract;
@ -309,7 +333,7 @@ begin
end;
function TStringItem.ParamValue:string;
function TStringItem.ParamValue(nr:sw_integer):string;
begin
ParamValue:=Str[SwitchesMode];
end;
@ -320,6 +344,58 @@ begin
FillChar(Str,sizeof(Str),0);
end;
{*****************************************************************************
TMultiStringItem
*****************************************************************************}
constructor TMultiStringItem.Init(const n,p:string;AID:TParamID);
var i:TSwitchMode;
begin
inherited Init(n,p,AID);
typ:=ot_MultiString;
for i:=low(MultiStr) to high(MultiStr) do
new(MultiStr[i],init(5,5));
{ Reset;}
end;
function TMultiStringItem.NeedParam:boolean;
begin
NeedParam:=(multistr[SwitchesMode]^.count<>0);
end;
function TMultiStringItem.ParamValue(nr:sw_integer):string;
begin
ParamValue:=MultiStr[SwitchesMode]^.at(nr)^;
end;
function TMultiStringItem.ParamCount:sw_integer;
begin
ParamCount:=Multistr[SwitchesMode]^.count;
end;
procedure TMultiStringItem.Reset;
var i:TSwitchMode;
begin
for i:=low(multiStr) to high(multiStr) do
MultiStr[i]^.freeall;
end;
destructor TmultiStringItem.done;
var i:TSwitchMode;
begin
for i:=low(MultiStr) to high(MultiStr) do
dispose(MultiStr[i],done);
inherited done;
end;
{*****************************************************************************
TLongintItem
@ -410,11 +486,15 @@ begin
end;
procedure TSwitches.AddStringItem(const name,param:string;AID: TParamID;mult,allowspaces:boolean);
procedure TSwitches.AddStringItem(const name,param:string;AID:TParamID;mult,allowspaces:boolean);
begin
Items^.Insert(New(PStringItem,Init(name,Param,AID,mult,allowspaces)));
end;
procedure TSwitches.AddMultiStringItem(const name,param:string;AID:TParamID);
begin
Items^.Insert(New(PMultiStringItem,Init(name,Param,AID)));
end;
function TSwitches.ItemCount:integer;
begin
@ -496,6 +576,29 @@ begin
GetStringItem:='';
end;
function TSwitches.GetMultiStringItem(index:integer):PUnsortedStringCollection;
var p:PMultiStringItem;
begin
if index<ItemCount then
p:=Items^.at(Index)
else
p:=nil;
if (p<>nil) and (p^.typ=ot_multistring) then
GetMultiStringItem:=p^.MultiStr[SwitchesMode]
else
GetMultiStringItem:=nil;
end;
function TSwitches.GetItemTyp(index:integer):TSwitchItemTyp;
var p:PSwitchItem;
begin
assert(index<itemcount);
GetItemTyp:=PSwitchItem(items^.at(index))^.typ;
end;
procedure TSwitches.SetBooleanItem(index:integer;b:boolean);
var
@ -613,7 +716,8 @@ var
end
else
if P^.Param<>'/' then
Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue);
for i:=0 to p^.ParamCount-1 do
Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue(i));
end;
end;
@ -681,6 +785,8 @@ begin
else
PStringItem(FoundP)^.Str[SwitchesMode]:=Copy(s,length(FoundP^.Param)+1,255);
end;
ot_MultiString :
PMultiStringItem(foundP)^.MultiStr[SwitchesMode]^.insert(newstr(copy(s,length(foundP^.param)+1,255)));
ot_Longint : Val(Copy(s,length(FoundP^.Param)+1,255),PLongintItem(FoundP)^.Val[SwitchesMode],code);
end;
ReadItemsCfg:=true;
@ -714,6 +820,7 @@ begin
TargetSwitches^.WriteItemsCfg;
VerboseSwitches^.WriteItemsCfg;
SyntaxSwitches^.WriteItemsCfg;
CompilerModeSwitches^.WriteItemsCfg;
CodegenSwitches^.WriteItemsCfg;
OptimizationSwitches^.WriteItemsCfg;
OptimizingGoalSwitches^.WriteItemsCfg;
@ -785,6 +892,7 @@ begin
if not ProcessorSwitches^.ReadItemsCfg(s) then
res:=OptimizingGoalSwitches^.ReadItemsCfg(s);
end;
'M' : res:=CompilerModeSwitches^.ReadItemsCfg(s);
'p' : res:=ProfileInfoSwitches^.ReadItemsCfg(s);
's' : res:=LinkAfterSwitches^.ReadItemsCfg(s);
'R' : res:=AsmReaderSwitches^.ReadItemsCfg(s);
@ -856,20 +964,33 @@ begin
New(SyntaxSwitches,Init('S'));
with SyntaxSwitches^ do
begin
AddBooleanItem(opt_objectpascal,'2',idNone);
AddBooleanItem(opt_clikeoperators,'c',idNone);
// AddBooleanItem(opt_objectpascal,'2',idNone);
AddBooleanItem(opt_stopafterfirsterror,'e',idNone);
AddBooleanItem(opt_allowlabelandgoto,'g',idNone);
AddBooleanItem(opt_cplusplusstyledinline,'i',idNone);
AddBooleanItem(opt_globalcmacros,'m',idNone);
AddBooleanItem(opt_tp7compatibility,'o',idNone);
AddBooleanItem(opt_delphicompatibility,'d',idNone);
AddBooleanItem(opt_cplusplusstyledinline,'i',idNone);
// AddBooleanItem(opt_tp7compatibility,'o',idNone);
// AddBooleanItem(opt_delphicompatibility,'d',idNone);
AddBooleanItem(opt_assertions,'a',idNone);
AddBooleanItem(opt_kylix,'k',idNone);
AddBooleanItem(opt_allowstaticinobjects,'s',idNone);
AddBooleanItem(opt_clikeoperators,'c',idNone);
{ Useless as they are not passed to the compiler PM
AddBooleanItem(opt_strictvarstrings,'/',idStrictVarStrings);
AddBooleanItem(opt_extendedsyntax,'/',idExtendedSyntax);
AddBooleanItem(opt_allowmmxoperations,'/',idMMXOps); }
end;
New(CompilerModeSwitches,InitSelect('M'));
with CompilerModeSwitches^ do
begin
AddSelectItem(opt_mode_freepascal,'fpc',idNone);
AddSelectItem(opt_mode_objectpascal,'objfpc',idNone);
AddSelectItem(opt_mode_turbopascal,'tp',idNone);
AddSelectItem(opt_mode_delphi,'delphi',idNone);
AddSelectItem(opt_mode_macpascal,'macpascal',idNone);
{ GNU Pascal mode doesn't do much, better disable it
AddSelectItem(opt_mode_gnupascal,'gpc',idNone);}
end;
New(VerboseSwitches,Init('v'));
with VerboseSwitches^ do
begin
@ -888,6 +1009,8 @@ begin
AddBooleanItem(opt_stackchecking,'t',idStackChecks);
AddBooleanItem(opt_iochecking,'i',idIOChecks);
AddBooleanItem(opt_overflowchecking,'o',idOverflowChecks);
AddBooleanItem(opt_objmethcallvalid,'R',idObjMethCallChecks);
AddBooleanItem(opt_pic,'g',idNone);
end;
New(OptimizingGoalSwitches,InitSelect('O'));
with OptimizingGoalSwitches^ do
@ -937,7 +1060,7 @@ begin
with AsmReaderSwitches^ do
begin
{$ifdef I386}
AddSelectItem(opt_directassembler,'direct',idAsmDirect);
{ AddSelectItem(opt_directassembler,'direct',idAsmDirect);}
AddSelectItem(opt_attassembler,'att',idAsmATT);
AddSelectItem(opt_intelassembler,'intel',idAsmIntel);
{$endif I386}
@ -988,13 +1111,14 @@ begin
New(DirectorySwitches,Init('F'));
with DirectorySwitches^ do
begin
AddStringItem(opt_unitdirectories,'u',idNone,true,true);
AddStringItem(opt_includedirectories,'i',idNone,true,true);
AddStringItem(opt_librarydirectories,'l',idNone,true,true);
AddStringItem(opt_objectdirectories,'o',idNone,true,true);
AddMultiStringItem(opt_unitdirectories,'u',idNone);
AddMultiStringItem(opt_includedirectories,'i',idNone);
AddMultiStringItem(opt_librarydirectories,'l',idNone);
AddMultiStringItem(opt_objectdirectories,'o',idNone);
AddStringItem(opt_exeppudirectories,'E',idNone,true,true);
AddStringItem(opt_ppuoutputdirectory,'U',idNone,true,true);
AddStringItem(opt_cross_tools_directory,'D',idNone,true,true);
AddStringItem(opt_dynamic_linker,'L',idNone,false,false);
end;
New(LibLinkerSwitches,InitSelect('X'));
@ -1057,6 +1181,8 @@ begin
{ AT&T reader }
AsmReaderSwitches^.SetCurrSel(1);
{$endif i386}
{ FPC mode}
CompilerModeSwitches^.SetCurrSel(0);
{ 128k stack }
MemorySwitches^.SetLongintItem(0,65536*2);
{ 2 MB heap }
@ -1092,8 +1218,10 @@ begin
end;
procedure DoneSwitches;
begin
dispose(SyntaxSwitches,Done);
dispose(CompilerModeSwitches,Done);
dispose(VerboseSwitches,Done);
dispose(CodegenSwitches,Done);
dispose(OptimizationSwitches,Done);
@ -1131,7 +1259,9 @@ procedure AddParam(const S: string);
begin
MiscParams^.Insert(NewStr(S));
end;
procedure EnumSwitches(P: PSwitches);
procedure HandleSwitch(P: PSwitchItem); {$ifndef FPC}far;{$endif}
begin
case P^.ParamID of
@ -1140,6 +1270,7 @@ begin
idStackChecks : AddSwitch('S'+P^.GetSwitchStr(SM));
idIOChecks : AddSwitch('I'+P^.GetSwitchStr(SM));
idOverflowChecks : AddSwitch('Q'+P^.GetSwitchStr(SM));
idObjMethCallChecks: AddSwitch('OBJECTCHECKS'+P^.GetSwitchStr(SM));
{ idAsmDirect : if P^.GetParamValueBool[SM] then AddParam('ASMMODE DIRECT');
idAsmATT : if P^.GetParamValueBool[SM] then AddParam('ASMMODE ATT');
idAsmIntel : if P^.GetParamValueBool[SM] then AddParam('ASMMODE INTEL');
@ -1177,6 +1308,7 @@ begin
EnumSwitches(DebugInfoSwitches);
EnumSwitches(ProfileInfoSwitches);
EnumSwitches(SyntaxSwitches);
EnumSwitches(CompilerModeSwitches);
EnumSwitches(VerboseSwitches);
EnumSwitches(CodegenSwitches);
EnumSwitches(OptimizationSwitches);

View File

@ -1025,7 +1025,7 @@ function AddrStr(Addr: longint): string;
type TLongint = record LoW,HiW: word; end;
begin
with TLongint(Addr) do
AddrStr:='$'+IntToHex(HiW,4)+IntToHex(LoW,4);
AddrStr:='$'+hexstr(HiW,4)+hexstr(LoW,4);
end;
begin
ClearFormatParams;

View File

@ -88,6 +88,11 @@ implementation
uses
WUtils;
{$IFOPT Q+}
{$Q-}
{$DEFINE REENABLE_Q}
{$ENDIF}
function CalcHash(const s: String): Cardinal;
var
i: integer;
@ -97,6 +102,10 @@ begin
CalcHash := CalcHash shl 9 - CalcHash shl 4 + Ord(S[I]);
end;
{$IFDEF REENABLE_Q}
{$Q+}
{$ENDIF}
constructor TINIEntry.Init(const ALine: string);
begin
inherited Init;

View File

@ -146,7 +146,6 @@ function FloatToStr(D: Double; Decimals: byte): string;
function FloatToStrL(D: Double; Decimals: byte; MinLen: byte): string;
function HexToInt(S: string): longint;
function HexToCard(S: string): cardinal;
function IntToHex(L: longint; MinLen: integer): string;
function GetStr(P: PString): string;
function GetPChar(P: PChar): string;
function BoolToStr(B: boolean; const TrueS, FalseS: string): string;
@ -191,8 +190,6 @@ function StrPas(C: PChar): string;
function MemToStr(var B; Count: byte): string;
procedure StrToMem(S: string; var B);
procedure GiveUpTimeSlice;
const LastStrToIntResult : integer = 0;
LastHexToIntResult : integer = 0;
LastStrToCardResult : integer = 0;
@ -506,30 +503,6 @@ begin
HexToCard:=L;
end;
function IntToHex(L: longint; MinLen: integer): string;
const HexNums : string[16] = '0123456789ABCDEF';
var S: string;
R: real;
function DivF(Mit,Mivel: real): longint;
begin
DivF:=trunc(Mit/Mivel);
end;
function ModF(Mit,Mivel: real): longint;
begin
ModF:=trunc(Mit-DivF(Mit,Mivel)*Mivel);
end;
begin
S:='';
R:=L; if R<0 then begin R:=R+2147483647+2147483647+2; end;
repeat
Insert(HexNums[ModF(R,16)+1],S,1);
R:=DivF(R,16);
until R=0;
while length(S)<MinLen do
Insert('0',S,1);
IntToHex:=S;
end;
function FloatToStr(D: Double; Decimals: byte): string;
var S: string;
L: byte;
@ -1320,52 +1293,6 @@ begin
CopyFile:=OK;
end;
procedure GiveUpTimeSlice;
{$ifdef GO32V2}{$define DOS}{$endif}
{$ifdef TP}{$define DOS}{$endif}
{$ifdef DOS}
var r: registers;
begin
Intr ($28, R); (* This is supported everywhere. *)
r.ax:=$1680;
intr($2f,r);
end;
{$endif}
{$ifdef Unix}
var
req,rem : timespec;
begin
req.tv_sec:=0;
req.tv_nsec:=10000000;{ 10 ms }
{$ifdef ver1_0}nanosleep(req,rem){$else}fpnanosleep(@req,@rem){$endif};
end;
{$endif}
{$IFDEF OS2}
begin
DosSleep (5);
end;
{$ENDIF}
{$ifdef Win32}
begin
{ if the return value of this call is non zero then
it means that a ReadFileEx or WriteFileEx have completed
unused for now ! }
{ wait for 10 ms }
if SleepEx(10,true)=WAIT_IO_COMPLETION then
begin
{ here we should handle the completion of the routines
if we use them }
end;
end;
{$endif}
{$undef DOS}
{$ifdef netwlibc} {$define netware} {$endif}
{$ifdef netware}
begin
Delay (10);
end;
{$endif}
procedure RegisterWUtils;
begin
{$ifndef NOOBJREG}

View File

@ -1511,11 +1511,11 @@ begin
begin
if LastEmittedChar<>ord(hscLineBreak) then
EmitText(hscLineBreak);
EmitDebugText('[tag0x'+IntToHex(Cmd,2)+']');
EmitDebugText('[tag0x'+hexstr(Cmd,2)+']');
end;
$80 : begin
FontNumber:=ReadSHORT;
EmitDebugText('[font'+IntToStr(FontNumber)+']');
EmitDebugText('[font'+inttostr(FontNumber)+']');
end;
$81 : {LineBreak}
begin
@ -1614,7 +1614,7 @@ begin
AddLinkToTopic(T,ID,LinkOfs);
end;
end;
else EmitDebugText('[tag0x'+IntToHex(Cmd,2)+']');
else EmitDebugText('[tag0x'+hexstr(Cmd,2)+']');
end;
end;
if SLen>0 then