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

Diff of /gcl/o/utils.c

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

revision 1.1.1.1 by wfs, Mon Dec 6 22:44:14 1999 UTC revision 1.2 by camm, Thu Jun 13 00:00:46 2002 UTC
# Line 1  Line 1 
1    #define _GNU_SOURCE
2    #include <stdarg.h>
3  #include "include.h"  #include "include.h"
4    
5  /* The functions IisProp check the property holds, and return the  /* The functions IisProp check the property holds, and return the
# Line 48  Iis_fixnum(f) Line 50  Iis_fixnum(f)
50      }      }
51  }  }
52    
53  void Wrong_type_error(str,n,va_alist)  void Wrong_type_error(char *str,int n,...) {
54       char *str;    FEerror("Wrong type error",0);
      int n;  
      va_dcl  
 { FEerror("Wrong type error",0);  
55  }  }
56    
57  object  object
# Line 68  object (*f)(); Line 67  object (*f)();
67  }  }
68    
69  object  object
70  Ifuncall_n(fun,n,va_alist)  Ifuncall_n(object fun,int n,...) {
71  /* call fun on the n optional args supplied, and set the fcall.nvalues etc  /* call fun on the n optional args supplied, and set the fcall.nvalues etc
72     return the first value */     return the first value */
73  object fun;    va_list ap;
74  int n;    object *new;
75  va_dcl    va_start(ap,n);
76  {va_list ap;    {
77   object *new;      COERCE_VA_LIST(new,ap,n);
78   va_start(ap);    }
79   {COERCE_VA_LIST(new,ap,n);    va_end(ap);
80   return IapplyVector(fun,n,new);    return IapplyVector(fun,n,new);
  va_end(ap);  
 }  
81  }  }
82    
83    
84    
85  /* For applying FUN to args in VA_LIST, where n are supplied directly  /* For applying FUN to args in VA_LIST, where n are supplied directly
86     and the last one is itself a va_list */     and the last one is itself a va_list */
87    /*  object */
88    /*  Iapply_fun_n(object fun,int n,int m,...) { */
89    
90    /*    va_list ap1,ap; */
91    /*    object b[F_ARG_LIMIT]; */
92    /*    int i = 0; */
93    
94    /*    va_start(ap1,m); */
95      
96    /*    while (--n >= 0) */
97    /*      { b[i++] = va_arg(ap1,object);} */
98    /*    if (m > 0) { */
99    /*      ap =     va_arg(ap1,va_list); */
100    /*      while (--m >= 0) */
101    /*        { b[i++] = va_arg(ap,object);} */
102    /*    } */
103    
104    /*    va_end(ap1); */
105    
106    /*    return IapplyVector(fun,i,b); */
107    
108    /*  } */
109    
110    
111    
112    /* For applying FUN to args in VA_LIST, where n are supplied directly
113       and the last one is itself a va_list */
114  object  object
115  Iapply_fun_n(fun,n,m,va_alist)  Iapply_fun_n1(object (*fun)(),int n,int m,...) {
116  object fun;  
117  int n,m;    va_list ap;
118  va_dcl    object b[F_ARG_LIMIT],*bb;
119  {va_list ap1,ap;    int i = 0;
120   object b[F_ARG_LIMIT];  
121   int i = 0;    va_start(ap,m);
122   va_start(ap1);  
123      while (--n >= 0) {
124   while (--n >= 0)      b[i++] = va_arg(ap,object);}
125     { b[i++] = va_arg(ap1,object);}    if (m > 0) {
126   if (m > 0) {      bb = va_arg(ap,object *);
127     ap =  va_arg(ap1,va_list);      while (--m >= 0)
128     while (--m >= 0)        b[i++] = *bb++;
129       { b[i++] = va_arg(ap,object);}    }
130   }  
131      va_end(ap);
132    
133     return IapplyVector(fun,i,b);
134    }
135    
136    /* For applying FUN to args in VA_LIST, where n are supplied directly
137       and the last one is itself a va_list */
138    object
139    Iapply_fun_n2(object fun,int n,int m,...) {
140    
141      va_list ap,*app;
142      object b[F_ARG_LIMIT];
143      int i = 0;
144    
145      va_start(ap,m);
146    
147      while (--n >= 0) {
148        b[i++] = va_arg(ap,object);}
149      if (m > 0) {
150        app = va_arg(ap,va_list *);
151        while (--m >= 0)
152          b[i++] = va_arg(*app,object);
153      }
154    
155      va_end(ap);
156    
157   return IapplyVector(fun,i,b);   return IapplyVector(fun,i,b);
158  }  }
159    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

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