(* BATCH.PAS -- create .BAT file ** Copyright (c) 1996 Jochen Metzinger ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2, or (at your option) ** any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *) UNIT batch; INTERFACE USES global, errors; PROCEDURE bat_open(filename: STRING); (* open configuration file *) PROCEDURE bat_close; (* close configuration file *) PROCEDURE bat_line(line: STRING); (* write next line *) FUNCTION bat_nr: STRING; (* return current goal counter *) PROCEDURE bat_inc; (* increment goal counter *) IMPLEMENTATION VAR bat_file: TEXT; bat_goal: LongInt; PROCEDURE bat_open(filename: STRING); BEGIN filename := AddExt(filename,'.BAT'); (*$I-*) Assign(bat_file, filename); ReWrite(bat_file); IF IOResult <> 0 THEN FATAL('unable to create file '+filename); (*$I+*) bat_goal := 1; END; (* bat_open *) PROCEDURE bat_close; BEGIN Close(bat_file); END; (* bat_close *) PROCEDURE bat_line(line: STRING); BEGIN WriteLn(bat_file, line); END; (* bat_line *) FUNCTION bat_nr: STRING; BEGIN bat_nr := long2str(bat_goal, 0); END; (* bat_nr *) PROCEDURE bat_inc; BEGIN Inc(bat_goal); END; (* bat_inc *) END. (* batch *)