home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG043.ARC
/
LABMAK.IN1
< prev
next >
Wrap
Text File
|
1979-12-31
|
18KB
|
553 lines
Procedure Start;
Var i:integer;
j:integer;
Begin
For i:=1 to Maxlines do For j:=1 to MaxCharComp do Text[i,j]:=Space;
For i:=1 to MaxLines do
Begin
LineInit[i,1]:=Null;
LineInit[i,2]:=Null;
Italic[i]:=False;
Under[i]:=False;
MaxChars[i]:=0;
End;
End;
Procedure RemovePrev;
Var i,
j :integer;
Begin
For i:=5 to 11 do
Begin
Gotoxy(10,i);
For j:=1 to 68 do Write (Space);
End
End;
procedure EnterCharSize;
Var SizeNum : char;
Begin
RemovePrev;
gotoxy(10,5);
write ('Enter character size for line number ',LineNumber);
Gotoxy(10,8);
Write('Select option, <RETURN> for normal, or <ESC> to exit ');
Gotoxy(50,5);
Write ('1) Normal');
gotoxy(50,6);
Write ('2) Enlarged');
gotoxy(50,7);
Write ('3) Condensed');
repeat
Read(kbd,SizeNum);
SizeNum:=UpCase(SizeNum);
until (SizeNum in ['1','2','3','N','E','C']) or (SizeNum=CR) or (SizeNum=Esc);
If SizeNum=Esc then
Begin
Aborted:=True;
Exit;
End;
if SizeNum=cr then SizeNum:='1';
case SizeNum of
'1','N':Begin
LineInit[LineNumber,1]:=Null;{No action taken}
Gotoxy(65,LineNumber+16);
Write('Norm');
MaxChars[LineNumber]:=MaxCharNorm
End;
'2','E':Begin
LineInit[LineNumber,1]:=Enlgd;
MaxChars[LineNumber]:=MaxCharEnlgd;
Gotoxy(65,LineNumber+16);
Write ('Enlg')
End;
'3','C':Begin
LineInit[LineNumber,1]:=Comp;
MaxChars[LineNumber]:=MaxCharComp;
Gotoxy(65,LineNumber+16);
Write('Comp')
End
end {case};
For i:=MaxChars[LineNumber] to MaxCharComp do Text[LineNumber,i]:=Space;
End;
Procedure EnterCharStyle;
Var StyleNum: Char;
Begin
RemovePrev;
Gotoxy(10,5);
Write('Enter print style for line number ',LineNumber);
Gotoxy(10,8);
Write('Select option, or <RETURN> for normal');
Gotoxy(50,5);
Write ('1) Normal');
gotoxy(50,6);
Write('2) Bold');
if (LineInit[LineNumber,1]<>Comp) then
Begin
gotoxy(50,7);
Write('3) Emphasized')
End;
Repeat
Read(kbd,StyleNum)
Until ((StyleNum in ['1','2']) or ((LineInit[LineNumber,1]<>Comp)and (StyleNum='3'))or (ord(StyleNum)=13));
if ord(StyleNum)=13 then StyleNum:='1';
Case StyleNum of
'1': Begin
LineInit[LineNumber,2]:=Null;
Gotoxy(70,LineNumber+16);
Write(' ')
End;
'2': Begin
LineInit[LineNumber,2]:=Bold;
Gotoxy(70,LineNumber+16);
Write('Bold')
End;
'3': Begin
LineInit[LineNumber,2]:=Emph;
Gotoxy(70,LineNumber+16);
Write('Emph')
End;
End {Case}
End;
Procedure EnterSpecFeat;
Var SpecNum:Char;
Begin
Italic[LineNumber]:=False;
Under[LineNumber]:=False;
RemovePrev;
SpecNum:=' ';
gotoxy(10,5);
Write('Enter special printing feature');
gotoxy(10,8);
Write('Select either, both or <RETURN> for none');
gotoxy(50,5);
Write('1) Italics');
gotoxy(50,6);
Write('2) Underline');
While Ord(SpecNum)<>13 do
Begin
Repeat
Read(Kbd,SpecNum);
Until ((SpecNum in ['1','2','i','I','U','u']) or (ord(SpecNum)=13));
Case SpecNum of
'1','I','i':Begin
Italic[LineNumber]:=Not(Italic[LineNumber]);
Gotoxy(50,5);
If Italic[LineNumber] then
LowVideo;
Write('1) Italics');
NormVideo;
End; {1}
'2','U','u':Begin
Under[LineNumber]:=Not(Under[LineNumber]);
Gotoxy(50,6);
If Under[LineNumber] then
LowVideo;
Write('2) Underline');
NormVideo;
End {1}
End; {Case}
End; {While}
if (Italic[LineNumber]) then
Begin
Gotoxy(75,LineNumber+16);
Write('I')
End; {if}
If (Under[LineNumber]) then
Begin
Gotoxy(77,LineNumber+16);
Write('U')
End {if}
End {Procedure};
Procedure RightJust (NumChars:Integer);
Var i:Integer;
Begin
NumChars:=NumChars-1;
gotoxy(5,LineNumber+16);
for i:=1 to MaxChars[LineNumber] do Write(Space);
For i:= NumChars Downto 1 do Text[LineNumber,MaxChars[LineNumber]-NumChars+i]:= Text[LineNumber,i];
For i:= MaxChars[LineNumber]-NumChars downto 1 do Text[LineNumber,i]:=space;
Gotoxy(5,LineNumber+16);
For i:= 1 to MaxChars[LineNumber] do Write(Text[LineNumber,i]);
End;
Procedure LeftJust;
Var i,
Last : integer;
Begin
Last:=0;
For i:=1 to MaxChars[LineNumber] do If Text[LineNumber,i]<>Space then Last:=i;
If Last<>0 then
While (Text[LineNumber,1]=Space) do
Begin
For i:=2 to MaxChars[LineNumber] do Text[LineNumber,i-1]:=Text[LineNumber,i];
Text[LineNumber,MaxChars[LineNumber]]:=Space;
gotoxy(5,LineNumber+16);
For i:=1 to MaxChars[LineNumber] do Write (Text[LineNumber,i]);
Gob;
Delay(50);
End;
End;
Procedure Centre;
Var i,
j,
Last :Integer;
Begin
j:=0;
While (j<=MaxChars[LineNumber]) and (Text[LineNumber,1]=Space) do
Begin
For i:=2 to MaxChars[LineNumber] do Text[LineNumber,i-1]:=Text[LineNumber,i];
Text[LineNumber,MaxChars[LineNumber]]:=Space;
j:=Succ(j);
End;
Last:=0;
For i:=1 to MaxChars[LineNumber] do If Text[LineNumber,i]<>Space then Last:=i;
If Last<>0 then
For i:=1 to (MaxChars[LineNumber] div 2)-(Last div 2) do
Begin
For j:=MaxChars[LineNumber] downto 2 do Text[LineNumber,j]:=Text[LineNumber,j-1];
Text[LineNumber,1]:=Space;
Gob;
gotoxy(5,LineNumber+16);
For j:= 1 to MaxChars[LineNumber] do Write(Text[LineNumber,j]);
End;
End;
Procedure EnterText(Editing : Boolean);
Type WorkString = String[255];
Const
Inon : String[2]=#27#41;
InOff : String[2]=#27#40;
Var CharNum:Integer {Pointer for entered character};
TempChar:Char;
EndChar : Integer;
I,
Last : Integer;
Function EditString (StringOp : WorkString ;
MaxChars,x,y : integer) : WorkString;
Var
LetterFound,
SpaceFound,
Next,
Completed : Boolean;
i,
CharNum : Integer;
Chr : Char;
Begin
Abort := False;
Next:=False;
CharNum:=Length(StringOp)+1;
{If Length(StringOp)=MaxChars then CharNum:=Pred(CharNum);}
For i:=Length(StringOp)+1 to MaxChars do StringOp[i]:=Space;
StringOp[0]:=Char(MaxChars);
Repeat
Gotoxy(x,y);
For i:=1 to MaxChars do Write (StringOp[i]);
Gotoxy(x+CharNum-1,y);
Repeat
Read (Kbd,Chr);
Until (Chr in [' '..'~',^E,^X,^A,^S,^D,^F,^G,^T,^Y,BS,Del,cr,Esc]);
If Chr = ^E then Chr := Esc;
If Chr = ^X then Chr := CR;
Case Chr of
Esc : Abort:=True;
' '..'~' : Begin
If (StringOp[MaxChars]<>Space) or (CharNum>MaxChars) then
Begin
Write (^G);
End
Else
Begin
Insert (Chr,StringOp,CharNum);
CharNum:=Succ(CharNum);
End;
End;
^A : Begin
i:=CharNum;
LetterFound:=False;
SpaceFound:=False;
Completed:=False;
Repeat
I:=i-1;
If (StringOp[i] in ['!'..'~']) then LetterFound:=True;
If (LetterFound and (StringOp[i]=Space)) or (i=0) then
Begin
CharNum:=i+1;
Completed:=True;
End;
Until Completed;
End;
^S : If CharNum<>1 then CharNum:=Pred(CharNum);
^D : If CharNum<>MaxChars then CharNum:=Succ(CharNum);
^F : If CharNum<>MaxChars then
Begin
i:=CharNum;
SpaceFound:=False;
Completed:=False ;
Repeat
I:=I+1;
If StringOp[i] =Space then SpaceFound:=True;
If (SpaceFound and (StringOp[i] in ['!'..'~'] )) or (i=MaxChars) then
Begin
CharNum:=i;
Completed:=True;
End;
Until Completed;
End;
BS : Begin
LetterFound:=False;
For i:=CharNum to MaxChars do If StringOp[i] in ['!'..'~'] then LetterFound:=True;
If LetterFound then
Begin
If CharNum<>1 then CharNum:=Pred(CharNum);
End
Else
Begin
If CharNum<> 1 then
Begin
CharNum:=Pred(CharNum);
Delete(StringOp,CharNum,1);
StringOp[MaxChars]:=Space;
StringOp[0]:=Succ(StringOp[0]);
End;
End;
End;
^G : Begin
Delete(StringOp,CharNum,1);
StringOp[MaxChars]:=Space;
StringOp[0]:=Succ(StringOp[0]);
End;
Del : Begin
If CharNum<> 1 then
Begin
CharNum:=Pred(CharNum);
Delete(StringOp,CharNum,1);
StringOp[MaxChars]:=Space;
StringOp[0]:=Succ(StringOp[0]);
End;
End;
^Y : Begin
CharNum:=1;
For i:=1 to MaxChars do StringOp[i]:=Space;
StringOp[0]:=Char(MaxChars);
End;
^T : Begin
While Stringop[CharNum] in ['!'..'~'] do
Begin
Delete(StringOp,CharNum,1);
Insert(Space,StringOP,MaxChars);
End;
i:=CharNum;
While (Stringop[CharNum]=Space) and (i<=MaxChars) do
Begin
Delete(Stringop,CharNum,1);
Insert(Space,StringOp,MaxChars);
i:=Succ(i);
End;
End;
End;{Case}
Until (Chr=CR) or (Chr=Esc) ;
i:=MaxChars+1;
Repeat
i:=Pred(i);
Until (i=0) or (StringOp[i]<>Space);
StringOp[0]:=Char(i);
EditString:=StringOP;
End;{Proc}
Begin
EndChar:=10+MaxChars[LineNumber];
RemovePrev;
gotoxy(10,5);
Write('Enter text for line number ',LineNumber);
gotoxy(10,8);
Write('Maximum of ',MaxChars[LineNumber],' characters');
Gotoxy(2,9);
Write (' ',InOn,'^A',InOff,' Word left, ',inon,'^S',inoff,' Char left, ',inon,'^D',inoff,
' Char right, ',inon,'^F',inoff,' Word right, ',inon,'^G',inoff,' Gobble char');
Gotoxy(2,10);
Write (' ',inon,'^T',inoff,' Delete word, ',inon,'^Y',
inoff,' Delete entire text, ',inon,'Del',inoff,' Delete char left ');
Gotoxy(EndChar,6);
Write('<');
Gotoxy(10,6);
Last:=0;
For i:=1 to MaxChars[LineNumber] do If Text[LIneNumber,i]<>Space then Last:=i;
If Last=0 then EditingString:=''
Else
Begin
For i:=1 to Last do EditingString[i]:=Text[LineNumber,i];
EditingString[0]:=Char(Last);
End;
EditingString:=EditString(EditingString,MaxChars[LineNumber],10,6);
For i:=1 to MaxChars[LineNumber] do
Begin
If i<=Length(EditingString) then Text[LineNumber,i]:=EditingString[i]
Else Text[LineNumber,i]:=Space;
End;
CharNum:=Succ(Length(EditingString));
Gotoxy(5,LineNumber+16);
for i:=1 to MaxChars[LineNumber] do
Write(Text[LineNumber,i]);
For i:=MaxChars[LineNumber] to MaxCharComp do Write (Space);
Gotoxy(5+MaxChars[LineNumber],LineNumber+16);
LowVideo;
Write('<');
NormVideo;
RemovePrev;
Gotoxy(2,9);
Write(' ');
Gotoxy(10,5);
Write ('Do you want this text to be');
Gotoxy(50,5);
Write ('1) Left Justified');
Gotoxy(50,6);
Write ('2) Right Justified');
Gotoxy(50,7);
Write ('3) Centered');
gotoxy(10,8);
Write('Select option or <RETURN> for Left Justified');
Repeat
Read(Kbd,TempChar);
TempChar:=UpCase(TempChar);
Until (TempChar in ['1','2','3','L','R','C',CR]) ;
Case TempChar of
'1','L':LeftJust;
'2','R':RightJust (CharNum);
'3','C':Centre ;
End
End;
Procedure Edit;
Var Resp:Char;
Begin
Aborted:=False;
RemovePrev;
Gotoxy(10,5);
Write('Which line do you wish to edit?');
Repeat
Read (Kbd,Resp);
Until Resp in ['1'..Char(48+MaxLines),Char(Esc)];
If Resp<>Char(Esc) then
Begin
LineNumber:=Ord(Resp)-48;
EnterCharSize;
If Not Aborted then
Begin
EnterCharStyle;
EnterSpecFeat;
EnterText(True);
End
End; {if}
End; {Proc}
Procedure Print;
Var i,
No,
P,
j:integer;
Begin
RemovePrev;
Gotoxy(10,5);
Write ('How many labels ( or <RETURN> for 1 ) :');
No := Entervalue;
If No = -2 then No := 1;
Gotoxy(10,6);
Write ('Printing label');
For p := 1 to No do
Begin
For i:=1 to MaxLines do
Begin
for j:=1 to 2 do
Write (Lst,LineInit[i,j]);
if Italic[i] then
Begin
For j:=1 to MaxChars[i] do
Begin
if Under[i] then write(lst,Underline,#1);
if (Under[i]) and (Text[i,j]=Space) then Write (Lst,Underline,#0);
Write (Lst,Char(Ord(Text[i,j])+128));
End;
Writeln (lst);
Write (Lst,LineReset);
End
Else
Begin
For j:=1 to MaxChars[i] do
Begin
if Under[i] then write(lst,Underline,#1);
if (Under[i]) and (Text[i,j]=Space) then Write (Lst,Underline,#0);
write (Lst,Text[i,j]);
End; {For}
Writeln(lst);
Write (Lst,LineReset);
End
End;
Writeln(lst)
End;
End;
Procedure CheckFinish;
Var Ch : Char;
Begin
Gotoxy( 50 , 10 );
Write ('Are you sure (Y/N) :');
Repeat
Read( Kbd,Ch );
Ch := UpCase( Ch );
Until Ch in ['Y' , 'N' ];
Ended := Ch = 'Y';
Gotoxy( 50 , 10);
Write (' ');
End;
Procedure Options;
Var Resp:Char;
Begin
RemovePrev;
gotoxy(10,5);
Write ('Do you wish to');
gotoxy(50,5);
Write ('1) Print label');
gotoxy(50,6);
Write('2) Start a new label');
gotoxy(50,7);
Write('3) Edit current label');
Gotoxy(50,8);
Write('4) Quit program');
Repeat
Read(Kbd,Resp);
Resp:=Upcase(Resp);
Until (Resp in ['1','P','2','S','3','E','4','Q']);
Case Resp of
'1','P': Print;
'2','S': Again:=True;
'3','E': Edit;
'4','Q': CheckFinish;
End
End;