~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/serialise/narray.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include <stdio.h>
  2 #include <stdlib.h>
  3 #include <tina/sys.h>
  4 #include <tina/sysfuncs.h>
  5 #include <tina/math.h>
  6 #include <tina/mathfuncs.h>
  7 
  8 void    nvector_ts_free(Varptr d, int l, int h, Vartype type);
  9 void    nvector_ts_print(Varptr d, int l, int h, Vartype type);
 10 List   *nvector_ts_serialise(List * lg, Varptr d, int l, int h, Vartype type);
 11 List   *nvector_ts_deserialise(List * lg, Varptr * d, int l, int h, Vartype type);
 12 
 13 void    narray_ts_print(Varptrptr d, int m1, int n1, int m2, int n2, Vartype type)
 14 {
 15     int     i;
 16 
 17     mprintf("narray { Low1 %d high1 %d Low2 %d high2 %d type ", m1, m2, n1, n2);
 18     print_vtype(stdout, type);
 19     mprintf("; [");
 20     for (i = m1; i < m2; i++)
 21     {
 22         Varptr  v;
 23 
 24         v.ptr_v = d.ptr_v[i];
 25         nvector_ts_print(v, n1, n2, type);
 26     }
 27     mprintf("]};");
 28 }
 29 
 30 List   *narray_ts_serialise(List * lg, Varptrptr d,
 31                          int m1, int n1, int m2, int n2, Vartype type)
 32 {
 33     int     i;
 34     Varptr  v;
 35 
 36     v.ptr_v = (void **) d.char_v;
 37     lg = nvector_ts_serialise(lg, v, m1, m2, int_v);
 38     for (i = m1; i < m2; i++)
 39     {
 40         v.char_v = d.char_v[i];
 41         if(v.char_v) lg = nvector_ts_serialise(lg, v, n1, n2, type);
 42     }
 43     return lg;
 44 }
 45 
 46 List   *narray_ts_deserialise(List * lg, Varptrptr * d,
 47                          int m1, int n1, int m2, int n2, Vartype type)
 48 {
 49     int     i;
 50     Varptr *vp;
 51 
 52     vp = (Varptr *) & (d->ptr_v);
 53     lg = nvector_ts_deserialise(lg, vp, m1, m2, int_v);
 54     for (i = m1; i < m2; i++)
 55     {
 56         vp = (Varptr *) d->char_v + i;
 57         if(vp->char_v) lg = nvector_ts_deserialise(lg, vp, n1, n2, type);
 58     }
 59     return lg;
 60 }
 61 void narray_ts_free(Varptrptr d,
 62                     int m1, int n1, int m2, int n2, Vartype type)
 63 {
 64     int     i;
 65     Varptr  v;
 66 
 67     v.ptr_v = (void **) d.char_v;
 68     for (i = m1; i < m2; i++)
 69     {
 70         v.char_v = d.char_v[i];
 71         if(v.char_v) nvector_ts_free(v, n1, n2, type);
 72     }
 73     rfree(d.char_v);
 74 }
 75 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.