本文整理汇总了C++中put_str函数的典型用法代码示例。如果您正苦于以下问题:C++ put_str函数的具体用法?C++ put_str怎么用?C++ put_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put_str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cmd_s_dir_attributes
int cmd_s_dir_attributes(CalcHandle *h, const char *name)
{
VirtualPacket* pkt;
size_t len = strlen(name) < 8 ? 8 : strlen(name);
ticalcs_info(" unknown directory list command in <%s>:", name);
pkt = nsp_vtl_pkt_new_ex(1 + len + 1, NSP_SRC_ADDR, nsp_src_port, NSP_DEV_ADDR, PORT_FILE_MGMT);
pkt->cmd = CMD_FM_ATTRIBUTES;
pkt->data[0] = 0x01;
put_str(pkt->data + 1, name);
TRYF(nsp_send_data(h, pkt));
nsp_vtl_pkt_del(pkt);
return 0;
}
开发者ID:TI8XEmulator,项目名称:graph89,代码行数:18,代码来源:nsp_cmd.c
示例2: prt_sp
/*
* Prints players max/cur spell points
*/
static void prt_sp(int row, int col)
{
char cur_sp[32], max_sp[32];
byte color = player_sp_attr();
/* Do not show mana unless we have some */
if (!p_ptr->msp) return;
put_str("SP ", row, col);
strnfmt(max_sp, sizeof(max_sp), "%4d", p_ptr->msp);
strnfmt(cur_sp, sizeof(cur_sp), "%4d", p_ptr->csp);
/* Show mana */
c_put_str(color, cur_sp, row, col + 3);
c_put_str(TERM_WHITE, "/", row, col + 7);
c_put_str(TERM_L_GREEN, max_sp, row, col + 8);
}
开发者ID:NickMcConnell,项目名称:RePosBand,代码行数:21,代码来源:xtra3.c
示例3: print_tomb
/**
* Display the tombstone
*/
static void print_tomb(void)
{
ang_file *fp;
char buf[1024];
int line = 0;
time_t death_time = (time_t)0;
Term_clear();
(void)time(&death_time);
/* Open the death file */
path_build(buf, sizeof(buf), ANGBAND_DIR_SCREENS, "dead.txt");
fp = file_open(buf, MODE_READ, FTYPE_TEXT);
if (fp) {
while (file_getl(fp, buf, sizeof(buf)))
put_str(buf, line++, 0);
file_close(fp);
}
line = 7;
put_str_centred(line++, 8, 8+31, "%s", op_ptr->full_name);
put_str_centred(line++, 8, 8+31, "the");
if (player->total_winner)
put_str_centred(line++, 8, 8+31, "Magnificent");
else
put_str_centred(line++, 8, 8+31, "%s", player->class->title[(player->lev - 1) / 5]);
line++;
put_str_centred(line++, 8, 8+31, "%s", player->class->name);
put_str_centred(line++, 8, 8+31, "Level: %d", (int)player->lev);
put_str_centred(line++, 8, 8+31, "Exp: %d", (int)player->exp);
put_str_centred(line++, 8, 8+31, "AU: %d", (int)player->au);
put_str_centred(line++, 8, 8+31, "Killed on Level %d", player->depth);
put_str_centred(line++, 8, 8+31, "by %s.", player->died_from);
line++;
put_str_centred(line++, 8, 8+31, "by %-.24s", ctime(&death_time));
}
开发者ID:Axydlbaaxr,项目名称:angband,代码行数:47,代码来源:ui-death.c
示例4: subtest_xhp
/*
** subtest_xhp(test_list, status, ch)
**
** (xhp) erase does not clear standout mode
*/
static void
subtest_xhp(
struct test_list *t,
int *state,
int *ch)
{
if (enter_standout_mode) {
put_crlf();
put_mode(enter_standout_mode);
put_str("Stand out");
put_mode(exit_standout_mode);
put_cr();
ptextln("If any part of this line is standout then (xhp) should be set.");
sprintf(temp, "(xhp) Erase-standout-glitch is %s in the data base",
ceol_standout_glitch ? "true" : "false");
ptextln(temp);
generic_done_message(t, state, ch);
}
}
开发者ID:enthought,项目名称:ncurses-5.5,代码行数:24,代码来源:modes.c
示例5: f_zgetsyi
int f_zgetsyi( oprtype *a, opctype op)
{
triple *r;
r = maketriple(op);
if (!strexpr(&(r->operand[0])))
return FALSE;
if (window_token != TK_COMMA)
r->operand[1] = put_str("",0);
else
{
advancewindow();
if (!strexpr(&r->operand[1]))
return FALSE;
}
ins_triple(r);
*a = put_tref(r);
return TRUE;
}
开发者ID:5HT,项目名称:mumps,代码行数:19,代码来源:f_zgetsyi.c
示例6: subtest_rmam
/*
** subtest_rmam(test_list, status, ch)
**
** test exit automatic margins mode (rmam)
*/
static void
subtest_rmam(
struct test_list *t,
int *state,
int *ch)
{
int j;
if (!exit_am_mode) {
ptext("(rmam) not present. ");
} else
if (!can_go_home) {
ptext("(rmam) not tested, no way to home cursor. ");
} else
if (over_strike) {
put_clear();
go_home();
tc_putp(exit_am_mode);
ptext("\n(rmam) will reset (am)");
go_home();
for (j = 0; j < columns; j++)
put_this(' ');
ptext("(rmam) will not reset (am)");
go_home();
put_newlines(2);
} else {
put_clear();
go_home();
tc_putp(exit_am_mode);
ptext("\n(rmam) will reset (am)");
go_home();
for (j = 0; j < columns; j++)
put_this(' ');
ptext("(rmam) will not reset (am) ");
go_home();
put_str(" ");
go_home();
put_newlines(2);
}
ptext("Exit-automatic-margins ");
generic_done_message(t, state, ch);
}
开发者ID:enthought,项目名称:ncurses-5.5,代码行数:47,代码来源:modes.c
示例7: dump_modules
static void dump_modules(int sel, int max)
{
int i;
char buf[40], pre = ' ', post = ')';
cptr name;
char ind;
for (i = 0; i < max; i++)
{
ind = I2A(i % 26);
if (i >= 26) ind = toupper(ind);
if (sel == i)
{
pre = '[';
post = ']';
}
else
{
pre = ' ';
post = ')';
}
call_lua("get_module_name", "(d)", "s", i, &name);
strnfmt(buf, 40, "%c%c%c %s", pre, ind, post, name);
if (sel == i)
{
call_lua("get_module_desc", "(d)", "s", i, &name);
print_desc_aux(name, 5, 0);
c_put_str(TERM_L_BLUE, buf, 10 + (i / 4), 20 * (i % 4));
}
else
put_str(buf, 10 + (i / 4), 20 * (i % 4));
}
}
开发者ID:AmyBSOD,项目名称:ToME-SX,代码行数:40,代码来源:modules.c
示例8: subtest_in
/*
** subtest_in(test_list, status, ch)
**
** (in) insert null glitch
*/
static void
subtest_in(
struct test_list *t,
int *state,
int *ch)
{
if (enter_insert_mode && exit_insert_mode) {
ptextln("\nTesting (in) with (smir) and (rmir)");
putln("\tIf these two lines line up ...");
put_str("\tIf these two lines line up ...");
put_cr();
tc_putp(enter_insert_mode);
putchp(' ');
tc_putp(exit_insert_mode);
ptext("\nthen (in) should be set. ");
sprintf(temp,
"(in) Insert-null-glitch is %s in the data base.",
insert_null_glitch ? "true" : "false");
ptextln(temp);
generic_done_message(t, state, ch);
}
}
开发者ID:enthought,项目名称:ncurses-5.5,代码行数:27,代码来源:modes.c
示例9: put_columns
void
put_columns(const char *s, int len, int w)
{ /* put out s in column format */
int l;
if (char_count + w > columns) {
put_crlf();
}
l = char_count % w;
if (l) {
while (l < w) {
putchp(' ');
l++;
}
}
if (char_count && char_count + len >= columns) {
put_crlf();
}
l = char_count;
put_str(s);
char_count = l + len;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:22,代码来源:output.c
示例10: put_inf2r
/* -- output a header format '111 (222)' -- */
static void put_inf2r(struct SYMBOL *s1,
struct SYMBOL *s2,
int action)
{
char buf[256], *p, *q;
if (s1 == 0) {
s1 = s2;
s2 = 0;
}
p = s1->as.text;
if (p[1] == ':')
p += 2;
while (isspace((unsigned char) *p))
p++;
if (s1->as.text[0] == 'T' && s1->as.text[1] == ':')
p = trim_title(p, s1 == info['T' - 'A']);
if (s2 != 0) {
buf[sizeof buf - 1] = '\0';
strncpy(buf, p, sizeof buf - 1);
q = buf + strlen(buf);
if (q < buf + sizeof buf - 4) {
*q++ = ' ';
*q++ = '(';
p = s2->as.text;
if (p[1] == ':')
p += 2;
while (isspace((unsigned char) *p))
p++;
strncpy(q, p, buf + sizeof buf - 2 - q);
q += strlen(q);
*q++ = ')';
*q = '\0';
}
p = buf;
}
put_str(p, action);
}
开发者ID:OS2World,项目名称:MM-UTIL-ABCM2PS,代码行数:39,代码来源:subs.c
示例11: put_value
static void
put_value (Sophon_VM *vm, Sophon_IOFunc func, Sophon_Ptr data,
Sophon_Value v)
{
if (sophon_value_is_undefined(v)) {
put_u8(func, data, TAG_UNDEF);
} else if (sophon_value_is_null(v)) {
put_u8(func, data, TAG_NULL);
} else if (sophon_value_is_bool(v)) {
Sophon_Bool b;
b = sophon_value_to_bool(vm, v);
put_u8(func, data, TAG_BOOL);
put_u8(func, data, b ? 1 : 0);
} else if (sophon_value_is_string(v)) {
Sophon_String *str;
sophon_value_to_string(vm, v, &str);
put_u8(func, data, (str->gc_flags & SOPHON_GC_FL_INTERN) ?
TAG_INTERN_STRING : TAG_STRING);
put_str(vm, func, data, str);
} else if (sophon_value_is_number(v)) {
Sophon_Number n;
sophon_value_to_number(vm, v, &n);
if (n == (Sophon_Number)(Sophon_Int)(n)) {
put_u8(func, data, TAG_INT);
put_u32(func, data, (Sophon_Int)n);
} else {
put_u8(func, data, TAG_DOUBLE);
put_double(func, data, n);
}
} else {
SOPHON_ASSERT(0);
}
}
开发者ID:sharpglasses,项目名称:SophonJS,代码行数:37,代码来源:sophon_insfile.c
示例12: crum_ll
/*
** crum_ll(test_list, status, ch)
**
** (ll) test Last line
*/
static void
crum_ll(
struct test_list *t,
int *state,
int *ch)
{
/*
(ll) may be simulated with (cup). Don't complain if (cup) is present.
*/
if (cursor_to_ll) {
put_clear();
put_str("This line could be anywhere.");
tc_putp(cursor_to_ll);
ptext("This line should be on the bottom");
go_home();
put_crlf();
} else
if (cursor_address) {
return;
} else {
ptextln("(ll) Move to last line is not defined. ");
}
generic_done_message(t, state, ch);
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:29,代码来源:crum.c
示例13: execute_pipe
int execute_pipe(char *str)
{
char **put_in_sst;
char ***temp;
if (str)
{
put_in_sst = put_in_ss(str);
if (put_in_sst)
{
temp = put_in_sss(put_in_sst);
if (temp)
{
loop_pipe(temp);
freed(temp);
}
ft_free2d(put_in_sst);
}
return (1);
}
else
put_str(ANSI_COLOR_RED"str passed to pipe is 'NULL'"ANSI_COLOR_RESET);
return (0);
}
开发者ID:lmatshay,项目名称:N.L-Matshaya,代码行数:24,代码来源:gen_pipes.c
示例14: line_pattern
static void
line_pattern(void)
{ /* put up a pattern that will help count the
number of lines */
int i, j;
put_clear();
if (over_strike) {
for (i = 0; i < 100; i++) {
if (i) {
put_crlf();
}
for (j = i / 10; j; j--) {
put_this(' ');
}
put_this('0' + ((i + 1) % 10));
}
} else /* I assume it will scroll */ {
for (i = 100; i; i--) {
sprintf(temp, "\r\n%d", i);
put_str(temp);
}
}
}
开发者ID:SamB,项目名称:debian-tack,代码行数:24,代码来源:fun.c
示例15: put_func
static void
put_func (Sophon_VM *vm, Sophon_IOFunc func, Sophon_Ptr data,
Sophon_Function *f)
{
StoreVarParams svp;
Sophon_U16 i;
SOPHON_ASSERT(!(f->flags & SOPHON_FUNC_FL_NATIVE));
if (f->name)
put_str(vm, func, data, f->name);
else
put_u32(func, data, 0);
put_u8(func, data, f->flags);
put_u8(func, data, f->argc);
put_u16(func, data, f->varc);
put_u16(func, data, f->stack_size);
put_u16(func, data, f->ibuf_size);
SOPHON_ASSERT(f->var_hash.count == f->varc + f->argc);
svp.func = func;
svp.data = data;
sophon_hash_for_each(vm, &f->var_hash, store_var, &svp);
func(data, f->f.ibuf, f->ibuf_size);
#ifdef SOPHON_LINE_INFO
put_u16(func, data, f->lbuf_size);
for (i = 0; i < f->lbuf_size; i++) {
put_u16(func, data, f->lbuf[i].line);
put_u16(func, data, f->lbuf[i].offset);
}
#endif
}
开发者ID:sharpglasses,项目名称:SophonJS,代码行数:36,代码来源:sophon_insfile.c
示例16: cmd_s_put_file
int cmd_s_put_file(CalcHandle *h, const char *name, uint32_t size)
{
VirtualPacket* pkt;
int o;
size_t len = strlen(name) < 8 ? 8 : strlen(name);
ticalcs_info(" sending variable:");
pkt = nsp_vtl_pkt_new_ex(6 + len, NSP_SRC_ADDR, nsp_src_port, NSP_DEV_ADDR, PORT_FILE_MGMT);
pkt->cmd = CMD_FM_PUT_FILE;
pkt->data[0] = 0x01;
o = put_str(pkt->data + 1, name);
o++;
pkt->data[o+0] = MSB(MSW(size));
pkt->data[o+1] = LSB(MSW(size));
pkt->data[o+2] = MSB(LSW(size));
pkt->data[o+3] = LSB(LSW(size));
TRYF(nsp_send_data(h, pkt));
nsp_vtl_pkt_del(pkt);
return 0;
}
开发者ID:TI8XEmulator,项目名称:graph89,代码行数:24,代码来源:nsp_cmd.c
示例17: display_winner
/*
* Display the winner crown
*/
static void display_winner(void)
{
char buf[1024];
ang_file *fp;
int wid, hgt;
int i = 2;
int width = 0;
path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "crown.txt");
fp = file_open(buf, MODE_READ, -1);
Term_clear();
Term_get_size(&wid, &hgt);
if (fp)
{
/* Get us the first line of file, which tells us how long the */
/* longest line is */
file_getl(fp, buf, sizeof(buf));
sscanf(buf, "%d", &width);
if (!width) width = 25;
/* Dump the file to the screen */
while (file_getl(fp, buf, sizeof(buf)))
put_str(buf, i++, (wid/2) - (width/2));
file_close(fp);
}
put_str_centred(i, 0, wid, "All Hail the Mighty %s!", p_ptr->sex->winner);
flush();
pause_line(Term);
}
开发者ID:BlackDragonB,项目名称:angband,代码行数:39,代码来源:death.c
示例18: get_mane_power
/*
* Allow user to choose a imitation.
*
* If a valid spell is chosen, saves it in '*sn' and returns TRUE
* If the user hits escape, returns FALSE, and set '*sn' to -1
* If there are no legal choices, returns FALSE, and sets '*sn' to -2
*
* The "prompt" should be "cast", "recite", or "study"
* The "known" should be TRUE for cast/pray, FALSE for study
*
* nb: This function has a (trivial) display bug which will be obvious
* when you run it. It's probably easy to fix but I haven't tried,
* sorry.
*/
static int get_mane_power(int *sn, bool baigaesi)
{
int i = 0;
int num = 0;
int y = 1;
int x = 18;
int minfail = 0;
int plev = p_ptr->lev;
int chance = 0;
int ask;
char choice;
char out_val[160];
char comment[80];
#ifdef JP
cptr p = "能力";
#else
cptr p = "power";
#endif
monster_power spell;
bool flag, redraw;
/* Assume cancelled */
*sn = (-1);
/* Nothing chosen yet */
flag = FALSE;
/* No redraw yet */
redraw = FALSE;
num = p_ptr->mane_num;
/* Build a prompt (accept all spells) */
(void)strnfmt(out_val, 78,
#ifdef JP
"(%c-%c, '*'で一覧, ESC) どの%sをまねますか?",
#else
"(%c-%c, *=List, ESC=exit) Use which %s? ",
#endif
I2A(0), I2A(num - 1), p);
/* Get a spell from the user */
choice= always_show_list ? ESCAPE:1 ;
while (!flag)
{
if(choice==ESCAPE) choice = ' ';
else if( !get_com(out_val, &choice, TRUE) )break;
/* Request redraw */
if ((choice == ' ') || (choice == '*') || (choice == '?'))
{
/* Show the list */
if (!redraw)
{
char psi_desc[80];
/* Show list */
redraw = TRUE;
/* Save the screen */
screen_save();
/* Display a list of spells */
prt("", y, x);
#ifdef JP
put_str("名前", y, x + 5);
#else
put_str("Name", y, x + 5);
#endif
#ifdef JP
put_str("失率 効果", y, x + 36);
#else
put_str("Fail Info", y, x + 35);
#endif
/* Dump the spells */
for (i = 0; i < num; i++)
{
/* Access the spell */
spell = monster_powers[p_ptr->mane_spell[i]];
chance = spell.manefail;
//.........这里部分代码省略.........
开发者ID:dplusplus,项目名称:hengband_njslyr,代码行数:101,代码来源:mane.c
示例19: m_job
int m_job(void)
{
int argcnt;
triple *ref,*next;
oprtype label, offset, routine, plist, timeout, arglst, *argptr, argval;
static readonly unsigned char empty_plist[1] = { jp_eol };
bool is_timeout,dummybool;
error_def(ERR_MAXACTARG);
error_def(ERR_RTNNAME);
error_def(ERR_COMMAORRPARENEXP);
error_def(ERR_JOBACTREF);
label = put_str(zero_ident.c,sizeof(mident));
offset = put_ilit((mint)0);
if (!lref(&label, &offset, FALSE, indir_job, TRUE, &dummybool))
return FALSE;
if ((TRIP_REF == label.oprclass) && (OC_COMMARG == label.oprval.tref->opcode))
return TRUE;
if (TK_CIRCUMFLEX != window_token)
{
if (!run_time)
routine = put_str(routine_name,sizeof(mident));
else
routine = put_tref(newtriple(OC_CURRTN));
} else
{
advancewindow();
switch(window_token)
{
case TK_IDENT:
routine = put_str(window_ident.c,sizeof(mident));
advancewindow();
break;
case TK_ATSIGN:
if (!indirection(&routine))
return FALSE;
break;
default:
stx_error(ERR_RTNNAME);
return FALSE;
}
}
argcnt = 0;
if (TK_LPAREN == window_token)
{
advancewindow();
argptr = &arglst;
while(TK_RPAREN != window_token)
{
if (argcnt > MAX_ACTUALS)
{
stx_error(ERR_MAXACTARG);
return FALSE;
}
if (TK_PERIOD == window_token)
{
stx_error(ERR_JOBACTREF);
return FALSE;
}
if (!expr(&argval))
return FALSE;
ref = newtriple(OC_PARAMETER);
ref->operand[0] = argval;
*argptr = put_tref(ref);
argptr = &ref->operand[1];
argcnt++;
if (TK_COMMA == window_token)
advancewindow();
else if (TK_RPAREN != window_token)
{
stx_error(ERR_COMMAORRPARENEXP);
return FALSE;
}
}
advancewindow(); /* jump over close paren */
}
if (TK_COLON == window_token)
{
advancewindow();
if (TK_COLON == window_token)
{
is_timeout = TRUE;
plist = put_str((char *)empty_plist,sizeof(empty_plist));
} else
{
if (!jobparameters(&plist))
return FALSE;
is_timeout = (TK_COLON == window_token);
}
if (is_timeout)
{
advancewindow();
if (!intexpr(&timeout))
return FALSE;
} else
timeout = put_ilit(NO_M_TIMEOUT);
} else
{
is_timeout = FALSE;
//.........这里部分代码省略.........
开发者ID:h4ck3rm1k3,项目名称:FIS-GT.M,代码行数:101,代码来源:m_job.c
示例20: display_scores_aux
/*
* Display the scores in a given range.
*/
static void display_scores_aux(const high_score scores[], int from, int to, int highlight)
{
char ch;
int j, k, n, place;
int count;
/* Assume we will show the first 10 */
if (from < 0) from = 0;
if (to < 0) to = 10;
if (to > MAX_HISCORES) to = MAX_HISCORES;
/* Hack -- Count the high scores */
for (count = 0; count < MAX_HISCORES; count++)
{
if (!scores[count].what[0]) break;
}
/* Forget about the last entries */
if (count > to) count = to;
/* Show 5 per page, until "done" */
for (k = from, j = from, place = k+1; k < count; k += 5)
{
char out_val[160];
char tmp_val[160];
/* Clear screen */
Term_clear();
/* Title */
put_str(format("%s Hall of Fame", VERSION_NAME), 0, 26);
/* Indicate non-top scores */
if (k > 0)
put_str(format("(from position %d)", place), 0, 40);
/* Dump 5 entries */
for (n = 0; j < count && n < 5; place++, j++, n++)
{
const high_score *score = &scores[j];
byte attr;
int pr, pc, clev, mlev, cdun, mdun;
cptr user, gold, when, aged;
/* Hack -- indicate death in yellow */
attr = (j == highlight) ? TERM_L_GREEN : TERM_WHITE;
/* Extract the race/class */
pr = atoi(score->p_r);
pc = atoi(score->p_c);
/* Extract the level info */
clev = atoi(score->cur_lev);
mlev = atoi(score->max_lev);
cdun = atoi(score->cur_dun);
mdun = atoi(score->max_dun);
/* Hack -- extract the gold and such */
for (user = score->uid; isspace((unsigned char)*user); user++) /* loop */;
for (when = score->day; isspace((unsigned char)*when); when++) /* loop */;
for (gold = score->gold; isspace((unsigned char)*gold); gold++) /* loop */;
for (aged = score->turns; isspace((unsigned char)*aged); aged++) /* loop */;
/* Dump some info */
strnfmt(out_val, sizeof(out_val),
"%3d.%9s %s the %s %s, Level %d",
place, score->pts, score->who,
p_info[pr].name, c_info[pc].name,
clev);
/* Append a "maximum level" */
if (mlev > clev) my_strcat(out_val, format(" (Max %d)", mlev), sizeof(out_val));
/* Dump the first line */
c_put_str(attr, out_val, n*4 + 2, 0);
/* Died where? */
if (!cdun)
strnfmt(out_val, sizeof(out_val), "Killed by %s in the town", score->how);
else
strnfmt(out_val, sizeof(out_val), "Killed by %s on dungeon level %d", score->how, cdun);
/* Append a "maximum level" */
if (mdun > cdun)
my_strcat(out_val, format(" (Max %d)", mdun), sizeof(out_val));
/* Dump the info */
c_put_str(attr, out_val, n*4 + 3, 15);
//.........这里部分代码省略.........
开发者ID:EpicMan,项目名称:angband,代码行数:101,代码来源:score.c
注:本文中的put_str函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论