summaryrefslogtreecommitdiff
path: root/support/lametex/src/Length.h
blob: 3dc6f2528e30c9bcbbb1d4d3093d50c9946ed5d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* Length.h
 *
 * The official LaTeX length parameters are implemented here. They control
 * variables such as the paragraph indentation and the space to skip between
 * lines.
 *
 * Copyright 1992 Jonathan Monsarrat. Permission given to freely distribute,
 * edit and use as long as this copyright statement remains intact.
 *
 */

const MAXLENGTHPARAMS = 100;
class Length;
// The class for the official LaTeX Length variables,
// plus any user-defined ones.
class LengthParam {
   float _value;
   char *_tokentext;
   Length *_parent;
 public:
   LengthParam(LengthParam *, Length *);
   LengthParam(float, char *, Length *);
   ~LengthParam();
   void set(float);
   float get();
   static int compare(const void *, const void *);
   void revert(Length *);
   void postscript_set();
   int match(char *);
};

// The official LaTeX Length variables are stored here
class Length : public Param {
 public:
   enum LengthTypes {
      Parameter,
      Parse_Length
   };
   Length();
   Length(Length *);
   ~Length();
   Param *copy();
   void revert(Param *);
   void addtolength(int, int, float, char *);
   void newlength(int, int, float, char *);
   void setlength(int, int, float, char *);
   float length_argument();
   LengthParam **fetch(char *);
 private:
   LengthParam *values[MAXLENGTHPARAMS];
   int set(int, float, char*);
   float get(int, char*);
   void postscript_set(int);
   void makeparam(float, char *);
   void set_lp(LengthParam *, float);
   int numvalues;
};