1*c54f35caSApple OSS Distributions /*
2*c54f35caSApple OSS Distributions * Copyright (c) 1999-2019 Apple Inc. All rights reserved.
3*c54f35caSApple OSS Distributions *
4*c54f35caSApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*c54f35caSApple OSS Distributions *
6*c54f35caSApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code
7*c54f35caSApple OSS Distributions * as defined in and that are subject to the Apple Public Source License
8*c54f35caSApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in
9*c54f35caSApple OSS Distributions * compliance with the License. The rights granted to you under the License
10*c54f35caSApple OSS Distributions * may not be used to create, or enable the creation or redistribution of,
11*c54f35caSApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to
12*c54f35caSApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any
13*c54f35caSApple OSS Distributions * terms of an Apple operating system software license agreement.
14*c54f35caSApple OSS Distributions *
15*c54f35caSApple OSS Distributions * Please obtain a copy of the License at
16*c54f35caSApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*c54f35caSApple OSS Distributions *
18*c54f35caSApple OSS Distributions * The Original Code and all software distributed under the License are
19*c54f35caSApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*c54f35caSApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*c54f35caSApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*c54f35caSApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*c54f35caSApple OSS Distributions * Please see the License for the specific language governing rights and
24*c54f35caSApple OSS Distributions * limitations under the License.
25*c54f35caSApple OSS Distributions *
26*c54f35caSApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*c54f35caSApple OSS Distributions */
28*c54f35caSApple OSS Distributions
29*c54f35caSApple OSS Distributions /*
30*c54f35caSApple OSS Distributions * HISTORY
31*c54f35caSApple OSS Distributions *
32*c54f35caSApple OSS Distributions * OSUnserializeXML.y created by rsulack on Tue Oct 12 1999
33*c54f35caSApple OSS Distributions */
34*c54f35caSApple OSS Distributions
35*c54f35caSApple OSS Distributions // parser for unserializing OSContainer objects serialized to XML
36*c54f35caSApple OSS Distributions //
37*c54f35caSApple OSS Distributions // to build :
38*c54f35caSApple OSS Distributions // bison -p OSUnserializeXML OSUnserializeXML.y
39*c54f35caSApple OSS Distributions // head -50 OSUnserializeXML.y > ../libkern/c++/OSUnserializeXMLSharedImplementation.h
40*c54f35caSApple OSS Distributions // sed -e "s/#include <stdio.h>//" < OSUnserializeXML.tab.c >> ../libkern/c++/OSUnserializeXMLSharedImplementation.h
41*c54f35caSApple OSS Distributions //
42*c54f35caSApple OSS Distributions // when changing code check in both OSUnserializeXML.y and OSUnserializeXMLSharedImplementation.h
43*c54f35caSApple OSS Distributions //
44*c54f35caSApple OSS Distributions //
45*c54f35caSApple OSS Distributions //
46*c54f35caSApple OSS Distributions //
47*c54f35caSApple OSS Distributions //
48*c54f35caSApple OSS Distributions // DO NOT EDIT OSUnserializeXMLSharedImplementation.h!
49*c54f35caSApple OSS Distributions //
50*c54f35caSApple OSS Distributions // this means you!
51*c54f35caSApple OSS Distributions /* A Bison parser, made by GNU Bison 2.3. */
52*c54f35caSApple OSS Distributions
53*c54f35caSApple OSS Distributions /* Skeleton implementation for Bison's Yacc-like parsers in C
54*c54f35caSApple OSS Distributions *
55*c54f35caSApple OSS Distributions * Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
56*c54f35caSApple OSS Distributions * Free Software Foundation, Inc.
57*c54f35caSApple OSS Distributions *
58*c54f35caSApple OSS Distributions * This program is free software; you can redistribute it and/or modify
59*c54f35caSApple OSS Distributions * it under the terms of the GNU General Public License as published by
60*c54f35caSApple OSS Distributions * the Free Software Foundation; either version 2, or (at your option)
61*c54f35caSApple OSS Distributions * any later version.
62*c54f35caSApple OSS Distributions *
63*c54f35caSApple OSS Distributions * This program is distributed in the hope that it will be useful,
64*c54f35caSApple OSS Distributions * but WITHOUT ANY WARRANTY; without even the implied warranty of
65*c54f35caSApple OSS Distributions * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
66*c54f35caSApple OSS Distributions * GNU General Public License for more details.
67*c54f35caSApple OSS Distributions *
68*c54f35caSApple OSS Distributions * You should have received a copy of the GNU General Public License
69*c54f35caSApple OSS Distributions * along with this program; if not, write to the Free Software
70*c54f35caSApple OSS Distributions * Foundation, Inc., 51 Franklin Street, Fifth Floor,
71*c54f35caSApple OSS Distributions * Boston, MA 02110-1301, USA. */
72*c54f35caSApple OSS Distributions
73*c54f35caSApple OSS Distributions /* As a special exception, you may create a larger work that contains
74*c54f35caSApple OSS Distributions * part or all of the Bison parser skeleton and distribute that work
75*c54f35caSApple OSS Distributions * under terms of your choice, so long as that work isn't itself a
76*c54f35caSApple OSS Distributions * parser generator using the skeleton or a modified version thereof
77*c54f35caSApple OSS Distributions * as a parser skeleton. Alternatively, if you modify or redistribute
78*c54f35caSApple OSS Distributions * the parser skeleton itself, you may (at your option) remove this
79*c54f35caSApple OSS Distributions * special exception, which will cause the skeleton and the resulting
80*c54f35caSApple OSS Distributions * Bison output files to be licensed under the GNU General Public
81*c54f35caSApple OSS Distributions * License without this special exception.
82*c54f35caSApple OSS Distributions *
83*c54f35caSApple OSS Distributions * This special exception was added by the Free Software Foundation in
84*c54f35caSApple OSS Distributions * version 2.2 of Bison. */
85*c54f35caSApple OSS Distributions
86*c54f35caSApple OSS Distributions /* C LALR(1) parser skeleton written by Richard Stallman, by
87*c54f35caSApple OSS Distributions * simplifying the original so-called "semantic" parser. */
88*c54f35caSApple OSS Distributions
89*c54f35caSApple OSS Distributions /* All symbols defined below should begin with yy or YY, to avoid
90*c54f35caSApple OSS Distributions * infringing on user name space. This should be done even for local
91*c54f35caSApple OSS Distributions * variables, as they might otherwise be expanded by user macros.
92*c54f35caSApple OSS Distributions * There are some unavoidable exceptions within include files to
93*c54f35caSApple OSS Distributions * define necessary library symbols; they are noted "INFRINGES ON
94*c54f35caSApple OSS Distributions * USER NAME SPACE" below. */
95*c54f35caSApple OSS Distributions
96*c54f35caSApple OSS Distributions /* Identify Bison output. */
97*c54f35caSApple OSS Distributions #define YYBISON 1
98*c54f35caSApple OSS Distributions
99*c54f35caSApple OSS Distributions /* Bison version. */
100*c54f35caSApple OSS Distributions #define YYBISON_VERSION "2.3"
101*c54f35caSApple OSS Distributions
102*c54f35caSApple OSS Distributions /* Skeleton name. */
103*c54f35caSApple OSS Distributions #define YYSKELETON_NAME "yacc.c"
104*c54f35caSApple OSS Distributions
105*c54f35caSApple OSS Distributions /* Pure parsers. */
106*c54f35caSApple OSS Distributions #define YYPURE 1
107*c54f35caSApple OSS Distributions
108*c54f35caSApple OSS Distributions /* Using locations. */
109*c54f35caSApple OSS Distributions #define YYLSP_NEEDED 0
110*c54f35caSApple OSS Distributions
111*c54f35caSApple OSS Distributions /* Substitute the variable and function names. */
112*c54f35caSApple OSS Distributions #define yyparse OSUnserializeXMLparse
113*c54f35caSApple OSS Distributions #define yylex OSUnserializeXMLlex
114*c54f35caSApple OSS Distributions #define yyerror OSUnserializeXMLerror
115*c54f35caSApple OSS Distributions #define yylval OSUnserializeXMLlval
116*c54f35caSApple OSS Distributions #define yychar OSUnserializeXMLchar
117*c54f35caSApple OSS Distributions #define yydebug OSUnserializeXMLdebug
118*c54f35caSApple OSS Distributions #define yynerrs OSUnserializeXMLnerrs
119*c54f35caSApple OSS Distributions
120*c54f35caSApple OSS Distributions
121*c54f35caSApple OSS Distributions /* Tokens. */
122*c54f35caSApple OSS Distributions #ifndef YYTOKENTYPE
123*c54f35caSApple OSS Distributions # define YYTOKENTYPE
124*c54f35caSApple OSS Distributions /* Put the tokens into the symbol table, so that GDB and other debuggers
125*c54f35caSApple OSS Distributions * know about them. */
126*c54f35caSApple OSS Distributions enum yytokentype {
127*c54f35caSApple OSS Distributions ARRAY = 258,
128*c54f35caSApple OSS Distributions BOOLEAN = 259,
129*c54f35caSApple OSS Distributions DATA = 260,
130*c54f35caSApple OSS Distributions DICTIONARY = 261,
131*c54f35caSApple OSS Distributions IDREF = 262,
132*c54f35caSApple OSS Distributions KEY = 263,
133*c54f35caSApple OSS Distributions NUMBER = 264,
134*c54f35caSApple OSS Distributions SET = 265,
135*c54f35caSApple OSS Distributions STRING = 266,
136*c54f35caSApple OSS Distributions SYNTAX_ERROR = 267
137*c54f35caSApple OSS Distributions };
138*c54f35caSApple OSS Distributions #endif
139*c54f35caSApple OSS Distributions /* Tokens. */
140*c54f35caSApple OSS Distributions #define ARRAY 258
141*c54f35caSApple OSS Distributions #define BOOLEAN 259
142*c54f35caSApple OSS Distributions #define DATA 260
143*c54f35caSApple OSS Distributions #define DICTIONARY 261
144*c54f35caSApple OSS Distributions #define IDREF 262
145*c54f35caSApple OSS Distributions #define KEY 263
146*c54f35caSApple OSS Distributions #define NUMBER 264
147*c54f35caSApple OSS Distributions #define SET 265
148*c54f35caSApple OSS Distributions #define STRING 266
149*c54f35caSApple OSS Distributions #define SYNTAX_ERROR 267
150*c54f35caSApple OSS Distributions
151*c54f35caSApple OSS Distributions
152*c54f35caSApple OSS Distributions
153*c54f35caSApple OSS Distributions
154*c54f35caSApple OSS Distributions /* Copy the first part of user declarations. */
155*c54f35caSApple OSS Distributions #line 61 "OSUnserializeXML.y"
156*c54f35caSApple OSS Distributions
157*c54f35caSApple OSS Distributions #include <string.h>
158*c54f35caSApple OSS Distributions #if KERNEL
159*c54f35caSApple OSS Distributions #include <libkern/c++/OSMetaClass.h>
160*c54f35caSApple OSS Distributions #include <libkern/c++/OSContainers.h>
161*c54f35caSApple OSS Distributions #include <libkern/c++/OSLib.h>
162*c54f35caSApple OSS Distributions #else /* !KERNEL */
163*c54f35caSApple OSS Distributions #include <DriverKit/DriverKit.h>
164*c54f35caSApple OSS Distributions #endif /* KERNEL */
165*c54f35caSApple OSS Distributions
166*c54f35caSApple OSS Distributions
167*c54f35caSApple OSS Distributions #define MAX_OBJECTS 131071
168*c54f35caSApple OSS Distributions #define MAX_REFED_OBJECTS 65535
169*c54f35caSApple OSS Distributions
170*c54f35caSApple OSS Distributions #define YYSTYPE object_t *
171*c54f35caSApple OSS Distributions #define YYPARSE_PARAM state
172*c54f35caSApple OSS Distributions #define YYLEX_PARAM (parser_state_t *)state
173*c54f35caSApple OSS Distributions
174*c54f35caSApple OSS Distributions // this is the internal struct used to hold objects on parser stack
175*c54f35caSApple OSS Distributions // it represents objects both before and after they have been created
176*c54f35caSApple OSS Distributions typedef struct object {
177*c54f35caSApple OSS Distributions struct object *next;
178*c54f35caSApple OSS Distributions struct object *free;
179*c54f35caSApple OSS Distributions struct object *elements;
180*c54f35caSApple OSS Distributions OSObject *object;
181*c54f35caSApple OSS Distributions OSSymbol *key; // for dictionary
182*c54f35caSApple OSS Distributions int size;
183*c54f35caSApple OSS Distributions void *data; // for data
184*c54f35caSApple OSS Distributions char *string; // for string & symbol
185*c54f35caSApple OSS Distributions int string_alloc_length;
186*c54f35caSApple OSS Distributions long long number; // for number
187*c54f35caSApple OSS Distributions int idref;
188*c54f35caSApple OSS Distributions } object_t;
189*c54f35caSApple OSS Distributions
190*c54f35caSApple OSS Distributions // this code is reentrant, this structure contains all
191*c54f35caSApple OSS Distributions // state information for the parsing of a single buffer
192*c54f35caSApple OSS Distributions typedef struct parser_state {
193*c54f35caSApple OSS Distributions const char *parseBuffer; // start of text to be parsed
194*c54f35caSApple OSS Distributions int parseBufferIndex; // current index into text
195*c54f35caSApple OSS Distributions int lineNumber; // current line number
196*c54f35caSApple OSS Distributions object_t *objects; // internal objects in use
197*c54f35caSApple OSS Distributions object_t *freeObjects; // internal objects that are free
198*c54f35caSApple OSS Distributions OSDictionary *tags; // used to remember "ID" tags
199*c54f35caSApple OSS Distributions OSString **errorString; // parse error with line
200*c54f35caSApple OSS Distributions OSObject *parsedObject; // resultant object of parsed text
201*c54f35caSApple OSS Distributions int parsedObjectCount;
202*c54f35caSApple OSS Distributions int retrievedObjectCount;
203*c54f35caSApple OSS Distributions } parser_state_t;
204*c54f35caSApple OSS Distributions
205*c54f35caSApple OSS Distributions #define STATE ((parser_state_t *)state)
206*c54f35caSApple OSS Distributions
207*c54f35caSApple OSS Distributions #undef yyerror
208*c54f35caSApple OSS Distributions #define yyerror(s) OSUnserializeerror(STATE, (s))
209*c54f35caSApple OSS Distributions static int OSUnserializeerror(parser_state_t *state, const char *s);
210*c54f35caSApple OSS Distributions
211*c54f35caSApple OSS Distributions static int yylex(YYSTYPE *lvalp, parser_state_t *state);
212*c54f35caSApple OSS Distributions
213*c54f35caSApple OSS Distributions static object_t *newObject(parser_state_t *state);
214*c54f35caSApple OSS Distributions static void freeObject(parser_state_t *state, object_t *o);
215*c54f35caSApple OSS Distributions static void rememberObject(parser_state_t *state, int tag, OSObject *o);
216*c54f35caSApple OSS Distributions static object_t *retrieveObject(parser_state_t *state, int tag);
217*c54f35caSApple OSS Distributions static void cleanupObjects(parser_state_t *state);
218*c54f35caSApple OSS Distributions
219*c54f35caSApple OSS Distributions static object_t *buildDictionary(parser_state_t *state, object_t *o);
220*c54f35caSApple OSS Distributions static object_t *buildArray(parser_state_t *state, object_t *o);
221*c54f35caSApple OSS Distributions static object_t *buildSet(parser_state_t *state, object_t *o);
222*c54f35caSApple OSS Distributions static object_t *buildString(parser_state_t *state, object_t *o);
223*c54f35caSApple OSS Distributions static object_t *buildSymbol(parser_state_t *state, object_t *o);
224*c54f35caSApple OSS Distributions static object_t *buildData(parser_state_t *state, object_t *o);
225*c54f35caSApple OSS Distributions static object_t *buildNumber(parser_state_t *state, object_t *o);
226*c54f35caSApple OSS Distributions static object_t *buildBoolean(parser_state_t *state, object_t *o);
227*c54f35caSApple OSS Distributions
228*c54f35caSApple OSS Distributions #if KERNEL
229*c54f35caSApple OSS Distributions __BEGIN_DECLS
230*c54f35caSApple OSS Distributions #include <kern/kalloc.h>
231*c54f35caSApple OSS Distributions __END_DECLS
232*c54f35caSApple OSS Distributions
233*c54f35caSApple OSS Distributions #define malloc(size) malloc_impl(size)
234*c54f35caSApple OSS Distributions #define malloc_type(type) kalloc_type(type, Z_WAITOK)
235*c54f35caSApple OSS Distributions static inline void *
malloc_impl(size_t size)236*c54f35caSApple OSS Distributions malloc_impl(size_t size)
237*c54f35caSApple OSS Distributions {
238*c54f35caSApple OSS Distributions if (size == 0) {
239*c54f35caSApple OSS Distributions return NULL;
240*c54f35caSApple OSS Distributions }
241*c54f35caSApple OSS Distributions return kalloc_data(size,
242*c54f35caSApple OSS Distributions Z_VM_TAG_BT(Z_WAITOK_ZERO, VM_KERN_MEMORY_LIBKERN));
243*c54f35caSApple OSS Distributions }
244*c54f35caSApple OSS Distributions
245*c54f35caSApple OSS Distributions #define free(addr) free_impl(addr)
246*c54f35caSApple OSS Distributions #define free_type(type, addr) kfree_type(type, addr)
247*c54f35caSApple OSS Distributions static inline void
free_impl(void * addr)248*c54f35caSApple OSS Distributions free_impl(void *addr)
249*c54f35caSApple OSS Distributions {
250*c54f35caSApple OSS Distributions kfree_data_addr(addr);
251*c54f35caSApple OSS Distributions }
252*c54f35caSApple OSS Distributions static inline void
safe_free(void * addr,size_t size)253*c54f35caSApple OSS Distributions safe_free(void *addr, size_t size)
254*c54f35caSApple OSS Distributions {
255*c54f35caSApple OSS Distributions kfree_data(addr, size);
256*c54f35caSApple OSS Distributions }
257*c54f35caSApple OSS Distributions
258*c54f35caSApple OSS Distributions #define realloc(addr, osize, nsize) realloc_impl(addr, osize, nsize)
259*c54f35caSApple OSS Distributions static inline void *
realloc_impl(void * addr,size_t osize,size_t nsize)260*c54f35caSApple OSS Distributions realloc_impl(void *addr, size_t osize, size_t nsize)
261*c54f35caSApple OSS Distributions {
262*c54f35caSApple OSS Distributions return krealloc_data(addr, osize, nsize,
263*c54f35caSApple OSS Distributions Z_VM_TAG_BT(Z_WAITOK_ZERO, VM_KERN_MEMORY_LIBKERN));
264*c54f35caSApple OSS Distributions }
265*c54f35caSApple OSS Distributions #else /* !KERNEL */
266*c54f35caSApple OSS Distributions #define malloc(size) malloc_impl(size)
267*c54f35caSApple OSS Distributions #define malloc_type(type) (type *) calloc(1, sizeof(type))
268*c54f35caSApple OSS Distributions static inline void *
malloc_impl(size_t size)269*c54f35caSApple OSS Distributions malloc_impl(size_t size)
270*c54f35caSApple OSS Distributions {
271*c54f35caSApple OSS Distributions if (size == 0) {
272*c54f35caSApple OSS Distributions return NULL;
273*c54f35caSApple OSS Distributions }
274*c54f35caSApple OSS Distributions return calloc(1, size);
275*c54f35caSApple OSS Distributions }
276*c54f35caSApple OSS Distributions #define safe_free(addr, size) free(addr)
277*c54f35caSApple OSS Distributions #define free_type(type, addr) safe_free(addr, sizeof(type))
278*c54f35caSApple OSS Distributions #define realloc(addr, osize, nsize) realloc_impl(addr, osize, nsize)
279*c54f35caSApple OSS Distributions static inline void *
realloc_impl(void * addr,size_t osize,size_t nsize)280*c54f35caSApple OSS Distributions realloc_impl(void *addr, size_t osize, size_t nsize)
281*c54f35caSApple OSS Distributions {
282*c54f35caSApple OSS Distributions void * nmem;
283*c54f35caSApple OSS Distributions
284*c54f35caSApple OSS Distributions if (!addr) {
285*c54f35caSApple OSS Distributions return malloc(nsize);
286*c54f35caSApple OSS Distributions }
287*c54f35caSApple OSS Distributions if (nsize == osize) {
288*c54f35caSApple OSS Distributions return addr;
289*c54f35caSApple OSS Distributions }
290*c54f35caSApple OSS Distributions nmem = (realloc)(addr, nsize);
291*c54f35caSApple OSS Distributions if (nmem && nsize > osize) {
292*c54f35caSApple OSS Distributions bzero((uint8_t *)nmem + osize, nsize - osize);
293*c54f35caSApple OSS Distributions }
294*c54f35caSApple OSS Distributions
295*c54f35caSApple OSS Distributions return nmem;
296*c54f35caSApple OSS Distributions }
297*c54f35caSApple OSS Distributions #endif /* KERNEL */
298*c54f35caSApple OSS Distributions
299*c54f35caSApple OSS Distributions
300*c54f35caSApple OSS Distributions
301*c54f35caSApple OSS Distributions /* Enabling traces. */
302*c54f35caSApple OSS Distributions #ifndef YYDEBUG
303*c54f35caSApple OSS Distributions # define YYDEBUG 0
304*c54f35caSApple OSS Distributions #endif
305*c54f35caSApple OSS Distributions
306*c54f35caSApple OSS Distributions /* Enabling verbose error messages. */
307*c54f35caSApple OSS Distributions #ifdef YYERROR_VERBOSE
308*c54f35caSApple OSS Distributions # undef YYERROR_VERBOSE
309*c54f35caSApple OSS Distributions # define YYERROR_VERBOSE 1
310*c54f35caSApple OSS Distributions #else
311*c54f35caSApple OSS Distributions # define YYERROR_VERBOSE 0
312*c54f35caSApple OSS Distributions #endif
313*c54f35caSApple OSS Distributions
314*c54f35caSApple OSS Distributions /* Enabling the token table. */
315*c54f35caSApple OSS Distributions #ifndef YYTOKEN_TABLE
316*c54f35caSApple OSS Distributions # define YYTOKEN_TABLE 0
317*c54f35caSApple OSS Distributions #endif
318*c54f35caSApple OSS Distributions
319*c54f35caSApple OSS Distributions #if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED
320*c54f35caSApple OSS Distributions typedef int YYSTYPE;
321*c54f35caSApple OSS Distributions # define yystype YYSTYPE /* obsolescent; will be withdrawn */
322*c54f35caSApple OSS Distributions # define YYSTYPE_IS_DECLARED 1
323*c54f35caSApple OSS Distributions # define YYSTYPE_IS_TRIVIAL 1
324*c54f35caSApple OSS Distributions #endif
325*c54f35caSApple OSS Distributions
326*c54f35caSApple OSS Distributions
327*c54f35caSApple OSS Distributions
328*c54f35caSApple OSS Distributions /* Copy the second part of user declarations. */
329*c54f35caSApple OSS Distributions
330*c54f35caSApple OSS Distributions
331*c54f35caSApple OSS Distributions /* Line 216 of yacc.c. */
332*c54f35caSApple OSS Distributions #line 300 "OSUnserializeXML.tab.c"
333*c54f35caSApple OSS Distributions
334*c54f35caSApple OSS Distributions #ifdef short
335*c54f35caSApple OSS Distributions # undef short
336*c54f35caSApple OSS Distributions #endif
337*c54f35caSApple OSS Distributions
338*c54f35caSApple OSS Distributions #ifdef YYTYPE_UINT8
339*c54f35caSApple OSS Distributions typedef YYTYPE_UINT8 yytype_uint8;
340*c54f35caSApple OSS Distributions #else
341*c54f35caSApple OSS Distributions typedef unsigned char yytype_uint8;
342*c54f35caSApple OSS Distributions #endif
343*c54f35caSApple OSS Distributions
344*c54f35caSApple OSS Distributions #ifdef YYTYPE_INT8
345*c54f35caSApple OSS Distributions typedef YYTYPE_INT8 yytype_int8;
346*c54f35caSApple OSS Distributions #elif (defined __STDC__ || defined __C99__FUNC__ \
347*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
348*c54f35caSApple OSS Distributions typedef signed char yytype_int8;
349*c54f35caSApple OSS Distributions #else
350*c54f35caSApple OSS Distributions typedef short int yytype_int8;
351*c54f35caSApple OSS Distributions #endif
352*c54f35caSApple OSS Distributions
353*c54f35caSApple OSS Distributions #ifdef YYTYPE_UINT16
354*c54f35caSApple OSS Distributions typedef YYTYPE_UINT16 yytype_uint16;
355*c54f35caSApple OSS Distributions #else
356*c54f35caSApple OSS Distributions typedef unsigned short int yytype_uint16;
357*c54f35caSApple OSS Distributions #endif
358*c54f35caSApple OSS Distributions
359*c54f35caSApple OSS Distributions #ifdef YYTYPE_INT16
360*c54f35caSApple OSS Distributions typedef YYTYPE_INT16 yytype_int16;
361*c54f35caSApple OSS Distributions #else
362*c54f35caSApple OSS Distributions typedef short int yytype_int16;
363*c54f35caSApple OSS Distributions #endif
364*c54f35caSApple OSS Distributions
365*c54f35caSApple OSS Distributions #ifndef YYSIZE_T
366*c54f35caSApple OSS Distributions # ifdef __SIZE_TYPE__
367*c54f35caSApple OSS Distributions # define YYSIZE_T __SIZE_TYPE__
368*c54f35caSApple OSS Distributions # elif defined size_t
369*c54f35caSApple OSS Distributions # define YYSIZE_T size_t
370*c54f35caSApple OSS Distributions # elif !defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
371*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
372*c54f35caSApple OSS Distributions # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
373*c54f35caSApple OSS Distributions # define YYSIZE_T size_t
374*c54f35caSApple OSS Distributions # else
375*c54f35caSApple OSS Distributions # define YYSIZE_T unsigned int
376*c54f35caSApple OSS Distributions # endif
377*c54f35caSApple OSS Distributions #endif
378*c54f35caSApple OSS Distributions
379*c54f35caSApple OSS Distributions #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
380*c54f35caSApple OSS Distributions
381*c54f35caSApple OSS Distributions #ifndef YY_
382*c54f35caSApple OSS Distributions # if defined YYENABLE_NLS && YYENABLE_NLS
383*c54f35caSApple OSS Distributions # if ENABLE_NLS
384*c54f35caSApple OSS Distributions # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
385*c54f35caSApple OSS Distributions # define YY_(msgid) dgettext ("bison-runtime", msgid)
386*c54f35caSApple OSS Distributions # endif
387*c54f35caSApple OSS Distributions # endif
388*c54f35caSApple OSS Distributions # ifndef YY_
389*c54f35caSApple OSS Distributions # define YY_(msgid) msgid
390*c54f35caSApple OSS Distributions # endif
391*c54f35caSApple OSS Distributions #endif
392*c54f35caSApple OSS Distributions
393*c54f35caSApple OSS Distributions /* Suppress unused-variable warnings by "using" E. */
394*c54f35caSApple OSS Distributions #if !defined lint || defined __GNUC__
395*c54f35caSApple OSS Distributions # define YYUSE(e) ((void) (e))
396*c54f35caSApple OSS Distributions #else
397*c54f35caSApple OSS Distributions # define YYUSE(e) /* empty */
398*c54f35caSApple OSS Distributions #endif
399*c54f35caSApple OSS Distributions
400*c54f35caSApple OSS Distributions /* Identity function, used to suppress warnings about constant conditions. */
401*c54f35caSApple OSS Distributions #ifndef lint
402*c54f35caSApple OSS Distributions # define YYID(n) (n)
403*c54f35caSApple OSS Distributions #else
404*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
405*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
406*c54f35caSApple OSS Distributions static int
YYID(int i)407*c54f35caSApple OSS Distributions YYID(int i)
408*c54f35caSApple OSS Distributions #else
409*c54f35caSApple OSS Distributions static int
410*c54f35caSApple OSS Distributions YYID(i)
411*c54f35caSApple OSS Distributions int i;
412*c54f35caSApple OSS Distributions #endif
413*c54f35caSApple OSS Distributions {
414*c54f35caSApple OSS Distributions return i;
415*c54f35caSApple OSS Distributions }
416*c54f35caSApple OSS Distributions #endif
417*c54f35caSApple OSS Distributions
418*c54f35caSApple OSS Distributions #if !defined yyoverflow || YYERROR_VERBOSE
419*c54f35caSApple OSS Distributions
420*c54f35caSApple OSS Distributions /* The parser invokes alloca or malloc; define the necessary symbols. */
421*c54f35caSApple OSS Distributions
422*c54f35caSApple OSS Distributions # ifdef YYSTACK_USE_ALLOCA
423*c54f35caSApple OSS Distributions # if YYSTACK_USE_ALLOCA
424*c54f35caSApple OSS Distributions # ifdef __GNUC__
425*c54f35caSApple OSS Distributions # define YYSTACK_ALLOC __builtin_alloca
426*c54f35caSApple OSS Distributions # elif defined __BUILTIN_VA_ARG_INCR
427*c54f35caSApple OSS Distributions # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
428*c54f35caSApple OSS Distributions # elif defined _AIX
429*c54f35caSApple OSS Distributions # define YYSTACK_ALLOC __alloca
430*c54f35caSApple OSS Distributions # elif defined _MSC_VER
431*c54f35caSApple OSS Distributions # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
432*c54f35caSApple OSS Distributions # define alloca _alloca
433*c54f35caSApple OSS Distributions # else
434*c54f35caSApple OSS Distributions # define YYSTACK_ALLOC alloca
435*c54f35caSApple OSS Distributions # if !defined _ALLOCA_H && !defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
436*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
437*c54f35caSApple OSS Distributions # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
438*c54f35caSApple OSS Distributions # ifndef _STDLIB_H
439*c54f35caSApple OSS Distributions # define _STDLIB_H 1
440*c54f35caSApple OSS Distributions # endif
441*c54f35caSApple OSS Distributions # endif
442*c54f35caSApple OSS Distributions # endif
443*c54f35caSApple OSS Distributions # endif
444*c54f35caSApple OSS Distributions # endif
445*c54f35caSApple OSS Distributions
446*c54f35caSApple OSS Distributions # ifdef YYSTACK_ALLOC
447*c54f35caSApple OSS Distributions /* Pacify GCC's `empty if-body' warning. */
448*c54f35caSApple OSS Distributions # define YYSTACK_FREE(Ptr) do { /* empty */ ; } while (YYID (0))
449*c54f35caSApple OSS Distributions # ifndef YYSTACK_ALLOC_MAXIMUM
450*c54f35caSApple OSS Distributions /* The OS might guarantee only one guard page at the bottom of the stack,
451*c54f35caSApple OSS Distributions * and a page size can be as small as 4096 bytes. So we cannot safely
452*c54f35caSApple OSS Distributions * invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
453*c54f35caSApple OSS Distributions * to allow for a few compiler-allocated temporary stack slots. */
454*c54f35caSApple OSS Distributions # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
455*c54f35caSApple OSS Distributions # endif
456*c54f35caSApple OSS Distributions # else
457*c54f35caSApple OSS Distributions # define YYSTACK_ALLOC YYMALLOC
458*c54f35caSApple OSS Distributions # define YYSTACK_FREE YYFREE
459*c54f35caSApple OSS Distributions # ifndef YYSTACK_ALLOC_MAXIMUM
460*c54f35caSApple OSS Distributions # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
461*c54f35caSApple OSS Distributions # endif
462*c54f35caSApple OSS Distributions # if (defined __cplusplus && !defined _STDLIB_H \
463*c54f35caSApple OSS Distributions && !((defined YYMALLOC || defined malloc) \
464*c54f35caSApple OSS Distributions && (defined YYFREE || defined free)))
465*c54f35caSApple OSS Distributions # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
466*c54f35caSApple OSS Distributions # ifndef _STDLIB_H
467*c54f35caSApple OSS Distributions # define _STDLIB_H 1
468*c54f35caSApple OSS Distributions # endif
469*c54f35caSApple OSS Distributions # endif
470*c54f35caSApple OSS Distributions # ifndef YYMALLOC
471*c54f35caSApple OSS Distributions # define YYMALLOC malloc
472*c54f35caSApple OSS Distributions # if !defined malloc && !defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
473*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
474*c54f35caSApple OSS Distributions void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
475*c54f35caSApple OSS Distributions # endif
476*c54f35caSApple OSS Distributions # endif
477*c54f35caSApple OSS Distributions # ifndef YYFREE
478*c54f35caSApple OSS Distributions # define YYFREE free
479*c54f35caSApple OSS Distributions # if !defined free && !defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
480*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
481*c54f35caSApple OSS Distributions void free(void *); /* INFRINGES ON USER NAME SPACE */
482*c54f35caSApple OSS Distributions # endif
483*c54f35caSApple OSS Distributions # endif
484*c54f35caSApple OSS Distributions # endif
485*c54f35caSApple OSS Distributions #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
486*c54f35caSApple OSS Distributions
487*c54f35caSApple OSS Distributions
488*c54f35caSApple OSS Distributions #if (!defined yyoverflow \
489*c54f35caSApple OSS Distributions && (!defined __cplusplus \
490*c54f35caSApple OSS Distributions || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
491*c54f35caSApple OSS Distributions
492*c54f35caSApple OSS Distributions /* A type that is properly aligned for any stack member. */
493*c54f35caSApple OSS Distributions union yyalloc {
494*c54f35caSApple OSS Distributions yytype_int16 yyss;
495*c54f35caSApple OSS Distributions YYSTYPE yyvs;
496*c54f35caSApple OSS Distributions };
497*c54f35caSApple OSS Distributions
498*c54f35caSApple OSS Distributions /* The size of the maximum gap between one aligned stack and the next. */
499*c54f35caSApple OSS Distributions # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
500*c54f35caSApple OSS Distributions
501*c54f35caSApple OSS Distributions /* The size of an array large to enough to hold all stacks, each with
502*c54f35caSApple OSS Distributions * N elements. */
503*c54f35caSApple OSS Distributions # define YYSTACK_BYTES(N) \
504*c54f35caSApple OSS Distributions ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
505*c54f35caSApple OSS Distributions + YYSTACK_GAP_MAXIMUM)
506*c54f35caSApple OSS Distributions
507*c54f35caSApple OSS Distributions /* Copy COUNT objects from FROM to TO. The source and destination do
508*c54f35caSApple OSS Distributions * not overlap. */
509*c54f35caSApple OSS Distributions # ifndef YYCOPY
510*c54f35caSApple OSS Distributions # if defined __GNUC__ && 1 < __GNUC__
511*c54f35caSApple OSS Distributions # define YYCOPY(To, From, Count) \
512*c54f35caSApple OSS Distributions __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
513*c54f35caSApple OSS Distributions # else
514*c54f35caSApple OSS Distributions # define YYCOPY(To, From, Count) \
515*c54f35caSApple OSS Distributions do \
516*c54f35caSApple OSS Distributions { \
517*c54f35caSApple OSS Distributions YYSIZE_T yyi; \
518*c54f35caSApple OSS Distributions for (yyi = 0; yyi < (Count); yyi++) \
519*c54f35caSApple OSS Distributions (To)[yyi] = (From)[yyi]; \
520*c54f35caSApple OSS Distributions } \
521*c54f35caSApple OSS Distributions while (YYID (0))
522*c54f35caSApple OSS Distributions # endif
523*c54f35caSApple OSS Distributions # endif
524*c54f35caSApple OSS Distributions
525*c54f35caSApple OSS Distributions /* Relocate STACK from its old location to the new one. The
526*c54f35caSApple OSS Distributions * local variables YYSIZE and YYSTACKSIZE give the old and new number of
527*c54f35caSApple OSS Distributions * elements in the stack, and YYPTR gives the new location of the
528*c54f35caSApple OSS Distributions * stack. Advance YYPTR to a properly aligned location for the next
529*c54f35caSApple OSS Distributions * stack. */
530*c54f35caSApple OSS Distributions # define YYSTACK_RELOCATE(Stack) \
531*c54f35caSApple OSS Distributions do \
532*c54f35caSApple OSS Distributions { \
533*c54f35caSApple OSS Distributions YYSIZE_T yynewbytes; \
534*c54f35caSApple OSS Distributions YYCOPY (&yyptr->Stack, Stack, yysize); \
535*c54f35caSApple OSS Distributions Stack = &yyptr->Stack; \
536*c54f35caSApple OSS Distributions yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
537*c54f35caSApple OSS Distributions yyptr += yynewbytes / sizeof (*yyptr); \
538*c54f35caSApple OSS Distributions } \
539*c54f35caSApple OSS Distributions while (YYID (0))
540*c54f35caSApple OSS Distributions
541*c54f35caSApple OSS Distributions #endif
542*c54f35caSApple OSS Distributions
543*c54f35caSApple OSS Distributions /* YYFINAL -- State number of the termination state. */
544*c54f35caSApple OSS Distributions #define YYFINAL 33
545*c54f35caSApple OSS Distributions /* YYLAST -- Last index in YYTABLE. */
546*c54f35caSApple OSS Distributions #define YYLAST 108
547*c54f35caSApple OSS Distributions
548*c54f35caSApple OSS Distributions /* YYNTOKENS -- Number of terminals. */
549*c54f35caSApple OSS Distributions #define YYNTOKENS 19
550*c54f35caSApple OSS Distributions /* YYNNTS -- Number of nonterminals. */
551*c54f35caSApple OSS Distributions #define YYNNTS 15
552*c54f35caSApple OSS Distributions /* YYNRULES -- Number of rules. */
553*c54f35caSApple OSS Distributions #define YYNRULES 32
554*c54f35caSApple OSS Distributions /* YYNRULES -- Number of states. */
555*c54f35caSApple OSS Distributions #define YYNSTATES 40
556*c54f35caSApple OSS Distributions
557*c54f35caSApple OSS Distributions /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
558*c54f35caSApple OSS Distributions #define YYUNDEFTOK 2
559*c54f35caSApple OSS Distributions #define YYMAXUTOK 267
560*c54f35caSApple OSS Distributions
561*c54f35caSApple OSS Distributions #define YYTRANSLATE(YYX) \
562*c54f35caSApple OSS Distributions ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
563*c54f35caSApple OSS Distributions
564*c54f35caSApple OSS Distributions /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
565*c54f35caSApple OSS Distributions static const yytype_uint8 yytranslate[] =
566*c54f35caSApple OSS Distributions {
567*c54f35caSApple OSS Distributions 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571*c54f35caSApple OSS Distributions 15, 16, 2, 2, 2, 2, 2, 2, 2, 2,
572*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576*c54f35caSApple OSS Distributions 2, 17, 2, 18, 2, 2, 2, 2, 2, 2,
577*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579*c54f35caSApple OSS Distributions 2, 2, 2, 13, 2, 14, 2, 2, 2, 2,
580*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592*c54f35caSApple OSS Distributions 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
593*c54f35caSApple OSS Distributions 5, 6, 7, 8, 9, 10, 11, 12
594*c54f35caSApple OSS Distributions };
595*c54f35caSApple OSS Distributions
596*c54f35caSApple OSS Distributions #if YYDEBUG
597*c54f35caSApple OSS Distributions /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
598*c54f35caSApple OSS Distributions * YYRHS. */
599*c54f35caSApple OSS Distributions static const yytype_uint8 yyprhs[] =
600*c54f35caSApple OSS Distributions {
601*c54f35caSApple OSS Distributions 0, 0, 3, 4, 6, 8, 10, 12, 14, 16,
602*c54f35caSApple OSS Distributions 18, 20, 22, 24, 27, 31, 33, 35, 38, 41,
603*c54f35caSApple OSS Distributions 43, 46, 50, 52, 55, 59, 61, 63, 66, 68,
604*c54f35caSApple OSS Distributions 70, 72, 74
605*c54f35caSApple OSS Distributions };
606*c54f35caSApple OSS Distributions
607*c54f35caSApple OSS Distributions /* YYRHS -- A `-1'-separated list of the rules' RHS. */
608*c54f35caSApple OSS Distributions static const yytype_int8 yyrhs[] =
609*c54f35caSApple OSS Distributions {
610*c54f35caSApple OSS Distributions 20, 0, -1, -1, 21, -1, 12, -1, 22, -1,
611*c54f35caSApple OSS Distributions 26, -1, 27, -1, 33, -1, 30, -1, 32, -1,
612*c54f35caSApple OSS Distributions 29, -1, 31, -1, 13, 14, -1, 13, 23, 14,
613*c54f35caSApple OSS Distributions -1, 6, -1, 24, -1, 23, 24, -1, 25, 21,
614*c54f35caSApple OSS Distributions -1, 8, -1, 15, 16, -1, 15, 28, 16, -1,
615*c54f35caSApple OSS Distributions 3, -1, 17, 18, -1, 17, 28, 18, -1, 10,
616*c54f35caSApple OSS Distributions -1, 21, -1, 28, 21, -1, 4, -1, 5, -1,
617*c54f35caSApple OSS Distributions 7, -1, 9, -1, 11, -1
618*c54f35caSApple OSS Distributions };
619*c54f35caSApple OSS Distributions
620*c54f35caSApple OSS Distributions /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
621*c54f35caSApple OSS Distributions static const yytype_uint16 yyrline[] =
622*c54f35caSApple OSS Distributions {
623*c54f35caSApple OSS Distributions 0, 234, 234, 237, 242, 247, 259, 271, 283, 295,
624*c54f35caSApple OSS Distributions 307, 319, 331, 355, 358, 361, 364, 365, 380, 389,
625*c54f35caSApple OSS Distributions 401, 404, 407, 410, 413, 416, 419, 422, 429, 432,
626*c54f35caSApple OSS Distributions 435, 438, 441
627*c54f35caSApple OSS Distributions };
628*c54f35caSApple OSS Distributions #endif
629*c54f35caSApple OSS Distributions
630*c54f35caSApple OSS Distributions #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
631*c54f35caSApple OSS Distributions /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
632*c54f35caSApple OSS Distributions * First, the terminals, then, starting at YYNTOKENS, nonterminals. */
633*c54f35caSApple OSS Distributions static const char *const yytname[] =
634*c54f35caSApple OSS Distributions {
635*c54f35caSApple OSS Distributions "$end", "error", "$undefined", "ARRAY", "BOOLEAN", "DATA", "DICTIONARY",
636*c54f35caSApple OSS Distributions "IDREF", "KEY", "NUMBER", "SET", "STRING", "SYNTAX_ERROR", "'{'", "'}'",
637*c54f35caSApple OSS Distributions "'('", "')'", "'['", "']'", "$accept", "input", "object", "dict",
638*c54f35caSApple OSS Distributions "pairs", "pair", "key", "array", "set", "elements", "boolean", "data",
639*c54f35caSApple OSS Distributions "idref", "number", "string", 0
640*c54f35caSApple OSS Distributions };
641*c54f35caSApple OSS Distributions #endif
642*c54f35caSApple OSS Distributions
643*c54f35caSApple OSS Distributions # ifdef YYPRINT
644*c54f35caSApple OSS Distributions /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
645*c54f35caSApple OSS Distributions * token YYLEX-NUM. */
646*c54f35caSApple OSS Distributions static const yytype_uint16 yytoknum[] =
647*c54f35caSApple OSS Distributions {
648*c54f35caSApple OSS Distributions 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
649*c54f35caSApple OSS Distributions 265, 266, 267, 123, 125, 40, 41, 91, 93
650*c54f35caSApple OSS Distributions };
651*c54f35caSApple OSS Distributions # endif
652*c54f35caSApple OSS Distributions
653*c54f35caSApple OSS Distributions /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
654*c54f35caSApple OSS Distributions static const yytype_uint8 yyr1[] =
655*c54f35caSApple OSS Distributions {
656*c54f35caSApple OSS Distributions 0, 19, 20, 20, 20, 21, 21, 21, 21, 21,
657*c54f35caSApple OSS Distributions 21, 21, 21, 22, 22, 22, 23, 23, 24, 25,
658*c54f35caSApple OSS Distributions 26, 26, 26, 27, 27, 27, 28, 28, 29, 30,
659*c54f35caSApple OSS Distributions 31, 32, 33
660*c54f35caSApple OSS Distributions };
661*c54f35caSApple OSS Distributions
662*c54f35caSApple OSS Distributions /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
663*c54f35caSApple OSS Distributions static const yytype_uint8 yyr2[] =
664*c54f35caSApple OSS Distributions {
665*c54f35caSApple OSS Distributions 0, 2, 0, 1, 1, 1, 1, 1, 1, 1,
666*c54f35caSApple OSS Distributions 1, 1, 1, 2, 3, 1, 1, 2, 2, 1,
667*c54f35caSApple OSS Distributions 2, 3, 1, 2, 3, 1, 1, 2, 1, 1,
668*c54f35caSApple OSS Distributions 1, 1, 1
669*c54f35caSApple OSS Distributions };
670*c54f35caSApple OSS Distributions
671*c54f35caSApple OSS Distributions /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
672*c54f35caSApple OSS Distributions * STATE-NUM when YYTABLE doesn't specify something else to do. Zero
673*c54f35caSApple OSS Distributions * means the default is an error. */
674*c54f35caSApple OSS Distributions static const yytype_uint8 yydefact[] =
675*c54f35caSApple OSS Distributions {
676*c54f35caSApple OSS Distributions 2, 22, 28, 29, 15, 30, 31, 25, 32, 4,
677*c54f35caSApple OSS Distributions 0, 0, 0, 0, 3, 5, 6, 7, 11, 9,
678*c54f35caSApple OSS Distributions 12, 10, 8, 19, 13, 0, 16, 0, 20, 26,
679*c54f35caSApple OSS Distributions 0, 23, 0, 1, 14, 17, 18, 21, 27, 24
680*c54f35caSApple OSS Distributions };
681*c54f35caSApple OSS Distributions
682*c54f35caSApple OSS Distributions /* YYDEFGOTO[NTERM-NUM]. */
683*c54f35caSApple OSS Distributions static const yytype_int8 yydefgoto[] =
684*c54f35caSApple OSS Distributions {
685*c54f35caSApple OSS Distributions -1, 13, 29, 15, 25, 26, 27, 16, 17, 30,
686*c54f35caSApple OSS Distributions 18, 19, 20, 21, 22
687*c54f35caSApple OSS Distributions };
688*c54f35caSApple OSS Distributions
689*c54f35caSApple OSS Distributions /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
690*c54f35caSApple OSS Distributions * STATE-NUM. */
691*c54f35caSApple OSS Distributions #define YYPACT_NINF -20
692*c54f35caSApple OSS Distributions static const yytype_int8 yypact[] =
693*c54f35caSApple OSS Distributions {
694*c54f35caSApple OSS Distributions 46, -20, -20, -20, -20, -20, -20, -20, -20, -20,
695*c54f35caSApple OSS Distributions 4, 61, -2, 10, -20, -20, -20, -20, -20, -20,
696*c54f35caSApple OSS Distributions -20, -20, -20, -20, -20, 6, -20, 91, -20, -20,
697*c54f35caSApple OSS Distributions 76, -20, 30, -20, -20, -20, -20, -20, -20, -20
698*c54f35caSApple OSS Distributions };
699*c54f35caSApple OSS Distributions
700*c54f35caSApple OSS Distributions /* YYPGOTO[NTERM-NUM]. */
701*c54f35caSApple OSS Distributions static const yytype_int8 yypgoto[] =
702*c54f35caSApple OSS Distributions {
703*c54f35caSApple OSS Distributions -20, -20, 0, -20, -20, -19, -20, -20, -20, 5,
704*c54f35caSApple OSS Distributions -20, -20, -20, -20, -20
705*c54f35caSApple OSS Distributions };
706*c54f35caSApple OSS Distributions
707*c54f35caSApple OSS Distributions /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
708*c54f35caSApple OSS Distributions * positive, shift that token. If negative, reduce the rule which
709*c54f35caSApple OSS Distributions * number is the opposite. If zero, do what YYDEFACT says.
710*c54f35caSApple OSS Distributions * If YYTABLE_NINF, syntax error. */
711*c54f35caSApple OSS Distributions #define YYTABLE_NINF -1
712*c54f35caSApple OSS Distributions static const yytype_uint8 yytable[] =
713*c54f35caSApple OSS Distributions {
714*c54f35caSApple OSS Distributions 14, 1, 2, 3, 4, 5, 35, 6, 7, 8,
715*c54f35caSApple OSS Distributions 33, 10, 23, 11, 23, 12, 31, 32, 24, 0,
716*c54f35caSApple OSS Distributions 34, 0, 0, 0, 0, 0, 0, 36, 0, 0,
717*c54f35caSApple OSS Distributions 38, 0, 38, 1, 2, 3, 4, 5, 0, 6,
718*c54f35caSApple OSS Distributions 7, 8, 0, 10, 0, 11, 0, 12, 39, 1,
719*c54f35caSApple OSS Distributions 2, 3, 4, 5, 0, 6, 7, 8, 9, 10,
720*c54f35caSApple OSS Distributions 0, 11, 0, 12, 1, 2, 3, 4, 5, 0,
721*c54f35caSApple OSS Distributions 6, 7, 8, 0, 10, 0, 11, 28, 12, 1,
722*c54f35caSApple OSS Distributions 2, 3, 4, 5, 0, 6, 7, 8, 0, 10,
723*c54f35caSApple OSS Distributions 0, 11, 37, 12, 1, 2, 3, 4, 5, 0,
724*c54f35caSApple OSS Distributions 6, 7, 8, 0, 10, 0, 11, 0, 12
725*c54f35caSApple OSS Distributions };
726*c54f35caSApple OSS Distributions
727*c54f35caSApple OSS Distributions static const yytype_int8 yycheck[] =
728*c54f35caSApple OSS Distributions {
729*c54f35caSApple OSS Distributions 0, 3, 4, 5, 6, 7, 25, 9, 10, 11,
730*c54f35caSApple OSS Distributions 0, 13, 8, 15, 8, 17, 18, 12, 14, -1,
731*c54f35caSApple OSS Distributions 14, -1, -1, -1, -1, -1, -1, 27, -1, -1,
732*c54f35caSApple OSS Distributions 30, -1, 32, 3, 4, 5, 6, 7, -1, 9,
733*c54f35caSApple OSS Distributions 10, 11, -1, 13, -1, 15, -1, 17, 18, 3,
734*c54f35caSApple OSS Distributions 4, 5, 6, 7, -1, 9, 10, 11, 12, 13,
735*c54f35caSApple OSS Distributions -1, 15, -1, 17, 3, 4, 5, 6, 7, -1,
736*c54f35caSApple OSS Distributions 9, 10, 11, -1, 13, -1, 15, 16, 17, 3,
737*c54f35caSApple OSS Distributions 4, 5, 6, 7, -1, 9, 10, 11, -1, 13,
738*c54f35caSApple OSS Distributions -1, 15, 16, 17, 3, 4, 5, 6, 7, -1,
739*c54f35caSApple OSS Distributions 9, 10, 11, -1, 13, -1, 15, -1, 17
740*c54f35caSApple OSS Distributions };
741*c54f35caSApple OSS Distributions
742*c54f35caSApple OSS Distributions /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
743*c54f35caSApple OSS Distributions * symbol of state STATE-NUM. */
744*c54f35caSApple OSS Distributions static const yytype_uint8 yystos[] =
745*c54f35caSApple OSS Distributions {
746*c54f35caSApple OSS Distributions 0, 3, 4, 5, 6, 7, 9, 10, 11, 12,
747*c54f35caSApple OSS Distributions 13, 15, 17, 20, 21, 22, 26, 27, 29, 30,
748*c54f35caSApple OSS Distributions 31, 32, 33, 8, 14, 23, 24, 25, 16, 21,
749*c54f35caSApple OSS Distributions 28, 18, 28, 0, 14, 24, 21, 16, 21, 18
750*c54f35caSApple OSS Distributions };
751*c54f35caSApple OSS Distributions
752*c54f35caSApple OSS Distributions #define yyerrok (yyerrstatus = 0)
753*c54f35caSApple OSS Distributions #define yyclearin (yychar = YYEMPTY)
754*c54f35caSApple OSS Distributions #define YYEMPTY (-2)
755*c54f35caSApple OSS Distributions #define YYEOF 0
756*c54f35caSApple OSS Distributions
757*c54f35caSApple OSS Distributions #define YYACCEPT goto yyacceptlab
758*c54f35caSApple OSS Distributions #define YYABORT goto yyabortlab
759*c54f35caSApple OSS Distributions #define YYERROR goto yyerrorlab
760*c54f35caSApple OSS Distributions
761*c54f35caSApple OSS Distributions
762*c54f35caSApple OSS Distributions /* Like YYERROR except do call yyerror. This remains here temporarily
763*c54f35caSApple OSS Distributions * to ease the transition to the new meaning of YYERROR, for GCC.
764*c54f35caSApple OSS Distributions * Once GCC version 2 has supplanted version 1, this can go. */
765*c54f35caSApple OSS Distributions
766*c54f35caSApple OSS Distributions #define YYFAIL goto yyerrlab
767*c54f35caSApple OSS Distributions
768*c54f35caSApple OSS Distributions #define YYRECOVERING() (!!yyerrstatus)
769*c54f35caSApple OSS Distributions
770*c54f35caSApple OSS Distributions #define YYBACKUP(Token, Value) \
771*c54f35caSApple OSS Distributions do \
772*c54f35caSApple OSS Distributions if (yychar == YYEMPTY && yylen == 1) \
773*c54f35caSApple OSS Distributions { \
774*c54f35caSApple OSS Distributions yychar = (Token); \
775*c54f35caSApple OSS Distributions yylval = (Value); \
776*c54f35caSApple OSS Distributions yytoken = YYTRANSLATE (yychar); \
777*c54f35caSApple OSS Distributions YYPOPSTACK (1); \
778*c54f35caSApple OSS Distributions goto yybackup; \
779*c54f35caSApple OSS Distributions } \
780*c54f35caSApple OSS Distributions else \
781*c54f35caSApple OSS Distributions { \
782*c54f35caSApple OSS Distributions yyerror (YY_("syntax error: cannot back up")); \
783*c54f35caSApple OSS Distributions YYERROR; \
784*c54f35caSApple OSS Distributions } \
785*c54f35caSApple OSS Distributions while (YYID (0))
786*c54f35caSApple OSS Distributions
787*c54f35caSApple OSS Distributions
788*c54f35caSApple OSS Distributions #define YYTERROR 1
789*c54f35caSApple OSS Distributions #define YYERRCODE 256
790*c54f35caSApple OSS Distributions
791*c54f35caSApple OSS Distributions
792*c54f35caSApple OSS Distributions /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
793*c54f35caSApple OSS Distributions * If N is 0, then set CURRENT to the empty location which ends
794*c54f35caSApple OSS Distributions * the previous symbol: RHS[0] (always defined). */
795*c54f35caSApple OSS Distributions
796*c54f35caSApple OSS Distributions #define YYRHSLOC(Rhs, K) ((Rhs)[K])
797*c54f35caSApple OSS Distributions #ifndef YYLLOC_DEFAULT
798*c54f35caSApple OSS Distributions # define YYLLOC_DEFAULT(Current, Rhs, N) \
799*c54f35caSApple OSS Distributions do \
800*c54f35caSApple OSS Distributions if (YYID (N)) \
801*c54f35caSApple OSS Distributions { \
802*c54f35caSApple OSS Distributions (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
803*c54f35caSApple OSS Distributions (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
804*c54f35caSApple OSS Distributions (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
805*c54f35caSApple OSS Distributions (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
806*c54f35caSApple OSS Distributions } \
807*c54f35caSApple OSS Distributions else \
808*c54f35caSApple OSS Distributions { \
809*c54f35caSApple OSS Distributions (Current).first_line = (Current).last_line = \
810*c54f35caSApple OSS Distributions YYRHSLOC (Rhs, 0).last_line; \
811*c54f35caSApple OSS Distributions (Current).first_column = (Current).last_column = \
812*c54f35caSApple OSS Distributions YYRHSLOC (Rhs, 0).last_column; \
813*c54f35caSApple OSS Distributions } \
814*c54f35caSApple OSS Distributions while (YYID (0))
815*c54f35caSApple OSS Distributions #endif
816*c54f35caSApple OSS Distributions
817*c54f35caSApple OSS Distributions
818*c54f35caSApple OSS Distributions /* YY_LOCATION_PRINT -- Print the location on the stream.
819*c54f35caSApple OSS Distributions * This macro was not mandated originally: define only if we know
820*c54f35caSApple OSS Distributions * we won't break user code: when these are the locations we know. */
821*c54f35caSApple OSS Distributions
822*c54f35caSApple OSS Distributions #ifndef YY_LOCATION_PRINT
823*c54f35caSApple OSS Distributions # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
824*c54f35caSApple OSS Distributions # define YY_LOCATION_PRINT(File, Loc) \
825*c54f35caSApple OSS Distributions fprintf (File, "%d.%d-%d.%d", \
826*c54f35caSApple OSS Distributions (Loc).first_line, (Loc).first_column, \
827*c54f35caSApple OSS Distributions (Loc).last_line, (Loc).last_column)
828*c54f35caSApple OSS Distributions # else
829*c54f35caSApple OSS Distributions # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
830*c54f35caSApple OSS Distributions # endif
831*c54f35caSApple OSS Distributions #endif
832*c54f35caSApple OSS Distributions
833*c54f35caSApple OSS Distributions
834*c54f35caSApple OSS Distributions /* YYLEX -- calling `yylex' with the right arguments. */
835*c54f35caSApple OSS Distributions
836*c54f35caSApple OSS Distributions #ifdef YYLEX_PARAM
837*c54f35caSApple OSS Distributions # define YYLEX yylex (&yylval, YYLEX_PARAM)
838*c54f35caSApple OSS Distributions #else
839*c54f35caSApple OSS Distributions # define YYLEX yylex (&yylval)
840*c54f35caSApple OSS Distributions #endif
841*c54f35caSApple OSS Distributions
842*c54f35caSApple OSS Distributions /* Enable debugging if requested. */
843*c54f35caSApple OSS Distributions #if YYDEBUG
844*c54f35caSApple OSS Distributions
845*c54f35caSApple OSS Distributions # ifndef YYFPRINTF
846*c54f35caSApple OSS Distributions # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
847*c54f35caSApple OSS Distributions # define YYFPRINTF fprintf
848*c54f35caSApple OSS Distributions # endif
849*c54f35caSApple OSS Distributions
850*c54f35caSApple OSS Distributions # define YYDPRINTF(Args) \
851*c54f35caSApple OSS Distributions do { \
852*c54f35caSApple OSS Distributions if (yydebug) \
853*c54f35caSApple OSS Distributions YYFPRINTF Args; \
854*c54f35caSApple OSS Distributions } while (YYID (0))
855*c54f35caSApple OSS Distributions
856*c54f35caSApple OSS Distributions # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
857*c54f35caSApple OSS Distributions do { \
858*c54f35caSApple OSS Distributions if (yydebug) \
859*c54f35caSApple OSS Distributions { \
860*c54f35caSApple OSS Distributions YYFPRINTF (stderr, "%s ", Title); \
861*c54f35caSApple OSS Distributions yy_symbol_print (stderr, \
862*c54f35caSApple OSS Distributions Type, Value); \
863*c54f35caSApple OSS Distributions YYFPRINTF (stderr, "\n"); \
864*c54f35caSApple OSS Distributions } \
865*c54f35caSApple OSS Distributions } while (YYID (0))
866*c54f35caSApple OSS Distributions
867*c54f35caSApple OSS Distributions
868*c54f35caSApple OSS Distributions /*--------------------------------.
869*c54f35caSApple OSS Distributions | Print this symbol on YYOUTPUT. |
870*c54f35caSApple OSS Distributions | `--------------------------------*/
871*c54f35caSApple OSS Distributions
872*c54f35caSApple OSS Distributions /*ARGSUSED*/
873*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
874*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
875*c54f35caSApple OSS Distributions static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)876*c54f35caSApple OSS Distributions yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
877*c54f35caSApple OSS Distributions #else
878*c54f35caSApple OSS Distributions static void
879*c54f35caSApple OSS Distributions yy_symbol_value_print(yyoutput, yytype, yyvaluep)
880*c54f35caSApple OSS Distributions FILE *yyoutput;
881*c54f35caSApple OSS Distributions int yytype;
882*c54f35caSApple OSS Distributions YYSTYPE const * const yyvaluep;
883*c54f35caSApple OSS Distributions #endif
884*c54f35caSApple OSS Distributions {
885*c54f35caSApple OSS Distributions if (!yyvaluep) {
886*c54f35caSApple OSS Distributions return;
887*c54f35caSApple OSS Distributions }
888*c54f35caSApple OSS Distributions # ifdef YYPRINT
889*c54f35caSApple OSS Distributions if (yytype < YYNTOKENS) {
890*c54f35caSApple OSS Distributions YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep);
891*c54f35caSApple OSS Distributions }
892*c54f35caSApple OSS Distributions # else
893*c54f35caSApple OSS Distributions YYUSE(yyoutput);
894*c54f35caSApple OSS Distributions # endif
895*c54f35caSApple OSS Distributions switch (yytype) {
896*c54f35caSApple OSS Distributions default:
897*c54f35caSApple OSS Distributions break;
898*c54f35caSApple OSS Distributions }
899*c54f35caSApple OSS Distributions }
900*c54f35caSApple OSS Distributions
901*c54f35caSApple OSS Distributions
902*c54f35caSApple OSS Distributions /*--------------------------------.
903*c54f35caSApple OSS Distributions | Print this symbol on YYOUTPUT. |
904*c54f35caSApple OSS Distributions | `--------------------------------*/
905*c54f35caSApple OSS Distributions
906*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
907*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
908*c54f35caSApple OSS Distributions static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)909*c54f35caSApple OSS Distributions yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
910*c54f35caSApple OSS Distributions #else
911*c54f35caSApple OSS Distributions static void
912*c54f35caSApple OSS Distributions yy_symbol_print(yyoutput, yytype, yyvaluep)
913*c54f35caSApple OSS Distributions FILE *yyoutput;
914*c54f35caSApple OSS Distributions int yytype;
915*c54f35caSApple OSS Distributions YYSTYPE const * const yyvaluep;
916*c54f35caSApple OSS Distributions #endif
917*c54f35caSApple OSS Distributions {
918*c54f35caSApple OSS Distributions if (yytype < YYNTOKENS) {
919*c54f35caSApple OSS Distributions YYFPRINTF(yyoutput, "token %s (", yytname[yytype]);
920*c54f35caSApple OSS Distributions } else {
921*c54f35caSApple OSS Distributions YYFPRINTF(yyoutput, "nterm %s (", yytname[yytype]);
922*c54f35caSApple OSS Distributions }
923*c54f35caSApple OSS Distributions
924*c54f35caSApple OSS Distributions yy_symbol_value_print(yyoutput, yytype, yyvaluep);
925*c54f35caSApple OSS Distributions YYFPRINTF(yyoutput, ")");
926*c54f35caSApple OSS Distributions }
927*c54f35caSApple OSS Distributions
928*c54f35caSApple OSS Distributions /*------------------------------------------------------------------.
929*c54f35caSApple OSS Distributions | yy_stack_print -- Print the state stack from its BOTTOM up to its |
930*c54f35caSApple OSS Distributions | TOP (included). |
931*c54f35caSApple OSS Distributions | `------------------------------------------------------------------*/
932*c54f35caSApple OSS Distributions
933*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
934*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
935*c54f35caSApple OSS Distributions static void
yy_stack_print(yytype_int16 * bottom,yytype_int16 * top)936*c54f35caSApple OSS Distributions yy_stack_print(yytype_int16 *bottom, yytype_int16 *top)
937*c54f35caSApple OSS Distributions #else
938*c54f35caSApple OSS Distributions static void
939*c54f35caSApple OSS Distributions yy_stack_print(bottom, top)
940*c54f35caSApple OSS Distributions yytype_int16 *bottom;
941*c54f35caSApple OSS Distributions yytype_int16 *top;
942*c54f35caSApple OSS Distributions #endif
943*c54f35caSApple OSS Distributions {
944*c54f35caSApple OSS Distributions YYFPRINTF(stderr, "Stack now");
945*c54f35caSApple OSS Distributions for (; bottom <= top; ++bottom) {
946*c54f35caSApple OSS Distributions YYFPRINTF(stderr, " %d", *bottom);
947*c54f35caSApple OSS Distributions }
948*c54f35caSApple OSS Distributions YYFPRINTF(stderr, "\n");
949*c54f35caSApple OSS Distributions }
950*c54f35caSApple OSS Distributions
951*c54f35caSApple OSS Distributions # define YY_STACK_PRINT(Bottom, Top) \
952*c54f35caSApple OSS Distributions do { \
953*c54f35caSApple OSS Distributions if (yydebug) \
954*c54f35caSApple OSS Distributions yy_stack_print ((Bottom), (Top)); \
955*c54f35caSApple OSS Distributions } while (YYID (0))
956*c54f35caSApple OSS Distributions
957*c54f35caSApple OSS Distributions
958*c54f35caSApple OSS Distributions /*------------------------------------------------.
959*c54f35caSApple OSS Distributions | Report that the YYRULE is going to be reduced. |
960*c54f35caSApple OSS Distributions | `------------------------------------------------*/
961*c54f35caSApple OSS Distributions
962*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
963*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
964*c54f35caSApple OSS Distributions static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)965*c54f35caSApple OSS Distributions yy_reduce_print(YYSTYPE *yyvsp, int yyrule)
966*c54f35caSApple OSS Distributions #else
967*c54f35caSApple OSS Distributions static void
968*c54f35caSApple OSS Distributions yy_reduce_print(yyvsp, yyrule)
969*c54f35caSApple OSS Distributions YYSTYPE *yyvsp;
970*c54f35caSApple OSS Distributions int yyrule;
971*c54f35caSApple OSS Distributions #endif
972*c54f35caSApple OSS Distributions {
973*c54f35caSApple OSS Distributions int yynrhs = yyr2[yyrule];
974*c54f35caSApple OSS Distributions int yyi;
975*c54f35caSApple OSS Distributions unsigned long int yylno = yyrline[yyrule];
976*c54f35caSApple OSS Distributions YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n",
977*c54f35caSApple OSS Distributions yyrule - 1, yylno);
978*c54f35caSApple OSS Distributions /* The symbols being reduced. */
979*c54f35caSApple OSS Distributions for (yyi = 0; yyi < yynrhs; yyi++) {
980*c54f35caSApple OSS Distributions fprintf(stderr, " $%d = ", yyi + 1);
981*c54f35caSApple OSS Distributions yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi],
982*c54f35caSApple OSS Distributions &(yyvsp[(yyi + 1) - (yynrhs)])
983*c54f35caSApple OSS Distributions );
984*c54f35caSApple OSS Distributions fprintf(stderr, "\n");
985*c54f35caSApple OSS Distributions }
986*c54f35caSApple OSS Distributions }
987*c54f35caSApple OSS Distributions
988*c54f35caSApple OSS Distributions # define YY_REDUCE_PRINT(Rule) \
989*c54f35caSApple OSS Distributions do { \
990*c54f35caSApple OSS Distributions if (yydebug) \
991*c54f35caSApple OSS Distributions yy_reduce_print (yyvsp, Rule); \
992*c54f35caSApple OSS Distributions } while (YYID (0))
993*c54f35caSApple OSS Distributions
994*c54f35caSApple OSS Distributions /* Nonzero means print parse trace. It is left uninitialized so that
995*c54f35caSApple OSS Distributions * multiple parsers can coexist. */
996*c54f35caSApple OSS Distributions int yydebug;
997*c54f35caSApple OSS Distributions #else /* !YYDEBUG */
998*c54f35caSApple OSS Distributions # define YYDPRINTF(Args)
999*c54f35caSApple OSS Distributions # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1000*c54f35caSApple OSS Distributions # define YY_STACK_PRINT(Bottom, Top)
1001*c54f35caSApple OSS Distributions # define YY_REDUCE_PRINT(Rule)
1002*c54f35caSApple OSS Distributions #endif /* !YYDEBUG */
1003*c54f35caSApple OSS Distributions
1004*c54f35caSApple OSS Distributions
1005*c54f35caSApple OSS Distributions /* YYINITDEPTH -- initial size of the parser's stacks. */
1006*c54f35caSApple OSS Distributions #ifndef YYINITDEPTH
1007*c54f35caSApple OSS Distributions # define YYINITDEPTH 200
1008*c54f35caSApple OSS Distributions #endif
1009*c54f35caSApple OSS Distributions
1010*c54f35caSApple OSS Distributions /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1011*c54f35caSApple OSS Distributions * if the built-in stack extension method is used).
1012*c54f35caSApple OSS Distributions *
1013*c54f35caSApple OSS Distributions * Do not make this value too large; the results are undefined if
1014*c54f35caSApple OSS Distributions * YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1015*c54f35caSApple OSS Distributions * evaluated with infinite-precision integer arithmetic. */
1016*c54f35caSApple OSS Distributions
1017*c54f35caSApple OSS Distributions #ifndef YYMAXDEPTH
1018*c54f35caSApple OSS Distributions # define YYMAXDEPTH 10000
1019*c54f35caSApple OSS Distributions #endif
1020*c54f35caSApple OSS Distributions
1021*c54f35caSApple OSS Distributions
1022*c54f35caSApple OSS Distributions
1023*c54f35caSApple OSS Distributions #if YYERROR_VERBOSE
1024*c54f35caSApple OSS Distributions
1025*c54f35caSApple OSS Distributions # ifndef yystrlen
1026*c54f35caSApple OSS Distributions # if defined __GLIBC__ && defined _STRING_H
1027*c54f35caSApple OSS Distributions # define yystrlen strlen
1028*c54f35caSApple OSS Distributions # else
1029*c54f35caSApple OSS Distributions /* Return the length of YYSTR. */
1030*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
1031*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
1032*c54f35caSApple OSS Distributions static YYSIZE_T
yystrlen(const char * yystr)1033*c54f35caSApple OSS Distributions yystrlen(const char *yystr)
1034*c54f35caSApple OSS Distributions #else
1035*c54f35caSApple OSS Distributions static YYSIZE_T
1036*c54f35caSApple OSS Distributions yystrlen(yystr)
1037*c54f35caSApple OSS Distributions const char *yystr;
1038*c54f35caSApple OSS Distributions #endif
1039*c54f35caSApple OSS Distributions {
1040*c54f35caSApple OSS Distributions YYSIZE_T yylen;
1041*c54f35caSApple OSS Distributions for (yylen = 0; yystr[yylen]; yylen++) {
1042*c54f35caSApple OSS Distributions continue;
1043*c54f35caSApple OSS Distributions }
1044*c54f35caSApple OSS Distributions return yylen;
1045*c54f35caSApple OSS Distributions }
1046*c54f35caSApple OSS Distributions # endif
1047*c54f35caSApple OSS Distributions # endif
1048*c54f35caSApple OSS Distributions
1049*c54f35caSApple OSS Distributions # ifndef yystpcpy
1050*c54f35caSApple OSS Distributions # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1051*c54f35caSApple OSS Distributions # define yystpcpy stpcpy
1052*c54f35caSApple OSS Distributions # else
1053*c54f35caSApple OSS Distributions /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1054*c54f35caSApple OSS Distributions * YYDEST. */
1055*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
1056*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
1057*c54f35caSApple OSS Distributions static char *
yystpcpy(char * yydest,const char * yysrc)1058*c54f35caSApple OSS Distributions yystpcpy(char *yydest, const char *yysrc)
1059*c54f35caSApple OSS Distributions #else
1060*c54f35caSApple OSS Distributions static char *
1061*c54f35caSApple OSS Distributions yystpcpy(yydest, yysrc)
1062*c54f35caSApple OSS Distributions char *yydest;
1063*c54f35caSApple OSS Distributions const char *yysrc;
1064*c54f35caSApple OSS Distributions #endif
1065*c54f35caSApple OSS Distributions {
1066*c54f35caSApple OSS Distributions char *yyd = yydest;
1067*c54f35caSApple OSS Distributions const char *yys = yysrc;
1068*c54f35caSApple OSS Distributions
1069*c54f35caSApple OSS Distributions while ((*yyd++ = *yys++) != '\0') {
1070*c54f35caSApple OSS Distributions continue;
1071*c54f35caSApple OSS Distributions }
1072*c54f35caSApple OSS Distributions
1073*c54f35caSApple OSS Distributions return yyd - 1;
1074*c54f35caSApple OSS Distributions }
1075*c54f35caSApple OSS Distributions # endif
1076*c54f35caSApple OSS Distributions # endif
1077*c54f35caSApple OSS Distributions
1078*c54f35caSApple OSS Distributions # ifndef yytnamerr
1079*c54f35caSApple OSS Distributions /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1080*c54f35caSApple OSS Distributions * quotes and backslashes, so that it's suitable for yyerror. The
1081*c54f35caSApple OSS Distributions * heuristic is that double-quoting is unnecessary unless the string
1082*c54f35caSApple OSS Distributions * contains an apostrophe, a comma, or backslash (other than
1083*c54f35caSApple OSS Distributions * backslash-backslash). YYSTR is taken from yytname. If YYRES is
1084*c54f35caSApple OSS Distributions * null, do not copy; instead, return the length of what the result
1085*c54f35caSApple OSS Distributions * would have been. */
1086*c54f35caSApple OSS Distributions static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1087*c54f35caSApple OSS Distributions yytnamerr(char *yyres, const char *yystr)
1088*c54f35caSApple OSS Distributions {
1089*c54f35caSApple OSS Distributions if (*yystr == '"') {
1090*c54f35caSApple OSS Distributions YYSIZE_T yyn = 0;
1091*c54f35caSApple OSS Distributions char const *yyp = yystr;
1092*c54f35caSApple OSS Distributions
1093*c54f35caSApple OSS Distributions for (;;) {
1094*c54f35caSApple OSS Distributions switch (*++yyp) {
1095*c54f35caSApple OSS Distributions case '\'':
1096*c54f35caSApple OSS Distributions case ',':
1097*c54f35caSApple OSS Distributions goto do_not_strip_quotes;
1098*c54f35caSApple OSS Distributions
1099*c54f35caSApple OSS Distributions case '\\':
1100*c54f35caSApple OSS Distributions if (*++yyp != '\\') {
1101*c54f35caSApple OSS Distributions goto do_not_strip_quotes;
1102*c54f35caSApple OSS Distributions }
1103*c54f35caSApple OSS Distributions /* Fall through. */
1104*c54f35caSApple OSS Distributions default:
1105*c54f35caSApple OSS Distributions if (yyres) {
1106*c54f35caSApple OSS Distributions yyres[yyn] = *yyp;
1107*c54f35caSApple OSS Distributions }
1108*c54f35caSApple OSS Distributions yyn++;
1109*c54f35caSApple OSS Distributions break;
1110*c54f35caSApple OSS Distributions
1111*c54f35caSApple OSS Distributions case '"':
1112*c54f35caSApple OSS Distributions if (yyres) {
1113*c54f35caSApple OSS Distributions yyres[yyn] = '\0';
1114*c54f35caSApple OSS Distributions }
1115*c54f35caSApple OSS Distributions return yyn;
1116*c54f35caSApple OSS Distributions }
1117*c54f35caSApple OSS Distributions }
1118*c54f35caSApple OSS Distributions do_not_strip_quotes:;
1119*c54f35caSApple OSS Distributions }
1120*c54f35caSApple OSS Distributions
1121*c54f35caSApple OSS Distributions if (!yyres) {
1122*c54f35caSApple OSS Distributions return yystrlen(yystr);
1123*c54f35caSApple OSS Distributions }
1124*c54f35caSApple OSS Distributions
1125*c54f35caSApple OSS Distributions return yystpcpy(yyres, yystr) - yyres;
1126*c54f35caSApple OSS Distributions }
1127*c54f35caSApple OSS Distributions # endif
1128*c54f35caSApple OSS Distributions
1129*c54f35caSApple OSS Distributions /* Copy into YYRESULT an error message about the unexpected token
1130*c54f35caSApple OSS Distributions * YYCHAR while in state YYSTATE. Return the number of bytes copied,
1131*c54f35caSApple OSS Distributions * including the terminating null byte. If YYRESULT is null, do not
1132*c54f35caSApple OSS Distributions * copy anything; just return the number of bytes that would be
1133*c54f35caSApple OSS Distributions * copied. As a special case, return 0 if an ordinary "syntax error"
1134*c54f35caSApple OSS Distributions * message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1135*c54f35caSApple OSS Distributions * size calculation. */
1136*c54f35caSApple OSS Distributions static YYSIZE_T
yysyntax_error(char * yyresult,int yystate,int yychar)1137*c54f35caSApple OSS Distributions yysyntax_error(char *yyresult, int yystate, int yychar)
1138*c54f35caSApple OSS Distributions {
1139*c54f35caSApple OSS Distributions int yyn = yypact[yystate];
1140*c54f35caSApple OSS Distributions
1141*c54f35caSApple OSS Distributions if (!(YYPACT_NINF < yyn && yyn <= YYLAST)) {
1142*c54f35caSApple OSS Distributions return 0;
1143*c54f35caSApple OSS Distributions } else {
1144*c54f35caSApple OSS Distributions int yytype = YYTRANSLATE(yychar);
1145*c54f35caSApple OSS Distributions YYSIZE_T yysize0 = yytnamerr(0, yytname[yytype]);
1146*c54f35caSApple OSS Distributions YYSIZE_T yysize = yysize0;
1147*c54f35caSApple OSS Distributions YYSIZE_T yysize1;
1148*c54f35caSApple OSS Distributions int yysize_overflow = 0;
1149*c54f35caSApple OSS Distributions enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1150*c54f35caSApple OSS Distributions char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1151*c54f35caSApple OSS Distributions int yyx;
1152*c54f35caSApple OSS Distributions
1153*c54f35caSApple OSS Distributions # if 0
1154*c54f35caSApple OSS Distributions /* This is so xgettext sees the translatable formats that are
1155*c54f35caSApple OSS Distributions * constructed on the fly. */
1156*c54f35caSApple OSS Distributions YY_("syntax error, unexpected %s");
1157*c54f35caSApple OSS Distributions YY_("syntax error, unexpected %s, expecting %s");
1158*c54f35caSApple OSS Distributions YY_("syntax error, unexpected %s, expecting %s or %s");
1159*c54f35caSApple OSS Distributions YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1160*c54f35caSApple OSS Distributions YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1161*c54f35caSApple OSS Distributions # endif
1162*c54f35caSApple OSS Distributions char *yyfmt;
1163*c54f35caSApple OSS Distributions char const *yyf;
1164*c54f35caSApple OSS Distributions static char const yyunexpected[] = "syntax error, unexpected %s";
1165*c54f35caSApple OSS Distributions static char const yyexpecting[] = ", expecting %s";
1166*c54f35caSApple OSS Distributions static char const yyor[] = " or %s";
1167*c54f35caSApple OSS Distributions char yyformat[sizeof yyunexpected
1168*c54f35caSApple OSS Distributions + sizeof yyexpecting - 1
1169*c54f35caSApple OSS Distributions + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1170*c54f35caSApple OSS Distributions * (sizeof yyor - 1))];
1171*c54f35caSApple OSS Distributions char const *yyprefix = yyexpecting;
1172*c54f35caSApple OSS Distributions
1173*c54f35caSApple OSS Distributions /* Start YYX at -YYN if negative to avoid negative indexes in
1174*c54f35caSApple OSS Distributions * YYCHECK. */
1175*c54f35caSApple OSS Distributions int yyxbegin = yyn < 0 ? -yyn : 0;
1176*c54f35caSApple OSS Distributions
1177*c54f35caSApple OSS Distributions /* Stay within bounds of both yycheck and yytname. */
1178*c54f35caSApple OSS Distributions int yychecklim = YYLAST - yyn + 1;
1179*c54f35caSApple OSS Distributions int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1180*c54f35caSApple OSS Distributions int yycount = 1;
1181*c54f35caSApple OSS Distributions
1182*c54f35caSApple OSS Distributions yyarg[0] = yytname[yytype];
1183*c54f35caSApple OSS Distributions yyfmt = yystpcpy(yyformat, yyunexpected);
1184*c54f35caSApple OSS Distributions
1185*c54f35caSApple OSS Distributions for (yyx = yyxbegin; yyx < yyxend; ++yyx) {
1186*c54f35caSApple OSS Distributions if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) {
1187*c54f35caSApple OSS Distributions if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) {
1188*c54f35caSApple OSS Distributions yycount = 1;
1189*c54f35caSApple OSS Distributions yysize = yysize0;
1190*c54f35caSApple OSS Distributions yyformat[sizeof yyunexpected - 1] = '\0';
1191*c54f35caSApple OSS Distributions break;
1192*c54f35caSApple OSS Distributions }
1193*c54f35caSApple OSS Distributions yyarg[yycount++] = yytname[yyx];
1194*c54f35caSApple OSS Distributions yysize1 = yysize + yytnamerr(0, yytname[yyx]);
1195*c54f35caSApple OSS Distributions yysize_overflow |= (yysize1 < yysize);
1196*c54f35caSApple OSS Distributions yysize = yysize1;
1197*c54f35caSApple OSS Distributions yyfmt = yystpcpy(yyfmt, yyprefix);
1198*c54f35caSApple OSS Distributions yyprefix = yyor;
1199*c54f35caSApple OSS Distributions }
1200*c54f35caSApple OSS Distributions }
1201*c54f35caSApple OSS Distributions
1202*c54f35caSApple OSS Distributions yyf = YY_(yyformat);
1203*c54f35caSApple OSS Distributions yysize1 = yysize + yystrlen(yyf);
1204*c54f35caSApple OSS Distributions yysize_overflow |= (yysize1 < yysize);
1205*c54f35caSApple OSS Distributions yysize = yysize1;
1206*c54f35caSApple OSS Distributions
1207*c54f35caSApple OSS Distributions if (yysize_overflow) {
1208*c54f35caSApple OSS Distributions return YYSIZE_MAXIMUM;
1209*c54f35caSApple OSS Distributions }
1210*c54f35caSApple OSS Distributions
1211*c54f35caSApple OSS Distributions if (yyresult) {
1212*c54f35caSApple OSS Distributions /* Avoid sprintf, as that infringes on the user's name space.
1213*c54f35caSApple OSS Distributions * Don't have undefined behavior even if the translation
1214*c54f35caSApple OSS Distributions * produced a string with the wrong number of "%s"s. */
1215*c54f35caSApple OSS Distributions char *yyp = yyresult;
1216*c54f35caSApple OSS Distributions int yyi = 0;
1217*c54f35caSApple OSS Distributions while ((*yyp = *yyf) != '\0') {
1218*c54f35caSApple OSS Distributions if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) {
1219*c54f35caSApple OSS Distributions yyp += yytnamerr(yyp, yyarg[yyi++]);
1220*c54f35caSApple OSS Distributions yyf += 2;
1221*c54f35caSApple OSS Distributions } else {
1222*c54f35caSApple OSS Distributions yyp++;
1223*c54f35caSApple OSS Distributions yyf++;
1224*c54f35caSApple OSS Distributions }
1225*c54f35caSApple OSS Distributions }
1226*c54f35caSApple OSS Distributions }
1227*c54f35caSApple OSS Distributions return yysize;
1228*c54f35caSApple OSS Distributions }
1229*c54f35caSApple OSS Distributions }
1230*c54f35caSApple OSS Distributions #endif /* YYERROR_VERBOSE */
1231*c54f35caSApple OSS Distributions
1232*c54f35caSApple OSS Distributions
1233*c54f35caSApple OSS Distributions /*-----------------------------------------------.
1234*c54f35caSApple OSS Distributions | Release the memory associated to this symbol. |
1235*c54f35caSApple OSS Distributions | `-----------------------------------------------*/
1236*c54f35caSApple OSS Distributions
1237*c54f35caSApple OSS Distributions /*ARGSUSED*/
1238*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
1239*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
1240*c54f35caSApple OSS Distributions static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1241*c54f35caSApple OSS Distributions yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1242*c54f35caSApple OSS Distributions #else
1243*c54f35caSApple OSS Distributions static void
1244*c54f35caSApple OSS Distributions yydestruct(yymsg, yytype, yyvaluep)
1245*c54f35caSApple OSS Distributions const char *yymsg;
1246*c54f35caSApple OSS Distributions int yytype;
1247*c54f35caSApple OSS Distributions YYSTYPE *yyvaluep;
1248*c54f35caSApple OSS Distributions #endif
1249*c54f35caSApple OSS Distributions {
1250*c54f35caSApple OSS Distributions YYUSE(yyvaluep);
1251*c54f35caSApple OSS Distributions
1252*c54f35caSApple OSS Distributions if (!yymsg) {
1253*c54f35caSApple OSS Distributions yymsg = "Deleting";
1254*c54f35caSApple OSS Distributions }
1255*c54f35caSApple OSS Distributions YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp);
1256*c54f35caSApple OSS Distributions
1257*c54f35caSApple OSS Distributions switch (yytype) {
1258*c54f35caSApple OSS Distributions default:
1259*c54f35caSApple OSS Distributions break;
1260*c54f35caSApple OSS Distributions }
1261*c54f35caSApple OSS Distributions }
1262*c54f35caSApple OSS Distributions
1263*c54f35caSApple OSS Distributions
1264*c54f35caSApple OSS Distributions /* Prevent warnings from -Wmissing-prototypes. */
1265*c54f35caSApple OSS Distributions
1266*c54f35caSApple OSS Distributions #ifdef YYPARSE_PARAM
1267*c54f35caSApple OSS Distributions #if defined __STDC__ || defined __cplusplus
1268*c54f35caSApple OSS Distributions int yyparse(void *YYPARSE_PARAM);
1269*c54f35caSApple OSS Distributions #else
1270*c54f35caSApple OSS Distributions int yyparse();
1271*c54f35caSApple OSS Distributions #endif
1272*c54f35caSApple OSS Distributions #else /* ! YYPARSE_PARAM */
1273*c54f35caSApple OSS Distributions #if defined __STDC__ || defined __cplusplus
1274*c54f35caSApple OSS Distributions int yyparse(void);
1275*c54f35caSApple OSS Distributions #else
1276*c54f35caSApple OSS Distributions int yyparse();
1277*c54f35caSApple OSS Distributions #endif
1278*c54f35caSApple OSS Distributions #endif /* ! YYPARSE_PARAM */
1279*c54f35caSApple OSS Distributions
1280*c54f35caSApple OSS Distributions
1281*c54f35caSApple OSS Distributions
1282*c54f35caSApple OSS Distributions
1283*c54f35caSApple OSS Distributions
1284*c54f35caSApple OSS Distributions
1285*c54f35caSApple OSS Distributions /*----------.
1286*c54f35caSApple OSS Distributions | yyparse. |
1287*c54f35caSApple OSS Distributions | `----------*/
1288*c54f35caSApple OSS Distributions
1289*c54f35caSApple OSS Distributions #ifdef YYPARSE_PARAM
1290*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
1291*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
1292*c54f35caSApple OSS Distributions int
yyparse(void * YYPARSE_PARAM)1293*c54f35caSApple OSS Distributions yyparse(void *YYPARSE_PARAM)
1294*c54f35caSApple OSS Distributions #else
1295*c54f35caSApple OSS Distributions int
1296*c54f35caSApple OSS Distributions yyparse(YYPARSE_PARAM)
1297*c54f35caSApple OSS Distributions void *YYPARSE_PARAM;
1298*c54f35caSApple OSS Distributions #endif
1299*c54f35caSApple OSS Distributions #else /* ! YYPARSE_PARAM */
1300*c54f35caSApple OSS Distributions #if (defined __STDC__ || defined __C99__FUNC__ \
1301*c54f35caSApple OSS Distributions || defined __cplusplus || defined _MSC_VER)
1302*c54f35caSApple OSS Distributions int
1303*c54f35caSApple OSS Distributions yyparse(void)
1304*c54f35caSApple OSS Distributions #else
1305*c54f35caSApple OSS Distributions int
1306*c54f35caSApple OSS Distributions yyparse()
1307*c54f35caSApple OSS Distributions
1308*c54f35caSApple OSS Distributions #endif
1309*c54f35caSApple OSS Distributions #endif
1310*c54f35caSApple OSS Distributions {
1311*c54f35caSApple OSS Distributions /* The look-ahead symbol. */
1312*c54f35caSApple OSS Distributions int yychar;
1313*c54f35caSApple OSS Distributions
1314*c54f35caSApple OSS Distributions /* The semantic value of the look-ahead symbol. */
1315*c54f35caSApple OSS Distributions YYSTYPE yylval;
1316*c54f35caSApple OSS Distributions
1317*c54f35caSApple OSS Distributions /* Number of syntax errors so far. */
1318*c54f35caSApple OSS Distributions int yynerrs;
1319*c54f35caSApple OSS Distributions
1320*c54f35caSApple OSS Distributions int yystate;
1321*c54f35caSApple OSS Distributions int yyn;
1322*c54f35caSApple OSS Distributions int yyresult;
1323*c54f35caSApple OSS Distributions /* Number of tokens to shift before error messages enabled. */
1324*c54f35caSApple OSS Distributions int yyerrstatus;
1325*c54f35caSApple OSS Distributions /* Look-ahead token as an internal (translated) token number. */
1326*c54f35caSApple OSS Distributions int yytoken = 0;
1327*c54f35caSApple OSS Distributions #if YYERROR_VERBOSE
1328*c54f35caSApple OSS Distributions /* Buffer for error messages, and its allocated size. */
1329*c54f35caSApple OSS Distributions char yymsgbuf[128];
1330*c54f35caSApple OSS Distributions char *yymsg = yymsgbuf;
1331*c54f35caSApple OSS Distributions YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1332*c54f35caSApple OSS Distributions #endif
1333*c54f35caSApple OSS Distributions
1334*c54f35caSApple OSS Distributions /* Three stacks and their tools:
1335*c54f35caSApple OSS Distributions * `yyss': related to states,
1336*c54f35caSApple OSS Distributions * `yyvs': related to semantic values,
1337*c54f35caSApple OSS Distributions * `yyls': related to locations.
1338*c54f35caSApple OSS Distributions *
1339*c54f35caSApple OSS Distributions * Refer to the stacks thru separate pointers, to allow yyoverflow
1340*c54f35caSApple OSS Distributions * to reallocate them elsewhere. */
1341*c54f35caSApple OSS Distributions
1342*c54f35caSApple OSS Distributions /* The state stack. */
1343*c54f35caSApple OSS Distributions yytype_int16 yyssa[YYINITDEPTH];
1344*c54f35caSApple OSS Distributions yytype_int16 *yyss = yyssa;
1345*c54f35caSApple OSS Distributions yytype_int16 *yyssp;
1346*c54f35caSApple OSS Distributions
1347*c54f35caSApple OSS Distributions /* The semantic value stack. */
1348*c54f35caSApple OSS Distributions YYSTYPE yyvsa[YYINITDEPTH];
1349*c54f35caSApple OSS Distributions YYSTYPE *yyvs = yyvsa;
1350*c54f35caSApple OSS Distributions YYSTYPE *yyvsp;
1351*c54f35caSApple OSS Distributions
1352*c54f35caSApple OSS Distributions
1353*c54f35caSApple OSS Distributions
1354*c54f35caSApple OSS Distributions #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1355*c54f35caSApple OSS Distributions
1356*c54f35caSApple OSS Distributions YYSIZE_T yystacksize = YYINITDEPTH;
1357*c54f35caSApple OSS Distributions
1358*c54f35caSApple OSS Distributions /* The variables used to return semantic value and location from the
1359*c54f35caSApple OSS Distributions * action routines. */
1360*c54f35caSApple OSS Distributions YYSTYPE yyval;
1361*c54f35caSApple OSS Distributions
1362*c54f35caSApple OSS Distributions
1363*c54f35caSApple OSS Distributions /* The number of symbols on the RHS of the reduced rule.
1364*c54f35caSApple OSS Distributions * Keep to zero when no symbol should be popped. */
1365*c54f35caSApple OSS Distributions int yylen = 0;
1366*c54f35caSApple OSS Distributions
1367*c54f35caSApple OSS Distributions YYDPRINTF((stderr, "Starting parse\n"));
1368*c54f35caSApple OSS Distributions
1369*c54f35caSApple OSS Distributions yystate = 0;
1370*c54f35caSApple OSS Distributions yyerrstatus = 0;
1371*c54f35caSApple OSS Distributions yynerrs = 0;
1372*c54f35caSApple OSS Distributions yychar = YYEMPTY; /* Cause a token to be read. */
1373*c54f35caSApple OSS Distributions
1374*c54f35caSApple OSS Distributions /* Initialize stack pointers.
1375*c54f35caSApple OSS Distributions * Waste one element of value and location stack
1376*c54f35caSApple OSS Distributions * so that they stay on the same level as the state stack.
1377*c54f35caSApple OSS Distributions * The wasted elements are never initialized. */
1378*c54f35caSApple OSS Distributions
1379*c54f35caSApple OSS Distributions yyssp = yyss;
1380*c54f35caSApple OSS Distributions yyvsp = yyvs;
1381*c54f35caSApple OSS Distributions
1382*c54f35caSApple OSS Distributions goto yysetstate;
1383*c54f35caSApple OSS Distributions
1384*c54f35caSApple OSS Distributions /*------------------------------------------------------------.
1385*c54f35caSApple OSS Distributions | yynewstate -- Push a new state, which is found in yystate. |
1386*c54f35caSApple OSS Distributions | `------------------------------------------------------------*/
1387*c54f35caSApple OSS Distributions yynewstate:
1388*c54f35caSApple OSS Distributions /* In all cases, when you get here, the value and location stacks
1389*c54f35caSApple OSS Distributions * have just been pushed. So pushing a state here evens the stacks. */
1390*c54f35caSApple OSS Distributions yyssp++;
1391*c54f35caSApple OSS Distributions
1392*c54f35caSApple OSS Distributions yysetstate:
1393*c54f35caSApple OSS Distributions *yyssp = yystate;
1394*c54f35caSApple OSS Distributions
1395*c54f35caSApple OSS Distributions if (yyss + yystacksize - 1 <= yyssp) {
1396*c54f35caSApple OSS Distributions /* Get the current used size of the three stacks, in elements. */
1397*c54f35caSApple OSS Distributions YYSIZE_T yysize = yyssp - yyss + 1;
1398*c54f35caSApple OSS Distributions
1399*c54f35caSApple OSS Distributions #ifdef yyoverflow
1400*c54f35caSApple OSS Distributions {
1401*c54f35caSApple OSS Distributions /* Give user a chance to reallocate the stack. Use copies of
1402*c54f35caSApple OSS Distributions * these so that the &'s don't force the real ones into
1403*c54f35caSApple OSS Distributions * memory. */
1404*c54f35caSApple OSS Distributions YYSTYPE *yyvs1 = yyvs;
1405*c54f35caSApple OSS Distributions yytype_int16 *yyss1 = yyss;
1406*c54f35caSApple OSS Distributions
1407*c54f35caSApple OSS Distributions
1408*c54f35caSApple OSS Distributions /* Each stack pointer address is followed by the size of the
1409*c54f35caSApple OSS Distributions * data in use in that stack, in bytes. This used to be a
1410*c54f35caSApple OSS Distributions * conditional around just the two extra args, but that might
1411*c54f35caSApple OSS Distributions * be undefined if yyoverflow is a macro. */
1412*c54f35caSApple OSS Distributions yyoverflow(YY_("memory exhausted"),
1413*c54f35caSApple OSS Distributions &yyss1, yysize * sizeof(*yyssp),
1414*c54f35caSApple OSS Distributions &yyvs1, yysize * sizeof(*yyvsp),
1415*c54f35caSApple OSS Distributions
1416*c54f35caSApple OSS Distributions &yystacksize);
1417*c54f35caSApple OSS Distributions
1418*c54f35caSApple OSS Distributions yyss = yyss1;
1419*c54f35caSApple OSS Distributions yyvs = yyvs1;
1420*c54f35caSApple OSS Distributions }
1421*c54f35caSApple OSS Distributions #else /* no yyoverflow */
1422*c54f35caSApple OSS Distributions # ifndef YYSTACK_RELOCATE
1423*c54f35caSApple OSS Distributions goto yyexhaustedlab;
1424*c54f35caSApple OSS Distributions # else
1425*c54f35caSApple OSS Distributions /* Extend the stack our own way. */
1426*c54f35caSApple OSS Distributions if (YYMAXDEPTH <= yystacksize) {
1427*c54f35caSApple OSS Distributions goto yyexhaustedlab;
1428*c54f35caSApple OSS Distributions }
1429*c54f35caSApple OSS Distributions yystacksize *= 2;
1430*c54f35caSApple OSS Distributions if (YYMAXDEPTH < yystacksize) {
1431*c54f35caSApple OSS Distributions yystacksize = YYMAXDEPTH;
1432*c54f35caSApple OSS Distributions }
1433*c54f35caSApple OSS Distributions
1434*c54f35caSApple OSS Distributions {
1435*c54f35caSApple OSS Distributions yytype_int16 *yyss1 = yyss;
1436*c54f35caSApple OSS Distributions union yyalloc *yyptr =
1437*c54f35caSApple OSS Distributions (union yyalloc *) YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize));
1438*c54f35caSApple OSS Distributions if (!yyptr) {
1439*c54f35caSApple OSS Distributions goto yyexhaustedlab;
1440*c54f35caSApple OSS Distributions }
1441*c54f35caSApple OSS Distributions YYSTACK_RELOCATE(yyss);
1442*c54f35caSApple OSS Distributions YYSTACK_RELOCATE(yyvs);
1443*c54f35caSApple OSS Distributions
1444*c54f35caSApple OSS Distributions # undef YYSTACK_RELOCATE
1445*c54f35caSApple OSS Distributions if (yyss1 != yyssa) {
1446*c54f35caSApple OSS Distributions YYSTACK_FREE(yyss1);
1447*c54f35caSApple OSS Distributions }
1448*c54f35caSApple OSS Distributions }
1449*c54f35caSApple OSS Distributions # endif
1450*c54f35caSApple OSS Distributions #endif /* no yyoverflow */
1451*c54f35caSApple OSS Distributions
1452*c54f35caSApple OSS Distributions yyssp = yyss + yysize - 1;
1453*c54f35caSApple OSS Distributions yyvsp = yyvs + yysize - 1;
1454*c54f35caSApple OSS Distributions
1455*c54f35caSApple OSS Distributions
1456*c54f35caSApple OSS Distributions YYDPRINTF((stderr, "Stack size increased to %lu\n",
1457*c54f35caSApple OSS Distributions (unsigned long int) yystacksize));
1458*c54f35caSApple OSS Distributions
1459*c54f35caSApple OSS Distributions if (yyss + yystacksize - 1 <= yyssp) {
1460*c54f35caSApple OSS Distributions YYABORT;
1461*c54f35caSApple OSS Distributions }
1462*c54f35caSApple OSS Distributions }
1463*c54f35caSApple OSS Distributions
1464*c54f35caSApple OSS Distributions YYDPRINTF((stderr, "Entering state %d\n", yystate));
1465*c54f35caSApple OSS Distributions
1466*c54f35caSApple OSS Distributions goto yybackup;
1467*c54f35caSApple OSS Distributions
1468*c54f35caSApple OSS Distributions /*-----------.
1469*c54f35caSApple OSS Distributions | yybackup. |
1470*c54f35caSApple OSS Distributions | `-----------*/
1471*c54f35caSApple OSS Distributions yybackup:
1472*c54f35caSApple OSS Distributions
1473*c54f35caSApple OSS Distributions /* Do appropriate processing given the current state. Read a
1474*c54f35caSApple OSS Distributions * look-ahead token if we need one and don't already have one. */
1475*c54f35caSApple OSS Distributions
1476*c54f35caSApple OSS Distributions /* First try to decide what to do without reference to look-ahead token. */
1477*c54f35caSApple OSS Distributions yyn = yypact[yystate];
1478*c54f35caSApple OSS Distributions if (yyn == YYPACT_NINF) {
1479*c54f35caSApple OSS Distributions goto yydefault;
1480*c54f35caSApple OSS Distributions }
1481*c54f35caSApple OSS Distributions
1482*c54f35caSApple OSS Distributions /* Not known => get a look-ahead token if don't already have one. */
1483*c54f35caSApple OSS Distributions
1484*c54f35caSApple OSS Distributions /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1485*c54f35caSApple OSS Distributions if (yychar == YYEMPTY) {
1486*c54f35caSApple OSS Distributions YYDPRINTF((stderr, "Reading a token: "));
1487*c54f35caSApple OSS Distributions yychar = YYLEX;
1488*c54f35caSApple OSS Distributions }
1489*c54f35caSApple OSS Distributions
1490*c54f35caSApple OSS Distributions if (yychar <= YYEOF) {
1491*c54f35caSApple OSS Distributions yychar = yytoken = YYEOF;
1492*c54f35caSApple OSS Distributions YYDPRINTF((stderr, "Now at end of input.\n"));
1493*c54f35caSApple OSS Distributions } else {
1494*c54f35caSApple OSS Distributions yytoken = YYTRANSLATE(yychar);
1495*c54f35caSApple OSS Distributions YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc);
1496*c54f35caSApple OSS Distributions }
1497*c54f35caSApple OSS Distributions
1498*c54f35caSApple OSS Distributions /* If the proper action on seeing token YYTOKEN is to reduce or to
1499*c54f35caSApple OSS Distributions * detect an error, take that action. */
1500*c54f35caSApple OSS Distributions yyn += yytoken;
1501*c54f35caSApple OSS Distributions if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) {
1502*c54f35caSApple OSS Distributions goto yydefault;
1503*c54f35caSApple OSS Distributions }
1504*c54f35caSApple OSS Distributions yyn = yytable[yyn];
1505*c54f35caSApple OSS Distributions if (yyn <= 0) {
1506*c54f35caSApple OSS Distributions if (yyn == 0 || yyn == YYTABLE_NINF) {
1507*c54f35caSApple OSS Distributions goto yyerrlab;
1508*c54f35caSApple OSS Distributions }
1509*c54f35caSApple OSS Distributions yyn = -yyn;
1510*c54f35caSApple OSS Distributions goto yyreduce;
1511*c54f35caSApple OSS Distributions }
1512*c54f35caSApple OSS Distributions
1513*c54f35caSApple OSS Distributions if (yyn == YYFINAL) {
1514*c54f35caSApple OSS Distributions YYACCEPT;
1515*c54f35caSApple OSS Distributions }
1516*c54f35caSApple OSS Distributions
1517*c54f35caSApple OSS Distributions /* Count tokens shifted since error; after three, turn off error
1518*c54f35caSApple OSS Distributions * status. */
1519*c54f35caSApple OSS Distributions if (yyerrstatus) {
1520*c54f35caSApple OSS Distributions yyerrstatus--;
1521*c54f35caSApple OSS Distributions }
1522*c54f35caSApple OSS Distributions
1523*c54f35caSApple OSS Distributions /* Shift the look-ahead token. */
1524*c54f35caSApple OSS Distributions YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc);
1525*c54f35caSApple OSS Distributions
1526*c54f35caSApple OSS Distributions /* Discard the shifted token unless it is eof. */
1527*c54f35caSApple OSS Distributions if (yychar != YYEOF) {
1528*c54f35caSApple OSS Distributions yychar = YYEMPTY;
1529*c54f35caSApple OSS Distributions }
1530*c54f35caSApple OSS Distributions
1531*c54f35caSApple OSS Distributions yystate = yyn;
1532*c54f35caSApple OSS Distributions *++yyvsp = yylval;
1533*c54f35caSApple OSS Distributions
1534*c54f35caSApple OSS Distributions goto yynewstate;
1535*c54f35caSApple OSS Distributions
1536*c54f35caSApple OSS Distributions
1537*c54f35caSApple OSS Distributions /*-----------------------------------------------------------.
1538*c54f35caSApple OSS Distributions | yydefault -- do the default action for the current state. |
1539*c54f35caSApple OSS Distributions | `-----------------------------------------------------------*/
1540*c54f35caSApple OSS Distributions yydefault:
1541*c54f35caSApple OSS Distributions yyn = yydefact[yystate];
1542*c54f35caSApple OSS Distributions if (yyn == 0) {
1543*c54f35caSApple OSS Distributions goto yyerrlab;
1544*c54f35caSApple OSS Distributions }
1545*c54f35caSApple OSS Distributions goto yyreduce;
1546*c54f35caSApple OSS Distributions
1547*c54f35caSApple OSS Distributions
1548*c54f35caSApple OSS Distributions /*-----------------------------.
1549*c54f35caSApple OSS Distributions | yyreduce -- Do a reduction. |
1550*c54f35caSApple OSS Distributions | `-----------------------------*/
1551*c54f35caSApple OSS Distributions yyreduce:
1552*c54f35caSApple OSS Distributions /* yyn is the number of a rule to reduce with. */
1553*c54f35caSApple OSS Distributions yylen = yyr2[yyn];
1554*c54f35caSApple OSS Distributions
1555*c54f35caSApple OSS Distributions /* If YYLEN is nonzero, implement the default value of the action:
1556*c54f35caSApple OSS Distributions * `$$ = $1'.
1557*c54f35caSApple OSS Distributions *
1558*c54f35caSApple OSS Distributions * Otherwise, the following line sets YYVAL to garbage.
1559*c54f35caSApple OSS Distributions * This behavior is undocumented and Bison
1560*c54f35caSApple OSS Distributions * users should not rely upon it. Assigning to YYVAL
1561*c54f35caSApple OSS Distributions * unconditionally makes the parser a bit smaller, and it avoids a
1562*c54f35caSApple OSS Distributions * GCC warning that YYVAL may be used uninitialized. */
1563*c54f35caSApple OSS Distributions yyval = yyvsp[1 - yylen];
1564*c54f35caSApple OSS Distributions
1565*c54f35caSApple OSS Distributions
1566*c54f35caSApple OSS Distributions YY_REDUCE_PRINT(yyn);
1567*c54f35caSApple OSS Distributions switch (yyn) {
1568*c54f35caSApple OSS Distributions case 2:
1569*c54f35caSApple OSS Distributions #line 234 "OSUnserializeXML.y"
1570*c54f35caSApple OSS Distributions { yyerror("unexpected end of buffer");
1571*c54f35caSApple OSS Distributions YYERROR;
1572*c54f35caSApple OSS Distributions ;}
1573*c54f35caSApple OSS Distributions break;
1574*c54f35caSApple OSS Distributions
1575*c54f35caSApple OSS Distributions case 3:
1576*c54f35caSApple OSS Distributions #line 237 "OSUnserializeXML.y"
1577*c54f35caSApple OSS Distributions { STATE->parsedObject = (yyvsp[(1) - (1)])->object;
1578*c54f35caSApple OSS Distributions (yyvsp[(1) - (1)])->object = 0;
1579*c54f35caSApple OSS Distributions freeObject(STATE, (yyvsp[(1) - (1)]));
1580*c54f35caSApple OSS Distributions YYACCEPT;
1581*c54f35caSApple OSS Distributions ;}
1582*c54f35caSApple OSS Distributions break;
1583*c54f35caSApple OSS Distributions
1584*c54f35caSApple OSS Distributions case 4:
1585*c54f35caSApple OSS Distributions #line 242 "OSUnserializeXML.y"
1586*c54f35caSApple OSS Distributions { yyerror("syntax error");
1587*c54f35caSApple OSS Distributions YYERROR;
1588*c54f35caSApple OSS Distributions ;}
1589*c54f35caSApple OSS Distributions break;
1590*c54f35caSApple OSS Distributions
1591*c54f35caSApple OSS Distributions case 5:
1592*c54f35caSApple OSS Distributions #line 247 "OSUnserializeXML.y"
1593*c54f35caSApple OSS Distributions { (yyval) = buildDictionary(STATE, (yyvsp[(1) - (1)]));
1594*c54f35caSApple OSS Distributions
1595*c54f35caSApple OSS Distributions if (!yyval->object) {
1596*c54f35caSApple OSS Distributions yyerror("buildDictionary");
1597*c54f35caSApple OSS Distributions YYERROR;
1598*c54f35caSApple OSS Distributions }
1599*c54f35caSApple OSS Distributions STATE->parsedObjectCount++;
1600*c54f35caSApple OSS Distributions if (STATE->parsedObjectCount > MAX_OBJECTS) {
1601*c54f35caSApple OSS Distributions yyerror("maximum object count");
1602*c54f35caSApple OSS Distributions YYERROR;
1603*c54f35caSApple OSS Distributions }
1604*c54f35caSApple OSS Distributions ;}
1605*c54f35caSApple OSS Distributions break;
1606*c54f35caSApple OSS Distributions
1607*c54f35caSApple OSS Distributions case 6:
1608*c54f35caSApple OSS Distributions #line 259 "OSUnserializeXML.y"
1609*c54f35caSApple OSS Distributions { (yyval) = buildArray(STATE, (yyvsp[(1) - (1)]));
1610*c54f35caSApple OSS Distributions
1611*c54f35caSApple OSS Distributions if (!yyval->object) {
1612*c54f35caSApple OSS Distributions yyerror("buildArray");
1613*c54f35caSApple OSS Distributions YYERROR;
1614*c54f35caSApple OSS Distributions }
1615*c54f35caSApple OSS Distributions STATE->parsedObjectCount++;
1616*c54f35caSApple OSS Distributions if (STATE->parsedObjectCount > MAX_OBJECTS) {
1617*c54f35caSApple OSS Distributions yyerror("maximum object count");
1618*c54f35caSApple OSS Distributions YYERROR;
1619*c54f35caSApple OSS Distributions }
1620*c54f35caSApple OSS Distributions ;}
1621*c54f35caSApple OSS Distributions break;
1622*c54f35caSApple OSS Distributions
1623*c54f35caSApple OSS Distributions case 7:
1624*c54f35caSApple OSS Distributions #line 271 "OSUnserializeXML.y"
1625*c54f35caSApple OSS Distributions { (yyval) = buildSet(STATE, (yyvsp[(1) - (1)]));
1626*c54f35caSApple OSS Distributions
1627*c54f35caSApple OSS Distributions if (!yyval->object) {
1628*c54f35caSApple OSS Distributions yyerror("buildSet");
1629*c54f35caSApple OSS Distributions YYERROR;
1630*c54f35caSApple OSS Distributions }
1631*c54f35caSApple OSS Distributions STATE->parsedObjectCount++;
1632*c54f35caSApple OSS Distributions if (STATE->parsedObjectCount > MAX_OBJECTS) {
1633*c54f35caSApple OSS Distributions yyerror("maximum object count");
1634*c54f35caSApple OSS Distributions YYERROR;
1635*c54f35caSApple OSS Distributions }
1636*c54f35caSApple OSS Distributions ;}
1637*c54f35caSApple OSS Distributions break;
1638*c54f35caSApple OSS Distributions
1639*c54f35caSApple OSS Distributions case 8:
1640*c54f35caSApple OSS Distributions #line 283 "OSUnserializeXML.y"
1641*c54f35caSApple OSS Distributions { (yyval) = buildString(STATE, (yyvsp[(1) - (1)]));
1642*c54f35caSApple OSS Distributions
1643*c54f35caSApple OSS Distributions if (!yyval->object) {
1644*c54f35caSApple OSS Distributions yyerror("buildString");
1645*c54f35caSApple OSS Distributions YYERROR;
1646*c54f35caSApple OSS Distributions }
1647*c54f35caSApple OSS Distributions STATE->parsedObjectCount++;
1648*c54f35caSApple OSS Distributions if (STATE->parsedObjectCount > MAX_OBJECTS) {
1649*c54f35caSApple OSS Distributions yyerror("maximum object count");
1650*c54f35caSApple OSS Distributions YYERROR;
1651*c54f35caSApple OSS Distributions }
1652*c54f35caSApple OSS Distributions ;}
1653*c54f35caSApple OSS Distributions break;
1654*c54f35caSApple OSS Distributions
1655*c54f35caSApple OSS Distributions case 9:
1656*c54f35caSApple OSS Distributions #line 295 "OSUnserializeXML.y"
1657*c54f35caSApple OSS Distributions { (yyval) = buildData(STATE, (yyvsp[(1) - (1)]));
1658*c54f35caSApple OSS Distributions
1659*c54f35caSApple OSS Distributions if (!yyval->object) {
1660*c54f35caSApple OSS Distributions yyerror("buildData");
1661*c54f35caSApple OSS Distributions YYERROR;
1662*c54f35caSApple OSS Distributions }
1663*c54f35caSApple OSS Distributions STATE->parsedObjectCount++;
1664*c54f35caSApple OSS Distributions if (STATE->parsedObjectCount > MAX_OBJECTS) {
1665*c54f35caSApple OSS Distributions yyerror("maximum object count");
1666*c54f35caSApple OSS Distributions YYERROR;
1667*c54f35caSApple OSS Distributions }
1668*c54f35caSApple OSS Distributions ;}
1669*c54f35caSApple OSS Distributions break;
1670*c54f35caSApple OSS Distributions
1671*c54f35caSApple OSS Distributions case 10:
1672*c54f35caSApple OSS Distributions #line 307 "OSUnserializeXML.y"
1673*c54f35caSApple OSS Distributions { (yyval) = buildNumber(STATE, (yyvsp[(1) - (1)]));
1674*c54f35caSApple OSS Distributions
1675*c54f35caSApple OSS Distributions if (!yyval->object) {
1676*c54f35caSApple OSS Distributions yyerror("buildNumber");
1677*c54f35caSApple OSS Distributions YYERROR;
1678*c54f35caSApple OSS Distributions }
1679*c54f35caSApple OSS Distributions STATE->parsedObjectCount++;
1680*c54f35caSApple OSS Distributions if (STATE->parsedObjectCount > MAX_OBJECTS) {
1681*c54f35caSApple OSS Distributions yyerror("maximum object count");
1682*c54f35caSApple OSS Distributions YYERROR;
1683*c54f35caSApple OSS Distributions }
1684*c54f35caSApple OSS Distributions ;}
1685*c54f35caSApple OSS Distributions break;
1686*c54f35caSApple OSS Distributions
1687*c54f35caSApple OSS Distributions case 11:
1688*c54f35caSApple OSS Distributions #line 319 "OSUnserializeXML.y"
1689*c54f35caSApple OSS Distributions { (yyval) = buildBoolean(STATE, (yyvsp[(1) - (1)]));
1690*c54f35caSApple OSS Distributions
1691*c54f35caSApple OSS Distributions if (!yyval->object) {
1692*c54f35caSApple OSS Distributions yyerror("buildBoolean");
1693*c54f35caSApple OSS Distributions YYERROR;
1694*c54f35caSApple OSS Distributions }
1695*c54f35caSApple OSS Distributions STATE->parsedObjectCount++;
1696*c54f35caSApple OSS Distributions if (STATE->parsedObjectCount > MAX_OBJECTS) {
1697*c54f35caSApple OSS Distributions yyerror("maximum object count");
1698*c54f35caSApple OSS Distributions YYERROR;
1699*c54f35caSApple OSS Distributions }
1700*c54f35caSApple OSS Distributions ;}
1701*c54f35caSApple OSS Distributions break;
1702*c54f35caSApple OSS Distributions
1703*c54f35caSApple OSS Distributions case 12:
1704*c54f35caSApple OSS Distributions #line 331 "OSUnserializeXML.y"
1705*c54f35caSApple OSS Distributions { (yyval) = retrieveObject(STATE, (yyvsp[(1) - (1)])->idref);
1706*c54f35caSApple OSS Distributions if ((yyval)) {
1707*c54f35caSApple OSS Distributions STATE->retrievedObjectCount++;
1708*c54f35caSApple OSS Distributions (yyval)->object->retain();
1709*c54f35caSApple OSS Distributions if (STATE->retrievedObjectCount > MAX_REFED_OBJECTS) {
1710*c54f35caSApple OSS Distributions yyerror("maximum object reference count");
1711*c54f35caSApple OSS Distributions YYERROR;
1712*c54f35caSApple OSS Distributions }
1713*c54f35caSApple OSS Distributions } else {
1714*c54f35caSApple OSS Distributions yyerror("forward reference detected");
1715*c54f35caSApple OSS Distributions YYERROR;
1716*c54f35caSApple OSS Distributions }
1717*c54f35caSApple OSS Distributions freeObject(STATE, (yyvsp[(1) - (1)]));
1718*c54f35caSApple OSS Distributions
1719*c54f35caSApple OSS Distributions STATE->parsedObjectCount++;
1720*c54f35caSApple OSS Distributions if (STATE->parsedObjectCount > MAX_OBJECTS) {
1721*c54f35caSApple OSS Distributions yyerror("maximum object count");
1722*c54f35caSApple OSS Distributions YYERROR;
1723*c54f35caSApple OSS Distributions }
1724*c54f35caSApple OSS Distributions ;}
1725*c54f35caSApple OSS Distributions break;
1726*c54f35caSApple OSS Distributions
1727*c54f35caSApple OSS Distributions case 13:
1728*c54f35caSApple OSS Distributions #line 355 "OSUnserializeXML.y"
1729*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(1) - (2)]);
1730*c54f35caSApple OSS Distributions (yyval)->elements = NULL;
1731*c54f35caSApple OSS Distributions ;}
1732*c54f35caSApple OSS Distributions break;
1733*c54f35caSApple OSS Distributions
1734*c54f35caSApple OSS Distributions case 14:
1735*c54f35caSApple OSS Distributions #line 358 "OSUnserializeXML.y"
1736*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(1) - (3)]);
1737*c54f35caSApple OSS Distributions (yyval)->elements = (yyvsp[(2) - (3)]);
1738*c54f35caSApple OSS Distributions ;}
1739*c54f35caSApple OSS Distributions break;
1740*c54f35caSApple OSS Distributions
1741*c54f35caSApple OSS Distributions case 17:
1742*c54f35caSApple OSS Distributions #line 365 "OSUnserializeXML.y"
1743*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(2) - (2)]);
1744*c54f35caSApple OSS Distributions (yyval)->next = (yyvsp[(1) - (2)]);
1745*c54f35caSApple OSS Distributions
1746*c54f35caSApple OSS Distributions object_t *o;
1747*c54f35caSApple OSS Distributions o = (yyval)->next;
1748*c54f35caSApple OSS Distributions while (o) {
1749*c54f35caSApple OSS Distributions if (o->key == (yyval)->key) {
1750*c54f35caSApple OSS Distributions yyerror("duplicate dictionary key");
1751*c54f35caSApple OSS Distributions YYERROR;
1752*c54f35caSApple OSS Distributions }
1753*c54f35caSApple OSS Distributions o = o->next;
1754*c54f35caSApple OSS Distributions }
1755*c54f35caSApple OSS Distributions ;}
1756*c54f35caSApple OSS Distributions break;
1757*c54f35caSApple OSS Distributions
1758*c54f35caSApple OSS Distributions case 18:
1759*c54f35caSApple OSS Distributions #line 380 "OSUnserializeXML.y"
1760*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(1) - (2)]);
1761*c54f35caSApple OSS Distributions (yyval)->key = (OSSymbol *)(yyval)->object;
1762*c54f35caSApple OSS Distributions (yyval)->object = (yyvsp[(2) - (2)])->object;
1763*c54f35caSApple OSS Distributions (yyval)->next = NULL;
1764*c54f35caSApple OSS Distributions (yyvsp[(2) - (2)])->object = 0;
1765*c54f35caSApple OSS Distributions freeObject(STATE, (yyvsp[(2) - (2)]));
1766*c54f35caSApple OSS Distributions ;}
1767*c54f35caSApple OSS Distributions break;
1768*c54f35caSApple OSS Distributions
1769*c54f35caSApple OSS Distributions case 19:
1770*c54f35caSApple OSS Distributions #line 389 "OSUnserializeXML.y"
1771*c54f35caSApple OSS Distributions { (yyval) = buildSymbol(STATE, (yyvsp[(1) - (1)]));
1772*c54f35caSApple OSS Distributions
1773*c54f35caSApple OSS Distributions // STATE->parsedObjectCount++;
1774*c54f35caSApple OSS Distributions // if (STATE->parsedObjectCount > MAX_OBJECTS) {
1775*c54f35caSApple OSS Distributions // yyerror("maximum object count");
1776*c54f35caSApple OSS Distributions // YYERROR;
1777*c54f35caSApple OSS Distributions // }
1778*c54f35caSApple OSS Distributions ;}
1779*c54f35caSApple OSS Distributions break;
1780*c54f35caSApple OSS Distributions
1781*c54f35caSApple OSS Distributions case 20:
1782*c54f35caSApple OSS Distributions #line 401 "OSUnserializeXML.y"
1783*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(1) - (2)]);
1784*c54f35caSApple OSS Distributions (yyval)->elements = NULL;
1785*c54f35caSApple OSS Distributions ;}
1786*c54f35caSApple OSS Distributions break;
1787*c54f35caSApple OSS Distributions
1788*c54f35caSApple OSS Distributions case 21:
1789*c54f35caSApple OSS Distributions #line 404 "OSUnserializeXML.y"
1790*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(1) - (3)]);
1791*c54f35caSApple OSS Distributions (yyval)->elements = (yyvsp[(2) - (3)]);
1792*c54f35caSApple OSS Distributions ;}
1793*c54f35caSApple OSS Distributions break;
1794*c54f35caSApple OSS Distributions
1795*c54f35caSApple OSS Distributions case 23:
1796*c54f35caSApple OSS Distributions #line 410 "OSUnserializeXML.y"
1797*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(1) - (2)]);
1798*c54f35caSApple OSS Distributions (yyval)->elements = NULL;
1799*c54f35caSApple OSS Distributions ;}
1800*c54f35caSApple OSS Distributions break;
1801*c54f35caSApple OSS Distributions
1802*c54f35caSApple OSS Distributions case 24:
1803*c54f35caSApple OSS Distributions #line 413 "OSUnserializeXML.y"
1804*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(1) - (3)]);
1805*c54f35caSApple OSS Distributions (yyval)->elements = (yyvsp[(2) - (3)]);
1806*c54f35caSApple OSS Distributions ;}
1807*c54f35caSApple OSS Distributions break;
1808*c54f35caSApple OSS Distributions
1809*c54f35caSApple OSS Distributions case 26:
1810*c54f35caSApple OSS Distributions #line 419 "OSUnserializeXML.y"
1811*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(1) - (1)]);
1812*c54f35caSApple OSS Distributions (yyval)->next = NULL;
1813*c54f35caSApple OSS Distributions ;}
1814*c54f35caSApple OSS Distributions break;
1815*c54f35caSApple OSS Distributions
1816*c54f35caSApple OSS Distributions case 27:
1817*c54f35caSApple OSS Distributions #line 422 "OSUnserializeXML.y"
1818*c54f35caSApple OSS Distributions { (yyval) = (yyvsp[(2) - (2)]);
1819*c54f35caSApple OSS Distributions (yyval)->next = (yyvsp[(1) - (2)]);
1820*c54f35caSApple OSS Distributions ;}
1821*c54f35caSApple OSS Distributions break;
1822*c54f35caSApple OSS Distributions
1823*c54f35caSApple OSS Distributions
1824*c54f35caSApple OSS Distributions /* Line 1267 of yacc.c. */
1825*c54f35caSApple OSS Distributions #line 1789 "OSUnserializeXML.tab.c"
1826*c54f35caSApple OSS Distributions default: break;
1827*c54f35caSApple OSS Distributions }
1828*c54f35caSApple OSS Distributions YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1829*c54f35caSApple OSS Distributions
1830*c54f35caSApple OSS Distributions YYPOPSTACK(yylen);
1831*c54f35caSApple OSS Distributions yylen = 0;
1832*c54f35caSApple OSS Distributions YY_STACK_PRINT(yyss, yyssp);
1833*c54f35caSApple OSS Distributions
1834*c54f35caSApple OSS Distributions *++yyvsp = yyval;
1835*c54f35caSApple OSS Distributions
1836*c54f35caSApple OSS Distributions
1837*c54f35caSApple OSS Distributions /* Now `shift' the result of the reduction. Determine what state
1838*c54f35caSApple OSS Distributions * that goes to, based on the state we popped back to and the rule
1839*c54f35caSApple OSS Distributions * number reduced by. */
1840*c54f35caSApple OSS Distributions
1841*c54f35caSApple OSS Distributions yyn = yyr1[yyn];
1842*c54f35caSApple OSS Distributions
1843*c54f35caSApple OSS Distributions yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1844*c54f35caSApple OSS Distributions if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) {
1845*c54f35caSApple OSS Distributions yystate = yytable[yystate];
1846*c54f35caSApple OSS Distributions } else {
1847*c54f35caSApple OSS Distributions yystate = yydefgoto[yyn - YYNTOKENS];
1848*c54f35caSApple OSS Distributions }
1849*c54f35caSApple OSS Distributions
1850*c54f35caSApple OSS Distributions goto yynewstate;
1851*c54f35caSApple OSS Distributions
1852*c54f35caSApple OSS Distributions
1853*c54f35caSApple OSS Distributions /*------------------------------------.
1854*c54f35caSApple OSS Distributions | yyerrlab -- here on detecting error |
1855*c54f35caSApple OSS Distributions | `------------------------------------*/
1856*c54f35caSApple OSS Distributions yyerrlab:
1857*c54f35caSApple OSS Distributions /* If not already recovering from an error, report this error. */
1858*c54f35caSApple OSS Distributions if (!yyerrstatus) {
1859*c54f35caSApple OSS Distributions ++yynerrs;
1860*c54f35caSApple OSS Distributions #if !YYERROR_VERBOSE
1861*c54f35caSApple OSS Distributions yyerror(YY_("syntax error"));
1862*c54f35caSApple OSS Distributions #else
1863*c54f35caSApple OSS Distributions {
1864*c54f35caSApple OSS Distributions YYSIZE_T yysize = yysyntax_error(0, yystate, yychar);
1865*c54f35caSApple OSS Distributions if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) {
1866*c54f35caSApple OSS Distributions YYSIZE_T yyalloc = 2 * yysize;
1867*c54f35caSApple OSS Distributions if (!(yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) {
1868*c54f35caSApple OSS Distributions yyalloc = YYSTACK_ALLOC_MAXIMUM;
1869*c54f35caSApple OSS Distributions }
1870*c54f35caSApple OSS Distributions if (yymsg != yymsgbuf) {
1871*c54f35caSApple OSS Distributions YYSTACK_FREE(yymsg);
1872*c54f35caSApple OSS Distributions }
1873*c54f35caSApple OSS Distributions yymsg = (char *) YYSTACK_ALLOC(yyalloc);
1874*c54f35caSApple OSS Distributions if (yymsg) {
1875*c54f35caSApple OSS Distributions yymsg_alloc = yyalloc;
1876*c54f35caSApple OSS Distributions } else {
1877*c54f35caSApple OSS Distributions yymsg = yymsgbuf;
1878*c54f35caSApple OSS Distributions yymsg_alloc = sizeof yymsgbuf;
1879*c54f35caSApple OSS Distributions }
1880*c54f35caSApple OSS Distributions }
1881*c54f35caSApple OSS Distributions
1882*c54f35caSApple OSS Distributions if (0 < yysize && yysize <= yymsg_alloc) {
1883*c54f35caSApple OSS Distributions (void) yysyntax_error(yymsg, yystate, yychar);
1884*c54f35caSApple OSS Distributions yyerror(yymsg);
1885*c54f35caSApple OSS Distributions } else {
1886*c54f35caSApple OSS Distributions yyerror(YY_("syntax error"));
1887*c54f35caSApple OSS Distributions if (yysize != 0) {
1888*c54f35caSApple OSS Distributions goto yyexhaustedlab;
1889*c54f35caSApple OSS Distributions }
1890*c54f35caSApple OSS Distributions }
1891*c54f35caSApple OSS Distributions }
1892*c54f35caSApple OSS Distributions #endif
1893*c54f35caSApple OSS Distributions }
1894*c54f35caSApple OSS Distributions
1895*c54f35caSApple OSS Distributions
1896*c54f35caSApple OSS Distributions
1897*c54f35caSApple OSS Distributions if (yyerrstatus == 3) {
1898*c54f35caSApple OSS Distributions /* If just tried and failed to reuse look-ahead token after an
1899*c54f35caSApple OSS Distributions * error, discard it. */
1900*c54f35caSApple OSS Distributions
1901*c54f35caSApple OSS Distributions if (yychar <= YYEOF) {
1902*c54f35caSApple OSS Distributions /* Return failure if at end of input. */
1903*c54f35caSApple OSS Distributions if (yychar == YYEOF) {
1904*c54f35caSApple OSS Distributions YYABORT;
1905*c54f35caSApple OSS Distributions }
1906*c54f35caSApple OSS Distributions } else {
1907*c54f35caSApple OSS Distributions yydestruct("Error: discarding",
1908*c54f35caSApple OSS Distributions yytoken, &yylval);
1909*c54f35caSApple OSS Distributions yychar = YYEMPTY;
1910*c54f35caSApple OSS Distributions }
1911*c54f35caSApple OSS Distributions }
1912*c54f35caSApple OSS Distributions
1913*c54f35caSApple OSS Distributions /* Else will try to reuse look-ahead token after shifting the error
1914*c54f35caSApple OSS Distributions * token. */
1915*c54f35caSApple OSS Distributions goto yyerrlab1;
1916*c54f35caSApple OSS Distributions
1917*c54f35caSApple OSS Distributions
1918*c54f35caSApple OSS Distributions /*---------------------------------------------------.
1919*c54f35caSApple OSS Distributions | yyerrorlab -- error raised explicitly by YYERROR. |
1920*c54f35caSApple OSS Distributions | `---------------------------------------------------*/
1921*c54f35caSApple OSS Distributions yyerrorlab:
1922*c54f35caSApple OSS Distributions
1923*c54f35caSApple OSS Distributions /* Pacify compilers like GCC when the user code never invokes
1924*c54f35caSApple OSS Distributions * YYERROR and the label yyerrorlab therefore never appears in user
1925*c54f35caSApple OSS Distributions * code. */
1926*c54f35caSApple OSS Distributions if (/*CONSTCOND*/ 0) {
1927*c54f35caSApple OSS Distributions goto yyerrorlab;
1928*c54f35caSApple OSS Distributions }
1929*c54f35caSApple OSS Distributions
1930*c54f35caSApple OSS Distributions /* Do not reclaim the symbols of the rule which action triggered
1931*c54f35caSApple OSS Distributions * this YYERROR. */
1932*c54f35caSApple OSS Distributions YYPOPSTACK(yylen);
1933*c54f35caSApple OSS Distributions yylen = 0;
1934*c54f35caSApple OSS Distributions YY_STACK_PRINT(yyss, yyssp);
1935*c54f35caSApple OSS Distributions yystate = *yyssp;
1936*c54f35caSApple OSS Distributions goto yyerrlab1;
1937*c54f35caSApple OSS Distributions
1938*c54f35caSApple OSS Distributions
1939*c54f35caSApple OSS Distributions /*-------------------------------------------------------------.
1940*c54f35caSApple OSS Distributions | yyerrlab1 -- common code for both syntax error and YYERROR. |
1941*c54f35caSApple OSS Distributions | `-------------------------------------------------------------*/
1942*c54f35caSApple OSS Distributions yyerrlab1:
1943*c54f35caSApple OSS Distributions yyerrstatus = 3; /* Each real token shifted decrements this. */
1944*c54f35caSApple OSS Distributions
1945*c54f35caSApple OSS Distributions for (;;) {
1946*c54f35caSApple OSS Distributions yyn = yypact[yystate];
1947*c54f35caSApple OSS Distributions if (yyn != YYPACT_NINF) {
1948*c54f35caSApple OSS Distributions yyn += YYTERROR;
1949*c54f35caSApple OSS Distributions if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) {
1950*c54f35caSApple OSS Distributions yyn = yytable[yyn];
1951*c54f35caSApple OSS Distributions if (0 < yyn) {
1952*c54f35caSApple OSS Distributions break;
1953*c54f35caSApple OSS Distributions }
1954*c54f35caSApple OSS Distributions }
1955*c54f35caSApple OSS Distributions }
1956*c54f35caSApple OSS Distributions
1957*c54f35caSApple OSS Distributions /* Pop the current state because it cannot handle the error token. */
1958*c54f35caSApple OSS Distributions if (yyssp == yyss) {
1959*c54f35caSApple OSS Distributions YYABORT;
1960*c54f35caSApple OSS Distributions }
1961*c54f35caSApple OSS Distributions
1962*c54f35caSApple OSS Distributions
1963*c54f35caSApple OSS Distributions yydestruct("Error: popping",
1964*c54f35caSApple OSS Distributions yystos[yystate], yyvsp);
1965*c54f35caSApple OSS Distributions YYPOPSTACK(1);
1966*c54f35caSApple OSS Distributions yystate = *yyssp;
1967*c54f35caSApple OSS Distributions YY_STACK_PRINT(yyss, yyssp);
1968*c54f35caSApple OSS Distributions }
1969*c54f35caSApple OSS Distributions
1970*c54f35caSApple OSS Distributions if (yyn == YYFINAL) {
1971*c54f35caSApple OSS Distributions YYACCEPT;
1972*c54f35caSApple OSS Distributions }
1973*c54f35caSApple OSS Distributions
1974*c54f35caSApple OSS Distributions *++yyvsp = yylval;
1975*c54f35caSApple OSS Distributions
1976*c54f35caSApple OSS Distributions
1977*c54f35caSApple OSS Distributions /* Shift the error token. */
1978*c54f35caSApple OSS Distributions YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp);
1979*c54f35caSApple OSS Distributions
1980*c54f35caSApple OSS Distributions yystate = yyn;
1981*c54f35caSApple OSS Distributions goto yynewstate;
1982*c54f35caSApple OSS Distributions
1983*c54f35caSApple OSS Distributions
1984*c54f35caSApple OSS Distributions /*-------------------------------------.
1985*c54f35caSApple OSS Distributions | yyacceptlab -- YYACCEPT comes here. |
1986*c54f35caSApple OSS Distributions | `-------------------------------------*/
1987*c54f35caSApple OSS Distributions yyacceptlab:
1988*c54f35caSApple OSS Distributions yyresult = 0;
1989*c54f35caSApple OSS Distributions goto yyreturn;
1990*c54f35caSApple OSS Distributions
1991*c54f35caSApple OSS Distributions /*-----------------------------------.
1992*c54f35caSApple OSS Distributions | yyabortlab -- YYABORT comes here. |
1993*c54f35caSApple OSS Distributions | `-----------------------------------*/
1994*c54f35caSApple OSS Distributions yyabortlab:
1995*c54f35caSApple OSS Distributions yyresult = 1;
1996*c54f35caSApple OSS Distributions goto yyreturn;
1997*c54f35caSApple OSS Distributions
1998*c54f35caSApple OSS Distributions #ifndef yyoverflow
1999*c54f35caSApple OSS Distributions /*-------------------------------------------------.
2000*c54f35caSApple OSS Distributions | yyexhaustedlab -- memory exhaustion comes here. |
2001*c54f35caSApple OSS Distributions | `-------------------------------------------------*/
2002*c54f35caSApple OSS Distributions yyexhaustedlab:
2003*c54f35caSApple OSS Distributions yyerror(YY_("memory exhausted"));
2004*c54f35caSApple OSS Distributions yyresult = 2;
2005*c54f35caSApple OSS Distributions /* Fall through. */
2006*c54f35caSApple OSS Distributions #endif
2007*c54f35caSApple OSS Distributions
2008*c54f35caSApple OSS Distributions yyreturn:
2009*c54f35caSApple OSS Distributions if (yychar != YYEOF && yychar != YYEMPTY) {
2010*c54f35caSApple OSS Distributions yydestruct("Cleanup: discarding lookahead",
2011*c54f35caSApple OSS Distributions yytoken, &yylval);
2012*c54f35caSApple OSS Distributions }
2013*c54f35caSApple OSS Distributions /* Do not reclaim the symbols of the rule which action triggered
2014*c54f35caSApple OSS Distributions * this YYABORT or YYACCEPT. */
2015*c54f35caSApple OSS Distributions YYPOPSTACK(yylen);
2016*c54f35caSApple OSS Distributions YY_STACK_PRINT(yyss, yyssp);
2017*c54f35caSApple OSS Distributions while (yyssp != yyss) {
2018*c54f35caSApple OSS Distributions yydestruct("Cleanup: popping",
2019*c54f35caSApple OSS Distributions yystos[*yyssp], yyvsp);
2020*c54f35caSApple OSS Distributions YYPOPSTACK(1);
2021*c54f35caSApple OSS Distributions }
2022*c54f35caSApple OSS Distributions #ifndef yyoverflow
2023*c54f35caSApple OSS Distributions if (yyss != yyssa) {
2024*c54f35caSApple OSS Distributions YYSTACK_FREE(yyss);
2025*c54f35caSApple OSS Distributions }
2026*c54f35caSApple OSS Distributions #endif
2027*c54f35caSApple OSS Distributions #if YYERROR_VERBOSE
2028*c54f35caSApple OSS Distributions if (yymsg != yymsgbuf) {
2029*c54f35caSApple OSS Distributions YYSTACK_FREE(yymsg);
2030*c54f35caSApple OSS Distributions }
2031*c54f35caSApple OSS Distributions #endif
2032*c54f35caSApple OSS Distributions /* Make sure YYID is used. */
2033*c54f35caSApple OSS Distributions return YYID(yyresult);
2034*c54f35caSApple OSS Distributions }
2035*c54f35caSApple OSS Distributions
2036*c54f35caSApple OSS Distributions
2037*c54f35caSApple OSS Distributions #line 444 "OSUnserializeXML.y"
2038*c54f35caSApple OSS Distributions
2039*c54f35caSApple OSS Distributions
2040*c54f35caSApple OSS Distributions int
OSUnserializeerror(parser_state_t * state,const char * s)2041*c54f35caSApple OSS Distributions OSUnserializeerror(parser_state_t * state, const char *s) /* Called by yyparse on errors */
2042*c54f35caSApple OSS Distributions {
2043*c54f35caSApple OSS Distributions if (state->errorString) {
2044*c54f35caSApple OSS Distributions char tempString[128];
2045*c54f35caSApple OSS Distributions snprintf(tempString, 128, "OSUnserializeXML: %s near line %d\n", s, state->lineNumber);
2046*c54f35caSApple OSS Distributions *(state->errorString) = OSString::withCString(tempString);
2047*c54f35caSApple OSS Distributions }
2048*c54f35caSApple OSS Distributions
2049*c54f35caSApple OSS Distributions return 0;
2050*c54f35caSApple OSS Distributions }
2051*c54f35caSApple OSS Distributions
2052*c54f35caSApple OSS Distributions #define TAG_MAX_LENGTH 32
2053*c54f35caSApple OSS Distributions #define TAG_MAX_ATTRIBUTES 32
2054*c54f35caSApple OSS Distributions #define TAG_BAD 0
2055*c54f35caSApple OSS Distributions #define TAG_START 1
2056*c54f35caSApple OSS Distributions #define TAG_END 2
2057*c54f35caSApple OSS Distributions #define TAG_EMPTY 3
2058*c54f35caSApple OSS Distributions #define TAG_IGNORE 4
2059*c54f35caSApple OSS Distributions
2060*c54f35caSApple OSS Distributions #define currentChar() (state->parseBuffer[state->parseBufferIndex])
2061*c54f35caSApple OSS Distributions #define nextChar() (state->parseBuffer[++state->parseBufferIndex])
2062*c54f35caSApple OSS Distributions #define prevChar() (state->parseBuffer[state->parseBufferIndex - 1])
2063*c54f35caSApple OSS Distributions
2064*c54f35caSApple OSS Distributions #define isSpace(c) ((c) == ' ' || (c) == '\t')
2065*c54f35caSApple OSS Distributions #define isAlpha(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
2066*c54f35caSApple OSS Distributions #define isDigit(c) ((c) >= '0' && (c) <= '9')
2067*c54f35caSApple OSS Distributions #define isAlphaDigit(c) ((c) >= 'a' && (c) <= 'f')
2068*c54f35caSApple OSS Distributions #define isHexDigit(c) (isDigit(c) || isAlphaDigit(c))
2069*c54f35caSApple OSS Distributions #define isAlphaNumeric(c) (isAlpha(c) || isDigit(c) || ((c) == '-'))
2070*c54f35caSApple OSS Distributions
2071*c54f35caSApple OSS Distributions static int
getTag(parser_state_t * state,char tag[TAG_MAX_LENGTH],int * attributeCount,char attributes[TAG_MAX_ATTRIBUTES][TAG_MAX_LENGTH],char values[TAG_MAX_ATTRIBUTES][TAG_MAX_LENGTH])2072*c54f35caSApple OSS Distributions getTag(parser_state_t *state,
2073*c54f35caSApple OSS Distributions char tag[TAG_MAX_LENGTH],
2074*c54f35caSApple OSS Distributions int *attributeCount,
2075*c54f35caSApple OSS Distributions char attributes[TAG_MAX_ATTRIBUTES][TAG_MAX_LENGTH],
2076*c54f35caSApple OSS Distributions char values[TAG_MAX_ATTRIBUTES][TAG_MAX_LENGTH] )
2077*c54f35caSApple OSS Distributions {
2078*c54f35caSApple OSS Distributions int length = 0;
2079*c54f35caSApple OSS Distributions int c = currentChar();
2080*c54f35caSApple OSS Distributions int tagType = TAG_START;
2081*c54f35caSApple OSS Distributions
2082*c54f35caSApple OSS Distributions *attributeCount = 0;
2083*c54f35caSApple OSS Distributions
2084*c54f35caSApple OSS Distributions if (c != '<') {
2085*c54f35caSApple OSS Distributions return TAG_BAD;
2086*c54f35caSApple OSS Distributions }
2087*c54f35caSApple OSS Distributions c = nextChar(); // skip '<'
2088*c54f35caSApple OSS Distributions
2089*c54f35caSApple OSS Distributions
2090*c54f35caSApple OSS Distributions // <!TAG declarations >
2091*c54f35caSApple OSS Distributions // <!-- comments -->
2092*c54f35caSApple OSS Distributions if (c == '!') {
2093*c54f35caSApple OSS Distributions c = nextChar();
2094*c54f35caSApple OSS Distributions bool isComment = (c == '-') && ((c = nextChar()) != 0) && (c == '-');
2095*c54f35caSApple OSS Distributions if (!isComment && !isAlpha(c)) {
2096*c54f35caSApple OSS Distributions return TAG_BAD; // <!1, <!-A, <!eos
2097*c54f35caSApple OSS Distributions }
2098*c54f35caSApple OSS Distributions while (c && (c = nextChar()) != 0) {
2099*c54f35caSApple OSS Distributions if (c == '\n') {
2100*c54f35caSApple OSS Distributions state->lineNumber++;
2101*c54f35caSApple OSS Distributions }
2102*c54f35caSApple OSS Distributions if (isComment) {
2103*c54f35caSApple OSS Distributions if (c != '-') {
2104*c54f35caSApple OSS Distributions continue;
2105*c54f35caSApple OSS Distributions }
2106*c54f35caSApple OSS Distributions c = nextChar();
2107*c54f35caSApple OSS Distributions if (c != '-') {
2108*c54f35caSApple OSS Distributions continue;
2109*c54f35caSApple OSS Distributions }
2110*c54f35caSApple OSS Distributions c = nextChar();
2111*c54f35caSApple OSS Distributions }
2112*c54f35caSApple OSS Distributions if (c == '>') {
2113*c54f35caSApple OSS Distributions (void)nextChar();
2114*c54f35caSApple OSS Distributions return TAG_IGNORE;
2115*c54f35caSApple OSS Distributions }
2116*c54f35caSApple OSS Distributions if (isComment) {
2117*c54f35caSApple OSS Distributions break;
2118*c54f35caSApple OSS Distributions }
2119*c54f35caSApple OSS Distributions }
2120*c54f35caSApple OSS Distributions return TAG_BAD;
2121*c54f35caSApple OSS Distributions } else
2122*c54f35caSApple OSS Distributions // <? Processing Instructions ?>
2123*c54f35caSApple OSS Distributions if (c == '?') {
2124*c54f35caSApple OSS Distributions while ((c = nextChar()) != 0) {
2125*c54f35caSApple OSS Distributions if (c == '\n') {
2126*c54f35caSApple OSS Distributions state->lineNumber++;
2127*c54f35caSApple OSS Distributions }
2128*c54f35caSApple OSS Distributions if (c != '?') {
2129*c54f35caSApple OSS Distributions continue;
2130*c54f35caSApple OSS Distributions }
2131*c54f35caSApple OSS Distributions c = nextChar();
2132*c54f35caSApple OSS Distributions if (!c) {
2133*c54f35caSApple OSS Distributions return TAG_IGNORE;
2134*c54f35caSApple OSS Distributions }
2135*c54f35caSApple OSS Distributions if (c == '>') {
2136*c54f35caSApple OSS Distributions (void)nextChar();
2137*c54f35caSApple OSS Distributions return TAG_IGNORE;
2138*c54f35caSApple OSS Distributions }
2139*c54f35caSApple OSS Distributions }
2140*c54f35caSApple OSS Distributions return TAG_BAD;
2141*c54f35caSApple OSS Distributions } else
2142*c54f35caSApple OSS Distributions // </ end tag >
2143*c54f35caSApple OSS Distributions if (c == '/') {
2144*c54f35caSApple OSS Distributions c = nextChar(); // skip '/'
2145*c54f35caSApple OSS Distributions tagType = TAG_END;
2146*c54f35caSApple OSS Distributions }
2147*c54f35caSApple OSS Distributions if (!isAlpha(c)) {
2148*c54f35caSApple OSS Distributions return TAG_BAD;
2149*c54f35caSApple OSS Distributions }
2150*c54f35caSApple OSS Distributions
2151*c54f35caSApple OSS Distributions /* find end of tag while copying it */
2152*c54f35caSApple OSS Distributions while (isAlphaNumeric(c)) {
2153*c54f35caSApple OSS Distributions tag[length++] = c;
2154*c54f35caSApple OSS Distributions c = nextChar();
2155*c54f35caSApple OSS Distributions if (length >= (TAG_MAX_LENGTH - 1)) {
2156*c54f35caSApple OSS Distributions return TAG_BAD;
2157*c54f35caSApple OSS Distributions }
2158*c54f35caSApple OSS Distributions }
2159*c54f35caSApple OSS Distributions
2160*c54f35caSApple OSS Distributions tag[length] = 0;
2161*c54f35caSApple OSS Distributions
2162*c54f35caSApple OSS Distributions // printf("tag %s, type %d\n", tag, tagType);
2163*c54f35caSApple OSS Distributions
2164*c54f35caSApple OSS Distributions // look for attributes of the form attribute = "value" ...
2165*c54f35caSApple OSS Distributions while ((c != '>') && (c != '/')) {
2166*c54f35caSApple OSS Distributions while (isSpace(c)) {
2167*c54f35caSApple OSS Distributions c = nextChar();
2168*c54f35caSApple OSS Distributions }
2169*c54f35caSApple OSS Distributions
2170*c54f35caSApple OSS Distributions length = 0;
2171*c54f35caSApple OSS Distributions while (isAlphaNumeric(c)) {
2172*c54f35caSApple OSS Distributions attributes[*attributeCount][length++] = c;
2173*c54f35caSApple OSS Distributions if (length >= (TAG_MAX_LENGTH - 1)) {
2174*c54f35caSApple OSS Distributions return TAG_BAD;
2175*c54f35caSApple OSS Distributions }
2176*c54f35caSApple OSS Distributions c = nextChar();
2177*c54f35caSApple OSS Distributions }
2178*c54f35caSApple OSS Distributions attributes[*attributeCount][length] = 0;
2179*c54f35caSApple OSS Distributions
2180*c54f35caSApple OSS Distributions while (isSpace(c)) {
2181*c54f35caSApple OSS Distributions c = nextChar();
2182*c54f35caSApple OSS Distributions }
2183*c54f35caSApple OSS Distributions
2184*c54f35caSApple OSS Distributions if (c != '=') {
2185*c54f35caSApple OSS Distributions return TAG_BAD;
2186*c54f35caSApple OSS Distributions }
2187*c54f35caSApple OSS Distributions c = nextChar();
2188*c54f35caSApple OSS Distributions
2189*c54f35caSApple OSS Distributions while (isSpace(c)) {
2190*c54f35caSApple OSS Distributions c = nextChar();
2191*c54f35caSApple OSS Distributions }
2192*c54f35caSApple OSS Distributions
2193*c54f35caSApple OSS Distributions if (c != '"') {
2194*c54f35caSApple OSS Distributions return TAG_BAD;
2195*c54f35caSApple OSS Distributions }
2196*c54f35caSApple OSS Distributions c = nextChar();
2197*c54f35caSApple OSS Distributions length = 0;
2198*c54f35caSApple OSS Distributions while (c != '"') {
2199*c54f35caSApple OSS Distributions values[*attributeCount][length++] = c;
2200*c54f35caSApple OSS Distributions if (length >= (TAG_MAX_LENGTH - 1)) {
2201*c54f35caSApple OSS Distributions return TAG_BAD;
2202*c54f35caSApple OSS Distributions }
2203*c54f35caSApple OSS Distributions c = nextChar();
2204*c54f35caSApple OSS Distributions if (!c) {
2205*c54f35caSApple OSS Distributions return TAG_BAD;
2206*c54f35caSApple OSS Distributions }
2207*c54f35caSApple OSS Distributions }
2208*c54f35caSApple OSS Distributions values[*attributeCount][length] = 0;
2209*c54f35caSApple OSS Distributions
2210*c54f35caSApple OSS Distributions c = nextChar(); // skip closing quote
2211*c54f35caSApple OSS Distributions
2212*c54f35caSApple OSS Distributions // printf(" attribute '%s' = '%s', nextchar = '%c'\n",
2213*c54f35caSApple OSS Distributions // attributes[*attributeCount], values[*attributeCount], c);
2214*c54f35caSApple OSS Distributions
2215*c54f35caSApple OSS Distributions (*attributeCount)++;
2216*c54f35caSApple OSS Distributions if (*attributeCount >= TAG_MAX_ATTRIBUTES) {
2217*c54f35caSApple OSS Distributions return TAG_BAD;
2218*c54f35caSApple OSS Distributions }
2219*c54f35caSApple OSS Distributions }
2220*c54f35caSApple OSS Distributions
2221*c54f35caSApple OSS Distributions if (c == '/') {
2222*c54f35caSApple OSS Distributions c = nextChar(); // skip '/'
2223*c54f35caSApple OSS Distributions tagType = TAG_EMPTY;
2224*c54f35caSApple OSS Distributions }
2225*c54f35caSApple OSS Distributions if (c != '>') {
2226*c54f35caSApple OSS Distributions return TAG_BAD;
2227*c54f35caSApple OSS Distributions }
2228*c54f35caSApple OSS Distributions c = nextChar(); // skip '>'
2229*c54f35caSApple OSS Distributions
2230*c54f35caSApple OSS Distributions return tagType;
2231*c54f35caSApple OSS Distributions }
2232*c54f35caSApple OSS Distributions
2233*c54f35caSApple OSS Distributions static char *
getString(parser_state_t * state,int * alloc_lengthp)2234*c54f35caSApple OSS Distributions getString(parser_state_t *state, int *alloc_lengthp)
2235*c54f35caSApple OSS Distributions {
2236*c54f35caSApple OSS Distributions int c = currentChar();
2237*c54f35caSApple OSS Distributions int start, length, i, j;
2238*c54f35caSApple OSS Distributions char * tempString;
2239*c54f35caSApple OSS Distributions
2240*c54f35caSApple OSS Distributions start = state->parseBufferIndex;
2241*c54f35caSApple OSS Distributions /* find end of string */
2242*c54f35caSApple OSS Distributions
2243*c54f35caSApple OSS Distributions while (c != 0) {
2244*c54f35caSApple OSS Distributions if (c == '\n') {
2245*c54f35caSApple OSS Distributions state->lineNumber++;
2246*c54f35caSApple OSS Distributions }
2247*c54f35caSApple OSS Distributions if (c == '<') {
2248*c54f35caSApple OSS Distributions break;
2249*c54f35caSApple OSS Distributions }
2250*c54f35caSApple OSS Distributions c = nextChar();
2251*c54f35caSApple OSS Distributions }
2252*c54f35caSApple OSS Distributions
2253*c54f35caSApple OSS Distributions if (c != '<') {
2254*c54f35caSApple OSS Distributions return 0;
2255*c54f35caSApple OSS Distributions }
2256*c54f35caSApple OSS Distributions
2257*c54f35caSApple OSS Distributions length = state->parseBufferIndex - start;
2258*c54f35caSApple OSS Distributions
2259*c54f35caSApple OSS Distributions /* copy to null terminated buffer */
2260*c54f35caSApple OSS Distributions tempString = (char *)malloc(length + 1);
2261*c54f35caSApple OSS Distributions if (tempString == NULL) {
2262*c54f35caSApple OSS Distributions printf("OSUnserializeXML: can't alloc temp memory\n");
2263*c54f35caSApple OSS Distributions goto error;
2264*c54f35caSApple OSS Distributions }
2265*c54f35caSApple OSS Distributions if (alloc_lengthp) {
2266*c54f35caSApple OSS Distributions *alloc_lengthp = length + 1;
2267*c54f35caSApple OSS Distributions }
2268*c54f35caSApple OSS Distributions
2269*c54f35caSApple OSS Distributions // copy out string in tempString
2270*c54f35caSApple OSS Distributions // "&" -> '&', "<" -> '<', ">" -> '>'
2271*c54f35caSApple OSS Distributions
2272*c54f35caSApple OSS Distributions i = j = 0;
2273*c54f35caSApple OSS Distributions while (i < length) {
2274*c54f35caSApple OSS Distributions c = state->parseBuffer[start + i++];
2275*c54f35caSApple OSS Distributions if (c != '&') {
2276*c54f35caSApple OSS Distributions tempString[j++] = c;
2277*c54f35caSApple OSS Distributions } else {
2278*c54f35caSApple OSS Distributions if ((i + 3) > length) {
2279*c54f35caSApple OSS Distributions goto error;
2280*c54f35caSApple OSS Distributions }
2281*c54f35caSApple OSS Distributions c = state->parseBuffer[start + i++];
2282*c54f35caSApple OSS Distributions if (c == 'l') {
2283*c54f35caSApple OSS Distributions if (state->parseBuffer[start + i++] != 't') {
2284*c54f35caSApple OSS Distributions goto error;
2285*c54f35caSApple OSS Distributions }
2286*c54f35caSApple OSS Distributions if (state->parseBuffer[start + i++] != ';') {
2287*c54f35caSApple OSS Distributions goto error;
2288*c54f35caSApple OSS Distributions }
2289*c54f35caSApple OSS Distributions tempString[j++] = '<';
2290*c54f35caSApple OSS Distributions continue;
2291*c54f35caSApple OSS Distributions }
2292*c54f35caSApple OSS Distributions if (c == 'g') {
2293*c54f35caSApple OSS Distributions if (state->parseBuffer[start + i++] != 't') {
2294*c54f35caSApple OSS Distributions goto error;
2295*c54f35caSApple OSS Distributions }
2296*c54f35caSApple OSS Distributions if (state->parseBuffer[start + i++] != ';') {
2297*c54f35caSApple OSS Distributions goto error;
2298*c54f35caSApple OSS Distributions }
2299*c54f35caSApple OSS Distributions tempString[j++] = '>';
2300*c54f35caSApple OSS Distributions continue;
2301*c54f35caSApple OSS Distributions }
2302*c54f35caSApple OSS Distributions if ((i + 3) > length) {
2303*c54f35caSApple OSS Distributions goto error;
2304*c54f35caSApple OSS Distributions }
2305*c54f35caSApple OSS Distributions if (c == 'a') {
2306*c54f35caSApple OSS Distributions if (state->parseBuffer[start + i++] != 'm') {
2307*c54f35caSApple OSS Distributions goto error;
2308*c54f35caSApple OSS Distributions }
2309*c54f35caSApple OSS Distributions if (state->parseBuffer[start + i++] != 'p') {
2310*c54f35caSApple OSS Distributions goto error;
2311*c54f35caSApple OSS Distributions }
2312*c54f35caSApple OSS Distributions if (state->parseBuffer[start + i++] != ';') {
2313*c54f35caSApple OSS Distributions goto error;
2314*c54f35caSApple OSS Distributions }
2315*c54f35caSApple OSS Distributions tempString[j++] = '&';
2316*c54f35caSApple OSS Distributions continue;
2317*c54f35caSApple OSS Distributions }
2318*c54f35caSApple OSS Distributions goto error;
2319*c54f35caSApple OSS Distributions }
2320*c54f35caSApple OSS Distributions }
2321*c54f35caSApple OSS Distributions tempString[j] = 0;
2322*c54f35caSApple OSS Distributions
2323*c54f35caSApple OSS Distributions // printf("string %s\n", tempString);
2324*c54f35caSApple OSS Distributions
2325*c54f35caSApple OSS Distributions return tempString;
2326*c54f35caSApple OSS Distributions
2327*c54f35caSApple OSS Distributions error:
2328*c54f35caSApple OSS Distributions if (tempString) {
2329*c54f35caSApple OSS Distributions safe_free(tempString, length + 1);
2330*c54f35caSApple OSS Distributions if (alloc_lengthp) {
2331*c54f35caSApple OSS Distributions *alloc_lengthp = 0;
2332*c54f35caSApple OSS Distributions }
2333*c54f35caSApple OSS Distributions }
2334*c54f35caSApple OSS Distributions return 0;
2335*c54f35caSApple OSS Distributions }
2336*c54f35caSApple OSS Distributions
2337*c54f35caSApple OSS Distributions static long long
getNumber(parser_state_t * state)2338*c54f35caSApple OSS Distributions getNumber(parser_state_t *state)
2339*c54f35caSApple OSS Distributions {
2340*c54f35caSApple OSS Distributions unsigned long long n = 0;
2341*c54f35caSApple OSS Distributions int base = 10;
2342*c54f35caSApple OSS Distributions bool negate = false;
2343*c54f35caSApple OSS Distributions int c = currentChar();
2344*c54f35caSApple OSS Distributions
2345*c54f35caSApple OSS Distributions if (c == '0') {
2346*c54f35caSApple OSS Distributions c = nextChar();
2347*c54f35caSApple OSS Distributions if (c == 'x') {
2348*c54f35caSApple OSS Distributions base = 16;
2349*c54f35caSApple OSS Distributions c = nextChar();
2350*c54f35caSApple OSS Distributions }
2351*c54f35caSApple OSS Distributions }
2352*c54f35caSApple OSS Distributions if (base == 10) {
2353*c54f35caSApple OSS Distributions if (c == '-') {
2354*c54f35caSApple OSS Distributions negate = true;
2355*c54f35caSApple OSS Distributions c = nextChar();
2356*c54f35caSApple OSS Distributions }
2357*c54f35caSApple OSS Distributions while (isDigit(c)) {
2358*c54f35caSApple OSS Distributions n = (n * base + c - '0');
2359*c54f35caSApple OSS Distributions c = nextChar();
2360*c54f35caSApple OSS Distributions }
2361*c54f35caSApple OSS Distributions if (negate) {
2362*c54f35caSApple OSS Distributions n = (unsigned long long)((long long)n * (long long)-1);
2363*c54f35caSApple OSS Distributions }
2364*c54f35caSApple OSS Distributions } else {
2365*c54f35caSApple OSS Distributions while (isHexDigit(c)) {
2366*c54f35caSApple OSS Distributions if (isDigit(c)) {
2367*c54f35caSApple OSS Distributions n = (n * base + c - '0');
2368*c54f35caSApple OSS Distributions } else {
2369*c54f35caSApple OSS Distributions n = (n * base + 0xa + c - 'a');
2370*c54f35caSApple OSS Distributions }
2371*c54f35caSApple OSS Distributions c = nextChar();
2372*c54f35caSApple OSS Distributions }
2373*c54f35caSApple OSS Distributions }
2374*c54f35caSApple OSS Distributions // printf("number 0x%x\n", (unsigned long)n);
2375*c54f35caSApple OSS Distributions return n;
2376*c54f35caSApple OSS Distributions }
2377*c54f35caSApple OSS Distributions
2378*c54f35caSApple OSS Distributions // taken from CFXMLParsing/CFPropertyList.c
2379*c54f35caSApple OSS Distributions
2380*c54f35caSApple OSS Distributions static const signed char __CFPLDataDecodeTable[128] = {
2381*c54f35caSApple OSS Distributions /* 000 */ -1, -1, -1, -1, -1, -1, -1, -1,
2382*c54f35caSApple OSS Distributions /* 010 */ -1, -1, -1, -1, -1, -1, -1, -1,
2383*c54f35caSApple OSS Distributions /* 020 */ -1, -1, -1, -1, -1, -1, -1, -1,
2384*c54f35caSApple OSS Distributions /* 030 */ -1, -1, -1, -1, -1, -1, -1, -1,
2385*c54f35caSApple OSS Distributions /* ' ' */ -1, -1, -1, -1, -1, -1, -1, -1,
2386*c54f35caSApple OSS Distributions /* '(' */ -1, -1, -1, 62, -1, -1, -1, 63,
2387*c54f35caSApple OSS Distributions /* '0' */ 52, 53, 54, 55, 56, 57, 58, 59,
2388*c54f35caSApple OSS Distributions /* '8' */ 60, 61, -1, -1, -1, 0, -1, -1,
2389*c54f35caSApple OSS Distributions /* '@' */ -1, 0, 1, 2, 3, 4, 5, 6,
2390*c54f35caSApple OSS Distributions /* 'H' */ 7, 8, 9, 10, 11, 12, 13, 14,
2391*c54f35caSApple OSS Distributions /* 'P' */ 15, 16, 17, 18, 19, 20, 21, 22,
2392*c54f35caSApple OSS Distributions /* 'X' */ 23, 24, 25, -1, -1, -1, -1, -1,
2393*c54f35caSApple OSS Distributions /* '`' */ -1, 26, 27, 28, 29, 30, 31, 32,
2394*c54f35caSApple OSS Distributions /* 'h' */ 33, 34, 35, 36, 37, 38, 39, 40,
2395*c54f35caSApple OSS Distributions /* 'p' */ 41, 42, 43, 44, 45, 46, 47, 48,
2396*c54f35caSApple OSS Distributions /* 'x' */ 49, 50, 51, -1, -1, -1, -1, -1
2397*c54f35caSApple OSS Distributions };
2398*c54f35caSApple OSS Distributions
2399*c54f35caSApple OSS Distributions #define DATA_ALLOC_SIZE 4096
2400*c54f35caSApple OSS Distributions
2401*c54f35caSApple OSS Distributions static void *
getCFEncodedData(parser_state_t * state,unsigned int * size)2402*c54f35caSApple OSS Distributions getCFEncodedData(parser_state_t *state, unsigned int *size)
2403*c54f35caSApple OSS Distributions {
2404*c54f35caSApple OSS Distributions int numeq = 0, cntr = 0;
2405*c54f35caSApple OSS Distributions unsigned int acc = 0;
2406*c54f35caSApple OSS Distributions int tmpbufpos = 0;
2407*c54f35caSApple OSS Distributions size_t tmpbuflen = DATA_ALLOC_SIZE;
2408*c54f35caSApple OSS Distributions unsigned char *tmpbuf = (unsigned char *)malloc(tmpbuflen);
2409*c54f35caSApple OSS Distributions
2410*c54f35caSApple OSS Distributions int c = currentChar();
2411*c54f35caSApple OSS Distributions *size = 0;
2412*c54f35caSApple OSS Distributions
2413*c54f35caSApple OSS Distributions while (c != '<') {
2414*c54f35caSApple OSS Distributions c &= 0x7f;
2415*c54f35caSApple OSS Distributions if (c == 0) {
2416*c54f35caSApple OSS Distributions safe_free(tmpbuf, tmpbuflen);
2417*c54f35caSApple OSS Distributions return 0;
2418*c54f35caSApple OSS Distributions }
2419*c54f35caSApple OSS Distributions if (c == '=') {
2420*c54f35caSApple OSS Distributions numeq++;
2421*c54f35caSApple OSS Distributions } else {
2422*c54f35caSApple OSS Distributions numeq = 0;
2423*c54f35caSApple OSS Distributions }
2424*c54f35caSApple OSS Distributions if (c == '\n') {
2425*c54f35caSApple OSS Distributions state->lineNumber++;
2426*c54f35caSApple OSS Distributions }
2427*c54f35caSApple OSS Distributions if (__CFPLDataDecodeTable[c] < 0) {
2428*c54f35caSApple OSS Distributions c = nextChar();
2429*c54f35caSApple OSS Distributions continue;
2430*c54f35caSApple OSS Distributions }
2431*c54f35caSApple OSS Distributions cntr++;
2432*c54f35caSApple OSS Distributions acc <<= 6;
2433*c54f35caSApple OSS Distributions acc += __CFPLDataDecodeTable[c];
2434*c54f35caSApple OSS Distributions if (0 == (cntr & 0x3)) {
2435*c54f35caSApple OSS Distributions if (tmpbuflen <= tmpbufpos + 2) {
2436*c54f35caSApple OSS Distributions size_t oldsize = tmpbuflen;
2437*c54f35caSApple OSS Distributions tmpbuflen *= 2;
2438*c54f35caSApple OSS Distributions tmpbuf = (unsigned char *)realloc(tmpbuf, oldsize, tmpbuflen);
2439*c54f35caSApple OSS Distributions }
2440*c54f35caSApple OSS Distributions tmpbuf[tmpbufpos++] = (acc >> 16) & 0xff;
2441*c54f35caSApple OSS Distributions if (numeq < 2) {
2442*c54f35caSApple OSS Distributions tmpbuf[tmpbufpos++] = (acc >> 8) & 0xff;
2443*c54f35caSApple OSS Distributions }
2444*c54f35caSApple OSS Distributions if (numeq < 1) {
2445*c54f35caSApple OSS Distributions tmpbuf[tmpbufpos++] = acc & 0xff;
2446*c54f35caSApple OSS Distributions }
2447*c54f35caSApple OSS Distributions }
2448*c54f35caSApple OSS Distributions c = nextChar();
2449*c54f35caSApple OSS Distributions }
2450*c54f35caSApple OSS Distributions *size = tmpbufpos;
2451*c54f35caSApple OSS Distributions if (*size == 0) {
2452*c54f35caSApple OSS Distributions safe_free(tmpbuf, tmpbuflen);
2453*c54f35caSApple OSS Distributions return 0;
2454*c54f35caSApple OSS Distributions }
2455*c54f35caSApple OSS Distributions return tmpbuf;
2456*c54f35caSApple OSS Distributions }
2457*c54f35caSApple OSS Distributions
2458*c54f35caSApple OSS Distributions static void *
getHexData(parser_state_t * state,unsigned int * size)2459*c54f35caSApple OSS Distributions getHexData(parser_state_t *state, unsigned int *size)
2460*c54f35caSApple OSS Distributions {
2461*c54f35caSApple OSS Distributions int c;
2462*c54f35caSApple OSS Distributions unsigned char *d, *start;
2463*c54f35caSApple OSS Distributions
2464*c54f35caSApple OSS Distributions size_t buflen = DATA_ALLOC_SIZE; // initial buffer size
2465*c54f35caSApple OSS Distributions start = d = (unsigned char *)malloc(buflen);
2466*c54f35caSApple OSS Distributions c = currentChar();
2467*c54f35caSApple OSS Distributions
2468*c54f35caSApple OSS Distributions while (c != '<') {
2469*c54f35caSApple OSS Distributions if (isSpace(c)) {
2470*c54f35caSApple OSS Distributions while ((c = nextChar()) != 0 && isSpace(c)) {
2471*c54f35caSApple OSS Distributions }
2472*c54f35caSApple OSS Distributions }
2473*c54f35caSApple OSS Distributions ;
2474*c54f35caSApple OSS Distributions if (c == '\n') {
2475*c54f35caSApple OSS Distributions state->lineNumber++;
2476*c54f35caSApple OSS Distributions c = nextChar();
2477*c54f35caSApple OSS Distributions continue;
2478*c54f35caSApple OSS Distributions }
2479*c54f35caSApple OSS Distributions
2480*c54f35caSApple OSS Distributions // get high nibble
2481*c54f35caSApple OSS Distributions if (isDigit(c)) {
2482*c54f35caSApple OSS Distributions *d = (c - '0') << 4;
2483*c54f35caSApple OSS Distributions } else if (isAlphaDigit(c)) {
2484*c54f35caSApple OSS Distributions *d = (0xa + (c - 'a')) << 4;
2485*c54f35caSApple OSS Distributions } else {
2486*c54f35caSApple OSS Distributions goto error;
2487*c54f35caSApple OSS Distributions }
2488*c54f35caSApple OSS Distributions
2489*c54f35caSApple OSS Distributions // get low nibble
2490*c54f35caSApple OSS Distributions c = nextChar();
2491*c54f35caSApple OSS Distributions if (isDigit(c)) {
2492*c54f35caSApple OSS Distributions *d |= c - '0';
2493*c54f35caSApple OSS Distributions } else if (isAlphaDigit(c)) {
2494*c54f35caSApple OSS Distributions *d |= 0xa + (c - 'a');
2495*c54f35caSApple OSS Distributions } else {
2496*c54f35caSApple OSS Distributions goto error;
2497*c54f35caSApple OSS Distributions }
2498*c54f35caSApple OSS Distributions
2499*c54f35caSApple OSS Distributions d++;
2500*c54f35caSApple OSS Distributions size_t oldsize = d - start;
2501*c54f35caSApple OSS Distributions if (oldsize >= buflen) {
2502*c54f35caSApple OSS Distributions assert(oldsize == buflen);
2503*c54f35caSApple OSS Distributions buflen *= 2;
2504*c54f35caSApple OSS Distributions start = (unsigned char *)realloc(start, oldsize, buflen);
2505*c54f35caSApple OSS Distributions d = start + oldsize;
2506*c54f35caSApple OSS Distributions }
2507*c54f35caSApple OSS Distributions c = nextChar();
2508*c54f35caSApple OSS Distributions }
2509*c54f35caSApple OSS Distributions
2510*c54f35caSApple OSS Distributions *size = d - start;
2511*c54f35caSApple OSS Distributions return start;
2512*c54f35caSApple OSS Distributions
2513*c54f35caSApple OSS Distributions error:
2514*c54f35caSApple OSS Distributions
2515*c54f35caSApple OSS Distributions *size = 0;
2516*c54f35caSApple OSS Distributions safe_free(start, buflen);
2517*c54f35caSApple OSS Distributions return 0;
2518*c54f35caSApple OSS Distributions }
2519*c54f35caSApple OSS Distributions
2520*c54f35caSApple OSS Distributions static int
yylex(YYSTYPE * lvalp,parser_state_t * state)2521*c54f35caSApple OSS Distributions yylex(YYSTYPE *lvalp, parser_state_t *state)
2522*c54f35caSApple OSS Distributions {
2523*c54f35caSApple OSS Distributions int c, i;
2524*c54f35caSApple OSS Distributions int tagType;
2525*c54f35caSApple OSS Distributions char tag[TAG_MAX_LENGTH];
2526*c54f35caSApple OSS Distributions int attributeCount;
2527*c54f35caSApple OSS Distributions char attributes[TAG_MAX_ATTRIBUTES][TAG_MAX_LENGTH];
2528*c54f35caSApple OSS Distributions char values[TAG_MAX_ATTRIBUTES][TAG_MAX_LENGTH];
2529*c54f35caSApple OSS Distributions object_t *object;
2530*c54f35caSApple OSS Distributions int alloc_length;
2531*c54f35caSApple OSS Distributions top:
2532*c54f35caSApple OSS Distributions c = currentChar();
2533*c54f35caSApple OSS Distributions
2534*c54f35caSApple OSS Distributions /* skip white space */
2535*c54f35caSApple OSS Distributions if (isSpace(c)) {
2536*c54f35caSApple OSS Distributions while ((c = nextChar()) != 0 && isSpace(c)) {
2537*c54f35caSApple OSS Distributions }
2538*c54f35caSApple OSS Distributions }
2539*c54f35caSApple OSS Distributions ;
2540*c54f35caSApple OSS Distributions
2541*c54f35caSApple OSS Distributions /* keep track of line number, don't return \n's */
2542*c54f35caSApple OSS Distributions if (c == '\n') {
2543*c54f35caSApple OSS Distributions STATE->lineNumber++;
2544*c54f35caSApple OSS Distributions (void)nextChar();
2545*c54f35caSApple OSS Distributions goto top;
2546*c54f35caSApple OSS Distributions }
2547*c54f35caSApple OSS Distributions
2548*c54f35caSApple OSS Distributions // end of the buffer?
2549*c54f35caSApple OSS Distributions if (!c) {
2550*c54f35caSApple OSS Distributions return 0;
2551*c54f35caSApple OSS Distributions }
2552*c54f35caSApple OSS Distributions
2553*c54f35caSApple OSS Distributions tagType = getTag(STATE, tag, &attributeCount, attributes, values);
2554*c54f35caSApple OSS Distributions if (tagType == TAG_BAD) {
2555*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2556*c54f35caSApple OSS Distributions }
2557*c54f35caSApple OSS Distributions if (tagType == TAG_IGNORE) {
2558*c54f35caSApple OSS Distributions goto top;
2559*c54f35caSApple OSS Distributions }
2560*c54f35caSApple OSS Distributions
2561*c54f35caSApple OSS Distributions // handle allocation and check for "ID" and "IDREF" tags up front
2562*c54f35caSApple OSS Distributions *lvalp = object = newObject(STATE);
2563*c54f35caSApple OSS Distributions object->idref = -1;
2564*c54f35caSApple OSS Distributions for (i = 0; i < attributeCount; i++) {
2565*c54f35caSApple OSS Distributions if (attributes[i][0] == 'I' && attributes[i][1] == 'D') {
2566*c54f35caSApple OSS Distributions // check for idref's, note: we ignore the tag, for
2567*c54f35caSApple OSS Distributions // this to work correctly, all idrefs must be unique
2568*c54f35caSApple OSS Distributions // across the whole serialization
2569*c54f35caSApple OSS Distributions if (attributes[i][2] == 'R' && attributes[i][3] == 'E' &&
2570*c54f35caSApple OSS Distributions attributes[i][4] == 'F' && !attributes[i][5]) {
2571*c54f35caSApple OSS Distributions if (tagType != TAG_EMPTY) {
2572*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2573*c54f35caSApple OSS Distributions }
2574*c54f35caSApple OSS Distributions object->idref = strtol(values[i], NULL, 0);
2575*c54f35caSApple OSS Distributions return IDREF;
2576*c54f35caSApple OSS Distributions }
2577*c54f35caSApple OSS Distributions // check for id's
2578*c54f35caSApple OSS Distributions if (!attributes[i][2]) {
2579*c54f35caSApple OSS Distributions object->idref = strtol(values[i], NULL, 0);
2580*c54f35caSApple OSS Distributions } else {
2581*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2582*c54f35caSApple OSS Distributions }
2583*c54f35caSApple OSS Distributions }
2584*c54f35caSApple OSS Distributions }
2585*c54f35caSApple OSS Distributions
2586*c54f35caSApple OSS Distributions switch (*tag) {
2587*c54f35caSApple OSS Distributions case 'a':
2588*c54f35caSApple OSS Distributions if (!strcmp(tag, "array")) {
2589*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2590*c54f35caSApple OSS Distributions object->elements = NULL;
2591*c54f35caSApple OSS Distributions return ARRAY;
2592*c54f35caSApple OSS Distributions }
2593*c54f35caSApple OSS Distributions return (tagType == TAG_START) ? '(' : ')';
2594*c54f35caSApple OSS Distributions }
2595*c54f35caSApple OSS Distributions break;
2596*c54f35caSApple OSS Distributions case 'd':
2597*c54f35caSApple OSS Distributions if (!strcmp(tag, "dict")) {
2598*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2599*c54f35caSApple OSS Distributions object->elements = NULL;
2600*c54f35caSApple OSS Distributions return DICTIONARY;
2601*c54f35caSApple OSS Distributions }
2602*c54f35caSApple OSS Distributions return (tagType == TAG_START) ? '{' : '}';
2603*c54f35caSApple OSS Distributions }
2604*c54f35caSApple OSS Distributions if (!strcmp(tag, "data")) {
2605*c54f35caSApple OSS Distributions unsigned int size;
2606*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2607*c54f35caSApple OSS Distributions object->data = NULL;
2608*c54f35caSApple OSS Distributions object->size = 0;
2609*c54f35caSApple OSS Distributions return DATA;
2610*c54f35caSApple OSS Distributions }
2611*c54f35caSApple OSS Distributions
2612*c54f35caSApple OSS Distributions bool isHexFormat = false;
2613*c54f35caSApple OSS Distributions for (i = 0; i < attributeCount; i++) {
2614*c54f35caSApple OSS Distributions if (!strcmp(attributes[i], "format") && !strcmp(values[i], "hex")) {
2615*c54f35caSApple OSS Distributions isHexFormat = true;
2616*c54f35caSApple OSS Distributions break;
2617*c54f35caSApple OSS Distributions }
2618*c54f35caSApple OSS Distributions }
2619*c54f35caSApple OSS Distributions // CF encoded is the default form
2620*c54f35caSApple OSS Distributions if (isHexFormat) {
2621*c54f35caSApple OSS Distributions object->data = getHexData(STATE, &size);
2622*c54f35caSApple OSS Distributions } else {
2623*c54f35caSApple OSS Distributions object->data = getCFEncodedData(STATE, &size);
2624*c54f35caSApple OSS Distributions }
2625*c54f35caSApple OSS Distributions object->size = size;
2626*c54f35caSApple OSS Distributions if ((getTag(STATE, tag, &attributeCount, attributes, values) != TAG_END) || strcmp(tag, "data")) {
2627*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2628*c54f35caSApple OSS Distributions }
2629*c54f35caSApple OSS Distributions return DATA;
2630*c54f35caSApple OSS Distributions }
2631*c54f35caSApple OSS Distributions break;
2632*c54f35caSApple OSS Distributions case 'f':
2633*c54f35caSApple OSS Distributions if (!strcmp(tag, "false")) {
2634*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2635*c54f35caSApple OSS Distributions object->number = 0;
2636*c54f35caSApple OSS Distributions return BOOLEAN;
2637*c54f35caSApple OSS Distributions }
2638*c54f35caSApple OSS Distributions }
2639*c54f35caSApple OSS Distributions break;
2640*c54f35caSApple OSS Distributions case 'i':
2641*c54f35caSApple OSS Distributions if (!strcmp(tag, "integer")) {
2642*c54f35caSApple OSS Distributions object->size = 64; // default
2643*c54f35caSApple OSS Distributions for (i = 0; i < attributeCount; i++) {
2644*c54f35caSApple OSS Distributions if (!strcmp(attributes[i], "size")) {
2645*c54f35caSApple OSS Distributions object->size = strtoul(values[i], NULL, 0);
2646*c54f35caSApple OSS Distributions }
2647*c54f35caSApple OSS Distributions }
2648*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2649*c54f35caSApple OSS Distributions object->number = 0;
2650*c54f35caSApple OSS Distributions return NUMBER;
2651*c54f35caSApple OSS Distributions }
2652*c54f35caSApple OSS Distributions object->number = getNumber(STATE);
2653*c54f35caSApple OSS Distributions if ((getTag(STATE, tag, &attributeCount, attributes, values) != TAG_END) || strcmp(tag, "integer")) {
2654*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2655*c54f35caSApple OSS Distributions }
2656*c54f35caSApple OSS Distributions return NUMBER;
2657*c54f35caSApple OSS Distributions }
2658*c54f35caSApple OSS Distributions break;
2659*c54f35caSApple OSS Distributions case 'k':
2660*c54f35caSApple OSS Distributions if (!strcmp(tag, "key")) {
2661*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2662*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2663*c54f35caSApple OSS Distributions }
2664*c54f35caSApple OSS Distributions object->string = getString(STATE, &alloc_length);
2665*c54f35caSApple OSS Distributions if (!object->string) {
2666*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2667*c54f35caSApple OSS Distributions }
2668*c54f35caSApple OSS Distributions object->string_alloc_length = alloc_length;
2669*c54f35caSApple OSS Distributions if ((getTag(STATE, tag, &attributeCount, attributes, values) != TAG_END)
2670*c54f35caSApple OSS Distributions || strcmp(tag, "key")) {
2671*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2672*c54f35caSApple OSS Distributions }
2673*c54f35caSApple OSS Distributions return KEY;
2674*c54f35caSApple OSS Distributions }
2675*c54f35caSApple OSS Distributions break;
2676*c54f35caSApple OSS Distributions case 'p':
2677*c54f35caSApple OSS Distributions if (!strcmp(tag, "plist")) {
2678*c54f35caSApple OSS Distributions freeObject(STATE, object);
2679*c54f35caSApple OSS Distributions goto top;
2680*c54f35caSApple OSS Distributions }
2681*c54f35caSApple OSS Distributions break;
2682*c54f35caSApple OSS Distributions case 's':
2683*c54f35caSApple OSS Distributions if (!strcmp(tag, "string")) {
2684*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2685*c54f35caSApple OSS Distributions object->string = (char *)malloc(1);
2686*c54f35caSApple OSS Distributions object->string_alloc_length = 1;
2687*c54f35caSApple OSS Distributions object->string[0] = 0;
2688*c54f35caSApple OSS Distributions return STRING;
2689*c54f35caSApple OSS Distributions }
2690*c54f35caSApple OSS Distributions object->string = getString(STATE, &alloc_length);
2691*c54f35caSApple OSS Distributions if (!object->string) {
2692*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2693*c54f35caSApple OSS Distributions }
2694*c54f35caSApple OSS Distributions object->string_alloc_length = alloc_length;
2695*c54f35caSApple OSS Distributions if ((getTag(STATE, tag, &attributeCount, attributes, values) != TAG_END)
2696*c54f35caSApple OSS Distributions || strcmp(tag, "string")) {
2697*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2698*c54f35caSApple OSS Distributions }
2699*c54f35caSApple OSS Distributions return STRING;
2700*c54f35caSApple OSS Distributions }
2701*c54f35caSApple OSS Distributions if (!strcmp(tag, "set")) {
2702*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2703*c54f35caSApple OSS Distributions object->elements = NULL;
2704*c54f35caSApple OSS Distributions return SET;
2705*c54f35caSApple OSS Distributions }
2706*c54f35caSApple OSS Distributions if (tagType == TAG_START) {
2707*c54f35caSApple OSS Distributions return '[';
2708*c54f35caSApple OSS Distributions } else {
2709*c54f35caSApple OSS Distributions return ']';
2710*c54f35caSApple OSS Distributions }
2711*c54f35caSApple OSS Distributions }
2712*c54f35caSApple OSS Distributions break;
2713*c54f35caSApple OSS Distributions case 't':
2714*c54f35caSApple OSS Distributions if (!strcmp(tag, "true")) {
2715*c54f35caSApple OSS Distributions if (tagType == TAG_EMPTY) {
2716*c54f35caSApple OSS Distributions object->number = 1;
2717*c54f35caSApple OSS Distributions return BOOLEAN;
2718*c54f35caSApple OSS Distributions }
2719*c54f35caSApple OSS Distributions }
2720*c54f35caSApple OSS Distributions break;
2721*c54f35caSApple OSS Distributions }
2722*c54f35caSApple OSS Distributions
2723*c54f35caSApple OSS Distributions return SYNTAX_ERROR;
2724*c54f35caSApple OSS Distributions }
2725*c54f35caSApple OSS Distributions
2726*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2727*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2728*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2729*c54f35caSApple OSS Distributions
2730*c54f35caSApple OSS Distributions // "java" like allocation, if this code hits a syntax error in the
2731*c54f35caSApple OSS Distributions // the middle of the parsed string we just bail with pointers hanging
2732*c54f35caSApple OSS Distributions // all over place, this code helps keeps it all together
2733*c54f35caSApple OSS Distributions
2734*c54f35caSApple OSS Distributions //static int object_count = 0;
2735*c54f35caSApple OSS Distributions
2736*c54f35caSApple OSS Distributions object_t *
newObject(parser_state_t * state)2737*c54f35caSApple OSS Distributions newObject(parser_state_t *state)
2738*c54f35caSApple OSS Distributions {
2739*c54f35caSApple OSS Distributions object_t *o;
2740*c54f35caSApple OSS Distributions
2741*c54f35caSApple OSS Distributions if (state->freeObjects) {
2742*c54f35caSApple OSS Distributions o = state->freeObjects;
2743*c54f35caSApple OSS Distributions state->freeObjects = state->freeObjects->next;
2744*c54f35caSApple OSS Distributions } else {
2745*c54f35caSApple OSS Distributions o = malloc_type(object_t);
2746*c54f35caSApple OSS Distributions // object_count++;
2747*c54f35caSApple OSS Distributions o->free = state->objects;
2748*c54f35caSApple OSS Distributions state->objects = o;
2749*c54f35caSApple OSS Distributions }
2750*c54f35caSApple OSS Distributions
2751*c54f35caSApple OSS Distributions return o;
2752*c54f35caSApple OSS Distributions }
2753*c54f35caSApple OSS Distributions
2754*c54f35caSApple OSS Distributions void
freeObject(parser_state_t * state,object_t * o)2755*c54f35caSApple OSS Distributions freeObject(parser_state_t * state, object_t *o)
2756*c54f35caSApple OSS Distributions {
2757*c54f35caSApple OSS Distributions o->next = state->freeObjects;
2758*c54f35caSApple OSS Distributions state->freeObjects = o;
2759*c54f35caSApple OSS Distributions }
2760*c54f35caSApple OSS Distributions
2761*c54f35caSApple OSS Distributions void
cleanupObjects(parser_state_t * state)2762*c54f35caSApple OSS Distributions cleanupObjects(parser_state_t *state)
2763*c54f35caSApple OSS Distributions {
2764*c54f35caSApple OSS Distributions object_t *t, *o = state->objects;
2765*c54f35caSApple OSS Distributions
2766*c54f35caSApple OSS Distributions while (o) {
2767*c54f35caSApple OSS Distributions if (o->object) {
2768*c54f35caSApple OSS Distributions // printf("OSUnserializeXML: releasing object o=%x object=%x\n", (int)o, (int)o->object);
2769*c54f35caSApple OSS Distributions o->object->release();
2770*c54f35caSApple OSS Distributions }
2771*c54f35caSApple OSS Distributions if (o->data) {
2772*c54f35caSApple OSS Distributions // printf("OSUnserializeXML: freeing object o=%x data=%x\n", (int)o, (int)o->data);
2773*c54f35caSApple OSS Distributions free(o->data);
2774*c54f35caSApple OSS Distributions }
2775*c54f35caSApple OSS Distributions if (o->key) {
2776*c54f35caSApple OSS Distributions // printf("OSUnserializeXML: releasing object o=%x key=%x\n", (int)o, (int)o->key);
2777*c54f35caSApple OSS Distributions o->key->release();
2778*c54f35caSApple OSS Distributions }
2779*c54f35caSApple OSS Distributions if (o->string) {
2780*c54f35caSApple OSS Distributions // printf("OSUnserializeXML: freeing object o=%x string=%x\n", (int)o, (int)o->string);
2781*c54f35caSApple OSS Distributions free(o->string);
2782*c54f35caSApple OSS Distributions }
2783*c54f35caSApple OSS Distributions
2784*c54f35caSApple OSS Distributions t = o;
2785*c54f35caSApple OSS Distributions o = o->free;
2786*c54f35caSApple OSS Distributions free_type(object_t, t);
2787*c54f35caSApple OSS Distributions // object_count--;
2788*c54f35caSApple OSS Distributions }
2789*c54f35caSApple OSS Distributions // printf("object_count = %d\n", object_count);
2790*c54f35caSApple OSS Distributions }
2791*c54f35caSApple OSS Distributions
2792*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2793*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2794*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2795*c54f35caSApple OSS Distributions
2796*c54f35caSApple OSS Distributions static void
rememberObject(parser_state_t * state,int tag,OSObject * o)2797*c54f35caSApple OSS Distributions rememberObject(parser_state_t *state, int tag, OSObject *o)
2798*c54f35caSApple OSS Distributions {
2799*c54f35caSApple OSS Distributions char key[16];
2800*c54f35caSApple OSS Distributions snprintf(key, 16, "%u", tag);
2801*c54f35caSApple OSS Distributions
2802*c54f35caSApple OSS Distributions // printf("remember key %s\n", key);
2803*c54f35caSApple OSS Distributions
2804*c54f35caSApple OSS Distributions state->tags->setObject(key, o);
2805*c54f35caSApple OSS Distributions }
2806*c54f35caSApple OSS Distributions
2807*c54f35caSApple OSS Distributions static object_t *
retrieveObject(parser_state_t * state,int tag)2808*c54f35caSApple OSS Distributions retrieveObject(parser_state_t *state, int tag)
2809*c54f35caSApple OSS Distributions {
2810*c54f35caSApple OSS Distributions OSObject *ref;
2811*c54f35caSApple OSS Distributions object_t *o;
2812*c54f35caSApple OSS Distributions char key[16];
2813*c54f35caSApple OSS Distributions snprintf(key, 16, "%u", tag);
2814*c54f35caSApple OSS Distributions
2815*c54f35caSApple OSS Distributions // printf("retrieve key '%s'\n", key);
2816*c54f35caSApple OSS Distributions
2817*c54f35caSApple OSS Distributions ref = state->tags->getObject(key);
2818*c54f35caSApple OSS Distributions if (!ref) {
2819*c54f35caSApple OSS Distributions return 0;
2820*c54f35caSApple OSS Distributions }
2821*c54f35caSApple OSS Distributions
2822*c54f35caSApple OSS Distributions o = newObject(state);
2823*c54f35caSApple OSS Distributions o->object = ref;
2824*c54f35caSApple OSS Distributions return o;
2825*c54f35caSApple OSS Distributions }
2826*c54f35caSApple OSS Distributions
2827*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2828*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2829*c54f35caSApple OSS Distributions // !@$&)(^Q$&*^!$(*!@$_(^%_(*Q#$(_*&!$_(*&!$_(*&!#$(*!@&^!@#%!_!#
2830*c54f35caSApple OSS Distributions
2831*c54f35caSApple OSS Distributions object_t *
buildDictionary(parser_state_t * state,object_t * header)2832*c54f35caSApple OSS Distributions buildDictionary(parser_state_t *state, object_t * header)
2833*c54f35caSApple OSS Distributions {
2834*c54f35caSApple OSS Distributions object_t *o, *t;
2835*c54f35caSApple OSS Distributions int count = 0;
2836*c54f35caSApple OSS Distributions OSDictionary *dict;
2837*c54f35caSApple OSS Distributions
2838*c54f35caSApple OSS Distributions // get count and reverse order
2839*c54f35caSApple OSS Distributions o = header->elements;
2840*c54f35caSApple OSS Distributions header->elements = 0;
2841*c54f35caSApple OSS Distributions while (o) {
2842*c54f35caSApple OSS Distributions count++;
2843*c54f35caSApple OSS Distributions t = o;
2844*c54f35caSApple OSS Distributions o = o->next;
2845*c54f35caSApple OSS Distributions
2846*c54f35caSApple OSS Distributions t->next = header->elements;
2847*c54f35caSApple OSS Distributions header->elements = t;
2848*c54f35caSApple OSS Distributions }
2849*c54f35caSApple OSS Distributions
2850*c54f35caSApple OSS Distributions dict = OSDictionary::withCapacity(count);
2851*c54f35caSApple OSS Distributions if (header->idref >= 0) {
2852*c54f35caSApple OSS Distributions rememberObject(state, header->idref, dict);
2853*c54f35caSApple OSS Distributions }
2854*c54f35caSApple OSS Distributions
2855*c54f35caSApple OSS Distributions o = header->elements;
2856*c54f35caSApple OSS Distributions while (o) {
2857*c54f35caSApple OSS Distributions dict->setObject(o->key, o->object);
2858*c54f35caSApple OSS Distributions
2859*c54f35caSApple OSS Distributions o->key->release();
2860*c54f35caSApple OSS Distributions o->object->release();
2861*c54f35caSApple OSS Distributions o->key = 0;
2862*c54f35caSApple OSS Distributions o->object = 0;
2863*c54f35caSApple OSS Distributions
2864*c54f35caSApple OSS Distributions t = o;
2865*c54f35caSApple OSS Distributions o = o->next;
2866*c54f35caSApple OSS Distributions freeObject(state, t);
2867*c54f35caSApple OSS Distributions }
2868*c54f35caSApple OSS Distributions o = header;
2869*c54f35caSApple OSS Distributions o->object = dict;
2870*c54f35caSApple OSS Distributions return o;
2871*c54f35caSApple OSS Distributions };
2872*c54f35caSApple OSS Distributions
2873*c54f35caSApple OSS Distributions object_t *
buildArray(parser_state_t * state,object_t * header)2874*c54f35caSApple OSS Distributions buildArray(parser_state_t *state, object_t * header)
2875*c54f35caSApple OSS Distributions {
2876*c54f35caSApple OSS Distributions object_t *o, *t;
2877*c54f35caSApple OSS Distributions int count = 0;
2878*c54f35caSApple OSS Distributions OSArray *array;
2879*c54f35caSApple OSS Distributions
2880*c54f35caSApple OSS Distributions // get count and reverse order
2881*c54f35caSApple OSS Distributions o = header->elements;
2882*c54f35caSApple OSS Distributions header->elements = 0;
2883*c54f35caSApple OSS Distributions while (o) {
2884*c54f35caSApple OSS Distributions count++;
2885*c54f35caSApple OSS Distributions t = o;
2886*c54f35caSApple OSS Distributions o = o->next;
2887*c54f35caSApple OSS Distributions
2888*c54f35caSApple OSS Distributions t->next = header->elements;
2889*c54f35caSApple OSS Distributions header->elements = t;
2890*c54f35caSApple OSS Distributions }
2891*c54f35caSApple OSS Distributions
2892*c54f35caSApple OSS Distributions array = OSArray::withCapacity(count);
2893*c54f35caSApple OSS Distributions if (header->idref >= 0) {
2894*c54f35caSApple OSS Distributions rememberObject(state, header->idref, array);
2895*c54f35caSApple OSS Distributions }
2896*c54f35caSApple OSS Distributions
2897*c54f35caSApple OSS Distributions o = header->elements;
2898*c54f35caSApple OSS Distributions while (o) {
2899*c54f35caSApple OSS Distributions array->setObject(o->object);
2900*c54f35caSApple OSS Distributions
2901*c54f35caSApple OSS Distributions o->object->release();
2902*c54f35caSApple OSS Distributions o->object = 0;
2903*c54f35caSApple OSS Distributions
2904*c54f35caSApple OSS Distributions t = o;
2905*c54f35caSApple OSS Distributions o = o->next;
2906*c54f35caSApple OSS Distributions freeObject(state, t);
2907*c54f35caSApple OSS Distributions }
2908*c54f35caSApple OSS Distributions o = header;
2909*c54f35caSApple OSS Distributions o->object = array;
2910*c54f35caSApple OSS Distributions return o;
2911*c54f35caSApple OSS Distributions };
2912*c54f35caSApple OSS Distributions
2913*c54f35caSApple OSS Distributions object_t *
buildSet(parser_state_t * state,object_t * header)2914*c54f35caSApple OSS Distributions buildSet(parser_state_t *state, object_t *header)
2915*c54f35caSApple OSS Distributions {
2916*c54f35caSApple OSS Distributions object_t *o = buildArray(state, header);
2917*c54f35caSApple OSS Distributions
2918*c54f35caSApple OSS Distributions #if KERNEL
2919*c54f35caSApple OSS Distributions OSArray *array = (OSArray *)o->object;
2920*c54f35caSApple OSS Distributions OSSet *set = OSSet::withArray(array, array->getCapacity());
2921*c54f35caSApple OSS Distributions
2922*c54f35caSApple OSS Distributions // write over the reference created in buildArray
2923*c54f35caSApple OSS Distributions if (header->idref >= 0) {
2924*c54f35caSApple OSS Distributions rememberObject(state, header->idref, set);
2925*c54f35caSApple OSS Distributions }
2926*c54f35caSApple OSS Distributions
2927*c54f35caSApple OSS Distributions array->release();
2928*c54f35caSApple OSS Distributions o->object = set;
2929*c54f35caSApple OSS Distributions #endif /* KERNEL */
2930*c54f35caSApple OSS Distributions return o;
2931*c54f35caSApple OSS Distributions };
2932*c54f35caSApple OSS Distributions
2933*c54f35caSApple OSS Distributions object_t *
buildString(parser_state_t * state,object_t * o)2934*c54f35caSApple OSS Distributions buildString(parser_state_t *state, object_t *o)
2935*c54f35caSApple OSS Distributions {
2936*c54f35caSApple OSS Distributions OSString *string;
2937*c54f35caSApple OSS Distributions
2938*c54f35caSApple OSS Distributions string = OSString::withCString(o->string);
2939*c54f35caSApple OSS Distributions if (o->idref >= 0) {
2940*c54f35caSApple OSS Distributions rememberObject(state, o->idref, string);
2941*c54f35caSApple OSS Distributions }
2942*c54f35caSApple OSS Distributions
2943*c54f35caSApple OSS Distributions free(o->string);
2944*c54f35caSApple OSS Distributions o->string = 0;
2945*c54f35caSApple OSS Distributions o->object = string;
2946*c54f35caSApple OSS Distributions
2947*c54f35caSApple OSS Distributions return o;
2948*c54f35caSApple OSS Distributions };
2949*c54f35caSApple OSS Distributions
2950*c54f35caSApple OSS Distributions object_t *
buildSymbol(parser_state_t * state,object_t * o)2951*c54f35caSApple OSS Distributions buildSymbol(parser_state_t *state, object_t *o)
2952*c54f35caSApple OSS Distributions {
2953*c54f35caSApple OSS Distributions OSSymbol *symbol;
2954*c54f35caSApple OSS Distributions
2955*c54f35caSApple OSS Distributions symbol = const_cast < OSSymbol * > (OSSymbol::withCString(o->string));
2956*c54f35caSApple OSS Distributions if (o->idref >= 0) {
2957*c54f35caSApple OSS Distributions rememberObject(state, o->idref, symbol);
2958*c54f35caSApple OSS Distributions }
2959*c54f35caSApple OSS Distributions
2960*c54f35caSApple OSS Distributions safe_free(o->string, o->string_alloc_length);
2961*c54f35caSApple OSS Distributions o->string = 0;
2962*c54f35caSApple OSS Distributions o->object = symbol;
2963*c54f35caSApple OSS Distributions
2964*c54f35caSApple OSS Distributions return o;
2965*c54f35caSApple OSS Distributions };
2966*c54f35caSApple OSS Distributions
2967*c54f35caSApple OSS Distributions object_t *
buildData(parser_state_t * state,object_t * o)2968*c54f35caSApple OSS Distributions buildData(parser_state_t *state, object_t *o)
2969*c54f35caSApple OSS Distributions {
2970*c54f35caSApple OSS Distributions OSData *data;
2971*c54f35caSApple OSS Distributions
2972*c54f35caSApple OSS Distributions if (o->size) {
2973*c54f35caSApple OSS Distributions data = OSData::withBytes(o->data, o->size);
2974*c54f35caSApple OSS Distributions } else {
2975*c54f35caSApple OSS Distributions data = OSData::withCapacity(0);
2976*c54f35caSApple OSS Distributions }
2977*c54f35caSApple OSS Distributions if (o->idref >= 0) {
2978*c54f35caSApple OSS Distributions rememberObject(state, o->idref, data);
2979*c54f35caSApple OSS Distributions }
2980*c54f35caSApple OSS Distributions
2981*c54f35caSApple OSS Distributions if (o->size) {
2982*c54f35caSApple OSS Distributions free(o->data);
2983*c54f35caSApple OSS Distributions }
2984*c54f35caSApple OSS Distributions o->data = 0;
2985*c54f35caSApple OSS Distributions o->object = data;
2986*c54f35caSApple OSS Distributions return o;
2987*c54f35caSApple OSS Distributions };
2988*c54f35caSApple OSS Distributions
2989*c54f35caSApple OSS Distributions object_t *
buildNumber(parser_state_t * state,object_t * o)2990*c54f35caSApple OSS Distributions buildNumber(parser_state_t *state, object_t *o)
2991*c54f35caSApple OSS Distributions {
2992*c54f35caSApple OSS Distributions OSNumber *number = OSNumber::withNumber(o->number, o->size);
2993*c54f35caSApple OSS Distributions
2994*c54f35caSApple OSS Distributions if (o->idref >= 0) {
2995*c54f35caSApple OSS Distributions rememberObject(state, o->idref, number);
2996*c54f35caSApple OSS Distributions }
2997*c54f35caSApple OSS Distributions
2998*c54f35caSApple OSS Distributions o->object = number;
2999*c54f35caSApple OSS Distributions return o;
3000*c54f35caSApple OSS Distributions };
3001*c54f35caSApple OSS Distributions
3002*c54f35caSApple OSS Distributions object_t *
buildBoolean(parser_state_t * state __unused,object_t * o)3003*c54f35caSApple OSS Distributions buildBoolean(parser_state_t *state __unused, object_t *o)
3004*c54f35caSApple OSS Distributions {
3005*c54f35caSApple OSS Distributions o->object = ((o->number == 0) ? kOSBooleanFalse : kOSBooleanTrue);
3006*c54f35caSApple OSS Distributions o->object->retain();
3007*c54f35caSApple OSS Distributions return o;
3008*c54f35caSApple OSS Distributions };
3009*c54f35caSApple OSS Distributions
3010*c54f35caSApple OSS Distributions OSObject*
OSUnserializeXML(const char * buffer,OSString ** errorString)3011*c54f35caSApple OSS Distributions OSUnserializeXML(const char *buffer, OSString **errorString)
3012*c54f35caSApple OSS Distributions {
3013*c54f35caSApple OSS Distributions OSObject *object;
3014*c54f35caSApple OSS Distributions
3015*c54f35caSApple OSS Distributions if (!buffer) {
3016*c54f35caSApple OSS Distributions return 0;
3017*c54f35caSApple OSS Distributions }
3018*c54f35caSApple OSS Distributions parser_state_t *state = (parser_state_t *)malloc_type(parser_state_t);
3019*c54f35caSApple OSS Distributions if (!state) {
3020*c54f35caSApple OSS Distributions return 0;
3021*c54f35caSApple OSS Distributions }
3022*c54f35caSApple OSS Distributions
3023*c54f35caSApple OSS Distributions // just in case
3024*c54f35caSApple OSS Distributions if (errorString) {
3025*c54f35caSApple OSS Distributions *errorString = NULL;
3026*c54f35caSApple OSS Distributions }
3027*c54f35caSApple OSS Distributions
3028*c54f35caSApple OSS Distributions state->parseBuffer = buffer;
3029*c54f35caSApple OSS Distributions state->parseBufferIndex = 0;
3030*c54f35caSApple OSS Distributions state->lineNumber = 1;
3031*c54f35caSApple OSS Distributions state->objects = 0;
3032*c54f35caSApple OSS Distributions state->freeObjects = 0;
3033*c54f35caSApple OSS Distributions state->tags = OSDictionary::withCapacity(128);
3034*c54f35caSApple OSS Distributions state->errorString = errorString;
3035*c54f35caSApple OSS Distributions state->parsedObject = 0;
3036*c54f35caSApple OSS Distributions state->parsedObjectCount = 0;
3037*c54f35caSApple OSS Distributions state->retrievedObjectCount = 0;
3038*c54f35caSApple OSS Distributions
3039*c54f35caSApple OSS Distributions (void)yyparse((void *)state);
3040*c54f35caSApple OSS Distributions
3041*c54f35caSApple OSS Distributions object = state->parsedObject;
3042*c54f35caSApple OSS Distributions
3043*c54f35caSApple OSS Distributions cleanupObjects(state);
3044*c54f35caSApple OSS Distributions state->tags->release();
3045*c54f35caSApple OSS Distributions free_type(parser_state_t, state);
3046*c54f35caSApple OSS Distributions
3047*c54f35caSApple OSS Distributions return object;
3048*c54f35caSApple OSS Distributions }
3049*c54f35caSApple OSS Distributions
3050*c54f35caSApple OSS Distributions #if KERNEL
3051*c54f35caSApple OSS Distributions #include <libkern/OSSerializeBinary.h>
3052*c54f35caSApple OSS Distributions
3053*c54f35caSApple OSS Distributions OSObject*
OSUnserializeXML(const char * buffer,size_t bufferSize,OSString ** errorString)3054*c54f35caSApple OSS Distributions OSUnserializeXML(const char *buffer, size_t bufferSize, OSString **errorString)
3055*c54f35caSApple OSS Distributions {
3056*c54f35caSApple OSS Distributions if (!buffer) {
3057*c54f35caSApple OSS Distributions return 0;
3058*c54f35caSApple OSS Distributions }
3059*c54f35caSApple OSS Distributions if (bufferSize < sizeof(kOSSerializeBinarySignature)) {
3060*c54f35caSApple OSS Distributions return 0;
3061*c54f35caSApple OSS Distributions }
3062*c54f35caSApple OSS Distributions
3063*c54f35caSApple OSS Distributions if (!strcmp(kOSSerializeBinarySignature, buffer)
3064*c54f35caSApple OSS Distributions || (kOSSerializeIndexedBinarySignature == (uint8_t)buffer[0])) {
3065*c54f35caSApple OSS Distributions return OSUnserializeBinary(buffer, bufferSize, errorString);
3066*c54f35caSApple OSS Distributions }
3067*c54f35caSApple OSS Distributions
3068*c54f35caSApple OSS Distributions // XML must be null terminated
3069*c54f35caSApple OSS Distributions if (buffer[bufferSize - 1]) {
3070*c54f35caSApple OSS Distributions return 0;
3071*c54f35caSApple OSS Distributions }
3072*c54f35caSApple OSS Distributions
3073*c54f35caSApple OSS Distributions return OSUnserializeXML(buffer, errorString);
3074*c54f35caSApple OSS Distributions }
3075*c54f35caSApple OSS Distributions
3076*c54f35caSApple OSS Distributions #else /* !KERNEL */
3077*c54f35caSApple OSS Distributions
3078*c54f35caSApple OSS Distributions OSObject*
OSUnserializeXML(const char * buffer,size_t bufferSize,OSString ** errorString)3079*c54f35caSApple OSS Distributions OSUnserializeXML(const char *buffer, size_t bufferSize, OSString **errorString)
3080*c54f35caSApple OSS Distributions {
3081*c54f35caSApple OSS Distributions if (!buffer) {
3082*c54f35caSApple OSS Distributions return 0;
3083*c54f35caSApple OSS Distributions }
3084*c54f35caSApple OSS Distributions
3085*c54f35caSApple OSS Distributions // XML must be null terminated
3086*c54f35caSApple OSS Distributions if (buffer[bufferSize - 1]) {
3087*c54f35caSApple OSS Distributions return 0;
3088*c54f35caSApple OSS Distributions }
3089*c54f35caSApple OSS Distributions
3090*c54f35caSApple OSS Distributions return OSUnserializeXML(buffer, errorString);
3091*c54f35caSApple OSS Distributions }
3092*c54f35caSApple OSS Distributions
3093*c54f35caSApple OSS Distributions #endif /* KERNEL */
3094*c54f35caSApple OSS Distributions
3095*c54f35caSApple OSS Distributions
3096*c54f35caSApple OSS Distributions //
3097*c54f35caSApple OSS Distributions //
3098*c54f35caSApple OSS Distributions //
3099*c54f35caSApple OSS Distributions //
3100*c54f35caSApple OSS Distributions //
3101*c54f35caSApple OSS Distributions // DO NOT EDIT OSUnserializeXMLSharedImplementation.h!
3102*c54f35caSApple OSS Distributions //
3103*c54f35caSApple OSS Distributions // this means you!
3104*c54f35caSApple OSS Distributions //
3105*c54f35caSApple OSS Distributions //
3106*c54f35caSApple OSS Distributions //
3107*c54f35caSApple OSS Distributions //
3108*c54f35caSApple OSS Distributions //
3109