Back to index

tetex-bin  3.0
Defines | Functions
tpic.h File Reference
#include "numbers.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define M_PI   (4.0*atan(1.0))

Functions

int tpic_parse_special (char *buffer, UNSIGNED_QUAD size, double x_user, double y_user)

Define Documentation

#define M_PI   (4.0*atan(1.0))

Definition at line 35 of file tpic.h.


Function Documentation

int tpic_parse_special ( char *  buffer,
UNSIGNED_QUAD  size,
double  x_user,
double  y_user 
)

Definition at line 363 of file tpic.c.

{
  int i, tpic_command, result = 0;
  char *end = buffer + size;
  char *token;
  skip_white (&buffer, end);
  if ((token = parse_ident (&buffer, end))) {
    for (i=0; i<(sizeof(tpic_specials)/sizeof(tpic_specials[0])); i++) {
      if (!strcmp (tpic_specials[i].s, token))
       break;
    }
    RELEASE (token);
  } else
    return 0;
  if (i < sizeof(tpic_specials)/sizeof(tpic_specials[0])) {
    tpic_command = tpic_specials[i].tpic_command;
    skip_white (&buffer, end);
    result = 1;
    switch (tpic_command) {
    case TPIC_PN:
      set_pen_size (&buffer, end);
      break;
    case TPIC_PA:
      add_point (&buffer, end);
      break;
    case TPIC_FP:
      flush_path(x_user, y_user, 0, 0.0);
      break;
    case TPIC_IP: 
      flush_path(x_user, y_user, 1, 0.0);
      break;
    case TPIC_DA:
      {
       char *s;
       if ((s=parse_number(&buffer, end))) {
         flush_path(x_user, y_user, 0, atof (s));
         RELEASE (s);
       }
      }
      break;
    case TPIC_DT:
      {
       char *s;
       if ((s=parse_number(&buffer, end))) {
         flush_path(x_user, y_user, 0, -atof (s));
         RELEASE (s);
       }
      }
      break;
    case TPIC_SP:
      {
       char *s;
       if ((s=parse_number(&buffer, end)))
         spline_path (x_user, y_user, atof (s));
       else
         spline_path(x_user, y_user, 0.0);
       break;
      }
    case TPIC_AR:
      arc (&buffer, end, x_user, y_user, 0);
      break;
    case TPIC_IA:
      arc (&buffer, end, x_user, y_user, 1);
      break;
    case TPIC_SH:
      set_fill_color (&buffer, end);
      break;
    case TPIC_WH: 
      fill_shape = 1;
      fill_color = 1.0;
      break;
    case TPIC_BK:
      fill_shape = 1;
      fill_color = 0.0;
      break;
    case TPIC_TX: 
      fill_shape = 1;
      {
       long num = 0, den = 0;
       while (buffer++ < end) {
         switch (*(buffer++)) {
         case '0':
           num += 0;
         case '1':
         case '2':
         case '4':
         case '8':
           num += 1;
           break;
         case '3':
         case '5':
         case '6':
         case '9':
         case 'a':
         case 'A':
         case 'c':
         case 'C':
           num += 2;
           break;
         case '7':
         case 'b':
         case 'B':
         case 'd':
         case 'D':
           num += 3;
           break;
         case 'f':
         case 'F':
           num += 4;
           break;
         default:
           break;
         }
         den += 16;
       }
       if (den != 0) {
         default_fill_color = 1.0 - (float) (num)/(den);
       }
       else {
         default_fill_color = 0.5;
       }
      }
      break;
    default:
      fprintf (stderr, "Fix me, I'm broke.  This should never happen");
      exit(1);
    }
  } else {
    result = 0;
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function: