Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:48:05

0001 /*
0002 Copyright Rene Rivera 2011-2015
0003 Distributed under the Boost Software License, Version 1.0.
0004 (See accompanying file LICENSE_1_0.txt or copy at
0005 http://www.boost.org/LICENSE_1_0.txt)
0006 */
0007 #include <boost/predef.h>
0008 
0009 #define BOOST_PREDEF_INTERNAL_GENERATE_TESTS
0010 
0011 void * add_predef_entry(const char * name, const char * description, unsigned value);
0012 #undef BOOST_PREDEF_DECLARE_TEST
0013 #define BOOST_PREDEF_DECLARE_TEST(x,s) void predef_entry_##x() { add_predef_entry(#x, s, x); }
0014 #include <boost/predef.h>
0015 
0016 #undef BOOST_PREDEF_DECLARE_TEST
0017 #define BOOST_PREDEF_DECLARE_TEST(x,s) predef_entry_##x();
0018 void create_predef_entries()
0019 {
0020 #include <boost/predef.h>
0021 }
0022 
0023 #ifdef __cplusplus
0024 #include <cstring>
0025 #include <cstdio>
0026 #include <cstdlib>
0027 using namespace std;
0028 #else
0029 #include <string.h>
0030 #include <stdio.h>
0031 #include <stdlib.h>
0032 #endif
0033 
0034 typedef struct predef_info
0035 {
0036     const char * name;
0037     const char * description;
0038     unsigned value;
0039 } predef_info;
0040 
0041 #ifdef __cplusplus
0042 using namespace std;
0043 #endif
0044 
0045 unsigned generated_predef_info_count = 0;
0046 predef_info* generated_predef_info = 0;
0047 void * add_predef_entry(const char * name, const char * description, unsigned value)
0048 {
0049     if (0 == generated_predef_info_count)
0050     {
0051         generated_predef_info_count = 1;
0052         generated_predef_info = (predef_info*)malloc(sizeof(predef_info));
0053     }
0054     else
0055     {
0056         generated_predef_info_count += 1;
0057         generated_predef_info = (predef_info*)realloc(generated_predef_info,
0058             generated_predef_info_count*sizeof(predef_info));
0059     }
0060     generated_predef_info[generated_predef_info_count-1].name = name;
0061     generated_predef_info[generated_predef_info_count-1].description = description;
0062     generated_predef_info[generated_predef_info_count-1].value = value;
0063     return 0;
0064 }
0065 
0066 int predef_info_compare(const void * a, const void * b)
0067 {
0068     const predef_info * i = (const predef_info *)a;
0069     const predef_info * j = (const predef_info *)b;
0070     return strcmp(i->name,j->name);
0071 }