WWW.DISSERS.RU


...
    !

Pages:     | 1 |   ...   | 16 | 17 || 19 | 20 |   ...   | 21 |

Oe, o oyx Display Error, x peoex uses paeax peaa ec cc x oye py a pya. a oy oy ccac py a pya paeax peaa, ooy o aca oe opoa ooc epece pae oox oye. py coa, oop aca oycae ccy a aco oopoa oy A paea peaa oy B, ocoy epece pae oye A B e ac py o pya ( ceoaeo, cooecy cpo paa aca opa oe).

Pa e e e p y x o e peoo, eoxoo opoa popa WriteXY ShowError a, o oa ooe apaep, oop aae poyooe oo a pae:

procedure writeXY(SomeWindow:Wind Rec;

X, Y : integer;

Message : string);

procedure ShowError (SomeWindow : WindRec;

ErrMsg : string);

Bco, o poeyp axoc pax oyx. ae ec o oy WindData paee epeca ooo oy, o o oee e ye ocyo paee epeca pyoo oy.

ye o pe oy, oop coco ox oe ac oa:

unit WindData;

interface type WinDRec = record X1, Y1, X2, Y2 : integer;

TextColor, BackColor : byte;

Active : boolean;

end;

implementation {ec ocycye ce peaa} end;

Ceac epece pae oox oye Display Error oy e WindData. o oyco, ooy o oye WindData e peoe uses, a oy Display Error e cc py a pya paee implementation (peaa). Bce oae oe oea oe oy.

Co a e c o c e x o y e yc oy IntLib, oee a INTLIB.PAS oopoa; peya o a INTLIB.TPU. oo, o oo o eo cooa popae, eo eoxoo oca oepaope uses.

Ta opao popaa ye e:

program MyProg;

uses IntLib;

aca peoaae, o a, oopo axoc oy, ee aoe e (o 8 coo), o oy. Ec oy MyUtilities, o aca e a c ee MYUTILIT.PAS.

o o y e Moy opyec ae a popaa: coaec p oo peaopa, oao Alt-F9.

Ho, eco aa c pacpee.EXE, coaec a c pacpee.TPU (oy aca). Moo oca o a a oo a. Moo oec eo TURBO.TPL p oo TPUMOVER.EXE.

B o cyae, oo oec a.TPU cpao oye, oop aaec oe oa Unit Directories (Options/Directories). Ta opao, oo ccac a a, oa o e axoc eye cpaoe TURBO.TPL.

Moo e oo o oy cxooo aa; o ocaaaec, oa ocaec oce oepaop end.

o a oy, yaa oepaope uses, oop aae pocapae peee oy oy, apyee a o pe ayca oopa aca TURBO.TPL. Ec oo oy e cpe peex, oop cae, o o oe a ce. O aae e eye peop, a ae peop, aao oao O/D/Unit Directories peo /U oao cpoe TPC. Hapep, ocpy uses Memory;

e Memory e pee oy, acae oopy ca MEMORY.TPU eye peop, a ae ao peop oye.

oa oa Compile/Make Compile/Build opy oy, aae oepaope uses, cxoe a yc a e, a .TPU a cxooo aa oy paec o e, o oy c pacpee.PAS.

pep:

Paccop eoo oy o aae IntLib, coco yx pocx popa: poeypa ISwap y IMax:

unit IntLib;

interface procedure ISwap (var I, J : integer);

function IMax (I, J : integer) : integer;

implementation procedure ISwap;

var Temp : integer;

begin Temp := I; I := J; J := Temp;

end; {of proc ISwap} procedure IMax;

begin if I > J then IMax := I else IMax := J;

end;{y IMax} end.{oy IntLib} Tec oy axoc ae INTLIB.PAS. oce o peypy o oeaec a INIT.TPU, a ae peop oye, ec o ec, ocaec o e peop, e axoc popaa.

Ceya popaa coye oy IntLib:

program IntTest;

uses IntLib;

var A, B : integer;

begin Write ('Bee e epeee eoo a : ');

Readln (A, B);

ISwap (A, B);

Writeln ('A= ', A, 'B= ', B);

