int immediate_depends_ptrlist(CTXTdeclc callnodeptr call1){ VariantSF subgoal; int count = 0; CPtr oldhreg = NULL; calllistptr cl; reg[4] = makelist(hreg); new_heap_free(hreg); new_heap_free(hreg); if(IsNonNULL(call1)){ /* This can be called from some non incremental predicate */ cl= call1->inedges; while(IsNonNULL(cl)){ subgoal = (VariantSF) cl->inedge_node->callnode->goal; if(IsNonNULL(subgoal)){/* fact check */ count++; check_glstack_overflow(4,pcreg,2); oldhreg = hreg-2; follow(oldhreg++) = makeint(subgoal); follow(oldhreg) = makelist(hreg); new_heap_free(hreg); new_heap_free(hreg); } cl=cl->next; } if (count>0) follow(oldhreg) = makenil; else reg[4] = makenil; } return unify(CTXTc reg_term(CTXTc 3),reg_term(CTXTc 4)); }
/* reg 1: tag for this call reg 2: filter list of goals to keep (keep all if []) reg 3: returned list of changed goals reg 4: used as temp (in case of heap expansion) */ int create_changed_call_list(CTXTdecl){ callnodeptr call1; VariantSF subgoal; TIFptr tif; int j, count = 0,arity; Psc psc; CPtr oldhreg = NULL; reg[4] = makelist(hreg); new_heap_free(hreg); // make heap consistent new_heap_free(hreg); while ((call1 = delete_calllist_elt(&changed_gl)) != EMPTY){ subgoal = (VariantSF) call1->goal; tif = (TIFptr) subgoal->tif_ptr; psc = TIF_PSC(tif); if (in_reg2_list(CTXTc psc)) { count++; arity = get_arity(psc); check_glstack_overflow(4,pcreg,2+arity*200); // guess for build_subgoal_args... oldhreg = hreg-2; if(arity>0){ sreg = hreg; follow(oldhreg++) = makecs(hreg); hreg += arity + 1; new_heap_functor(sreg, psc); for (j = 1; j <= arity; j++) { new_heap_free(sreg); cell_array1[arity-j] = cell(sreg-1); } build_subgoal_args(subgoal); }else{ follow(oldhreg++) = makestring(get_name(psc)); } follow(oldhreg) = makelist(hreg); new_heap_free(hreg); // make heap consistent new_heap_free(hreg); } } if (count>0) follow(oldhreg) = makenil; else reg[4] = makenil; return unify(CTXTc reg_term(CTXTc 3),reg_term(CTXTc 4)); /* int i; for(i=0; i<callqptr; i++){ if(IsNonNULL(callq[i]) && (callq[i]->deleted==1)){ sfPrintGoal(stdout,(VariantSF)callq[i]->goal,NO); printf(" %d %d\n",callq[i]->falsecount,callq[i]->deleted); } } printf("-----------------------------\n"); */ }
/* For a callnode call1 returns a Prolog list of callnode on which call1 immediately depends. */ int immediate_inedges_list(CTXTdeclc callnodeptr call1){ VariantSF subgoal; TIFptr tif; int j, count = 0,arity; Psc psc; CPtr oldhreg = NULL; calllistptr cl; reg[4] = makelist(hreg); new_heap_free(hreg); new_heap_free(hreg); if(IsNonNULL(call1)){ /* This can be called from some non incremental predicate */ cl= call1->inedges; while(IsNonNULL(cl)){ subgoal = (VariantSF) cl->inedge_node->callnode->goal; if(IsNonNULL(subgoal)){/* fact check */ count++; tif = (TIFptr) subgoal->tif_ptr; psc = TIF_PSC(tif); arity = get_arity(psc); check_glstack_overflow(4,pcreg,2+arity*200); // don't know how much for build_subgoal_args... oldhreg = hreg-2; if(arity>0){ sreg = hreg; follow(oldhreg++) = makecs(hreg); hreg += arity + 1; new_heap_functor(sreg, psc); for (j = 1; j <= arity; j++) { new_heap_free(sreg); cell_array1[arity-j] = cell(sreg-1); } build_subgoal_args(subgoal); }else{ follow(oldhreg++) = makestring(get_name(psc)); } follow(oldhreg) = makelist(hreg); new_heap_free(hreg); new_heap_free(hreg); } cl=cl->next; } if (count>0) follow(oldhreg) = makenil; else reg[4] = makenil; }else{ xsb_warn("Called with non-incremental predicate\n"); reg[4] = makenil; } return unify(CTXTc reg_term(CTXTc 3),reg_term(CTXTc 4)); }
main(){ struct node* head; int pop; makelist(&head); pop = Pop(&head); print_list(head); }
// 입력받은 cmdline 문자열을 파싱하여 각 명령을 수행한다. void execute_cmdline(char* cmdline) { int count = makelist(cmdline, ";", cmdgrps, MAX_CMD_GRP); for(int i = 0; i < count; ++i) { // exit 명령 처리 exit_if(cmdgrps[i]); // cd 명령 처리 if(chdir_if_cd(cmdgrps[i])) continue; int pid = fork(); int status = 0; switch(pid) { case -1: fatal("fork error"); break; case 0: // child process execute_cmdgrp(cmdgrps[i]); exit(0); break; default: // parent process waitpid(pid, &status, 0); fflush(stdout); } } }
/* * List all of the active buffers. First update the special * buffer that holds the list. Next make sure at least 1 * window is displaying the buffer list, splitting the screen * if this is what it takes. Lastly, repaint all of the * windows that are displaying the list. Bound to "C-X C-B". * * A numeric argument forces it to list invisible buffers as * well. */ int listbuffers(int f, int n) { struct window *wp; struct buffer *bp; int s; if ((s = makelist(f)) != TRUE) return s; if (blistp->b_nwnd == 0) { /* Not on screen yet. */ if ((wp = wpopup()) == NULL) return FALSE; bp = wp->w_bufp; if (--bp->b_nwnd == 0) { bp->b_dotp = wp->w_dotp; bp->b_doto = wp->w_doto; bp->b_markp = wp->w_markp; bp->b_marko = wp->w_marko; } wp->w_bufp = blistp; ++blistp->b_nwnd; } wp = wheadp; while (wp != NULL) { if (wp->w_bufp == blistp) { wp->w_linep = lforw(blistp->b_linep); wp->w_dotp = lforw(blistp->b_linep); wp->w_doto = 0; wp->w_markp = NULL; wp->w_marko = 0; wp->w_flag |= WFMODE | WFHARD; } wp = wp->w_wndp; } return TRUE; }
prolog_term intern_rec(CTXTdeclc prolog_term term) { int areaindex, reclen, i, j; CPtr hc_term; Cell dterm[255]; Cell arg; // printf("intern_rec\n"); // create term-record with all fields dereffed in dterm XSB_Deref(term); if (isinternstr(term)) {printf("old\n"); return term;} if (isconstr(term)) { areaindex = get_arity(get_str_psc(term)); reclen = areaindex + 1; cell(dterm) = (Cell)get_str_psc(term); // copy psc ptr j=1; } else if (islist(term)) { areaindex = LIST_INDEX; reclen = 2; j=0; } else return 0; for (i=j; i<reclen; i++) { arg = get_str_arg(term,i); // works for lists and strs XSB_Deref(arg); if (isref(arg) || (isstr(arg) && !isinternstr(arg)) || isattv(arg)) { return 0; } cell(dterm+i) = arg; } hc_term = insert_interned_rec(reclen, areaindex, dterm); if (islist(term)) return makelist(hc_term); else return makecs(hc_term); }
/* only fills in next field, not prev */ static Tree makelist(Tree t) { Tree left, right; Tree tleft,tright; Tree retval = t; if (!t) return NULL; left = makelist(t->left); /* head of left list */ right = makelist(t->right); /* head of right list */ if (right) { retval = right; tright = t->right; tright->next = t; } if (left) { retval=left; tleft=t->left; tleft->next = (right) ? right : t; } t->next = NULL; return retval; }
void if_stat(LIST *S, int level) { ATTR *B = (ATTR*)malloc(sizeof(ATTR)); LIST *S1 = (LIST*)malloc(sizeof(LIST)); LIST *TAIL = (LIST*)malloc(sizeof(LIST)); LIST *list; int p1, p2; debug(level,"IF"); if(token == TK_IF) { debug_lex(); if(token == TK_LPAR) { debug_lex(); condition(B, level+1); p1 = nextquad(); if(token == TK_RPAR) { debug_lex(); brack_or_stat(S1, level+1); list = makelist(int2string(nextquad())); genquad("jump", "_", "_", "_"); p2 = nextquad(); elsepart(TAIL, level+1); backpatch(B->true, int2string(p1)); backpatch(B->false, int2string(p2)); S->next = merge(S1->next, list); S->next = merge(S->next, TAIL->next); } else {
list_t * filter(bool (*f)(void*,void*), void* env, list_t * xs) { if(xs == NULL) return NULL; if(f(env,xs->head)) return makelist(xs->head, filter(f,env,xs->tail)); return filter(f,env,xs->tail); }
int flow() { int i,v,lh; list *ptr; for(i=0;i<=t;i++)h[i]=n[i]=e[i]=0; for(i=0;i<=t;i++) { if(c[0][i]==0) continue; e[i]=c[0][i]; c[0][i]-=e[i]; c[i][0]+=e[i]; } h[0]=t+1; makelist(); for(ptr=head;ptr!=NULL;ptr=ptr->next) { v=ptr->v; lh=h[v]; discharge(v); if(h[v]>lh && head!=ptr) tofront(ptr); } return e[t]; cleanlist(); }
int main(int argc, char **argv) { int i, mt; (void)setvbuf(stdout, NULL, _IOLBF, BUFSIZ); if (argc < 2) { mt = sysconf(_SC_NPROCESSORS_ONLN); } else { mt = atoi(argv[1]); if (mt < 1) { mt = 1; } } if (pthread_mutex_init(&lock, NULL)) { fprintf(stderr, "pthread_mutex_init\n"); exit(EXIT_FAILURE); } makelist(); (void)signal(SIGALRM, sigalrm); printf("# nname\tnthr\tpersec\tideal\n"); for (i = 1; i <= mt; i++) { run(i); } exit(EXIT_SUCCESS); }
void statement(LIST *S, int level) { LIST *list; ATTR *E = (ATTR*)malloc(sizeof(ATTR)); debug(level,"STATEMENT"); if(token == ID) { assignment_stat(S, level+1); } else if(token == TK_IF) { if_stat(S, level+1); backpatch(S, int2string(nextquad())); } else if(token == TK_DO) { while_stat(S, level+1); S->next = NULL; } else if(token == TK_EXIT) { exit_stat(level+1); list = makelist(int2string(nextquad())); list->exitflag = 1; genquad("jump", "_", "_", "_"); S->next = merge(S->next, list); } else if(token == TK_RETURN) { return_stat(E, level+1); S->next = NULL; } else if(token == TK_PRINT) { print_stat(level+1); S->next = NULL; } else if(token == TK_CALL) { call_stat(level+1); S->next = NULL; } else { S->next = NULL; } }
int return_scc_list(CTXTdeclc SCCNode * nodes, int num_nodes){ VariantSF subgoal; TIFptr tif; int cur_node = 0,arity, j; Psc psc; CPtr oldhreg = NULL; reg[4] = makelist(hreg); new_heap_free(hreg); new_heap_free(hreg); do { subgoal = (VariantSF) nodes[cur_node].node; tif = (TIFptr) subgoal->tif_ptr; psc = TIF_PSC(tif); arity = get_arity(psc); // printf("subgoal %p, %s/%d\n",subgoal,get_name(psc),arity); check_glstack_overflow(4,pcreg,2+arity*200); // don't know how much for build_subgoal_args.. oldhreg=hreg-2; // ptr to car if(arity>0){ sreg = hreg; follow(oldhreg++) = makecs(sreg); new_heap_functor(sreg,get_ret_psc(2)); // car pts to ret/2 psc hreg += 3; // hreg pts past ret/2 sreg = hreg; follow(hreg-1) = makeint(nodes[cur_node].component); // arg 2 of ret/2 pts to component follow(hreg-2) = makecs(sreg); new_heap_functor(sreg, psc); // arg 1 of ret/2 pts to goal psc hreg += arity + 1; for (j = 1; j <= arity; j++) { new_heap_free(sreg); cell_array1[arity-j] = cell(sreg-1); } build_subgoal_args(subgoal); } else{ follow(oldhreg++) = makestring(get_name(psc)); } follow(oldhreg) = makelist(hreg); // cdr points to next car new_heap_free(hreg); new_heap_free(hreg); cur_node++; } while (cur_node < num_nodes); follow(oldhreg) = makenil; // cdr points to next car return unify(CTXTc reg_term(CTXTc 3),reg_term(CTXTc 4)); }
int main(int argc, char *argv[] ) { GtkWidget *window, *hbox; char applName[256]; // Initialisations gtk_init (&argc, &argv); StripPath (argv[0], applName); CheckMidiShare (applName); gRefNum = MidiOpen(applName); // User interface construction window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), applName); gtk_container_set_border_width(GTK_CONTAINER(window), 10); hbox = gtk_hbox_new (FALSE, 10); add(hbox, makelist(&gSrcList, "Sources ->", GTK_SELECTION_MULTIPLE, GTK_SIGNAL_FUNC(select_src), GTK_SIGNAL_FUNC(unselect_src))); add(hbox, makelist(&gAppList, "Applications", GTK_SELECTION_BROWSE, GTK_SIGNAL_FUNC(select_appl), NULL)); add(hbox, makelist(&gDstList, "-> Destinations",GTK_SELECTION_MULTIPLE, GTK_SIGNAL_FUNC(select_dst), GTK_SIGNAL_FUNC(unselect_dst))); initLists(); gtk_container_add(GTK_CONTAINER(window), hbox); gtk_widget_show_all (window); // signal connexion gtk_signal_connect( GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(my_delete_action), NULL ); // MidiShare applAlarm initialisation MidiSetApplAlarm(gRefNum, MyApplAlarm); gtk_timeout_add( 100, check_update, NULL); gtk_main (); return(0); }
static TREPTR list(int flg) { register TREPTR r; register int b; r = term(flg); while (r && ((b = (wdval == ANDFSYM)) || wdval == ORFSYM)) { r = makelist((b ? TAND : TORF), r, term(NLFLG)); } return r; }
// 사용자가 입력한 명령이 exit 이면 프로그램을 종료한다. void check_exit(const char* cmdgrp) { char buff[BUFSIZ] = {0,}; strcpy(buff, cmdgrp); makelist(buff, " \t", cmdvector, MAX_CMD_ARG); if(strcasecmp(cmdvector[0], "exit") == 0) { exit(0); } }
/* Take a port's describe line and split it into fields */ static PORT * portify(char * line) { PORT * p; size_t i, n; /* Verify that line has the right number of fields */ for (n = i = 0; line[i] != 0; i++) if (line[i] == '|') n++; if (n != 12) errx(1, "Port describe line is corrupt:\n%s\n", line); p = malloc(sizeof(PORT)); if (p == NULL) err(1, "malloc(PORT)"); p->pkgname = strdup2(strsep(&line, "|")); p->portdir = strdup2(strsep(&line, "|")); p->prefix = strdup2(strsep(&line, "|")); p->comment = strdup2(strsep(&line, "|")); p->pkgdescr = strdup2(strsep(&line, "|")); p->maintainer = strdup2(strsep(&line, "|")); p->categories = strdup2(strsep(&line, "|")); p->edep = makelist(strsep(&line, "|"), &p->n_edep); p->pdep = makelist(strsep(&line, "|"), &p->n_pdep); p->fdep = makelist(strsep(&line, "|"), &p->n_fdep); p->bdep = makelist(strsep(&line, "|"), &p->n_bdep); p->rdep = makelist(strsep(&line, "|"), &p->n_rdep); p->www = strdup2(strsep(&line, "|")); p->recursed = 0; /* * line will now be equal to NULL -- we counted the field * separators at the top of the function. */ return p; }
int immediate_affects_ptrlist(CTXTdeclc callnodeptr call1){ VariantSF subgoal; int count = 0; CPtr oldhreg = NULL; struct hashtable *h; struct hashtable_itr *itr; callnodeptr cn; reg[4] = makelist(hreg); new_heap_free(hreg); new_heap_free(hreg); if(IsNonNULL(call1)){ /* This can be called from some non incremental predicate */ h=call1->outedges->hasht; itr = hashtable1_iterator(h); if (hashtable1_count(h) > 0){ do { cn = hashtable1_iterator_value(itr); if(IsNonNULL(cn->goal)){ count++; subgoal = (VariantSF) cn->goal; check_glstack_overflow(4,pcreg,2); oldhreg=hreg-2; follow(oldhreg++) = makeint(subgoal); follow(oldhreg) = makelist(hreg); new_heap_free(hreg); new_heap_free(hreg); } } while (hashtable1_iterator_advance(itr)); } if (count>0) follow(oldhreg) = makenil; else reg[4] = makenil; } return unify(CTXTc reg_term(CTXTc 3),reg_term(CTXTc 4)); }
// exit 명령이면 종료한다. void exit_if(const char* cmdgrp) { char* s = strdup(cmdgrp); makelist(s, " \t", cmdvector, MAX_CMD_ARG); if(strncasecmp(cmdvector[0], "exit", 4) == 0) { free(s); exit(0); } free(s); }
/* Use closest-point heuristic from Cormen Leiserson and Rivest */ static Tree conquer(Tree t) { Tree cycle,tmp,min,prev,next,donext; double mindist,test; double mintonext, mintoprev, ttonext, ttoprev; if (!t) return NULL; t=makelist(t); /*printf("CONQUER\n");*/ /* Create initial cycle */ cycle = t; t = t->next; cycle->next = cycle; cycle->prev = cycle; for (; t; t=donext) { /* loop over remaining points */ donext = t->next; /* value won't be around later */ min = cycle; mindist = distance(t,cycle); for (tmp=cycle->next; tmp!=cycle; tmp=tmp->next) { test = distance(tmp,t); if (test < mindist) { mindist = test; min = tmp; } /* if */ } /* for tmp... */ next = min->next; prev = min->prev; mintonext = distance(min,next); mintoprev = distance(min,prev); ttonext = distance(t,next); ttoprev = distance(t,prev); if ((ttoprev - mintoprev) < (ttonext - mintonext)) { /* insert between min and prev */ prev->next = t; t->next = min; t->prev = prev; min->prev = t; } else { next->prev = t; t->next = next; min->next = t; t->prev = min; } } /* for t... */ /*print_list(cycle);*/ /*printf("End CONQUER\n");*/ return cycle; }
// 사용자가 입력한 명령이 cd 이면 chdir() 로 디렉토리를 바꾼다. int check_cd(const char* cmdgrp) { char buff[BUFSIZ] = {0,}; strcpy(buff, cmdgrp); makelist(buff, " \t", cmdvector, MAX_CMD_ARG); if(strcmp(cmdvector[0], "cd") == 0) { chdir(cmdvector[1]); return 1; } return 0; }
std::unique_ptr<EntryList> Spectrum2D::_get_spectrum(std::initializer_list<Pair> list) { int min0, min1, max0, max1; if (list.size() != 2) { min0 = min1 = 0; max0 = max1 = metadata_.resolution; } else { Pair range0 = *list.begin(), range1 = *(list.begin()+1); min0 = range0.first; max0 = range0.second; min1 = range1.first; max1 = range1.second; } std::unique_ptr<std::list<Entry>> result(new std::list<Entry>); CustomTimer makelist(true); if (buffered_ && !temp_spectrum_.empty()) { for (auto it : temp_spectrum_) { int co0 = it.first.first, co1 = it.first.second; if ((min0 <= co0) && (co0 < max0) && (min1 <= co1) && (co1 < max1)) { Entry newentry; newentry.first.resize(2, 0); newentry.first[0] = co0; newentry.first[1] = co1; newentry.second = it.second; result->push_back(newentry); } } } else { for (auto it : spectrum_) { int co0 = it.first.first, co1 = it.first.second; if ((min0 <= co0) && (co0 < max0) && (min1 <= co1) && (co1 < max1)) { Entry newentry; newentry.first.resize(2, 0); newentry.first[0] = co0; newentry.first[1] = co1; newentry.second = it.second; result->push_back(newentry); } } } if (!temp_spectrum_.empty()) { boost::unique_lock<boost::mutex> uniqueLock(u_mutex_, boost::defer_lock); while (!uniqueLock.try_lock()) boost::this_thread::sleep_for(boost::chrono::seconds{1}); temp_spectrum_.clear(); //assumption about client } // PL_DBG << "<Spectrum2D> Making list for " << metadata_.name << " took " << makelist.ms() << "ms filled with " // << result->size() << " elements"; return result; }
// cd 명령어이면 chdir() 로 디렉토리를 바꾼다. int chdir_if_cd(const char* cmdgrp) { char* s = strdup(cmdgrp); makelist(s, " \t", cmdvector, MAX_CMD_ARG); if(strncmp(cmdvector[0], "cd", 2) == 0) { chdir(cmdvector[1]); free(s); return 1; } free(s); return 0; }
static TREPTR term(int flg) { register TREPTR t; reserv++; if (flg & NLFLG) skipnl(); else word(); if ((t = item(TRUE)) && (wdval == '^' || wdval == '|')) { return (makelist(TFIL, makefork(FPOU, t), makefork(FPIN | FPCL, term(NLFLG)))); } else return (t); }
void writeTechInfo() { std::ofstream of("techtypes.dox"); for (auto t : TechTypes::allTechTypes()) { if (t == TechTypes::Unknown || t == TechTypes::None) continue; of << docEnum(t); of << docBegin(t); of << icon(t) << " " << docIntro(t) << "\n"; of << "<table border='0'>"; of << row("Race", tref(t.getRace())); if (t.mineralPrice() != 0 || t.gasPrice() != 0) { std::string oreCost = imgOre() + std::to_string(t.mineralPrice()); std::string gasCost = imgGas(t.getRace()) + std::to_string(t.gasPrice()); of << row("Cost", oreCost + " " + gasCost); } if (t.researchTime() != 0) of << row("Research Time", std::to_string(t.researchTime()) + " frames"); if (t.energyCost() != 0) of << row("Energy Cost", imgEnergy() + std::to_string(t.energyCost())); if (t.whatResearches() != UnitTypes::None) of << row("Researched at", iconref(t.whatResearches())); if (t.requiredUnit() != UnitTypes::None) of << row("Requires", iconref(t.requiredUnit())); std::set<std::string> targets; if (t.targetsPosition()) targets.insert("Positions"); if (t.targetsUnit()) targets.insert("Units"); if (!targets.empty()) of << row("Targets", makelist(targets)); if (t.getWeapon() != WeaponTypes::None) of << row("Weapon", iconref(t.getWeapon())); if (t.getOrder() != Orders::None) of << row("Order", iconref(t.getOrder())); if (!t.whatUses().empty()) of << row("Used by", makeiconlist(t.whatUses())); of << "</table>\n"; // References std::string const & name = t.getName(); of << "@tl" << name << " @scc" << name << " @wik" << name; of << docEnd(); } }
int main(int argc, char const *argv[]) { struct ListNode *use; struct ListNode *temp; use = makelist(); for (temp = use; temp != NULL ; temp = temp->m_pNext){ printf("%d-->",temp->m_nkey); } printf("\n"); temp = reverselist(use); for (; temp != NULL ; temp = temp->m_pNext){ printf("%d-->",temp->m_nkey); } printf("\n"); return 0; }
// 명령어 실행 void execute_cmdgrp(char *cmdgrp) { int count = 0; char* last_arg = NULL; int len = 0; count = makelist(cmdgrp, " \t", cmdvector, MAX_CMD_ARG); last_arg = cmdvector[count-1]; len = strlen(last_arg); if(len && last_arg[len-1] == '&') { last_arg[len-1] = '\0'; if(strlen(last_arg) == 0) cmdvector[count-1] = NULL; background_run(); } execvp(cmdvector[0], cmdvector); fatal("exec error"); }
// 명령어 실행 void execute_cmdgrp(char *cmdgrp) { int count = makelist(cmdgrp, " \t", cmdvector, MAX_CMD_ARG); // for(int i=0; i<count; i++) // { // printf("cmdvector[%d] :%s\n", i, cmdvector[i]); // } int size = strlen(cmdvector[count - 1]); if(size > 0 && cmdvector[count - 1][size - 1] == '&') { cmdvector[count - 1][size - 1] = '\0'; if(strlen(cmdvector[count - 1]) == 0) cmdvector[count - 1] = NULL; execute_at_background(); exit(0); } execvp(cmdvector[0], cmdvector); fatal("exec error"); }
/* ARGSUSED */ int listbuffers(int f, int n) { static int initialized = 0; struct buffer *bp; struct mgwin *wp; if (!initialized) { maps_add((KEYMAP *)&listbufmap, "listbufmap"); initialized = 1; } if ((bp = makelist()) == NULL || (wp = popbuf(bp, WNONE)) == NULL) return (FALSE); wp->w_dotp = bp->b_dotp; /* fix up if window already on screen */ wp->w_doto = bp->b_doto; bp->b_modes[0] = name_mode("fundamental"); bp->b_modes[1] = name_mode("listbufmap"); bp->b_nmodes = 1; return (TRUE); }