Borland Object Pascal

++. Borland Object Pascal (IDE Borland Delphi), , , .

,
10.12.2009
620,9 K

. ,

, , , , .

53

++.

.

Borland Object Pascal (IDE Borland Delphi).

1

2

3

4

80- AT&T Bell Laboratories (Bjarne Siroustrup) ++. - , , , simula67. ++ (. . ++. -., , 1991).

++, (Rick Mascitti) 1983 , ( ). ++ . 1989 ++, ANSI ++, ANSI X3J16. 90- WG21 (ISO), ANSI/ISO ++. International Standard for Information Systems -Programming Language ++ (ISO/IEC JTC1/SC22/WG21), 1998 . ++ . , .

- .

1

function.cpp.

- .

void swap(int i, int j)

{

int temp = i;

i = j;

j = temp;

}

int main()

{

int a = 10, b = 3;

swap(a, b);

cout << " = " << a << " and b = " << b;

return 0;

}

2.

Borland Delphi ( File \ New \ Application). Caption . .

- . TOpenDialog Execute. odFile.

TButton buOpen, buProverka buClose. buOpen ( 33 - 41) Memo1 TMemo. Lines .

buProverka ( 59 - 207). sFile ( 62). , , ( 63), ( 65-68). , .. ( 69-86). ( 87-109). , , ( 110-129). . ( 130 - 145). , . , ( 146 - 154). () . - , - ( 161 - 164). ( 183 - 198). ( 202 - 203).

buClose ( 209-212) .

.1 - Design

3.

1

unit Unit1;

2

3

interface

4

5

uses

6

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

7

Dialogs, StdCtrls;

8

9

type

10

TForm1 = class(TForm)

11

Memo1: TMemo;

12

buOpen: TButton;

13

buProverka: TButton;

14

lbRezultat: TLabel;

15

odFile: TOpenDialog;

16

buClose: TButton;

17

procedure buOpenClick(Sender: TObject);

18

procedure buProverkaClick(Sender: TObject);

19

procedure buCloseClick(Sender: TObject);

20

private

21

{ Private declarations }

22

public

23

{ Public declarations }

24

end;

25

26

var

27

Form1: TForm1;

28

msTypePosition: array [1..5]of integer;

29

msFunctionName: array of string;

30

msFunctionKolParam: array of integer;

31

iFunctionKol: integer;

32

33

const

34

msType: array [1..5] of string= ('void', 'int', 'double', 'char', 'bool');

35

msError: array[1..6]of string= ('!!! ',

36

'!!! ',

37

'!!! ',

38

'!!! ',

39

'!!! ',

40

'!!! ');

41

42

implementation

43

44

{$R *.dfm}

45

46

procedure TForm1.buOpenClick(Sender: TObject);

47

begin

48

if odFile.Execute then

49

begin

50

Memo1.Lines.Clear;

51

Memo1.Lines.LoadFromFile(odFile.FileName);

52

lbRezultat.Caption:= '';

53

end;

54

end;

55

56

procedure TForm1.buProverkaClick(Sender: TObject);

57

var

58

sFile, sFunctionName, sFunctionParam: string;

59

i, iKol, j, iminPos, iminNom, iKodError, iKolParam: integer;

60

flagFunction: boolean;

61

begin

62

sFile:= Memo1.Lines.Text;

63

if sFile<>'' then

64

begin

65

iFunctionKol:= 0;

66

iKodError:= 0;

67

SetLength(msFunctionName, iFunctionKol+1);

68

SetLength(msFunctionKolParam, iFunctionKol+1);

69

//

70

iminPos:= 10000;

71

while iminPos<>0 do

72

begin

73

for i:= 1 to 5 do msTypePosition[i]:= 10000;

74

iminPos:= 1000;

75

iminNom:= 0;

76

for i:= 1 to 5 do

77

begin

78

msTypePosition[i]:= pos(msType[i], sFile);

79

if (msTypePosition[i]<>0)and(msTypePosition[i]<iminPos) then

80

begin

81

iminPos:= msTypePosition[i];

82

iminNom:= i;

83

end;

84

end;

85

if iminNom=0 then break;

86

delete(sFile, 1, iminPos+ length(msType[iminNom]));

87

//

88

i:= pos('(', sFile);

89

if i=0 then

90

begin

91

if iFunctionKol=0 then

92

begin

93

iKodError:= 1;

94

Break;

95

end

96

else

97

Continue;

98

end;

99

sFunctionName:= copy(sFile, 1, i-1);

100

delete(sFile, 1, i);

101

flagFunction:= true;

102

for i:=1 to length(sFunctionName) do

103

if not(sFunctionName[i] in ['A'..'Z', 'a'..'z', '0'..'9'])then flagFunction:= false;

104

if not flagFunction then Continue; //

105

inc(iFunctionKol);

106

SetLength(msFunctionName, iFunctionKol+1);

107

SetLength(msFunctionKolParam, iFunctionKol+1);

108

msFunctionName[iFunctionKol]:= sFunctionName;

