Пример #1
0
/*
 * NAME:	data->get_varmap()
 * DESCRIPTION:	get the variable mapping for an object
 */
static unsigned short *d_get_varmap(object **obj, Uint update, unsigned short *nvariables)
{
    object *tmpl;
    unsigned short nvar, *vmap;

    tmpl = OBJ((*obj)->prev);
    if (O_UPGRADING(*obj)) {
	/* in the middle of an upgrade */
	tmpl = OBJ(tmpl->prev);
    }
    vmap = o_control(tmpl)->vmap;
    nvar = tmpl->ctrl->vmapsize;

    if (tmpl->update != update) {
	unsigned short *m1, *m2, n;

	m1 = vmap;
	vmap = ALLOC(unsigned short, n = nvar);
	do {
	    tmpl = OBJ(tmpl->prev);
	    m2 = o_control(tmpl)->vmap;
	    while (n > 0) {
		*vmap++ = (NEW_VAR(*m1)) ? *m1++ : m2[*m1++];
		--n;
	    }
	    n = nvar;
	    vmap -= n;
	    m1 = vmap;
	} while (tmpl->update != update);
    }
Пример #2
0
Object *Builtin_subtract(ListObject *arg, ListObject *context)
{
	NumberObject *ret = NULL;

	int i = 0;
	while (i < arg->len)
	{
		Object *term = arg->arr[i];
		if (Object_istype(term, NUMBER_OBJECT))
		{
			if (i == 0)
			{
				double init = NUM(term)->value;
				if (arg->len == 1)
					init = -init;
				ret = new_NumberObject(init);
			}
			else
				NUM(ret)->value -= NUM(term)->value;
		}
		else
		{
			if (ret != NULL)
				del_Object(OBJ(ret));
			ret = NULL;
			break;
		}
		i++;
	}
	if (ret == NULL)
		cause_error(INCORRECT_ARGUMENT_ERROR, "(<number> <number> ...)", 23);

	return OBJ(ret);
}
Пример #3
0
/* cloneGraph:
 * Clone node, edge and subgraph structure from src to tgt.
 */
static void cloneGraph(Agraph_t * tgt, Agraph_t * src)
{
    Agedge_t *e;
    Agnode_t *t;
    Agraph_t *sg;

    for (t = agfstnode(src); t; t = agnxtnode(t)) {
	if (!copy(tgt, OBJ(t))) {
	    error(ERROR_FATAL, "error cloning node %s from graph %s",
		  agnameof(t), agnameof(src));
	}
    }
    for (t = agfstnode(src); t; t = agnxtnode(t)) {
	for (e = agfstout(t); e; e = agnxtout(e)) {
	    if (!copy(tgt, OBJ(e))) {
		error(ERROR_FATAL,
		      "error cloning edge (%s,%s)[%s] from graph %s",
		      agnameof(agtail(e)), agnameof(aghead(e)),
		      agnameof(e), agnameof(src));
	    }
	}
    }
    for (sg = agfstsubg(src); sg; sg = agnxtsubg(sg)) {
	if (!cloneSubg(tgt, sg)) {
	    error(ERROR_FATAL, "error cloning subgraph %s from graph %s",
		  agnameof(sg), agnameof(src));
	}
    }
}
Пример #4
0
obj translate_LR( RStore *in_store, struct LocationRef lr )
{
  struct PageRef ref;

  if (lr.indirect)
    {
      if (lr.first)
	{
	  struct VMPageRecord *vmpr;

	  ref.base_page_num = lr.base_page_num;
	  ref.first = 1;
	  ref.indirect = 1;
	  ref.dirty = 0;
	  ref.loaded = 0;
	  ref.nth_page = lr.nth_page;

	  vmpr = get_vmpr( in_store, &ref );

	  if (!vmpr || lr.offset > 63 || lr.nth_page != 1)
	    {
	      scheme_error( "translate_ptr(~d[~d]): illegal",
			    2, 
			    int2fx( lr.base_page_num ),
			    int2fx( lr.offset ) );
	    }
	  return ((obj *)vmpr->mem_address)[ lr.offset ];
	}
      else
	{
	  /* special hack for immobs */
	  return OBJ(lr.base_page_num);
	}
    }
  else
    {
      struct VMPageRecord *vmpr;

      ref.base_page_num = lr.base_page_num;
      ref.first = lr.first;
      ref.indirect = 0;
      ref.dirty = 0;
      ref.loaded = 0;
      ref.nth_page = lr.nth_page;
      vmpr = get_vmpr( in_store, &ref );
      if (!vmpr)
	{
	  scheme_error( "translate_ptr(~x.~04x+~x): illegal",
		        3,
		       int2fx( lr.base_page_num >> 16 ),
		       int2fx( lr.base_page_num & 0xFFFF ),
		       int2fx( lr.offset ) );

	}
      return OBJ( (UINT_32)vmpr->mem_address + lr.offset );
    }
Пример #5
0
/* isEdge:
 * Return edge, if any, between t and h with given key.
 * Edge is in root graph
 */
Agedge_t *isEdge(Agnode_t * t, Agnode_t * h, char *key)
{
    Agraph_t *root;

    if ((root = sameG(t, h, "isEdge", "tail and head node"))) {
	t = (Agnode_t *) agrebind(root, OBJ(t));
	h = (Agnode_t *) agrebind(root, OBJ(h));
	return agedge(t, h, key, 0);
    } else
	return 0;
}
Пример #6
0
/*
 * _nd_adjustXY() is an unpublished function that
 * adjusts a x/y pair according to a return code from
 * _nd_drawObjCommon.
 */
void
_nd_adjustXY(int rc, void* o, int* x, int* y)
{
    ADJUSTXY(OBJ(o), (*x), (*y));
    if (rc & DREW_TITLE)
	(*y)++;
    if (rc & DREW_A_BOX) {
	(*y)++;
	(*x)++;
    }
    if (rc & DREW_PREFIX)
	(*x) += strlen(OBJ(o)->prefix);
} /* _nd_adjustXY */
Пример #7
0
void
printNextObjChain(void *obj)
{
    Obj *p = OBJ(obj);

    if (p == 0)
	return;
    do {
	assert(p != 0);
	printf("(%d,%d) %s title [%s]\n", p->x, p->y, objId(p), objTitle(p));
	p = p->next;
    } while (p != OBJ(obj));
} /* printNextObjChain */
Пример #8
0
ULONG storePrefs(BOOL bStorePrefs)
{
    struct URL_Prefs up;

    /* Copy settings from gadgets into structure */
    up.up_Version = PREFS_VERSION;

    /* Browsers */
    IExec->CopyMem(&list_Brow, &up.up_BrowserList, sizeof(struct MinList));

    /* Mailers */
    IExec->CopyMem(&list_Mail, &up.up_MailerList, sizeof(struct MinList));

    /* FTPs */
    IExec->CopyMem(&list_FTPs, &up.up_FTPList, sizeof(struct MinList));

    /* Miscellaneous */
    if(iget(OBJ(OBJ_PREPEND), GA_Selected))
        SET_FLAG(up.up_Flags, UPF_PREPENDHTTP);
    else
        CLEAR_FLAG(up.up_Flags, UPF_PREPENDHTTP);

    if(iget(OBJ(OBJ_SEND_MAILTO), GA_Selected))
        SET_FLAG(up.up_Flags, UPF_DOMAILTO);
    else
        CLEAR_FLAG(up.up_Flags, UPF_DOMAILTO);

    if(iget(OBJ(OBJ_SEND_FTP), GA_Selected))
        SET_FLAG(up.up_Flags, UPF_DOFTP);
    else
        CLEAR_FLAG(up.up_Flags, UPF_DOFTP);

    if(iget(OBJ(OBJ_SEND_MAILTO), GA_Selected))
        SET_FLAG(up.up_Flags, UPF_DOMAILTO);
    else
        CLEAR_FLAG(up.up_Flags, UPF_DOMAILTO);

    if(iget(OBJ(OBJ_SEND_FTP), GA_Selected))
        SET_FLAG(up.up_Flags, UPF_DOFTP);
    else
        CLEAR_FLAG(up.up_Flags, UPF_DOFTP);

    up.up_DefShow = iget(OBJ(OBJ_UNICONIFY), GA_Selected);
    up.up_DefBringToFront = iget(OBJ(OBJ_BRING), GA_Selected);
    up.up_DefNewWindow = iget(OBJ(OBJ_OPEN), GA_Selected);
    up.up_DefLaunch = iget(OBJ(OBJ_LAUNCH), GA_Selected);

    /* Save to disk */
    if (!IOpenURL->URL_SetPrefs(&up,URL_SetPrefs_Save,bStorePrefs,TAG_DONE))
        RA_Request((Object *)window,getString(MSG_ErrReqTitle),getString(MSG_ErrReqGadget),getString(MSG_Err_FailedSave),NULL);

    return TRUE;
}
Пример #9
0
int search(string str){
    if(grenda){
           write("Grenda doesn't let you near her box of knitting supplies.\n");
            return 1;
       }
    if(searched){
       write("The box contains nothing of interest");
       return 1;
          }
   if(!str){ 
    write("That cannot be searched here"); 
    return 1; 
        } 
   if(!grenda){
          
      if(str !="box")
        {
        write("You find a pair of golden knitting needles in the box!\n");
        needle=clone_object(OBJ(needle));
        needle->move(TP);
        searched = 1;
        return 1;
          }
    }
}
Пример #10
0
Файл: int.c Проект: rendau/rose
obj_t
int_new_wc(obj_t obj) {
  ASSERT(!obj || (obj->type != OBJ_INT), "bad object");
  return OBJ(int_new(INT(obj)->v));
 error:
  return NULL;
}
Пример #11
0
bool VdfnObjectRegistry::SetObject( const std::string &strName, 
				IVistaNameable *pObj, 
				IVistaTransformable *pTrans )
{
	if(m_mpObjects.find(strName) != m_mpObjects.end())
		return false;

	if( pObj )
	{
		if( pObj->GetNameForNameable().empty() )
		{
			vstr::outi() << "[VdfnObjectRegistry]: Registering <unnamed> as ["
						<< strName << "]" << std::endl;
		}
		else
		{
			vstr::outi() << "[VdfnObjectRegistry]: Registering [" 
						<< pObj->GetNameForNameable() << "] as [" 
						<< strName << "]" << std::endl;
		}
	}	

	m_mpObjects[strName] = OBJ(pObj, pTrans);
	return true;
}
Пример #12
0
static void tri_swizzled( int offset, obj from, obj to )
{
  char *comment = NULL;
  char temp[1000], *d;

  d = temp;

#if INCLUDE_COMMENTS
  if (OBJ_ISA_PTR(from))
    {
      obj k = OBJ( VAL(from) - POINTER_TAG );
      comment = get_comment( k );
    }
#endif
  if (offset == -1)
    d += sprintf( d, "  class" );
  else if (offset == -2)
    d += sprintf( d, "   self" );
  else
    d += sprintf( d, "    [%d]", offset/SLOT(1) );
  
  d += sprintf( d, " %#lx => %#lx", VAL(from), VAL(to) );
    
  if (OBJ_ISA_PTR(to))
    {
      d += sprintf( d, " *" );
    }

  if (comment)
    {
      d += sprintf( d, " %s", comment );
    }
  tri_printf( "%s\n", temp );
}
Пример #13
0
obj_t
float_new_wc(obj_t obj) {
  ASSERT(!obj || (obj->type != OBJ_FLOAT), "bad object");
  return OBJ(float_new(FLOAT(obj)->v));
 error:
  return NULL;
}
Пример #14
0
static void wrapsetter(js_State *J)
{
	pdf_jsimp_setter *set;
	const char *type;
	void *jsctx;
	void *obj;

	js_getregistry(J, "jsctx");
	jsctx = js_touserdata(J, "jsctx", -1);
	js_pop(J, 1);

	js_currentfunction(J);
	{
		js_getproperty(J, -1, "__set");
		set = js_touserdata(J, "setter", -1);
		js_pop(J, 1);

		js_getproperty(J, -1, "__type");
		type = js_tostring(J, -1);
		js_pop(J, 1);
	}
	js_pop(J, 1);

	if (js_isuserdata(J, type, 0))
		obj = js_touserdata(J, type, 0);
	else
		obj = NULL;

	set(jsctx, obj, OBJ(1));

	js_pushundefined(J);
}
Пример #15
0
/*
 * coreSortObjChain() sorts an object chain by some user-specified criteria,
 * returning a pointer to the start of the chain.
 *
 * We could do this in some elegant fashion, but that would make my
 * head hurt.  Instead, we build an array of Obj*'s, run qsort on
 * that array, reassemble the chain, and return a pointer to the new
 * head of the chain.
 */
void*
coreSortObjChain(void *chain, int (*sortf)(const void*, const void*))
{
    Obj **list;
    Obj *run;
    int idx;
    int count;

    if (chain == 0) {
	errno = EINVAL;
	return 0;
    }


    /* count the number of elements in the chain */
    count =0;
    run = OBJ(chain);
    do {
	++count;
	run = run->next;
	if (run == 0) {
	    errno = EFAULT;
	    return 0;
	}
    } while (run != OBJ(chain));

    /* build an array of Obj*'s */
    if ((list = (Obj**)malloc(count * sizeof list[0])) == (Obj**)0)
	return 0;

    for (run=OBJ(chain),idx=0; idx<count; idx++) {
	list[idx] = run;
	run = run->next;
    }

    /* sort the array */
    qsort(list, count, sizeof list[0], sortf);

    /* reassemble the chain */
    for (idx=0; idx<count; idx++) {
	list[idx]->next = (idx == count-1) ? list[0] : list[idx+1];
	list[idx]->prev = (idx == 0) ? list[count-1] : list[idx-1];
    }
    chain = list[0];
    free(list);
    return chain;
} /* coreSortObjChain */
Пример #16
0
/*
 * objAt() returns the x,y position of the upper right hand corner of the
 * object.
 */
int
objAt(void* obj, int* x, int* y)
{
    *x = *y = 0;

    if (obj == 0) {
	errno = EINVAL;
	return -1;
    }

    if (objType(obj) != O_BUTTON) {
	*x = OBJ(obj)->x;
	*y = OBJ(obj)->y;
    }

    return 0;
} /* objAt */
Пример #17
0
/* clone:
 * Create new object of type AGTYPE(obj) with all of its
 * attributes and substructure.
 * If obj is an edge, end nodes are cloned if necessary.
 * If obj is a graph, if g is null, create a clone top-level
 * graph. Otherwise, create a clone subgraph of g.
 * Assume obj != NULL.
 */
Agobj_t *clone(Agraph_t * g, Agobj_t * obj)
{
    Agobj_t *nobj = 0;
    Agedge_t *e;
    Agnode_t *h;
    Agnode_t *t;
    int kind = AGTYPE(obj);
    char *name;

    if ((kind != AGRAPH) && !g) {
	exerror("NULL graph with non-graph object in clone()");
	return 0;
    }

    switch (kind) {
    case AGNODE:		/* same as copy node */
	name = agnameof(obj);
	nobj = (Agobj_t *) openNode(g, name);
	if (nobj)
	    copyAttr(obj, nobj);
	break;
    case AGRAPH:
	name = agnameof(obj);
	if (g)
	    nobj = (Agobj_t *) openSubg(g, name);
	else
	    nobj = (Agobj_t *) openG(name, ((Agraph_t *) obj)->desc);
	if (nobj) {
	    copyAttr(obj, nobj);
	    cloneGraph((Agraph_t *) nobj, (Agraph_t *) obj);
	}
	break;
    case AGINEDGE:
    case AGOUTEDGE:
	e = (Agedge_t *) obj;
	t = (Agnode_t *) clone(g, OBJ(agtail(e)));
	h = (Agnode_t *) clone(g, OBJ(aghead(e)));
	name = agnameof (AGMKOUT(e));
	nobj = (Agobj_t *) openEdge(g, t, h, name);
	if (nobj)
	    copyAttr(obj, nobj);
	break;
    }

    return nobj;
}
Пример #18
0
/// HandleInput_Edit_FTP_Win
void HandleInput_Edit_FTP_Win()
{
    uint32 result      = 0;
    uint16 code        = 0;

    while ((result = RA_HandleInput(edit_ftp_win, &code)))
    {
        switch(result & WMHI_CLASSMASK)
        {
            case WMHI_CLOSEWINDOW:
                RA_CloseWindow(edit_ftp_win);
                edit_ftp_window = NULL;
                break;
            case WMHI_GADGETUP:
                switch (result & WMHI_GADGETMASK)
                {
                    case OBJ_FTP_USE:
                        gadset(GAD(OBJ_LBROWSER_BROW), window, LISTBROWSER_Labels, ~0);
                        updateFTPNode();
                        gadset(GAD(OBJ_LBROWSER_BROW), window, LISTBROWSER_Labels, &list_FTPs,
                                                               LISTBROWSER_AutoFit, TRUE);
                    case OBJ_FTP_CANCEL:
                        RA_CloseWindow(edit_ftp_win);
                        edit_brow_window = NULL;
                        break;
                    case OBJ_FTP_PATH_GET:
                        if (gfRequestFile(OBJ(OBJ_FTP_PATH_GET), edit_ftp_window))
                        {
                        }
                        break;
                    case OBJ_FTP_PATH_CHOOSE:  // set Attrs according to the button clicked on.
                    case OBJ_FTP_OPEN_CHOOSE:
                    case OBJ_FTP_NEW_CHOOSE:
                        iset( OBJ(OBJ_HIDDEN_CHOOSER), CHOOSER_LabelArray, hidden_strings);
                        IIntuition->ActivateGadget(GAD(OBJ_HIDDEN_CHOOSER),
                                                   edit_ftp_window, NULL);
                        break;
                    case OBJ_FTP_AREXX_CHOOSE:
                        iset( OBJ(OBJ_HIDDEN_CHOOSER), CHOOSER_LabelArray, hidden_strings);
                        IIntuition->ActivateGadget(GAD(OBJ_HIDDEN_CHOOSER),
                                                   edit_ftp_window, NULL);
                        break;
                }
        }
    }
}
Пример #19
0
/* cloneGraph:
 * Clone node, edge and subgraph structure from src to tgt.
 */
static void cloneGraph(Agraph_t * tgt, Agraph_t * src)
{
    Agedge_t *e;
    Agedge_t *ne;
    Agnode_t *t;
    Agraph_t *sg;
    char* name;
    Dt_t* emap = dtopen (&edgepair, Dtoset);
    edgepair_t* data = (edgepair_t*)malloc(sizeof(edgepair_t)*agnedges(src));
    edgepair_t* ep = data;

    for (t = agfstnode(src); t; t = agnxtnode(src, t)) {
	if (!copy(tgt, OBJ(t))) {
	    exerror("error cloning node %s from graph %s",
		  agnameof(t), agnameof(src));
	}
    }
    for (t = agfstnode(src); t; t = agnxtnode(src, t)) {
	for (e = agfstout(src, t); e; e = agnxtout(src, e)) {
	    if (!(ne = (Agedge_t*)copy(tgt, OBJ(e)))) {
		name = agnameof(AGMKOUT(e));
		if (name)
		    exerror("error cloning edge (%s,%s)[%s] from graph %s",
		      agnameof(agtail(e)), agnameof(aghead(e)),
		      name, agnameof(src));
		else
		    exerror("error cloning edge (%s,%s) from graph %s",
		      agnameof(agtail(e)), agnameof(aghead(e)),
		      agnameof(src));
		return;
	    }
	    ep->key = e;
	    ep->val = ne;
	    dtinsert (emap, ep++);
	}
    }
    for (sg = agfstsubg(src); sg; sg = agnxtsubg(sg)) {
	if (!cloneSubg(tgt, sg, emap)) {
	    exerror("error cloning subgraph %s from graph %s",
		  agnameof(sg), agnameof(src));
	}
    }

    dtclose (emap);
    free (data);
}
Пример #20
0
static void init_rplc( void *q, obj h, obj k, obj v )
{
  assert( OBJ_ISA_PTR(k) );
  assert( OBJ_ISA_PTR(v) );
  assert( OBJ_ISA_PTR(CLASSOF_PTR(k)) );

  hi_enqueue_item( (SaveQueue *)q, k );
  PTR_TO_HDRPTR(k)->pob_class = OBJ( VAL(v) - POINTER_TAG + IMMOB_TAG );
}
Пример #21
0
/* sameG:
 * Return common root if objects belong to same root graph.
 * NULL otherwise
 */
Agraph_t *sameG(void *p1, void *p2, char *fn, char *msg)
{
    Agobj_t *obj1 = OBJ(p1);
    Agobj_t *obj2 = OBJ(p2);
    Agraph_t *root;

    root = agroot(agraphof(obj1));
    if (root != agroot(agraphof(obj2))) {
	if (msg)
	    error(ERROR_WARNING, "%s in %s() belong to different graphs",
		  msg, fn);
	else
	    error(ERROR_WARNING,
		  "%s and %s in %s() belong to different graphs",
		  KINDS(obj1), KINDS(obj2), fn);
	return 0;
    } else
	return root;
}
Пример #22
0
/*
 * drawString() draws a string
 */
void
drawString(void *o, void *w)
{
    Obj *obj = OBJ(o);
    int idx;			/* all god's chillums need indices */
    int start;			/* string window start */
    int moretofollow = 0;	/* does more string follow to the right
				 * of the window?
				 */
    int rc;
    WINDOW *win = Window(w);
    int x = WX(w),
	y = WY(w);

    if (obj == 0 || obj->Class != O_STRING)
	return;

    rc = _nd_drawObjCommon(o, w);
    _nd_adjustXY(rc, o, &x, &y);
    
    /* print the data contained in the field */
    /* we want to show the cursor, so people can come back to this
     * field without having their brains bleed.
     */
    start = obj->item.string.startx;
    wmove(win, y, x);
    if (IS_CURRENT(obj))
	setcolor(win, SELECTED_COLOR);
    for (idx=start; idx-start < obj->width && ((char*)(obj->content))[idx]; idx++) {
	if (obj->flags & PASSWORD_STRING)
	    waddch(win, '*');
	else
	    waddch(win, ((char*)(obj->content))[idx]);
    }
    if (idx-start == obj->width && ((char*)(obj->content))[idx])
	moretofollow = 1;

    /* erase any text poop left in the field, so everything will look
     * beautiful
     */
    for (;idx-start < obj->width; idx++)
	waddch(win, ' ');

#if 0
    if (IS_CURRENT(obj))
	setcolor(win, WINDOW_COLOR);
#endif
    if (rc & DREW_A_BOX) {
	setcolor(win, WIDGET_COLOR);
	if (start > 0)
	    mvwaddch(win, y, x-1, ACS_LARROW);
	if (moretofollow)
	    mvwaddch(win, y, x+obj->width, ACS_RARROW);
    }
} /* drawString */
Пример #23
0
static _rs_inline obj sign_ext_from_32( obj x )
{
  if (VAL(x) & 0x80000000UL)
    {
      /* plug in the sign bits by hand... */
      return OBJ( VAL(x) | 0xFFFFFFFF00000000UL );
    }
  else
    {
      return x;
    }
}
Пример #24
0
/*
 * objDataAt() returns the x,y,dx,dy area containing the data (not the
 * prompts or windowframes) for the object.
 */
int
objDataAt(void* obj, int* x, int* y, int* dx, int *dy)
{
    int dummy;

    if (obj == 0) {
	errno = EINVAL;
	return -1;
    }

    if (x == 0)   x = &dummy;
    if (y == 0)   y = &dummy;
    if (dx == 0) dx = &dummy;
    if (dy == 0) dy = &dummy;

    *x  = OBJ(obj)->dtx;
    *y  = OBJ(obj)->dty;
    *dx = OBJ(obj)->width;
    *dy = OBJ(obj)->depth;
    return 0;
} /* objDataAt */
Пример #25
0
/* cloneSubg:
 * Clone subgraph sg in tgt.
 */
static Agraph_t *cloneSubg(Agraph_t * tgt, Agraph_t * g, Dt_t* emap)
{
    Agraph_t *ng;
    Agraph_t *sg;
    Agnode_t *t;
    Agnode_t *newt;
    Agedge_t *e;
    Agedge_t *newe;
    char* name;

    ng = (Agraph_t *) (copy(tgt, OBJ(g)));
    if (!ng)
	return 0;
    for (t = agfstnode(g); t; t = agnxtnode(g, t)) {
	newt = agnode(tgt, agnameof(t), 0);
	if (!newt) {
	    exerror("node %s not found in cloned graph %s",
		  agnameof(t), agnameof(tgt));
	    return 0;
	}
	else
	    agsubnode(ng, newt, 1);
    }
    for (t = agfstnode(g); t; t = agnxtnode(g, t)) {
	for (e = agfstout(g, t); e; e = agnxtout(g, e)) {
	    newe = mapEdge (emap, e);
	    if (!newe) {
		name = agnameof(AGMKOUT(e));
		if (name)
		    exerror("edge (%s,%s)[%s] not found in cloned graph %s",
		      agnameof(agtail(e)), agnameof(aghead(e)),
		      name, agnameof(tgt));
		else
		    exerror("edge (%s,%s) not found in cloned graph %s",
		      agnameof(agtail(e)), agnameof(aghead(e)),
		      agnameof(tgt));
		return 0;
	    }
	    else
		agsubedge(ng, newe, 1);
	}
    }
    for (sg = agfstsubg(g); sg; sg = agnxtsubg(sg)) {
	if (!cloneSubg(ng, sg, emap)) {
	    exerror("error cloning subgraph %s from graph %s",
		  agnameof(sg), agnameof(g));
	    return 0;
	}
    }
    return ng;
}
Пример #26
0
void bbs_done() {
#if USEBBS
	Symbol* sym = hoc_lookup("ParallelContext");
	sym = hoc_which_template(sym);
	hoc_Item* q, *ql;
	ql = sym->u.ctemplate->olist;
	q = ql->next;
	if (q != ql) {
		Object* ob = OBJ(q);
		OcBBS* bbs = (OcBBS*)ob->u.this_pointer;
		if (bbs->is_master()) {bbs->done();}
	}
#endif
}
Пример #27
0
s32 main(s32 argc, const char* argv[])
{
	padInfo padinfo ;
	padData paddata ;
	sysUtilRegisterCallback(SYSUTIL_EVENT_SLOT0, eventHandler, NULL);

	ioPadInit(7);

	pngData png;
	
	NoRSX *GFX = new NoRSX();
	Image IMG(GFX);
	Background BG(GFX);
	Object OBJ(GFX);
	Font F(GFX);
	

	IMG.LoadPNG_Buf(NoRSX_Image_bin,NoRSX_Image_bin_size, &png);
	u32 imgX =(GFX->width/2)-(png.width/2), imgY = (GFX->height/2)-(png.height/2);
	exitapp = 1;
	int frame=0;
	while(exitapp){
		static time_t starttime = 0;
		double fps = 0;
		if (starttime == 0) starttime = time (NULL);
		else fps = frame / difftime (time (NULL), starttime);
		ioPadGetInfo(&padinfo);
		if(padinfo.status[0]){
			ioPadGetData(0, &paddata);
			if(paddata.BTN_CROSS){
				exitapp = 0;
			}
		}
		BG.Mono(0xb4e83a); //a green hex color (you can use hex colors insted of COLOR_XXXXXXX)
		OBJ.Circle(400,900,100,COLOR_YELLOW);
		OBJ.Rectangle(500,400,200,500,COLOR_ORANGE);
		OBJ.Line(400,400,900,100,COLOR_GREY);
		IMG.AlphaDrawIMG(imgX,imgY,&png);
		F.Printf(150,200,COLOR_BLACK,"SCREEN %d X %d",GFX->width,GFX->height);
		F.Print(150,250,COLOR_YELLOW,"PRESS X TO EXIT");
		F.Printf(150,100,COLOR_GREEN,"FPS %f", fps);
		GFX->Flip();
		frame ++;
		sysUtilCheckCallback();
	}
	GFX->NoRSX_Exit();
	ioPadEnd();
	return 0;
}
Пример #28
0
/*
 * NAME:	dump_inherits()
 * DESCRIPTION:	output the inherited objects
 */
static void dump_inherits(control *ctrl)
{
    int i;

    printf("\nstatic pcinherit inherits[] = {\n");
    for (i = 0; i < ctrl->ninherits; i++) {
	printf("{ \"%s\", %u, %u, %u, %d },\n",
	       OBJ(ctrl->inherits[i].oindex)->chain.name,
	       ctrl->inherits[i].progoffset,
	       ctrl->inherits[i].funcoffset,
	       ctrl->inherits[i].varoffset,
	       ctrl->inherits[i].priv);
    }
    printf("};\n");
}
Пример #29
0
/*
 * drawGauge() draws a progress bar
 */
void
drawGauge(void *o, void* w)
{
    Obj *obj = OBJ(o);
    int percent;
    int fillwidth;
    int rc;
    WINDOW *win = Window(w);
    int x = WX(w),
	y = WY(w);
    char bfr[5];

    if (obj == 0 || obj->Class != O_GAUGE)
	return;

    percent = obj->content ? *((int*)(obj->content)) : 0;

    fillwidth = (obj->width * percent) / 100;

    rc = _nd_drawObjCommon(o, w);
    _nd_adjustXY(rc, o, &x, &y);
    
    /* clear the gauge area */
    wmove(win, y, x);
    setcolor(win, WINDOW_COLOR);
    waddnstr(win, rillyrillylongblankstring, obj->width);

    if (obj->width > 4) {
	/* draw the percentage in the middle of the progress bar,
	 * appropriately shaded */
	sprintf(bfr, "%d%%", percent);

	wmove(win, y, x + ((obj->width-strlen(bfr))/2) );
	waddstr(win, bfr);
    }

#if WITH_NCURSES
    /* highlight the progress bar as appropriate */
    mvwchgat(win, y, x, fillwidth, A_REVERSE, PAIR_NUMBER(WINDOW_COLOR), 0);
#else
    wstandout(win);
    for (rc = 0; rc < fillwidth; rc++)
	mvwaddch(win, y, x+rc, mvwinch(win, y, x+rc));
    wstandend(win);
#endif

} /* drawGauge */
Пример #30
0
void nrniv_recalc_ptrs() {
	// PlayRecord and PreSyn pointers
        net_cvode_instance->recalc_ptrs();
	hoc_List* hl;
	hoc_Item* q;
#if HAVE_IV
	// update pointers used by Graph
	if (!grsym_) {
		grsym_ = hoc_lookup("Graph");
		assert(grsym_->type == TEMPLATE);
	}
	hl = grsym_->u.ctemplate->olist;
	ITERATE(q, hl) {
		Object* obj = OBJ(q);
		Graph* g = (Graph*)obj->u.this_pointer;
		if (g) {g->update_ptrs();}
	}