Back to index

radiance  4R0+20100331
Classes | Functions | Variables
plot.c File Reference
#include "rtio.h"
#include "meta.h"
#include "plot.h"

Go to the source code of this file.

Classes

struct  setting

Functions

static void spop (int attrib)
static int spat (int pat, char *patval)
void set (int attrib, char *value)
void unset (int attrib)
void reset (int attrib)

Variables

static const char RCSid [] = "$Id: plot.c,v 1.3 2003/11/15 02:13:37 schorsch Exp $"
int pati [4] = {0, 1, 2, 3}
unsigned char pattern [NPATS+4][PATSIZE/8][PATSIZE]
static int context = 0
static struct settingsets [0200]

Class Documentation

struct setting

Definition at line 99 of file plot.c.

Collaboration diagram for setting:
Class Members
int cnx
struct setting * snext
char * val

Function Documentation

void reset ( int  attrib)

Definition at line 185 of file plot.c.

{
    switch (attrib) {
       case SALL:
           reset(SPAT0);
           reset(SPAT1);
           reset(SPAT2);
           reset(SPAT3);
           context = 0;
           return;
       case SPAT0:
           spat(SPAT0, "P0");
           break;
       case SPAT1:
           spat(SPAT1, "P1");
           break;
       case SPAT2:
           spat(SPAT2, "P2");
           break;
       case SPAT3:
           spat(SPAT3, "P3");
           break;
       default:
           sprintf(errmsg, "Can't reset attribute: %o", attrib);
           error(WARNING, errmsg);
           return;
    }
    while (sets[attrib] != NULL)
       spop(attrib);
}

Here is the caller graph for this function:

void set ( int  attrib,
char *  value 
)

Definition at line 111 of file plot.c.

{
    struct setting  *newset;

    switch (attrib) {
       case SALL:
           context++;
           return;
       case SPAT0:
       case SPAT1:
       case SPAT2:
       case SPAT3:
           if (!spat(attrib, value)) {
              sprintf(errmsg, "Bad pattern set value: %s", value);
              error(WARNING, errmsg);
              return;
           }
           break;
       default:
           sprintf(errmsg, "Can't set attribute: %o", attrib);
           error(WARNING, errmsg);
           return;
    }
    newset = (struct setting *)malloc(sizeof(struct setting));
    newset->cnx = context;
    newset->val = savestr(value);
    newset->snext = sets[attrib];
    sets[attrib] = newset;
}
static int spat ( int  pat,
char *  patval 
) [static]

Definition at line 238 of file plot.c.

{
    int  n, i, j, v;
    register char  *cp;

    if (patval == NULL) return(FALSE);

    if (patval[0] == 'P' || patval[0] == 'p') {
       if (nextscan(patval+1, "%d", (char*)&n) == NULL || n < 0 || n >= NPATS)
           return(FALSE);
    } else {
       n = NPATS + pat - SPAT0;
       cp = patval;
       for (i = 0; i < PATSIZE>>3; i++)
           for (j = 0; j < PATSIZE; j++) {
              if ((cp = nextscan(cp, "%o", (char*)&v)) == NULL || v < 0 || v > 0377)
                  return(FALSE);
              pattern[n][i][j] = v;
           }
    }
    pati[pat-SPAT0] = n;
    return(TRUE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void spop ( int  attrib) [static]

Definition at line 221 of file plot.c.

{

    if (sets[attrib] != NULL) {
       if (sets[attrib]->val != NULL)
           freestr(sets[attrib]->val);
       free((char *)sets[attrib]);
       sets[attrib] = sets[attrib]->snext;
    }

}

Here is the call graph for this function:

Here is the caller graph for this function:

void unset ( int  attrib)

Definition at line 147 of file plot.c.

{
    register int  i;

    if (attrib == SALL) {
       if (context == 0)
           reset(SALL);
       else {
           context--;
           for (i = 0; i < 0200; i++)
              while (sets[i] != NULL && sets[i]->cnx > context)
                  spop(i);
       }
       return;
    }
    spop(attrib);
    if (sets[attrib] == NULL)
       reset(attrib);

    switch (attrib) {
       case SPAT0:
       case SPAT1:
       case SPAT2:
       case SPAT3:
           spat(attrib, sets[attrib]->val);
           break;
       default:
           sprintf(errmsg, "Can't unset attribute: %o", attrib);
           error(WARNING, errmsg);
           return;
    }
}

Here is the caller graph for this function:


Variable Documentation

int context = 0 [static]

Definition at line 97 of file plot.c.

int pati[4] = {0, 1, 2, 3}

Definition at line 14 of file plot.c.

unsigned char pattern[NPATS+4][PATSIZE/8][PATSIZE]

Definition at line 21 of file plot.c.

const char RCSid[] = "$Id: plot.c,v 1.3 2003/11/15 02:13:37 schorsch Exp $" [static]

Definition at line 2 of file plot.c.

struct setting* sets[0200] [static]

Definition at line 105 of file plot.c.