IDE: fixed replace all

git-svn-id: trunk@9576 -
This commit is contained in:
mattias 2006-07-08 16:36:19 +00:00
parent f10441b47f
commit 65c428629e
7 changed files with 145 additions and 116 deletions

View File

@ -118,7 +118,6 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
Constraints.MaxHeight = 33
Default = True
Kind = bkOK
ModalResult = 1
NumGlyphs = 0
OnClick = OkButtonClick
TabOrder = 3
@ -342,8 +341,8 @@ object LazFindReplaceDialog: TLazFindReplaceDialog
Caption = '&All'
Constraints.MaxHeight = 33
Kind = bkAll
ModalResult = 8
NumGlyphs = 0
OnClick = ReplaceAllButtonClick
TabOrder = 8
end
end

View File

@ -45,82 +45,82 @@ LazarusResources.Add('TLazFindReplaceDialog','FORMDATA',[
+'deBottom.Side'#7#9'asrBottom'#4'Left'#3'k'#1#6'Height'#2#24#3'Top'#3'='#1#5
+'Width'#2'3'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderS'
+'pacing.Around'#2#6#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#3'&OK'#21
+'Constraints.MaxHeight'#2'!'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2
+#1#9'NumGlyphs'#2#0#7'OnClick'#7#13'OkButtonClick'#8'TabOrder'#2#3#0#0#9'TGr'
+'oupBox'#15'OptionsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anchor'
+'SideTop.Control'#7#19'ReplaceTextComboBox'#18'AnchorSideTop.Side'#7#9'asrBo'
+'ttom'#24'AnchorSideBottom.Control'#7#12'CancelButton'#4'Left'#2#6#6'Height'
+#3#245#0#3'Top'#2'B'#5'Width'#3#199#0#7'Anchors'#11#5'akTop'#6'akLeft'#8'akB'
+'ottom'#0#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#20'BorderSpac'
+'ing.Bottom'#2#6#7'Caption'#6#15'OptionsGroupBox'#8'TabOrder'#2#4#0#9'TCheck'
+'Box'#23'PromptOnReplaceCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Le'
+'ft'#2#6#6'Height'#2#20#3'Top'#3#140#0#5'Width'#3#183#0#5'Align'#7#5'alTop'
+#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Around'#2#6#7'Caption'#6#23'Prom'
+'ptOnReplaceCheckBox'#7'Checked'#9#14'ParentShowHint'#8#8'ShowHint'#9#5'Stat'
+'e'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#9'TCheckBox'#17'MultiLineCheckBox'#18
+'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#20#3'Top'#2'l'#5
+'Constraints.MaxHeight'#2'!'#7'Default'#9#4'Kind'#7#4'bkOK'#9'NumGlyphs'#2#0
+#7'OnClick'#7#13'OkButtonClick'#8'TabOrder'#2#3#0#0#9'TGroupBox'#15'OptionsG'
+'roupBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7
+#19'ReplaceTextComboBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#24'AnchorSide'
+'Bottom.Control'#7#12'CancelButton'#4'Left'#2#6#6'Height'#3#245#0#3'Top'#2'B'
+#5'Width'#3#199#0#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#18'BorderSp'
+'acing.Left'#2#6#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Bottom'#2#6#7'Ca'
+'ption'#6#15'OptionsGroupBox'#8'TabOrder'#2#4#0#9'TCheckBox'#23'PromptOnRepl'
+'aceCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2
+#20#3'Top'#3#140#0#5'Width'#3#183#0#5'Align'#7#5'alTop'#17'BorderSpacing.Top'
+#2#6#20'BorderSpacing.Around'#2#6#7'Caption'#6#23'PromptOnReplaceCheckBox'#7
+'Checked'#9#14'ParentShowHint'#8#8'ShowHint'#9#5'State'#7#9'cbChecked'#8'Tab'
+'Order'#2#0#0#0#9'TCheckBox'#17'MultiLineCheckBox'#18'AnchorSideTop.Side'#7#9
+'asrBottom'#4'Left'#2#6#6'Height'#2#20#3'Top'#2'l'#5'Width'#3#183#0#5'Align'
+#7#5'alTop'#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Around'#2#6#7'Caption'
+#6#17'MultiLineCheckBox'#7'Enabled'#8#14'ParentShowHint'#8#8'ShowHint'#9#8'T'
+'abOrder'#2#1#0#0#9'TCheckBox'#26'RegularExpressionsCheckBox'#18'AnchorSideT'
+'op.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#20#3'Top'#2'L'#5'Width'#3
+#183#0#5'Align'#7#5'alTop'#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Around'
+#2#6#7'Caption'#6#26'RegularExpressionsCheckBox'#14'ParentShowHint'#8#8'Show'
,'Hint'#9#8'TabOrder'#2#2#0#0#9'TCheckBox'#22'WholeWordsOnlyCheckBox'#18'Anch'
+'orSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#20#3'Top'#2','#5'Wid'
+'th'#3#183#0#5'Align'#7#5'alTop'#17'BorderSpacing.Top'#2#6#20'BorderSpacing.'
+'Around'#2#6#7'Caption'#6#22'WholeWordsOnlyCheckBox'#14'ParentShowHint'#8#8
+'ShowHint'#9#8'TabOrder'#2#3#0#0#9'TCheckBox'#21'CaseSensitiveCheckBox'#18'A'
+'nchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#20#3'Top'#2#12#5
+'Width'#3#183#0#5'Align'#7#5'alTop'#17'BorderSpacing.Top'#2#6#20'BorderSpaci'
+'ng.Around'#2#6#7'Caption'#6#17'MultiLineCheckBox'#7'Enabled'#8#14'ParentSho'
+'wHint'#8#8'ShowHint'#9#8'TabOrder'#2#1#0#0#9'TCheckBox'#26'RegularExpressio'
+'nsCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#20
+#3'Top'#2'L'#5'Width'#3#183#0#5'Align'#7#5'alTop'#17'BorderSpacing.Top'#2#6
+#20'BorderSpacing.Around'#2#6#7'Caption'#6#26'RegularExpressionsCheckBox'#14
,'ParentShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#2#0#0#9'TCheckBox'#22'WholeWo'
+'rdsOnlyCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'
+#2#20#3'Top'#2','#5'Width'#3#183#0#5'Align'#7#5'alTop'#17'BorderSpacing.Top'
+#2#6#20'BorderSpacing.Around'#2#6#7'Caption'#6#22'WholeWordsOnlyCheckBox'#14
+'ParentShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#3#0#0#9'TCheckBox'#21'CaseSen'
+'sitiveCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'
+#2#20#3'Top'#2#12#5'Width'#3#183#0#5'Align'#7#5'alTop'#17'BorderSpacing.Top'
+#2#6#20'BorderSpacing.Around'#2#6#7'Caption'#6#21'CaseSensitiveCheckBox'#14
+'ParentShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#4#0#0#0#9'TGroupBox'#13'Scope'
+'GroupBox'#22'AnchorSideLeft.Control'#7#15'OptionsGroupBox'#19'AnchorSideLef'
+'t.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#14'OriginGroupBox'#18'An'
+'chorSideTop.Side'#7#9'asrBottom'#4'Left'#3#211#0#6'Height'#2'J'#3'Top'#3#146
+#0#5'Width'#3#199#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#13'ScopeGroupB'
+'ox'#28'ChildSizing.LeftRightSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7
+#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomoge'
+'nousSpaceResize'#28'ChildSizing.ShrinkHorizontal'#7#24'crsHomogenousSpaceRe'
+'size'#26'ChildSizing.ShrinkVertical'#7#24'crsHomogenousSpaceResize'#18'Chil'
+'dSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.Controls'
+'PerLine'#2#1#8'TabOrder'#2#5#0#12'TRadioButton'#19'SelectedRadioButton'#4'L'
+'eft'#2#6#6'Height'#2#20#3'Top'#2#6#5'Width'#3#183#0#7'Caption'#6#19'Selecte'
+'dRadioButton'#8'TabOrder'#2#0#0#0#12'TRadioButton'#17'GlobalRadioButton'#4
+'Left'#2#6#6'Height'#2#20#3'Top'#2' '#5'Width'#3#183#0#7'Caption'#6#17'Globa'
+'lRadioButton'#7'Checked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#1#0#0#0#9
+'TGroupBox'#17'DirectionGroupBox'#22'AnchorSideLeft.Control'#7#15'OptionsGro'
+'upBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#13
+'ScopeGroupBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#3#211#0#6'Heig'
+'ht'#2'J'#3'Top'#3#226#0#5'Width'#3#199#0#20'BorderSpacing.Around'#2#6#7'Cap'
+'tion'#6#17'DirectionGroupBox'#28'ChildSizing.LeftRightSpacing'#2#6#29'Child'
+'Sizing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.Enl'
+'argeVertical'#7#24'crsHomogenousSpaceResize'#28'ChildSizing.ShrinkHorizonta'
+'l'#7#24'crsHomogenousSpaceResize'#26'ChildSizing.ShrinkVertical'#7#24'crsHo'
+'mogenousSpaceResize'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBot'
+'tom'#27'ChildSizing.ControlsPerLine'#2#1#8'TabOrder'#2#6#0#12'TRadioButton'
+#19'BackwardRadioButton'#4'Left'#2#6#6'Height'#2#20#3'Top'#2#6#5'Width'#3#183
+#0#7'Caption'#6#19'BackwardRadioButton'#8'TabOrder'#2#0#0#0#12'TRadioButton'
+#18'ForwardRadioButton'#4'Left'#2#6#6'Height'#2#20#3'Top'#2' '#5'Width'#3#183
+#0#7'Caption'#6#18'ForwardRadioButton'#7'Checked'#9#5'State'#7#9'cbChecked'#8
+'TabOrder'#2#1#0#0#0#9'TGroupBox'#14'OriginGroupBox'#22'AnchorSideLeft.Contr'
+'ol'#7#15'OptionsGroupBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorS'
+'ideTop.Control'#7#19'ReplaceTextComboBox'#18'AnchorSideTop.Side'#7#9'asrBot'
+'tom'#4'Left'#3#211#0#6'Height'#2'J'#3'Top'#2'B'#5'Width'#3#199#0#20'BorderS'
+'pacing.Around'#2#6#7'Caption'#6#14'OriginGroupBox'#28'ChildSizing.LeftRight'
+'Spacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildResiz'
+'e'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousSpaceResize'#28'ChildS'
+'izing.ShrinkHorizontal'#7#24'crsHomogenousSpaceResize'#26'ChildSizing.Shrin'
+'kVertical'#7#24'crsHomogenousSpaceResize'#18'ChildSizing.Layout'#7#29'cclLe'
+'ftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#8'TabOrder'#2
+#7#0#12'TRadioButton'#21'FromCursorRadioButton'#4'Left'#2#6#6'Height'#2#20#3
+'Top'#2#6#5'Width'#3#183#0#8'AutoSize'#8#7'Caption'#6#21'FromCursorRadioButt'
+'on'#7'Checked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#12'TRadioButto'
+'n'#22'EntireScopeRadioButton'#4'Left'#2#6#6'Height'#2#20#3'Top'#2' '#5'Widt'
+'h'#3#183#0#8'AutoSize'#8#7'Caption'#6#22'EntireScopeRadioButton'#8'TabOrder'
+#2#1#0#0#0#7'TBitBtn'#16'ReplaceAllButton'#23'AnchorSideRight.Control'#7#8'O'
+'KButton'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7
+#9'asrBottom'#4'Left'#3'1'#1#6'Height'#2#28#3'Top'#3'9'#1#5'Width'#2'4'#7'An'
+'chors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2
+#6#7'Caption'#6#4'&All'#21'Constraints.MaxHeight'#2'!'#4'Kind'#7#5'bkAll'#11
+'ModalResult'#2#8#9'NumGlyphs'#2#0#8'TabOrder'#2#8#0#0#0
+'ng.Around'#2#6#7'Caption'#6#21'CaseSensitiveCheckBox'#14'ParentShowHint'#8#8
+'ShowHint'#9#8'TabOrder'#2#4#0#0#0#9'TGroupBox'#13'ScopeGroupBox'#22'AnchorS'
+'ideLeft.Control'#7#15'OptionsGroupBox'#19'AnchorSideLeft.Side'#7#9'asrBotto'
+'m'#21'AnchorSideTop.Control'#7#14'OriginGroupBox'#18'AnchorSideTop.Side'#7#9
+'asrBottom'#4'Left'#3#211#0#6'Height'#2'J'#3'Top'#3#146#0#5'Width'#3#199#0#20
+'BorderSpacing.Around'#2#6#7'Caption'#6#13'ScopeGroupBox'#28'ChildSizing.Lef'
+'tRightSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChil'
+'dResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousSpaceResize'#28
+'ChildSizing.ShrinkHorizontal'#7#24'crsHomogenousSpaceResize'#26'ChildSizing'
+'.ShrinkVertical'#7#24'crsHomogenousSpaceResize'#18'ChildSizing.Layout'#7#29
+'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#8'TabOrd'
+'er'#2#5#0#12'TRadioButton'#19'SelectedRadioButton'#4'Left'#2#6#6'Height'#2
+#20#3'Top'#2#6#5'Width'#3#183#0#7'Caption'#6#19'SelectedRadioButton'#8'TabOr'
+'der'#2#0#0#0#12'TRadioButton'#17'GlobalRadioButton'#4'Left'#2#6#6'Height'#2
+#20#3'Top'#2' '#5'Width'#3#183#0#7'Caption'#6#17'GlobalRadioButton'#7'Checke'
+'d'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#1#0#0#0#9'TGroupBox'#17'Directio'
+'nGroupBox'#22'AnchorSideLeft.Control'#7#15'OptionsGroupBox'#19'AnchorSideLe'
+'ft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#13'ScopeGroupBox'#18'An'
+'chorSideTop.Side'#7#9'asrBottom'#4'Left'#3#211#0#6'Height'#2'J'#3'Top'#3#226
+#0#5'Width'#3#199#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#17'DirectionGr'
+'oupBox'#28'ChildSizing.LeftRightSpacing'#2#6#29'ChildSizing.EnlargeHorizont'
+'al'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crs'
+'HomogenousSpaceResize'#28'ChildSizing.ShrinkHorizontal'#7#24'crsHomogenousS'
+'paceResize'#26'ChildSizing.ShrinkVertical'#7#24'crsHomogenousSpaceResize'#18
+'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.Cont'
+'rolsPerLine'#2#1#8'TabOrder'#2#6#0#12'TRadioButton'#19'BackwardRadioButton'
+#4'Left'#2#6#6'Height'#2#20#3'Top'#2#6#5'Width'#3#183#0#7'Caption'#6#19'Back'
+'wardRadioButton'#8'TabOrder'#2#0#0#0#12'TRadioButton'#18'ForwardRadioButton'
+#4'Left'#2#6#6'Height'#2#20#3'Top'#2' '#5'Width'#3#183#0#7'Caption'#6#18'For'
+'wardRadioButton'#7'Checked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#1#0#0#0
+#9'TGroupBox'#14'OriginGroupBox'#22'AnchorSideLeft.Control'#7#15'OptionsGrou'
+'pBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#19
+'ReplaceTextComboBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#3#211#0#6
+'Height'#2'J'#3'Top'#2'B'#5'Width'#3#199#0#20'BorderSpacing.Around'#2#6#7'Ca'
+'ption'#6#14'OriginGroupBox'#28'ChildSizing.LeftRightSpacing'#2#6#29'ChildSi'
+'zing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.Enlar'
+'geVertical'#7#24'crsHomogenousSpaceResize'#28'ChildSizing.ShrinkHorizontal'
+#7#24'crsHomogenousSpaceResize'#26'ChildSizing.ShrinkVertical'#7#24'crsHomog'
+'enousSpaceResize'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'
+#27'ChildSizing.ControlsPerLine'#2#1#8'TabOrder'#2#7#0#12'TRadioButton'#21'F'
+'romCursorRadioButton'#4'Left'#2#6#6'Height'#2#20#3'Top'#2#6#5'Width'#3#183#0
+#8'AutoSize'#8#7'Caption'#6#21'FromCursorRadioButton'#7'Checked'#9#5'State'#7
+#9'cbChecked'#8'TabOrder'#2#0#0#0#12'TRadioButton'#22'EntireScopeRadioButton'
+#4'Left'#2#6#6'Height'#2#20#3'Top'#2' '#5'Width'#3#183#0#8'AutoSize'#8#7'Cap'
+'tion'#6#22'EntireScopeRadioButton'#8'TabOrder'#2#1#0#0#0#7'TBitBtn'#16'Repl'
+'aceAllButton'#23'AnchorSideRight.Control'#7#8'OKButton'#24'AnchorSideBottom'
+'.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3'1'#1
+#6'Height'#2#28#3'Top'#3'9'#1#5'Width'#2'4'#7'Anchors'#11#7'akRight'#8'akBot'
+'tom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#4'&All'#21'C'
+'onstraints.MaxHeight'#2'!'#4'Kind'#7#5'bkAll'#9'NumGlyphs'#2#0#7'OnClick'#7
+#21'ReplaceAllButtonClick'#8'TabOrder'#2#8#0#0#0
]);

