fix gdbinit; postprocessing macros
[m6w6/ext-psi] / src / types / decl_enum_item.h
index 3b976dea2c0d33c94e83a17807a22d83313ed457..86e4dc8b255e0f26a18afe31d1d7047e2f4dccb3 100644 (file)
@@ -1,31 +1,48 @@
-#ifndef _PSI_TYPES_DECL_ENUM_ITEM_H
-#define _PSI_TYPES_DECL_ENUM_ITEM_H
+/*******************************************************************************
+ Copyright (c) 2016, Michael Wallner <mike@php.net>.
+ All rights reserved.
 
-typedef struct decl_enum_item {
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+     * Redistributions of source code must retain the above copyright notice,
+       this list of conditions and the following disclaimer.
+     * Redistributions in binary form must reproduce the above copyright
+       notice, this list of conditions and the following disclaimer in the
+       documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+#ifndef PSI_TYPES_DECL_ENUM_ITEM_H
+#define PSI_TYPES_DECL_ENUM_ITEM_H
+
+struct psi_data;
+struct psi_token;
+struct psi_num_exp;
+struct psi_decl_enum;
+
+struct psi_decl_enum_item {
        struct psi_token *token;
-       char *name;
-       num_exp *num;
-       num_exp inc;
-       struct decl_enum_item *prev;
-} decl_enum_item;
-
-static inline decl_enum_item *init_decl_enum_item(const char *name, num_exp *num) {
-       decl_enum_item *i = calloc(1, sizeof(*i));
-
-       i->name = strdup(name);
-       i->num = num;
-       return i;
-}
-
-static inline void free_decl_enum_item(decl_enum_item *i) {
-       if (i->token) {
-               free(i->token);
-       }
-       if (i->num && i->num != &i->inc) {
-               free_num_exp(i->num);
-       }
-       free(i->name);
-       free(i);
-}
+       zend_string *name;
+       int64_t val;
+       struct psi_num_exp inc;
+       struct psi_num_exp *num;
+       struct psi_decl_enum_item *prev;
+};
+
+struct psi_decl_enum_item *psi_decl_enum_item_init(zend_string *name, struct psi_num_exp *num);
+void psi_decl_enum_item_free(struct psi_decl_enum_item **i_ptr);
+void psi_decl_enum_item_dump(struct psi_dump *dump, struct psi_decl_enum_item *item);
+bool psi_decl_enum_item_validate(struct psi_data *data, struct psi_decl_enum *enm, struct psi_decl_enum_item *item, size_t seq);
 
 #endif