Back to index

radiance  4R0+20100331
Functions | Variables
freeobjmem.c File Reference
#include "copyright.h"
#include "ray.h"
#include "otypes.h"
#include "rtotypes.h"
#include "face.h"
#include "cone.h"
#include "instance.h"
#include "data.h"
#include "font.h"
#include "func.h"
#include "mesh.h"

Go to the source code of this file.

Functions

int free_os (register OBJREC *op)
int free_objs (register OBJECT on, OBJECT no)
void free_objmem (void)

Variables

static const char RCSid [] = "$Id: freeobjmem.c,v 2.7 2004/03/30 16:13:01 schorsch Exp $"

Function Documentation

void free_objmem ( void  )

Definition at line 89 of file freeobjmem.c.

{
       free_objs(0, nobjects);
       freedata(NULL);
       freefont(NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int free_objs ( register OBJECT  on,
OBJECT  no 
)

Definition at line 71 of file freeobjmem.c.

{
       int    nfreed;
       register OBJREC      *op;

       for (nfreed = 0; no-- > 0; on++) {
              op = objptr(on);
              if (op->os != NULL)
                     nfreed += free_os(op);
       }
       return(nfreed);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int free_os ( register OBJREC op)

Definition at line 25 of file freeobjmem.c.

{
       if (op->os == NULL)
              return(0);
       if (hasfunc(op->otype)) {
              freefunc(op);
              return(1);
       }
       switch (op->otype) {
       case OBJ_FACE:              /* polygon */
              freeface(op);
              return(1);
       case OBJ_CONE:              /* cone */
       case OBJ_RING:              /* disk */
       case OBJ_CYLINDER:   /* cylinder */
       case OBJ_CUP:        /* inverted cone */
       case OBJ_TUBE:              /* inverted cylinder */
              freecone(op);
              return(1);
       case OBJ_INSTANCE:   /* octree instance */
              freeinstance(op);
              return(1);
       case OBJ_MESH:              /* mesh instance */
              freemeshinst(op);
              return(1);
       case PAT_BTEXT:             /* monochromatic text */
       case PAT_CTEXT:             /* colored text */
       case MIX_TEXT:              /* mixing text */
              freetext(op);
              return(1);
       case MAT_CLIP:              /* clipping surface */
       case MAT_SPOT:              /* spot light source */
              free((void *)op->os);
              op->os = NULL;
              return(1);
       }
#ifdef DEBUG
       objerror(op, WARNING, "cannot free structure");
#endif
       return(0);
}

Here is the call graph for this function:


Variable Documentation

const char RCSid[] = "$Id: freeobjmem.c,v 2.7 2004/03/30 16:13:01 schorsch Exp $" [static]

Definition at line 2 of file freeobjmem.c.