|
|
1.1 root 1: /* $Header: pathlist.h,v 10.1 86/11/19 10:46:00 jg Exp $ */
2: /* pathlist.h - Constants, macros, typedefs and globals
3: * used by PathListConverter()
4: *
5: * Author:
6: * Scott Bates
7: * Brown University
8: * IRIS, Box 1946
9: * Providence, RI 02912
10: *
11: *
12: * Copyright (c) 1986 Brown University
13: *
14: * Permission to use, copy, modify and distribute this software and its
15: * documentation for any purpose and without fee is hereby granted, provided
16: * that the above copyright notice appear in all copies, and that both
17: * that copyright notice and this permission notice appear in supporting
18: * documentation, and that the name of Brown University not be used in
19: * advertising or publicity pertaining to distribution of the software
20: * without specific, written prior permission. Brown University makes no
21: * representations about the suitability of this software for any purpose.
22: * It is provided "as-is" without express or implied warranty.
23: */
24:
25: /*
26: * Path list Segment structure
27: */
28:
29: typedef struct _Segment {
30: int Index;
31: int Type;
32: int Count;
33: } Segment;
34:
35: /*
36: * Segment types
37: */
38:
39: #define LINE_SEGMENT 0
40: #define OPEN_CURVE_SEGMENT 1
41: #define CLOSED_CURVE_SEGMENT 2
42:
43: /*
44: * Default values for segemnt allocation
45: */
46:
47: #define INITIAL_SEGMENTS 1024
48: #define ADDITIONAL_SEGMENTS 512
49:
50: /*
51: * This macro starts a new segment and when required
52: * expands the size of the segment table
53: */
54:
55: #define StartNewSegment(type, index, count) { \
56: if(++SegmentIndex == MaxSegments) { \
57: Segment *TempSeg; \
58: \
59: MaxSegments += 1 + ADDITIONAL_SEGMENTS; \
60: TempSeg = (Segment *)realloc((caddr_t)SegmentTable, \
61: (unsigned)(MaxSegments * sizeof(Segment))); \
62: if(TempSeg == NULL) { \
63: return(NULL); \
64: } \
65: CurrentSegment = &((SegmentTable = TempSeg)[SegmentIndex]); \
66: } else { \
67: CurrentSegment++; \
68: } \
69: CurrentSegment->Index = (index); \
70: CurrentSegment->Type = (type); \
71: CurrentSegment->Count = (count); \
72: }
73:
74: /*
75: * Defaults for spline vertex buffer allocation
76: */
77:
78: #define INITIAL_SPLINE_VERTS 4096
79: #define ADDITIONAL_SPLINE_VERTS 1024
80:
81: /*
82: * This macro increases the size of the spline vertex buffer
83: * if it is to small to handle "VertexCount" entries.
84: */
85:
86: #define GrowSplineVertexBuffer(CurrentVertex, VertexCount) { \
87: if((SplineVertexIndex + (VertexCount)) > MaxSplineVerts) { \
88: Vertex *TempVerts; \
89: \
90: MaxSplineVerts += ((VertexCount) - (MaxSplineVerts - \
91: SplineVertexIndex)) + ADDITIONAL_SPLINE_VERTS; \
92: \
93: TempVerts = (Vertex *)realloc((caddr_t)SplineVertexBuffer, \
94: (unsigned)(MaxSplineVerts * sizeof(Vertex))); \
95: if(TempVerts == NULL) { \
96: return(NULL); \
97: } \
98: (CurrentVertex) = \
99: &((SplineVertexBuffer = TempVerts)[SplineVertexIndex]); \
100: } \
101: }
102:
103: /*
104: * Vertex type flags
105: */
106:
107: #define VERTEX_TYPE_MASK 0x001C
108: #define LINE 0x0000
109: #define CURVE 0x0004
110: #define START_CLOSED_CURVE 0x000C
111: #define END_CLOSED_CURVE 0x0014
112: #define START_OF_CLOSED_POLY 0x8000
113:
114: /*
115: * glocal variables
116: */
117:
118: static Vertex *SplineVertexBuffer;
119: static int SplineVertexIndex;
120: static int MaxSplineVerts;
121: static int SplineUsed;
122: static Segment *SegmentTable;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.