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 #ifndef JX_ANY
00092 #define JX_ANY -1
00093 #endif
00094 
00095 /*
00096  * Macro to test if we're using a GNU C compiler of a specific vintage
00097  * or later, for e.g. features that appeared in a particular version
00098  * of GNU C.  Usage:
00099  *
00100  * #if __GNUC_PREREQ__(major, minor)
00101  * ...cool feature...
00102  * #else
00103  * ...delete feature...
00104  * #endif
00105  */
00106 #ifndef __GNUC_PREREQ__
00107 #ifdef __GNUC__
00108 #define __GNUC_PREREQ__(x, y) \
00109         ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
00110          (__GNUC__ > (x)))
00111 #else
00112 #define __GNUC_PREREQ__(x, y) 0
00113 #endif
00114 #endif
00115 
00116 #ifndef __wur
00117 #if __GNUC_PREREQ__(3, 4)
00118 #define __wur __attribute__((warn_unused_result))
00119 #else
00120 #define __wur
00121 #endif
00122 #endif
00123 
00124 #ifndef __sentinel
00125 #if __GNUC_PREREQ__(4, 0)
00126 #define __sentinel __attribute__((sentinel))
00127 #else
00128 #define __sentinel
00129 #endif
00130 #endif
00131 
00138 int jx_match_boolean(struct jx *j, int *v) __wur;
00139 
00146 int jx_match_integer(struct jx *j, jx_int_t *v) __wur;
00147 
00154 int jx_match_double(struct jx *j, double *v) __wur;
00155 
00174 int jx_match_string(struct jx *j, char **v) __wur;
00175 
00186 int jx_match_symbol(struct jx *j, char **v) __wur;
00187 
00203 int jx_match_array(struct jx *j, ...) __wur __sentinel;
00204 
00205 #endif

Generated on 27 Oct 2016 for cctools by  doxygen 1.6.1