View File

@ -97,7 +97,7 @@ type
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
public
property Options:TSynSearchOptions read GetOptions write SetOptions;
property Options: TSynSearchOptions read GetOptions write SetOptions;
property FindText:AnsiString read GetFindText write SetFindText;
property ReplaceText:AnsiString read GetReplaceText write SetReplaceText;
property OnKey: TOnFindDlgKey read FOnKey write SetOnKey;
@ -211,6 +211,7 @@ begin
if not CheckInput then exit;
fReplaceAllClickedLast:=false;
ActiveControl:=TextToFindComboBox;
ModalResult:=mrOk;
end;
procedure TLazFindReplaceDialog.ReplaceAllButtonClick(Sender:TObject);
@ -218,6 +219,7 @@ begin
if not CheckInput then exit;
fReplaceAllClickedLast:=true;
ActiveControl:=TextToFindComboBox;
ModalResult:=mrAll;
end;
procedure TLazFindReplaceDialog.CancelButtonClick(Sender:TObject);

View File

@ -1140,7 +1140,7 @@ begin
else
EditorComponent.LogicalCaretXY:=EditorComponent.BlockEnd
end;
//debugln('TSourceEditor.DoFindAndReplace A FindReplaceDlg.FindText="',dbgstr(FindReplaceDlg.FindText),'" ssoEntireScope=',dbgs(ssoEntireScope in FindReplaceDlg.Options),' ssoBackwards=',dbgs(ssoBackwards in FindReplaceDlg.Options));
debugln('TSourceEditor.DoFindAndReplace A FindReplaceDlg.FindText="',dbgstr(FindReplaceDlg.FindText),'" ssoEntireScope=',dbgs(ssoEntireScope in FindReplaceDlg.Options),' ssoBackwards=',dbgs(ssoBackwards in FindReplaceDlg.Options));
try
Result:=EditorComponent.SearchReplace(
FindReplaceDlg.FindText,FindReplaceDlg.ReplaceText,FindReplaceDlg.Options);

