1: #ifndef lint
   2: static char *rcsid =
   3:    "$Header: pbignum.c,v 1.3 83/09/12 14:17:59 sklower Exp $";
   4: #endif
   5: 
   6: /*					-[Sat Jan 29 13:30:47 1983 by jkf]-
   7:  * 	pbignum.c			$Locker:  $
   8:  * print a bignum
   9:  *
  10:  * (c) copyright 1982, Regents of the University of California
  11:  */
  12: 
  13: #include "global.h"
  14: 
  15: pbignum(current, useport)
  16: register lispval current;
  17: register FILE *useport;
  18: {
  19:     long  *top, *bot, *work, negflag = 0;
  20:     char *alloca();
  21:     register int *digitp;
  22:     Keepxs();
  23: 
  24:     /* copy bignum onto stack */
  25:     top = (sp()) - 1;
  26:     do {
  27:         stack(current->s.I);
  28:     } while(current = current->s.CDR);
  29: 
  30:     bot = sp();
  31:     if (top==bot) {
  32:         fprintf(useport,"%d",*bot);
  33:         Freexs();
  34:         return;
  35:     }
  36: 
  37:     /* save space for printed digits*/
  38:     work = (int *)alloca((top-bot)*2*sizeof(int));
  39:     if( *bot < 0) {
  40:         negflag = 1;
  41:         dsneg(top,bot);
  42:     }
  43: 
  44:     /* figure out nine digits at a time by destructive division*/
  45:     for(digitp = work; bot <= top; digitp++) {
  46:         *digitp = dodiv(top,bot);
  47:         if(*bot==0) bot += 1;
  48:     }
  49: 
  50:     /* print them out */
  51: 
  52:     if(negflag) putc('-',useport);
  53:     fprintf(useport,"%d",*--digitp);
  54:     while ( digitp > work) fprintf(useport,"%.09d",*--digitp);
  55:     Freexs();
  56: }

Defined functions

Defined variables

rcsid defined in line 2; never used
Last modified: 1985-08-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 764
Valid CSS Valid XHTML 1.0 Strict