-
Notifications
You must be signed in to change notification settings - Fork 5
/
ASC2LOGO.PAS
52 lines (47 loc) · 1.28 KB
/
ASC2LOGO.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ @author: Sylvain Maltais ([email protected])
@created: 2023
@website(https://www.gladir.com/corail)
@abstract(Target: Turbo Pascal 7, Free Pascal)
}
Program ASC2LOGO(Input,Output);
Var
SourceASC,TargetLogo:Text;
CurrLine:String;
BEGIN
If(ParamStr(1)='/?')or(ParamStr(1)='--help')or(ParamStr(1)='-h')Then Begin
WriteLn('ASC2LOGO : Cette commande permet de transformer du texte en code source Logo.');
WriteLn;
WriteLn('Syntaxe : ASC2LOGO nomdufichier.asc nomdufichier.LGO');
End
Else
If ParamCount>0Then Begin
Assign(SourceASC,ParamStr(1));
{$I-}Reset(SourceASC);{$I+}
If IoResult<>0Then Begin
WriteLn('Fichier ASCII introuvable !');
Halt;
End;
Assign(TargetLOGO,ParamStr(2));
{$I+}Rewrite(TargetLOGO); {$I+}
If IoResult<>0Then Begin
WriteLn('Impossible de cr‚er le fichier Logo !');
Close(SourceASC);
Halt;
End;
While Not EOF(SourceASC)do Begin
ReadLn(SourceASC,CurrLine);
If CurrLine=''Then WriteLn(TargetLOGO,'PRINT []')
Else WriteLn(TargetLOGO,'PRINT [',CurrLine,']');
End;
Close(TargetLOGO);
Close(SourceASC);
End
Else
Begin
While Not EOF(SourceASC)do Begin
ReadLn(Input,CurrLine);
If CurrLine=''Then WriteLn(Output,'PRINT []')
Else WriteLn(Output,'PRINT [',CurrLine,']');
End;
End;
END.