View File

@ -54,7 +54,7 @@ interface
{$ELSE}
{off $DEFINE NoGdkPixbufLib}
{$ENDIF}
{off $Define Critical_Sections_Support}
{off $Define DisableCriticalSections}
{off $Define Disable_GC_SysColors}

View File

@ -9592,13 +9592,13 @@ end;
// Placed CriticalSectionSupport outside the API wizard bounds
// so it won't affect sorting etc.
{$IfDef Critical_Sections_Support}
{$IfNDef DisableCriticalSections}
{$IfNDef Win32}
{$IfDef Unix}
{$Define pthread}
Type
{Type
_pthread_fastlock = packed record
__status: Longint;
__spinlock: Integer;
@ -9615,11 +9615,11 @@ end;
pthread_mutexattr_t = packed record
__mutexkind: Integer;
end;
end;}
{$linklib pthread}
function pthread_mutex_init(var Mutex: pthread_mutex_t;
{function pthread_mutex_init(var Mutex: pthread_mutex_t;
var Attr: pthread_mutexattr_t): Integer; cdecl;external;
function pthread_mutexattr_settype(var Attr: pthread_mutexattr_t;
Kind: Integer): Integer; cdecl;external;
@ -9628,7 +9628,7 @@ end;
function pthread_mutex_unlock(var Mutex: pthread_mutex_t):
Integer; cdecl; external;
function pthread_mutex_destroy(var Mutex: pthread_mutex_t):
Integer; cdecl; external;
Integer; cdecl; external;}
{$EndIf}
{$EndIf}
@ -9636,6 +9636,13 @@ end;
Procedure TGtkWidgetSet.InitializeCriticalSection(var CritSection: TCriticalSection);
{$IfDef pthread}
var
ACritSec: System.PRTLCriticalSection;
begin
New(ACritSec);
System.InitCriticalSection(ACritSec^);
CritSection:=TCriticalSection(ACritSec);
end;
{var
Crit : ppthread_mutex_t;
Attribute: pthread_mutexattr_t;
begin
@ -9651,7 +9658,7 @@ begin
New(Crit);
pthread_mutex_init(Crit^, Attribute);
CritSection := Longint(Crit);
end;
end;}
{$Else}
begin
end;
@ -9660,6 +9667,12 @@ end;
Procedure TGtkWidgetSet.EnterCriticalSection(var CritSection: TCriticalSection);
{$IfDef pthread}
var
ACritSec: System.PRTLCriticalSection;
begin
ACritSec:=System.PRTLCriticalSection(CritSection);
System.EnterCriticalsection(ACritSec^);
end;
{var
Crit,
tmp : ppthread_mutex_t;
begin
@ -9677,7 +9690,7 @@ begin
tmp := ppthread_mutex_t(CritSection);
CritSection := Longint(Crit);
Dispose(Tmp);
end;
end;}
{$Else}
begin
end;
@ -9686,6 +9699,12 @@ end;
Procedure TGtkWidgetSet.LeaveCriticalSection(var CritSection: TCriticalSection);
{$IfDef pthread}
var
ACritSec: System.PRTLCriticalSection;
begin
ACritSec:=System.PRTLCriticalSection(CritSection);
System.LeaveCriticalsection(ACritSec^);
end;
{var
Crit,
tmp : ppthread_mutex_t;
begin
@ -9703,7 +9722,7 @@ begin
tmp := ppthread_mutex_t(CritSection);
CritSection := Longint(Crit);
Dispose(Tmp);
end;
end;}
{$Else}
begin
end;
@ -9712,6 +9731,14 @@ end;
Procedure TGtkWidgetSet.DeleteCriticalSection(var CritSection: TCriticalSection);
{$IfDef pthread}
var
ACritSec: System.PRTLCriticalSection;
begin
ACritSec:=System.PRTLCriticalSection(CritSection);
System.DoneCriticalsection(ACritSec^);
Dispose(ACritSec);
CritSection:=0;
end;
{var
Crit,
tmp : ppthread_mutex_t;
begin
@ -9730,7 +9757,7 @@ begin
tmp := ppthread_mutex_t(CritSection);
CritSection := 0;
Dispose(Tmp);
end;
end;}
{$Else}
begin
end;

View File

@ -174,8 +174,6 @@ function StrToDouble(const s: string): double;
// debugging
procedure RaiseGDBException(const Msg: string);
procedure DumpExceptionBackTrace;
@ -1915,7 +1913,6 @@ procedure DbgOutThreadLog(const Msg: string);
var
PID: PtrInt;
fs: TFileStream;
s: string;
Filename: string;
begin
PID:=PtrInt(GetThreadID);
@ -1925,50 +1922,54 @@ begin
else
fs:=TFileStream.Create(Filename,fmCreate);
fs.Position:=fs.Size;
s:=IntToStr(PtrInt(PID))+' : '+Msg;
fs.Write(s[1], length(s));
fs.Write(Msg[1], length(Msg));
fs.Free;
end;
procedure DebuglnThreadLog(const Msg: string);
var
PID: PtrInt;
begin
DbgOutThreadLog(Msg+LineEnding);
PID:=PtrInt(GetThreadID);
DbgOutThreadLog(IntToStr(PtrInt(PID))+' : '+Msg+LineEnding);
end;
procedure DebuglnThreadLog(Args: array of const);
var
i: Integer;
s: String;
begin
s:='';
for i:=Low(Args) to High(Args) do begin
case Args[i].VType of
vtInteger: DbgOutThreadLog(dbgs(Args[i].vinteger));
vtInt64: DbgOutThreadLog(dbgs(Args[i].VInt64^));
vtQWord: DbgOutThreadLog(dbgs(Args[i].VQWord^));
vtBoolean: DbgOutThreadLog(dbgs(Args[i].vboolean));
vtExtended: DbgOutThreadLog(dbgs(Args[i].VExtended^));
vtInteger: s:=s+dbgs(Args[i].vinteger);
vtInt64: s:=s+dbgs(Args[i].VInt64^);
vtQWord: s:=s+dbgs(Args[i].VQWord^);
vtBoolean: s:=s+dbgs(Args[i].vboolean);
vtExtended: s:=s+dbgs(Args[i].VExtended^);
{$ifdef FPC_CURRENCY_IS_INT64}
// MWE:
// ppcppc 2.0.2 has troubles in choosing the right dbgs()
// so we convert here (i don't know about other versions
vtCurrency: DbgOutThreadLog(dbgs(int64(Args[i].vCurrency^)/10000, 4));
vtCurrency: s:=s+dbgs(int64(Args[i].vCurrency^)/10000, 4);
{$else}
vtCurrency: DbgOutThreadLog(dbgs(Args[i].vCurrency^));
vtCurrency: s:=s+dbgs(Args[i].vCurrency^);
{$endif}
vtString: DbgOutThreadLog(Args[i].VString^);
vtAnsiString: DbgOutThreadLog(AnsiString(Args[i].VAnsiString));
vtChar: DbgOutThreadLog(Args[i].VChar);
vtPChar: DbgOutThreadLog(Args[i].VPChar);
vtPWideChar: DbgOutThreadLog(Args[i].VPWideChar);
vtWideChar: DbgOutThreadLog(Args[i].VWideChar);
vtWidestring: DbgOutThreadLog(WideString(Args[i].VWideString));
vtObject: DbgOutThreadLog(DbgSName(Args[i].VObject));
vtClass: DbgOutThreadLog(DbgSName(Args[i].VClass));
vtPointer: DbgOutThreadLog(Dbgs(Args[i].VPointer));
vtString: s:=s+Args[i].VString^;
vtAnsiString: s:=s+AnsiString(Args[i].VAnsiString);
vtChar: s:=s+Args[i].VChar;
vtPChar: s:=s+Args[i].VPChar;
vtPWideChar: s:=s+Args[i].VPWideChar;
vtWideChar: s:=s+Args[i].VWideChar;
vtWidestring: s:=s+WideString(Args[i].VWideString);
vtObject: s:=s+DbgSName(Args[i].VObject);
vtClass: s:=s+DbgSName(Args[i].VClass);
vtPointer: s:=s+Dbgs(Args[i].VPointer);
else
DbgOutThreadLog('?unknown variant?');
end;
end;
DebuglnThreadLog;
DebuglnThreadLog(s);
end;
procedure DebuglnThreadLog;