本文整理汇总了C++中put_str函数的典型用法代码示例。如果您正苦于以下问题:C++ put_str函数的具体用法?C++ put_str怎么用?C++ put_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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));
}
示例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);
}
}
示例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;
}
示例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);
}
示例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));
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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
}