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

Linux Cross Reference
Tina4/src/vision/scalar/scalar.c

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

  1 /**@(#)
  2 **/
  3 /* scalar.c functions for manipulating scalar quantities
  4  * 
  5  * typedef struct scalar { int type; int label; float val; struct list
  6  * *props; } Scalar;
  7  * 
  8  */
  9 
 10 #include <tina/sys.h>
 11 #include <tina/sysfuncs.h>
 12 #include <tina/math.h>
 13 #include <tina/mathfuncs.h>
 14 #include <tina/vision.h>
 15 #include <tina/visionfuncs.h>
 16 #ifdef _PCC
 17 #include <memory.h>
 18 #endif
 19 
 20 Scalar *scalar_alloc(unsigned int type)
 21 {
 22     Scalar *scalar = ts_ralloc(Scalar);
 23 
 24     scalar->type = type;
 25     scalar->label = new_label();
 26     scalar->val = (float) 0.0;
 27     scalar->props = NULL;
 28     return (scalar);
 29 }
 30 
 31 Scalar *scalar_make(double val, int type)
 32 {
 33     Scalar *scalar = ts_ralloc(Scalar);
 34 
 35     scalar->type = type;
 36     scalar->label = new_label();
 37     scalar->val = (float) val;
 38     scalar->props = NULL;
 39     return (scalar);
 40 }
 41 
 42 void    scalar_free(Scalar * scalar)
 43 {
 44     if (scalar == NULL)
 45         return;
 46     proplist_freelist(scalar->props);
 47     rfree((void *) scalar);
 48 }
 49 
 50 Scalar *scalar_copy(Scalar * scalar)
 51 {
 52     Scalar *copy;
 53     List   *proplist_copy();
 54 
 55     if (scalar == NULL)
 56         return (NULL);
 57 
 58     copy = ts_ralloc(Scalar);
 59     (void) memcpy((char *) copy, (char *) scalar, sizeof(Scalar));
 60     copy->props = proplist_copy(scalar->props);
 61     return (copy);
 62 }
 63 
 64 int     scalar_number(List * scalars)
 65 {
 66     List   *lptr;
 67     int     n = 0;
 68 
 69     for (lptr = scalars; lptr != NULL; lptr = lptr->next)
 70         ((Scalar *) (lptr->to))->label = n++;
 71     return(n);
 72 }
 73 

~ [ 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.