1
0
Fork 0

added MSG_Write and renamed ???Message to MSG_???. Fixed some typos

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@321
This commit is contained in:
Peter Veenstra 2002-10-17 13:18:00 +00:00
parent ed0e6bee75
commit 6d64c5f21e
3 changed files with 40 additions and 28 deletions

View file

@ -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 */

View file

@ -42,12 +42,12 @@ struct MessageBlock
static list<MessageBlock> Lang;
typedef list<MessageBlock>::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);
}

View file

@ -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);