jx_match.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2016- The University of Notre Dame
00003 This software is distributed under the GNU General Public License.
00004 See the file COPYING for details.
00005 */
00006 
00088 #ifndef JX_MATCH_H
00089 #define JX_MATCH_H
00090 
00091 #include <jx.h>
00092 
00093 #ifndef JX_ANY
00094 #define JX_ANY -1
00095 #endif
00096 
00097 /*
00098  * Macro to test if we're using a GNU C compiler of a specific vintage
00099  * or later, for e.g. features that appeared in a particular version
00100  * of GNU C.  Usage:
00101  *
00102  * #if __GNUC_PREREQ__(major, minor)
00103  * ...cool feature...
00104  * #else
00105  * ...delete feature...
00106  * #endif
00107  */
00108 #ifndef __GNUC_PREREQ__
00109 #ifdef __GNUC__
00110 #define __GNUC_PREREQ__(x, y) \
00111         ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
00112          (__GNUC__ > (x)))
00113 #else
00114 #define __GNUC_PREREQ__(x, y) 0
00115 #endif
00116 #endif
00117 
00118 #ifndef __wur
00119 #if __GNUC_PREREQ__(3, 4)
00120 #define __wur __attribute__((warn_unused_result))
00121 #else
00122 #define __wur
00123 #endif
00124 #endif
00125 
00126 #ifndef __sentinel
00127 #if __GNUC_PREREQ__(4, 0)
00128 #define __sentinel __attribute__((sentinel))
00129 #else
00130 #define __sentinel
00131 #endif
00132 #endif
00133 
00140 int jx_match_boolean(struct jx *j, int *v) __wur;
00141 
00148 int jx_match_integer(struct jx *j, jx_int_t *v) __wur;
00149 
00156 int jx_match_double(struct jx *j, double *v) __wur;
00157 
00176 int jx_match_string(struct jx *j, char **v) __wur;
00177 
00188 int jx_match_symbol(struct jx *j, char **v) __wur;
00189 
00205 int jx_match_array(struct jx *j, ...) __wur __sentinel;
00206 
00207 #endif

Generated on 17 Sep 2019 for cctools by  doxygen 1.6.1