Back to index

tetex-bin  3.0
Defines | Functions | Variables
header_routines.c File Reference
#include "cpascal.h"
#include "list_routines.h"
#include "manifests.h"
#include "header_routines.h"
#include "print_routines.h"
#include "error_routines.h"
#include "out_ofm.h"
#include "omfonts.h"

Go to the source code of this file.

Defines

#define LOC_CHECK_SUM   0
#define LOC_DESIGN_SIZE   4
#define LOC_CODING_SCHEME   8
#define LOC_FAMILY   (LOC_CODING_SCHEME+LEN_CODING_SCHEME+1)
#define LOC_SEVEN_FLAG   (LOC_FAMILY+LEN_FAMILY+1)
#define LOC_FACE   (LOC_SEVEN_FLAG+3)
#define HEADER_MIN   18
#define HEADER_MAX   255

Functions

void store_header_int (unsigned loc, unsigned val)
void store_header_byte (unsigned loc, unsigned val)
void retrieve_header_int (unsigned loc, unsigned *where)
void retrieve_header_byte (unsigned loc, unsigned char *where)
void init_header_word ()
void set_header_word (unsigned index, unsigned val)
void store_header_word ()
void retrieve_header_word ()
void print_header (void)
void init_check_sum (void)
void set_check_sum (unsigned cs)
void store_check_sum (void)
void retrieve_check_sum (void)
void calculate_check_sum (void)
void init_design_size ()
void set_design_size (fix ds)
void store_design_size (void)
void retrieve_design_size (void)
void init_design_units (void)
void set_design_units (fix du)
void init_coding_scheme (void)
void set_coding_scheme (string sval)
void store_coding_scheme (void)
void retrieve_coding_scheme (void)
void init_family (void)
void set_family (string sval)
void store_family (void)
void retrieve_family (void)
void init_face ()
void set_face (unsigned f)
void store_face (void)
void retrieve_face (void)
void init_ofm_level ()
void set_ofm_level (unsigned level)
void init_font_dir ()
void set_font_dir (unsigned direction)
void init_seven_bit_safe_flag ()
void set_seven_bit_safe_flag (unsigned f)
void store_seven_bit_safe_flag (void)
void retrieve_seven_bit_safe_flag (void)
void calculate_seven_bit_safe_flag (void)
void init_header (void)
void store_header (void)
void retrieve_header (void)
void output_ofm_header (void)

Variables

string header
av_list header_list = NULL
unsigned header_max = HEADER_MIN-1
unsigned check_sum
boolean check_sum_specified
fix design_size
boolean design_size_specified
fix design_units
boolean design_units_specified
string coding_scheme
boolean coding_scheme_specified
string family
boolean family_specified
unsigned face
boolean face_specified
unsigned ofm_level
boolean ofm_level_specified
unsigned font_dir
boolean font_dir_specified
boolean seven_bit
boolean seven_bit_specified
boolean seven_bit_calculated
unsigned font_type = FT_VANILLA
unsigned lh

Define Documentation

#define HEADER_MAX   255

Definition at line 41 of file header_routines.c.

#define HEADER_MIN   18

Definition at line 40 of file header_routines.c.

#define LOC_CHECK_SUM   0

Definition at line 33 of file header_routines.c.

#define LOC_CODING_SCHEME   8

Definition at line 35 of file header_routines.c.

#define LOC_DESIGN_SIZE   4

Definition at line 34 of file header_routines.c.

#define LOC_FACE   (LOC_SEVEN_FLAG+3)

Definition at line 38 of file header_routines.c.

Definition at line 36 of file header_routines.c.

Definition at line 37 of file header_routines.c.


Function Documentation

Definition at line 242 of file header_routines.c.

{
/* 
    if (check_sum_specified == FALSE) {
       not_yet_done("checksum calculation");
    }
*/
}

Here is the caller graph for this function:

Definition at line 546 of file header_routines.c.

