static int letter5() { /* Prepare path */ sprintf(mail600, "/tmp/#%dmaill600", pid); if(lcreat(mail600) < 0) { if(write(1, "Can't write 604 letter\n", 23) == -1) { exit(1); } return 0; } lprcat("\n\n\n\n\n\n\n\n\n\n\n\n"); standout(); lprcat("From:"); standend(); lprcat(" St. Mary's Children's Home\n"); standout(); lprcat("\nSubject:"); standend(); lprcat(" These Poor Children\n"); lprcat("\n News of your great conquests has spread to all of Larndom."); lprcat("\nMight I have a moment of a great man's time. We here at St."); lprcat("\nMary's Children's Home are very poor, and many children are"); lprcat("\nstarving. Disease is widespread and very often fatal without"); lprcat("\ngood food. Could you possibly find it in your heart to help us"); lprcat("\nin out plight? Whatever you could give will help much."); lprcat("\n(your gift is tax deductible)\n"); lwclose(); return 1; }
static int letter6() { /* Prepare path */ sprintf(mail600, "/tmp#%dmail600", pid); if(lcreat(mail600) < 0) { if(write(1, "Can't write 605 letter\n", 23) == -1) { exit(1); } return 0; } lprcat("\n\n\n\n\n\n\n\n\n\n\n\n"); standout(); lprcat("From:"); standend(); lprcat(" The National Cancer Society of Larn\n"); standout(); lprcat("\nSubject:"); standend(); lprcat(" Hope\n"); lprcat("\n Congratulations on your successful expedition. We are sure much"); lprcat("\ncourage and dtermination were needed on your quest. There are"); lprcat("\nmany though, that could never hope to undertake such a journey"); lprcat("\ndue to an enfeebling disease -- cancer. We at the National"); lprcat("\nCancer Soceity of Larn wish to appeal to your philanthropy in"); lprcat("\norder to save many good people -- possibly even yourself in a few"); lprcat("\nyears from now. Much work needs to be done in researching this"); lprcat("\ndreaded disease, and you can help today. Could you please see it"); lprcat("\nin your heart to give generously? Your continued good health"); lprcat("\ncan be in your everlasting reward.\n"); lwclose(); return 1; }
static int letter4() { /* Prepare path */ sprintf(mail600, "/tmp/$%dmail600", pid); if(lcreat(mail600) < 0) { if(write(1, "Can't write 603 letter\n", 23) == -1) { exit(1); } return 0; } lprcat("\n\n\n\n\n\n\n\n\n\n\n\n"); standout(); lprcat("From:"); standend(); lprcat(" Mainair, Duke of Larnty\n"); standout(); lprcat("\nSubject:"); standend(); lprcat(" High Praise\n"); lprcat("\n With a certainty a hero I declare to be amongst us! A nod of"); lprcat("\nfavour I send to thee. Me thinks Count Endelford this day of"); lprcat("\nright breath'eth fire as a dragon of whom ye are slayer. I"); lprcat("\nyearn to behold his anger and jealously. Should ye choose to"); lprcat("\nunleash some of they wealth upon those whoe be unfortunate, I,"); lprcat("\nDuke Mainair, Shall equal thy gift also.\n"); lwclose(); return 1; }
/* ^Y */ static void tstop() { /* Nothing if inhibited */ if(nosignal) { return; } lcreat((char *)0); clearvt100(); lflush(); signal(SIGTSTP, SIG_DFL); #ifdef SIGVTALRM /* Looks like BSD4.2 or higher - must clr mask for signal to take effect */ sigset_t set; sigprocmask(0, NULL, &set); sigprocmask(~BIT(SIGTSTP) & SIG_BLOCK, &set, NULL); #endif kill(getpid(), SIGTSTP); setupvt100(); signal(SIGTSTP, tstop); if(predostuff == 1) { s2choose(); } else { drawscreen(); } showplayer(); lflush(); }
/* * writeboard() Function to write the scoreboard from readboard()'s buffer * * returns -1 if unable to write the scoreboard, returns 0 if all is OK */ static int writeboard (void) { set_score_output (); if (lcreat (scorefile) < 0) { lprcat ("Can't write scoreboard\n"); lflush (); return (-1); } lwrite ((char *) sco, sizeof (sco)); lwrite ((char *) winr, sizeof (winr)); lwclose (); lcreat ((char *) 0); return (0); }
void showscores (void) { int i, j; lflush (); lcreat ((char *) 0); if (readboard () < 0) { return; } i = winshou (); j = shou (0); if (i + j == 0) { lprcat (esb); } else { lprc ('\n'); } lflush (); }
List lcopy(List l) { List n = lcreat(); for (int i = l.size-1; i >= 0; i--) { linsertn(&n, 0, lnth(l, i)->val); } return n; }
letter1() { int write_len; sprintf(mail600, "/tmp/#%dmail600",pid); /* prepare path */ if (lcreat(mail600) < 0) { write_len = write(1,"can't write 600 letter\n",23); return(0); } lprcat("From: [email protected] (Ularn Revenue Service)\n"); lprcat("Subject: undeclared income\n"); lprcat("\n We heard you survived the caverns of Ularn. Let me be the"); lprcat("\nfirst to congratulate you on your success. It is quite a feat."); lprcat("\nIt must also have been very profitable for you."); lprcat("\n\n The Dungeon Master has informed us that you brought"); lprintf("\n%d gold piece%s back with you from your journey. As the", (long)c[GOLD], (c[GOLD]==1)?"":"s"); lprcat("\ncounty of Ularn is in dire need of funds, we have spared no time"); lprintf("\nin preparing your tax bill. You owe %d gold piece%s as", Taxes, (Taxes==1)?"":"s"); lprcat("\nof this notice, and is due within 5 days. Failure to pay will"); lprcat("\nmean penalties. Once again, congratulations. We look forward"); lprcat("\nto your future successful expeditions.\n"); lwclose(); return(1); }
List cstr2list(const char *s) { List res = lcreat(); for (int i = 0; s[i]; i++) { lappendn(&res, s[i]); } return res; }
/* * readboard() Function to read in the scoreboard into a static buffer * * returns -1 if unable to read in the scoreboard, returns 0 if all is OK */ readboard() { if (lopen(scorefile)<0) { lprcat("Can't read scoreboard\n"); lflush(); return(-1); } lrfill((char*)sco,sizeof(sco)); lrfill((char*)winr,sizeof(winr)); lrclose(); lcreat((char*)0); return(0); }
static int letter3() { /* Prepare path */ sprintf(mail600, "/tmp#%dmail600", pid); if(lcreat(mail600) < 0) { if(write(1, "Can't write 602 letter\n", 23) == -1) { exit(1); } return 0; } lprcat("\n\n\n\n\n\n\n\n\n\n\n\n"); standout(); lprcat("From:"); standend(); lprcat(" Count Endelford\n"); standout(); lprcat("\nSubject:"); standend(); lprcat(" You Bastard!\n"); lprcat("\n I heard (from sources) of your journey. Congratulations!"); lprcat("\nYou bastard! With several attempts I have yet to endure the"); lprcat(" caves,\nand you, a nobody, makes the journey! From this time"); lprcat(" onward, be warned\nupon our meeting you shall pay the price!\n"); lwclose(); return 1; }
static int letter2() { /* Prepare path */ sprintf(mail600, "/tmp/#%dmail600", pid); if(lcreat(mail600) < 0) { if(write(1, "Can't write 601 letter\n", 23) == -1) { exit(1); } return 0; } lprcat("\n\n\n\n\n\n\n\n\n\n\n\n"); standout(); lprcat("From:"); standend(); lprcat(" His Majesty King Wilfred of Larndom\n"); standout(); lprcat("\nSubject:"); standend(); lprcat(" A Noble Deed\n"); lprcat("\n I have heard of your magnificent feat, and I, King Wilfred,"); lprcat("\nforthwith declare today to be a national holiday. Furthermore,"); lprcat("\nhence three days, Ye be invited to the castle to receive the"); lprcat("\nhonour of Kinght of the Realm. Upon thy name shall it be written..."); lprcat("\nBravery and courage be yours."); lprcat("\nMay you live in happiness forever...\n"); lwclose(); return 1; }
/* * writeboard() Function to write the scoreboard from readboard()'s buffer * * returns -1 if unable to write the scoreboard, returns 0 if all is OK */ int writeboard() { int i; set_score_output(); setegid(egid); i = lcreat(scorefile); setegid(gid); if (i < 0) { lprcat("Can't write scoreboard\n"); lflush(); return (-1); } lwrite((char *) sco, sizeof(sco)); lwrite((char *) winr, sizeof(winr)); lwclose(); lcreat((char *) 0); return (0); }
static void tstop() /* control Y */ { if (nosignal) return; /* nothing if inhibited */ lcreat((char*)0); clearvt100(); lflush(); signal(SIGTSTP,SIG_DFL); #ifdef SIGVTALRM /* looks like BSD4.2 or higher - must clr mask for signal to take effect*/ sigsetmask(sigblock(0)& ~BIT(SIGTSTP)); #endif kill(getpid(),SIGTSTP); setupvt100(); signal(SIGTSTP,tstop); if (predostuff==1) s2choose(); else drawscreen(); showplayer(); lflush(); }
/* * diedlog() Subroutine to read a log file and print it out in ascii format */ void diedlog (void) { int n; char *p; struct stat stbuf; lcreat ((char *) 0); if (lopen (logfile) < 0) { lprintf ("Can't locate log file <%s>\n", logfile); return; } if (fstat (fd, &stbuf) < 0) { lprintf ("Can't stat log file <%s>\n", logfile); return; } for (n = stbuf.st_size / sizeof (struct log_fmt); n > 0; --n) { lrfill ((char *) &logg, sizeof (struct log_fmt)); p = ctime ((time_t *) & logg.diedtime); p[16] = '\n'; p[17] = 0; lprintf ("Score: %d, Diff: %d, %s %s on %d at %s", (int) (logg.score), (int) (logg.diff), logg.who, logg.what, (int) (logg.cavelev), p + 4); #ifdef EXTRA if (logg.moves <= 0) logg.moves = 1; lprintf (" Experience Level: %d, AC: %d, HP: %d/%d, Elapsed Time: %d minutes\n", (int) (logg.lev), (int) (logg.ac), (int) (logg.hp), (int) (logg.hpmax), (int) (logg.elapsedtime)); lprintf (" BYTES in: %d, out: %d, moves: %d, deaths: %d, spells cast: %d\n", (int) (logg.bytin), (int) (logg.bytout), (int) (logg.moves), (int) (logg.killed), (int) (logg.spused)); lprintf (" out bytes per move: %d", (int) (logg.bytout / logg.moves)); lprintf ("\n"); #endif } lflush (); lrclose (); return; }
PROGRAMMER * pgm_dup(const PROGRAMMER const * src) { PROGRAMMER * pgm; pgm = (PROGRAMMER *)malloc(sizeof(*pgm)); if (pgm == NULL) { fprintf(stderr, "%s: out of memory allocating programmer structure\n", progname); exit(1); } memcpy(pgm, src, sizeof(*pgm)); pgm->id = lcreat(NULL, 0); return pgm; }
int getplid (char *nam) { int fd7, high = 999, no; char *p, *p2; char name[80]; if (havepid != -1) return (havepid); /* already did it */ lflush (); /* flush any pending I/O */ sprintf (name, "%s\n", nam); /* append a \n to name */ if (lopen (playerids) < 0) /* no file, make it */ { if ((fd7 = _creat (playerids, _S_IWRITE)) < 0) return (-1); /* can't make it */ _close (fd7); goto addone; /* now append new playerid record to file */ } for (;;) /* now search for the name in the player id file */ { p = lgetl (); if (p == NULL) break; /* EOF? */ no = atoi (p); /* the id # */ p2 = lgetl (); if (p2 == NULL) break; /* EOF? */ if (no > high) high = no; /* accumulate highest id # */ if (strcmp (p2, name) == 0) /* we found him */ { return (no); /* his id number */ } } lrclose (); /* if we get here, we didn't find him in the file -- put him there */ addone: if (lappend (playerids) < 0) return (-1); /* can't open file for append */ lprintf ("%d\n%s", (int) ++high, name); /* new id # and name */ lwclose (); lcreat ((char *) 0); /* re-open terminal channel */ return (high); }
letter3 () { int write_len; sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */ if (lcreat(mail600) < 0) { write_len = write(1,"can't write 600 letter\n",23); return(0); } lprcat("From: [email protected] (Count Endelford)\n"); lprintf("Subject: You %s\n!", sex?"Bastard":"Bitch"); lprcat("\n I heard (from sources) of your journey. Congratulations!"); lprintf("You %s! With several attempts I have yet to endure the", sex?"Bastard":"Bitch"); lprcat(" caves,\nand you, a nobody, make the journey! From this time"); lprcat(" onward, be warned:\nupon our meeting you shall pay the price!\n"); lwclose(); return(1); }
/* * readboard() Function to read in the scoreboard into a static buffer * * returns -1 if unable to read in the scoreboard, returns 0 if all is OK */ int readboard() { int i; setegid(egid); i = lopen(scorefile); setegid(gid); if (i < 0) { lprcat("Can't read scoreboard\n"); lflush(); return (-1); } lrfill((char *) sco, sizeof(sco)); lrfill((char *) winr, sizeof(winr)); lrclose(); lcreat((char *) 0); return (0); }
/* * readboard() Function to read in the scoreboard into a static buffer * * returns -1 if unable to read in the scoreboard, returns 0 if all is OK */ static int readboard (void) { if (lopen (scorefile) < 0) { lprcat ("Can't read scoreboard\n"); lflush (); return -1; } lrfill ((char *) sco, sizeof (sco)); lrfill ((char *) winr, sizeof (winr)); lrclose (); lcreat ((char *) 0); return 0; }
letter4 () { int write_len; sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */ if (lcreat(mail600) < 0) { write_len = write(1,"can't write 600 letter\n",23); return(0); } lprcat("From: [email protected] (Duke of Ularnty)\n"); lprcat("Subject: High Praise\n"); lprcat("\n With a certainty, a hero I declare to be amongst us! A nod of"); lprcat("\nfavour I send to thee. Methinks Count Endelford this day of"); lprcat("\nright breaths fire as of dragon of whom ye are slayer. I"); lprcat("\nyearn to behold his anger and jealously. Should ye choose to"); lprcat("\nunleash some of thy wealth upon those who be unfortunate, I,"); lprcat("\nDuke Mainair, Shall equal thy gift also.\n"); lwclose(); return(1); }
/* * diedlog() Subroutine to read a log file and print it out in ascii format */ void diedlog(void) { int n; char *p; static char q[] = "?"; struct stat stbuf; time_t t; lcreat((char *) 0); if (lopen(logfile) < 0) { lprintf("Can't locate log file <%s>\n", logfile); return; } if (fstat(io_infd, &stbuf) < 0) { lprintf("Can't stat log file <%s>\n", logfile); return; } for (n = stbuf.st_size / sizeof(struct log_fmt); n > 0; --n) { lrfill((char *) &logg, sizeof(struct log_fmt)); t = logg.diedtime; if ((p = ctime(&t)) == NULL) p = q; else { p[16] = '\n'; p[17] = 0; } lprintf("Score: %ld, Diff: %ld, %s %s on %ld at %s", (long) (logg.score), (long) (logg.diff), logg.who, logg.what, (long) (logg.cavelev), p + 4); #ifdef EXTRA if (logg.moves <= 0) logg.moves = 1; lprintf(" Experience Level: %ld, AC: %ld, HP: %ld/%ld, Elapsed Time: %ld minutes\n", (long) (logg.lev), (long) (logg.ac), (long) (logg.hp), (long) (logg.hpmax), (long) (logg.elapsedtime)); lprintf(" CPU time used: %ld seconds, Machine usage: %ld.%02ld%%\n", (long) (logg.cputime), (long) (logg.usage / 100), (long) (logg.usage % 100)); lprintf(" BYTES in: %ld, out: %ld, moves: %ld, deaths: %ld, spells cast: %ld\n", (long) (logg.bytin), (long) (logg.bytout), (long) (logg.moves), (long) (logg.killed), (long) (logg.spused)); lprintf(" out bytes per move: %ld, time per move: %ld ms\n", (long) (logg.bytout / logg.moves), (long) ((logg.cputime * 1000) / logg.moves)); #endif } lflush(); lrclose(); return; }
/* * showallscores() Function to show scores and the iven lists that go with them * * Returns nothing of value */ void showallscores(void) { int i, j; lflush(); lcreat((char *) 0); if (readboard() < 0) return; c[WEAR] = c[WIELD] = c[SHIELD] = -1; /* not wielding or wearing * anything */ for (i = 0; i < MAXPOTION; i++) potionname[i] = potionhide[i]; for (i = 0; i < MAXSCROLL; i++) scrollname[i] = scrollhide[i]; i = winshou(); j = shou(1); if (i + j == 0) lprcat(esb); else lprc('\n'); lflush(); }
/* * Function to create the tax bill for the user */ static int letter1() { /* Prepare path */ sprintf(mail600, "/tmp/#%dmail600", pid); if(lcreat(mail600) < 0) { if(write(1, "Can't write 600 letter\n", 23) == -1) { exit(1); } return 0; } lprcat("\n\n\n\n\n\n\n\n\n\n\n\n"); standout(); lprcat("From:"); standend(); lprcat(" The LRS (Larn Revenue Service)\n"); standout(); lprcat("\nSubject"); standend(); lprcat(" Undeclared Income\n"); lprcat("\n We heard you survived the caverns of Larn. Let be the"); lprcat("\nfirst to congratulate you on your success. It is quite a feat."); lprcat("\nIt must also have been very profitable for you."); lprcat("\n\n The Dungeon Master has informed us that you brought"); lprintf("\n%d gold pieces back with you from your journey. As the", (long)c[GOLD]); lprcat("\ncounty of Larn is in dire need of funds, we have spared no time"); lprintf("\nin preparing your tax bill. You owe %d gold pieces as", (long)c[GOLD] * TAXRATE); lprcat("\nof this notice, and is due within 5 days. Failure to pay will"); lprcat("\nmean penalties. Once again, congratulations, we look forward"); lprcat("\nto your future successful expeditions.\n"); lwclose(); return 1; }
letter5 () { int write_len; sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */ if (lcreat(mail600) < 0) { write_len = write(1,"can't write 600 letter\n",23); return(0); } lprcat("From: [email protected] (St. Mary's Children's Home)\n"); lprcat("Subject: these poor children\n"); lprcat("\n News of your great conquest has spread to all of Ularndom."); lprintf("\nMight I have a moment of a great %sman's time? We here at St.", sex?"":"wo"); lprcat("\nMary's Children's Home are very poor and many children are"); lprcat("\nstarving. Disease is widespread and very often fatal without"); lprcat("\ngood food. Could you possibly find it in your heart to help us"); lprcat("\nin our plight? Whatever you could give would help much."); lprcat("\n(your gift is tax-deductible)\n"); lwclose(); return(1); }
letter2 () { int write_len; sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */ if (lcreat(mail600) < 0) { write_len = write(1,"can't write 600 letter\n",23); return(0); } lprcat("From: [email protected] (His Majesty King Wilfred)\n"); lprcat("Subject: a noble deed\n"); lprcat("\n I have heard of your magnificent feat and I, King Wilfred,"); lprcat("\nhereby declare this day to be a national holiday. Furthermore,"); lprcat("\nthree days hence, ye be invited to the castle to receive the"); lprintf("\nhonour of %s of the Realm. Upon thy name shall it be written...", sex?"Knight":"Lady"); lprcat("\nBravery and courage be yours."); lprcat("\nMay you live in happiness for evermore...\n"); lwclose(); return(1); }
letter6 () { int write_len; sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */ if (lcreat(mail600) < 0) { write_len = write(1,"can't write 600 letter\n",23); return(0); } lprcat("From: [email protected] (National Dianthroritis Society of Ularn)\n"); lprcat("Subject: hope\n"); lprcat("\nCongratulations on your successful expedition. We are sure much"); lprcat("\ncourage and determination was needed on your quest. There are"); lprcat("\nmany though, that could never hope to undertake such a journey"); lprcat("\ndue to an enfeebling disease -- dianthroritis. We at the National"); lprcat("\nDianthroritis Society of Ularn wish to appeal to your philanthropy in"); lprcat("\norder to save many good people -- possibly even yourself or a loved one a few"); lprcat("\nyears from now. Much work needs to be done in researching this"); lprcat("\ndreaded disease and you can help today. Could you please see it"); lprcat("\nin your heart to give generously? Your continued good health"); lprcat("\ncan be your everlasting reward.\n"); lwclose(); return(1); }
void died(int x) { int f, win; char ch; const char *mod; time_t zzz; if (c[LIFEPROT] > 0) { /* if life protection */ switch ((x > 0) ? x : -x) { case 256: case 257: case 262: case 263: case 265: case 266: case 267: case 268: case 269: case 271: case 282: case 284: case 285: case 300: goto invalid; /* can't be saved */ }; --c[LIFEPROT]; c[HP] = 1; --c[CONSTITUTION]; cursors(); lprcat("\nYou feel wiiieeeeerrrrrd all over! "); emit_beep(); lflush(); sleep(4); return; /* only case where died() returns */ } invalid: clearvt100(); lflush(); f = 0; if (ckpflag) unlink(ckpfile);/* remove checkpoint file if used */ if (x < 0) { f++; x = -x; } /* if we are not to display the scores */ if ((x == 300) || (x == 257)) exit(0); /* for quick exit or saved game */ if (x == 263) win = 1; else win = 0; c[GOLD] += c[BANKACCOUNT]; c[BANKACCOUNT] = 0; /* now enter the player at the end of the scoreboard */ newscore(c[GOLD], logname, x, win); diedsub(x); /* print out the score line */ lflush(); set_score_output(); if ((wizard == 0) && (c[GOLD] > 0)) { /* wizards can't score */ #ifndef NOLOG if (gid != egid) setegid(egid); if (lappend(logfile) < 0) { /* append to file */ if (lcreat(logfile) < 0) { /* and can't create new * log file */ lcreat((char *) 0); lprcat("\nCan't open record file: I can't post your score.\n"); sncbr(); resetscroll(); lflush(); exit(0); } if (gid != egid) setegid(egid); chmod(logfile, 0660); if (gid != egid) setegid(gid); } if (gid != egid) setegid(gid); strcpy(logg.who, loginname); logg.score = c[GOLD]; logg.diff = c[HARDGAME]; if (x < 256) { ch = *monster[x].name; if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') mod = "an"; else mod = "a"; snprintf(logg.what, sizeof(logg.what), "killed by %s %s", mod, monster[x].name); } else snprintf(logg.what, sizeof(logg.what), "%s", whydead[x - 256]); logg.cavelev = level; time(&zzz); /* get CPU time -- write out score info */ logg.diedtime = zzz; #ifdef EXTRA times(&cputime);/* get CPU time -- write out score info */ logg.cputime = i = (cputime.tms_utime + cputime.tms_stime) / 60 + c[CPUTIME]; logg.lev = c[LEVEL]; logg.ac = c[AC]; logg.hpmax = c[HPMAX]; logg.hp = c[HP]; logg.elapsedtime = (zzz - initialtime + 59) / 60; logg.usage = (10000 * i) / (zzz - initialtime); logg.bytin = c[BYTESIN]; logg.bytout = c[BYTESOUT]; logg.moves = c[MOVESMADE]; logg.spused = c[SPELLSCAST]; logg.killed = c[MONSTKILLED]; #endif lwrite((char *) &logg, sizeof(struct log_fmt)); lwclose(); #endif /* NOLOG */ /* * now for the scoreboard maintenance -- not for a suspended * game */ if (x != 257) { if (sortboard()) { set_score_output(); scorerror = writeboard(); } } } if ((x == 256) || (x == 257) || (f != 0)) exit(0); if (scorerror == 0) showscores(); /* if we updated the scoreboard */ if (x == 263) mailbill(); exit(0); }
PROGRAMMER * pgm_new(void) { int i; PROGRAMMER * pgm; pgm = (PROGRAMMER *)malloc(sizeof(*pgm)); if (pgm == NULL) { fprintf(stderr, "%s: out of memory allocating programmer structure\n", progname); exit(1); } memset(pgm, 0, sizeof(*pgm)); pgm->id = lcreat(NULL, 0); pgm->desc[0] = 0; pgm->type[0] = 0; pgm->config_file[0] = 0; pgm->lineno = 0; pgm->baudrate = 0; for (i=0; i<N_PINS; i++) pgm->pinno[i] = 0; /* * mandatory functions - these are called without checking to see * whether they are assigned or not */ pgm->initialize = pgm_default_2; pgm->display = pgm_default_6; pgm->enable = pgm_default_4; pgm->disable = pgm_default_4; pgm->powerup = pgm_default_powerup_powerdown; pgm->powerdown = pgm_default_powerup_powerdown; pgm->program_enable = pgm_default_2; pgm->chip_erase = pgm_default_2; pgm->open = pgm_default_open; pgm->close = pgm_default_4; pgm->read_byte = pgm_default_3; pgm->write_byte = pgm_default_5; /* * predefined functions - these functions have a valid default * implementation. Hence, they don't need to be defined in * the programmer. */ pgm->rdy_led = pgm_default_led; pgm->err_led = pgm_default_led; pgm->pgm_led = pgm_default_led; pgm->vfy_led = pgm_default_led; /* * optional functions - these are checked to make sure they are * assigned before they are called */ pgm->cmd = NULL; pgm->cmd_tpi = NULL; pgm->spi = NULL; pgm->paged_write = NULL; pgm->paged_load = NULL; pgm->write_setup = NULL; pgm->read_sig_bytes = NULL; pgm->set_vtarget = NULL; pgm->set_varef = NULL; pgm->set_fosc = NULL; pgm->perform_osccal = NULL; pgm->parseextparams = NULL; pgm->setup = NULL; pgm->teardown = NULL; return pgm; }
Deque dqinit() { return lcreat(); }