本文整理汇总了C++中NOT_END函数的典型用法代码示例。如果您正苦于以下问题:C++ NOT_END函数的具体用法?C++ NOT_END怎么用?C++ NOT_END使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NOT_END函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Make_Array
//
// Map_To_Block: C
//
// mapser = series of the map
// what: -1 - words, +1 - values, 0 -both
//
REBSER *Map_To_Block(REBSER *mapser, REBINT what)
{
REBVAL *val;
REBCNT cnt = 0;
REBSER *blk;
REBVAL *out;
// Count number of set entries:
for (val = BLK_HEAD(mapser); NOT_END(val) && NOT_END(val+1); val += 2) {
if (!IS_NONE(val+1)) cnt++; // must have non-none value
}
// Copy entries to new block:
blk = Make_Array(cnt * ((what == 0) ? 2 : 1));
out = BLK_HEAD(blk);
for (val = BLK_HEAD(mapser); NOT_END(val) && NOT_END(val+1); val += 2) {
if (!IS_NONE(val+1)) {
if (what <= 0) *out++ = val[0];
if (what >= 0) *out++ = val[1];
}
}
SET_END(out);
blk->tail = out - BLK_HEAD(blk);
return blk;
}
开发者ID:fort-ascension,项目名称:ren-c,代码行数:32,代码来源:t-map.c
示例2: COPY_ANY_ARRAY_AT_DEEP_MANAGED
//
// Copy_And_Bind_Relative_Deep_Managed: C
//
// This routine is called by Make_Function in order to take the raw material
// given as a function body, and de-relativize any IS_RELATIVE(value)s that
// happen to be in it already (as any Copy does). But it also needs to make
// new relative references to ANY-WORD! that are referencing function
// parameters, as well as to relativize the copies of ANY-ARRAY! that contain
// these relative words...so that they refer to the archetypal function
// to which they should be relative.
//
REBARR *Copy_And_Bind_Relative_Deep_Managed(
const REBVAL *body,
REBARR *paramlist, // body of function is not actually ready yet
REBU64 bind_types
) {
// !!! Currently this is done in two phases, because the historical code
// would use the generic copying code and then do a bind phase afterward.
// Both phases are folded into this routine to make it easier to make
// a one-pass version when time permits.
//
REBARR *copy = COPY_ANY_ARRAY_AT_DEEP_MANAGED(body);
struct Reb_Binder binder;
INIT_BINDER(&binder);
// Setup binding table from the argument word list
//
REBCNT index = 1;
RELVAL *param = ARR_AT(paramlist, 1); // [0] is FUNCTION! value
for (; NOT_END(param); param++, index++)
Add_Binder_Index(&binder, VAL_KEY_CANON(param), index);
Bind_Relative_Inner_Loop(&binder, ARR_HEAD(copy), paramlist, bind_types);
// Reset binding table
//
param = ARR_AT(paramlist, 1); // [0] is FUNCTION! value
for (; NOT_END(param); param++)
Remove_Binder_Index(&binder, VAL_KEY_CANON(param));
SHUTDOWN_BINDER(&binder);
return copy;
}
开发者ID:rgchris,项目名称:ren-c,代码行数:44,代码来源:c-bind.c
示例3: WORDS_HEAD
*/ void Bind_Relative(REBSER *words, REBSER *frame, REBSER *block)
/*
** Bind the words of a function block to a stack frame.
** To indicate the relative nature of the index, it is set to
** a negative offset.
**
** words: VAL_FUNC_ARGS(func)
** frame: VAL_FUNC_ARGS(func)
** block: block to bind
**
***********************************************************************/
{
REBVAL *args;
REBINT index;
REBINT *binds = WORDS_HEAD(Bind_Table); // GC safe to do here
args = BLK_SKIP(words, 1);
CHECK_BIND_TABLE;
//Dump_Block(words);
// Setup binding table from the argument word list:
for (index = 1; NOT_END(args); args++, index++)
binds[VAL_BIND_CANON(args)] = -index;
Bind_Relative_Words(frame, block);
// Reset binding table:
for (args = BLK_SKIP(words, 1); NOT_END(args); args++)
binds[VAL_BIND_CANON(args)] = 0;
}
开发者ID:dailybarid,项目名称:rebol,代码行数:32,代码来源:c-frame.c
示例4: FRM_WORDS
static REBSER *Trim_Object(REBSER *obj)
{
REBVAL *val;
REBINT cnt = 0;
REBSER *nobj;
REBVAL *nval;
REBVAL *word;
REBVAL *nwrd;
word = FRM_WORDS(obj)+1;
for (val = FRM_VALUES(obj)+1; NOT_END(val); val++, word++) {
if (VAL_TYPE(val) > REB_NONE && !VAL_GET_OPT(word, OPTS_HIDE))
cnt++;
}
nobj = Make_Frame(cnt);
nval = FRM_VALUES(nobj)+1;
word = FRM_WORDS(obj)+1;
nwrd = FRM_WORDS(nobj)+1;
for (val = FRM_VALUES(obj)+1; NOT_END(val); val++, word++) {
if (VAL_TYPE(val) > REB_NONE && !VAL_GET_OPT(word, OPTS_HIDE)) {
*nval++ = *val;
*nwrd++ = *word;
}
}
SET_END(nval);
SET_END(nwrd);
SERIES_TAIL(nobj) = cnt+1;
SERIES_TAIL(FRM_WORD_SERIES(nobj)) = cnt+1;
return nobj;
}
开发者ID:51weekend,项目名称:r3,代码行数:32,代码来源:t-object.c
示例5: Append_Map
//
// Append_Map: C
//
static void Append_Map(REBSER *ser, REBVAL *arg, REBCNT len)
{
REBVAL *val;
REBCNT n;
val = VAL_BLK_DATA(arg);
for (n = 0; n < len && NOT_END(val) && NOT_END(val+1); val += 2, n += 2) {
Find_Entry(ser, val, val+1);
}
}
开发者ID:fort-ascension,项目名称:ren-c,代码行数:13,代码来源:t-map.c
示例6: Mold_Block_Series
STOID Mold_Block_Series(REB_MOLD *mold, REBSER *series, REBCNT index, REBYTE *sep)
{
REBSER *out = mold->series;
REBOOL line_flag = FALSE; // newline was part of block
REBOOL had_lines = FALSE;
REBVAL *value = BLK_SKIP(series, index);
if (!sep) sep = "[]";
if (IS_END(value)) {
Append_Bytes(out, sep);
return;
}
// Recursion check: (variation of: Find_Same_Block(MOLD_LOOP, value))
for (value = BLK_HEAD(MOLD_LOOP); NOT_END(value); value++) {
if (VAL_SERIES(value) == series) {
Emit(mold, "C...C", sep[0], sep[1]);
return;
}
}
value = Append_Value(MOLD_LOOP);
Set_Block(value, series);
if (sep[1]) {
Append_Byte(out, sep[0]);
mold->indent++;
}
// else out->tail--; // why?????
value = BLK_SKIP(series, index);
while (NOT_END(value)) {
if (VAL_GET_LINE(value)) {
if (sep[1] || line_flag) New_Indented_Line(mold);
had_lines = TRUE;
}
line_flag = TRUE;
Mold_Value(mold, value, TRUE);
value++;
if (NOT_END(value))
Append_Byte(out, (sep[0] == '/') ? '/' : ' ');
}
if (sep[1]) {
mold->indent--;
if (VAL_GET_LINE(value) || had_lines) New_Indented_Line(mold);
Append_Byte(out, sep[1]);
}
Remove_Last(MOLD_LOOP);
}
开发者ID:dailybarid,项目名称:rebol,代码行数:51,代码来源:s-mold.c
示例7: Bind_Values_Core
//
// Bind_Values_Core: C
//
// Bind words in an array of values terminated with END
// to a specified context. See warnings on the functions like
// Bind_Values_Deep() about not passing just a singular REBVAL.
//
// NOTE: If types are added, then they will be added in "midstream". Only
// bindings that come after the added value is seen will be bound.
//
void Bind_Values_Core(
RELVAL *head,
REBCTX *context,
REBU64 bind_types,
REBU64 add_midstream_types,
REBFLGS flags // see %sys-core.h for BIND_DEEP, etc.
) {
struct Reb_Binder binder;
INIT_BINDER(&binder);
// Via the global hash table, each spelling of the word can find the
// canon form of the word. Associate that with an index number to signal
// a binding should be created to this context (at that index.)
REBCNT index = 1;
REBVAL *key = CTX_KEYS_HEAD(context);
for (; index <= CTX_LEN(context); key++, index++)
if (!GET_VAL_FLAG(key, TYPESET_FLAG_UNBINDABLE))
Add_Binder_Index(&binder, VAL_KEY_CANON(key), index);
Bind_Values_Inner_Loop(
&binder, head, context, bind_types, add_midstream_types, flags
);
// Reset all the binder indices to zero, balancing out what was added.
key = CTX_KEYS_HEAD(context);
for (; NOT_END(key); key++)
Remove_Binder_Index(&binder, VAL_KEY_CANON(key));
SHUTDOWN_BINDER(&binder);
}
开发者ID:rgchris,项目名称:ren-c,代码行数:42,代码来源:c-bind.c
示例8: BLK_HEAD
*/ RL_API u32 *RL_Map_Words(REBSER *series)
/*
** Given a block of word values, return an array of word ids.
**
** Returns:
** An array of global word identifiers (integers). The [0] value is the size.
** Arguments:
** series - block of words as values (from REBOL blocks, not strings.)
** Notes:
** Word identifiers are persistent, and you can use them anytime.
** The block can include any kind of word, including set-words, lit-words, etc.
** If the input block contains non-words, they will be skipped.
** The array is allocated with OS_ALLOC and you can OS_FREE it any time.
**
***********************************************************************/
{
REBCNT i = 1;
u32 *words;
REBVAL *val = BLK_HEAD(series);
words = OS_ALLOC_ARRAY(u32, series->tail + 2);
for (; NOT_END(val); val++) {
if (ANY_WORD(val)) words[i++] = VAL_WORD_CANON(val);
}
words[0] = i;
words[i] = 0;
return words;
}
开发者ID:asampal,项目名称:ren-c,代码行数:31,代码来源:a-lib.c
示例9: AS_CONTEXT
//
// RL_Words_Of_Object: C
//
// Returns information about the object.
//
// Returns:
// Returns an array of words used as fields of the object.
// Arguments:
// obj - object pointer (e.g. from RXA_OBJECT)
// Notes:
// Returns a word array similar to MAP_WORDS().
// The array is allocated with OS_ALLOC. You can OS_FREE it any time.
//
RL_API u32 *RL_Words_Of_Object(REBSER *obj)
{
REBCNT index;
u32 *syms;
REBVAL *key;
REBCTX *context = AS_CONTEXT(obj);
key = CTX_KEYS_HEAD(context);
// We don't include hidden keys (e.g. SELF), but terminate by 0.
// Conservative estimate that there are no hidden keys, add one.
//
syms = OS_ALLOC_N(u32, CTX_LEN(context) + 1);
index = 0;
for (; NOT_END(key); key++) {
if (GET_VAL_FLAG(key, TYPESET_FLAG_HIDDEN))
continue;
syms[index] = VAL_TYPESET_CANON(key);
index++;
}
syms[index] = SYM_0; // Null terminate
return syms;
}
开发者ID:kjanz1899,项目名称:ren-c,代码行数:40,代码来源:a-lib.c
示例10: WORDS_HEAD
*/ REBSER *Collect_Words(REBVAL value[], REBVAL prior_value[], REBCNT modes)
/*
** Collect words from a prior block and new block.
**
***********************************************************************/
{
REBSER *series;
REBCNT start;
REBINT *binds = WORDS_HEAD(Bind_Table); // GC safe to do here
CHECK_BIND_TABLE;
if (SERIES_TAIL(BUF_WORDS)) panic Error_0(RE_WORD_LIST); // still in use
if (prior_value)
Collect_Words_Inner_Loop(binds, &prior_value[0], BIND_ALL);
start = SERIES_TAIL(BUF_WORDS);
Collect_Words_Inner_Loop(binds, &value[0], modes);
// Reset word markers:
for (value = BLK_HEAD(BUF_WORDS); NOT_END(value); value++)
binds[VAL_WORD_CANON(value)] = 0;
series = Copy_Array_At_Max_Shallow(
BUF_WORDS, start, SERIES_TAIL(BUF_WORDS) - start
);
RESET_TAIL(BUF_WORDS); // allow reuse
CHECK_BIND_TABLE;
return series;
}
开发者ID:kealist,项目名称:ren-c,代码行数:31,代码来源:c-frame.c
示例11: VAL_WORD_SYM
*/ REBINT PD_Frame(REBPVS *pvs)
/*
** pvs->value points to the first value in frame (SELF).
**
***********************************************************************/
{
REBCNT sym;
REBCNT s;
REBVAL *word;
REBVAL *val;
if (IS_WORD(pvs->select)) {
sym = VAL_WORD_SYM(pvs->select);
s = SYMBOL_TO_CANON(sym);
word = BLK_SKIP(VAL_FRM_WORDS(pvs->value), 1);
for (val = pvs->value + 1; NOT_END(val); val++, word++) {
if (sym == VAL_BIND_SYM(word) || s == VAL_BIND_CANON(word)) {
if (VAL_GET_OPT(word, OPTS_HIDE)) break;
if (VAL_PROTECTED(word)) Trap1(RE_LOCKED_WORD, word);
pvs->value = val;
return PE_SET;
}
}
}
return PE_BAD_SELECT;
}
开发者ID:51weekend,项目名称:r3,代码行数:26,代码来源:t-object.c
示例12: Is_Type_Of
//
// Is_Type_Of: C
//
// Types can be: word or block. Each element must be either
// a datatype or a typeset.
//
static REBOOL Is_Type_Of(const REBVAL *value, REBVAL *types)
{
const REBVAL *val;
val = IS_WORD(types) ? GET_OPT_VAR_MAY_FAIL(types) : types;
if (IS_DATATYPE(val))
return LOGICAL(VAL_TYPE_KIND(val) == VAL_TYPE(value));
if (IS_TYPESET(val))
return LOGICAL(TYPE_CHECK(val, VAL_TYPE(value)));
if (IS_BLOCK(val)) {
for (types = VAL_ARRAY_AT(val); NOT_END(types); types++) {
val = IS_WORD(types) ? GET_OPT_VAR_MAY_FAIL(types) : types;
if (IS_DATATYPE(val)) {
if (VAL_TYPE_KIND(val) == VAL_TYPE(value)) return TRUE;
}
else if (IS_TYPESET(val)) {
if (TYPE_CHECK(val, VAL_TYPE(value))) return TRUE;
}
else
fail (Error(RE_INVALID_TYPE, Type_Of(val)));
}
return FALSE;
}
fail (Error_Invalid_Arg(types));
}
开发者ID:kjanz1899,项目名称:ren-c,代码行数:35,代码来源:n-data.c
示例13: BLK_HEAD
*/ static void Bind_Relative_Words(REBSER *frame, REBSER *block)
/*
** Recursive function for relative function word binding.
**
** Note: frame arg points to an identifying series of the function,
** not a normal frame. This will be used to verify the word fetch.
**
***********************************************************************/
{
REBVAL *value = BLK_HEAD(block);
REBINT n;
for (; NOT_END(value); value++) {
if (ANY_WORD(value)) {
// Is the word (canon sym) found in this frame?
if (NZ(n = WORDS_HEAD(Bind_Table)[VAL_WORD_CANON(value)])) {
// Word is in frame, bind it:
VAL_WORD_INDEX(value) = n;
VAL_WORD_FRAME(value) = frame; // func body
}
}
else if (ANY_BLOCK(value))
Bind_Relative_Words(frame, VAL_SERIES(value));
}
}
开发者ID:dailybarid,项目名称:rebol,代码行数:25,代码来源:c-frame.c
示例14: VAL_TUPLE
*/ REBFLG MT_Tuple(REBVAL *out, REBVAL *data, REBCNT type)
/*
***********************************************************************/
{
REBYTE *vp;
REBINT len = 0;
REBINT n;
vp = VAL_TUPLE(out);
for (; NOT_END(data); data++, vp++, len++) {
if (len >= 10) return FALSE;
if (IS_INTEGER(data)) {
n = Int32(data);
}
else if (IS_CHAR(data)) {
n = VAL_CHAR(data);
}
else return FALSE;
if (n > 255 || n < 0) return FALSE;
*vp = n;
}
VAL_TUPLE_LEN(out) = len;
for (; len < 10; len++) *vp++ = 0;
VAL_SET(out, type);
return TRUE;
}
开发者ID:51weekend,项目名称:r3,代码行数:29,代码来源:t-tuple.c
示例15: if
*/ REBVAL *Find_In_Contexts(REBCNT sym, REBVAL *where)
/*
** Search a block of objects for a given word symbol and
** return the value for the word. NULL if not found.
**
***********************************************************************/
{
REBVAL *val;
for (; NOT_END(where); where++) {
if (IS_WORD(where)) {
val = Get_Var(where);
}
else if (IS_PATH(where)) {
Do_Path(&where, 0);
val = DS_TOP; // only safe for short time!
}
else
val = where;
if (IS_OBJECT(val)) {
val = Find_Word_Value(VAL_OBJ_FRAME(val), sym);
if (val) return val;
}
}
return 0;
}
开发者ID:dailybarid,项目名称:rebol,代码行数:27,代码来源:c-frame.c
示例16: D_ARG
/***********************************************************************
**
** Get_Obj_Mods -- return a block of modified words from an object
**
***********************************************************************/
REBVAL *Get_Obj_Mods(REBFRM *frame, REBVAL **inter_block)
{
REBVAL *obj = D_ARG(1);
REBVAL *words, *val;
REBFRM *frm = VAL_OBJ_FRAME(obj);
REBSER *ser = Make_Block(2);
REBOOL clear = D_REF(2);
//DISABLE_GC;
val = BLK_HEAD(frm->values);
words = BLK_HEAD(frm->words);
for (; NOT_END(val); val++, words++)
if (!(VAL_FLAGS(val) & FLAGS_CLEAN)) {
Append_Val(ser, words);
if (clear) VAL_FLAGS(val) |= FLAGS_CLEAN;
}
if (!STR_LEN(ser)) {
ENABLE_GC;
goto is_none;
}
Bind_Block(frm, BLK_HEAD(ser), FALSE);
VAL_SERIES(Temp_Blk_Value) = ser;
//ENABLE_GC;
return Temp_Blk_Value;
}
开发者ID:51weekend,项目名称:r3,代码行数:31,代码来源:t-object.c
示例17: Construct_Object
*/ void Init_Errors(REBVAL *errors)
/*
***********************************************************************/
{
REBSER *errs;
REBVAL *val;
// Create error objects and error type objects:
*ROOT_ERROBJ = *Get_System(SYS_STANDARD, STD_ERROR);
errs = Construct_Object(0, VAL_BLK(errors), 0);
Set_Object(Get_System(SYS_CATALOG, CAT_ERRORS), errs);
Set_Root_Series(TASK_ERR_TEMPS, Make_Block(3));
// Create objects for all error types:
for (val = BLK_SKIP(errs, 1); NOT_END(val); val++) {
errs = Construct_Object(0, VAL_BLK(val), 0);
SET_OBJECT(val, errs);
}
// Catch top level errors, to provide decent output:
PUSH_STATE(Top_State, Saved_State);
if (SET_JUMP(Top_State)) {
POP_STATE(Top_State, Saved_State);
DSP++; // Room for return value
Catch_Error(DS_TOP); // Stores error value here
Print_Value(DS_TOP, 0, FALSE);
Crash(RP_NO_CATCH);
}
SET_STATE(Top_State, Saved_State);
}
开发者ID:51weekend,项目名称:r3,代码行数:31,代码来源:c-error.c
示例18: Next_Path_Throws
//
// Next_Path_Throws: C
//
// Evaluate next part of a path.
//
REBOOL Next_Path_Throws(REBPVS *pvs)
{
REBPEF dispatcher;
REBVAL temp;
VAL_INIT_WRITABLE_DEBUG(&temp);
// Path must have dispatcher, else return:
dispatcher = Path_Dispatch[VAL_TYPE_0(pvs->value)];
if (!dispatcher) return FALSE; // unwind, then check for errors
pvs->item++;
//Debug_Fmt("Next_Path: %r/%r", pvs->path-1, pvs->path);
// object/:field case:
if (IS_GET_WORD(pvs->item)) {
pvs->selector = GET_MUTABLE_VAR_MAY_FAIL(pvs->item);
if (IS_UNSET(pvs->selector))
fail (Error(RE_NO_VALUE, pvs->item));
}
// object/(expr) case:
else if (IS_GROUP(pvs->item)) {
if (DO_VAL_ARRAY_AT_THROWS(&temp, pvs->item)) {
*pvs->value = temp;
return TRUE;
}
pvs->selector = &temp;
}
else // object/word and object/value case:
pvs->selector = pvs->item;
switch (dispatcher(pvs)) {
case PE_OK:
break;
case PE_SET_IF_END:
if (pvs->opt_setval && IS_END(pvs->item + 1)) {
*pvs->value = *pvs->opt_setval;
pvs->opt_setval = NULL;
}
break;
case PE_NONE:
SET_NONE(pvs->store);
case PE_USE_STORE:
pvs->value = pvs->store;
break;
default:
assert(FALSE);
}
if (NOT_END(pvs->item + 1)) return Next_Path_Throws(pvs);
return FALSE;
}
开发者ID:kjanz1899,项目名称:ren-c,代码行数:63,代码来源:c-path.c
示例19: Find_Max_Bit
//
// Find_Max_Bit: C
//
// Return integer number for the maximum bit number defined by
// the value. Used to determine how much space to allocate.
//
REBINT Find_Max_Bit(REBVAL *val)
{
REBINT maxi = 0;
REBINT n;
switch (VAL_TYPE(val)) {
case REB_CHAR:
maxi = VAL_CHAR(val)+1;
break;
case REB_INTEGER:
maxi = Int32s(val, 0);
break;
case REB_STRING:
case REB_FILE:
case REB_EMAIL:
case REB_URL:
case REB_TAG:
// case REB_ISSUE:
n = VAL_INDEX(val);
if (VAL_BYTE_SIZE(val)) {
REBYTE *bp = VAL_BIN(val);
for (; n < cast(REBINT, VAL_LEN_HEAD(val)); n++)
if (bp[n] > maxi) maxi = bp[n];
}
else {
REBUNI *up = VAL_UNI(val);
for (; n < cast(REBINT, VAL_LEN_HEAD(val)); n++)
if (up[n] > maxi) maxi = up[n];
}
maxi++;
break;
case REB_BINARY:
maxi = VAL_LEN_AT(val) * 8 - 1;
if (maxi < 0) maxi = 0;
break;
case REB_BLOCK:
for (val = VAL_ARRAY_AT(val); NOT_END(val); val++) {
n = Find_Max_Bit(val);
if (n > maxi) maxi = n;
}
//maxi++;
break;
case REB_NONE:
maxi = 0;
break;
default:
return -1;
}
return maxi;
}
开发者ID:kjanz1899,项目名称:ren-c,代码行数:64,代码来源:t-bitset.c
示例20: FRM_VALUES
*/ void Check_Frame(REBSER *frame)
/*
***********************************************************************/
{
REBINT n;
REBVAL *values = FRM_VALUES(frame);
REBVAL *words = FRM_WORDS(frame);
REBINT tail = SERIES_TAIL(frame);
for (n = 0; n < tail; n++, values++, words++) {
if (IS_END(words) || IS_END(values)) {
Debug_Fmt("** Early %s end at index: %d", IS_END(words) ? "words" : "values", n);
}
}
if (NOT_END(words) || NOT_END(values))
Debug_Fmt("** Missing %s end at index: %d type: %d", NOT_END(words) ? "words" : "values", n, VAL_TYPE(words));
}
开发者ID:dailybarid,项目名称:rebol,代码行数:18,代码来源:c-frame.c
注:本文中的NOT_END函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论