/[gcl]/gcl/o/alloc.c
ViewVC logotype

Diff of /gcl/o/alloc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by camm, Sun Oct 27 15:35:06 2002 UTC revision 1.16 by camm, Sun Feb 9 22:35:15 2003 UTC
# Line 24  Foundation, 675 Mass Ave, Cambridge, MA Line 24  Foundation, 675 Mass Ave, Cambridge, MA
24          IMPLEMENTATION-DEPENDENT          IMPLEMENTATION-DEPENDENT
25  */  */
26    
 /*  #define _GNU_SOURCE */  
27  #include <string.h>  #include <string.h>
28  #include <unistd.h>  #include <unistd.h>
29  #include <stdlib.h>  #include <stdlib.h>
# Line 375  object on_stack_cons(object x, object y) Line 374  object on_stack_cons(object x, object y)
374  }  }
375    
376    
377  DEFUN("ALLOCATED",object,fSallocated,SI  DEFUN_NEW("ALLOCATED",object,fSallocated,SI,2,2,NONE,OO,OO,OO,OO,(object typ),"")
    ,2,2,NONE,OO,OO,OO,OO,"")(typ)  
 object typ;  
378  { struct typemanager *tm=(&tm_table[t_from_type(typ)]);  { struct typemanager *tm=(&tm_table[t_from_type(typ)]);
379    tm = & tm_table[tm->tm_type];    tm = & tm_table[tm->tm_type];
380    if (tm->tm_type == t_relocatable)    if (tm->tm_type == t_relocatable)
# Line 401  object typ; Line 398  object typ;
398               ));               ));
399  }  }
400    
401  DEFUN("RESET-NUMBER-USED",object,fSreset_number_used,SI,0,1,NONE,OO,OO,OO,OO,"")(typ)  DEFUN_NEW("RESET-NUMBER-USED",object,fSreset_number_used,SI,0,1,NONE,OO,OO,OO,OO,(object typ),"")
      object typ;  
402  {int i;  {int i;
403   if (VFUN_NARGS == 1)   if (VFUN_NARGS == 1)
404     { tm_table[t_from_type(typ)].tm_nused = 0;}     { tm_table[t_from_type(typ)].tm_nused = 0;}
# Line 732  init_alloc(void) { Line 728  init_alloc(void) {
728        
729  }  }
730    
731  DEFUN("STATICP",object,fSstaticp,SI,1,1,NONE,OO,OO,OO,OO,"Tell if the string or vector is static") (x)  DEFUN_NEW("STATICP",object,fSstaticp,SI,1,1,NONE,OO,OO,OO,OO,(object x),"Tell if the string or vector is static")
 object x;  
732  { RETURN1((inheap(x->ust.ust_self) ? sLt : sLnil));  { RETURN1((inheap(x->ust.ust_self) ? sLt : sLnil));
733  }  }
734    
# Line 742  cant_get_a_type(void) { Line 737  cant_get_a_type(void) {
737    FEerror("Can't get a type.", 0);    FEerror("Can't get a type.", 0);
738  }  }
739    
740  DEFUNO("ALLOCATE",object,fSallocate,SI  DEFUNO_NEW("ALLOCATE",object,fSallocate,SI
741         ,2,3,NONE,OO,IO,OO,OO,siLallocate,"")(type,npages,va_alist)         ,2,3,NONE,OO,IO,OO,OO,siLallocate,(object type,int npages,...),"")
      object type;  
      int npages;  
      va_dcl  
