1 /*
2     Copyright (c) 2005-2021 Intel Corporation
3 
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7 
8         http://www.apache.org/licenses/LICENSE-2.0
9 
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15 */
16 
17 /*
18     The original source for this example is
19     Copyright (c) 1994-2008 John E. Stone
20     All rights reserved.
21 
22     Redistribution and use in source and binary forms, with or without
23     modification, are permitted provided that the following conditions
24     are met:
25     1. Redistributions of source code must retain the above copyright
26        notice, this list of conditions and the following disclaimer.
27     2. Redistributions in binary form must reproduce the above copyright
28        notice, this list of conditions and the following disclaimer in the
29        documentation and/or other materials provided with the distribution.
30     3. The name of the author may not be used to endorse or promote products
31        derived from this software without specific prior written permission.
32 
33     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
34     OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36     ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
37     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42     OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43     SUCH DAMAGE.
44 */
45 
46 /*
47  * parse.h - this file contains defines for model file reading.
48  *
49  *  $Id: parse.h,v 1.2 2007-02-22 17:54:16 Exp $
50  */
51 
52 #define PARSENOERR      0
53 #define PARSEBADFILE    1
54 #define PARSEBADSUBFILE 2
55 #define PARSEBADSYNTAX  4
56 #define PARSEEOF        8
57 #define PARSEALLOCERR   16
58 
59 unsigned int readmodel(char *, SceneHandle);
60 
61 #ifdef PARSE_INTERNAL
62 #define NUMTEXS    32768
63 #define TEXNAMELEN 24
64 
65 typedef struct {
66     double rx1;
67     double rx2;
68     double rx3;
69     double ry1;
70     double ry2;
71     double ry3;
72     double rz1;
73     double rz2;
74     double rz3;
75 } RotMat;
76 
77 typedef struct {
78     char name[TEXNAMELEN];
79     void *tex;
80 } texentry;
81 
82 #ifdef _ERRCODE_DEFINED
83 #define errcode errcode_t
84 #endif //_ERRCODE_DEFINED
85 typedef unsigned int errcode;
86 
87 static errcode add_texture(void *tex, char name[TEXNAMELEN]);
88 static errcode GetString(FILE *, const char *);
89 static errcode GetScenedefs(FILE *, SceneHandle);
90 static errcode GetColor(FILE *, color *);
91 static errcode GetVector(FILE *, vector *);
92 static errcode GetTexDef(FILE *);
93 static errcode GetTexAlias(FILE *);
94 static errcode GetTexture(FILE *, void **);
95 void *GetTexBody(FILE *);
96 static errcode GetBackGnd(FILE *);
97 static errcode GetCylinder(FILE *);
98 static errcode GetFCylinder(FILE *);
99 static errcode GetPolyCylinder(FILE *);
100 static errcode GetSphere(FILE *);
101 static errcode GetPlane(FILE *);
102 static errcode GetRing(FILE *);
103 static errcode GetBox(FILE *);
104 static errcode GetVol(FILE *);
105 static errcode GetTri(FILE *);
106 static errcode GetSTri(FILE *);
107 static errcode GetLight(FILE *);
108 static errcode GetLandScape(FILE *);
109 static errcode GetTPolyFile(FILE *);
110 static errcode GetMGFFile(FILE *, SceneHandle);
111 static errcode GetObject(FILE *, SceneHandle);
112 
113 #endif
114