diff --git a/include/dosbox.h b/include/dosbox.h index 6f381dec..25606f62 100644 --- a/include/dosbox.h +++ b/include/dosbox.h @@ -24,7 +24,7 @@ void E_Exit(char * message,...); void S_Warn(char * message,...); -void AddMessage(const char*,const char*); //add messages to the internal langaugefile +void MSG_Add(const char*,const char*); //add messages to the internal langaugefile const char* MSG_Get(char const *); //get messages from the internal langaugafile /* The internal types */ diff --git a/src/misc/messages.cpp b/src/misc/messages.cpp index 3ec32ef1..9ce0fe63 100644 --- a/src/misc/messages.cpp +++ b/src/misc/messages.cpp @@ -42,12 +42,12 @@ struct MessageBlock static list Lang; typedef list::iterator itmb; -void AddMessage(const char * _name, const char* _val) +void MSG_Add(const char * _name, const char* _val) { Lang.push_back(MessageBlock(_name,_val)); } -void ReplaceMessage(const char * _name, const char* _val) +void MSG_Replace(const char * _name, const char* _val) { //find the message for(itmb tel=Lang.begin();tel!=Lang.end();tel++) @@ -60,7 +60,7 @@ void ReplaceMessage(const char * _name, const char* _val) } } //even if the message doesn't exist add it - AddMessage(_name,_val); + MSG_Add(_name,_val); } static void LoadMessageFile(const char * fname) { @@ -94,7 +94,7 @@ static void LoadMessageFile(const char * fname) { /* End of string marker */ } else if (linein[0]=='.') { /* Replace/Add the string to the internal langaugefile */ - ReplaceMessage(name,string); + MSG_Replace(name,string); } else { /* Normal string to be added */ strcat(string,linein); @@ -122,3 +122,15 @@ void MSG_Init(Section_prop * section) { LoadMessageFile(file_name.c_str()); } else LoadMessageFile(section->Get_string("LANGUAGE")); } + +void MSG_Write(const char * location) +{ + FILE* out=fopen(location,"w+b"); + if(out==NULL) return;//maybe an error? + for(itmb tel=Lang.begin();tel!=Lang.end();tel++){ + fprintf(out,":%s\n%s.\n",(*tel).name.c_str(),(*tel).val.c_str()); + } + + fclose(out); +} + diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 3375d388..c88df57f 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -177,29 +177,29 @@ static char * full_name="Z:\\COMMAND.COM"; static char * init_line="/INIT AUTOEXEC.BAT"; void SHELL_Init() { //add messages: - AddMessage("SHELL_CMD_HELP","supported commands are:\n"); - AddMessage("SHELL_CMD_ECHO_ON","ECHO is on\n"); - AddMessage("SHELL_CMD_ECHO_OFF","ECHO is off\n"); - AddMessage("SHELL_ILLEGAL_SWITCH","Illegal switch: %s"); - AddMessage("SHELL_CMD_CHDIR_ERROR","Unable to change to: %s\n"); - AddMessage("SHELL_CMD_MKDIR_ERROR","Unable to make: %s\n"); - AddMessage("SHELL_CMD_RMDIR_ERROR","Unable to remove: %\n"); - AddMessage("SHELL_SYNTAXERROR","The syntax of the command is incorrect.\n"); - AddMessage("SHELL_CMD_SET_NOT_SET","Environment variable %s not defined\n"); - AddMessage("SHELL_CMD_SET_OUT_OF_SPACE","Not enough environment space left.\n"); - AddMessage("SHELL_CMD_IF_EXIST_MISSING_FILENAME","IF EXIST: Missing filename.\n"); - AddMessage("SHELL_CMD_IF_ERRORLEVEL_MISSING_NUMBER","IF ERRORLEVEL: Missing number.\n"); - AddMessage("SHELL_CMD_IF_ERRORLEVEL_INVALID_NUMBER","IF ERRORLEVEL: Invalid number.\n"); - AddMessage("SHELL_CMD_GOTO_MISSING_LABEL","No label supplied to GOTO command.\n"); - AddMessage("SHELL_CMD_GOTO_LABEL_NOT_FOUND","GOTO: Label %s not found.\n"); - AddMessage("SHELL_CMD_FILE_NOT_FOUND","File %s not found.\n"); - AddMessage("SHELL_CMD_DIR_INTRO","Directory of %s.\n"); - AddMessage("SHELL_CMD_DIR_PATH_ERROR","Illegal Path\n"); - AddMessage("SHELL_CMD_DIR_BYTES_USED","%5d File(s) %17s Bytes\n"); - AddMessage("SHELL_CMD_DIR_BYTES_FREE","%5d Dir(s) %17s Bytes free"); - AddMessage("SHELL_EXECUTE_DRIVE_NOT_FOUND","Drive %c does not exist!\n"); - AddMessage("SHELL_EXECUTE_ILLEGAL_COMMAND","Illegal command: %s.\n"); - AddMessage("SHELL_STARTUP","DOSBox Shell v0.40\nFor Help and supported commands type: HELP\n\nHAVE FUN!\nThe DOSBox Team\n\n"); + MSG_Add("SHELL_CMD_HELP","supported commands are:\n"); + MSG_Add("SHELL_CMD_ECHO_ON","ECHO is on\n"); + MSG_Add("SHELL_CMD_ECHO_OFF","ECHO is off\n"); + MSG_Add("SHELL_ILLEGAL_SWITCH","Illegal switch: %s\n"); + MSG_Add("SHELL_CMD_CHDIR_ERROR","Unable to change to: %s\n"); + MSG_Add("SHELL_CMD_MKDIR_ERROR","Unable to make: %s\n"); + MSG_Add("SHELL_CMD_RMDIR_ERROR","Unable to remove: %\n"); + MSG_Add("SHELL_SYNTAXERROR","The syntax of the command is incorrect.\n"); + MSG_Add("SHELL_CMD_SET_NOT_SET","Environment variable %s not defined\n"); + MSG_Add("SHELL_CMD_SET_OUT_OF_SPACE","Not enough environment space left.\n"); + MSG_Add("SHELL_CMD_IF_EXIST_MISSING_FILENAME","IF EXIST: Missing filename.\n"); + MSG_Add("SHELL_CMD_IF_ERRORLEVEL_MISSING_NUMBER","IF ERRORLEVEL: Missing number.\n"); + MSG_Add("SHELL_CMD_IF_ERRORLEVEL_INVALID_NUMBER","IF ERRORLEVEL: Invalid number.\n"); + MSG_Add("SHELL_CMD_GOTO_MISSING_LABEL","No label supplied to GOTO command.\n"); + MSG_Add("SHELL_CMD_GOTO_LABEL_NOT_FOUND","GOTO: Label %s not found.\n"); + MSG_Add("SHELL_CMD_FILE_NOT_FOUND","File %s not found.\n"); + MSG_Add("SHELL_CMD_DIR_INTRO","Directory of %s.\n"); + MSG_Add("SHELL_CMD_DIR_PATH_ERROR","Illegal Path\n"); + MSG_Add("SHELL_CMD_DIR_BYTES_USED","%5d File(s) %17s Bytes\n"); + MSG_Add("SHELL_CMD_DIR_BYTES_FREE","%5d Dir(s) %17s Bytes free\n"); + MSG_Add("SHELL_EXECUTE_DRIVE_NOT_FOUND","Drive %c does not exist!\n"); + MSG_Add("SHELL_EXECUTE_ILLEGAL_COMMAND","Illegal command: %s.\n"); + MSG_Add("SHELL_STARTUP","DOSBox Shell v0.40\nFor Help and supported commands type: HELP\n\nHAVE FUN!\nThe DOSBox Team\n\n"); //regular startup call_shellstop=CALLBACK_Allocate(); CALLBACK_Setup(call_shellstop,shellstop_handler,CB_IRET);