{
    if ((seven_bit_specified == TRUE) && (seven_bit == 1) &&
        (seven_bit_calculated == 0)) {
        warning_0("SEVENBITSAFEFLAG value specified TRUE; "
                  "really FALSE");
    }
    seven_bit = seven_bit_calculated;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 214 of file header_routines.c.

Here is the caller graph for this function:

Definition at line 315 of file header_routines.c.

Here is the caller graph for this function:

Definition at line 255 of file header_routines.c.

Here is the caller graph for this function:

Definition at line 291 of file header_routines.c.

Here is the caller graph for this function:

Definition at line 430 of file header_routines.c.

Here is the caller graph for this function:

Definition at line 380 of file header_routines.c.

{
    family = "UNSPECIFIED";
    family_specified = FALSE;
}

Here is the caller graph for this function:

Definition at line 489 of file header_routines.c.

Definition at line 557 of file header_routines.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 116 of file header_routines.c.

Here is the caller graph for this function:

Definition at line 466 of file header_routines.c.

Definition at line 511 of file header_routines.c.

Here is the caller graph for this function:

Definition at line 618 of file header_routines.c.

{
    unsigned i=0, j, k1, k2;

    av_list L = header_list;

    out_ofm_4(check_sum); i++;
    out_ofm_4(design_size); i++;
    k1 = strlen(coding_scheme);
    out_ofm(k1);
    for (j=0; j<k1; j++) out_ofm(coding_scheme[j]);
    for (j=k1; j<LEN_CODING_SCHEME; j++) out_ofm(0); 
    k2 = strlen(family);
    out_ofm(k2);
    for (j=0; j<k2; j++) out_ofm(family[j]);
    for (j=k2; j<LEN_FAMILY; j++) out_ofm(0); 
    if ((ofm_level==OFM_TFM) && (seven_bit_specified==TRUE))
      out_ofm(seven_bit);
    else
      out_ofm(0);
    out_ofm(0); out_ofm(0); out_ofm(face);
    i = 1 + LOC_SEVEN_FLAG / 4;
    lh = header_max + 1;
    while(L != NULL) {
       j=lattr(L);
       while (i<j) {
           out_ofm_4(0);
           i++;
       }
       out_ofm_4(lval(L));
       L = L->ptr; i++;
    }
    while (i<lh) {out_ofm_4(0); i++;}
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 195 of file header_routines.c.

Here is the call graph for this function:

Definition at line 236 of file header_routines.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 354 of file header_routines.c.

{
    register unsigned i=0, j=LOC_CODING_SCHEME, len=header[LOC_CODING_SCHEME];

    coding_scheme = (string) xmalloc(len+1);
    for (j++; i<len; i++,j++) {
       coding_scheme[i] = header[j];
       if ((text_format == TEXT_CODE_UPPER) &&
           (coding_scheme[i] >= 'a') &&
           (coding_scheme[i] <= 'z')) {
          coding_scheme[i] += 'A' - 'a';
       }
    }
    coding_scheme[i] = '\0';
    if (!strncmp(coding_scheme, "TEX MATH SY", 11) ||
        !strncmp(coding_scheme, "TeX math sy", 11))
        font_type = FT_MATHSY;
    else if (!strncmp(coding_scheme, "TEX MATH EX", 11) ||
        !strncmp(coding_scheme, "TeX math ex", 11))
        font_type = FT_MATHEX;
    else font_type = FT_VANILLA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 282 of file header_routines.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 456 of file header_routines.c.

{
    unsigned char face_byte;
    retrieve_header_byte(LOC_FACE, &face_byte);
    face = face_byte;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 411 of file header_routines.c.

{
    register unsigned i=0, j=LOC_FAMILY, len=header[LOC_FAMILY];

    family = (string) xmalloc(len+1);
    for (j++; i<len; i++,j++) {
       family[i] = header[j];
       if ((text_format == TEXT_CODE_UPPER) &&
           (family[i] >= 'a') &&
           (family[i] <= 'z')) {
          family[i] += 'A' - 'a';
       }
    }
    family[i] = '\0';
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 606 of file header_routines.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void retrieve_header_byte ( unsigned  loc,
unsigned char *  where 
)

Definition at line 108 of file header_routines.c.

{
    *where = header[loc];
}

Here is the caller graph for this function:

void retrieve_header_int ( unsigned  loc,
unsigned *  where 
)

Definition at line 96 of file header_routines.c.

{
    string ptr = header+loc;

    *where = ((* ptr    & 0xff) << 24) |
             ((*(ptr+1) & 0xff) << 16) |
             ((*(ptr+2) & 0xff) <<  8) |
              (*(ptr+3) & 0xff) ;

}

Here is the caller graph for this function:

Definition at line 180 of file header_routines.c.

{
    unsigned j = HEADER_MIN, value, header_no=lh;

    header_list = NULL; 
    while (j <= header_no) {
       retrieve_header_int(j*4, &value);
       if (value != 0) {
           set_header_word(j, value);
       }
        j++;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 538 of file header_routines.c.

{
    unsigned char seven_bit_byte;
    retrieve_header_byte(LOC_SEVEN_FLAG, &seven_bit_byte);
    seven_bit = (seven_bit_byte != 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void set_check_sum ( unsigned  cs)

Definition at line 221 of file header_routines.c.

Definition at line 322 of file header_routines.c.

{
    if (coding_scheme_specified==TRUE) {
       warning_0("CODINGSCHEME previously defined; old value ignored");
        free(coding_scheme); coding_scheme=NULL;
    }
    coding_scheme = sval;
    
    if (!strncmp(coding_scheme, "TEX MATH SY", 11) ||
        !strncmp(coding_scheme, "TeX math sy", 11))
        font_type = FT_MATHSY;
    else if (!strncmp(coding_scheme, "TEX MATH EX", 11) ||
        !strncmp(coding_scheme, "TeX math ex", 11))
        font_type = FT_MATHEX;
    else font_type = FT_VANILLA;

    coding_scheme_specified = TRUE;
}

Here is the call graph for this function:

Definition at line 262 of file header_routines.c.

{
    if (design_size_specified==TRUE)
       warning_0("DESIGNSIZE previously defined; old value ignored");
    if (ds<1) {
        warning_0("DESIGNSIZE value must be at least 1; set to 10");
        design_size = 10*UNITY;
    } else {
        design_size = ds;
    }
    design_size_specified = TRUE;
}

Here is the call graph for this function:

Definition at line 298 of file header_routines.c.

{
    if (design_units_specified==TRUE)
       warning_0("DESIGNUNITS previously defined; old value ignored");
    if (du<=0) {
        warning_0("DESIGNUNITS value must be positive; set to 1");
        design_units = UNITY;
    } else {
        design_units = du;
    }
    design_units_specified = TRUE;
}

Here is the call graph for this function:

void set_face ( unsigned  f)

Definition at line 437 of file header_routines.c.

{
    if (face_specified==TRUE)
       warning_0("FACE previously defined; old value ignored");
    if (face>255) {
        warning_0("FACE value must be less than 256");
    } else {
        face = f;
    }
    face_specified = TRUE;
}

Here is the call graph for this function:

void set_family ( string  sval)

Definition at line 387 of file header_routines.c.

{
    if (family_specified==TRUE) {
       warning_0("FAMILY previously defined; old value ignored");
        free(family); family=NULL;
    }
    family = sval;
    family_specified = TRUE;
}

Here is the call graph for this function:

void set_font_dir ( unsigned  direction)

Definition at line 496 of file header_routines.c.

{
    if (font_dir_specified==TRUE)
        warning_0("FONTDIR previously defined; old value ignored");
    if ((direction < DIR_MIN) || (direction > DIR_MAX)) {
        warning_0("bad FONTDIR value; ignored");
    } else {
        font_dir = direction;
    }
    font_dir_specified = TRUE;
}

Here is the call graph for this function:

void set_header_word ( unsigned  index,
unsigned  val 
)

Definition at line 124 of file header_routines.c.

{
    av_list L1, L2;

    if (index > HEADER_MAX) {
       warning_0("HEADER index must be at most 255; ignored");
        return;
    }
    if (index < HEADER_MIN) {
       warning_0("HEADER index must be at least 18; ignored");
        return;
    }
    L1 = header_list;
    if (L1 == NULL) {
       header_list = av_list1(index, val);
       header_max = index;
    } else {
       L2 = L1->ptr;
       while ((L2 != NULL) && (lattr(L2) <= index)) {
           L1 = L2;
           L2 = L2->ptr;
       }
       if (index < lattr(L1)) {
           header_list = av_list1(index, val);
           header_list->ptr = L1;
        } else if (index == lattr(L1)) {
           warning_1("HEADER index (%d) previously defined; "
                      "old value ignored", index);
           lval(L1)  = val;
       } else {
           L2 = av_list1(index, val);
           L2->ptr = L1->ptr;
           if (L1->ptr==NULL) header_max = index;
           L1->ptr = L2;
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void set_ofm_level ( unsigned  level)

Definition at line 473 of file header_routines.c.

{
    if (ofm_level_specified==TRUE)
        warning_0("OFMLEVEL previously defined; old value ignored");
    /* Fix from Joel Riou <joel.riou@normalesup.org> */
    if ((level != 0) && (level != 1)) {
        warning_0("OFMLEVEL value must be D 0 or D 1");
    } else {
        ofm_level = level ? OFM_LEVEL1 : OFM_LEVEL0;
    }
    ofm_level_specified = TRUE;
}

Here is the call graph for this function:

void set_seven_bit_safe_flag ( unsigned  f)

Definition at line 519 of file header_routines.c.

{
    if (seven_bit_specified==TRUE)
        warning_0("SEVENBITSAFEFLAG previously defined; "
                  "old value ignored");
    if ((f!=FALSE) && (f!=TRUE)) {
        internal_error_1("set_seven_bit_safe_flag (f=%d)", f);
    }
    seven_bit = f;
    seven_bit_specified = TRUE;
}

Here is the call graph for this function:

Definition at line 228 of file header_routines.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 342 of file header_routines.c.

{
    register unsigned i=0, j=LOC_CODING_SCHEME, len=strlen(coding_scheme);

    header[j] = len;
    for (j++; i<len; i++,j++) header[j] = coding_scheme[i];
    for (; j<(LOC_CODING_SCHEME+LEN_CODING_SCHEME); j++)
        header[j] = '\0';;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 276 of file header_routines.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 450 of file header_routines.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 398 of file header_routines.c.

{
    register unsigned i=0, j=LOC_FAMILY, len=strlen(family);

    if (len>LEN_FAMILY) internal_error_1("store_family (len=%d)", len);
    header[j] = len;
    for (j++; i<len; i++,j++) header[j] = family[i];
    for (; j<=(LOC_FAMILY+LEN_FAMILY); j++)
        header[j] = '\0';;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 570 of file header_routines.c.

{

    store_header_word();
    store_check_sum();
    store_design_size();
    store_coding_scheme();
    store_family();
    store_face();
    store_seven_bit_safe_flag();

/*
    { int i;
    for (i=0; i<(4*(header_max+1)); i++) {
        if (!(i%4)) fprintf(stdout, "\n");
       fprintf(stdout, "%d: %c (%d, %2x) ",
                i, header[i], header[i], header[i]);
    }
    fprintf(stdout, "\n");
*/
    if (header_list!=NULL) {
        av_list L1 = header_list, L2;
        while (L1 != NULL) {
            L2 = L1->ptr;
            free(L1);
            L1 = L2;
        }
    }
    lh = header_max;
    header_list = NULL;
    header_max = HEADER_MIN-1;

    retrieve_header();
}

Here is the call graph for this function:

void store_header_byte ( unsigned  loc,
unsigned  val 
)

Definition at line 90 of file header_routines.c.

{
    header[loc] = 0xff & val ;
}

Here is the caller graph for this function:

void store_header_int ( unsigned  loc,
unsigned  val 
)

Definition at line 81 of file header_routines.c.

{
    header[loc]   = 0xff & (val >> 24) ;
    header[loc+1] = 0xff & (val >> 16) ;
    header[loc+2] = 0xff & (val >>  8) ;
    header[loc+3] = 0xff & val ;
}

Here is the caller graph for this function:

Definition at line 163 of file header_routines.c.

{
    av_list L = header_list;
    unsigned ctr = HEADER_MIN;

    header = (string) xmalloc(4*(header_max+1));
    while (L != NULL) {
       while (ctr<lattr(L)) {
           store_header_int(ctr*4,0);
           ctr++;
       }
       store_header_int(ctr*4,lval(L));
       ctr++; L = L->ptr;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 532 of file header_routines.c.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

unsigned check_sum

Definition at line 48 of file header_routines.c.

Definition at line 49 of file header_routines.c.

Definition at line 57 of file header_routines.c.

Definition at line 58 of file header_routines.c.

Definition at line 51 of file header_routines.c.

Definition at line 52 of file header_routines.c.

Definition at line 54 of file header_routines.c.

Definition at line 55 of file header_routines.c.

unsigned face

Definition at line 63 of file header_routines.c.

Definition at line 64 of file header_routines.c.

Definition at line 60 of file header_routines.c.

Definition at line 61 of file header_routines.c.

unsigned font_dir

Definition at line 69 of file header_routines.c.

Definition at line 70 of file header_routines.c.

unsigned font_type = FT_VANILLA

Definition at line 76 of file header_routines.c.

Definition at line 44 of file header_routines.c.

Definition at line 45 of file header_routines.c.

unsigned header_max = HEADER_MIN-1

Definition at line 46 of file header_routines.c.

unsigned lh

Definition at line 78 of file header_routines.c.

unsigned ofm_level

Definition at line 66 of file header_routines.c.

Definition at line 67 of file header_routines.c.

Definition at line 72 of file header_routines.c.

Definition at line 74 of file header_routines.c.

Definition at line 73 of file header_routines.c.