nethercote | 5912c81 | 2004-02-15 15:38:08 +0000 | [diff] [blame] | 1 | /* This file is part of hp2ps, a graph drawer for memory profiles. |
| 2 | Copyright (C) 2002 The University Court of the University of Glasgow. |
| 3 | This program is governed by the license contained in the file LICENSE. */ |
| 4 | |
nethercote | c9f3692 | 2004-02-14 16:40:02 +0000 | [diff] [blame] | 5 | #ifndef HP_FILE_H |
| 6 | #define HP_FILE_H |
| 7 | |
| 8 | typedef enum { |
| 9 | /* These tokens are found in ".hp" files */ |
| 10 | |
| 11 | EOF_TOK, |
| 12 | INTEGER_TOK, |
| 13 | FLOAT_TOK, |
| 14 | IDENTIFIER_TOK, |
| 15 | STRING_TOK, |
| 16 | BEGIN_SAMPLE_TOK, |
| 17 | END_SAMPLE_TOK, |
| 18 | JOB_TOK, |
| 19 | DATE_TOK, |
| 20 | SAMPLE_UNIT_TOK, |
| 21 | VALUE_UNIT_TOK, |
| 22 | MARK_TOK, |
| 23 | |
| 24 | /* These extra ones are found only in ".aux" files */ |
| 25 | |
| 26 | X_RANGE_TOK, |
| 27 | Y_RANGE_TOK, |
| 28 | ORDER_TOK, |
| 29 | SHADE_TOK |
| 30 | } token; |
| 31 | |
| 32 | struct datapoint { |
| 33 | int bucket; |
| 34 | floatish value; |
| 35 | }; |
| 36 | |
| 37 | struct chunk { |
| 38 | struct chunk *next; |
| 39 | short nd; /* 0 .. N_CHUNK - 1 */ |
| 40 | struct datapoint *d; |
| 41 | }; |
| 42 | |
| 43 | |
| 44 | struct entry { |
| 45 | struct entry *next; |
| 46 | struct chunk *chk; |
| 47 | char *name; |
| 48 | }; |
| 49 | |
| 50 | extern char *theident; |
| 51 | extern char *thestring; |
| 52 | extern int theinteger; |
| 53 | extern floatish thefloatish; |
| 54 | extern int g_ch; |
| 55 | extern token thetok; |
| 56 | extern int linenum; |
| 57 | extern int endfile; |
| 58 | |
| 59 | char *TokenToString PROTO((token)); |
| 60 | |
| 61 | extern struct entry** identtable; |
| 62 | |
| 63 | extern floatish *samplemap; |
| 64 | extern floatish *markmap; |
| 65 | |
| 66 | void GetHpFile PROTO((FILE *)); |
| 67 | void StoreSample PROTO((struct entry *, intish, floatish)); |
| 68 | struct entry *MakeEntry PROTO((char *)); |
| 69 | |
| 70 | token GetNumber PROTO((FILE *)); |
| 71 | void GetIdent PROTO((FILE *)); |
| 72 | void GetString PROTO((FILE *)); |
| 73 | boolish IsIdChar PROTO((int)); /* int is a "char" from getc */ |
| 74 | |
| 75 | extern char *jobstring; |
| 76 | extern char *datestring; |
| 77 | |
| 78 | extern char *sampleunitstring; |
| 79 | extern char *valueunitstring; |
| 80 | |
| 81 | #endif /* HP_FILE_H */ |