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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
// Copyright (C) 1999-2018
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"
#ifndef __util_h__
#define __util_h__
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <math.h>
#include <iostream>
#include <sstream>
#include <iomanip>
using namespace std;
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "fuzzy.h"
#include "vector.h"
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#ifdef _WIN32
#include <win32lib.h>
#endif
#ifdef MAC_OSX_TK
#include <macosxlib.h>
void XXWarpPointer(Display* display, Window src_w, Window dest_w,
int src_x, int src_y,
unsigned int src_width, unsigned int src_height,
int dest_x, int dest_y);
#endif
#if defined (MAC_OSX_TK) || (_WIN32)
int XSetClipRectangles(Display *d, GC gc, int clip_x_origin, int clip_y_origin,
XRectangle* rectangles, int n, int ordering);
#endif
#define STRCMP(which,str,cnt) (!strncmp(toConstLower(which), str, cnt) && strlen(which)==cnt)
enum PSColorSpace {BW, GRAY, RGB, CMYK};
static const char psFonts[12][32] = {
{"Helvetica"},
{"Helvetica-Oblique"},
{"Helvetica-Bold"},
{"Helvetica-BoldOblique"},
{"Times-Roman"},
{"Times-Italic"},
{"Times-Bold"},
{"Times-BoldItalic"},
{"Courier"},
{"Courier-Oblique"},
{"Courier-Bold"},
{"Courier-BoldOblique"}
};
#ifndef __CYGWIN__
static const double M_TWOPI = 2*M_PI;
#endif
static const double M_THREEPI = 3*M_PI;
static const double M_FOURPI = 4*M_PI;
extern int maperr;
extern int lsb();
extern void swap2(char* src, char* dest);
extern void swap4(char* src, char* dest);
extern void swap8(char* src, char* dest);
extern void internalError(const char*);
extern char* dupstr(const char*);
extern char* trim(const char*);
extern char* toLower(const char*);
extern char* toUpper(const char*);
extern char* toConstLower(const char*);
extern char* toConstUpper(const char*);
extern double zeroTWOPI(double);
extern double m180To180(double);
extern double degToRad(double);
extern double radToDeg(double);
extern int parseSection(char*, Vector*, Vector*);
extern double dmsToDegree(int, int, int, double);
extern double parseSEXStr(const char*);
extern double parseHMSStr(const char*);
extern double parseDMSStr(const char*);
extern double RGB2Gray(double, double, double);
extern unsigned char RGB2Gray(unsigned char, unsigned char, unsigned char);
extern void RGB2CMYK(unsigned char, unsigned char, unsigned char,
unsigned char*, unsigned char*, unsigned char*,
unsigned char*);
extern void RGB2CMYK(unsigned short, unsigned short, unsigned short,
unsigned short*, unsigned short*, unsigned short*,
unsigned short*);
extern ostream& psColorGray(XColor*, ostream&);
extern ostream& psColorRGB(XColor*, ostream&);
extern ostream& psColorCMYK(XColor*, ostream&);
extern char* psQuote(const char*);
extern const char* psFontName(const char*);
extern int psFontSize(const char*);
extern const char* psFontName(const char*, const char*, const char*);
extern int fCompare(const void*, const void*);
extern int dCompare(const void*, const void*);
#endif
|