109

msFunctionKolParam[iFunctionKol]:= 0;

110

//

111

i:= pos(')', sFile);

112

if i=0 then

113

begin

114

iKodError:= 2;

115

Break;

116

end;

117

sFunctionParam:= copy(sFile, 1, i-1);

118

delete(sFile, 1, i);

119

i:= pos(',', sFunctionParam);

120

//

121

while i<>0 do

122

begin

123

msFunctionKolParam[iFunctionKol]:= msFunctionKolParam[iFunctionKol]+1;

124

delete(sFunctionParam, 1, i);

125

i:= pos(',', sFunctionParam);

126

end;

127

// 1

128

if msFunctionKolParam[iFunctionKol]<>0 then

129

msFunctionKolParam[iFunctionKol]:= msFunctionKolParam[iFunctionKol]+1;

130

//

131

i:= pos('{', sFile);

132

if i=0 then

133

begin

134

iKodError:= 3;

135

Break;

136

end;

137

delete(sFile, 1, i);

138

i:= pos('}', sFile);

139

if i=0 then

140

begin

141

iKodError:= 4;

142

Break;

143

end;

144

delete(sFile, 1, i)

145

end;

146

//

147

if iKodError<>0 then

148

begin

149

lbRezultat.Font.Color:= clRed;

150

lbRezultat.Caption:= msError[iKodError];

151

exit;

152

end;

153

lbRezultat.Font.Color:= clBlack;

154

lbRezultat.Caption:= ' : ';

155

for i:= 1 to iFunctionKol do

156

lbRezultat.Caption:= lbRezultat.Caption+' '+ msFunctionName[i];

157

lbRezultat.Caption:= lbRezultat.Caption+#13;

158

//

159

for i:= 1 to iFunctionKol do

160

begin

161

sFile:= Memo1.Lines.Text;

162

j:= pos(msFunctionName[i], sFile);//

163

delete(sFile, 1, j+length(msFunctionName[i]));

164

j:= pos(msFunctionName[i], sFile);//

165

iKol:= 0;

166

while j<>0 do

167

begin

168

Inc(iKol);

169

delete(sFile, 1, j+length(msFunctionName[i])-1);

170

if sFile[1]<>'(' then

171

begin

172

lbRezultat.Font.Color:= clRed;

173

lbRezultat.Caption:= lbRezultat.Caption+#13+ msError[5]+' '+msFunctionName[i];

174

Exit;

175

end;

176

j:= pos(')', sFile);

177

if j=0 then

178

begin

179

lbRezultat.Font.Color:= clRed;

180

lbRezultat.Caption:= lbRezultat.Caption+#13+msError[5]+' '+msFunctionName[i];

181

Exit;

182

end;

183

sFunctionParam:= copy(sFile, 1, j);

184

iKolParam:= 0;

185

j:= pos(',', sFunctionParam);

186

while j<>0 do

187

begin

188

Inc(iKolParam);

189

delete(sFunctionParam, 1, j);

190

j:= pos(',', sFunctionParam);

191

end;

192

if iKolParam<>0 then iKolParam:= iKolParam+1;// , 1

193

if iKolParam<> msFunctionKolParam[i] then

194

begin

195

lbRezultat.Font.Color:= clRed;

196

lbRezultat.Caption:= lbRezultat.Caption+#13+msError[6]+' '+msFunctionName[i];

197

Exit;

198

end;

199

delete(sFile, 1, j);

200

j:= pos(msFunctionName[i], sFile);//

201

end;

202

lbRezultat.Caption:= lbRezultat.Caption+''+ msFunctionName[i]+ ' '+

203

IntToStr(iKol)+' (,)'+#13;

204

end;

205

206

end;

207

end;

208

209

procedure TForm1.buCloseClick(Sender: TObject);

210

begin

211

Close;

212

end;

213

214

end.

4

F9. . .2-7.

.2 -

.3 -

.4 -

.6 -

.7 -

1. .., .., .. . - .: , 1988.

2. .., .., ... : V7.0, , . - : , 1993.

3. .., .. Turbo Pascal 7.0.-.: -,1999.

4. .. Turbo Pascal 6.0,7.0. - .: , ,1993.

5. .., .. Delphi 7. . . - .: "", 2001.

6. .. Pascal 7.0. . . -.: , 2000.

7. . ., ... Turbo Pascal 7.0.-.: +,1999.

8. .. Turbo Pascal 7.0. . - .: , 2000.

9. .., .., .. ++- ., , 2006 - 525 .

10. "" 7.091501 " " 7.091502 . /.: .. , .. - : - , 2006. - 37.

// ++.

// .

// Borland Object Pascal (IDE Borland Delphi).

void swap(int i, int j)

{

int temp = i;

i = j;

j = temp;

}

int main()

{

int a = 10, b = 3;

swap(a, b);

cout << " = " << a << " and b = " << b;

return 0;

}

-$A8

-$B-

-$C+

-$D+

-$E-

-$F-

-$G+

