这篇教程C++ valInt函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中valInt函数的典型用法代码示例。如果您正苦于以下问题:C++ valInt函数的具体用法?C++ valInt怎么用?C++ valInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了valInt函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: forwardsSpatialstatic statusforwardsSpatial(Spatial s, Any from, Any to){ Int xref, yref; Int tX, tY, tW, tH; Area f, t; TRY(f = get(from, NAME_area, EAV)); TRY(t = get(to, NAME_area, EAV)); CALC(xref,s->xFrom,getVar(s->xFrom,VarXref,VarX,f->x,VarW,f->w, EAV),f->x); CALC(yref,s->yFrom,getVar(s->yFrom,VarYref,VarY,f->y,VarH,f->h, EAV),f->y); CALC(tW, s->wTo, getVar(s->wTo, VarW2, VarW, f->w, EAV), t->w); CALC(tH, s->hTo, getVar(s->hTo, VarH2, VarH, f->h, EAV), t->h); CALC(tX, s->xTo,getVar(s->xTo, VarX, VarXref, xref, VarW, tW, EAV), t->x); CALC(tY, s->yTo,getVar(s->yTo, VarY, VarYref, yref, VarH, tH, EAV), t->y); DEBUG(NAME_spatial, Cprintf("%s->f: (%s,%s) -- %ld,%ld,%ld,%ld ==> (%ld, %ld, %ld, %ld)/n", pp(s), pp(from), pp(to), valInt(f->x), valInt(f->y), valInt(f->w), valInt(f->h), valInt(tX), valInt(tY), valInt(tW), valInt(tH))); if (t->x != tX || t->y != tY || t->w != tW || t->h != tH) return send(to, NAME_set, tX, tY, tW, tH, EAV); succeed;}
开发者ID:SWI-Prolog,项目名称:packages-xpce,代码行数:27,
示例2: backwardsSpatialstatic statusbackwardsSpatial(Spatial s, Any from, Any to){ Int xref, yref; Int fW, fH, fX, fY; Area f, t; TRY(f = get(from, NAME_area, EAV)); TRY(t = get(to, NAME_area, EAV)); CALC(xref, s->xTo, getVar(s->xTo,VarXref,VarX,t->x,VarW,t->w,EAV), t->x); CALC(yref, s->yTo, getVar(s->yTo,VarYref,VarY,t->y,VarH,t->h,EAV), t->y); CALC(fW, s->wTo, getVar(s->wTo,VarW,VarW2,t->w,EAV), f->w); CALC(fH, s->hTo, getVar(s->hTo,VarH,VarH2,t->h,EAV), f->h); CALC(fX, s->xTo, getVar(s->xFrom,VarX,VarXref,xref,VarW,f->w,EAV), f->x); CALC(fY, s->yTo, getVar(s->yFrom,VarY,VarYref,yref,VarH,f->h,EAV), f->y); DEBUG(NAME_spatial, Cprintf("%s->b: (%s,%s) -- %ld,%ld,%ld,%ld ==> (%ld, %ld, %ld, %ld)/n", pp(s), pp(from), pp(to), valInt(t->x), valInt(t->y), valInt(t->w), valInt(t->h), valInt(fX), valInt(fY), valInt(fW), valInt(fH))); if (f->x != fX || f->y != fY || f->w != fW || f->h != fH) return send(from, NAME_set, fX, fY, fW, fH, EAV); succeed;}
开发者ID:SWI-Prolog,项目名称:packages-xpce,代码行数:28,
示例3: cornerAreastatic statuscornerArea(Area a, Point pos){ int w, h; w = valInt(pos->x) - valInt(a->x); w += (w>=0 ? 1 : -1); h = valInt(pos->y) - valInt(a->y); h += (h>=0 ? 1 : -1); assign(a, w, toInt(w)); assign(a, h, toInt(h)); succeed;}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:14,
示例4: compute_label_sliderstatic voidcompute_label_slider(Slider s, int *lw, int *lh){ if ( s->show_label == ON ) { if ( isDefault(s->label_font) ) obtainClassVariablesObject(s); dia_label_size(s, lw, lh, NULL); *lw += valInt(getExFont(s->label_font)); if ( notDefault(s->label_width) ) *lw = max(valInt(s->label_width), *lw); } else { *lw = *lh = 0; }}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:14,
示例5: table_cell_paddingvoidtable_cell_padding(TableCell cell, int *pxptr, int* pyptr){ Size size; Table tab; if ( notDefault(cell->cell_padding) ) size = cell->cell_padding; else if ( (tab=table_of_cell(cell)) ) size = tab->cell_padding; else return; /* should not happen */ *pxptr = valInt(size->w); *pyptr = valInt(size->h);}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:15,
示例6: xpmGetRGBfromNameintxpmGetRGBfromName(char *inname, int *r, int *g, int *b){ char name[256]; char *q = name, *s = inname; Name cname; Int pcergb; for( ;*s; s++, q++) { if ( isupper(*s) ) *q = tolower(*s); else if ( *s == ' ' ) *q = '_'; else *q = *s; } *q = EOS; cname = CtoKeyword(name); if ( (pcergb = getMemberHashTable(LoadColourNames(), cname)) ) { COLORREF rgb = valInt(pcergb); *r = GetRValue(rgb); *g = GetGValue(rgb); *b = GetBValue(rgb); } else { *r = 255; /* nothing there, return red */ *g = *b = 0; } return 1; /* we have it */}
开发者ID:ddgold,项目名称:design_patterns,代码行数:31,
示例7: getBottomSideAreastatic IntgetBottomSideArea(Area a){ if ( valInt(a->h) >= 0 ) answer(add(a->y, a->h)); else answer(a->y);}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:7,
示例8: getRightSideAreastatic IntgetRightSideArea(Area a){ if ( valInt(a->w) >= 0 ) answer(add(a->x, a->w)); else answer(a->x);}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:7,
示例9: getTailVectorAnygetTailVector(Vector v){ if ( v->size != ZERO ) answer(v->elements[valInt(v->size)-1]); fail;}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:7,
示例10: RedrawAreaTextMarginstatic statusRedrawAreaTextMargin(TextMargin m, Area a){ int x, y, w, h; Elevation z = getClassVariableValueObject(m, NAME_elevation); Any obg; initialiseDeviceGraphical(m, &x, &y, &w, &h); margin_x = x; margin_y = y; obg = r_background(m->background); r_clear(x, y, w, h); if ( z && notNil(z) ) r_3d_box(x, y, w, h, 0, z, FALSE); else { r_thickness(valInt(m->pen)); r_dash(m->texture); r_box(x, y, w, h, 0, NIL); } scan_fragment_icons(m, paint_fragment, NAME_forSome, NIL); RedrawAreaGraphical(m, a); r_background(obg); succeed;}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:27,
示例11: ws_open_colourmapstatic voidws_open_colourmap(ColourMap cm){ if ( !getExistingPaletteColourMap(cm) && notNil(cm->colours) ) { int size = valInt(cm->colours->size); LOGPALETTE *lp = pceMalloc(offset(LOGPALETTE, palPalEntry[size])); PALETTEENTRY *pe = &lp->palPalEntry[0]; HPALETTE hpal; int n, nc = 0; DisplayObj d = CurrentDisplay(NIL); for(n=0; n<size; n++) { Colour c = cm->colours->elements[n]; if ( isName(c) && (c = checkType(c, TypeColour, NIL)) ) elementVector(cm->colours, toInt(n+1), c); if ( instanceOfObject(c, ClassColour) ) { if ( c->kind == NAME_named ) ws_create_colour(c, d); pe->peRed = valInt(c->red) >> 8; pe->peGreen = valInt(c->green) >> 8; pe->peBlue = valInt(c->blue) >> 8; pe->peFlags = 0; pe++; nc++; } else Cprintf("%s is not a colour/n", pp(c)); }
开发者ID:ddgold,项目名称:design_patterns,代码行数:30,
示例12: computeAscentDescentGrBoxstatuscomputeAscentDescentGrBox(GrBox grb){ Graphical gr = grb->graphical; int h, ascent, descent; ComputeGraphical(gr); h = valInt(gr->area->h); if ( grb->alignment == NAME_top ) ascent = 0; else if ( grb->alignment == NAME_bottom ) ascent = h; else ascent = h/2; descent = h-ascent; if ( grb->ascent != toInt(ascent) || grb->descent != toInt(descent) ) { assign(grb, ascent, toInt(ascent)); assign(grb, descent, toInt(descent)); succeed; /* changed */ } else fail; /* no change */}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:25,
示例13: computeButtonstatic statuscomputeButton(Button b){ if ( notNil(b->request_compute) ) { int w, h, isimage; TRY(obtainClassVariablesObject(b)); dia_label_size(b, &w, &h, &isimage); if ( b->look == NAME_winMenuBar || b->look == NAME_gtkMenuBar ) { if ( !isimage ) { w += valInt(getExFont(b->label_font)) * 2; if ( b->look == NAME_gtkMenuBar ) h += 4; } else { w += 4; h += 4; } } else { if ( isimage ) { w += 4; h += 4; } else { Size size = getClassVariableValueObject(b, NAME_size); h += 6; w += 10 + valInt(b->radius); if ( notNil(b->popup) ) { if ( notNil(b->popup->popup_image) ) w += valInt(b->popup->popup_image->size->w) + 5; else if ( b->look == NAME_motif || b->look == NAME_gtk ) w += 12 + 5; else w += 9 + 5; } w = max(valInt(size->w), w); h = max(valInt(size->h), h); } } CHANGING_GRAPHICAL(b, assign(b->area, w, toInt(w)); assign(b->area, h, toInt(h))); assign(b, request_compute, NIL); }
开发者ID:brayc0,项目名称:nlfetdb,代码行数:47,
示例14: RedrawAreaLabelstatic statusRedrawAreaLabel(Label lb, Area a){ int x, y, w, h; Elevation z = lb->elevation; int preview = (lb->status == NAME_preview && notNil(lb->message)); initialiseDeviceGraphical(lb, &x, &y, &w, &h); if ( notNil(z) ) r_3d_box(x, y, w, h, 0, z, !preview); x += valInt(lb->border); y += valInt(lb->border); w -= 2*valInt(lb->border); h -= 2*valInt(lb->border); if ( lb->wrap == NAME_clip ) d_clip(x, y, w, h); if ( instanceOfObject(lb->selection, ClassCharArray) ) { String s = &((CharArray)lb->selection)->data; if ( notNil(z) ) x += valInt(getExFont(lb->font))/2; if ( lb->wrap == NAME_clip ) { LocalString(buf, s->iswide, s->size+1); str_one_line(buf, s); s = buf; } str_label(s, 0, lb->font, x, y, w, h, NAME_left, NAME_top, lb->active == ON ? 0 : LABEL_INACTIVE); } else /*if ( instanceOfObject(lb->selection, ClassImage) )*/ { Image image = (Image) lb->selection; r_image(image, 0, 0, x, y, w, h, ON); } if ( lb->wrap == NAME_clip ) d_clip_done(); if ( preview && isNil(z) ) r_complement(x, y, w, h); return RedrawAreaGraphical(lb, a);}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:47,
示例15: includeArrowsInAreaArcstatic voidincludeArrowsInAreaArc(Arc a){ if ( notNil(a->first_arrow) || notNil(a->second_arrow) ) { int sx, sy, ex, ey; int cx, cy; Any av[4]; points_arc(a, &sx, &sy, &ex, &ey); cx = valInt(a->position->x); cy = valInt(a->position->y); if ( notNil(a->first_arrow) ) { av[0] = toInt(sx); av[1] = toInt(sy); if ( valReal(a->size_angle) >= 0.0 ) { av[2] = toInt(sx+(sy-cy)); av[3] = toInt(sy-(sx-cx)); } else { av[2] = toInt(sx-(sy-cy)); av[3] = toInt(sy+(sx-cx)); } if ( qadSendv(a->first_arrow, NAME_points, 4, av) ) { ComputeGraphical(a->first_arrow); unionNormalisedArea(a->area, a->first_arrow->area); } } if ( notNil(a->second_arrow) ) { av[0] = toInt(ex); av[1] = toInt(ey); if ( valReal(a->size_angle) >= 0.0 ) { av[2] = toInt(ex-(ey-cy)); av[3] = toInt(ey+(ex-cx)); } else { av[2] = toInt(ex+(ey-cy)); av[3] = toInt(ey-(ex-cx)); } if ( qadSendv(a->second_arrow, NAME_points, 4, av) ) { ComputeGraphical(a->second_arrow); unionNormalisedArea(a->area, a->second_arrow->area); } } }}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:47,
示例16: getCopyVectorVectorgetCopyVector(Vector v){ Vector v2 = answerObjectv(classOfObject(v), valInt(v->size), v->elements); assign(v2, offset, v->offset); answer(v2);}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:8,
示例17: find_fragmentstatic statusfind_fragment(TextMargin m, int x, int y, Fragment fragment, position *pos){ Style s; Size sz; int ex, ey; if ( isNil(s = fragment_style(m, fragment)) || isNil(s->icon) ) fail; ex = pos->x; ey = pos->y; sz = s->icon->size; if ( ex >= x && ey >= y && ex <= x + valInt(sz->w) && ey <= y + valInt(sz->h) ) succeed; fail;}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:17,
示例18: getArgVectorAnygetArgVector(Vector v, Int arg){ int n = valInt(arg) - 1; validIndex(v, n); answer(v->elements[n]);}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:8,
示例19: put_int64intput_int64(Word at, int64_t l, int flags ARG_LD){ Word p; word r, m; int req; r = consInt(l); if ( valInt(r) == l ) { *at = r; return TRUE; }#if SIZEOF_VOIDP == 8 req = 3;#elif SIZEOF_VOIDP == 4 req = 4;#else#error "FIXME: Unsupported sizeof word"#endif if ( !hasGlobalSpace(req) ) { int rc = ensureGlobalSpace(req, flags); if ( rc != TRUE ) return rc; } p = gTop; gTop += req;#if SIZEOF_VOIDP == 8 r = consPtr(p, TAG_INTEGER|STG_GLOBAL); m = mkIndHdr(1, TAG_INTEGER); *p++ = m; *p++ = l; *p = m;#else#if SIZEOF_VOIDP == 4 r = consPtr(p, TAG_INTEGER|STG_GLOBAL); m = mkIndHdr(2, TAG_INTEGER); *p++ = m;#ifdef WORDS_BIGENDIAN *p++ = (word)(l>>32); *p++ = (word)l;#else *p++ = (word)l; *p++ = (word)(l>>32);#endif *p = m;#else#error "FIXME: Unsupported sizeof intptr_t."#endif#endif *at = r; return TRUE;}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:58,
示例20: sortVectorstatic statussortVector(Vector v, Code code, Int from, Int to){ int f, t, n; f = valInt(v->offset) + 1; t = f + valInt(v->size) - 1; if ( notDefault(from) && valInt(from) > f ) f = valInt(from); if ( notDefault(to) && valInt(to) > t ) t = valInt(to); if ( t <= f ) succeed; n = t-f+1; f -= valInt(v->offset) + 1; { Code old = qsortCompareCode; /* make reentrant */ qsortCompareCode = code; qsort(&v->elements[f], n, sizeof(Any), qsortCompareObjects); qsortCompareCode = old; } succeed;}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:27,
示例21: width_textstatic intwidth_text(FontObj f, const char *s){ CharArray ctmp = CtoScratchCharArray(s); Int w = getWidthFont(f, ctmp); doneScratchCharArray(ctmp); return(valInt(w));}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:9,
示例22: format_valuestatic voidformat_value(Slider s, char *buf, Any val){ int deffmt = isDefault(s->format); if ( isInteger(val) ) sprintf(buf, deffmt ? INTPTR_FORMAT : strName(s->format), valInt(val)); else sprintf(buf, deffmt ? "%g" : strName(s->format), valReal(val));}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:9,
示例23: dragPopupGesturestatic statusdragPopupGesture(PopupGesture g, EventObj ev){ if ( notNil(g->current) && g->current->displayed == ON ) { DEBUG(NAME_popup, Cprintf("Posting drag to %s/n", pp(g->current))); return postEvent(ev, (Graphical) g->current, DEFAULT); } else { if ( notNil(g->max_drag_distance) ) { PceWindow sw; if ( instanceOfObject((sw=ev->window), ClassWindow) && valInt(getDistanceEvent(sw->focus_event, ev)) > valInt(g->max_drag_distance) ) send(g, NAME_cancel, ev, EAV); } } fail;}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:18,
示例24: eventPopupGesturestatic statuseventPopupGesture(PopupGesture g, EventObj ev){ if ( g->status == NAME_active && isUpEvent(ev) ) { PceWindow sw; if ( !(sw = getWindowGraphical(ev->receiver)) ) sw = ev->window; if ( notNil(g->current) && g->current->displayed == OFF ) { send(g->current, NAME_open, ev->receiver, getAreaPositionEvent(ev, DEFAULT), EAV); attributeObject(g, NAME_Stayup, ON); grabPointerWindow(sw, ON); focusWindow(sw, ev->receiver, (Recogniser) g, g->cursor, NIL); } else if ( valInt(getClickTimeEvent(ev)) < 400 && getAttributeObject(g, NAME_Stayup) != ON ) { attributeObject(g, NAME_Stayup, ON); grabPointerWindow(sw, ON); focusWindow(sw, ev->receiver, (Recogniser) g, g->cursor, NIL); } else { send(g, NAME_terminate, EAV); if ( isNil(g->current) ) { grabPointerWindow(sw, OFF); focusWindow(sw, NIL, NIL, NIL, NIL); deleteAttributeObject(g, NAME_Stayup); assign(g, status, NAME_inactive); } } succeed; } else if ( notNil(g->current) && g->current->displayed == ON ) return postEvent(ev, (Graphical) g->current, DEFAULT); if ( eventGesture(g, ev) ) succeed; if ( g->status == NAME_active && isAEvent(ev, NAME_keyboard) ) { Name key; TRY(updatePopupGesture(g, ev)); key = characterName(getIdEvent(ev)); if ( send(g->current, NAME_key, key, EAV) ) { Any context = g->context; PopupObj current = g->current; assign(g, context, NIL); assign(g, current, NIL); send(current, NAME_execute, context, EAV); succeed; } else send(g, NAME_cancel, ev, EAV); } fail;}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:57,
示例25: paint_fragmentstatic statuspaint_fragment(TextMargin m, int x, int y, Fragment fragment){ Image icon; Style s; int w, h; if ( notNil(s = fragment_style(m, fragment)) && notNil(icon = s->icon) ) { x += margin_x; y += margin_y; w = valInt(icon->size->w); h = valInt(icon->size->h); r_image(icon, 0, 0, x, y, w, h, ON); if ( m->editor->selected_fragment == fragment ) r_complement(x, y, w, h); } succeed;}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:19,
示例26: storeVectorstatic statusstoreVector(Vector v, FileObj file){ int n; TRY(storeSlotsObject(v, file)); for(n = 0; n < valInt(v->size); n++) TRY(storeObject(v->elements[n], file)); succeed;}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:10,
示例27: cToPceIntegerAnycToPceInteger(intptr_t i){ Int n = toInt(i); if ( valInt(n) != i ) { errorPce(PCE, NAME_intRange); fail; } return n;}
开发者ID:brayc0,项目名称:nlfetdb,代码行数:11,
注:本文中的valInt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ val_array_ptr函数代码示例 C++ val2str函数代码示例 |