program concat (afile, bfile, abfile, output); (* copies afile and bfile into abfile billie lemmon and thomas schneider, copyright (c) 1985 module libraries: delman, delmods *) const (* begin module version *) version = 1.08; (* concat 1986 dec 9 origin: 1982 august 15 *) (* end module version *) (* begin module describe.concat *) (* name concat: concatenate files together synopsis concat(afile: in, bfile: in, abfile: out, output: out) files afile: the first file to be copied to abfile bfile: the second file to be copied to abfile abfile: the concatenation of afile and bfile output: messages to the user description concat joins two files, afile and bfile, into a single file named abfile. afile is first copied to abfile, followed by bfile. a warning is given to the user if either afile or bfile is empty, but in this case, the program copies the other file to abfile anyway. examples one can use concat to join delila instruction sets in the cyclic teaching of the perceptron (see our third nar paper). note that delila will not accept several titles in the instructions, so be sure that one of the two sets has no title, or remove it by hand. author billie lemmon and thomas schneider bugs none known *) (* end module describe.concat *) var afile, bfile, (* input files *) abfile: text; (* result of the operation *) (* begin module unlimitln *) procedure unlimitln(var afile: text); (* this procedure removes a stupid system dependent limit on the number of lines that one can write to a file. you may remove it from the code if your system does not want or need this. suggested method: place comments around the contents of the procedure. *) begin (* linelimit(afile, maxint); (* set 'infinite' lines allowed for afile *) end; (* end module unlimitln version = 'delmod 6.51 85 apr 17 tds/gds' *) procedure onecopy(var sin, sout : text); (* copy sin to sout *) var c: char; (* character of the text *) begin (* onecopy *) while not eof(sin) do begin while not eoln(sin) do begin read (sin, c); write(sout, c) end; readln(sin); writeln(sout) end end; (* onecopy *) begin (* concat *) writeln(output,' concat ',version:4:2); reset(afile); reset(bfile); rewrite(abfile); unlimitln(abfile); if not eof(afile) then onecopy(afile, abfile) else writeln(output, 'afile is empty'); if not eof(bfile) then onecopy(bfile, abfile) else writeln(output, 'bfile is empty') end. (* concat *)