00001 /* 00002 This file is a part of the OsiDylp LP distribution. 00003 00004 Copyright (C) 2005 Lou Hafer 00005 00006 School of Computing Science 00007 Simon Fraser University 00008 Burnaby, B.C., V5A 1S6, Canada 00009 lou@cs.sfu.ca 00010 00011 This program is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the Free 00013 Software Foundation; either version 2 of the License, or (at your option) 00014 any later version. 00015 00016 This program is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00019 more details. 00020 00021 You should have received a copy of the GNU General Public License along 00022 with this program; if not, write to the Free Software Foundation, Inc., 00023 51 Franklin St., Fifth Floor, Boston, MA 02110-1301 USA 00024 */ 00025 00026 #ifndef _DY_CMDINT_H 00027 #define _DY_CMDINT_H 00028 00029 /* 00030 @(#)dy_cmdint.h 3.3 06/22/04 00031 svn/cvs: $Id: dy_cmdint.h 71 2006-06-09 04:21:15Z andreasw $ 00032 00033 Declarations specific to dylp's command interpreter. 00034 */ 00035 00036 #include "dylib_std.h" 00037 #include "dylib_io.h" 00038 #include "dylib_errs.h" 00039 00040 /* 00041 Globals for log stream and echo control, command input stream and echo 00042 control. These must be declared in a main program somewhere. 00043 00044 dy_cmdchn i/o id for command input 00045 dy_cmdecho controls echoing of command input to stdout 00046 00047 dy_logchn i/o id for log file 00048 dy_gtxecho controls echoing of generated text to stdout 00049 00050 dylp.h also contains extern declarations for dy_logchn and dy_gtxecho. Turns out 00051 that the files related to the command interpreter don't need the main dylp 00052 structures, so it's useful to duplicate the extern decl's in both .h files. 00053 */ 00054 00055 extern ioid dy_logchn,dy_cmdchn ; 00056 extern bool dy_gtxecho,dy_cmdecho ; 00057 00058 00059 /* 00060 cmdint.c 00061 */ 00062 00063 /* 00064 Return codes for command execution routines called from the command 00065 interpreter: 00066 00067 cmdOK execution of the command was adequately successful, further 00068 command interpretation should continue. 00069 cmdHALTNOERROR execution of the command was adequately successful, but break 00070 out of the command interpretation loop. 00071 cmdHALTERROR an error occurred during execution of the command, break 00072 out of the command interpretation loop. 00073 00074 As return codes for process_cmds, the interpretation is slightly different: 00075 cmdOK command interpretation was ended by an eof on the top level 00076 command channel (this is the normal case when command execution 00077 completes without error). 00078 cmdHALTNOERROR some command returned a cmdHALTNOERROR return code. 00079 cmdHALTERROR either a command returned a cmdHALTERROR return code, or a 00080 fatal error occurred in process_cmds. 00081 */ 00082 00083 typedef enum { cmdOK, cmdHALTERROR, cmdHALTNOERROR } cmd_retval ; 00084 00085 cmd_retval process_cmds(bool silent) ; 00086 00087 #endif /* _DY_CMDINT_H */