os-cmpi-xen

view src/Xen_SettingDataParser.y @ 121:4868ace2726b

Add initial consistence checks in test suite for Xen_MemoryPool, Xen_ProcessorPool and Xen_VirtualSystemManagementService.

Signed-off-by: Luke Szymanski <Lukasz.Szymanski@Unisys.com>
author Jim Fehlig <jfehlig@novell.com>
date Fri Jun 08 10:22:05 2007 -0600 (2007-06-08)
parents 4ae953dc7f33
children
line source
1 /* DEFINITIONS SECTION */
2 /* Everything between %{ ... %} is copied verbatim to the start of the parser generated C code. */
4 %{
5 #include <stdlib.h>
7 #include "cmpiutil.h"
8 #include "cmpimacs.h" /* Contains CMSetProperty() */
10 #define RC_OK 0
11 #define RC_EOF EOF
13 /* DEFINE ANY GLOBAL VARS HERE */
14 static CMPIBroker * _BROKER;
15 static CMPIInstance ** _INSTANCE; /* The current instance that is being read into */
16 %}
18 /* List all possible CIM property types that can be returned by the lexer */
19 %union {
20 /* Note - we override the CIM definition of string to make this data type
21 easier to handle in the lexer/parser. Instead implemented as simple text string. */
22 char * string;
23 CMPIBoolean boolean;
24 CMPISint64 sint64;
25 }
27 /* DEFINE SIMPLE (UNTYPED) LEXICAL TOKENS */
28 %token INSTANCE OF ENDOFFILE
30 /* DEFINE LEXICAL TOKENS THAT RETURN A VALUE AND THEIR RETURN TYPE (OBTAINED FROM THE %union ABOVE) */
31 %token <string> CLASSNAME
32 %token <string> PROPERTYNAME
33 %token <string> STRING
34 %token <boolean> BOOLEAN
35 %token <sint64> INTEGER
37 /* END OF DEFINITIONS SECTION */
38 %%
40 /* RULES SECTION */
41 /* DESCRIBE THE SYNTAX OF EACH INSTANCE ENTRY IN THE SOURCE FILE */
43 instance: /* empty */
44 | INSTANCE OF CLASSNAME '{'
45 {
46 fprintf(stderr,"classname = %s\n",$3);
47 *_INSTANCE = _CMNewInstance(_BROKER, "root/cimv2", $3, NULL);
48 free($3);
49 }
50 properties '}' ';'
51 {
52 /* Return after reading in each instance */
53 return RC_OK;
54 }
56 | ENDOFFILE { return RC_EOF; }
57 ;
59 properties: /* empty */
60 | ENDOFFILE
61 | property
62 | property properties
63 ;
65 property: PROPERTYNAME '=' STRING ';'
66 {
67 fprintf(stderr,"propertyname = %s\n",$1);
68 fprintf(stderr,"\ttype = CMPI_chars\n");
69 fprintf(stderr,"\tvalue = %s\n",$3);
70 CMSetProperty( *_INSTANCE, $1, $3, CMPI_chars );
71 free($1); free($3);
72 }
74 | PROPERTYNAME '=' INTEGER ';'
75 {
76 fprintf(stderr,"propertyname = %s\n",$1);
77 fprintf(stderr,"\ttype = CMPI_sint64\n");
78 fprintf(stderr,"\tvalue = %lld\n",$3);
79 unsigned long long value = $3;
80 CMSetProperty( *_INSTANCE, $1, &(value), CMPI_uint64 );
81 free($1);
82 }
84 | PROPERTYNAME '=' BOOLEAN ';'
85 {
86 fprintf(stderr,"propertyname = %s\n",$1);
87 fprintf(stderr,"\ttype = CMPI_boolean\n");
88 fprintf(stderr,"\tvalue = %d\n",$3);
89 CMSetProperty( *_INSTANCE, $1, &($3), CMPI_boolean );
90 free($1);
91 }
92 ;
94 /* END OF RULES SECTION */
95 %%
97 /* USER SUBROUTINE SECTION */
99 int Xen_SettingDatayyparseinstance( CMPIBroker * broker, CMPIInstance ** instance )
100 {
101 _BROKER = broker;
102 _INSTANCE = instance;
104 /* Parse the next instance */
105 return(Xen_SettingDatayyparse());
106 }