Смекни!
smekni.com

Разработка программы на языке Borland Object Pascal (Ide Borland Delphi) (стр. 2 из 2)

Рис.5 – Проверка файла


ПЕРЕЧЕНЬ ССЫЛОК

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.


ПРИЛОЖЕНИЯ

Приложение А

int i, j;

for(i = 0; i < 10; i++)

{

// ...

if(condition1)

{

j = 4;

goto label1;

}

// ...

for(j = 0; j < 10; j++)

{

// ...

label1:

// ...

if(condition2)

{

i = 6;

goto label2;

}

}


Приложение Б

-$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:&bsol;program files&bsol;borland&bsol;delphi7&bsol;Projects&bsol;Bpl"

-LN"c:&bsol;program files&bsol;borland&bsol;delphi7&bsol;Projects&bsol;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:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;UData.pas',0,1,545,15,558,1,0

File_1=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;UTablNU.pas',0,1,681,50,698,1,0

File_2=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;UMain.pas',0,1,148,31,155,1,0

File_3=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;UPerson.pas',0,1,99,34,116,1,0

File_4=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;UFunction.pas',0,1,479,1,492,0,0

File_5=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;UEtalon.pas',0,1,800,40,825,0,0

File_6=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;UCreateAllReport.pas',0,1,406,51,407,0,0

File_7=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;USprNa.pas',0,1,1,17,9,1,0

File_8=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;USprUd.pas',0,1,305,1,308,1,0

File_9=SourceModule,'D:&bsol;Projects&bsol;Delphi Studio&bsol;SKSMiK&bsol;ZarPlata&bsol;units&bsol;USprOtdel.pas',0,1,1,1,1,1,0

[Modules]

Module0=D:&bsol;Projects&bsol;Delphi&bsol;sti&bsol;check_goto&bsol;Unit1.pas

Count=1

EditWindowCount=1

[D:&bsol;Projects&bsol;Delphi&bsol;sti&bsol;check_goto&bsol;Unit1.pas]

ModuleType=SourceModule

FormState=1

FormOnTop=0

[C:&bsol;Program Files&bsol;Borland&bsol;Delphi7&bsol;Projects&bsol;ProjectGroup1.bpg]

FormState=0

FormOnTop=0

[D:&bsol;Projects&bsol;Delphi&bsol;sti&bsol;check_goto&bsol;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=868

Height=505

MaxLeft=-4

MaxTop=108

MaxWidth=1288

MaxHeight=666

ClientWidth=1280

ClientHeight=632

LeftPanelSize=0

LeftPanelClients=CodeExplorer@EditWindow0

LeftPanelData=00000400010000000C000000436F64654578706C6F72657200000000000000000000000000000000000100000000000000000C000000436F64654578706C6F726572FFFFFFFF

RightPanelSize=0

BottomPanelSize=0

BottomPanelClients=MessageView@EditWindow0

BottomPanelData=00000400010000000B0000004D657373616765566965770000000000000000000000000000000000FFFFFFFF

[View0]

Module=D:&bsol;Projects&bsol;Delphi&bsol;sti&bsol;check_goto&bsol;Unit1.pas

CursorX=13

CursorY=57

TopLine=64

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=0

[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=Name

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=-100

Top=-534

Width=443

Height=85

MaxLeft=-1

MaxTop=-1

ClientWidth=443

ClientHeight=85

TBDockHeight=85

LRDockWidth=443

Dockable=1

[DockHosts]

DockHostCount=0


Приложение К

object Form1: TForm1

Left = 320

Top = 139

Width = 520

Height = 500

Caption = #1055#1088#1086#1074#1077#1088#1082#1072' Goto'

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 = 210

Top = 424

Width = 52

Height = 13

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

end

object Memo1: TMemo

Left = 8

Top = 48

Width = 497

Height = 353

ScrollBars = ssBoth

TabOrder = 0

end

object buOpen: TButton

Left = 16

Top = 8

Width = 169

Height = 33

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

TabOrder = 1

OnClick = buOpenClick

end

object buProverka: TButton

Left = 16

Top = 416

Width = 185

Height = 33

Caption = #1055#1088#1086#1074#1077#1088#1082#1072' Goto'

TabOrder = 2

OnClick = buProverkaClick

end

object buClose: TButton

Left = 365

Top = 8

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;

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, sLabelName: string;

i, iKol, j: integer;

begin

sFile:= Memo1.Lines.Text;

if sFile<>'' then

begin

iKol:= 0;

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

while i<>0 do

begin

delete(sFile, 1, i+4);

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

j:= pos(#13, sFile);

if ((j<>0)and(j<i))or(i=0) then

begin

lbRezultat.Caption:= 'Ошибка: Отсутсвует ;';

lbRezultat.Font.Color:= clRed;

Exit;

end;

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

if not (sLabelName[1] in ['A'..'Z', 'a'..'z'])then

begin

lbRezultat.Caption:= 'Ошибка: Неверное имя метки '+ sLabelName;

lbRezultat.Font.Color:= clRed;

Exit;

end;

for i:= 2 to length(sLabelName) do

if not(sLabelName[i] in ['0'..'9', 'A'..'Z', 'a'..'z']) then

begin

lbRezultat.Caption:= 'Ошибка: Неверное имя метки '+ sLabelName;

lbRezultat.Font.Color:= clRed;

Exit;

end;

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

if i=0 then

begin

lbRezultat.Caption:= 'Ошибка: Отсутствует переход на метку '+ sLabelName;

lbRezultat.Font.Color:= clRed;

Exit;

end;

inc(iKol);

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

end;

if lbRezultat.Caption='' then

begin

lbRezultat.Caption:= 'Правильное задание '+ IntToStr(iKol)+ ' инструкций безусловного перехода';

lbRezultat.Font.Color:= clNavy;

end;

end;

end;

procedure TForm1.buCloseClick(Sender: TObject);

begin

Close;

end;

end.