-$H+

-$I+

-$J-

-$K-

-$L+

-$M-

-$N+

-$O+

-$P+

-$Q-

-$R-

-$S-

-$T-

-$U-

-$V+

-$W-

-$X+

-$YD

-$Z1

-cg

-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;

-H+

-W+

-M

-$M16384,1048576

-K$00400000

-LE"c:\program files\borland\delphi7\Projects\Bpl"

-LN"c:\program files\borland\delphi7\Projects\Bpl"

-w-UNSAFE_TYPE

-w-UNSAFE_CODE

-w-UNSAFE_CAST

[FileVersion]

Version=7.0

[Compiler]

A=8

B=0

C=1

D=1

E=0

F=0

G=1

H=1

I=1

J=0

K=0

L=1

M=0

N=1

O=1

P=1

Q=0

R=0

S=0

T=0

U=0

V=1

W=0

X=1

Y=1

Z=1

ShowHints=1

ShowWarnings=1

UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;

NamespacePrefix=

SymbolDeprecated=1

SymbolLibrary=1

SymbolPlatform=1

UnitLibrary=1

UnitPlatform=1

UnitDeprecated=1

HResultCompat=1

HidingMember=1

HiddenVirtual=1

Garbage=1

BoundsError=1

ZeroNilCompat=1

StringConstTruncated=1

ForLoopVarVarPar=1

TypedConstVarPar=1

AsgToTypedConst=1

CaseLabelRange=1

ForVariable=1

ConstructingAbstract=1

ComparisonFalse=1

ComparisonTrue=1

ComparingSignedUnsigned=1

CombiningSignedUnsigned=1

UnsupportedConstruct=1

FileOpen=1

FileOpenUnitSrc=1

BadGlobalSymbol=1

DuplicateConstructorDestructor=1

InvalidDirective=1

PackageNoLink=1

PackageThreadVar=1

ImplicitImport=1

HPPEMITIgnored=1

NoRetVal=1

UseBeforeDef=1

ForLoopVarUndef=1

UnitNameMismatch=1

NoCFGFileFound=1

MessageDirective=1

ImplicitVariants=1

UnicodeToLocale=1

LocaleToUnicode=1

ImagebaseMultiple=1

SuspiciousTypecast=1

PrivatePropAccessor=1

UnsafeType=0

UnsafeCode=0

UnsafeCast=0

[Linker]

MapFile=0

OutputObjs=0

ConsoleApp=1

DebugInfo=0

RemoteSymbols=0

MinStackSize=16384

MaxStackSize=1048576

ImageBase=4194304

ExeDescription=

[Directories]

OutputDir=

UnitOutputDir=

PackageDLLOutputDir=

PackageDCPOutputDir=

SearchPath=

Packages=

Conditionals=

DebugSourceDirs=

UsePackages=0

[Parameters]

RunParams=

HostApplication=

Launcher=

UseLauncher=0

DebugCWD=

[Language]

ActiveLang=

ProjectLang=

RootDir=

[Version Info]

IncludeVerInfo=0

AutoIncBuild=0

MajorVer=1

MinorVer=0

Release=0

Build=0

Debug=0

PreRelease=0

Special=0

Private=0

DLL=0

Locale=1049

CodePage=1251

[Version Info Keys]

CompanyName=

FileDescription=

FileVersion=1.0.0.0

InternalName=

LegalCopyright=

LegalTrademarks=

OriginalFilename=

ProductName=

ProductVersion=1.0.0.0

Comments=

program proverka;

uses

Forms,

Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin

Application.Initialize;

Application.CreateForm(TForm1, Form1);

Application.Run;

end.

[Closed Files]

File_0=SourceModule,'D:\Projects\Delphi\sti\check_goto\Unit1.pas',0,1,64,1,55,1,0

File_1=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\UData.pas',0,1,545,15,558,1,0

File_2=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\UTablNU.pas',0,1,681,50,698,1,0

File_3=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\UMain.pas',0,1,148,31,155,1,0

File_4=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\UPerson.pas',0,1,99,34,116,1,0

File_5=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\UFunction.pas',0,1,479,1,492,0,0

File_6=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\UEtalon.pas',0,1,800,40,825,0,0

File_7=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\UCreateAllReport.pas',0,1,406,51,407,0,0

File_8=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\USprNa.pas',0,1,1,17,9,1,0

File_9=SourceModule,'D:\Projects\Delphi Studio\SKSMiK\ZarPlata\units\USprUd.pas',0,1,305,1,308,1,0

[Modules]

Module0=D:\Projects\Delphi\sti\check_function\Unit1.pas

Count=1

EditWindowCount=1

[D:\Projects\Delphi\sti\check_function\Unit1.pas]

ModuleType=SourceModule

FormState=1

FormOnTop=1

[C:\Program Files\Borland\Delphi7\Projects\ProjectGroup1.bpg]

FormState=0

FormOnTop=0

[D:\Projects\Delphi\sti\check_function\proverka.dpr]

FormState=0

