Home | History | Annotate | Download | only in jni
      1 #!/bin/sh
      2 #
      3 # This script is used to generate the source files for this test.
      4 #
      5 LIMITS=""
      6 CONSTANTS=""
      7 for SIZE in 8 16 32 64; do
      8     for PREFIX in INT INT_LEAST INT_FAST; do
      9         LIMITS="$LIMITS $PREFIX${SIZE}_MIN $PREFIX${SIZE}_MAX"
     10         CONSTANTS="$CONSTANTS $PREFIX${SIZE}_C"
     11     done
     12     for PREFIX in UINT UINT_LEAST UINT_FAST; do
     13         LIMITS="$LIMITS $PREFIX${SIZE}_MAX"
     14         CONSTANTS="$CONSTANTS $PREFIX${SIZE}_C"
     15     done
     16 done
     17 
     18 LIMITS="$LIMITS INTMAX_MIN INTMAX_MAX UINTMAX_MAX"
     19 CONSTANTS="$CONSTANTS INTMAX_C UINTMAX_C"
     20 
     21 for PREFIX in INTPTR PTRDIFF; do
     22     LIMITS="$LIMITS ${PREFIX}_MIN ${PREFIX}_MAX"
     23     CONSTANTS="$CONSTANTS ${PREFIX}_C"
     24 done
     25 
     26 LIMITS="$LIMITS UINTPTR_MAX"
     27 CONSTANTS="$CONSTANTS UINTPTR_C"
     28 
     29 SRC=test_cpp_no_macros.cpp
     30 
     31 gen_cpp_no_macros ()
     32 {
     33     echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */"
     34     echo "#include <stdint.h>"
     35     for MACRO in $LIMITS $CONSTANTS; do
     36         echo "#ifdef $MACRO"
     37         echo "#error $MACRO defined!"
     38         echo "#endif"
     39     done
     40 }
     41 
     42 gen_cpp_limit_macros ()
     43 {
     44     echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */"
     45     echo "#define __STDC_LIMIT_MACROS 1"
     46     echo "#include <stdint.h>"
     47     for MACRO in $LIMITS; do
     48         echo "#ifndef $MACRO"
     49         echo "#error $MACRO is not defined!"
     50         echo "#endif"
     51     done
     52     for MACRO in $CONSTANTS; do
     53         echo "#ifdef $MACRO"
     54         echo "#error $MACRO is defined!"
     55         echo "#endif"
     56     done
     57 }
     58 
     59 gen_cpp_constant_macros ()
     60 {
     61     echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */"
     62     echo "#define __STDC_CONSTANT_MACROS 1"
     63     echo "#include <stdint.h>"
     64     for MACRO in $LIMITS; do
     65         echo "#ifdef $MACRO"
     66         echo "#error $MACRO is defined!"
     67         echo "#endif"
     68     done
     69     for MACRO in $CONSTANTS; do
     70         echo "#ifndef $MACRO"
     71         echo "#error $MACRO is not defined!"
     72         echo "#endif"
     73     done
     74 }
     75 
     76 gen_cpp_all_macros ()
     77 {
     78     echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */"
     79     echo "#define __STDC_LIMIT_MACROS 1"
     80     echo "#define __STDC_CONSTANT_MACROS 1"
     81     echo "#include <stdint.h>"
     82     for MACRO in $LIMITS $CONSTANTS; do
     83         echo "#ifndef $MACRO"
     84         echo "#error $MACRO defined!"
     85         echo "#endif"
     86     done
     87 }
     88 
     89 gen_c ()
     90 {
     91     echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */"
     92     echo "#include <stdint.h>"
     93     for MACRO in $LIMITS $CONSTANTS; do
     94         echo "#ifndef $MACRO"
     95         echo "#error $MACRO defined!"
     96         echo "#endif"
     97     done
     98 }
     99 
    100 gen_c > test_c.c
    101 gen_cpp_no_macros > test_no_macros.cpp
    102 gen_cpp_limit_macros > test_limit_macros.cpp
    103 gen_cpp_constant_macros > test_constant_macros.cpp
    104 gen_cpp_all_macros > test_all_macros.cpp
    105