您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FLAGS函数代码示例

51自学网 2021-06-01 20:41:33
  C++
这篇教程C++ FLAGS函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FLAGS函数的典型用法代码示例。如果您正苦于以下问题:C++ FLAGS函数的具体用法?C++ FLAGS怎么用?C++ FLAGS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FLAGS函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Kpp_DeleteFunc

BOOL PEXPORT Kpp_DeleteFunc(FUNCID idFunc){    LPFUNC lpFunc = (LPFUNC) KppGetItem(FUNC, idFunc);        if (!lpFunc)        return ERROR;    if (FLAGS(lpFunc) & ITEMOPEN)        return KppRegisterKappaMessage(hResThisDll, IDE_BEINGEDITED,                                       lpIDs->idError, NAME(lpFunc), NULLID);    /* Check for system defined function */    if (FLAGS(lpFunc) & UNDELETABLE)    {        KppReleaseItem(FUNC, idFunc);        return KppRegisterKappaMessage(hResThisDll, IDE_NOSYSDELETE,                                       lpIDs->idError, NAME(lpFunc), NULLID);    }    /* first clear up the function */    Kpp__ResetFunc(lpFunc);    /* then delete the func itself */    KppReleaseItem(FUNC, idFunc);    KppDeleteItem(FUNC, idFunc);    /* Add to KnowledgeTools */    KppAddItemCB(FUNC, -1);    return TRUE;}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:31,


示例2: __CopyRule

