home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / pointlist / ptlList.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-12  |  2.1 KB  |  83 lines

  1. #include "ooglutil.h"
  2. #include "geom.h"
  3. #include "listP.h"
  4. #include "pointlistP.h"
  5.  
  6.  
  7. void *list_PointList_get(int sel, Geom *geom, va_list args);
  8. void *list_PointList_fillin(int sel, Geom *geom, va_list args);
  9. void *list_PointList_set(int sel, Geom *geom, va_list args);
  10. void *list_PointList_length(int sel, Geom *geom, va_list args);
  11.  
  12. #define MAX_METHODS 4
  13.  
  14. static SpecFunc methods[] = {
  15.   "PointList_get", list_PointList_get,
  16.   "PointList_fillin", list_PointList_fillin,
  17.   "PointList_set", list_PointList_set,
  18.   "PointList_length", list_PointList_length
  19.   };
  20.  
  21. static char msg[] = "ptlList.c";
  22.  
  23. ptlList_init() {
  24.   pointlist_initspec(methods, MAX_METHODS, GeomClassLookup("list"));
  25. }
  26.  
  27. void *list_PointList_get(int sel, Geom *geom, va_list args) {
  28.   List *l = (List *)geom;
  29.   HPoint3 *plist;
  30.   float **f;
  31.   
  32.   plist = OOGLNewNE(HPoint3, 
  33.             (int)GeomCall(GeomMethodSel("PointList_length"), geom), 
  34.              msg);
  35.   f = va_arg(args, float **);
  36.  
  37.   return(GeomCall(GeomMethodSel("PointList_fillin"), geom, f, 0, plist));
  38.  
  39. }
  40.  
  41. void *list_PointList_fillin(int sel, Geom *geom, va_list args) {
  42.   float **t;
  43.   int n_points1;
  44.   HPoint3 *plist;
  45.   List *l = (List *)geom;
  46.  
  47.   t = va_arg(args, float **);
  48.   va_arg(args, int);
  49.   plist = va_arg(args, HPoint3 *);
  50.  
  51.   n_points1 = (int)GeomCall(GeomMethodSel("PointList_length"), l->car);
  52.  
  53.   GeomCall(GeomMethodSel("PointList_fillin"), l->car, t, 0, plist);
  54.   GeomCall(GeomMethodSel("PointList_fillin"), (Geom *)l->cdr, t, 0, 
  55.        &plist[n_points1]);
  56.   return plist;
  57. }
  58.  
  59.  
  60. void *list_PointList_set(int sel, Geom *geom, va_list args) {
  61.   HPoint3 *pt1;
  62.   int n_points1, coordsys;
  63.   List *l = (List *)geom;
  64.  
  65.   coordsys = va_arg(args, int);
  66.   pt1 = va_arg(args, HPoint3 *);
  67.   n_points1 = (int)GeomCall(GeomMethodSel("PointList_length"), l->car);
  68.  
  69.   GeomCall(GeomMethodSel("PointList_set"), l->car, coordsys, pt1);
  70.   GeomCall(GeomMethodSel("PointList_set"), (Geom *)l->cdr, 
  71.        coordsys, &pt1[n_points1]);
  72.  
  73.   return geom;
  74. }
  75.  
  76. void *list_PointList_length(int sel, Geom *geom, va_list args) {
  77.   List *l = (List *)geom;
  78.   return  (void *)
  79.     ((int)GeomCall(GeomMethodSel("PointList_length"), l->car) + 
  80.      (int)GeomCall(GeomMethodSel("PointList_length"), (Geom *)l->cdr));
  81. }
  82.  
  83.