FormOnTop=0

[EditWindow0]

ViewCount=1

CurrentView=0

View0=0

CodeExplorer=CodeExplorer@EditWindow0

MessageView=MessageView@EditWindow0

Create=1

Visible=1

State=2

Left=294

Top=140

Width=986

Height=505

MaxLeft=-4

MaxTop=108

MaxWidth=1288

MaxHeight=666

ClientWidth=1280

ClientHeight=632

LeftPanelSize=0

LeftPanelClients=CodeExplorer@EditWindow0

LeftPanelData=00000400010000000C000000436F64654578706C6F726572000000000000000000000000000000000001000000000000000000000000FFFFFFFF

RightPanelSize=0

BottomPanelSize=0

BottomPanelClients=MessageView@EditWindow0

BottomPanelData=00000400010000000B0000004D657373616765566965770005000000000000025500000000000000010000000000000000000000000100000000000500000B0000004D65737361676556696577FFFFFFFF

[View0]

Module=D:\Projects\Delphi\sti\check_function\Unit1.pas

CursorX=53

CursorY=106

TopLine=184

LeftCol=1

[Watches]

Count=0

[WatchWindow]

WatchColumnWidth=100

WatchShowColumnHeaders=1

Create=1

Visible=0

State=0

Left=0

Top=138

Width=265

Height=638

MaxLeft=-1

MaxTop=-1

ClientWidth=257

ClientHeight=612

TBDockHeight=612

LRDockWidth=257

Dockable=1

[Breakpoints]

Count=1

Breakpoint0='D:\Projects\Delphi\sti\check_goto\Unit1.pas',102,'',0,1,'',1,0,0,'',1,'','',''

[AddressBreakpoints]

Count=0

[Main Window]

Create=1

Visible=1

State=0

Left=0

Top=0

Width=1280

Height=112

MaxLeft=-1

MaxTop=-1

ClientWidth=1272

ClientHeight=78

[ProjectManager]

Create=1

Visible=0

State=0

Left=369

Top=372

Width=438

Height=303

MaxLeft=-1

MaxTop=-1

ClientWidth=430

ClientHeight=277

TBDockHeight=303

LRDockWidth=438

Dockable=1

[CPUWindow]

Create=1

Visible=0

State=0

Left=96

Top=114

Width=959

Height=635

MaxLeft=-1

MaxTop=-1

ClientWidth=951

ClientHeight=601

DumpPane=79

DisassemblyPane=187

RegisterPane=231

FlagPane=64

[AlignmentPalette]

Create=1

Visible=0

State=0

Left=200

Top=107

Width=156

Height=84

MaxLeft=-1

MaxTop=-1

ClientWidth=150

ClientHeight=60

[PropertyInspector]

Create=1

Visible=1

State=0

Left=9

Top=203

Width=274

Height=559

MaxLeft=-1

MaxTop=-1

ClientWidth=266

ClientHeight=533

TBDockHeight=429

LRDockWidth=190

Dockable=1

SplitPos=144

ArrangeBy=Name

SelectedItem=Caption

ExpandedItems=

HiddenCategories=

[ObjectTree]

Create=1

Visible=0

State=0

Left=958

Top=125

Width=190

Height=669

MaxLeft=-1

MaxTop=-1

ClientWidth=182

ClientHeight=643

TBDockHeight=290

LRDockWidth=190

Dockable=1

[CodeExplorer@EditWindow0]

Create=1

Visible=0

State=0

Left=0

Top=12

Width=140

Height=459

MaxLeft=-1

MaxTop=-1

ClientWidth=140

ClientHeight=459

TBDockHeight=305

LRDockWidth=140

Dockable=1

[MessageView@EditWindow0]

Create=1

Visible=0

State=0

Left=12

Top=0

Width=1268

Height=85

MaxLeft=-1

MaxTop=-1

ClientWidth=1268

ClientHeight=85

TBDockHeight=85

LRDockWidth=443

Dockable=1

[DockHosts]

DockHostCount=0