Writeln ('Macaa x ', IMax (A, B);

end. {popa IntTest} B pepe oaao a coa oy coyy eo popay.

Mo y o e p o p a Oo oa popaa ec a oy, oope coco poeyp y, cpypoax o aae. Hapep, popa peaopa oo pae a aa, o, ee ac aa, opapoae .. Ta e oe oa oy oy coye ce py oy, a a e ao popao o opeee oae oca, ax, epeee, poeyp y. Cxea oo popa:

program Editor uses DOS,Crt,Printer {caape oy TURBO.TPL} EditGlobals, {oy, acae ooaee} EditInit, EditPrint, EditRead, EditWrite, EditFormat;

{oe popa, poeyp y} begin {aa popaa} end.{popa Editor} Moy o popa oy axoc TURBO.TPL cyecoa a oee.TPU a. B ocee cyae Turbo Pascal ye ypa poeo. o a, o p epeo popa Editor, Turbo Pascal, poep ay ao.PAS .TPU, epeopye oo e oy a, oope opoa.

Op a a p o p a Turbo Pascal epc 7.0 ooe pae popay a ooe cee. aa popaa oce o aae cee. o a, o oa e oe aa a oe 64 .

Oao, eec oooc ye o epx pee, pa Bay popay a oy. a oy oe coepa o 64 ax oo p o.

oo oo oe ce oae opeee oca, ax, epeee o oy. Eo oo aa MyGlobals. B oe o aex ao, oy e oy "e" e opeee, ceae ao popae; o "" oo o, o opeeeo epeco ac x coceoo oy pyx oyx, coyex . ooy oy oe cooa MyGlobals opaac o ce oa oe.

Bopo oo oy MyUtils. B oopo oo copa opopa, coyee popae.

ec o copa opopa, oope e ac o ax-o pyx opopa.

poe oo, oo oe poeyp y oece py. B ao pye oo opee ecoo poeyp y, oope aoee aco coyc popao ae poeyp y, oope coyc ecoo pee. Paee oo popa a oy oe pooc peeo oceoaeoc:

1 Copye ce poeyp y oe a yae x ao popa.

2 Opoe o a peapoa.

3 Haepe ceye cpo epe poeypa y:

unit oy;

intarface uses MyGlobals implementation, E M MO M BAEO MO (TAE M PEATPEMOO AA).

4 Haepe oepaop end, oe aa.

5 Mey interface implementation copye aoo poeyp y, aex ao popa. aooo o epa cpoa opopa ece co coa procedure function.

6 Ec o oy coye pye oy, pee x ea epe ay peoe Uses.

7 Oopye o a.

8 Bepec Bay ay popay oae oo oy peoee Uses.

Cp e c a B u i l d M a k e Turbo Pascal ae ce oe aoe oe yoe cpeco ypae poeo cpoey yy Make. Paccop ee aaee oyc eec popaa MAIN.PAS, oopa coye epe oy: A, B, C, D. epe oy epe ecox aa A.PAS, B.PAS, C. PAS, D.PAS. aee B coye A, a C D coy A D (pc. 19).

MAIN A B C D Pc. 19 Cxea aoec oye p o MAIN.PAS oop e a A.TPU, B.TPU, C.TPU D.TPU, apyae x a, copae x o a MAIN.PAS, opye acae eo a MAIN.EXE (ec opyec a c).

oyc, o occ ee C.PAS. Teep coa MAIN.EXE eoxoo epeopoa C.PAS MAIN.PAS. o eoo cya, o e coa aaa.

oyc, ee ece ce epeca A.PAS. coa oo epc MAIN.EXE eoxoo epeopoa ye ce epe oy ca MAIN.PAS. o oaae, o p ao ee oye A.PAS, peyec epeo cex oye.

M a k e Turbo Pascal peaae peee o poe: oo cooa o Make e Compile Turbo Pascal o c paoy. poecc oe poco: oce ece ee ao-o oy ay popay epeopoa ao oo ay popay.

Turbo Pascal ocyece p a poepo:

1 Bo-epx, poepa a pee aoo oy, coyeoo popao. aa cepec y ao c pacpe.PAS .TPU. Ec a (.PAS) occ ee c ex op, a coa cooecy.TPU, o o a.PAS epeopyec aoo, coaa ooe a.TPU. ooy epo pepe, oa ee occ C.PAS, Turbo Pascal aoaec oopye C.PAS epe oe MAIN.PAS (p yco cooa o Make).

2 Bopa poepa: ece ee ce epeca opyeoo oy. Ec o eo eco, o Turbo Pascal aoo o opye ce oy, coye a oy.

Bo opo pepe ee ece pae epeca A.PAS, oy MAIN.PAS opyec aoo.

Turbo Pascal epe oe MAIN.PAS aoaec epeopye A. PAS, B.PAS, C.PAS, D.PAS ( ocao uses ope). Oao, ec opoa oo pae peaa, o epeo pyx acx oye e peyec, ocoy (c x o pe) e ec o oy.

3 Tpe poepa acaec aex .OBJ ao, coepax opopa a Acceepe, coyex a-o oye. Ec a a.TPU coa pae, e ao-y a ae .OBJ, c oop o copaec, o cooecy oy opyec aoo. Ta opao, ec ece ee opopaax, acax a Acceepe, coyee oye, o oy aoaec epeopyec, oa opyec popaa, coya o oy.

cooa o Make ao pa oay Make e Compile aa F9. p paoe c oopo oao cpo yaa o /M. O Make e oecye a oy, axoec TURBO.TPL.

B u i l d O Build o ac cya Make. p cooa Build epeopyc ce oy, coyee ao popao, ca oy oe TURBO.TPL. o oee poco ae coco, o ce ye ooeo.

oa Build oao cpo coyec o /B.

Aooa ya Make o popaa, ocaea c Turbo Pascal.

Turbo Pascal peaae oo aop ox cpec ypae coa ox cox popa, ocpoex oocex oye, cxox oex ao. Ccea peaae aoaecoe oee oepa Make Build, epeopy oy cyae eoxooc. Bo e pe, Turbo Pascal e ee cpec oye ooex.OBJ ao (ao oex oo) opopa, acax a e Acceepa (.ASM ao), cyae oa ocex. oo eoxoo cooa oe Acceep. Bopoc: a oy ocee epc ao c pacpe.ASM .OBJ a x oa popaa Oe poc. coyec aooa ya Make, oopa ocaec ece c cceo Turbo Pascal.

Make eeya popa acpaop, oop p aa opeeex oa, o eoxoy paoy o coxpae ooe popa. Ha cao ee oooc y Make aeo pe. Bee yoae oooc xo:

coae peepx o;

yaee ao pax opeop;

aoaec ayc popa c ecee ee coyee a ax.

o epe ye cooa y Make, oo ye pye oooc coco pee o y papao popaoo oecee.

Make aooa ya; oa oaec o o Make Build, oope e IDE oop oao cpo Heoo pep:

oyc, ao aca ecoo popa, ox a ce eoopy opa o ax ex cceax. Oa popaa GETSTAR.PAS cae eco a cco ex cce, opaaae eo coae o a o opa.

GETSTAR.PAS coye p oy: STARDEFS.TPU, oop coep oae opeee;

STARLIB.TPU, coepa eoope y (cooaee opopa); STARPROC.TPU, oop eae ocoy opaoy opa. cxoe o x axoc, cooeceo, aax: STARDEFS.PAS, STARLIB.PAS, STARPROC.PAS. Opee ceye acoc:

STARDEFS.PAS e coye ax pyx oye;

STARLIB.PAS coye STARDEFS;

STARPROC.PAS coye STARDEFS STARLIB;

GETSTAR.PAS coye STARDEFS, STARLIB STARPROC.

oye GETSTAR.EXE eoxoo poco "cea" (oopoa) GETSTAR.PAS. Turbo Pascal ye epeopoa oy o eoxooc.

oyc, ec ecoo opopa STARLIB.PAS acax a Acceepe ao SLIB1.ASM SLIB2.ASM. oce pao Turbo Assembler oyae a SLIB1.OBJ SLIB2.OBJ. a pa STARLIB.PAS p o ooyec c oo.OBJ aa. aec, Turbo Pascal aoo epeopye STARLIB.PAS, ec a STARLIB.TPU coa pae, e ao-o x.OBJ ao.

Pages:     | 1 |   ...   | 16 | 17 || 19 | 20 |   ...   | 21 |



2011 www.dissers.ru -

, .
, , , , 1-2 .