本文整理汇总了C++中set_message函数的典型用法代码示例。如果您正苦于以下问题:C++ set_message函数的具体用法?C++ set_message怎么用?C++ set_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_key
void handle_key(struct wdata *data, int c)
{
if (c == 27) {
reset();
states_pop();
} else if (c == 9) {
autocomplete_handle();
} else if (c == 13) {
execute(data);
reset();
states_pop();
} else if (c == 263) {
if (cmd_data.bufpos > 0) {
autocomplete_clear();
cmd_data.buf[--cmd_data.bufpos] = '\0';
set_message(M_INFO, ":%s", cmd_data.buf);
} else {
set_message(M_INFO, "");
states_pop();
}
} else if (c >= 32) {
if (cmd_data.bufpos < CMD_BUFSIZE) {
autocomplete_clear();
cmd_data.buf[cmd_data.bufpos++] = c;
cmd_data.buf[cmd_data.bufpos] = '\0';
set_message(M_INFO, ":%s", cmd_data.buf);
}
}
}
示例2: execute
void execute(struct wdata *data)
{
char tmp[CMD_BUFSIZE + 1];
char *name;
int i;
struct arg arg;
strcpy(tmp, cmd_data.buf);
name = strtok(tmp, " ");
arg.s = strtok(NULL, " ");
if (!name) {
/* no command entered, leave cmd state */
set_message(M_INFO, "");
} else {
for (i = 0; i < ARRSIZE(cmds); i++) {
if (streq(name, cmds[i].name)) {
cmds[i].func(data, &arg);
return;
}
}
/* no command found, print error message */
set_message(M_ERROR, "no such command: '%s' ", name);
}
}
示例3: search_upwards
bool
edit_interface_rep::set_hybrid_footer (tree st) {
// WARNING: update edit_dynamic_rep::activate_hybrid when updating this
if (is_atomic (st))
if (is_func (subtree (et, path_up (tp, 2)), HYBRID, 1)) {
string msg;
// macro argument
string name= st->label;
path mp= search_upwards (MACRO);
if (!is_nil (mp)) {
tree mt= subtree (et, mp);
int i, n= N(mt)-1;
for (i=0; i<n; i++)
if (mt[i] == name) {
set_message (concat (kbd ("return"), ": insert argument ", name),
"hybrid command");
return true;
}
}
// macro application
tree f= get_env_value (name);
if (drd->contains (name) && (f == UNINIT))
set_message (concat (kbd ("return"), ": insert primitive ", name),
"hybrid command");
else if (is_func (f, MACRO) || is_func (f, XMACRO))
set_message (concat (kbd ("return"), ": insert macro ", name),
"hybrid command");
else if (f != UNINIT)
set_message (concat (kbd ("return"), ": insert value ", name),
"hybrid command");
else return false;
return true;
}
return false;
}
示例4: creation_message_erreur
creation_message_erreur(char nom[]) {
int fd = creation_fichier_liste("erreur.txt");
set_message("le fichier suivant n'existe pas : ");
write(fd,get_message(),size_message());
write(fd,nom,strlen(nom));
set_message("\n\n");
write(fd,get_message(),size_message());
ajout_info_liste(fd);
}
示例5: cmd_set_sort
void cmd_set_sort(struct wdata *data, const struct arg *arg)
{
if (arg->i < 0 || arg->i >= N_SORTMETHODS)
return;
set_message(M_INFO, "");
dwindow_set_sort(data->wsel, arg->i);
set_message(M_INFO, "sorted by: %s", strsort(data->wsel->sort));
}
示例6: gwy_tip_estimate_partial
/**
* gwy_tip_estimate_partial:
* @tip: Tip data to be refined (allocated).
* @surface: Surface data.
* @threshold: Threshold for noise supression.
* @use_edges: Whether use also edges of image.
* @count: Where to store the number of places that produced refinements to.
* @set_fraction: Function that sets fraction to output (or %NULL).
* @set_message: Function that sets message to output (or %NULL).
*
* Performs partial blind estimation algorithm published by Villarrubia. This
* function converts all fields into form requested by "morph_lib.c" library,
* that is almost identical with original Villarubia's library. Note that the
* threshold value must be chosen sufficently high value to supress small
* fluctulations due to noise (that would lead to very sharp tip) but
* sufficiently low value to put algorithm at work. A value similar to 1/10000
* of surface range can be good. Otherwise we recommend to start with zero
* threshold and increase it slowly to observe changes and choose right value.
*
* Returns: Estimated tip. May return %NULL if aborted.
**/
GwyDataField*
gwy_tip_estimate_partial(GwyDataField *tip,
GwyDataField *surface,
gdouble threshold,
gboolean use_edges,
gint *count,
GwySetFractionFunc set_fraction,
GwySetMessageFunc set_message)
{
gint **ftip;
gint **fsurface;
gdouble tipmin, surfacemin, step;
gint cnt;
if (set_message && !set_message(N_("Converting fields")))
return NULL;
tipmin = gwy_data_field_get_min(tip);
surfacemin = gwy_data_field_get_min(surface);
step = (gwy_data_field_get_max(surface)-surfacemin)/10000;
ftip = i_datafield_to_field(tip, TRUE, tipmin, step);
fsurface = i_datafield_to_field(surface, FALSE, surfacemin, step);
if (set_message && !set_message(N_("Starting partial estimation"))) {
_gwy_morph_lib_ifreematrix(ftip, tip->xres);
_gwy_morph_lib_ifreematrix(fsurface, surface->xres);
return NULL;
}
cnt = _gwy_morph_lib_itip_estimate0(fsurface, surface->yres, surface->xres,
tip->yres, tip->xres,
tip->yres/2, tip->xres/2,
ftip, threshold/step, use_edges,
set_fraction, set_message);
if (cnt == -1 || (set_fraction && !set_fraction(0.0))) {
_gwy_morph_lib_ifreematrix(ftip, tip->xres);
_gwy_morph_lib_ifreematrix(fsurface, surface->xres);
return NULL;
}
gwy_debug("Converting fields");
if (set_message)
set_message(N_("Converting fields"));
tip = i_field_to_datafield(ftip, tip, tipmin, step);
gwy_data_field_add(tip, -gwy_data_field_get_min(tip));
_gwy_morph_lib_ifreematrix(ftip, tip->xres);
_gwy_morph_lib_ifreematrix(fsurface, surface->xres);
if (count)
*count = cnt;
return tip;
}
示例7: probe_monitors
static void probe_monitors(GtkWidget *widget, gpointer data) {
if (combo_box_changed_handler_id)
g_signal_handler_disconnect(G_OBJECT(combo_box), combo_box_changed_handler_id);
gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo_box))));
set_message(_(
"Probing for available monitors..."
));
if (widget == NULL)
monlist = ddcci_load_list();
else
monlist = NULL;
if (!monlist) {
monlist = ddcci_probe();
ddcci_save_list(monlist);
}
struct monitorlist* current;
char buffer[256];
for (current = monlist; current != NULL; current = current->next)
{
snprintf(buffer, 256, "%s: %s",
current->filename, current->name);
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), buffer);
}
combo_box_changed_handler_id = g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(combo_change), NULL);
currentid = -1;
nextid = -1;
if (monlist) {
widgets_set_sensitive(TRUE);
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
}
else {
widgets_set_sensitive(FALSE);
gtk_widget_set_sensitive(close_button, TRUE);
gtk_widget_set_sensitive(refresh_controls_button, TRUE);
set_message(_(
"No monitor supporting DDC/CI available.\n\n"
"If your graphics card need it, please check all the required kernel modules are loaded (i2c-dev, and your framebuffer driver)."
));
}
}
示例8: load_metadata
/* load metadata file */
int load_metadata() {
FILE *f;
unsigned int stp;
mylog("::load_metadata()\n");
if (metaurl[0] != '@') {
/* not for @ code: it is not updated */
f = fopen(tpl, "w");
if (f == NULL) {
update_ok = UP_INT;
set_message("Failed to create local metadata file (check /tmp).");
return(0);
}
}
if (metaurl[0] == '@') {
/* user ask for a local program to update file */
/* run it with "system". may change */
if (system(metaurl+1) != 0) {
update_ok = UP_404; /* fail. same error than 404 */
set_message("Failed to execute updater program for metadata.");
return(0);
}
return(1);
} else {
/* we just dl the metadata file from website */
if (!wget_meta(metaurl, f)) {
fclose(f);
update_ok = UP_404;
return(0);
}
fclose(f);
}
/* now check for timestamp value */
f = fopen(tpl, "r");
if (f == NULL) {
update_ok = UP_INT;
set_message("Failed to open local metadata file (check /tmp).");
return(0);
}
if (fscanf(f, "%u", &stp) != 1) {
fclose(f);
update_ok = UP_TREE;
set_message("Failed to find timestamp in metadata file (bad format?).");
return(0);
}
fclose(f);
set_message(NULL);
return(1);
}
示例9: show_message
void show_message(char message[]){
window_stack_pop(true);
window_stack_push(message_window, true);
set_message(message);
last_screen = current_screen;
current_screen = SCREEN_MESSAGE_KEY;
}
示例10: cli_setatr
BOOL cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t)
{
char *p;
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
set_message(cli->outbuf,8,0,True);
SCVAL(cli->outbuf,smb_com,SMBsetatr);
SSVAL(cli->outbuf,smb_tid,cli->cnum);
cli_setup_packet(cli);
SSVAL(cli->outbuf,smb_vwv0, attr);
put_dos_date3(cli->outbuf,smb_vwv1, t);
p = smb_buf(cli->outbuf);
*p++ = 4;
p += clistr_push(cli, p, fname, -1, STR_TERMINATE);
*p++ = 4;
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {
return False;
}
if (cli_is_error(cli)) {
return False;
}
return True;
}
示例11: cli_rmdir
BOOL cli_rmdir(struct cli_state *cli, const char *dname)
{
char *p;
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
set_message(cli->outbuf,0, 0, True);
SCVAL(cli->outbuf,smb_com,SMBrmdir);
SSVAL(cli->outbuf,smb_tid,cli->cnum);
cli_setup_packet(cli);
p = smb_buf(cli->outbuf);
*p++ = 4;
p += clistr_push(cli, p, dname, -1, STR_TERMINATE);
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {
return False;
}
if (cli_is_error(cli)) {
return False;
}
return True;
}
示例12: cli_nt_hardlink
BOOL cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst)
{
char *p;
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
set_message(cli->outbuf, 4, 0, True);
SCVAL(cli->outbuf,smb_com,SMBntrename);
SSVAL(cli->outbuf,smb_tid,cli->cnum);
cli_setup_packet(cli);
SSVAL(cli->outbuf,smb_vwv0,aSYSTEM | aHIDDEN | aDIR);
SSVAL(cli->outbuf,smb_vwv1, RENAME_FLAG_HARD_LINK);
p = smb_buf(cli->outbuf);
*p++ = 4;
p += clistr_push(cli, p, fname_src, -1, STR_TERMINATE);
*p++ = 4;
p += clistr_push(cli, p, fname_dst, -1, STR_TERMINATE);
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli))
return False;
if (cli_is_error(cli))
return False;
return True;
}
示例13: setup
void setup(void) {
bank_init();
set_message("The following commands are available at the bank:\n" +
"\tbalance : Get your balance.\n" +
"\tdeposit # : Deposit # coins in the bank.\n" +
"\twithdraw # : Withdraw # coins from the bank.\n");
}
示例14: cli_message_text_build
/****************************************************************************
send a message
****************************************************************************/
int cli_message_text_build(struct cli_state *cli, char *msg, int len, int grp)
{
char *msgdos;
int lendos;
char *p;
memset(cli->outbuf,'\0',smb_size);
set_message(cli->outbuf,1,0,True);
SCVAL(cli->outbuf,smb_com,SMBsendtxt);
SSVAL(cli->outbuf,smb_tid,cli->cnum);
cli_setup_packet(cli);
SSVAL(cli->outbuf,smb_vwv0,grp);
p = smb_buf(cli->outbuf);
*p++ = 1;
if ((lendos = (int)convert_string_allocate(NULL,CH_UNIX, CH_DOS, msg,len, (void **)(void *)&msgdos, True)) < 0 || !msgdos) {
DEBUG(3,("Conversion failed, sending message in UNIX charset\n"));
SSVAL(p, 0, len); p += 2;
memcpy(p, msg, len);
p += len;
} else {
SSVAL(p, 0, lendos); p += 2;
memcpy(p, msgdos, lendos);
p += lendos;
SAFE_FREE(msgdos);
}
cli_setup_bcc(cli, p);
return(PTR_DIFF(p, cli->outbuf));
}
示例15: reply_pipe_read_and_X
/****************************************************************************
reply to a read and X
This code is basically stolen from reply_read_and_X with some
wrinkles to handle pipes.
****************************************************************************/
int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
{
pipes_struct *p = get_rpc_pipe_p(inbuf,smb_vwv2);
int smb_maxcnt = SVAL(inbuf,smb_vwv5);
int smb_mincnt = SVAL(inbuf,smb_vwv6);
int nread = -1;
char *data;
/* we don't use the offset given to use for pipe reads. This
is deliberate, instead we always return the next lump of
data on the pipe */
#if 0
uint32 smb_offs = IVAL(inbuf,smb_vwv3);
#endif
if (!p)
return(ERROR(ERRDOS,ERRbadfid));
set_message(outbuf,12,0,True);
data = smb_buf(outbuf);
nread = (int)read_from_pipe(p, data, (size_t)smb_maxcnt);
if (nread < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess));
SSVAL(outbuf,smb_vwv5,nread);
SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
SSVAL(smb_buf(outbuf),-2,nread);
DEBUG(3,("readX-IPC pnum=%04x min=%d max=%d nread=%d\n",
p->pnum, smb_mincnt, smb_maxcnt, nread));
return chain_reply(inbuf,outbuf,length,bufsize);
}