_ _ _ ____ ( @ _ _ _ 1______ ?33331_ _??3333_ 33333_ ?????? 33331 _DD ??? _FvvD ??1 Gggfv@ ??1_&vvggd ?1_wwgbvt ?1wwwr"gf@ _??1wwwr"vv@ ??3_wr""gf@ ??3_wr""&f@ ??_ww"w""@ _?1wr'""@ _?1?w""$ _??1rwr"_ ??3_'w"/? ??3_"ww$? _?__"" ? _?1 ? ??1 ?? ??3_ ???p ?31 ?? 3333;?31 ?? ?33333?3 ??? ?333???3 ?? ???????? ?????????? ???????????? ? ? _______

_ ?_ ? _ _ _ _ _ _ ? ? ? __~_>_ ?_ ?_ ? ? ? ?_ 0 _ M A I N I C O N ____ _ _ _ _ _ _ _

_# B;^ _- <pUnit1.pas1; rUnit1.dfm_u;_d_StdCtrlsC f_TMemo Mf_TButton7ef_TLabel-rg_.TMemoЮL0g_.TButton_x;Hg_.TLabel__cd_DialogsC f TOpenDialogg

.TOpenDialogp"g_TOpenDialog.GetFileNameǥcd_FormsC f_TForm_Ig_.TFormu$,g_TCustomForm.AlignControlsmgag_TCustomForm.CreateParamspgag_TCustomForm.CreateWindowHandleqgag_TCustomForm.CreateWndrgag_TCustomForm.DefinePropertiestgag_TCustomForm.DestroyWindowHandleugag_TCustomForm.DoCreatewgag_TCustomForm.DoDestroyxgag_TCustomForm.GetClientRect{gag_TCustomForm.GetFloating}gag_TCustomForm.Loadedgag_TCustomForm.Notificationgag_TCustomForm.PaintWindowgag_TCustomForm.QueryInterfacegag_TCustomForm.ReadStategag_TCustomForm.SetParentBiDiModegag_TCustomForm.SetParentgag_TCustomForm.UpdateActionsgag_TCustomForm.ValidateRenamegag_TCustomForm.WndProcgag_TCustomForm.Resizinggag_TCustomForm.Creategag_TCustomForm.CreateNewgag_TCustomForm.Destroygag_TCustomForm.AfterConstructiongag_TCustomForm.BeforeDestructiongag_TCustomForm.CloseQuerygag_TCustomForm.DefaultHandlergag_TCustomForm.SetFocusgag_TCustomForm.SetFocusedControlgag_TCustomForm.ShowModalgag_TCustomForm.WantChildKeygag%TScrollingWinControl.AdjustClientRect(_#g&TScrollingWinControl.AutoScrollEnabled(_#g%TScrollingWinControl.AutoScrollInView(_#g_TCustomForm.Closegacd_ControlsC g_TWinControl.AssignTo.g_TWinControl.CanAutoSize.g_TWinControl.CanResize.g_TWinControl.ConstrainedResize-.g_TWinControl.CreateHandle.g#TWinControl.CustomAlignInsertBefore.g_TWinControl.CustomAlignPosition.g_TWinControl.DestroyWnd.g_TWinControl.GetClientOrigin.g_TWinControl.GetControlExtents.g_TWinControl.GetDeviceContext.g_TWinControl.SetParentBackground.g_TWinControl.ShowControl.g_TWinControl.Invalidate_.g_TWinControl.Repaint_.g_TWinControl.SetBounds .g_TWinControl.Update

.g_TControl.GetAction6`)g_TControl.GetDragImages<`)g_TControl.GetEnabled=`)g!TControl.GetFloatingDockSiteClass?`)g_TControl.SetAutoSizeN`)g_TControl.SetDragModeO`)g_TControl.SetEnabledP`)g_TControl.SetNameQ`)g_TControl.SetBiDiModeU`)g_TControl.InitiateAction`)g_TControl.SetText`)g_TControl.GetTextʅ`)cd_GraphicsC g_TFont.SetColork_g_clRedZg_clBlackZcd_ClassesC g_TComponent.UpdateRegistryg_TComponent.WriteState'g_TComponent.SafeCallExceptiong_TPersistent.AssignN_`cd_VariantsC cd_SysUtilsC g_IntToStr_i5cd_MessagesC cd_WindowsC cd_SysInitC cd_SystemC f_TObject_g_TObject.DispatchG--g_TObject.NewInstanceG--g_TObject.FreeInstanceG--f_Integer

f

AnsiStringf_Stringg_@LStrClrѨ}g_@HandleFinallyEaf_BooleanW_~8gSetLength g_Pos g_@LStrPosEag_Break g_Delete g_Length g_@LStrLen__g @LStrDeleteEag_Continue g_Copy g@LStrCopyEag_Trueg_Falseg_Inc g_Exit g_@DynArraySetLengthEag_@LStrAsg4_g@LStrCatNEag_@LStrCatEag

@LStrArrayClrzYg_@FinalizeArrayBBg_@DynArrayClearxB)c4_Unit1iif@_c4_Windows c4_Messages c4_SysUtils c4_Variants c4_Classes c4_Graphics c4_Controls hc4_Forms _c4_Dialogs _c4_StdCtrls _c&_.TForm1> _ *_TForm1W

_)_ _Form1es1)_6 _msTypePositionaW,1_8 _msFunctionNameLV,_:*_.2_ _msFunctionKolParam*Ob_<*_.3_

iFunctionKol_

_>*_.4 '_msTypeB_ ( _ *_.5"'_msError_"Q ( _ _ _.6f$ (_TForm1.buOpenClickM_M ___&!_Self___!_Sender_

