本文整理汇总了C++中HAS_BIT函数的典型用法代码示例。如果您正苦于以下问题:C++ HAS_BIT函数的具体用法?C++ HAS_BIT怎么用?C++ HAS_BIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAS_BIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spec_janitor
SPEC_RET spec_janitor( CHAR_DATA *ch )
{
OBJ_DATA *trash;
OBJ_DATA *trash_next;
if ( !is_awake(ch) )
return FALSE;
for ( trash = ch->in_room->first_content; trash; trash = trash_next )
{
trash_next = trash->next_content;
if ( !HAS_BIT(trash->wear_flags, OBJWEAR_TAKE) ) continue;
if ( HAS_BIT(trash->extra_flags, OBJFLAG_BURIED) ) continue;
if ( trash->type == OBJTYPE_DRINK_CON
|| trash->type == OBJTYPE_TRASH
|| trash->cost < 10
|| (trash->pObjProto->vnum == VNUM_OBJ_SHOPPING_BAG && !trash->first_content) )
{
act( AT_ACTION, "$n raccoglie della spazzatura.", ch, NULL, NULL, TO_ROOM );
obj_from_room( trash );
obj_to_char( trash, ch );
return TRUE;
}
}
return FALSE;
}
示例2: abort_handler
void abort_handler(int signal)
{
static char crashed = FALSE;
if (crashed)
{
exit(-1);
}
crashed = TRUE;
restore_terminal();
clean_screen(gtd->ses);
dump_stack();
fflush(NULL);
exit(-1);
if (gtd->ses->connect_retry > utime())
{
gtd->ses->connect_retry = 0;
}
else if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
{
socket_printf(gtd->ses, 1, "%c", 3);
}
else
{
do_zap(gtd->ses, "");
}
}
示例3: write_mud
void write_mud(struct session *ses, char *command, int flags)
{
char output[BUFFER_SIZE];
int size;
size = substitute(ses, command, output, flags);
if (HAS_BIT(ses->flags, SES_FLAG_MAPPING))
{
if (ses->map == NULL || ses->map->nofollow == 0)
{
check_insert_path(command, ses);
}
}
if (ses->map && ses->map->in_room && ses->map->nofollow == 0)
{
if (!HAS_BIT(ses->map->flags, MAP_FLAG_NOFOLLOW))
{
if (follow_map(ses, command))
{
return;
}
}
}
write_line_mud(ses, output, size);
}
示例4: process_input
void process_input(void)
{
if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
{
read_key();
}
else
{
read_line();
}
if (!HAS_BIT(gtd->flags, TINTIN_FLAG_PROCESSINPUT))
{
return;
}
DEL_BIT(gtd->flags, TINTIN_FLAG_PROCESSINPUT);
if (gtd->chat && gtd->chat->paste_time)
{
chat_paste(gtd->input_buf, NULL);
return;
}
if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
{
add_line_history(gtd->ses, gtd->input_buf);
}
if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
{
echo_command(gtd->ses, gtd->input_buf);
}
else
{
echo_command(gtd->ses, "");
}
if (gtd->ses->scroll_line != -1)
{
buffer_end(gtd->ses, "");
}
check_all_events(gtd->ses, SUB_ARG|SUB_SEC, 0, 1, "RECEIVED INPUT", gtd->input_buf);
gtd->ses = script_driver(gtd->ses, LIST_COMMAND, gtd->input_buf);
if (IS_SPLIT(gtd->ses))
{
erase_toeol();
}
gtd->input_buf[0] = 0;
}
示例5: echo_command
void echo_command(struct session *ses, char *line)
{
char buffer[STRING_SIZE], result[STRING_SIZE];
if (HAS_BIT(ses->flags, SES_FLAG_SPLIT))
{
sprintf(buffer, "%s%s\033[0m", ses->cmd_color, line);
}
else
{
sprintf(buffer, "%s", line);
}
/*
Deal with pending output
*/
if (ses->more_output[0])
{
if (ses->check_output)
{
strcpy(result, ses->more_output);
ses->more_output[0] = 0;
process_mud_output(ses, result, FALSE);
}
}
DEL_BIT(ses->telopts, TELOPT_FLAG_PROMPT);
if (HAS_BIT(ses->flags, SES_FLAG_SPLIT))
{
if (!HAS_BIT(ses->flags, SES_FLAG_ECHOCOMMAND))
{
sprintf(result, "\033[0;37m");
}
else
{
sprintf(result, "%s%s", ses->more_output, buffer);
}
add_line_buffer(ses, buffer, -1);
SET_BIT(ses->flags, SES_FLAG_SCROLLSTOP);
tintin_printf2(ses, "%s", result);
DEL_BIT(ses->flags, SES_FLAG_SCROLLSTOP);
}
else
{
add_line_buffer(ses, buffer, -1);
}
}
示例6: space_out
char *get_arg_stop_spaces(struct session *ses, char *string, char *result, int flag)
{
char *pto, *pti;
int nest = 0;
pti = space_out(string);
pto = result;
while (*pti)
{
if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0)
{
*pto++ = *pti++;
*pto++ = *pti++;
continue;
}
if (*pti == '\\' && pti[1] == COMMAND_SEPARATOR)
{
*pto++ = *pti++;
}
else if (*pti == COMMAND_SEPARATOR && nest == 0)
{
break;
}
else if (isspace((int) *pti) && nest == 0)
{
pti++;
break;
}
else if (*pti == DEFAULT_OPEN)
{
nest++;
}
else if (*pti == '[' && HAS_BIT(flag, GET_NST))
{
nest++;
}
else if (*pti == DEFAULT_CLOSE)
{
nest--;
}
else if (*pti == ']' && HAS_BIT(flag, GET_NST))
{
nest--;
}
*pto++ = *pti++;
}
*pto = '\0';
return pti;
}
示例7: printline
void printline(struct session *ses, char **str, int prompt)
{
char *out;
push_call("printline(%p,%p,%d)",ses,*str,prompt);
if (ses->scroll_line != -1 && HAS_BIT(ses->flags, SES_FLAG_SCROLLLOCK))
{
pop_call();
return;
}
if (HAS_BIT(ses->flags, SES_FLAG_SCAN) && !HAS_BIT(ses->flags, SES_FLAG_VERBOSE))
{
pop_call();
return;
}
out = str_alloc(strlen(*str) * 2);
if (HAS_BIT(ses->flags, SES_FLAG_CONVERTMETA))
{
convert_meta(*str, out);
str_cpy(str, out);
}
if (HAS_BIT(ses->flags, SES_FLAG_WORDWRAP))
{
word_wrap(ses, *str, out, TRUE);
}
else
{
strcpy(out, *str);
}
if (prompt)
{
printf("%s", out);
}
else
{
printf("%s\n", out);
}
str_free(out);
pop_call();
return;
}
示例8: interrupt_handler
void interrupt_handler(int signal)
{
if (gtd->ses->connect_retry > utime())
{
gtd->ses->connect_retry = 0;
}
else if (HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_SGA) && !HAS_BIT(gtd->ses->telopts, TELOPT_FLAG_ECHO))
{
socket_printf(gtd->ses, 1, "%c", 4);
}
else
{
cursor_delete_or_exit(gtd->ses, "");
}
}
示例9: space_out
char *get_arg_to_brackets(struct session *ses, char *string, char *result)
{
char *pti, *pto, *ptii, *ptoo;
int nest1 = 0, nest2 = 0, nest3 = 0;
pti = space_out(string);
pto = result;
ptii = ptoo = NULL;
while (*pti)
{
if (HAS_BIT(ses->flags, SES_FLAG_BIG5) && *pti & 128 && pti[1] != 0)
{
*pto++ = *pti++;
*pto++ = *pti++;
continue;
}
if (*pti == '[')
{
nest2++;
if (nest1 == 0 && ptii == NULL)
{
ptii = pti;
ptoo = pto;
}
}
else if (*pti == ']')
{
if (nest2)
{
nest2--;
}
else
{
nest3 = 1;
}
if (*(pti+1) == 0 && ptii && nest1 == 0 && nest2 == 0 && nest3 == 0)
{
*ptoo = 0;
return ptii;
}
}
else if (*pti == DEFAULT_OPEN)
{
nest1++;
}
else if (*pti == DEFAULT_CLOSE)
{
nest1--;
}
*pto++ = *pti++;
}
*pto = 0;
return pti;
}
示例10: add_line_history
void add_line_history(struct session *ses, char *line)
{
struct listroot *root;
root = ses->list[LIST_HISTORY];
if (*line == 0)
{
if (root->used && HAS_BIT(ses->flags, SES_FLAG_REPEATENTER))
{
strcpy(line, root->list[root->used - 1]->left);
}
return;
}
if (*line == gtd->repeat_char)
{
search_line_history(ses, line);
}
update_node_list(ses->list[LIST_HISTORY], line, "", "");
while (root->used > gtd->history_size)
{
delete_index_list(ses->list[LIST_HISTORY], 0);
}
return;
}
示例11: strip_vt102_strlen
int strip_vt102_strlen(struct session *ses, char *str)
{
char *pti;
int i = 0;
pti = str;
while (*pti)
{
if (skip_vt102_codes(pti))
{
pti += skip_vt102_codes(pti);
continue;
}
if (HAS_BIT(ses->flags, SES_FLAG_UTF8) && (*pti & 192) == 192)
{
pti++;
while ((*pti & 192) == 128)
{
pti++;
}
}
else
{
pti++;
}
i++;
}
return i;
}
示例12: winch_handler
void winch_handler(int signal)
{
struct session *ses;
init_screen_size(gts);
for (ses = gts->next ; ses ; ses = ses->next)
{
init_screen_size(ses);
if (HAS_BIT(ses->telopts, TELOPT_FLAG_NAWS))
{
send_sb_naws(ses, 0, NULL);
}
}
/*
we have to reinitialize the signals for sysv machines
if (signal(SIGWINCH, winch_handler) == BADSIG)
{
syserr("signal SIGWINCH");
}
*/
}
示例13: check_one_regexp
int check_one_regexp(struct session *ses, struct listnode *node, char *line, char *original, int option)
{
char *exp, *str;
if (node->regex == NULL)
{
char result[BUFFER_SIZE];
substitute(ses, node->left, result, SUB_VAR|SUB_FUN);
exp = result;
}
else
{
exp = node->left;
}
if (HAS_BIT(node->flags, NODE_FLAG_META))
{
exp++;
str = original;
}
else
{
str = line;
}
return tintin_regexp(ses, node->regex, str, exp, option, SUB_ARG);
}
示例14: DoExtDiskSpace
void DoExtDiskSpace(tBuffer *bIn, tBuffer *bOut, u_int32_t id)
{
struct STATFS stfs;
tFSPath *realPath;
char *path;
path = convertFromUtf8(BufferGetString(bIn), 1);
realPath = FSCheckPath(path);
DEBUG((MYLOG_DEBUG, "[DoExtDiskSpaceOpenSSH]Path: %s", path));
if (realPath != NULL && !HAS_BIT(gl_var->flagsDisable, SFTP_DISABLE_STATSFS))
{
DEBUG((MYLOG_DEBUG, "[DoExtDiskSpaceOpenSSH]Realpath: %s", realPath->realPath));
if (STATFS(realPath->realPath, &stfs) == 0)
{
tBuffer *b;
b = BufferNew();
BufferPutInt8(b, SSH2_FXP_EXTENDED_REPLY);
BufferPutInt32(b, id);
BufferPutInt64(b, (u_int64_t) stfs.f_blocks * (u_int64_t) stfs.f_bsize);
BufferPutInt64(b, (u_int64_t) stfs.f_bfree * (u_int64_t) stfs.f_bsize);
BufferPutInt64(b, 0);
BufferPutInt64(b, (u_int64_t) stfs.f_bavail * (u_int64_t) stfs.f_bsize);
BufferPutInt32(b, stfs.f_bsize);
BufferPutPacket(bOut, b);
}
else
SendStatus(bOut, id, errnoToPortable(errno));
}
else
SendStatus(bOut, id, SSH2_FX_PERMISSION_DENIED);
FSDestroyPath(realPath);
free(path);
}
示例15: show_session
void show_session(struct session *ses, struct session *ptr)
{
char temp[BUFFER_SIZE];
sprintf(temp, "%3d %-12s %20s:%-5s", ptr->socket, ptr->name, ptr->host, ptr->port);
if (ptr == gtd->ses)
{
strcat(temp, " (active)");
}
else
{
strcat(temp, " ");
}
if (ptr->mccp)
{
strcat(temp, " (mccp) ");
}
if (HAS_BIT(ptr->flags, SES_FLAG_SNOOP))
{
strcat(temp, " (snooped)");
}
if (ptr->logfile)
{
strcat(temp, " (logging)");
}
tintin_puts2(ses, temp);
}