742  {  {
743    
744    int nargs=VFUN_NARGS;    int nargs=VFUN_NARGS;
# Line 758  DEFUNO("ALLOCATE",object,fSallocate,SI Line 750  DEFUNO("ALLOCATE",object,fSallocate,SI
750        
751    really_do=Cnil;    really_do=Cnil;
752    if (nargs>=3) {    if (nargs>=3) {
753      va_start(ap);      va_start(ap,npages);
754      really_do=va_arg(ap,object);      really_do=va_arg(ap,object);
755      va_end(ap);      va_end(ap);
756    }    }
# Line 818  t_from_type(object type) { Line 810  t_from_type(object type) {
810     when the sgc is turned on.  FREE_PERCENT is an integer between 0 and 100.     when the sgc is turned on.  FREE_PERCENT is an integer between 0 and 100.
811     */     */
812    
813  DEFUN("ALLOCATE-SGC",object,fSallocate_sgc,SI  DEFUN_NEW("ALLOCATE-SGC",object,fSallocate_sgc,SI
814        ,4,4,NONE,OO,II,II,OO,"")(object type,int min,int max,int free_percent) {        ,4,4,NONE,OO,II,II,OO,(object type,int min,int max,int free_percent),"") {
815    
816    int t=t_from_type(type);    int t=t_from_type(type);
817    struct typemanager *tm;    struct typemanager *tm;
# Line 842  DEFUN("ALLOCATE-SGC",object,fSallocate_s Line 834  DEFUN("ALLOCATE-SGC",object,fSallocate_s
834  /* Growth of TYPE will be by at least MIN pages and at most MAX pages.  /* Growth of TYPE will be by at least MIN pages and at most MAX pages.
835     It will try to grow PERCENT of the current pages.     It will try to grow PERCENT of the current pages.
836     */     */
837  DEFUN("ALLOCATE-GROWTH",object,fSallocate_growth,SI,5,5,NONE,OO,II,II,OO,"")  DEFUN_NEW("ALLOCATE-GROWTH",object,fSallocate_growth,SI,5,5,NONE,OO,II,II,OO,
838       (type,min,max,percent,percent_free)        (object type,int min,int max,int percent,int percent_free),"")
 int min,max,percent,percent_free;  
 object type;  
839  {int  t=t_from_type(type);  {int  t=t_from_type(type);
840   struct typemanager *tm=tm_of(t);   struct typemanager *tm=tm_of(t);
841   object res;   object res;
# Line 868  object type; Line 858  object type;
858    
859    
860    
861  DEFUNO("ALLOCATE-CONTIGUOUS-PAGES",object,fSallocate_contiguous_pages,SI  DEFUNO_NEW("ALLOCATE-CONTIGUOUS-PAGES",object,fSallocate_contiguous_pages,SI
862         ,1,2,NONE,OI,OO,OO,OO,siLalloc_contpage,"")(npages,va_alist)         ,1,2,NONE,OI,OO,OO,OO,siLalloc_contpage,(int npages,...),"")
      int npages;  
      va_dcl  
863  {  {
864    
865    int nargs=VFUN_NARGS,i,m;    int nargs=VFUN_NARGS,i,m;
# Line 881  DEFUNO("ALLOCATE-CONTIGUOUS-PAGES",objec Line 869  DEFUNO("ALLOCATE-CONTIGUOUS-PAGES",objec
869        
870    really_do=Cnil;    really_do=Cnil;
871    if (nargs>=2) {    if (nargs>=2) {
872      va_start(ap);      va_start(ap,npages);
873      really_do=va_arg(ap,object);      really_do=va_arg(ap,object);
874      va_end(ap);      va_end(ap);
875    }    }
# Line 911  DEFUNO("ALLOCATE-CONTIGUOUS-PAGES",objec Line 899  DEFUNO("ALLOCATE-CONTIGUOUS-PAGES",objec
899  }  }
900    
901    
902  DEFUNO("ALLOCATED-CONTIGUOUS-PAGES",object,fSallocated_contiguous_pages,SI  DEFUNO_NEW("ALLOCATED-CONTIGUOUS-PAGES",object,fSallocated_contiguous_pages,SI
903     ,0,0,NONE,OO,OO,OO,OO,siLncbpage,"")()         ,0,0,NONE,OO,OO,OO,OO,siLncbpage,(void),"")
904  {  {
905          /* 0 args */          /* 0 args */
906          RETURN1((make_fixnum(ncbpage)));          RETURN1((make_fixnum(ncbpage)));
907  }  }
908    
909  DEFUNO("MAXIMUM-CONTIGUOUS-PAGES",object,fSmaximum_contiguous_pages,SI  DEFUNO_NEW("MAXIMUM-CONTIGUOUS-PAGES",object,fSmaximum_contiguous_pages,SI
910     ,0,0,NONE,OO,OO,OO,OO,siLmaxcbpage,"")()         ,0,0,NONE,OO,OO,OO,OO,siLmaxcbpage,(void),"")
911  {  {
912          /* 0 args */          /* 0 args */
913          RETURN1((make_fixnum(maxcbpage)));          RETURN1((make_fixnum(maxcbpage)));
914  }  }
915    
916    
917  DEFUNO("ALLOCATE-RELOCATABLE-PAGES",object,fSallocate_relocatable_pages,SI  DEFUNO_NEW("ALLOCATE-RELOCATABLE-PAGES",object,fSallocate_relocatable_pages,SI
918         ,1,2,NONE,OI,OO,OO,OO,siLalloc_relpage,"")(npages,va_alist)         ,1,2,NONE,OI,OO,OO,OO,siLalloc_relpage,(int npages,...),"")
      int npages;  
      va_dcl  
919  {  {
920    
921    int nargs=VFUN_NARGS;    int nargs=VFUN_NARGS;
# Line 938  DEFUNO("ALLOCATE-RELOCATABLE-PAGES",obje Line 924  DEFUNO("ALLOCATE-RELOCATABLE-PAGES",obje
924        
925    really_do=Cnil;    really_do=Cnil;
926    if (nargs>=2) {    if (nargs>=2) {
927      va_start(ap);      va_start(ap,npages);
928      really_do=va_arg(ap,object);      really_do=va_arg(ap,object);
929      va_end(ap);      va_end(ap);
930    }    }
# Line 960  DEFUNO("ALLOCATE-RELOCATABLE-PAGES",obje Line 946  DEFUNO("ALLOCATE-RELOCATABLE-PAGES",obje
946    
947  }  }
948    
949  DEFUNO("ALLOCATED-RELOCATABLE-PAGES",object,fSallocated_relocatable_pages,SI  DEFUNO_NEW("ALLOCATED-RELOCATABLE-PAGES",object,fSallocated_relocatable_pages,SI
950     ,0,0,NONE,OO,OO,OO,OO,siLnrbpage,"")()         ,0,0,NONE,OO,OO,OO,OO,siLnrbpage,(void),"")
951  {  {
952          /* 0 args */          /* 0 args */
953          RETURN1(make_fixnum(nrbpage));          RETURN1(make_fixnum(nrbpage));
954  }  }
955    
956  DEFUNO("GET-HOLE-SIZE",object,fSget_hole_size,SI  DEFUNO_NEW("GET-HOLE-SIZE",object,fSget_hole_size,SI
957     ,0,0,NONE,OO,OO,OO,OO,siLget_hole_size,"")()         ,0,0,NONE,OO,OO,OO,OO,siLget_hole_size,(void),"")
958  {  {
959          /* 0 args */          /* 0 args */
960          RETURN1((make_fixnum(new_holepage)));          RETURN1((make_fixnum(new_holepage)));
961  }  }
962    
963  DEFUNO("SET-HOLE-SIZE",object,fSset_hole_size,SI  DEFUNO_NEW("SET-HOLE-SIZE",object,fSset_hole_size,SI
964         ,1,2,NONE,OI,IO,OO,OO,siLset_hole_size,"")(npages,va_alist)         ,1,2,NONE,OI,IO,OO,OO,siLset_hole_size,(int npages,...),"")
      int npages;  
      va_dcl  
965  {  {
966    
967    int nargs=VFUN_NARGS;    int nargs=VFUN_NARGS;
# Line 986  DEFUNO("SET-HOLE-SIZE",object,fSset_hole Line 970  DEFUNO("SET-HOLE-SIZE",object,fSset_hole
970    
971    reserve=30;    reserve=30;
972    if (nargs>=2) {    if (nargs>=2) {
973      va_start(ap);      va_start(ap,npages);
974      reserve=va_arg(ap,int);      reserve=va_arg(ap,int);
975      va_end(ap);      va_end(ap);
976    }    }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26