_c(_TForm1.buProverkaClickN_M !__&!_Selff_!_Sender_

_ _sFilef_

sFunctionNamef_ _sFunctionParamf_ _i___ _iKolf_ _j___ _iminPosf_ _iminNomf_ iKodErrorf_ iKolParam__

flagFunctionf_c(_TForm1.buCloseClickO_M

_&!_Self__ !_Sender_

_c(

FinalizationEa ! &c_(_Unit1 _!_&cG _ __F<_9_

A

5_z& ,_Memo1__ ,_buOpen__ ,

buProverka___

lbRezultat___

,_odFile__!

,_buClose__1

- buOpenClick_u__-_buProverkaClick___-

buCloseClick___cL ( _(_E<_I_*E<_Q_,L((Y__._L(0e__0_D _ $_ _P@ D _ $_

L _2_L _4_D _ $_

D _ $_

D _ $ PD _ $ Pl3L _ @_ _ _ __ _ _ _ _Memo1_ _ _buOpen _ _

buProverka__ _

lbRezultat__ _ _odFile

_ _ _buClose_ _ buOpenClick_ _buProverkaClick_

buCloseClick_TForm1_ _ __TForm1L ^ _Unit1 _ __.2_ H _Unit1_ __.3_ _ _Unit1_

_.4_ _ _ _ $ 4 D _ void _ int _ double _ char _ bool _

_.5_ _ _ 8 h % !!! % !!! " !!! * !!! # !!! ( !!! Uj S3Uh{ d0d __ _R<t@_ _ _RDU__ U_ _ _Qh3ҋ__ 3ZYYd_h E [Y]U j j IuQSVWE3Uh__ d0d UE_ _ _Q_} __ 3 3E @P _ _ _ @P _ _ _E_' } __ _ __' _NuE_ 3E_ E Eԋ U _; t__;E}__EuF_E__uЃ} _#_ E_ _ME_ U__ u_= __ E_ _ EPI_ E Eκ_ E_E ~+Eؾ_ ED0_,

r__,_r

_,_r_E FMu݀} _d_ _ @P _ _ _ @P _ _ _ _ _U _ 3ɉ

U(_ u

E_ EPI_ E Eκ_ U4_ t0 _ _Eκ_ U4_ uС _ < t_ _ _U@_ uE_ DEκ_ UL_ uE_ _Eκ_ } _p} t3E__ @h E_E__ l_ E__ @h3 E__ X_ ~HEؾ_ ŰE__ uh|_ 4Eк_ UЋ FMuUȋE__ EȺ_ Uȋ __ Eؾ_ UE_ _ _Q_ _U ء _ _ˍE_ _U 3E__ E _ _IE_ E8(teE__ @h UE__ uh_ 5_ h|_ 4Eĺ_ UċE__ _ U(_ ؅ueE__ @h UE__ uh_ 5_ h|_ 4E_ UE__ I_ EP˺_ E 3U4_ ؅t#GE˺_ U4_ ؅u݅t_G ;<teE__ @h UE__ uh_ 5_ h|_ 4E_ UE__ E˺_ _U ؅__UE__ uh_ 4h_ UE uh_ h_ E_ U FM_J3ZYYd_h

_ E E E_ _^[] _ ( _ ) _ , _ { _ } _ : _ _

_ (a, ) U3Uhq d0d _ uJ _ _ _ _ _ _ 3ZYYd_hx ]Ã- _me_ _5_ _5_ _9___5___5___5________P__R____V______N__j__(____4__6__<______D____:__J__n__l__p____z__0__~______2__'____-____@__>____F____________`__ __r__"__$__&__t__v__*__x__|__8______X__b__d__H__,__.__B__L__T__Z__\__^

_5__u_$__,__4____________9_ _9___5______I_ _I_______Q_ _Q_(___Y_ _Y_ ___]_ _a___a___a___a___a___a__e_ _e_ ___i_ _m___m___m___m___m___m___m___u___u_h__B_ __u___

____4__\_U___U___E___I_

___U___M___Q_

_<_A_H_]_

_A___n_]_

_$____

___U_N_____~_U_

_U___E___I_

___U___M___Q_

___E_

_U___

_M_

_U____

_L______

___M_

_U_$____

___M

_U___M_

_U____

_<____

_<_L___i___ 0____

_

_U_>____

_E_ ___ 2____

___

_U_X_E_____E___"_

_E___._E___$_<_"____

_i_

__

_E_ _"_ ___

_8_"____

_i_

__

_E_ _"_ 0____

_,____

_ _M_6_"____

_i_

__

_E_ _"_ (_

_E___:____

_E_________

______?.________

___?___f

_______q___i___

___

_]___

___

_M_

_Q_

___

_E_

_I_

______

______q_

__^1__,___"_D_T___H_._____

_>_>_____,___

_"_____

____

___B________

_(_____(<_

_>_>_,_ _______

_(______________"_____________________1___

_,_0_

_&_&_"v_

_T_*_._$_<_$_

_____>___,_?_

_____,_?_

_&___________

___,_?_

__$H__??_`___

_ _?__]_ ?__ __?NZ_ _ _9_ _ _9___ _9___ _9___ _9___ _9_

_ _9_

_ u_ __$"\9___ "_ __&$p9___ $?_ __(&E_9___ &=_ _ 6A_ _ 8E_ _ :M_ _ <U_ _ >]_ _ Di_ _ Fy_ _ _}_ _ \?_ _ ___?_ _ p_ _ t?_ _ t?_ _ t?_ _ v_ _ v_ _ v_ _ v?_ _ v?_ _ v?_ _ v_ _ x_ _ z__ _ E__ _ Y_??u_@_ __y_,_y____ p_?_M__?_

_?___?___?_i__?__?_U__?__?___?__?_-_?_??__?_y

?_

_?_

?_} _?_ ?_? _?_ ?_)

_?_9

?_]

_?_?

?___?__?_}___!___?______?_=_?_Q_______?____1__?_1___}_?_?_

_______M___?_?_?_?____-__?_-___i__?____?_1_?_@ _ _

_ __ a

__DELPHI.DIAGRAM.PORTFOLIO_ @___Untitled1_ _ _

object Form1: TForm1

Left = 320

Top = 139

Width = 520

Height = 572

Caption = #1055#1088#1086#1074#1077#1088#1082#1072' '#1086#1073#1098#1103#1074#1083#1077#1085#1080#1103' '#1080' '#1080#1089#1087#1086#1083#1100#1079#1086#1074#1072#1085#1080#1103' '#1092#1091#1085#1082#1094#1080#1081

Color = clBtnFace

Font.Charset = DEFAULT_CHARSET

Font.Color = clWindowText

Font.Height = -11

Font.Name = 'MS Sans Serif'

Font.Style = []

OldCreateOrder = False

PixelsPerInch = 96

TextHeight = 13

object lbRezultat: TLabel

Left = 154

Top = 464

Width = 52

Height = 13

Caption = #1056#1077#1079#1091#1083#1100#1090#1072#1090

end

object Memo1: TMemo

Left = 8

Top = 8

Width = 497

Height = 393

ScrollBars = ssBoth

TabOrder = 0

end

object buOpen: TButton

Left = 8

Top = 408

Width = 137

Height = 33

Caption = #1054#1090#1082#1088#1099#1090#1100' '#1092#1072#1081#1083

TabOrder = 1

OnClick = buOpenClick

end

object buProverka: TButton

Left = 8

Top = 448

Width = 137

Height = 33

Caption = #1042#1099#1087#1086#1083#1085#1080#1090#1100' '#1087#1088#1086#1074#1077#1088#1082#1091

TabOrder = 2

OnClick = buProverkaClick

end

object buClose: TButton

Left = 8

Top = 496

Width = 137

Height = 33

Caption = #1042#1099#1093#1086#1076

TabOrder = 3

OnClick = buCloseClick

end

object odFile: TOpenDialog

Filter = 'C++ '#1092#1072#1081#1083'|*.cpp'

Left = 208

Top = 16

end

end

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;

type

TForm1 = class(TForm)

Memo1: TMemo;

buOpen: TButton;

buProverka: TButton;

lbRezultat: TLabel;

odFile: TOpenDialog;

buClose: TButton;

procedure buOpenClick(Sender: TObject);

procedure buProverkaClick(Sender: TObject);

procedure buCloseClick(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

msTypePosition: array [1..5]of integer;

msFunctionName: array of string;

msFunctionKolParam: array of integer;

iFunctionKol: integer;

const

msType: array [1..5] of string= ('void', 'int', 'double', 'char', 'bool');

msError: array[1..6]of string= ('!!! ',

'!!! ',

'!!! ',

'!!! ',

'!!! ',

'!!! ');

implementation

{$R *.dfm}

procedure TForm1.buOpenClick(Sender: TObject);

begin

if odFile.Execute then

begin

Memo1.Lines.Clear;

Memo1.Lines.LoadFromFile(odFile.FileName);

lbRezultat.Caption:= '';

end;

end;

procedure TForm1.buProverkaClick(Sender: TObject);

var

sFile, sFunctionName, sFunctionParam: string;

i, iKol, j, iminPos, iminNom, iKodError, iKolParam: integer;

flagFunction: boolean;

begin

sFile:= Memo1.Lines.Text;

if sFile<>'' then

begin

iFunctionKol:= 0;

iKodError:= 0;

SetLength(msFunctionName, iFunctionKol+1);

SetLength(msFunctionKolParam, iFunctionKol+1);

//

iminPos:= 10000;

while iminPos<>0 do

begin

for i:= 1 to 5 do msTypePosition[i]:= 10000;

iminPos:= 1000;

iminNom:= 0;

for i:= 1 to 5 do

begin

msTypePosition[i]:= pos(msType[i], sFile);

if (msTypePosition[i]<>0)and(msTypePosition[i]<iminPos) then

begin

iminPos:= msTypePosition[i];

iminNom:= i;

end;

end;

if iminNom=0 then break;

delete(sFile, 1, iminPos+ length(msType[iminNom]));

//

i:= pos('(', sFile);

if i=0 then

begin

if iFunctionKol=0 then

begin

iKodError:= 1;

Break;

end

else

Continue;

end;

sFunctionName:= copy(sFile, 1, i-1);

delete(sFile, 1, i);

flagFunction:= true;

for i:=1 to length(sFunctionName) do

if not(sFunctionName[i] in ['A'..'Z', 'a'..'z', '0'..'9'])then flagFunction:= false;

if not flagFunction then Continue; //

inc(iFunctionKol);

SetLength(msFunctionName, iFunctionKol+1);

SetLength(msFunctionKolParam, iFunctionKol+1);

msFunctionName[iFunctionKol]:= sFunctionName;

msFunctionKolParam[iFunctionKol]:= 0;

//

i:= pos(')', sFile);

if i=0 then

begin

iKodError:= 2;

Break;

end;

sFunctionParam:= copy(sFile, 1, i-1);

delete(sFile, 1, i);

i:= pos(',', sFunctionParam);

//

while i<>0 do

begin

msFunctionKolParam[iFunctionKol]:= msFunctionKolParam[iFunctionKol]+1;

delete(sFunctionParam, 1, i);

i:= pos(',', sFunctionParam);

end;

// 1

if msFunctionKolParam[iFunctionKol]<>0 then

msFunctionKolParam[iFunctionKol]:= msFunctionKolParam[iFunctionKol]+1;

//

i:= pos('{', sFile);

if i=0 then

begin

iKodError:= 3;

Break;

end;

delete(sFile, 1, i);

i:= pos('}', sFile);

if i=0 then

begin

iKodError:= 4;

Break;

end;

delete(sFile, 1, i)

end;

//

if iKodError<>0 then

begin

lbRezultat.Font.Color:= clRed;

lbRezultat.Caption:= msError[iKodError];

exit;

end;

lbRezultat.Font.Color:= clBlack;

lbRezultat.Caption:= ' : ';

for i:= 1 to iFunctionKol do

lbRezultat.Caption:= lbRezultat.Caption+' '+ msFunctionName[i];

lbRezultat.Caption:= lbRezultat.Caption+#13;

//

for i:= 1 to iFunctionKol do

begin

sFile:= Memo1.Lines.Text;

j:= pos(msFunctionName[i], sFile);//

delete(sFile, 1, j+length(msFunctionName[i]));

j:= pos(msFunctionName[i], sFile);//

iKol:= 0;

while j<>0 do

begin

Inc(iKol);

delete(sFile, 1, j+length(msFunctionName[i])-1);

if sFile[1]<>'(' then

begin

lbRezultat.Font.Color:= clRed;

lbRezultat.Caption:= lbRezultat.Caption+#13+ msError[5]+' '+msFunctionName[i];

Exit;

end;

j:= pos(')', sFile);

if j=0 then

begin

lbRezultat.Font.Color:= clRed;

lbRezultat.Caption:= lbRezultat.Caption+#13+msError[5]+' '+msFunctionName[i];

Exit;

end;

sFunctionParam:= copy(sFile, 1, j);

iKolParam:= 0;

j:= pos(',', sFunctionParam);

while j<>0 do

begin

Inc(iKolParam);

delete(sFunctionParam, 1, j);

j:= pos(',', sFunctionParam);

end;

if iKolParam<>0 then iKolParam:= iKolParam+1;// ,

if iKolParam<> msFunctionKolParam[i] then

begin

lbRezultat.Font.Color:= clRed;

lbRezultat.Caption:= lbRezultat.Caption+#13+msError[6]+' '+msFunctionName[i];

Exit;

end;

delete(sFile, 1, j);

j:= pos(msFunctionName[i], sFile);//

end;

lbRezultat.Caption:= lbRezultat.Caption+' '+ msFunctionName[i]+ ' '+

IntToStr(iKol)+' (a, )'+#13;

end;

end;

end;

procedure TForm1.buCloseClick(Sender: TObject);

begin

Close;

end;

end.


  • . Object Pascal - Borland DELPHI 6.0 Windows XP.

    [493,8 K], 12.05.2013

  • Borland Pascal, 8-10 . , , , , .

    [389,3 K], 19.09.2010

  • Free Pascal , Borland Pascal Object Pascal - Delphi, . , .

    [4,2 M], 13.12.2011

  • goto.cpp., MSDN . , , .

    [499,8 K], 10.11.2009

  • Object Pascal Borland Delphi 7. .

    [1,8 M], 28.03.2013

  • Borland Delphi 7 , , : , . Delphi.

    [3,6 M], 18.10.2012

  • Pascal. . " Delphi". Object Pascal.

    [55,4 K], 08.12.2010

  • "Borland Software Corporation". Turbo-Pascal, Delphi, CaliberRM, Turbo C++ . Windows. -.

    [20,9 K], 02.04.2010

  • . Pascal Turbo Pascal Object Pascal Delphi. , , , . .

    [2,1 M], 02.05.2014

  • Borland Delphi 7.0. " ", "", " ", " ". , .

    [961,6 K], 21.04.2012

, , ..
PPT, PPTX PDF- .
.