src/VFsys.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- memclr
- memcmp
- memcpy
- memclr
- memclr
- ALLOC_IF_ERR
- ALLOCN_IF_ERR
- xfree
- toint
1 /*
2 * VFsys.h - misc definitions for internals of VFlib
3 *
4 */
5 /*
6 * Copyright (C) 1996-1999 Hirotsugu Kakugawa.
7 * All rights reserved.
8 *
9 * This file is part of the VFlib Library. This library is free
10 * software; you can redistribute it and/or modify it under the terms of
11 * the GNU Library General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your
13 * option) any later version. This library is distributed in the hope
14 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
15 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22 #ifndef __VFLIB_VFSYS_H__
23 #define __VFLIB_VFSYS_H__
24
25 #include "consts.h"
26
27
28 #if !defined(TRUE) && !defined(FALSE)
29 #define TRUE (0==0)
30 #define FALSE (0==1)
31 #endif
32
33 #define Public /*public*/
34 #define Glocal /*public within VFlib */
35 #define Private static
36 #define Import extern
37
38
39 #if STDC_HEADERS
40 # define memclr(a,n) memset((a),0,(n))
41 #else
42 # ifndef HAVE_MEMCMP
43 # define memcmp(a1,a2,n) bcmp((a1),(a2),(n))
44 # define memcpy(dst,src,n) bcopy((src),(dst),(n))
45 # define memclr(a,n) bzero((a),(n))
46 # else
47 # define memclr(a,n) memset((a),0,(n))
48 # endif /*HAVE_MEMCMP*/
49 #endif
50
51 #if HAVE_STRING_H
52 # include <string.h>
53 #endif
54 #if HAVE_STRINGS_H
55 # include <strings.h>
56 #endif
57
58 #ifndef SEEK_SET
59 # define SEEK_SET 0
60 # define SEEK_CUR 1
61 # define SEEK_END 2
62 #endif
63
64 #ifndef FOPEN_MODE_BIN
65 # if defined(VMS) || defined(VMCMS) || defined(DOS) || defined(OS2) \
66 || defined(WIN32) || defined(__DJGPP__) || defined(__CYGWIN32__)
67 # define FOPEN_RD_MODE_BIN "rb"
68 # define FOPEN_RD_MODE_TEXT "rt"
69 # define FOPEN_WD_MODE_BIN "wb"
70 # define FOPEN_WD_MODE_TEXT "wt"
71 # else
72 # define FOPEN_RD_MODE_BIN "r"
73 # define FOPEN_RD_MODE_TEXT "r"
74 # define FOPEN_WR_MODE_BIN "w"
75 # define FOPEN_WR_MODE_TEXT "w"
76 # endif
77 #endif
78
79 #define ALLOC_IF_ERR(v,t) \
80 if ((v = (t*)calloc(1, sizeof(t))) == NULL)
81 #define ALLOCN_IF_ERR(v,t,n) \
82 if ((v = (t*)calloc(n, sizeof(t))) == NULL)
83 #define xfree(p) if ((p) != NULL){ free(p); }
84 #define toint(x) (int)(((x)>0)?(x+0.5):(x-0.5))
85
86 #define DRIVER_FUNC_TYPE int(*)(VF_FONT,char*,char*,int,void*)
87
88 extern double atof();
89
90 extern int vf_openfont1(char *font_name, char *requested_font_class,
91 double dpi_x, double dpi_y, double point_size,
92 double mag_x, double mag_y);
93 extern int vf_openfont2(char *font_name, char *requested_font_class,
94 int pixel_size, double mag_x, double mag_y);
95
96
97 extern int vf_dbg_font_open;
98 extern int vf_dbg_font_search;
99 extern int vf_dbg_kpathsea;
100 extern int vf_dbg_vfcap;
101 extern int vf_dbg_parameters;
102 extern int vf_dbg_ccv;
103 extern int vf_dbg_ccv_map;
104
105 typedef void*(*FM_OPEN_METHOD)(char*,long,long,void*,void*);
106 typedef void (*FM_CLOSE_METHOD)(void*,long,long,void*,void*);
107 extern int vf_fm_init(void);
108 extern FILE* vf_fm_OpenBinaryFileStream(char*);
109 extern FILE* vf_fm_OpenTextFileStream(char*);
110 extern void* vf_fm_OpenFileStreamApp(char *arg, long iarg1, long iarg2,
111 void *arg1, void *arg2,
112 FM_OPEN_METHOD open_method,
113 FM_CLOSE_METHOD close_method,
114 char* dbgmsg);
115 extern void vf_fm_CloseFileStreamApp(char *arg, long iarg1, long iarg2,
116 void *arg1, void *arg2,
117 FM_OPEN_METHOD open_method,
118 FM_CLOSE_METHOD close_method,
119 char* dbgmsg);
120
121
122 #ifndef VAR_VAL_DELIMIT_CHAR
123 # define VAR_VAL_DELIMIT_CHAR '='
124 #endif
125
126
127 /* raster.c, bm2ol.c */
128 #define BM2OL_DOT_SHAPE_SQUARE 0
129 #define BM2OL_DOT_SHAPE_DIAMOND 1
130 #define BM2OL_DEFAULT_DOT_SIZE 0.8
131 extern int vf_draw_outline(VF_BITMAP,VF_OUTLINE);
132 extern VF_BITMAP vf_outline_to_bitmap(VF_OUTLINE,double,double,
133 double,double,double);
134 extern VF_OUTLINE vf_bitmap_to_outline(VF_BITMAP,int,int,
135 double,double,double,double,double);
136 extern VF_OUTLINE vf_bitmap_to_outline2(VF_BITMAP,int,double,int,int,
137 double,double,double,double,double);
138
139 /* defaults.c */
140 #include "sexp.h"
141 extern SEXP_ALIST vf_extension_hints;
142 extern SEXP_LIST vf_implicit_font_classes;
143 extern char *vf_directory_delimiter;
144 extern int vf_defaults_init(void);
145
146 #include "mem.h"
147
148 #endif /*__VFLIB_VFSYS_H__*/
149
150 /*EOF*/