RULEID __CopyRule(LPRULE lpOldRule, ITEMID idName){#ifdef INFERENCE    RULEID      idRule;    LPRULE      lpRule;    LPEXP       lpBody;    EXPID       idBody;    if (GetRule(idName) != NULLID)        return NULLID;        idRule = KppAddItemAndName (RULE, (LPLPSTR)&lpRule, idName);    if (!idRule)        return NULLID;    NAME(lpRule) = idName;    FLAGS(lpRule) = NULL;    PRIORITY(lpRule) = 0;    MATCHES(lpRule) = NULLID;    NUMVARS(lpRule) = NUMVARS(lpOldRule);    if (! (FLAGS(lpRule) & CBODY))    {        VARS(lpRule) = KppDeepListCopy(VARS(lpOldRule), Kpp__CopyVar,idRule);        idBody = BODY(lpRule) = KppCopyExp(                        BODY(lpOldRule), (LPLPSTR)&lpBody, kPERMMODE);        KppReleaseExp(idBody);    }    KppReleaseItem(RULE, idRule);    /* Add to KnowledgeTools */    KppAddItemCB (RULE, 1);    return idRule;#endif}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:34,


示例3: can_see

boolcan_see(dbref player, dbref thing, bool can_see_loc){    if (!OkObj(player) || !OkObj(thing))        return 0;    if (player == thing || Typeof(thing) == TYPE_EXIT        || Typeof(thing) == TYPE_ROOM)        return 0;    if (Light(thing))        return 1;    if (can_see_loc) {        switch (Typeof(thing)) {            case TYPE_PROGRAM:                return ((FLAGS(thing) & LINK_OK) || controls(player, thing)                        || (POWERS(player) & POW_SEE_ALL));            case TYPE_PLAYER:                if (tp_dark_sleepers) {                    return (!Dark(thing) || online(thing)                            || (POWERS(player) & POW_SEE_ALL));                }            default:                return (!Dark(thing) || (POWERS(player) & POW_SEE_ALL) ||                        (controls(player, thing) && !(FLAGS(player) & STICKY)));        }    } else {        /* can't see loc */        return (controls(player, thing) && !(FLAGS(player) & STICKY));    }}
开发者ID:nekosune,项目名称:protomuck,代码行数:33,


示例4: Kpp_DeleteGoal

BOOL PEXPORT Kpp_DeleteGoal(GOALID idGoal){#ifdef INFERENCE    ATOMID idName;    LPGOAL lpGoal;    if ((lpGoal = (LPGOAL) KppGetItem(GOAL, idGoal)) == NULL)        return ERROR;    if (FLAGS (lpGoal) & ITEMOPEN)        return KppRegisterKappaMessage (hResThisDll,             IDE_BEINGEDITED, lpIDs->idError, NAME(lpGoal), NULLID);    /* Check for system defined goal */    if (FLAGS(lpGoal) & UNDELETABLE)        {        idName = NAME (lpGoal);        KppReleaseItem(GOAL, idGoal);        return KppRegisterKappaMessage (hResThisDll,             IDE_NOSYSDELETE,lpIDs->idError, idName, NULLID);        } /* if */    /* reset the goal contents */    Kpp__ResetGoal(lpGoal);    /* then delete the goal itself */    KppReleaseItem(GOAL, idGoal);    KppDeleteItem(GOAL, idGoal);    /* Add to KnowledgeTools */    KppAddItemCB (GOAL, -1);#endif    return TRUE;}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:34,


示例5: SetMarkFile

/*** SetMarkFile - Change markfile** Purpose:**   Changes to a new markfile.** Input:*   val - String after the 'markfile' switch** Output:**   Returns Error string if error, NULL otherwise** Notes:**   We:** UNDONE:o Magically ensure that the current markfile is up to date and*	  saved to disk.  This means, at the very least, that there*	  can be no dirty files.**	o Remove the current markfile from the file list.**	o Read in the new markfile.**	o Invalidate all current marks.  This is just marking them*	  invalid in the PFILE.***************************************************************************/char *SetMarkFile (    char *val    ) {    REGISTER PFILE pFile;    buffer  tmpval;    pathbuf pathname;    strcpy ((char *) tmpval, val);    if (NULL == CanonFilename (tmpval, pathname)) {        sprintf (buf, "'%s': name is malformed", tmpval);        return buf;    }    if (!(pFile = FileNameToHandle (pathname, NULL))) {        pFile = AddFile (pathname);    }    if (!TESTFLAG(FLAGS(pFile), REAL) && !FileRead (pathname, pFile, FALSE)) {        RemoveFile (pFile);        sprintf (buf, "'%s' - %s", pathname, error());        return buf;    }    pFileMark = pFile;    for (pFile = pFileHead; pFile; pFile = pFile->pFileNext) {        if (!TESTFLAG(FLAGS(pFile), FAKE)) {            RSETFLAG (FLAGS(pFile), VALMARKS);        }    }    return NULL;}
开发者ID:mingpen,项目名称:OpenNT,代码行数:65,


示例6: opt_default

int opt_default(const char *opt, const char *arg){    const AVOption *oc, *of, *os;    char opt_stripped[128];    const char *p;    const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc;    if (!(p = strchr(opt, ':')))        p = opt + strlen(opt);    av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1));    if ((oc = av_opt_find(&cc, opt_stripped, NULL, 0, AV_OPT_SEARCH_CHILDREN|AV_OPT_SEARCH_FAKE_OBJ)) ||         ((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&          (oc = av_opt_find(&cc, opt+1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ))))        av_dict_set(&codec_opts, opt, arg, FLAGS(oc));    if ((of = av_opt_find(&fc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))        av_dict_set(&format_opts, opt, arg, FLAGS(of));#if CONFIG_SWSCALE    sc = sws_get_class();    if ((os = av_opt_find(&sc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {        // XXX we only support sws_flags, not arbitrary sws options        int ret = av_set_string3(sws_opts, opt, arg, 1, NULL);        if (ret < 0) {            av_log(NULL, AV_LOG_ERROR, "Error setting option %s./n", opt);            return ret;        }    }#endif    if (oc || of || os)        return 0;    av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'/n", opt);    return AVERROR_OPTION_NOT_FOUND;}
开发者ID:Tjoppen,项目名称:FFmpeg,代码行数:34,


示例7: skipproperties

voidskipproperties(FILE * f, dbref obj){    char buf[BUFFER_LEN * 3];    int islisten = 0;    /* get rid of first line */    fgets(buf, sizeof(buf), f);    fgets(buf, sizeof(buf), f);    while (strcmp(buf, "*End*/n")) {        if (!islisten) {            if (string_prefix(buf, "_listen"))                islisten = 1;            if (string_prefix(buf, "~listen"))                islisten = 1;            if (string_prefix(buf, "~olisten"))                islisten = 1;        }        fgets(buf, sizeof(buf), f);    }    if (islisten) {        FLAGS(obj) |= LISTENER;    } else {        FLAGS(obj) &= ~LISTENER;    }}
开发者ID:revarbat,项目名称:fuzzball,代码行数:27,


示例8: unparse_object

const char *unparse_object(dbref player, dbref loc){	static char buf[BUFFER_LEN];	if (player == NOTHING)		goto islog;	if (Typeof(player) != TYPE_PLAYER)		player = OWNER(player);islog:	switch (loc) {	case NOTHING:		return "*NOTHING*";	case AMBIGUOUS:		return "*AMBIGUOUS*";	case HOME:		return "*HOME*";	default:		if (loc < 0 || loc >= db_top)			return "*INVALID*";		if ((player == NOTHING) || (!(FLAGS(player) & STICKY) &&			(can_link_to(player, NOTYPE, loc) ||			 ((Typeof(loc) != TYPE_PLAYER) &&			  (controls_link(player, loc) || (FLAGS(loc) & CHOWN_OK)))))) {			/* show everything */			snprintf(buf, sizeof(buf), "%.*s(#%d%s)", (BUFFER_LEN / 2), NAME(loc), loc, unparse_flags(loc));			return buf;		} else {			/* show only the name */			return NAME(loc);		}	}}
开发者ID:UnderSampled,项目名称:RAOAMUCK,代码行数:33,


示例9: Kpp_DeleteRule

BOOL PEXPORT Kpp_DeleteRule(RULEID idRule){#ifdef INFERENCE    ATOMID idName;    LPRULE lpRule;    if ((lpRule = (LPRULE) KppGetItem(RULE, idRule)) == NULL)        return ERROR;    if (FLAGS (lpRule) & ITEMOPEN)        return KppRegisterKappaMessage (hResThisDll,             IDE_BEINGEDITED, lpIDs->idError, NAME(lpRule), NULLID);    /* Check for system defined rule */    if (FLAGS(lpRule) & UNDELETABLE)        {        idName = NAME (lpRule);        KppReleaseItem(RULE, idRule);        return KppRegisterKappaMessage (hResThisDll,                 IDE_NOSYSDELETE,lpIDs->idError, idName, NULLID);        } /* if */    /* first clear up the rule */    Kpp__ResetRule(lpRule);    /* finally delete the rule itself */    KppReleaseItem(RULE, idRule);    KppDeleteItem(RULE, idRule);    /* Add to KnowledgeTools */    KppAddItemCB (RULE, -1);    KppChangeRuleCB ();    #endif    return TRUE;}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:35,


示例10: do_prog

/*  Use this to create a program.  First, find a program that matches that name.  If there's one,  then we put him into edit mode and do it.  Otherwise, we create a new object for him, and call it a program.  */voiddo_prog(int descr, dbref player, const char *name){    dbref i;    struct match_data md;    if (Typeof(player) != TYPE_PLAYER) {        anotify_nolisten2(player, CFAIL "Only players can edit programs.");        return;    } else if (!Mucker(player)) {        anotify_nolisten2(player, CFAIL NOMBIT_MESG);        return;    } else if (!tp_building || tp_db_readonly) {        anotify_nolisten2(player, CFAIL NOBUILD_MESG);        return;    } else if (!*name) {        anotify_nolisten2(player, CINFO "No program name given.");        return;    }    init_match(descr, player, name, TYPE_PROGRAM, &md);    match_possession(&md);    match_neighbor(&md);    match_registered(&md);    match_absolute(&md);    if ((i = match_result(&md)) == NOTHING) {        i = new_program(OWNER(player), name);        FLAGS(i) |= INTERNAL;        DBFETCH(player)->sp.player.curr_prog = i;        anotify_fmt(player, CSUCC "Program %s created with number %d.", name,                    i);        anotify_nolisten2(player, CINFO "Entering editor.");    } else if (i == AMBIGUOUS) {        anotify_nolisten2(player, CINFO "I don't know which one you mean!");        return;    } else {        if ((Typeof(i) != TYPE_PROGRAM) || !controls(player, i)) {            anotify_fmt(player, CFAIL "%s", tp_noperm_mesg);            return;        } else if (FLAGS(i) & INTERNAL) {            anotify_nolisten2(player, CFAIL NOEDIT_MESG);            return;        }        DBFETCH(i)->sp.program.first = read_program(i);        FLAGS(i) |= INTERNAL;        DBFETCH(player)->sp.player.curr_prog = i;        anotify_fmt(player, CINFO "Entering editor for %s.",                    unparse_object(player, i));        /* list current line */        do_list(player, i, 0, 0, 0);        DBDIRTY(i);    }    FLAGS(player) |= INTERACTIVE;    DBDIRTY(player);}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:65,


示例11: could_doit

/* * could_doit: Checks to see if player could actually do what is proposing * to be done: if thing is an exit, this checks to see if the exit will * perform a move that is allowed. Then, it checks the @lock on the thing, * whether it's an exit or not. */intcould_doit(int descr, dbref player, dbref thing){	dbref source, dest, owner;	if (Typeof(thing) == TYPE_EXIT) {			/* If exit is unlinked, can't do it. */		if (DBFETCH(thing)->sp.exit.ndest == 0) {			return 0;		}		owner = OWNER(thing);		source = DBFETCH(player)->location;		dest = *(DBFETCH(thing)->sp.exit.dest);		if (Typeof(dest) == TYPE_PLAYER) {			/* Check for additional restrictions related to player dests */			dbref destplayer = dest;			dest = DBFETCH(dest)->location;			/* If the dest player isn't JUMP_OK, or if the dest player's loc			 * is set BOUND, can't do it. */			if (!(FLAGS(destplayer) & JUMP_OK) || (FLAGS(dest) & BUILDER)) {				return 0;			}		}		/* for actions */		if ((DBFETCH(thing)->location != NOTHING) &&			(Typeof(DBFETCH(thing)->location) != TYPE_ROOM)) {			/* If this is an exit on a Thing or a Player... */			/* If the destination is a room or player, and the current			 * location is set BOUND (note: if the player is in a vehicle			 * set BUILDER this will also return failure) */			if ((Typeof(dest) == TYPE_ROOM || Typeof(dest) == TYPE_PLAYER) &&				(FLAGS(source) & BUILDER)) return 0;			/* If secure_teleport is true, and if the destination is a room */			if (tp_secure_teleport && Typeof(dest) == TYPE_ROOM) {				/* if player doesn't control the source and the source isn't				 * set Jump_OK, then if the destination isn't HOME,				 * can't do it.  (Should this include getlink(owner)?  Not				 * everyone knows that 'home' or '#-3' can be linked to and				 * be treated specially. -winged) */				if ((dest != HOME) && (!controls(owner, source))					&& ((FLAGS(source) & JUMP_OK) == 0)) {					return 0;				}			/* FIXME: Add support for in-server banishment from rooms			 * and environments here. */			}		}	}		/* Check the @lock on the thing, as a final test. */	return (eval_boolexp(descr, player, GETLOCK(thing), thing));}
开发者ID:giveamouse,项目名称:fbmuck,代码行数:65,


示例12: mfn_force

const char *mfn_force(MFUNARGS){    char *nxt, *ptr;    dbref obj = mesg_dbref_raw(player, what, perms, argv[0]);    if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)        ABORT_MPI("FORCE","Failed match. (arg1)");    if (obj == PERMDENIED)        ABORT_MPI("FORCE","Permission denied. (arg1)");    if (Typeof(obj) != TYPE_THING && Typeof(obj) != TYPE_PLAYER)        ABORT_MPI("FORCE","Bad object reference. (arg1)");    if (!*argv[1])        ABORT_MPI("FORCE","Null command string. (arg2)");    if (!tp_zombies && !Wizperms(perms))        ABORT_MPI("FORCE","Permission Denied.");    if (!Wizperms(perms)) {	const char *ptr = RNAME(obj);	char objname[BUFFER_LEN], *ptr2;	dbref loc = getloc(obj);	if (Typeof(obj) == TYPE_THING) {	    if (FLAGS(obj) & DARK)		ABORT_MPI("FORCE","Cannot force a dark puppet.");	    if ((FLAGS(OWNER(obj)) & ZOMBIE))		ABORT_MPI("FORCE","Permission denied.");	    if (loc != NOTHING && (FLAGS(loc) & ZOMBIE) &&		    Typeof(loc) == TYPE_ROOM)		ABORT_MPI("FORCE","Cannot force a Puppet in a no-puppets room.");	    for (ptr2 = objname; *ptr && !isspace(*ptr);)		*(ptr2++) = *(ptr++);	    *ptr2 = '/0';	    if (lookup_player(objname) != NOTHING)		ABORT_MPI("FORCE","Cannot force a thing named after a player.");	}	if (!(FLAGS(obj) & XFORCIBLE)) {	    ABORT_MPI("FORCE","Permission denied: forced object not @set Xforcible.");	}	if (!test_lock_false_default(perms, obj, "@/flk")) {	    ABORT_MPI("FORCE","Permission denied: Object not force-locked to trigger.");	}    }    if (God(obj))	ABORT_MPI("FORCE","Permission denied: You can't force God.");    if (force_level)	ABORT_MPI("FORCE","Permission denied: You can't force recursively.");    strcpy(buf, argv[1]);    ptr = buf;    do {        nxt = index(ptr, '/r');        if (nxt) *nxt++ = '/0';        force_level++;        if (*ptr) process_command(obj, ptr);        force_level--;        ptr = nxt;    } while (ptr);    *buf = '/0';    return "";}
开发者ID:TealWizard,项目名称:TinyMUCK-Tapestries,代码行数:58,


示例13: can_link_to

intcan_link_to(dbref who, object_flag_type what_type, dbref where){		/* Can always link to HOME */	if (where == HOME)		return 1;		/* Can't link to an invalid dbref */	if (where < 0 || where >= db_top)		return 0;	switch (what_type) {	case TYPE_EXIT:		/* If the target is LINK_OK, then any exit may be linked		 * there.  Otherwise, only someone who controls the		 * target may link there. */		return (controls(who, where) || (FLAGS(where) & LINK_OK));		/* NOTREACHED */		break;	case TYPE_PLAYER:		/* Players may only be linked to rooms, that are either		 * controlled by the player or set either L or A. */		return (Typeof(where) == TYPE_ROOM && (controls(who, where)											   || Linkable(where)));		/* NOTREACHED */		break;	case TYPE_ROOM:		/* Rooms may be linked to rooms or things (this sets their		 * dropto location).  Target must be controlled, or be L or A. */		return ((Typeof(where) == TYPE_ROOM || Typeof(where) == TYPE_THING)				&& (controls(who, where) || Linkable(where)));		/* NOTREACHED */		break;	case TYPE_THING:		/* Things may be linked to rooms, players, or other things (this		 * sets the thing's home).  Target must be controlled, or be L or A. */		return (				(Typeof(where) == TYPE_ROOM || Typeof(where) == TYPE_PLAYER ||				 Typeof(where) == TYPE_THING) && 				 (controls(who, where) || Linkable(where)));		/* NOTREACHED */		break;	case NOTYPE:		/* Why is this here? -winged */		return (controls(who, where) || (FLAGS(where) & LINK_OK) ||				(Typeof(where) != TYPE_THING && (FLAGS(where) & ABODE)));		/* NOTREACHED */		break;	default:		/* Programs can't be linked anywhere */		return 0;		/* NOTREACHED */		break;	}	/* NOTREACHED */	return 0;}
开发者ID:giveamouse,项目名称:fbmuck,代码行数:55,


示例14: fetchprops_priority

intfetchprops_priority(dbref obj, int mode, const char *pdir){	const char *s;	int hitflag = 0;	/* update fetched timestamp */	DBFETCH(obj)->propstime = time(NULL);	/* if in memory, don't try to reload. */	if (DBFETCH(obj)->propsmode != PROPS_UNLOADED) {		/* but do update the queue position */		addobject_ringqueue(obj, DBFETCH(obj)->propsmode);		if (!pdir)			pdir = "/";		while ((s = propdir_unloaded(DBFETCH(obj)->properties, pdir))) {			propcache_misses++;			hitflag++;			if (!mode)				update_fetchstats();			if (FLAGS(obj) & SAVED_DELTA) {				getproperties(delta_infile, obj, s);			} else {				getproperties(input_file, obj, s);			}		}		if (hitflag) {			return 1;		} else {			propcache_hits++;			return 0;		}	}	propcache_misses++;	housecleanprops();	/* actually load in root properties from the appropriate file */	if (FLAGS(obj) & SAVED_DELTA) {		getproperties(delta_infile, obj, "/");	} else {		getproperties(input_file, obj, "/");	}	/* update fetch statistics */	if (!mode)		update_fetchstats();	/* add object to appropriate queue */	addobject_ringqueue(obj, ((mode) ? PROPS_PRIORITY : PROPS_LOADED));	return 1;}
开发者ID:rhencke,项目名称:fuzzball,代码行数:55,


示例15: makedirty

/*** makedirty*** Input:** Output:**************************************************************************/voidmakedirty (    REGISTER PFILE pFileDirty    ) {    if (!TESTFLAG(FLAGS(pFileDirty),DIRTY)) {        if (pFileDirty == pFileHead) {            SETFLAG (fDisplay, RSTATUS);        }	SETFLAG (FLAGS(pFileDirty), DIRTY);    }}
开发者ID:mingpen,项目名称:OpenNT,代码行数:19,


示例16: mfn_contents

const char *mfn_contents(MFUNARGS){    char buf2[50];    int list_limit = MAX_MFUN_LIST_LEN;    dbref obj = mesg_dbref_local(player, what, perms, argv[0]);    int typchk, ownroom;    int outlen, nextlen;    if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)	ABORT_MPI("CONTENTS","Match failed");    if (obj == PERMDENIED)	ABORT_MPI("CONTENTS",NOPERM_MESG);    typchk = NOTYPE;    if (argc > 1) {	if (!string_compare(argv[1], "Room")) {	    typchk = TYPE_ROOM;	} else if (!string_compare(argv[1], "Exit")) {	    typchk = TYPE_EXIT;  /* won't find any, though */	} else if (!string_compare(argv[1], "Player")) {	    typchk = TYPE_PLAYER;	} else if (!string_compare(argv[1], "Program")) {	    typchk = TYPE_PROGRAM;	} else if (!string_compare(argv[1], "Thing")) {	    typchk = TYPE_THING;	} else {	    ABORT_MPI("CONTENTS","Type must be 'player', 'room', 'thing', 'program', or 'exit'. (2)");	}    }    strcpy(buf, "");    outlen = 0;    ownroom = controls(perms, obj);    obj = DBFETCH(obj)->contents;    while (obj != NOTHING && list_limit) {	if ((typchk == NOTYPE || Typeof(obj) == typchk) &&		(ownroom || controls(perms, obj) ||		!((FLAGS(obj) & DARK) || (FLAGS(getloc(obj)) & DARK) ||		(Typeof(obj) == TYPE_PROGRAM && !(FLAGS(obj) & LINK_OK)))) &&		!(Typeof(obj) == TYPE_ROOM && typchk != TYPE_ROOM)) {	    ref2str(obj, buf2);	    nextlen = strlen(buf2);	    if ((outlen + nextlen) >= (BUFFER_LEN - 3))		break;	    if (outlen) strcat((buf+(outlen++)), "/r");	    strcat((buf + outlen), buf2);	    outlen += nextlen;	    list_limit--;	}	obj = DBFETCH(obj)->next;    }    return buf;}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:53,


示例17: find_mlev

dbreffind_mlev(dbref prog, struct frame * fr, int st){	if ((FLAGS(prog) & STICKY) && (FLAGS(prog) & HAVEN)) {		if ((st > 1) && (TrueWizard(OWNER(prog))))			return (find_mlev(fr->caller.st[st - 1], fr, st - 1));	}	if (MLevel(prog) < MLevel(OWNER(prog))) {		return (MLevel(prog));	} else {		return (MLevel(OWNER(prog)));	}}
开发者ID:rhencke,项目名称:fuzzball,代码行数:13,


示例18: list_proglines

/** * List program lines to a player * * This is used by the debugger for listing lines and for backtraces. * Uses the editor's list_program under the hood. * * @see list_program * * @param player the player to send the listing to * @param program the program to list * @param fr the running program frame * @param start the start line * @param end the end line */voidlist_proglines(dbref player, dbref program, struct frame *fr, int start,               int end){    int range[2];    int argc;    if (start == end || end == 0) {        range[0] = start;        range[1] = start;        argc = 1;    } else {        range[0] = start;        range[1] = end;        argc = 2;    }    /* Make sure we have the lines of code loaded for display */    if (!fr->brkpt.proglines || program != fr->brkpt.lastproglisted) {        free_prog_text(fr->brkpt.proglines);        fr->brkpt.proglines = (struct line *) read_program(program);        fr->brkpt.lastproglisted = program;    }    {        /*         * We have to change the program position in order to do the         * listing, so we use this tmpline so we can reset it when         * we are done.         */        struct line *tmpline = PROGRAM_FIRST(program);        PROGRAM_SET_FIRST(program, fr->brkpt.proglines);        {            int tmpflg = (FLAGS(player) & INTERNAL);            FLAGS(player) |= INTERNAL;            list_program(player, program, range, argc, 0);            if (!tmpflg) {                FLAGS(player) &= ~INTERNAL;            }        }        PROGRAM_SET_FIRST(program, tmpline);    }    return;}
开发者ID:fuzzball-muck,项目名称:fuzzball,代码行数:65,


示例19: can_link_to

boolcan_link_to(dbref who, object_flag_type what_type,            dbref where){    if (where == HOME)        return 1;    if (where == NIL)        return 1;    if (!OkObj(who) || !OkObj(where))        return 0;    switch (what_type) {        case TYPE_EXIT:            return (controls(who, where) || (FLAGS(where) & LINK_OK)                    || (POWERS(who) & POW_LINK_ANYWHERE));            /* NOTREACHED */            break;        case TYPE_PLAYER:            return (Typeof(where) == TYPE_ROOM && (controls(who, where)                                                   || Linkable(where)                                                   || (POWERS(who) &                                                       POW_LINK_ANYWHERE)));            /* NOTREACHED */            break;        case TYPE_ROOM:            return ((Typeof(where) == TYPE_ROOM || Typeof(where) == TYPE_THING)                    && (controls(who, where) || Linkable(where)                        || (POWERS(who) & POW_LINK_ANYWHERE)));            /* NOTREACHED */            break;        case TYPE_THING:            return ((Typeof(where) == TYPE_ROOM || Typeof(where) == TYPE_PLAYER                     || Typeof(where) == TYPE_THING)                    && (controls(who, where) || Linkable(where)                        || (POWERS(who) & POW_LINK_ANYWHERE)));            /* NOTREACHED */            break;        case NOTYPE:            return (controls(who, where) || (FLAGS(where) & LINK_OK)                    || (POWERS(who) & POW_LINK_ANYWHERE)                    || (Typeof(where) != TYPE_THING && (FLAGS(where) & ABODE)));            /* NOTREACHED */            break;    }    return 0;}
开发者ID:nekosune,项目名称:protomuck,代码行数:49,


示例20: do_edit

voiddo_edit(int descr, dbref player, const char *name){    dbref i;    struct match_data md;    if (Typeof(player) != TYPE_PLAYER) {        anotify_nolisten2(player, CFAIL "Only players can edit programs.");        return;    } else if (!Mucker(player)) {        anotify_nolisten2(player, CFAIL NOMBIT_MESG);        return;    } else if (tp_db_readonly) {        anotify_nolisten2(player, CFAIL DBRO_MESG);        return;    } else if (!*name) {        anotify_nolisten2(player, CINFO "No program name given.");        return;    }    init_match(descr, player, name, TYPE_PROGRAM, &md);    match_possession(&md);    match_neighbor(&md);    match_registered(&md);    match_absolute(&md);    if ((i = noisy_match_result(&md)) == NOTHING || i == AMBIGUOUS)        return;    if ((Typeof(i) != TYPE_PROGRAM) || !controls(player, i)) {        anotify_fmt(player, CFAIL "%s", tp_noperm_mesg);        return;    } else if (FLAGS(i) & INTERNAL) {        anotify_nolisten2(player, CFAIL NOEDIT_MESG);        return;    }    FLAGS(i) |= INTERNAL;    DBFETCH(i)->sp.program.first = read_program(i);    DBFETCH(player)->sp.player.curr_prog = i;    anotify_fmt(player, CINFO "Entering editor for %s.",                unparse_object(player, i));    /* list current line */    do_list(player, i, 0, 0, 0);    FLAGS(player) |= INTERACTIVE;    DBDIRTY(i);    DBDIRTY(player);}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:48,


示例21: time_for_monolithic

inttime_for_monolithic(void){    dbref i;    int count = 0;    int a, b;    if (!last_monolithic_time)	last_monolithic_time = time(NULL);    if (time(NULL) - last_monolithic_time >=	    (tp_monolithic_interval - tp_dump_warntime)    ) {	return 1;    }    for (i = 0; i < db_top; i++)	if (FLAGS(i) & (SAVED_DELTA | OBJECT_CHANGED)) count++;    if (((count * 100) / db_top)  > tp_max_delta_objs) {	return 1;    }    fseek(delta_infile, 0L, 2);    a = ftell(delta_infile);    fseek(input_file, 0L, 2);    b = ftell(input_file);    if (a >= b) {	return 1;    }    return 0;}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:30,


示例22: do_page

/* doesn't really belong here, but I couldn't figure out where else */void do_page(dbref player, const char *arg1, const char *arg2){    int     ignored;    char    buf[BUFFER_LEN], buf2[BUFFER_LEN];    dbref   target;    if (!payfor(player, tp_lookup_cost)) {	anotify_fmt(player, CFAIL "You don't have enough %s.", tp_pennies);	return;    }    if ( strcmp(arg1, "me") ) {	if ((target = lookup_player(arg1)) == NOTHING) {	    anotify(player, CINFO WHO_MESG);	    return;	}    } else target = player;    if(Guest(player)) {	if(!Mage(target)) {	    anotify(player, CINFO "Guests can only page " NAMEWIZ "s, type 'wizzes'.");	    return;	}    }    if (FLAGS(target) & HAVEN) {	anotify(player, CFAIL "That player is haven.");	return;    }    ignored = ignoring(target, player);    if(ignored == 1) {	anotify(player, CFAIL "That player is ignoring you.");	return;    } else if(ignored == 2) {	anotify(player, CINFO "That player is ignoring you.");    }    do_parse_mesg(player, player, arg2, "(page)", buf, MPI_ISPRIVATE);    tct(buf,buf2);    if (!*buf2) {	sprintf(buf, CGREEN "You sense that %s is looking for you in %s.",			PNAME(player), NAME(DBFETCH(player)->location));    } else {	if(buf2[0] == ':' || buf2[0] == ';') {	    sprintf(buf, CGREEN "%s pages /"" CYELLOW "%s %.3900s" CGREEN "/"",			PNAME(player), PNAME(player), buf2);	} else {	    sprintf(buf, CGREEN "%s pages /"" CYELLOW "%.3900s" CGREEN "/"",			PNAME(player), buf2);	}    }    if (anotify_from(player, target, buf))	anotify(player, CSUCC "Your message has been sent.");    else {	sprintf(buf, CINFO "%s is not connected.", PNAME(target));	anotify(player, buf);    }}
开发者ID:GlowMUCK,项目名称:GlowMUCK,代码行数:61,


示例23: FileStatus

/*  FileStatus - compare logical info about a file with file on disk * *  Compare the last modified time with the last snapshot.  If the filename *  contains metachars, the file is not believed to have changed.  Further, if *  the file is a pseudo file, it cannot have changed. * *  pFile       file of interest (contains mod time) *  pName       name of file to examine (when writing to diff. name) * *  returns     FILECHANGED if timestamps differ *              FILEDELETED if file on disk does not exist *              FILESAME    if timestamps are the same */intFileStatus (    PFILE pFile,    char *pName    ){    long modtime;    if (TESTFLAG(FLAGS(pFile),FAKE)) {        return FILESAME;    }    if (pName == NULL) {        pName = pFile->pName;    }    if (*strbscan (pName, "?*") != 0) {        return FILESAME;    }    if ((modtime = ModTime (pName)) == 0L) {        return FILEDELETED;    }    if (pFile->modify != modtime) {        return FILECHANGED;    }    return FILESAME;}
开发者ID:mingpen,项目名称:OpenNT,代码行数:43,


示例24: fSyncFile

/*  fSyncFile - Attempt to make logical file and physical file the same * *  When editing in a network or multi-tasking environment, we need to make *  sure that changes made underneath us are properly reflected to the *  user.  We do this by snapshotting the time-of-last-write and periodically *  comparing it with the version on disk.  When a mismatch is found, we *  prompt the user and give him the opportunity to reread the file * *  pFileLoc    file structure of interest *  fPrompt     TRUE => prompt user for permission to refresh, else just *              refresh. * *  returns     TRUE iff the logical file and the physical file are the same. */flagTypefSyncFile (    PFILE pFileLoc,    flagType fPrompt    ) {    if (pFileLoc == NULL) {        pFileLoc = pFileHead;    }    switch (FileStatus (pFileLoc, NULL)) {    case FILECHANGED:        if (!confirmx("%s has been changed.  Refresh? ", pFileLoc->pName)) {            /* No, validate this edit session */            SetModTime (pFileLoc);            return FALSE;        }        FileRead (strcpy( buf, pFileLoc->pName ), pFileLoc, TRUE);        RSETFLAG (FLAGS (pFileLoc), DIRTY);        SETFLAG (fDisplay, RSTATUS);        return TRUE;    case FILEDELETED:        domessage ("File has been deleted");        break;    default:        break;    }    return TRUE;}
开发者ID:mingpen,项目名称:OpenNT,代码行数:47,


示例25: do_page

/* doesn't really belong here, but I couldn't figure out where else */voiddo_page(dbref player, const char *arg1, const char *arg2){	char buf[BUFFER_LEN];	dbref target;	if (!payfor(player, tp_lookup_cost)) {		notify_fmt(player, "You don't have enough %s.", tp_pennies);		return;	}	if ((target = lookup_player(arg1)) == NOTHING) {		notify(player, "I don't recognize that name.");		return;	}	if (FLAGS(target) & HAVEN) {		notify(player, "That player does not wish to be disturbed.");		return;	}	if (blank(arg2))		snprintf(buf, sizeof(buf), "You sense that %s is looking for you in %s.",				NAME(player), NAME(DBFETCH(player)->location));	else		snprintf(buf, sizeof(buf), "%s pages from %s: /"%s/"", NAME(player),				NAME(DBFETCH(player)->location), arg2);	if (notify_from(player, target, buf))		notify(player, "Your message has been sent.");	else {		snprintf(buf, sizeof(buf), "%s is not connected.", NAME(target));		notify(player, buf);	}}
开发者ID:giveamouse,项目名称:fbmuck,代码行数:32,


示例26: apply_reloc

/* * Apply a relocation to an image being built from an input file.  Use the * runtime linkers routines to do the necessary magic. */voidapply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr,    Rt_map *lmp){	Rela	*rel = vrel;	Xword	type = ELF_R_TYPE(rel->r_info, M_MACH);	Xword	value = reloc->r_value + rel->r_addend;	if (type == R_AMD64_JUMP_SLOT) {		uintptr_t	addr, vaddr;		if (FLAGS(lmp) & FLG_RT_FIXED)			vaddr = 0;		else			vaddr = ADDR(lmp);		addr = (uintptr_t)oaddr - rel->r_offset;		/* LINTED */		(void) elf_plt_write((uintptr_t)addr, vaddr, rel,		    (uintptr_t)value, reloc->r_pltndx);	} else if (type == R_AMD64_COPY) {		(void) memcpy((void *)oaddr, (void *)value,		    (size_t)reloc->r_size);	} else {		(void) do_reloc_rtld(type, oaddr, &value, reloc->r_name, name,		    LIST(lmp));	}}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:33,


示例27: mcpedit_program

voidmcpedit_program(int descr, dbref player, dbref prog, const char *name,                McpFrame *mfr){    char namestr[BUFFER_LEN];    char refstr[BUFFER_LEN];    struct line *curr;    McpMesg msg;    McpVer supp;    supp = mcp_frame_package_supported(mfr, "dns-org-mud-moo-simpleedit");    if (supp.verminor == 0 && supp.vermajor == 0) {        do_prog(descr, player, name);        return;    }    FLAGS(prog) |= INTERNAL;    snprintf(refstr, sizeof(refstr), "%d.prog.", prog);    snprintf(namestr, sizeof(namestr), "a program named %s(%d)", NAME(prog),             prog);    mcp_mesg_init(&msg, "dns-org-mud-moo-simpleedit", "content");    mcp_mesg_arg_append(&msg, "reference", refstr);    mcp_mesg_arg_append(&msg, "type", "muf-code");    mcp_mesg_arg_append(&msg, "name", namestr);    for (curr = DBFETCH(prog)->sp.program.first; curr; curr = curr->next)        mcp_mesg_arg_append(&msg, "content", DoNull(curr->this_line));    mcp_frame_output_mesg(mfr, &msg);    mcp_mesg_clear(&msg);    free_prog_text(DBFETCH(prog)->sp.program.first);    DBFETCH(prog)->sp.program.first = NULL;}
开发者ID:CyberLeo,项目名称:protomuck,代码行数:34,


示例28: CLEANUP

 //*********************************************** uint8_t ColYuvRgb::reset(uint32_t ww, uint32_t hh) { int flags=0;	    CLEANUP();    FLAGS();    PixelFormat fmt=TARGET_COLORSPACE;    if(_inverted) fmt=ALTERNATE_COLORSPACE;    if(!ww || !hh) return 0;	if (_context)		sws_freeContext((SwsContext *)_context);	/* 	FIXME: remove when ffmpeg is fixed	Without SWS_ACCURATE_RND the quality is bad 	for YUV->RGB (caused by libswscale r28700) 	*/	flags |= SWS_ACCURATE_RND;	 _context=(void *)sws_getContext(                      ww,hh,                      PIX_FMT_YUV420P ,                      ww,hh,                      fmt,                      flags, NULL, NULL,NULL);    if(!_context) ADM_assert(0);    w=ww;    h=hh;    return 1;}
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:33,


示例29: KppMakeCRule

BOOL PEXPORT KppMakeCRule(ATOMID idName,                                       ATOMID (PEXPORT *pIfPart)(),                                      void (PEXPORT *pThenPart)(), short sPrio){#ifdef INFERENCE    BOOL bExists = FALSE;    RULEID idRule;    LPRULE lpRule;    if (!KppIsGoodAtom(idName))        return FALSE;    idRule = KppGetItemFromName(RULE, idName, (LPLPSTR) &lpRule);    if (idRule)        bExists = TRUE;    else if (!(idRule = KppAddItemAndName(RULE, (LPLPSTR) &lpRule, idName)))        return FALSE;    NAME(lpRule) = idName;    FLAGS(lpRule) = CBODY;    PRIORITY(lpRule) = sPrio;    CIFPTR(lpRule) = pIfPart;    CTHENPTR(lpRule) = (ATOMID (PEXPORT *)()) pThenPart;    CIFPAIRS(lpRule) = NULLID;    CTHENPAIRS(lpRule) = NULLID;    KppReleaseItem(RULE, idRule);    /* Add to KnowledgeTools */    if (!bExists)         KppAddItemCB(RULE, 1);    KppChangeRuleCB();    return TRUE;#endif}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:35,


示例30: KppMakeCGoal

/******************************************************************                      C GOAL function*****************************************************************/BOOL PEXPORT KppMakeCGoal(ATOMID idName, LOGICALID (PEXPORT *pGoal)(void)){    BOOL bExists = FALSE;    GOALID idGoal = NULLID;    LPGOAL lpGoal;#ifdef INFERENCE    if (!KppIsGoodAtom(idName))        return FALSE;    idGoal = KppGetItemFromName(GOAL, idName, (LPLPSTR) &lpGoal);    if (idGoal)        bExists = TRUE;    else if (!(idGoal = KppAddItemAndName(GOAL, (LPLPSTR) &lpGoal, idName)))        return FALSE;    NAME(lpGoal) = idName;    FLAGS(lpGoal) = CBODY;    PRIORITY(lpGoal) = 0;    CBODYPTR(lpGoal) = pGoal;    KppReleaseItem(GOAL, idGoal);    /* Add to KnowledgeTools */    if (!bExists)         KppAddItemCB(GOAL, 1);#endif    return idGoal;}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:32,



注:本文中的FLAGS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ FLAGS_GET_M函数代码示例
C++ FLAG函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。