本文整理汇总了C++中MsgFormat类的典型用法代码示例。如果您正苦于以下问题:C++ MsgFormat类的具体用法?C++ MsgFormat怎么用?C++ MsgFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MsgFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: alice
//.........这里部分代码省略.........
}
else {
ALICE_error(12); // msg 12: "full" or "reserve" required
}
}
if (table->in_sw_value & sw_user)
{
if (--argc <= 0) {
ALICE_error(13); // msg 13: user name required
}
tdgbl->ALICE_data.ua_user = *argv++;
}
if (table->in_sw_value & sw_password)
{
if (--argc <= 0) {
ALICE_error(14); // msg 14: password required
}
uSvc->hidePasswd(uSvc->argv, argv - uSvc->argv.begin());
tdgbl->ALICE_data.ua_password = *argv++;
}
if (table->in_sw_value & sw_fetch_password)
{
if (--argc <= 0) {
ALICE_error(14); // msg 14: password required
}
switch (fb_utils::fetchPassword(*argv, tdgbl->ALICE_data.ua_password))
{
case fb_utils::FETCH_PASS_OK:
break;
case fb_utils::FETCH_PASS_FILE_OPEN_ERROR:
ALICE_error(116, MsgFormat::SafeArg() << *argv << errno);
// error @2 opening password file @1
break;
case fb_utils::FETCH_PASS_FILE_READ_ERROR:
ALICE_error(117, MsgFormat::SafeArg() << *argv << errno);
// error @2 reading password file @1
break;
case fb_utils::FETCH_PASS_FILE_EMPTY:
ALICE_error(118, MsgFormat::SafeArg() << *argv);
// password file @1 is empty
break;
}
++argv;
}
if (table->in_sw_value & sw_disable)
{
if (--argc <= 0) {
ALICE_error(15); // msg 15: subsystem name
}
ALICE_down_case(*argv++, string, sizeof(string));
if (strcmp(string, "wal")) {
ALICE_error(16); // msg 16: "wal" required
}
}
if (table->in_sw_value & (sw_attach | sw_force | sw_tran | sw_cache))
{
if (--argc <= 0) {
ALICE_error(17); // msg 17: number of seconds required
}
ALICE_down_case(*argv++, string, sizeof(string));
if ((!(tdgbl->ALICE_data.ua_shutdown_delay = atoi(string))) && (strcmp(string, "0")))
示例2: execute_abort
static void execute_abort( qli_nod* node)
{
/**************************************
*
* e x e c u t e _ a b o r t
*
**************************************
*
* Functional description
* Abort a statement.
*
**************************************/
if (node->nod_count)
{
const TEXT* ptr = NULL;
Firebird::VaryStr<80> temp;
const USHORT l =
MOVQ_get_string(EVAL_value(node->nod_arg[0]), &ptr, &temp, sizeof(temp));
UCHAR msg[128];
MOVQ_terminate(ptr, (SCHAR*) msg, l, sizeof(msg));
ERRQ_error(40, SafeArg() << msg);
// Msg40 Request terminated by statement: %s
}
IBERROR(41); // Msg41 Request terminated by statement
}
示例3: CMD_rename_proc
void CMD_rename_proc( qli_syntax* node)
{
/**************************************
*
* C M D _ r e n a m e _ p r o c
*
**************************************
*
* Functional description
* Rename a procedure in the named database,
* or the most recently readied database.
*
**************************************/
qli_proc* old_proc = (qli_proc*) node->syn_arg[0];
qli_proc* new_proc = (qli_proc*) node->syn_arg[1];
qli_dbb* database = old_proc->qpr_database;
if (!database)
database = QLI_databases;
if (new_proc->qpr_database && (new_proc->qpr_database != database))
IBERROR(84); // Msg84 Procedures can not be renamed across databases. Try COPY
const qli_name* old_name = old_proc->qpr_name;
const qli_name* new_name = new_proc->qpr_name;
if (PRO_rename_procedure(database, old_name->nam_string, new_name->nam_string))
{
return;
}
ERRQ_error(85, SafeArg() << old_name->nam_string << database->dbb_symbol->sym_string);
// Msg85 Procedure %s not found in database %s
}
示例4: reconnect
static bool reconnect(FB_API_HANDLE handle, SLONG number, const TEXT* name, SINT64 switches)
{
ISC_STATUS_ARRAY status_vector;
const SLONG id = gds__vax_integer(reinterpret_cast<const UCHAR*>(&number), 4);
FB_API_HANDLE transaction = 0;
if (isc_reconnect_transaction(status_vector, &handle, &transaction,
sizeof(id), reinterpret_cast<const char*>(&id)))
{
ALICE_print(90, SafeArg() << name);
// msg 90: failed to reconnect to a transaction in database %s
ALICE_print_status(true, status_vector);
return true;
}
if (!(switches & (sw_commit | sw_rollback)))
{
ALICE_print(91, SafeArg() << number);
// msg 91: Transaction %ld:
switches = ask();
if (switches == ~SINT64(0))
{
ALICE_print(84);
// msg 84: unexpected end of input
return true;
}
}
if (switches & sw_commit)
isc_commit_transaction(status_vector, &transaction);
else if (switches & sw_rollback)
isc_rollback_transaction(status_vector, &transaction);
else
return false;
if (status_vector[1])
{
ALICE_print_status(true, status_vector);
return true;
}
return false;
}
示例5: CMD_extract
void CMD_extract( qli_syntax* node)
{
/**************************************
*
* C M D _ e x t r a c t
*
**************************************
*
* Functional description
* Extract a series of procedures.
*
**************************************/
FILE* file = (FILE*) EXEC_open_output((qli_nod*) node->syn_arg[1]);
qli_syntax* list = node->syn_arg[0];
if (list)
{
qli_syntax** ptr = list->syn_arg;
for (const qli_syntax* const* const end = ptr + list->syn_count; ptr < end; ptr++)
{
qli_proc* proc = (qli_proc*) *ptr;
qli_dbb* database = proc->qpr_database;
if (!database)
database = QLI_databases;
const qli_name* name = proc->qpr_name;
FB_API_HANDLE blob = PRO_fetch_procedure(database, name->nam_string);
if (!blob)
{
ERRQ_msg_put(89, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
// Msg89 Procedure %s not found in database %s
continue;
}
dump_procedure(database, file, name->nam_string, name->nam_length, blob);
}
}
else
{
CMD_check_ready();
for (qli_dbb* database = QLI_databases; database; database = database->dbb_next)
{
PRO_scan(database, extract_procedure, file);
}
}
#ifdef WIN_NT
if (((qli_nod*) node->syn_arg[1])->nod_arg[e_out_pipe])
_pclose(file);
else
#endif
fclose(file);
}
示例6: yes_no
static bool yes_no(USHORT number, const TEXT* arg1)
{
/**************************************
*
* y e s _ n o
*
**************************************
*
* Functional description
* Put out a prompt that expects a yes/no
* answer, and keep trying until we get an
* acceptable answer (e.g. y, Yes, N, etc.)
*
**************************************/
TEXT prompt[256];
ERRQ_msg_format(number, sizeof(prompt), prompt, SafeArg() << arg1);
if (!yes_no_loaded)
{
yes_no_loaded = true;
// Msg498 NO
if (!ERRQ_msg_get(498, answer_table[0].answer, sizeof(answer_table[0].answer)))
strcpy(answer_table[0].answer, "NO"); // default if msg_get fails
// Msg497 YES
if (!ERRQ_msg_get(497, answer_table[1].answer, sizeof(answer_table[1].answer)))
strcpy(answer_table[1].answer, "YES");
}
TEXT buffer[256];
while (true)
{
buffer[0] = 0;
if (!LEX_get_line(prompt, buffer, sizeof(buffer)))
return true;
for (const answer_t* response = answer_table; *response->answer != '\0'; response++)
{
const TEXT* p = buffer;
while (*p == ' ')
p++;
if (*p == EOF)
return true;
for (const TEXT* q = response->answer; *p && UPPER(*p) == *q++; p++)
;
if (!*p || *p == '\n')
return response->value;
}
}
}
示例7: ERRQ_print_error
void ERRQ_print_error(USHORT number, const char* str)
{
/**************************************
*
* E R R Q _ p r i n t _ e r r o r
*
**************************************
*
* Functional description
* An error has occurred. Put out an error message and
* unwind.
*
**************************************/
ERRQ_error(number, SafeArg() << str);
}
示例8: ERRQ_msg_put
void ERRQ_msg_put(USHORT number, const char* str)
{
/**************************************
*
* E R R Q _ m s g _ p u t
*
**************************************
*
* Functional description
* Retrieve a message from the error file, format it, and print it
* It's same outcome as ERRQ_msg_partial but with a newline at the end.
*
**************************************/
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), ERRQ_message, SafeArg() << str);
printf("%s\n", ERRQ_message);
}
示例9: ERRQ_error
void ERRQ_error(USHORT number, const char* str)
{
/**************************************
*
* E R R Q _ e r r o r
*
**************************************
*
* Functional description
* An error has occurred. Put out an error message and
* unwind. If this was called before the unwind path
* was established, don't unwind just print error and exit.
*
**************************************/
ERRQ_error(number, SafeArg() << str);
}
示例10: ERRQ_bugcheck
void ERRQ_bugcheck( USHORT number)
{
/**************************************
*
* E R R Q _ b u g c h e c k
*
**************************************
*
* Functional description
* Somebody has screwed up. Bugcheck.
*
**************************************/
TEXT s[256];
ERRQ_msg_format(number, sizeof(s), s);
ERRQ_error(9, SafeArg() << s); // Msg9 INTERNAL: %s
}
示例11: TDR_attach_database
bool TDR_attach_database(ISC_STATUS* status_vector, tdr* trans, const TEXT* pathname)
{
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
if (tdgbl->ALICE_data.ua_debug)
ALICE_print(68, SafeArg() << pathname); // msg 68: ATTACH_DATABASE: attempted attach of %s
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
dpb.insertTag(isc_dpb_no_garbage_collect);
dpb.insertTag(isc_dpb_gfix_attach);
tdgbl->uSvc->fillDpb(dpb);
if (tdgbl->ALICE_data.ua_user) {
dpb.insertString(isc_dpb_user_name, tdgbl->ALICE_data.ua_user, fb_strlen(tdgbl->ALICE_data.ua_user));
}
if (tdgbl->ALICE_data.ua_password)
{
dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password,
tdgbl->ALICE_data.ua_password, fb_strlen(tdgbl->ALICE_data.ua_password));
}
trans->tdr_db_handle = 0;
isc_attach_database(status_vector, 0, pathname,
&trans->tdr_db_handle, dpb.getBufferLength(),
reinterpret_cast<const char*>(dpb.getBuffer()));
if (status_vector[1])
{
if (tdgbl->ALICE_data.ua_debug)
{
ALICE_print(69); // msg 69: failed
ALICE_print_status(false, status_vector);
}
return false;
}
MET_set_capabilities(status_vector, trans);
if (tdgbl->ALICE_data.ua_debug)
ALICE_print(70); // msg 70: succeeded
return true;
}
示例12: ERRQ_syntax
void ERRQ_syntax( USHORT number)
{
/**************************************
*
* E R R Q _ s y n t a x
*
**************************************
*
* Functional description
* Syntax error has occurred. Give some hint of what went
* wrong.
*
**************************************/
TEXT s[256];
ERRQ_msg_format(number, sizeof(s), s);
ERRQ_error(13, SafeArg() << s << QLI_token->tok_string);
// Msg13 expected %s, encountered %s
}
示例13: ERRQ_error_format
void ERRQ_error_format(USHORT number, const SafeArg& arg)
{
/**************************************
*
* E R R Q _ e r r o r _ f o r m a t
*
**************************************
*
* Functional description
* Retrieve a message from the error file and format it
* in the standard qli error format, put it where
* ERRQ_pending expects to find it.
**************************************/
TEXT s[256];
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(s), s, arg);
fb_msg_format(0, QLI_MSG_FAC, 12, sizeof(ERRQ_message), ERRQ_message, SafeArg() << s);
// Msg12 ** QLI error: %s **
QLI_error = ERRQ_message;
QLI_skip_line = true;
}
示例14: CMD_delete_proc
void CMD_delete_proc( qli_syntax* node)
{
/**************************************
*
* C M D _ d e l e t e _ p r o c
*
**************************************
*
* Functional description
* Delete a procedure in the named database
* or in the most recently readied database.
*
**************************************/
qli_proc* proc = (qli_proc*) node->syn_arg[0];
if (!proc->qpr_database)
proc->qpr_database = QLI_databases;
if (PRO_delete_procedure(proc->qpr_database, proc->qpr_name->nam_string))
return;
ERRQ_msg_put(88, SafeArg() << proc->qpr_name->nam_string << // Msg88 Procedure %s not found in database %s
proc->qpr_database->dbb_symbol->sym_string);
}
示例15: LEX_token
qli_tok* LEX_token()
{
/**************************************
*
* L E X _ t o k e n
*
**************************************
*
* Functional description
* Parse and return the next token.
*
**************************************/
qli_tok* token = QLI_token;
TEXT* p = token->tok_string;
// Get next significant byte. If it's the last EOL of a blob, throw it away
SSHORT c;
for (;;)
{
c = skip_white();
if (c != '\n' || QLI_line->line_type != line_blob)
break;
qli_line* prior = QLI_line;
next_line(true);
if (prior == QLI_line)
break;
}
// If we hit end of file, make up a phoney token
if (!QLI_line)
{
const TEXT* q = eof_string;
while (*p++ = *q++);
token->tok_type = tok_eof;
token->tok_keyword = KW_none;
return NULL;
}
*p++ = c;
QLI_token->tok_position = QLI_line->line_position + QLI_line->line_ptr - QLI_line->line_data - 1;
// On end of file, generate furious but phone end of line tokens
char char_class = classes(c);
if (char_class & CHR_letter)
{
for (c = nextchar(true); classes(c) & CHR_ident; c = nextchar(true))
*p++ = c;
retchar();
token->tok_type = tok_ident;
}
else if (((char_class & CHR_digit) || c == '.') && scan_number(c, &p))
token->tok_type = tok_number;
else if (char_class & CHR_quote)
{
token->tok_type = tok_quoted;
while (true)
{
const SSHORT next = nextchar(false);
if (!next || next == '\n')
{
retchar();
IBERROR(63); // Msg 63 unterminated quoted string
break;
}
*p++ = next;
if ((p - token->tok_string) >= MAXSYMLEN)
ERRQ_msg_put(470, SafeArg() << MAXSYMLEN); // Msg 470 literal too long
// If there are 2 quotes in a row, interpret 2nd as a literal
if (next == c)
{
const SSHORT peek = nextchar(false);
retchar();
if (peek != c)
break;
nextchar(false);
}
}
}
else if (c == '\n')
{
// end of line, signal it properly with a phoney token.
token->tok_type = tok_eol;
--p;
const TEXT* q = eol_string;
while (*q)
*p++ = *q++;
}
else
{
token->tok_type = tok_punct;
*p++ = nextchar(true);
if (!HSH_lookup(token->tok_string, 2))
{
//.........这里部分代码省略.........