| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef DOSBOX_PROGRAMS_H |
| 22 |
#define DOSBOX_PROGRAMS_H |
| 23 |
|
| 24 |
#ifndef DOSBOX_DOSBOX_H |
| 25 |
#include "dosbox.h" |
| 26 |
#endif |
| 27 |
#ifndef DOSBOX_DOS_INC_H |
| 28 |
#include "dos_inc.h" |
| 29 |
#endif |
| 30 |
|
| 31 |
#ifndef CH_LIST |
| 32 |
#define CH_LIST |
| 33 |
#include <list> |
| 34 |
#endif |
| 35 |
|
| 36 |
#ifndef CH_STRING |
| 37 |
#define CH_STRING |
| 38 |
#include <string> |
| 39 |
#endif |
| 40 |
|
| 41 |
class CommandLine { |
| 42 |
public: |
| 43 |
CommandLine(int argc,char const * const argv[]); |
| 44 |
CommandLine(char const * const name,char const * const cmdline); |
| 45 |
const char * GetFileName(){ return file_name.c_str();} |
| 46 |
|
| 47 |
bool FindExist(char const * const name,bool remove=false); |
| 48 |
bool FindHex(char const * const name,int & value,bool remove=false); |
| 49 |
bool FindInt(char const * const name,int & value,bool remove=false); |
| 50 |
bool FindString(char const * const name,std::string & value,bool remove=false); |
| 51 |
bool FindCommand(unsigned int which,std::string & value); |
| 52 |
bool FindStringBegin(char const * const begin,std::string & value, bool remove=false); |
| 53 |
bool FindStringRemain(char const * const name,std::string & value); |
| 54 |
bool GetStringRemain(std::string & value); |
| 55 |
unsigned int GetCount(void); |
| 56 |
void Shift(unsigned int amount=1); |
| 57 |
Bit16u Get_arglength(); |
| 58 |
|
| 59 |
private: |
| 60 |
typedef std::list<std::string>::iterator cmd_it; |
| 61 |
std::list<std::string> cmds; |
| 62 |
std::string file_name; |
| 63 |
bool FindEntry(char const * const name,cmd_it & it,bool neednext=false); |
| 64 |
}; |
| 65 |
|
| 66 |
class Program { |
| 67 |
public: |
| 68 |
Program(); |
| 69 |
virtual ~Program(){ |
| 70 |
delete cmd; |
| 71 |
delete psp; |
| 72 |
} |
| 73 |
std::string temp_line; |
| 74 |
CommandLine * cmd; |
| 75 |
DOS_PSP * psp; |
| 76 |
virtual void Run(void)=0; |
| 77 |
bool GetEnvStr(const char * entry,std::string & result); |
| 78 |
bool GetEnvNum(Bitu num,std::string & result); |
| 79 |
Bitu GetEnvCount(void); |
| 80 |
bool SetEnv(const char * entry,const char * new_string); |
| 81 |
void WriteOut(const char * format,...); |
| 82 |
void WriteOut_NoParsing(const char * format); |
| 83 |
void ChangeToLongCmd(); |
| 84 |
|
| 85 |
}; |
| 86 |
|
| 87 |
typedef void (PROGRAMS_Main)(Program * * make); |
| 88 |
void PROGRAMS_MakeFile(char const * const name,PROGRAMS_Main * main); |
| 89 |
|
| 90 |
#endif |