void gen_chdr(FILE *fd,char *name) { struct rtype *r; struct regs *i; if(regs) close_reg(); reduce_names(regs); simp_names(regs); fix_names(regs); fix_names1(regs); // Cheating here reduce_names((struct regs *)rtypes); simp_names((struct regs *)rtypes); fix_names((struct regs *)rtypes); fix_names1((struct regs *)rtypes); // Check for conflicting addresses check_conflict(); fprintf(fd,"/* This file utomatically generated by vcsr */\n"); fprintf(fd,"/* Do not edit: instead modify Verilog RTL */\n\n"); fprintf(fd,"#include \"csrdef.h\"\n\n"); for(r=rtypes;r;r=r->next) { struct field *f; fprintf(fd,"struct %s {\n",r->name); for(f=r->fields;f;f=f->next) if(f->iz_flag) fprintf(fd," %sInit(%s, %d, %d, 0x%x);\n",f->type,f->name,f->size,f->start,f->iz); else fprintf(fd," %s(%s, %d, %d);\n",f->type,f->name,f->size,f->start); fprintf(fd,"};\n\n"); } fprintf(fd,"struct %s_t CHIP_COLLECTION {\n",name); for(i=regs;i;i=i->next) if(i->word_size) fprintf(fd," %s(%s[%d:%d], %s, 0x%x);\n",i->type,i->name,i->no_words,i->word_size,i->rtype ? i->rtype->name : "(undefined)",i->addr); else fprintf(fd," %s(%s, %s, 0x%x);\n",i->type,i->name,i->rtype ? i->rtype->name : "(undefined)",i->addr); fprintf(fd,"} %s;\n",name); }
void make_picker(QSP_ARG_DECL Screen_Obj *sop) { #ifdef HAVE_MOTIF int j; Arg al[20]; int ac = 0; Screen_Obj *b_sop; /* button ptr */ char buf[6]; int n; const char **stringlist; if( SOB_N_CYLINDERS(sop) != 1 ){ sprintf(ERROR_STRING,"picker %s needs %d components, but we're only implementing 1!?", SOB_NAME(sop),SOB_N_CYLINDERS(sop)); WARN(ERROR_STRING); } n= SOB_N_SELECTORS_AT_IDX(sop,/*component*/ 0 ); sop->so_frame = generic_frame(curr_panel->po_panel_obj, sop, XmSHADOW_IN); XtSetArg(al[ac], XmNentryClass, xmToggleButtonWidgetClass); ac++; strcpy(buf,"name"); sop->so_obj = XmCreateRadioBox(sop->so_frame, buf, al, ac); XtManageChild(sop->so_obj); #ifdef CAUTIOUS if( sop->so_children != NO_LIST ){ sprintf(ERROR_STRING,"CAUTIOUS: Picker %s already has a child list!?",SOB_NAME(sop)); ERROR1(ERROR_STRING); } #endif /* CAUTIOUS */ SET_SOB_CHILDREN(sop,new_list()); stringlist = SOB_SELECTORS_AT_IDX(sop,0); // The choices are created as screen_objs, we // need to create a special context for them so that we // can have the same choices in multiple pickers and choosers // The context name should be the concatenation of the current // scrnobj context, and the name of this widget... push_widget_context(QSP_ARG sop); for(j=0; j<n; j++) { b_sop = simple_object(QSP_ARG stringlist[j]); if( b_sop==NO_SCREEN_OBJ ) return; b_sop->so_action_text = savestr(stringlist[j]); b_sop->so_parent = sop; b_sop->so_flags |= SOT_MENU_ITEM; /* The choices need to be part of the panel list (so we can find them * with find_object), but also on the parent list, so we can find them * through it... */ addHead(curr_panel->po_children,mk_node(b_sop)); addTail(sop->so_children,mk_node(b_sop)); b_sop->so_obj = XtCreateManagedWidget( b_sop->so_name, /* widget name */ xmToggleButtonWidgetClass, /* widget class */ sop->so_obj, /* parent widget */ NULL, 0); fix_names(QSP_ARG b_sop,sop); /* client data */ XtAddCallback(b_sop->so_obj, XmNvalueChangedCallback, chooser_func, NULL); XtManageChild(b_sop->so_obj); } pop_scrnobj_context(SINGLE_QSP_ARG); SET_SOB_HEIGHT(sop, CHOOSER_HEIGHT + CHOOSER_ITEM_HEIGHT*n ); #endif /* HAVE_MOTIF */ }
void make_chooser(QSP_ARG_DECL Screen_Obj *sop, int n, const char **stringlist) { #ifdef HAVE_MOTIF int j; Arg al[20]; int ac = 0; Screen_Obj *b_sop; /* button ptr */ char buf[6]; sop->so_frame = generic_frame(curr_panel->po_panel_obj, sop, XmSHADOW_IN); XtSetArg(al[ac], XmNentryClass, xmToggleButtonWidgetClass); ac++; strcpy(buf,"name"); sop->so_obj = XmCreateRadioBox(sop->so_frame, buf, al, ac); XtManageChild(sop->so_obj); #ifdef CAUTIOUS if( sop->so_children != NO_LIST ){ sprintf(ERROR_STRING,"CAUTIOUS: Chooser %s already has a child list!?",SOB_NAME(sop)); ERROR1(ERROR_STRING); } #endif /* CAUTIOUS */ SET_SOB_CHILDREN(sop,new_list()); push_widget_context(QSP_ARG sop); for(j=0; j<n; j++) { b_sop = simple_object(QSP_ARG stringlist[j]); if( b_sop==NO_SCREEN_OBJ ) return; b_sop->so_action_text = savestr(stringlist[j]); b_sop->so_parent = sop; b_sop->so_flags |= SOT_MENU_ITEM; /* The choices need to be part of the panel list (so we can find them * with find_object), but also on the parent list, so we can find them * through it... */ addHead(curr_panel->po_children,mk_node(b_sop)); addTail(sop->so_children,mk_node(b_sop)); b_sop->so_obj = XtCreateManagedWidget( b_sop->so_name, /* widget name */ xmToggleButtonWidgetClass, /* widget class */ sop->so_obj, /* parent widget */ NULL, 0); fix_names(QSP_ARG b_sop,sop); /* client data */ XtAddCallback(b_sop->so_obj, XmNvalueChangedCallback, chooser_func, NULL); XtManageChild(b_sop->so_obj); } pop_scrnobj_context(SINGLE_QSP_ARG); #endif /* HAVE_MOTIF */ SET_SOB_HEIGHT(sop, CHOOSER_HEIGHT + CHOOSER_ITEM_HEIGHT*n ); }