summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/pst.h
blob: d7379409e9e8de1fe7e5ee58c1af2d3e3d926865 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.

    Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata,
    the dvipdfmx project team.

    Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

#ifndef _PST_H_
#define _PST_H_

#include <stdio.h>

#define PST_TYPE_UNKNOWN   -1
#define PST_TYPE_NULL       0
#define PST_TYPE_BOOLEAN    1
#define PST_TYPE_INTEGER    2
#define PST_TYPE_REAL       3
#define PST_TYPE_STRING     5
#define PST_TYPE_NAME       6
#define PST_TYPE_MARK       7

typedef struct pst_obj pst_obj;
typedef int            pst_type;

extern pst_obj *pst_get_token (unsigned char **inbuf, unsigned char *inbufend);

extern pst_obj *pst_new_obj    (pst_type type, void *data);
extern void     pst_release_obj(pst_obj *obj);
extern pst_obj *pst_new_mark   (void);

extern pst_type pst_type_of   (pst_obj *obj);
extern int      pst_length_of (pst_obj *obj);

extern int      pst_getIV (pst_obj *obj);
extern double   pst_getRV (pst_obj *obj);
extern unsigned char  *pst_getSV (pst_obj *obj);

extern void    *pst_data_ptr (pst_obj *obj);

#define PST_NAME_LEN_MAX   127
#define PST_STRING_LEN_MAX 4096
#define PST_MAX_DIGITS     10
#define PST_TOKEN_LEN_MAX  PST_STRING_LEN_MAX

#define PST_NULLTYPE(o)    (pst_type_of((o)) == PST_TYPE_NULL)
#define PST_BOOLEANTYPE(o) (pst_type_of((o)) == PST_TYPE_BOOLEAN)
#define PST_NAMETYPE(o)    (pst_type_of((o)) == PST_TYPE_NAME)
#define PST_STRINGTYPE(o)  (pst_type_of((o)) == PST_TYPE_STRING)
#define PST_INTEGERTYPE(o) (pst_type_of((o)) == PST_TYPE_INTEGER)
#define PST_REALTYPE(o)    (pst_type_of((o)) == PST_TYPE_REAL)
#define PST_NUMBERTYPE(o)  (PST_INTEGERTYPE((o))||PST_REALTYPE((o)))
#define PST_MARKTYPE(o)    (pst_type_of((o)) == PST_TYPE_MARK)
#define PST_UNKNOWNTYPE(o) (pst_type_of((o)) < 0)

#define PST_TOKEN_END(s,e) ((s) == (e) || is_delim(*(s)) || is_space(*(s)))

#endif /* _PST_H_ */