summaryrefslogtreecommitdiff
path: root/graphics/mf2tex/log2tex.pas
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/mf2tex/log2tex.pas')
-rw-r--r--graphics/mf2tex/log2tex.pas53
1 files changed, 53 insertions, 0 deletions
diff --git a/graphics/mf2tex/log2tex.pas b/graphics/mf2tex/log2tex.pas
new file mode 100644
index 0000000000..5cdcbcbf38
--- /dev/null
+++ b/graphics/mf2tex/log2tex.pas
@@ -0,0 +1,53 @@
+{convertor from generated LOG files to the corresponding TeX sources
+
+ this program is for dos-systems}
+
+program log2tex;
+uses
+ dos;
+var
+ fi,fo:text;
+ line:string;
+ d:dirstr;
+ n:namestr;
+ e:extstr;
+
+procedure
+ error(txt:string);
+begin
+ writeln(txt);
+ halt(1);
+end;
+
+begin
+ if paramcount>=1 then begin
+ line:=paramstr(1);
+ end else begin
+ write('input: ');
+ readln(line);
+ end;
+ fsplit(line,d,n,e);
+ if e='' then line:=line+'.log';
+ assign(fi,line);
+ {$i-} reset(fi); {$i+}
+ if ioresult<>0 then
+ error('can not open input file');
+ while not eof(fi) do begin
+ readln(fi,line);
+ if copy(line,1,4)='$#@!' then begin
+ line:=copy(line,5,255);
+ assign(fo,line+'.tex');
+ {$i-} rewrite(fo); {$i+}
+ if ioresult<>0 then
+ error('can not open output file');
+ break;
+ end;
+ end;
+ while not eof(fi) do begin
+ readln(fi,line);
+ if copy(line,1,4)='!@#$' then
+ writeln(fo,copy(line,5,255));
+ end;
+ close(fo);
+ close(fi);
+end.