Changeset 3848e0e
- Timestamp:
- Dec 3, 2014, 3:08:38 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- d9a0e76
- Parents:
- 42dcae7
- Files:
-
- 1 added
- 1 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
autom4te.cache/requests
r42dcae7 r3848e0e 69 69 'AM_SET_DEPDIR' => 1, 70 70 '_AM_DEPENDENCIES' => 1, 71 'm4_include' => 1, 71 72 'AM_PROG_INSTALL_SH' => 1, 72 'm4_include' => 1,73 73 '_AC_AM_CONFIG_HEADER_HOOK' => 1, 74 74 'AU_DEFUN' => 1, … … 88 88 ], 89 89 { 90 'AM_PROG_F77_C_O' => 1, 90 91 '_LT_AC_TAGCONFIG' => 1, 91 ' AM_PROG_F77_C_O' => 1,92 'm4_pattern_forbid' => 1, 92 93 'AC_INIT' => 1, 93 ' m4_pattern_forbid' => 1,94 'AC_CANONICAL_TARGET' => 1, 94 95 '_AM_COND_IF' => 1, 95 'AC_C ANONICAL_TARGET' => 1,96 'AC_CONFIG_LIBOBJ_DIR' => 1, 96 97 'AC_SUBST' => 1, 97 'AC_C ONFIG_LIBOBJ_DIR' => 1,98 'AC_CANONICAL_HOST' => 1, 98 99 'AC_FC_SRCEXT' => 1, 99 'AC_CANONICAL_HOST' => 1,100 100 'AC_PROG_LIBTOOL' => 1, 101 101 'AM_INIT_AUTOMAKE' => 1, 102 'AC_CONFIG_SUBDIRS' => 1, 102 103 'AM_PATH_GUILE' => 1, 103 'AC_CONFIG_SUBDIRS' => 1,104 104 'AM_AUTOMAKE_VERSION' => 1, 105 105 'LT_CONFIG_LTDL_DIR' => 1, 106 'AC_CONFIG_LINKS' => 1, 106 107 'AC_REQUIRE_AUX_FILE' => 1, 107 ' AC_CONFIG_LINKS' => 1,108 'LT_SUPPORTED_TAG' => 1, 108 109 'm4_sinclude' => 1, 109 'LT_SUPPORTED_TAG' => 1,110 110 'AM_MAINTAINER_MODE' => 1, 111 111 'AM_NLS' => 1, 112 112 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, 113 '_m4_warn' => 1, 113 114 'AM_MAKEFILE_INCLUDE' => 1, 114 '_m4_warn' => 1,115 115 'AM_PROG_CXX_C_O' => 1, 116 '_AM_MAKEFILE_INCLUDE' => 1, 116 117 '_AM_COND_ENDIF' => 1, 117 '_AM_MAKEFILE_INCLUDE' => 1,118 118 'AM_ENABLE_MULTILIB' => 1, 119 119 'AM_SILENT_RULES' => 1, 120 120 'AM_PROG_MOC' => 1, 121 121 'AC_CONFIG_FILES' => 1, 122 'LT_INIT' => 1, 122 123 'include' => 1, 123 ' LT_INIT' => 1,124 'AM_GNU_GETTEXT' => 1, 124 125 'AM_PROG_AR' => 1, 125 'AM_GNU_GETTEXT' => 1,126 126 'AC_LIBSOURCE' => 1, 127 'AC_CANONICAL_BUILD' => 1, 127 128 'AM_PROG_FC_C_O' => 1, 128 'AC_CANONICAL_BUILD' => 1,129 129 'AC_FC_FREEFORM' => 1, 130 130 'AH_OUTPUT' => 1, 131 'AC_CONFIG_AUX_DIR' => 1, 131 132 '_AM_SUBST_NOTMAKE' => 1, 132 'AC_CONFIG_AUX_DIR' => 1, 133 'm4_pattern_allow' => 1, 134 'AM_PROG_CC_C_O' => 1, 133 135 'sinclude' => 1, 134 'AM_ PROG_CC_C_O' => 1,135 ' m4_pattern_allow' => 1,136 'AM_CONDITIONAL' => 1, 137 'AC_CANONICAL_SYSTEM' => 1, 136 138 'AM_XGETTEXT_OPTION' => 1, 137 'AC_CANONICAL_SYSTEM' => 1,138 'AM_CONDITIONAL' => 1,139 139 'AC_CONFIG_HEADERS' => 1, 140 140 'AC_DEFINE_TRACE_LITERAL' => 1, -
libcfa/Makefile.in
r42dcae7 r3848e0e 13 13 14 14 # make forward declarations for gcc builtins 15 builtins.cf: builtins.c builtins.def15 builtins.cf: Makefile builtins.c builtins.def 16 16 @BACKEND_CC@ -E builtins.c | sed 's/"//g' > builtins.cf 17 17 18 18 libcfa-prelude.c: ../translator/cfa-cpp prelude.cf builtins.cf 19 sed -i -e "s#typedef.*ptrdiff_t.*#`@BACKEND_CC@ -E ptrdiff_t.c | grep 'typedef.*ptrdiff_t'`#" prelude.cf 19 20 ../translator/cfa-cpp -l prelude.cf $@ 21 rm -f prelude.c 20 22 21 23 libcfa-prelude.o: libcfa-prelude.c … … 32 34 33 35 distclean: clean 34 -
libcfa/prelude.cf
r42dcae7 r3848e0e 1 /* Standard Cforall Preample 2 * 3 * Copyright 1994, 1999 Glen Ditchfield 4 * 5 */ 6 7 // #include <stddef.h> 8 typedef long _ptrdiff_t; 9 10 /* 11 * Section 4.1 Primary Expressions 12 */ 1 // -*- Mode: C -*- 2 // 3 // Copyright (C) Glen Ditchfield 1994, 1999 4 // 5 // prelude.cf -- Standard Cforall Preample 6 // 7 // Author : Glen Ditchfield 8 // Created On : Sat Nov 29 07:23:41 2014 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Tue Dec 2 09:25:31 2014 11 // Update Count : 20 12 // 13 14 // Following line added from stddef.h by build 15 typedef long int ptrdiff_t; 16 17 // Section numbers from: http://plg.uwaterloo.ca/~cforall/refrat.pdf 18 19 // ------------------------------------------------------------ 20 // 21 // Section 4.1 Primary Expressions 22 // 23 // ------------------------------------------------------------ 24 13 25 const int 0, 1; 14 /* 15 const int 0; 16 */ 17 forall (dtype DT) const DT* const 0; 18 forall (ftype FT) FT * const 0; 19 20 /* 21 * ------------------------------------------------------------ 22 * 23 * Section 4.2 Postfix Operators 24 */ 25 26 int ?++( int *), ?--( int *); 27 unsigned ?++( unsigned *), ?--( unsigned *); 28 long ?++( long *), ?--( long *); 29 long unsigned ?++( long unsigned *), ?--( long unsigned *); 30 float ?++( float *), ?--( float *); 31 double ?++( double *), ?--( double *); 32 long double ?++( long double *), ?--( long double *); 33 34 forall(type T) T* ?++( T**); 35 forall(type T) T* ?--( T**); 36 forall(type T) const T* ?++(const T**); 37 forall(type T) const T* ?--(const T**); 38 forall(type T) volatile T* ?++( volatile T**); 39 forall(type T) volatile T* ?--( volatile T**); 40 forall(type T) const volatile T* ?++(const volatile T**); 41 forall(type T) const volatile T* ?--(const volatile T**); 42 43 forall(type T) lvalue T ?[?]( T*, _ptrdiff_t); 44 forall(type T) const lvalue T ?[?](const T*, _ptrdiff_t); 45 forall(type T) volatile lvalue T ?[?]( volatile T*, _ptrdiff_t); 46 forall(type T) const volatile lvalue T ?[?](const volatile T*, _ptrdiff_t); 47 forall(type T) lvalue T ?[?](_ptrdiff_t, T*); 48 forall(type T) const lvalue T ?[?](_ptrdiff_t, const T*); 49 forall(type T) volatile lvalue T ?[?](_ptrdiff_t, volatile T*); 50 forall(type T) const volatile lvalue T ?[?](_ptrdiff_t, const volatile T*); 51 52 /* 53 * ------------------------------------------------------------ 54 * 55 * Section 4.3 Unary Operators 56 */ 57 58 int ++?(int *), --?(int *); 59 unsigned ++?(unsigned *), --?(unsigned *); 60 long ++?(long *), --?(long *); 61 long unsigned ++?(long unsigned *), --?(long unsigned *); 62 float ++?(float *), --?(float *); 63 double ++?(double *), --?(double *); 64 long double ++?(long double *), --?(long double *); 65 66 forall(type T) T* ++?( T**); 67 forall(type T) T* --?( T**); 68 forall(type T) const T* ++?(const T**); 69 forall(type T) const T* --?(const T**); 70 forall(type T) volatile T* ++?( volatile T**); 71 forall(type T) volatile T* --?( volatile T**); 72 forall(type T) const volatile T* ++?(const volatile T**); 73 forall(type T) const volatile T* --?(const volatile T**); 74 75 forall(type T) lvalue T *?( T* ); 76 forall(type T) const lvalue T *?( const T* ); 77 forall(type T) volatile lvalue T *?( volatile T* ); 78 forall(type T) const volatile lvalue T *?( const volatile T* ); 79 forall(ftype FT) lvalue FT *?( FT* ); 80 81 int +?(int), -?(int), ~?(int); 82 unsigned +?(unsigned), -?(unsigned), ~?(unsigned); 83 unsigned long +?(unsigned long), -?(unsigned long), ~?(unsigned long); 84 long +?(long), -?(long), ~?(long); 85 float +?(float), -?(float); 86 double +?(double), -?(double); 87 long double +?(long double), -?(long double); 26 27 forall ( dtype DT ) const DT * const 0; 28 forall ( ftype FT ) FT * const 0; 29 30 // ------------------------------------------------------------ 31 // 32 // Section 4.2 Postfix Operators 33 // 34 // ------------------------------------------------------------ 35 36 int ?++( int * ), ?--( int * ); 37 unsigned ?++( unsigned * ), ?--( unsigned * ); 38 long ?++( long * ), ?--( long * ); 39 long unsigned ?++( long unsigned * ), ?--( long unsigned * ); 40 float ?++( float * ), ?--( float * ); 41 double ?++( double * ), ?--( double * ); 42 long double ?++( long double * ), ?--( long double * ); 43 44 forall( type T ) T * ?++( T ** ); 45 forall( type T ) T * ?--( T ** ); 46 forall( type T ) const T * ?++( const T ** ); 47 forall( type T ) const T * ?--( const T ** ); 48 forall( type T ) volatile T * ?++( volatile T ** ); 49 forall( type T ) volatile T * ?--( volatile T ** ); 50 forall( type T ) const volatile T * ?++( const volatile T ** ); 51 forall( type T ) const volatile T * ?--( const volatile T ** ); 52 53 forall( type T ) lvalue T ?[?]( T *, ptrdiff_t ); 54 forall( type T ) const lvalue T ?[?]( const T *, ptrdiff_t ); 55 forall( type T ) volatile lvalue T ?[?]( volatile T *, ptrdiff_t ); 56 forall( type T ) const volatile lvalue T ?[?]( const volatile T *, ptrdiff_t ); 57 forall( type T ) lvalue T ?[?]( ptrdiff_t, T * ); 58 forall( type T ) const lvalue T ?[?]( ptrdiff_t, const T * ); 59 forall( type T ) volatile lvalue T ?[?]( ptrdiff_t, volatile T * ); 60 forall( type T ) const volatile lvalue T ?[?]( ptrdiff_t, const volatile T * ); 61 62 // ------------------------------------------------------------ 63 // 64 // Section 4.3 Unary Operators 65 // 66 // ------------------------------------------------------------ 67 68 int ++?( int * ), --?( int * ); 69 unsigned ++?( unsigned * ), --?( unsigned * ); 70 long ++?( long * ), --?( long * ); 71 long unsigned ++?( long unsigned * ), --?( long unsigned * ); 72 float ++?( float * ), --?( float * ); 73 double ++?( double * ), --?( double * ); 74 long double ++?( long double * ), --?( long double * ); 75 76 forall( type T ) T * ++?( T ** ); 77 forall( type T ) T * --?( T ** ); 78 forall( type T ) const T * ++?( const T ** ); 79 forall( type T ) const T * --?( const T ** ); 80 forall( type T ) volatile T * ++?( volatile T ** ); 81 forall( type T ) volatile T * --?( volatile T ** ); 82 forall( type T ) const volatile T * ++?( const volatile T ** ); 83 forall( type T ) const volatile T * --?( const volatile T ** ); 84 85 forall( type T ) lvalue T *?( T * ); 86 forall( type T ) const lvalue T *?( const T * ); 87 forall( type T ) volatile lvalue T *?( volatile T * ); 88 forall( type T ) const volatile lvalue T *?( const volatile T * ); 89 forall( ftype FT ) lvalue FT *?( FT * ); 90 91 int +?( int ), -?( int ), ~?( int ); 92 unsigned +?( unsigned ), -?( unsigned ), ~?( unsigned ); 93 unsigned long +?( unsigned long ), -?( unsigned long ), ~?( unsigned long ); 94 long +?( long ), -?( long ), ~?( long ); 95 float +?( float ), -?( float ); 96 double +?( double ), -?( double ); 97 long double +?( long double ), -?( long double ); 88 98 89 99 int !?( int ), !?( unsigned ), !?( long ), !?( unsigned long ), 90 100 !?( float ), !?( double ); 91 101 92 forall ( dtype DT) int !?( const volatile DT* );93 forall ( ftype FT) int !?( FT* );94 95 / *96 * ------------------------------------------------------------ 97 * 98 * Section 4.5 Multiplicative Operators 99 */ 102 forall ( dtype DT ) int !?( const volatile DT * ); 103 forall ( ftype FT ) int !?( FT * ); 104 105 // ------------------------------------------------------------ 106 // 107 // Section 4.5 Multiplicative Operators 108 // 109 // ------------------------------------------------------------ 100 110 101 111 int ?*?( int, int ), … … 117 127 long double ?*?( long double, long double ), 118 128 ?/?( long double, long double ); 119 /* 120 * ------------------------------------------------------------ 121 * 122 * Section 4.6 Additive Operators 123 */ 124 125 int ?+?( int, int), ?-?( int, int); 126 long ?+?( long, long), ?-?( long, long); 127 unsigned ?+?( unsigned, unsigned), ?-?( unsigned, unsigned); 128 long unsigned ?+?( long unsigned, long unsigned), ?-?( long unsigned, long unsigned); 129 float ?+?( float, float), ?-?( float, float); 130 double ?+?( double, double), ?-?( double, double); 131 long double ?+?( long double, long double), ?-?( long double, long double); 132 133 forall(type T) T* ?+?( T*, _ptrdiff_t); 134 forall(type T) T* ?+?( _ptrdiff_t, T*); 135 forall(type T) T* ?-?( T*, _ptrdiff_t); 136 forall(type T) const T* ?+?(const T*, _ptrdiff_t); 137 forall(type T) const T* ?+?( _ptrdiff_t, const T*); 138 forall(type T) const T* ?-?(const T*, _ptrdiff_t); 139 forall(type T) volatile T* ?+?( volatile T*, _ptrdiff_t); 140 forall(type T) volatile T* ?+?( _ptrdiff_t, volatile T*); 141 forall(type T) volatile T* ?-?( volatile T*, _ptrdiff_t); 142 forall(type T) const volatile T* ?+?(const volatile T*, _ptrdiff_t); 143 forall(type T) const volatile T* ?+?( _ptrdiff_t, const volatile T*); 144 forall(type T) const volatile T* ?-?(const volatile T*, _ptrdiff_t); 145 146 forall(type T) _ptrdiff_t ?-?(const volatile T*, const volatile T*); 147 148 /* 149 * ------------------------------------------------------------ 150 * 151 * Section 4.7 Bitwise Shift Operators 152 */ 153 154 int ?<<?(int, int), ?>>?(int, int); 155 long ?<<?(long, long), ?>>?(long, long); 156 unsigned ?<<?(unsigned, unsigned), ?>>?(unsigned, unsigned); 157 long unsigned ?<<?(long unsigned, long unsigned), ?>>?(long unsigned, long unsigned); 158 159 /* 160 * ------------------------------------------------------------ 161 * 162 * Section 4.8 Relational Operators 163 */ 164 165 int ?<?(int, int), ?<=?(int, int), 166 ?>?(int, int), ?>=?(int, int); 167 int ?<?(long, long), ?<=?(long, long), 168 ?>?(long, long), ?>=?(long, long); 169 int ?<?(unsigned, unsigned), ?<=?(unsigned, unsigned), 170 ?>?(unsigned, unsigned), ?>=?(unsigned, unsigned); 171 int ?<?(unsigned long, unsigned long), ?<=?(unsigned long, unsigned long), 172 ?>?(unsigned long, unsigned long), ?>=?(unsigned long, unsigned long); 173 int ?<?(float, float), ?<=?(float, float), 174 ?>?(float, float), ?>=?(float, float); 175 int ?<?(double, double), ?<=?(double, double), 176 ?>?(double, double), ?>=?(double, double); 177 int ?<?(long double, long double), ?<=?(long double, long double), 178 ?>?(long double, long double), ?>=?(long double, long double); 179 180 forall(dtype DT) int ?<?( const volatile DT*, const volatile DT*); 181 forall(dtype DT) int ?>?( const volatile DT*, const volatile DT*); 182 forall(dtype DT) int ?<=?( const volatile DT*, const volatile DT*); 183 forall(dtype DT) int ?>=?( const volatile DT*, const volatile DT*); 184 185 /* 186 * ------------------------------------------------------------ 187 * 188 * Section 4.9 Equality Operators 189 */ 190 191 int ?==?(int, int), ?!=?(int, int); 192 int ?==?(long, long), ?!=?(long, long); 193 int ?==?(unsigned, unsigned), ?!=?(unsigned, unsigned); 194 int ?==?(unsigned long, unsigned long), ?!=?(unsigned long, unsigned long); 195 int ?==?(float, float), ?!=?(float, float); 196 int ?==?(double, double), ?!=?(double, double); 197 int ?==?(long double, long double), ?!=?(long double, long double); 198 199 forall(dtype DT) int ?==?( DT*, DT*); 200 forall(dtype DT) int ?!=?( DT*, DT*); 201 forall(dtype DT) int ?==?( const DT*, const DT*); 202 forall(dtype DT) int ?!=?( const DT*, const DT*); 203 forall(dtype DT) int ?==?( volatile DT*, volatile DT*); 204 forall(dtype DT) int ?!=?( volatile DT*, volatile DT*); 205 forall(dtype DT) int ?==?( const volatile DT*, const volatile DT*); 206 forall(dtype DT) int ?!=?( const volatile DT*, const volatile DT*); 207 forall(ftype FT) int ?==?( FT*, FT*); 208 forall(ftype FT) int ?!=?( FT*, FT*); 209 210 211 forall(dtype DT) int ?==?( const volatile DT*, const volatile void*); 212 forall(dtype DT) int ?!=?( const volatile DT*, const volatile void*); 213 forall(dtype DT) int ?==?( const volatile void*, const volatile DT*); 214 forall(dtype DT) int ?!=?( const volatile void*, const volatile DT*); 215 216 forall(dtype DT) int ?==?( const volatile DT*, forall(dtype DT2)const DT2*); 217 forall(dtype DT) int ?!=?( const volatile DT*, forall(dtype DT2)const DT2*); 218 forall(dtype DT) int ?==?( forall(dtype DT2)const DT2*, const volatile DT*); 219 forall(dtype DT) int ?!=?( forall(dtype DT2)const DT2*, const volatile DT*); 220 forall(ftype FT) int ?==?( FT*, forall(ftype FT2)FT2*); 221 forall(ftype FT) int ?!=?( FT*, forall(ftype FT2)FT2*); 222 forall(ftype FT) int ?==?( forall(ftype FT2)FT2*, FT*); 223 forall(ftype FT) int ?!=?( forall(ftype FT2)FT2*, FT*); 224 225 /* 226 * ------------------------------------------------------------ 227 * 228 * Section 4.10 Bitwise AND Operators 229 */ 129 130 // ------------------------------------------------------------ 131 // 132 // Section 4.6 Additive Operators 133 // 134 // ------------------------------------------------------------ 135 136 int ?+?( int, int ), ?-?( int, int ); 137 long ?+?( long, long ), ?-?( long, long ); 138 unsigned ?+?( unsigned, unsigned ), ?-?( unsigned, unsigned ); 139 long unsigned ?+?( long unsigned, long unsigned ), ?-?( long unsigned, long unsigned ); 140 float ?+?( float, float ), ?-?( float, float ); 141 double ?+?( double, double ), ?-?( double, double ); 142 long double ?+?( long double, long double ), ?-?( long double, long double ); 143 144 forall( type T ) T * ?+?( T *, ptrdiff_t ); 145 forall( type T ) T * ?+?( ptrdiff_t, T * ); 146 forall( type T ) T * ?-?( T *, ptrdiff_t ); 147 forall( type T ) const T * ?+?( const T *, ptrdiff_t ); 148 forall( type T ) const T * ?+?( ptrdiff_t, const T * ); 149 forall( type T ) const T * ?-?( const T *, ptrdiff_t ); 150 forall( type T ) volatile T * ?+?( volatile T *, ptrdiff_t ); 151 forall( type T ) volatile T * ?+?( ptrdiff_t, volatile T * ); 152 forall( type T ) volatile T * ?-?( volatile T *, ptrdiff_t ); 153 forall( type T ) const volatile T * ?+?( const volatile T *, ptrdiff_t ); 154 forall( type T ) const volatile T * ?+?( ptrdiff_t, const volatile T * ); 155 forall( type T ) const volatile T * ?-?( const volatile T *, ptrdiff_t ); 156 157 forall( type T ) ptrdiff_t ?-?( const volatile T *, const volatile T * ); 158 159 // ------------------------------------------------------------ 160 // 161 // Section 4.7 Bitwise Shift Operators 162 // 163 // ------------------------------------------------------------ 164 165 int ?<<?( int, int ), ?>>?( int, int ); 166 long ?<<?( long, long ), ?>>?( long, long ); 167 unsigned ?<<?( unsigned, unsigned ), ?>>?( unsigned, unsigned ); 168 long unsigned ?<<?( long unsigned, long unsigned ), ?>>?( long unsigned, long unsigned ); 169 170 // ------------------------------------------------------------ 171 // 172 // Section 4.8 Relational Operators 173 // 174 // ------------------------------------------------------------ 175 176 int ?<?( int, int ), ?<=?( int, int ), 177 ?>?( int, int ), ?>=?( int, int ); 178 int ?<?( long, long ), ?<=?( long, long ), 179 ?>?( long, long ), ?>=?( long, long ); 180 int ?<?( unsigned, unsigned ), ?<=?( unsigned, unsigned ), 181 ?>?( unsigned, unsigned ), ?>=?( unsigned, unsigned ); 182 int ?<?( unsigned long, unsigned long ), ?<=?( unsigned long, unsigned long ), 183 ?>?( unsigned long, unsigned long ), ?>=?( unsigned long, unsigned long ); 184 int ?<?( float, float ), ?<=?( float, float ), 185 ?>?( float, float ), ?>=?( float, float ); 186 int ?<?( double, double ), ?<=?( double, double ), 187 ?>?( double, double ), ?>=?( double, double ); 188 int ?<?( long double, long double ), ?<=?( long double, long double ), 189 ?>?( long double, long double ), ?>=?( long double, long double ); 190 191 forall( dtype DT ) int ?<?( const volatile DT *, const volatile DT * ); 192 forall( dtype DT ) int ?>?( const volatile DT *, const volatile DT * ); 193 forall( dtype DT ) int ?<=?( const volatile DT *, const volatile DT * ); 194 forall( dtype DT ) int ?>=?( const volatile DT *, const volatile DT * ); 195 196 // ------------------------------------------------------------ 197 // 198 // Section 4.9 Equality Operators 199 // 200 // ------------------------------------------------------------ 201 202 int ?==?( int, int ), ?!=?( int, int ); 203 int ?==?( long, long ), ?!=?( long, long ); 204 int ?==?( unsigned, unsigned ), ?!=?( unsigned, unsigned ); 205 int ?==?( unsigned long, unsigned long ), ?!=?( unsigned long, unsigned long ); 206 int ?==?( float, float ), ?!=?( float, float ); 207 int ?==?( double, double ), ?!=?( double, double ); 208 int ?==?( long double, long double ), ?!=?( long double, long double ); 209 210 forall( dtype DT ) int ?==?( DT *, DT * ); 211 forall( dtype DT ) int ?!=?( DT *, DT * ); 212 forall( dtype DT ) int ?==?( const DT *, const DT * ); 213 forall( dtype DT ) int ?!=?( const DT *, const DT * ); 214 forall( dtype DT ) int ?==?( volatile DT *, volatile DT * ); 215 forall( dtype DT ) int ?!=?( volatile DT *, volatile DT * ); 216 forall( dtype DT ) int ?==?( const volatile DT *, const volatile DT * ); 217 forall( dtype DT ) int ?!=?( const volatile DT *, const volatile DT * ); 218 forall( ftype FT ) int ?==?( FT *, FT * ); 219 forall( ftype FT ) int ?!=?( FT *, FT * ); 220 221 222 forall( dtype DT ) int ?==?( const volatile DT *, const volatile void * ); 223 forall( dtype DT ) int ?!=?( const volatile DT *, const volatile void * ); 224 forall( dtype DT ) int ?==?( const volatile void *, const volatile DT * ); 225 forall( dtype DT ) int ?!=?( const volatile void *, const volatile DT * ); 226 227 forall( dtype DT ) int ?==?( const volatile DT *, forall( dtype DT2 )const DT2 * ); 228 forall( dtype DT ) int ?!=?( const volatile DT *, forall( dtype DT2 )const DT2 * ); 229 forall( dtype DT ) int ?==?( forall( dtype DT2 )const DT2 *, const volatile DT * ); 230 forall( dtype DT ) int ?!=?( forall( dtype DT2 )const DT2 *, const volatile DT * ); 231 forall( ftype FT ) int ?==?( FT *, forall( ftype FT2 )FT2 * ); 232 forall( ftype FT ) int ?!=?( FT *, forall( ftype FT2 )FT2 * ); 233 forall( ftype FT ) int ?==?( forall( ftype FT2 )FT2 *, FT * ); 234 forall( ftype FT ) int ?!=?( forall( ftype FT2 )FT2 *, FT * ); 235 236 // ------------------------------------------------------------ 237 // 238 // Section 4.10 Bitwise AND Operators 239 // 240 // ------------------------------------------------------------ 230 241 231 242 int ?&?( int, int ); … … 234 245 unsigned long ?&?( unsigned long, unsigned long ); 235 246 236 / *237 * ------------------------------------------------------------ 238 * 239 * Section 4.11 Bitwise XOR Operators 240 */ 247 // ------------------------------------------------------------ 248 // 249 // Section 4.11 Bitwise XOR Operators 250 // 251 // ------------------------------------------------------------ 241 252 242 253 int ?^?( int, int ); … … 245 256 unsigned long ?^?( unsigned long, unsigned long ); 246 257 247 / *248 * ------------------------------------------------------------ 249 * 250 * Section 4.12 Bitwise OR Operators 251 */ 258 // ------------------------------------------------------------ 259 // 260 // Section 4.12 Bitwise OR Operators 261 // 262 // ------------------------------------------------------------ 252 263 253 264 int ?|?( int, int ); … … 256 267 unsigned long ?|?( unsigned long, unsigned long ); 257 268 258 / *259 * ------------------------------------------------------------ 260 * 261 * Section 4.16 Assignment Operator 262 */ 263 264 forall( ftype FT) FT* ?=?(FT**, FT*);265 forall( ftype FT) FT* ?=?(FT* volatile*, FT*);266 267 forall( dtype DT) DT* ?=?( DT * *, DT* );268 forall( dtype DT) DT* ?=?( DT * volatile *, DT* );269 forall( dtype DT) const DT* ?=?(const DT * *, DT* );270 forall( dtype DT) const DT* ?=?(const DT * volatile *, DT* );271 forall( dtype DT) const DT* ?=?(const DT * *, const DT* );272 forall( dtype DT) const DT* ?=?(const DT * volatile *, const DT* );273 forall( dtype DT) volatile DT* ?=?( volatile DT * *, DT* );274 forall( dtype DT) volatile DT* ?=?( volatile DT * volatile *, DT* );275 forall( dtype DT) volatile DT* ?=?( volatile DT * *, volatile DT* );276 forall( dtype DT) volatile DT* ?=?( volatile DT * volatile *, volatile DT* );269 // ------------------------------------------------------------ 270 // 271 // Section 4.16 Assignment Operator 272 // 273 // ------------------------------------------------------------ 274 275 forall( ftype FT ) FT * ?=?( FT **, FT * ); 276 forall( ftype FT ) FT * ?=?( FT * volatile *, FT * ); 277 278 forall( dtype DT ) DT * ?=?( DT * *, DT * ); 279 forall( dtype DT ) DT * ?=?( DT * volatile *, DT * ); 280 forall( dtype DT ) const DT * ?=?( const DT * *, DT * ); 281 forall( dtype DT ) const DT * ?=?( const DT * volatile *, DT * ); 282 forall( dtype DT ) const DT * ?=?( const DT * *, const DT * ); 283 forall( dtype DT ) const DT * ?=?( const DT * volatile *, const DT * ); 284 forall( dtype DT ) volatile DT * ?=?( volatile DT * *, DT * ); 285 forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, DT * ); 286 forall( dtype DT ) volatile DT * ?=?( volatile DT * *, volatile DT * ); 287 forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, volatile DT * ); 277 288 278 forall( dtype DT) const volatile DT* ?=?(const volatile DT * *, DT* );279 forall( dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, DT* );280 forall( dtype DT) const volatile DT* ?=?(const volatile DT * *, const DT* );281 forall( dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, const DT* );282 forall( dtype DT) const volatile DT* ?=?(const volatile DT * *, volatile DT* );283 forall( dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, volatile DT* );284 forall( dtype DT) const volatile DT* ?=?(const volatile DT * *, const volatile DT* );285 forall( dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, const volatile DT* );286 287 forall( dtype DT) DT* ?=?( DT * *, void* );288 forall( dtype DT) DT* ?=?( DT * volatile *, void* );289 forall( dtype DT) const DT* ?=?(const DT * *, void* );290 forall( dtype DT) const DT* ?=?(const DT * volatile *, void* );291 forall( dtype DT) const DT* ?=?(const DT * *, const void* );292 forall( dtype DT) const DT* ?=?(const DT * volatile *, const void* );293 forall( dtype DT) volatile DT* ?=?( volatile DT * *, void* );294 forall( dtype DT) volatile DT* ?=?( volatile DT * volatile *, void* );295 forall( dtype DT) volatile DT* ?=?( volatile DT * *, volatile void* );296 forall( dtype DT) volatile DT* ?=?( volatile DT * volatile *, volatile void* );289 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, DT * ); 290 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, DT * ); 291 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, const DT * ); 292 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, const DT * ); 293 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, volatile DT * ); 294 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, volatile DT * ); 295 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, const volatile DT * ); 296 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, const volatile DT * ); 297 298 forall( dtype DT ) DT * ?=?( DT * *, void * ); 299 forall( dtype DT ) DT * ?=?( DT * volatile *, void * ); 300 forall( dtype DT ) const DT * ?=?( const DT * *, void * ); 301 forall( dtype DT ) const DT * ?=?( const DT * volatile *, void * ); 302 forall( dtype DT ) const DT * ?=?( const DT * *, const void * ); 303 forall( dtype DT ) const DT * ?=?( const DT * volatile *, const void * ); 304 forall( dtype DT ) volatile DT * ?=?( volatile DT * *, void * ); 305 forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, void * ); 306 forall( dtype DT ) volatile DT * ?=?( volatile DT * *, volatile void * ); 307 forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, volatile void * ); 297 308 298 forall(dtype DT) const volatile DT* ?=?(const volatile DT * *, void* ); 299 forall(dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, void* ); 300 forall(dtype DT) const volatile DT* ?=?(const volatile DT * *, const void* ); 301 forall(dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, const void* ); 302 forall(dtype DT) const volatile DT* ?=?(const volatile DT * *, volatile void* ); 303 forall(dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, volatile void* ); 304 forall(dtype DT) const volatile DT* ?=?(const volatile DT * *, const volatile void* ); 305 forall(dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, const volatile void* ); 306 307 308 forall(dtype DT) void * ?=?( void * *, DT*); 309 forall(dtype DT) void * ?=?( void * volatile *, DT*); 310 forall(dtype DT) const void * ?=?(const void * *, DT*); 311 forall(dtype DT) const void * ?=?(const void * volatile *, DT*); 312 forall(dtype DT) const void * ?=?(const void * *, const DT*); 313 forall(dtype DT) const void * ?=?(const void * volatile *, const DT*); 314 forall(dtype DT) volatile void * ?=?( volatile void * *, DT*); 315 forall(dtype DT) volatile void * ?=?( volatile void * volatile *, DT*); 316 forall(dtype DT) volatile void * ?=?( volatile void * *, volatile DT*); 317 forall(dtype DT) volatile void * ?=?( volatile void * volatile *, volatile DT*); 318 forall(dtype DT) const volatile void * ?=?(const volatile void * *, DT*); 319 forall(dtype DT) const volatile void * ?=?(const volatile void * volatile *, DT*); 320 forall(dtype DT) const volatile void * ?=?(const volatile void * *, const DT*); 321 forall(dtype DT) const volatile void * ?=?(const volatile void * volatile *, const DT*); 322 forall(dtype DT) const volatile void * ?=?(const volatile void * *, volatile DT*); 323 forall(dtype DT) const volatile void * ?=?(const volatile void * volatile *, volatile DT*); 324 forall(dtype DT) const volatile void * ?=?(const volatile void * *, const volatile DT*); 325 forall(dtype DT) const volatile void * ?=?(const volatile void * volatile *, const volatile DT*); 326 327 void * ?=?( void * *, void*); 328 void * ?=?( void * volatile *, void*); 329 const void * ?=?(const void * *, void*); 330 const void * ?=?(const void * volatile *, void*); 331 const void * ?=?(const void * *, const void*); 332 const void * ?=?(const void * volatile *, const void*); 333 volatile void * ?=?( volatile void * *, void*); 334 volatile void * ?=?( volatile void * volatile *, void*); 335 volatile void * ?=?( volatile void * *, volatile void*); 336 volatile void * ?=?( volatile void * volatile *, volatile void*); 337 const volatile void * ?=?(const volatile void * *, void*); 338 const volatile void * ?=?(const volatile void * volatile *, void*); 339 const volatile void * ?=?(const volatile void * *, const void*); 340 const volatile void * ?=?(const volatile void * volatile *, const void*); 341 const volatile void * ?=?(const volatile void * *, volatile void*); 342 const volatile void * ?=?(const volatile void * volatile *, volatile void*); 343 const volatile void * ?=?(const volatile void * *, const volatile void*); 344 const volatile void * ?=?(const volatile void * volatile *, const volatile void*); 345 346 forall(dtype DT) DT* ?=?( DT * *, forall(dtype DT2) const DT2*); 347 forall(dtype DT) DT* ?=?( DT * volatile *, forall(dtype DT2) const DT2*); 348 forall(dtype DT) const DT* ?=?(const DT * *, forall(dtype DT2) const DT2*); 349 forall(dtype DT) const DT* ?=?(const DT * volatile *, forall(dtype DT2) const DT2*); 350 forall(dtype DT) volatile DT* ?=?( volatile DT * *, forall(dtype DT2) const DT2*); 351 forall(dtype DT) volatile DT* ?=?( volatile DT * volatile *, forall(dtype DT2) const DT2*); 352 forall(dtype DT) const volatile DT* ?=?(const volatile DT * *, forall(dtype DT2) const DT2*); 353 forall(dtype DT) const volatile DT* ?=?(const volatile DT * volatile *, forall(dtype DT2) const DT2*); 354 355 forall(ftype FT) FT* ?=?( FT * *, forall(ftype FT2)FT2*); 356 forall(ftype FT) FT* ?=?( FT * volatile *, forall(ftype FT2)FT2*); 357 358 forall(type T) T* ?+=?( T * *, _ptrdiff_t); 359 forall(type T) T* ?+=?( T * volatile *, _ptrdiff_t); 360 forall(type T) T* ?-=?( T * *, _ptrdiff_t); 361 forall(type T) T* ?-=?( T * volatile *, _ptrdiff_t); 362 forall(type T) const T* ?+=?( const T * *, _ptrdiff_t); 363 forall(type T) const T* ?+=?( const T * volatile *, _ptrdiff_t); 364 forall(type T) const T* ?-=?( const T * *, _ptrdiff_t); 365 forall(type T) const T* ?-=?( const T * volatile *, _ptrdiff_t); 366 forall(type T) volatile T* ?+=?( volatile T * *, _ptrdiff_t); 367 forall(type T) volatile T* ?+=?( volatile T * volatile *, _ptrdiff_t); 368 forall(type T) volatile T* ?-=?( volatile T * *, _ptrdiff_t); 369 forall(type T) volatile T* ?-=?( volatile T * volatile *, _ptrdiff_t); 370 forall(type T) const volatile T* ?+=?( const volatile T * *, _ptrdiff_t); 371 forall(type T) const volatile T* ?+=?( const volatile T * volatile *, _ptrdiff_t); 372 forall(type T) const volatile T* ?-=?( const volatile T * *, _ptrdiff_t); 373 forall(type T) const volatile T* ?-=?( const volatile T * volatile *, _ptrdiff_t); 374 375 376 char ?=?( char*, char), 377 ?=?(volatile char*, char); 378 signed char ?=?( signed char*, signed char), 379 ?=?(volatile signed char*, signed char); 380 unsigned char ?=?( unsigned char*, unsigned char), 381 ?=?(volatile unsigned char*, unsigned char); 382 short ?=?( short*, short), 383 ?=?(volatile short*, short); 384 unsigned short ?=?( unsigned short*, unsigned short), 385 ?=?(volatile unsigned short*, unsigned short); 386 int ?=?( int*, int), 387 ?=?(volatile int*, int); 388 unsigned ?=?( unsigned*, unsigned), 389 ?=?(volatile unsigned*, unsigned); 390 long ?=?( long*, long), 391 ?=?(volatile long*, long); 392 unsigned long ?=?( unsigned long*, unsigned long), 393 ?=?(volatile unsigned long*, unsigned long); 394 long long ?=?( long long*, long long), 395 ?=?(volatile long long*, long long); 396 unsigned long long ?=?( unsigned long long*, unsigned long long), 397 ?=?(volatile unsigned long long*, unsigned long long); 398 399 char ?*=?( char*, char), 400 ?*=?(volatile char*, char); 401 signed char ?*=?( signed char*, signed char), 402 ?*=?(volatile signed char*, signed char); 403 unsigned char ?*=?( unsigned char*, unsigned char), 404 ?*=?(volatile unsigned char*, unsigned char); 405 short ?*=?( short*, short), 406 ?*=?(volatile short*, short); 407 unsigned short ?*=?( unsigned short*, unsigned short), 408 ?*=?(volatile unsigned short*, unsigned short); 409 int ?*=?( int*, int), 410 ?*=?(volatile int*, int); 411 unsigned ?*=?( unsigned*, unsigned), 412 ?*=?(volatile unsigned*, unsigned); 413 long ?*=?( long*, long), 414 ?*=?(volatile long*, long); 415 unsigned long ?*=?( unsigned long*, unsigned long), 416 ?*=?(volatile unsigned long*, unsigned long); 417 long long ?*=?( long long*, long long), 418 ?*=?(volatile long long*, long long); 419 unsigned long long ?*=?( unsigned long long*, unsigned long long), 420 ?*=?(volatile unsigned long long*, unsigned long long); 421 422 char ?/=?( char*, char), 423 ?/=?(volatile char*, char); 424 signed char ?/=?( signed char*, signed char), 425 ?/=?(volatile signed char*, signed char); 426 unsigned char ?/=?( unsigned char*, unsigned char), 427 ?/=?(volatile unsigned char*, unsigned char); 428 short ?/=?( short*, short), 429 ?/=?(volatile short*, short); 430 unsigned short ?/=?( unsigned short*, unsigned short), 431 ?/=?(volatile unsigned short*, unsigned short); 432 int ?/=?( int*, int), 433 ?/=?(volatile int*, int); 434 unsigned ?/=?( unsigned*, unsigned), 435 ?/=?(volatile unsigned*, unsigned); 436 long ?/=?( long*, long), 437 ?/=?(volatile long*, long); 438 unsigned long ?/=?( unsigned long*, unsigned long), 439 ?/=?(volatile unsigned long*, unsigned long); 440 long long ?/=?( long long*, long long), 441 ?/=?(volatile long long*, long long); 442 unsigned long long ?/=?( unsigned long long*, unsigned long long), 443 ?/=?(volatile unsigned long long*, unsigned long long); 444 445 char ?%=?( char*, char), 446 ?%=?(volatile char*, char); 447 signed char ?%=?( signed char*, signed char), 448 ?%=?(volatile signed char*, signed char); 449 unsigned char ?%=?( unsigned char*, unsigned char), 450 ?%=?(volatile unsigned char*, unsigned char); 451 short ?%=?( short*, short), 452 ?%=?(volatile short*, short); 453 unsigned short ?%=?( unsigned short*, unsigned short), 454 ?%=?(volatile unsigned short*, unsigned short); 455 int ?%=?( int*, int), 456 ?%=?(volatile int*, int); 457 unsigned ?%=?( unsigned*, unsigned), 458 ?%=?(volatile unsigned*, unsigned); 459 long ?%=?( long*, long), 460 ?%=?(volatile long*, long); 461 unsigned long ?%=?( unsigned long*, unsigned long), 462 ?%=?(volatile unsigned long*, unsigned long); 463 long long ?%=?( long long*, long long), 464 ?%=?(volatile long long*, long long); 465 unsigned long long ?%=?( unsigned long long*, unsigned long long), 466 ?%=?(volatile unsigned long long*, unsigned long long); 467 468 char ?+=?( char*, char), 469 ?+=?(volatile char*, char); 470 signed char ?+=?( signed char*, signed char), 471 ?+=?(volatile signed char*, signed char); 472 unsigned char ?+=?( unsigned char*, unsigned char), 473 ?+=?(volatile unsigned char*, unsigned char); 474 short ?+=?( short*, short), 475 ?+=?(volatile short*, short); 476 unsigned short ?+=?( unsigned short*, unsigned short), 477 ?+=?(volatile unsigned short*, unsigned short); 478 int ?+=?( int*, int), 479 ?+=?(volatile int*, int); 480 unsigned ?+=?( unsigned*, unsigned), 481 ?+=?(volatile unsigned*, unsigned); 482 long ?+=?( long*, long), 483 ?+=?(volatile long*, long); 484 unsigned long ?+=?( unsigned long*, unsigned long), 485 ?+=?(volatile unsigned long*, unsigned long); 486 long long ?+=?( long long*, long long), 487 ?+=?(volatile long long*, long long); 488 unsigned long long ?+=?( unsigned long long*, unsigned long long), 489 ?+=?(volatile unsigned long long*, unsigned long long); 490 491 char ?-=?( char*, char), 492 ?-=?(volatile char*, char); 493 signed char ?-=?( signed char*, signed char), 494 ?-=?(volatile signed char*, signed char); 495 unsigned char ?-=?( unsigned char*, unsigned char), 496 ?-=?(volatile unsigned char*, unsigned char); 497 short ?-=?( short*, short), 498 ?-=?(volatile short*, short); 499 unsigned short ?-=?( unsigned short*, unsigned short), 500 ?-=?(volatile unsigned short*, unsigned short); 501 int ?-=?( int*, int), 502 ?-=?(volatile int*, int); 503 unsigned ?-=?( unsigned*, unsigned), 504 ?-=?(volatile unsigned*, unsigned); 505 long ?-=?( long*, long), 506 ?-=?(volatile long*, long); 507 unsigned long ?-=?( unsigned long*, unsigned long), 508 ?-=?(volatile unsigned long*, unsigned long); 509 long long ?-=?( long long*, long long), 510 ?-=?(volatile long long*, long long); 511 unsigned long long ?-=?( unsigned long long*, unsigned long long), 512 ?-=?(volatile unsigned long long*, unsigned long long); 513 514 char ?<<=?( char*, char), 515 ?<<=?(volatile char*, char); 516 signed char ?<<=?( signed char*, signed char), 517 ?<<=?(volatile signed char*, signed char); 518 unsigned char ?<<=?( unsigned char*, unsigned char), 519 ?<<=?(volatile unsigned char*, unsigned char); 520 short ?<<=?( short*, short), 521 ?<<=?(volatile short*, short); 522 unsigned short ?<<=?( unsigned short*, unsigned short), 523 ?<<=?(volatile unsigned short*, unsigned short); 524 int ?<<=?( int*, int), 525 ?<<=?(volatile int*, int); 526 unsigned ?<<=?( unsigned*, unsigned), 527 ?<<=?(volatile unsigned*, unsigned); 528 long ?<<=?( long*, long), 529 ?<<=?(volatile long*, long); 530 unsigned long ?<<=?( unsigned long*, unsigned long), 531 ?<<=?(volatile unsigned long*, unsigned long); 532 long long ?<<=?( long long*, long long), 533 ?<<=?(volatile long long*, long long); 534 unsigned long long ?<<=?( unsigned long long*, unsigned long long), 535 ?<<=?(volatile unsigned long long*, unsigned long long); 536 537 char ?>>=?( char*, char), 538 ?>>=?(volatile char*, char); 539 signed char ?>>=?( signed char*, signed char), 540 ?>>=?(volatile signed char*, signed char); 541 unsigned char ?>>=?( unsigned char*, unsigned char), 542 ?>>=?(volatile unsigned char*, unsigned char); 543 short ?>>=?( short*, short), 544 ?>>=?(volatile short*, short); 545 unsigned short ?>>=?( unsigned short*, unsigned short), 546 ?>>=?(volatile unsigned short*, unsigned short); 547 int ?>>=?( int*, int), 548 ?>>=?(volatile int*, int); 549 unsigned ?>>=?( unsigned*, unsigned), 550 ?>>=?(volatile unsigned*, unsigned); 551 long ?>>=?( long*, long), 552 ?>>=?(volatile long*, long); 553 unsigned long ?>>=?( unsigned long*, unsigned long), 554 ?>>=?(volatile unsigned long*, unsigned long); 555 long long ?>>=?( long long*, long long), 556 ?>>=?(volatile long long*, long long); 557 unsigned long long ?>>=?( unsigned long long*, unsigned long long), 558 ?>>=?(volatile unsigned long long*, unsigned long long); 559 560 char ?&=?( char*, char), 561 ?&=?(volatile char*, char); 562 signed char ?&=?( signed char*, signed char), 563 ?&=?(volatile signed char*, signed char); 564 unsigned char ?&=?( unsigned char*, unsigned char), 565 ?&=?(volatile unsigned char*, unsigned char); 566 short ?&=?( short*, short), 567 ?&=?(volatile short*, short); 568 unsigned short ?&=?( unsigned short*, unsigned short), 569 ?&=?(volatile unsigned short*, unsigned short); 570 int ?&=?( int*, int), 571 ?&=?(volatile int*, int); 572 unsigned ?&=?( unsigned*, unsigned), 573 ?&=?(volatile unsigned*, unsigned); 574 long ?&=?( long*, long), 575 ?&=?(volatile long*, long); 576 unsigned long ?&=?( unsigned long*, unsigned long), 577 ?&=?(volatile unsigned long*, unsigned long); 578 long long ?&=?( long long*, long long), 579 ?&=?(volatile long long*, long long); 580 unsigned long long ?&=?( unsigned long long*, unsigned long long), 581 ?&=?(volatile unsigned long long*, unsigned long long); 582 583 char ?|=?( char*, char), 584 ?|=?(volatile char*, char); 585 signed char ?|=?( signed char*, signed char), 586 ?|=?(volatile signed char*, signed char); 587 unsigned char ?|=?( unsigned char*, unsigned char), 588 ?|=?(volatile unsigned char*, unsigned char); 589 short ?|=?( short*, short), 590 ?|=?(volatile short*, short); 591 unsigned short ?|=?( unsigned short*, unsigned short), 592 ?|=?(volatile unsigned short*, unsigned short); 593 int ?|=?( int*, int), 594 ?|=?(volatile int*, int); 595 unsigned ?|=?( unsigned*, unsigned), 596 ?|=?(volatile unsigned*, unsigned); 597 long ?|=?( long*, long), 598 ?|=?(volatile long*, long); 599 unsigned long ?|=?( unsigned long*, unsigned long), 600 ?|=?(volatile unsigned long*, unsigned long); 601 long long ?|=?( long long*, long long), 602 ?|=?(volatile long long*, long long); 603 unsigned long long ?|=?( unsigned long long*, unsigned long long), 604 ?|=?(volatile unsigned long long*, unsigned long long); 605 606 char ?^=?( char*, char), 607 ?^=?(volatile char*, char); 608 signed char ?^=?( signed char*, signed char), 609 ?^=?(volatile signed char*, signed char); 610 unsigned char ?^=?( unsigned char*, unsigned char), 611 ?^=?(volatile unsigned char*, unsigned char); 612 short ?^=?( short*, short), 613 ?^=?(volatile short*, short); 614 unsigned short ?^=?( unsigned short*, unsigned short), 615 ?^=?(volatile unsigned short*, unsigned short); 616 int ?^=?( int*, int), 617 ?^=?(volatile int*, int); 618 unsigned ?^=?( unsigned*, unsigned), 619 ?^=?(volatile unsigned*, unsigned); 620 long ?^=?( long*, long), 621 ?^=?(volatile long*, long); 622 unsigned long ?^=?( unsigned long*, unsigned long), 623 ?^=?(volatile unsigned long*, unsigned long); 624 long long ?^=?( long long*, long long), 625 ?^=?(volatile long long*, long long); 626 unsigned long long ?^=?( unsigned long long*, unsigned long long), 627 ?^=?(volatile unsigned long long*, unsigned long long); 628 629 630 float ?=?( float *, float), 631 ?=?(volatile float *, float), 632 ?*=?( float *, float), 633 ?*=?(volatile float *, float), 634 ?/=?( float *, float), 635 ?/=?(volatile float *, float), 636 ?+=?( float *, float), 637 ?+=?(volatile float *, float), 638 ?-=?( float *, float), 639 ?-=?(volatile float *, float); 640 641 double ?=?( double *, double), 642 ?=?(volatile double *, double), 643 ?*=?( double *, double), 644 ?*=?(volatile double *, double), 645 ?/=?( double *, double), 646 ?/=?(volatile double *, double), 647 ?+=?( double *, double), 648 ?+=?(volatile double *, double), 649 ?-=?( double *, double), 650 ?-=?(volatile double *, double); 651 652 long double ?=?( long double *, long double), 653 ?=?(volatile long double *, long double), 654 ?*=?( long double *, long double), 655 ?*=?(volatile long double *, long double), 656 ?/=?( long double *, long double), 657 ?/=?(volatile long double *, long double), 658 ?+=?( long double *, long double), 659 ?+=?(volatile long double *, long double), 660 ?-=?( long double *, long double), 661 ?-=?(volatile long double *, long double); 662 663 /* 664 * ------------------------------------------------------------ 665 * 666 * End of file 667 * 668 * ------------------------------------------------------------ 669 */ 309 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, void * ); 310 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, void * ); 311 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, const void * ); 312 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, const void * ); 313 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, volatile void * ); 314 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, volatile void * ); 315 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, const volatile void * ); 316 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, const volatile void * ); 317 318 forall( dtype DT ) void * ?=?( void * *, DT * ); 319 forall( dtype DT ) void * ?=?( void * volatile *, DT * ); 320 forall( dtype DT ) const void * ?=?( const void * *, DT * ); 321 forall( dtype DT ) const void * ?=?( const void * volatile *, DT * ); 322 forall( dtype DT ) const void * ?=?( const void * *, const DT * ); 323 forall( dtype DT ) const void * ?=?( const void * volatile *, const DT * ); 324 forall( dtype DT ) volatile void * ?=?( volatile void * *, DT * ); 325 forall( dtype DT ) volatile void * ?=?( volatile void * volatile *, DT * ); 326 forall( dtype DT ) volatile void * ?=?( volatile void * *, volatile DT * ); 327 forall( dtype DT ) volatile void * ?=?( volatile void * volatile *, volatile DT * ); 328 forall( dtype DT ) const volatile void * ?=?( const volatile void * *, DT * ); 329 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile *, DT * ); 330 forall( dtype DT ) const volatile void * ?=?( const volatile void * *, const DT * ); 331 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile *, const DT * ); 332 forall( dtype DT ) const volatile void * ?=?( const volatile void * *, volatile DT * ); 333 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile *, volatile DT * ); 334 forall( dtype DT ) const volatile void * ?=?( const volatile void * *, const volatile DT * ); 335 forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile *, const volatile DT * ); 336 337 void * ?=?( void * *, void * ); 338 void * ?=?( void * volatile *, void * ); 339 const void * ?=?( const void * *, void * ); 340 const void * ?=?( const void * volatile *, void * ); 341 const void * ?=?( const void * *, const void * ); 342 const void * ?=?( const void * volatile *, const void * ); 343 volatile void * ?=?( volatile void * *, void * ); 344 volatile void * ?=?( volatile void * volatile *, void * ); 345 volatile void * ?=?( volatile void * *, volatile void * ); 346 volatile void * ?=?( volatile void * volatile *, volatile void * ); 347 const volatile void * ?=?( const volatile void * *, void * ); 348 const volatile void * ?=?( const volatile void * volatile *, void * ); 349 const volatile void * ?=?( const volatile void * *, const void * ); 350 const volatile void * ?=?( const volatile void * volatile *, const void * ); 351 const volatile void * ?=?( const volatile void * *, volatile void * ); 352 const volatile void * ?=?( const volatile void * volatile *, volatile void * ); 353 const volatile void * ?=?( const volatile void * *, const volatile void * ); 354 const volatile void * ?=?( const volatile void * volatile *, const volatile void * ); 355 356 forall( dtype DT ) DT * ?=?( DT * *, forall( dtype DT2 ) const DT2 * ); 357 forall( dtype DT ) DT * ?=?( DT * volatile *, forall( dtype DT2 ) const DT2 * ); 358 forall( dtype DT ) const DT * ?=?( const DT * *, forall( dtype DT2 ) const DT2 * ); 359 forall( dtype DT ) const DT * ?=?( const DT * volatile *, forall( dtype DT2 ) const DT2 * ); 360 forall( dtype DT ) volatile DT * ?=?( volatile DT * *, forall( dtype DT2 ) const DT2 * ); 361 forall( dtype DT ) volatile DT * ?=?( volatile DT * volatile *, forall( dtype DT2 ) const DT2 * ); 362 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * *, forall( dtype DT2 ) const DT2 * ); 363 forall( dtype DT ) const volatile DT * ?=?( const volatile DT * volatile *, forall( dtype DT2 ) const DT2 * ); 364 365 forall( ftype FT ) FT * ?=?( FT * *, forall( ftype FT2 ) FT2 * ); 366 forall( ftype FT ) FT * ?=?( FT * volatile *, forall( ftype FT2 ) FT2 * ); 367 368 forall( type T ) T * ?+=?( T * *, ptrdiff_t ); 369 forall( type T ) T * ?+=?( T * volatile *, ptrdiff_t ); 370 forall( type T ) T * ?-=?( T * *, ptrdiff_t ); 371 forall( type T ) T * ?-=?( T * volatile *, ptrdiff_t ); 372 forall( type T ) const T * ?+=?( const T * *, ptrdiff_t ); 373 forall( type T ) const T * ?+=?( const T * volatile *, ptrdiff_t ); 374 forall( type T ) const T * ?-=?( const T * *, ptrdiff_t ); 375 forall( type T ) const T * ?-=?( const T * volatile *, ptrdiff_t ); 376 forall( type T ) volatile T * ?+=?( volatile T * *, ptrdiff_t ); 377 forall( type T ) volatile T * ?+=?( volatile T * volatile *, ptrdiff_t ); 378 forall( type T ) volatile T * ?-=?( volatile T * *, ptrdiff_t ); 379 forall( type T ) volatile T * ?-=?( volatile T * volatile *, ptrdiff_t ); 380 forall( type T ) const volatile T * ?+=?( const volatile T * *, ptrdiff_t ); 381 forall( type T ) const volatile T * ?+=?( const volatile T * volatile *, ptrdiff_t ); 382 forall( type T ) const volatile T * ?-=?( const volatile T * *, ptrdiff_t ); 383 forall( type T ) const volatile T * ?-=?( const volatile T * volatile *, ptrdiff_t ); 384 385 _Bool ?=?( _Bool *, _Bool ), 386 ?=?( volatile _Bool *, _Bool ); 387 char ?=?( char *, char ), 388 ?=?( volatile char *, char ); 389 signed char ?=?( signed char *, signed char ), 390 ?=?( volatile signed char *, signed char ); 391 unsigned char ?=?( unsigned char *, unsigned char ), 392 ?=?( volatile unsigned char *, unsigned char ); 393 short ?=?( short *, short ), 394 ?=?( volatile short *, short ); 395 unsigned short ?=?( unsigned short *, unsigned short ), 396 ?=?( volatile unsigned short *, unsigned short ); 397 int ?=?( int *, int ), 398 ?=?( volatile int *, int ); 399 unsigned ?=?( unsigned *, unsigned ), 400 ?=?( volatile unsigned *, unsigned ); 401 long ?=?( long *, long ), 402 ?=?( volatile long *, long ); 403 unsigned long ?=?( unsigned long *, unsigned long ), 404 ?=?( volatile unsigned long *, unsigned long ); 405 long long ?=?( long long *, long long ), 406 ?=?( volatile long long *, long long ); 407 unsigned long long ?=?( unsigned long long *, unsigned long long ), 408 ?=?( volatile unsigned long long *, unsigned long long ); 409 410 _Bool ?*=?( _Bool *, _Bool ), 411 ?*=?( volatile _Bool *, _Bool ); 412 char ?*=?( char *, char ), 413 ?*=?( volatile char *, char ); 414 signed char ?*=?( signed char *, signed char ), 415 ?*=?( volatile signed char *, signed char ); 416 unsigned char ?*=?( unsigned char *, unsigned char ), 417 ?*=?( volatile unsigned char *, unsigned char ); 418 short ?*=?( short *, short ), 419 ?*=?( volatile short *, short ); 420 unsigned short ?*=?( unsigned short *, unsigned short ), 421 ?*=?( volatile unsigned short *, unsigned short ); 422 int ?*=?( int *, int ), 423 ?*=?( volatile int *, int ); 424 unsigned ?*=?( unsigned *, unsigned ), 425 ?*=?( volatile unsigned *, unsigned ); 426 long ?*=?( long *, long ), 427 ?*=?( volatile long *, long ); 428 unsigned long ?*=?( unsigned long *, unsigned long ), 429 ?*=?( volatile unsigned long *, unsigned long ); 430 long long ?*=?( long long *, long long ), 431 ?*=?( volatile long long *, long long ); 432 unsigned long long ?*=?( unsigned long long *, unsigned long long ), 433 ?*=?( volatile unsigned long long *, unsigned long long ); 434 435 _Bool ?/=?( _Bool *, _Bool ), 436 ?/=?( volatile _Bool *, _Bool ); 437 char ?/=?( char *, char ), 438 ?/=?( volatile char *, char ); 439 signed char ?/=?( signed char *, signed char ), 440 ?/=?( volatile signed char *, signed char ); 441 unsigned char ?/=?( unsigned char *, unsigned char ), 442 ?/=?( volatile unsigned char *, unsigned char ); 443 short ?/=?( short *, short ), 444 ?/=?( volatile short *, short ); 445 unsigned short ?/=?( unsigned short *, unsigned short ), 446 ?/=?( volatile unsigned short *, unsigned short ); 447 int ?/=?( int *, int ), 448 ?/=?( volatile int *, int ); 449 unsigned ?/=?( unsigned *, unsigned ), 450 ?/=?( volatile unsigned *, unsigned ); 451 long ?/=?( long *, long ), 452 ?/=?( volatile long *, long ); 453 unsigned long ?/=?( unsigned long *, unsigned long ), 454 ?/=?( volatile unsigned long *, unsigned long ); 455 long long ?/=?( long long *, long long ), 456 ?/=?( volatile long long *, long long ); 457 unsigned long long ?/=?( unsigned long long *, unsigned long long ), 458 ?/=?( volatile unsigned long long *, unsigned long long ); 459 460 _Bool ?%=?( _Bool *, _Bool ), 461 ?%=?( volatile _Bool *, _Bool ); 462 char ?%=?( char *, char ), 463 ?%=?( volatile char *, char ); 464 signed char ?%=?( signed char *, signed char ), 465 ?%=?( volatile signed char *, signed char ); 466 unsigned char ?%=?( unsigned char *, unsigned char ), 467 ?%=?( volatile unsigned char *, unsigned char ); 468 short ?%=?( short *, short ), 469 ?%=?( volatile short *, short ); 470 unsigned short ?%=?( unsigned short *, unsigned short ), 471 ?%=?( volatile unsigned short *, unsigned short ); 472 int ?%=?( int *, int ), 473 ?%=?( volatile int *, int ); 474 unsigned ?%=?( unsigned *, unsigned ), 475 ?%=?( volatile unsigned *, unsigned ); 476 long ?%=?( long *, long ), 477 ?%=?( volatile long *, long ); 478 unsigned long ?%=?( unsigned long *, unsigned long ), 479 ?%=?( volatile unsigned long *, unsigned long ); 480 long long ?%=?( long long *, long long ), 481 ?%=?( volatile long long *, long long ); 482 unsigned long long ?%=?( unsigned long long *, unsigned long long ), 483 ?%=?( volatile unsigned long long *, unsigned long long ); 484 485 _Bool ?+=?( _Bool *, _Bool ), 486 ?+=?( volatile _Bool *, _Bool ); 487 char ?+=?( char *, char ), 488 ?+=?( volatile char *, char ); 489 signed char ?+=?( signed char *, signed char ), 490 ?+=?( volatile signed char *, signed char ); 491 unsigned char ?+=?( unsigned char *, unsigned char ), 492 ?+=?( volatile unsigned char *, unsigned char ); 493 short ?+=?( short *, short ), 494 ?+=?( volatile short *, short ); 495 unsigned short ?+=?( unsigned short *, unsigned short ), 496 ?+=?( volatile unsigned short *, unsigned short ); 497 int ?+=?( int *, int ), 498 ?+=?( volatile int *, int ); 499 unsigned ?+=?( unsigned *, unsigned ), 500 ?+=?( volatile unsigned *, unsigned ); 501 long ?+=?( long *, long ), 502 ?+=?( volatile long *, long ); 503 unsigned long ?+=?( unsigned long *, unsigned long ), 504 ?+=?( volatile unsigned long *, unsigned long ); 505 long long ?+=?( long long *, long long ), 506 ?+=?( volatile long long *, long long ); 507 unsigned long long ?+=?( unsigned long long *, unsigned long long ), 508 ?+=?( volatile unsigned long long *, unsigned long long ); 509 510 _Bool ?-=?( _Bool *, _Bool ), 511 ?-=?( volatile _Bool *, _Bool ); 512 char ?-=?( char *, char ), 513 ?-=?( volatile char *, char ); 514 signed char ?-=?( signed char *, signed char ), 515 ?-=?( volatile signed char *, signed char ); 516 unsigned char ?-=?( unsigned char *, unsigned char ), 517 ?-=?( volatile unsigned char *, unsigned char ); 518 short ?-=?( short *, short ), 519 ?-=?( volatile short *, short ); 520 unsigned short ?-=?( unsigned short *, unsigned short ), 521 ?-=?( volatile unsigned short *, unsigned short ); 522 int ?-=?( int *, int ), 523 ?-=?( volatile int *, int ); 524 unsigned ?-=?( unsigned *, unsigned ), 525 ?-=?( volatile unsigned *, unsigned ); 526 long ?-=?( long *, long ), 527 ?-=?( volatile long *, long ); 528 unsigned long ?-=?( unsigned long *, unsigned long ), 529 ?-=?( volatile unsigned long *, unsigned long ); 530 long long ?-=?( long long *, long long ), 531 ?-=?( volatile long long *, long long ); 532 unsigned long long ?-=?( unsigned long long *, unsigned long long ), 533 ?-=?( volatile unsigned long long *, unsigned long long ); 534 535 _Bool ?<<=?( _Bool *, _Bool ), 536 ?<<=?( volatile _Bool *, _Bool ); 537 char ?<<=?( char *, char ), 538 ?<<=?( volatile char *, char ); 539 signed char ?<<=?( signed char *, signed char ), 540 ?<<=?( volatile signed char *, signed char ); 541 unsigned char ?<<=?( unsigned char *, unsigned char ), 542 ?<<=?( volatile unsigned char *, unsigned char ); 543 short ?<<=?( short *, short ), 544 ?<<=?( volatile short *, short ); 545 unsigned short ?<<=?( unsigned short *, unsigned short ), 546 ?<<=?( volatile unsigned short *, unsigned short ); 547 int ?<<=?( int *, int ), 548 ?<<=?( volatile int *, int ); 549 unsigned ?<<=?( unsigned *, unsigned ), 550 ?<<=?( volatile unsigned *, unsigned ); 551 long ?<<=?( long *, long ), 552 ?<<=?( volatile long *, long ); 553 unsigned long ?<<=?( unsigned long *, unsigned long ), 554 ?<<=?( volatile unsigned long *, unsigned long ); 555 long long ?<<=?( long long *, long long ), 556 ?<<=?( volatile long long *, long long ); 557 unsigned long long ?<<=?( unsigned long long *, unsigned long long ), 558 ?<<=?( volatile unsigned long long *, unsigned long long ); 559 560 _Bool ?>>=?( _Bool *, _Bool ), 561 ?>>=?( volatile _Bool *, _Bool ); 562 char ?>>=?( char *, char ), 563 ?>>=?( volatile char *, char ); 564 signed char ?>>=?( signed char *, signed char ), 565 ?>>=?( volatile signed char *, signed char ); 566 unsigned char ?>>=?( unsigned char *, unsigned char ), 567 ?>>=?( volatile unsigned char *, unsigned char ); 568 short ?>>=?( short *, short ), 569 ?>>=?( volatile short *, short ); 570 unsigned short ?>>=?( unsigned short *, unsigned short ), 571 ?>>=?( volatile unsigned short *, unsigned short ); 572 int ?>>=?( int *, int ), 573 ?>>=?( volatile int *, int ); 574 unsigned ?>>=?( unsigned *, unsigned ), 575 ?>>=?( volatile unsigned *, unsigned ); 576 long ?>>=?( long *, long ), 577 ?>>=?( volatile long *, long ); 578 unsigned long ?>>=?( unsigned long *, unsigned long ), 579 ?>>=?( volatile unsigned long *, unsigned long ); 580 long long ?>>=?( long long *, long long ), 581 ?>>=?( volatile long long *, long long ); 582 unsigned long long ?>>=?( unsigned long long *, unsigned long long ), 583 ?>>=?( volatile unsigned long long *, unsigned long long ); 584 585 _Bool ?&=?( _Bool *, _Bool ), 586 ?&=?( volatile _Bool *, _Bool ); 587 char ?&=?( char *, char ), 588 ?&=?( volatile char *, char ); 589 signed char ?&=?( signed char *, signed char ), 590 ?&=?( volatile signed char *, signed char ); 591 unsigned char ?&=?( unsigned char *, unsigned char ), 592 ?&=?( volatile unsigned char *, unsigned char ); 593 short ?&=?( short *, short ), 594 ?&=?( volatile short *, short ); 595 unsigned short ?&=?( unsigned short *, unsigned short ), 596 ?&=?( volatile unsigned short *, unsigned short ); 597 int ?&=?( int *, int ), 598 ?&=?( volatile int *, int ); 599 unsigned ?&=?( unsigned *, unsigned ), 600 ?&=?( volatile unsigned *, unsigned ); 601 long ?&=?( long *, long ), 602 ?&=?( volatile long *, long ); 603 unsigned long ?&=?( unsigned long *, unsigned long ), 604 ?&=?( volatile unsigned long *, unsigned long ); 605 long long ?&=?( long long *, long long ), 606 ?&=?( volatile long long *, long long ); 607 unsigned long long ?&=?( unsigned long long *, unsigned long long ), 608 ?&=?( volatile unsigned long long *, unsigned long long ); 609 610 _Bool ?|=?( _Bool *, _Bool ), 611 ?|=?( volatile _Bool *, _Bool ); 612 char ?|=?( char *, char ), 613 ?|=?( volatile char *, char ); 614 signed char ?|=?( signed char *, signed char ), 615 ?|=?( volatile signed char *, signed char ); 616 unsigned char ?|=?( unsigned char *, unsigned char ), 617 ?|=?( volatile unsigned char *, unsigned char ); 618 short ?|=?( short *, short ), 619 ?|=?( volatile short *, short ); 620 unsigned short ?|=?( unsigned short *, unsigned short ), 621 ?|=?( volatile unsigned short *, unsigned short ); 622 int ?|=?( int *, int ), 623 ?|=?( volatile int *, int ); 624 unsigned ?|=?( unsigned *, unsigned ), 625 ?|=?( volatile unsigned *, unsigned ); 626 long ?|=?( long *, long ), 627 ?|=?( volatile long *, long ); 628 unsigned long ?|=?( unsigned long *, unsigned long ), 629 ?|=?( volatile unsigned long *, unsigned long ); 630 long long ?|=?( long long *, long long ), 631 ?|=?( volatile long long *, long long ); 632 unsigned long long ?|=?( unsigned long long *, unsigned long long ), 633 ?|=?( volatile unsigned long long *, unsigned long long ); 634 635 _Bool ?^=?( _Bool *, _Bool ), 636 ?^=?( volatile _Bool *, _Bool ); 637 char ?^=?( char *, char ), 638 ?^=?( volatile char *, char ); 639 signed char ?^=?( signed char *, signed char ), 640 ?^=?( volatile signed char *, signed char ); 641 unsigned char ?^=?( unsigned char *, unsigned char ), 642 ?^=?( volatile unsigned char *, unsigned char ); 643 short ?^=?( short *, short ), 644 ?^=?( volatile short *, short ); 645 unsigned short ?^=?( unsigned short *, unsigned short ), 646 ?^=?( volatile unsigned short *, unsigned short ); 647 int ?^=?( int *, int ), 648 ?^=?( volatile int *, int ); 649 unsigned ?^=?( unsigned *, unsigned ), 650 ?^=?( volatile unsigned *, unsigned ); 651 long ?^=?( long *, long ), 652 ?^=?( volatile long *, long ); 653 unsigned long ?^=?( unsigned long *, unsigned long ), 654 ?^=?( volatile unsigned long *, unsigned long ); 655 long long ?^=?( long long *, long long ), 656 ?^=?( volatile long long *, long long ); 657 unsigned long long ?^=?( unsigned long long *, unsigned long long ), 658 ?^=?( volatile unsigned long long *, unsigned long long ); 659 660 661 float ?=?( float *, float ), 662 ?=?( volatile float *, float ), 663 ?*=?( float *, float ), 664 ?*=?( volatile float *, float ), 665 ?/=?( float *, float ), 666 ?/=?( volatile float *, float ), 667 ?+=?( float *, float ), 668 ?+=?( volatile float *, float ), 669 ?-=?( float *, float ), 670 ?-=?( volatile float *, float ); 671 672 double ?=?( double *, double ), 673 ?=?( volatile double *, double ), 674 ?*=?( double *, double ), 675 ?*=?( volatile double *, double ), 676 ?/=?( double *, double ), 677 ?/=?( volatile double *, double ), 678 ?+=?( double *, double ), 679 ?+=?( volatile double *, double ), 680 ?-=?( double *, double ), 681 ?-=?( volatile double *, double ); 682 683 long double ?=?( long double *, long double ), 684 ?=?( volatile long double *, long double ), 685 ?*=?( long double *, long double ), 686 ?*=?( volatile long double *, long double ), 687 ?/=?( long double *, long double ), 688 ?/=?( volatile long double *, long double ), 689 ?+=?( long double *, long double ), 690 ?+=?( volatile long double *, long double ), 691 ?-=?( long double *, long double ), 692 ?-=?( volatile long double *, long double ); -
translator/CodeGen/GenType.cc
r42dcae7 r3848e0e 64 64 switch(basicType->get_kind()){ 65 65 case BasicType::Bool: 66 typeWords = " bool";66 typeWords = "_Bool"; 67 67 break; 68 68 case BasicType::Char: -
translator/InitTweak/BasicInit.cc
r42dcae7 r3848e0e 218 218 args.push_back(new AddressExpr( new UntypedMemberExpr( membName, new NameExpr(toInit->get_name()) ))); 219 219 args.push_back( sinit->get_value() ); 220 Statement *ret = new ExprStmt(std::list<Label>(), 221 new UntypedExpr(new NameExpr("?=?"), args)); 220 Statement *ret = new ExprStmt(std::list<Label>(), new UntypedExpr(new NameExpr("?=?"), args)); 222 221 return ret; 223 222 } … … 254 253 args.push_back( new AddressExpr(lh) ); args.push_back( rh ); 255 254 256 stmts.push_back( new ExprStmt(std::list<Label>(), 257 new UntypedExpr(new NameExpr("?=?"), args)) ); 255 stmts.push_back( new ExprStmt(std::list<Label>(), new UntypedExpr(new NameExpr("?=?"), args)) ); 258 256 } 259 257 } -
translator/Parser/DeclarationNode.cc
r42dcae7 r3848e0e 28 28 extern LinkageSpec::Type linkage; /* defined in cfa.y */ 29 29 30 DeclarationNode* 31 DeclarationNode::clone() const 32 { 33 DeclarationNode *newnode = new DeclarationNode; 34 newnode->type = maybeClone( type ); 35 newnode->name = name; 36 newnode->storageClasses = storageClasses; 37 newnode->bitfieldWidth = maybeClone( bitfieldWidth ); 38 newnode->hasEllipsis = hasEllipsis; 39 newnode->initializer = initializer; 40 newnode->next = maybeClone( next ); 41 newnode->linkage = linkage; 42 return newnode; 43 } 44 45 DeclarationNode::DeclarationNode() 46 : type( 0 ), bitfieldWidth( 0 ), initializer( 0 ), hasEllipsis( false ), linkage( ::linkage ) 47 { 48 } 49 50 DeclarationNode::~DeclarationNode() 51 { 52 delete type; 53 delete bitfieldWidth; 54 delete initializer; 55 } 56 57 bool 58 DeclarationNode::get_hasEllipsis() const 59 { 60 return hasEllipsis; 61 } 62 63 const char *storageClassName[] = 64 { 65 // order must correspond with DeclarationNode::StorageClass 66 "static", 67 "auto", 68 "extern", 69 "register", 70 "inline", 71 "fortran", 30 DeclarationNode *DeclarationNode::clone() const { 31 DeclarationNode *newnode = new DeclarationNode; 32 newnode->type = maybeClone( type ); 33 newnode->name = name; 34 newnode->storageClasses = storageClasses; 35 newnode->bitfieldWidth = maybeClone( bitfieldWidth ); 36 newnode->hasEllipsis = hasEllipsis; 37 newnode->initializer = initializer; 38 newnode->next = maybeClone( next ); 39 newnode->linkage = linkage; 40 return newnode; 41 } 42 43 DeclarationNode::DeclarationNode() : type( 0 ), bitfieldWidth( 0 ), initializer( 0 ), hasEllipsis( false ), linkage( ::linkage ) { 44 } 45 46 DeclarationNode::~DeclarationNode() { 47 delete type; 48 delete bitfieldWidth; 49 delete initializer; 50 } 51 52 bool DeclarationNode::get_hasEllipsis() const { 53 return hasEllipsis; 54 } 55 56 const char *storageClassName[] = { 57 // order must correspond with DeclarationNode::StorageClass 58 "static", 59 "auto", 60 "extern", 61 "register", 62 "inline", 63 "fortran", 72 64 }; 73 65 74 void 75 DeclarationNode::print( std::ostream &os, int indent ) const 76 { 77 os << string(indent, ' '); 78 if( name == "" ) { 66 void DeclarationNode::print( std::ostream &os, int indent ) const { 67 os << string(indent, ' ' ); 68 if ( name == "" ) { 79 69 /// os << "An unnamed "; 80 } else { 81 os << name << ": a "; 82 } 83 if( linkage != LinkageSpec::Cforall ) { 84 os << LinkageSpec::toString( linkage ) << " "; 85 } 86 printEnums( storageClasses.begin(), storageClasses.end(), storageClassName, os ); 87 if( type ) { 88 type->print( os, indent ); 89 } else { 90 os << "untyped entity "; 91 } 92 if( bitfieldWidth ) { 93 os << endl << string(indent+2, ' ') << "with bitfield width "; 94 bitfieldWidth->printOneLine( os ); 95 } 96 97 if( initializer != 0 ) { 98 os << endl << string(indent+2, ' ') << "with initializer "; 99 initializer->printOneLine( os ); 100 } 101 102 os << endl; 103 } 104 105 void 106 DeclarationNode::printList( std::ostream &os, int indent ) const 107 { 108 ParseNode::printList( os, indent ); 109 if( hasEllipsis ) { 110 os << string( indent, ' ' ) << "and a variable number of other arguments" << endl; 111 } 112 } 113 114 DeclarationNode * 115 DeclarationNode::newFunction( std::string* name, DeclarationNode *ret, DeclarationNode *param, StatementNode *body, bool newStyle ) 116 { 117 DeclarationNode *newnode = new DeclarationNode; 118 newnode->name = assign_strptr( name ); 119 120 newnode->type = new TypeData( TypeData::Function ); 121 newnode->type->function->params = param; 122 newnode->type->function->newStyle = newStyle; 123 newnode->type->function->body = body; 124 if( body ) { 125 newnode->type->function->hasBody = true; 126 } 127 128 if( ret ) { 129 newnode->type->base = ret->type; 130 ret->type = 0; 131 delete ret; 132 } 133 134 return newnode; 135 } 136 137 DeclarationNode * 138 DeclarationNode::newQualifier( Qualifier q ) 139 { 140 DeclarationNode *newnode = new DeclarationNode; 141 newnode->type = new TypeData(); 142 newnode->type->qualifiers.push_back( q ); 143 return newnode; 144 } 145 146 DeclarationNode * 147 DeclarationNode::newStorageClass( StorageClass sc ) 148 { 149 DeclarationNode *newnode = new DeclarationNode; 150 newnode->storageClasses.push_back( sc ); 151 return newnode; 152 } 153 154 DeclarationNode * 155 DeclarationNode::newBasicType( BasicType bt ) 156 { 157 DeclarationNode *newnode = new DeclarationNode; 158 newnode->type = new TypeData( TypeData::Basic ); 159 newnode->type->basic->typeSpec.push_back( bt ); 160 return newnode; 161 } 162 163 DeclarationNode * 164 DeclarationNode::newModifier( Modifier mod ) 165 { 166 DeclarationNode *newnode = new DeclarationNode; 167 newnode->type = new TypeData( TypeData::Basic ); 168 newnode->type->basic->modifiers.push_back( mod ); 169 return newnode; 170 } 171 172 DeclarationNode * 173 DeclarationNode::newForall( DeclarationNode* forall ) 174 { 175 DeclarationNode *newnode = new DeclarationNode; 176 newnode->type = new TypeData( TypeData::Unknown ); 177 newnode->type->forall = forall; 178 return newnode; 179 } 180 181 DeclarationNode * 182 DeclarationNode::newFromTypedef( std::string* name ) 183 { 184 DeclarationNode *newnode = new DeclarationNode; 185 newnode->type = new TypeData( TypeData::SymbolicInst ); 186 newnode->type->symbolic->name = assign_strptr( name ); 187 newnode->type->symbolic->isTypedef = true; 188 newnode->type->symbolic->params = 0; 189 return newnode; 190 } 191 192 DeclarationNode * 193 DeclarationNode::newAggregate( TyCon kind, std::string* name, DeclarationNode *formals, ExpressionNode *actuals, DeclarationNode *fields ) 194 { 195 DeclarationNode *newnode = new DeclarationNode; 196 newnode->type = new TypeData( TypeData::Aggregate ); 197 newnode->type->aggregate->kind = kind; 198 newnode->type->aggregate->name = assign_strptr( name ); 199 if( newnode->type->aggregate->name == "" ) { 200 newnode->type->aggregate->name = DeclarationNode::anonymous.newName(); 201 } 202 newnode->type->aggregate->params = formals; 203 newnode->type->aggregate->actuals = actuals; 204 newnode->type->aggregate->members = fields; 205 return newnode; 206 } 207 208 DeclarationNode * 209 DeclarationNode::newEnum( std::string *name, DeclarationNode *constants ) 210 { 211 DeclarationNode *newnode = new DeclarationNode; 212 newnode->name = assign_strptr( name ); 213 newnode->type = new TypeData( TypeData::Enum ); 214 newnode->type->enumeration->name = newnode->name; 215 if( newnode->type->enumeration->name == "" ) { 216 newnode->type->enumeration->name = DeclarationNode::anonymous.newName(); 217 } 218 newnode->type->enumeration->constants = constants; 219 return newnode; 220 } 221 222 DeclarationNode * 223 DeclarationNode::newEnumConstant( std::string* name, ExpressionNode *constant ) 224 { 225 DeclarationNode *newnode = new DeclarationNode; 226 newnode->name = assign_strptr( name ); 227 // do something with the constant 228 return newnode; 229 } 230 231 DeclarationNode * 232 DeclarationNode::newName( std::string* name ) 233 { 234 DeclarationNode *newnode = new DeclarationNode; 235 newnode->name = assign_strptr( name ); 236 return newnode; 237 } 238 239 DeclarationNode * 240 DeclarationNode::newFromTypeGen( std::string* name, ExpressionNode *params ) 241 { 242 DeclarationNode *newnode = new DeclarationNode; 243 newnode->type = new TypeData( TypeData::SymbolicInst ); 244 newnode->type->symbolic->name = assign_strptr( name ); 245 newnode->type->symbolic->isTypedef = false; 246 newnode->type->symbolic->actuals = params; 247 return newnode; 248 } 249 250 DeclarationNode * 251 DeclarationNode::newTypeParam( TypeClass tc, std::string* name ) 252 { 253 DeclarationNode *newnode = new DeclarationNode; 254 newnode->name = assign_strptr( name ); 255 newnode->type = new TypeData( TypeData::Variable ); 256 newnode->type->variable->tyClass = tc; 257 newnode->type->variable->name = newnode->name; 258 return newnode; 259 } 260 261 DeclarationNode * 262 DeclarationNode::newContext( std::string *name, DeclarationNode *params, DeclarationNode *asserts ) 263 { 264 DeclarationNode *newnode = new DeclarationNode; 265 newnode->type = new TypeData( TypeData::Aggregate ); 266 newnode->type->aggregate->kind = Context; 267 newnode->type->aggregate->params = params; 268 newnode->type->aggregate->members = asserts; 269 newnode->type->aggregate->name = assign_strptr( name ); 270 return newnode; 271 } 272 273 DeclarationNode * 274 DeclarationNode::newContextUse( std::string *name, ExpressionNode *params ) 275 { 276 DeclarationNode *newnode = new DeclarationNode; 277 newnode->type = new TypeData( TypeData::AggregateInst ); 278 newnode->type->aggInst->aggregate = new TypeData( TypeData::Aggregate ); 279 newnode->type->aggInst->aggregate->aggregate->kind = Context; 280 newnode->type->aggInst->aggregate->aggregate->name = assign_strptr( name ); 281 newnode->type->aggInst->params = params; 282 return newnode; 283 } 284 285 DeclarationNode * 286 DeclarationNode::newTypeDecl( std::string *name, DeclarationNode *typeParams ) 287 { 288 DeclarationNode *newnode = new DeclarationNode; 289 newnode->name = assign_strptr( name ); 290 newnode->type = new TypeData( TypeData::Symbolic ); 291 newnode->type->symbolic->isTypedef = false; 292 newnode->type->symbolic->params = typeParams; 293 newnode->type->symbolic->name = newnode->name; 294 return newnode; 295 } 296 297 DeclarationNode * 298 DeclarationNode::newPointer( DeclarationNode *qualifiers ) 299 { 300 DeclarationNode *newnode = new DeclarationNode; 301 newnode->type = new TypeData( TypeData::Pointer ); 302 return newnode->addQualifiers( qualifiers ); 303 } 304 305 DeclarationNode * 306 DeclarationNode::newArray( ExpressionNode *size, DeclarationNode *qualifiers, bool isStatic ) 307 { 308 DeclarationNode *newnode = new DeclarationNode; 309 newnode->type = new TypeData( TypeData::Array ); 310 newnode->type->array->dimension = size; 311 newnode->type->array->isStatic = isStatic; 312 newnode->type->array->isVarLen = false; 313 return newnode->addQualifiers( qualifiers ); 314 } 315 316 DeclarationNode * 317 DeclarationNode::newVarArray( DeclarationNode *qualifiers ) 318 { 319 DeclarationNode *newnode = new DeclarationNode; 320 newnode->type = new TypeData( TypeData::Array ); 321 newnode->type->array->dimension = 0; 322 newnode->type->array->isStatic = false; 323 newnode->type->array->isVarLen = true; 324 return newnode->addQualifiers( qualifiers ); 325 } 326 327 DeclarationNode * 328 DeclarationNode::newBitfield( ExpressionNode *size ) 329 { 330 DeclarationNode *newnode = new DeclarationNode; 331 newnode->bitfieldWidth = size; 332 return newnode; 333 } 334 335 DeclarationNode * 336 DeclarationNode::newTuple( DeclarationNode *members ) 337 { 338 DeclarationNode *newnode = new DeclarationNode; 339 newnode->type = new TypeData( TypeData::Tuple ); 340 newnode->type->tuple->members = members; 341 return newnode; 342 } 343 344 DeclarationNode * 345 DeclarationNode::newTypeof( ExpressionNode *expr ) 346 { 347 DeclarationNode *newnode = new DeclarationNode; 348 newnode->type = new TypeData( TypeData::Typeof ); 349 newnode->type->typeexpr->expr = expr; 350 return newnode; 351 } 352 353 DeclarationNode * 354 DeclarationNode::newAttr( std::string *name, ExpressionNode *expr ) 355 { 356 DeclarationNode *newnode = new DeclarationNode; 357 newnode->type = new TypeData( TypeData::Attr ); 358 newnode->type->attr->name = assign_strptr( name ); 359 newnode->type->attr->expr = expr; 360 return newnode; 361 } 362 363 DeclarationNode * 364 DeclarationNode::newAttr( std::string *name, DeclarationNode *type ) 365 { 366 DeclarationNode *newnode = new DeclarationNode; 367 newnode->type = new TypeData( TypeData::Attr ); 368 newnode->type->attr->name = assign_strptr( name ); 369 newnode->type->attr->type = type; 370 return newnode; 70 } else { 71 os << name << ": a "; 72 } 73 74 if ( linkage != LinkageSpec::Cforall ) { 75 os << LinkageSpec::toString( linkage ) << " "; 76 } 77 78 printEnums( storageClasses.begin(), storageClasses.end(), storageClassName, os ); 79 if ( type ) { 80 type->print( os, indent ); 81 } else { 82 os << "untyped entity "; 83 } 84 85 if ( bitfieldWidth ) { 86 os << endl << string(indent+2, ' ') << "with bitfield width "; 87 bitfieldWidth->printOneLine( os ); 88 } 89 90 if ( initializer != 0 ) { 91 os << endl << string(indent+2, ' ') << "with initializer "; 92 initializer->printOneLine( os ); 93 } 94 95 os << endl; 96 } 97 98 void DeclarationNode::printList( std::ostream &os, int indent ) const { 99 ParseNode::printList( os, indent ); 100 if ( hasEllipsis ) { 101 os << string( indent, ' ' ) << "and a variable number of other arguments" << endl; 102 } 103 } 104 105 DeclarationNode *DeclarationNode::newFunction( std::string* name, DeclarationNode *ret, DeclarationNode *param, StatementNode *body, bool newStyle ) { 106 DeclarationNode *newnode = new DeclarationNode; 107 newnode->name = assign_strptr( name ); 108 109 newnode->type = new TypeData( TypeData::Function ); 110 newnode->type->function->params = param; 111 newnode->type->function->newStyle = newStyle; 112 newnode->type->function->body = body; 113 114 if ( body ) { 115 newnode->type->function->hasBody = true; 116 } 117 118 if ( ret ) { 119 newnode->type->base = ret->type; 120 ret->type = 0; 121 delete ret; 122 } 123 124 return newnode; 125 } 126 127 DeclarationNode *DeclarationNode::newQualifier( Qualifier q ) { 128 DeclarationNode *newnode = new DeclarationNode; 129 newnode->type = new TypeData(); 130 newnode->type->qualifiers.push_back( q ); 131 return newnode; 132 } 133 134 DeclarationNode *DeclarationNode::newStorageClass( StorageClass sc ) { 135 DeclarationNode *newnode = new DeclarationNode; 136 newnode->storageClasses.push_back( sc ); 137 return newnode; 138 } 139 140 DeclarationNode *DeclarationNode::newBasicType( BasicType bt ) { 141 DeclarationNode *newnode = new DeclarationNode; 142 newnode->type = new TypeData( TypeData::Basic ); 143 newnode->type->basic->typeSpec.push_back( bt ); 144 return newnode; 145 } 146 147 DeclarationNode *DeclarationNode::newModifier( Modifier mod ) { 148 DeclarationNode *newnode = new DeclarationNode; 149 newnode->type = new TypeData( TypeData::Basic ); 150 newnode->type->basic->modifiers.push_back( mod ); 151 return newnode; 152 } 153 154 DeclarationNode *DeclarationNode::newForall( DeclarationNode* forall ) { 155 DeclarationNode *newnode = new DeclarationNode; 156 newnode->type = new TypeData( TypeData::Unknown ); 157 newnode->type->forall = forall; 158 return newnode; 159 } 160 161 DeclarationNode *DeclarationNode::newFromTypedef( std::string* name ) { 162 DeclarationNode *newnode = new DeclarationNode; 163 newnode->type = new TypeData( TypeData::SymbolicInst ); 164 newnode->type->symbolic->name = assign_strptr( name ); 165 newnode->type->symbolic->isTypedef = true; 166 newnode->type->symbolic->params = 0; 167 return newnode; 168 } 169 170 DeclarationNode *DeclarationNode::newAggregate( TyCon kind, std::string* name, DeclarationNode *formals, ExpressionNode *actuals, DeclarationNode *fields ) { 171 DeclarationNode *newnode = new DeclarationNode; 172 newnode->type = new TypeData( TypeData::Aggregate ); 173 newnode->type->aggregate->kind = kind; 174 newnode->type->aggregate->name = assign_strptr( name ); 175 if ( newnode->type->aggregate->name == "" ) { 176 newnode->type->aggregate->name = DeclarationNode::anonymous.newName(); 177 } 178 newnode->type->aggregate->params = formals; 179 newnode->type->aggregate->actuals = actuals; 180 newnode->type->aggregate->members = fields; 181 return newnode; 182 } 183 184 DeclarationNode *DeclarationNode::newEnum( std::string *name, DeclarationNode *constants ) { 185 DeclarationNode *newnode = new DeclarationNode; 186 newnode->name = assign_strptr( name ); 187 newnode->type = new TypeData( TypeData::Enum ); 188 newnode->type->enumeration->name = newnode->name; 189 if ( newnode->type->enumeration->name == "" ) { 190 newnode->type->enumeration->name = DeclarationNode::anonymous.newName(); 191 } 192 newnode->type->enumeration->constants = constants; 193 return newnode; 194 } 195 196 DeclarationNode *DeclarationNode::newEnumConstant( std::string* name, ExpressionNode *constant ) { 197 DeclarationNode *newnode = new DeclarationNode; 198 newnode->name = assign_strptr( name ); 199 // do something with the constant 200 return newnode; 201 } 202 203 DeclarationNode *DeclarationNode::newName( std::string* name ) { 204 DeclarationNode *newnode = new DeclarationNode; 205 newnode->name = assign_strptr( name ); 206 return newnode; 207 } 208 209 DeclarationNode *DeclarationNode::newFromTypeGen( std::string* name, ExpressionNode *params ) { 210 DeclarationNode *newnode = new DeclarationNode; 211 newnode->type = new TypeData( TypeData::SymbolicInst ); 212 newnode->type->symbolic->name = assign_strptr( name ); 213 newnode->type->symbolic->isTypedef = false; 214 newnode->type->symbolic->actuals = params; 215 return newnode; 216 } 217 218 DeclarationNode *DeclarationNode::newTypeParam( TypeClass tc, std::string* name ) { 219 DeclarationNode *newnode = new DeclarationNode; 220 newnode->name = assign_strptr( name ); 221 newnode->type = new TypeData( TypeData::Variable ); 222 newnode->type->variable->tyClass = tc; 223 newnode->type->variable->name = newnode->name; 224 return newnode; 225 } 226 227 DeclarationNode *DeclarationNode::newContext( std::string *name, DeclarationNode *params, DeclarationNode *asserts ) { 228 DeclarationNode *newnode = new DeclarationNode; 229 newnode->type = new TypeData( TypeData::Aggregate ); 230 newnode->type->aggregate->kind = Context; 231 newnode->type->aggregate->params = params; 232 newnode->type->aggregate->members = asserts; 233 newnode->type->aggregate->name = assign_strptr( name ); 234 return newnode; 235 } 236 237 DeclarationNode *DeclarationNode::newContextUse( std::string *name, ExpressionNode *params ) { 238 DeclarationNode *newnode = new DeclarationNode; 239 newnode->type = new TypeData( TypeData::AggregateInst ); 240 newnode->type->aggInst->aggregate = new TypeData( TypeData::Aggregate ); 241 newnode->type->aggInst->aggregate->aggregate->kind = Context; 242 newnode->type->aggInst->aggregate->aggregate->name = assign_strptr( name ); 243 newnode->type->aggInst->params = params; 244 return newnode; 245 } 246 247 DeclarationNode *DeclarationNode::newTypeDecl( std::string *name, DeclarationNode *typeParams ) { 248 DeclarationNode *newnode = new DeclarationNode; 249 newnode->name = assign_strptr( name ); 250 newnode->type = new TypeData( TypeData::Symbolic ); 251 newnode->type->symbolic->isTypedef = false; 252 newnode->type->symbolic->params = typeParams; 253 newnode->type->symbolic->name = newnode->name; 254 return newnode; 255 } 256 257 DeclarationNode *DeclarationNode::newPointer( DeclarationNode *qualifiers ) { 258 DeclarationNode *newnode = new DeclarationNode; 259 newnode->type = new TypeData( TypeData::Pointer ); 260 return newnode->addQualifiers( qualifiers ); 261 } 262 263 DeclarationNode *DeclarationNode::newArray( ExpressionNode *size, DeclarationNode *qualifiers, bool isStatic ) { 264 DeclarationNode *newnode = new DeclarationNode; 265 newnode->type = new TypeData( TypeData::Array ); 266 newnode->type->array->dimension = size; 267 newnode->type->array->isStatic = isStatic; 268 newnode->type->array->isVarLen = false; 269 return newnode->addQualifiers( qualifiers ); 270 } 271 272 DeclarationNode *DeclarationNode::newVarArray( DeclarationNode *qualifiers ) { 273 DeclarationNode *newnode = new DeclarationNode; 274 newnode->type = new TypeData( TypeData::Array ); 275 newnode->type->array->dimension = 0; 276 newnode->type->array->isStatic = false; 277 newnode->type->array->isVarLen = true; 278 return newnode->addQualifiers( qualifiers ); 279 } 280 281 DeclarationNode *DeclarationNode::newBitfield( ExpressionNode *size ) { 282 DeclarationNode *newnode = new DeclarationNode; 283 newnode->bitfieldWidth = size; 284 return newnode; 285 } 286 287 DeclarationNode *DeclarationNode::newTuple( DeclarationNode *members ) { 288 DeclarationNode *newnode = new DeclarationNode; 289 newnode->type = new TypeData( TypeData::Tuple ); 290 newnode->type->tuple->members = members; 291 return newnode; 292 } 293 294 DeclarationNode *DeclarationNode::newTypeof( ExpressionNode *expr ) { 295 DeclarationNode *newnode = new DeclarationNode; 296 newnode->type = new TypeData( TypeData::Typeof ); 297 newnode->type->typeexpr->expr = expr; 298 return newnode; 299 } 300 301 DeclarationNode *DeclarationNode::newAttr( std::string *name, ExpressionNode *expr ) { 302 DeclarationNode *newnode = new DeclarationNode; 303 newnode->type = new TypeData( TypeData::Attr ); 304 newnode->type->attr->name = assign_strptr( name ); 305 newnode->type->attr->expr = expr; 306 return newnode; 307 } 308 309 DeclarationNode *DeclarationNode::newAttr( std::string *name, DeclarationNode *type ) { 310 DeclarationNode *newnode = new DeclarationNode; 311 newnode->type = new TypeData( TypeData::Attr ); 312 newnode->type->attr->name = assign_strptr( name ); 313 newnode->type->attr->type = type; 314 return newnode; 315 } 316 317 static void addQualifiersToType( TypeData *&src, TypeData *dst ) { 318 if ( src && dst ) { 319 if ( src->forall && dst->kind == TypeData::Function ) { 320 if ( dst->forall ) { 321 dst->forall->appendList( src->forall ); 322 } else { 323 dst->forall = src->forall; 324 } 325 src->forall = 0; 326 } 327 if ( dst->base ) { 328 addQualifiersToType( src, dst->base ); 329 } else if ( dst->kind == TypeData::Function ) { 330 dst->base = src; 331 src = 0; 332 } else { 333 dst->qualifiers.splice( dst->qualifiers.end(), src->qualifiers ); 334 } 335 } 336 } 337 338 DeclarationNode *DeclarationNode::addQualifiers( DeclarationNode *q ) { 339 if ( q ) { 340 storageClasses.splice( storageClasses.end(), q->storageClasses ); 341 if ( q->type ) { 342 if ( ! type ) { 343 type = new TypeData; 344 } 345 addQualifiersToType( q->type, type ); 346 if ( q->type && q->type->forall ) { 347 if ( type->forall ) { 348 type->forall->appendList( q->type->forall ); 349 } else { 350 type->forall = q->type->forall; 351 } 352 q->type->forall = 0; 353 } 354 } 355 } 356 delete q; 357 return this; 358 } 359 360 DeclarationNode *DeclarationNode::copyStorageClasses( DeclarationNode *q ) { 361 storageClasses = q->storageClasses; 362 return this; 363 } 364 365 static void addTypeToType( TypeData *&src, TypeData *&dst ) { 366 if ( src && dst ) { 367 if ( src->forall && dst->kind == TypeData::Function ) { 368 if ( dst->forall ) { 369 dst->forall->appendList( src->forall ); 370 } else { 371 dst->forall = src->forall; 372 } 373 src->forall = 0; 374 } 375 if ( dst->base ) { 376 addTypeToType( src, dst->base ); 377 } else { 378 switch ( dst->kind ) { 379 case TypeData::Unknown: 380 src->qualifiers.splice( src->qualifiers.end(), dst->qualifiers ); 381 dst = src; 382 src = 0; 383 break; 384 385 case TypeData::Basic: 386 dst->qualifiers.splice( dst->qualifiers.end(), src->qualifiers ); 387 if ( src->kind != TypeData::Unknown ) { 388 assert( src->kind == TypeData::Basic ); 389 dst->basic->modifiers.splice( dst->basic->modifiers.end(), src->basic->modifiers ); 390 dst->basic->typeSpec.splice( dst->basic->typeSpec.end(), src->basic->typeSpec ); 391 } 392 break; 393 394 default: 395 switch ( src->kind ) { 396 case TypeData::Aggregate: 397 case TypeData::Enum: 398 dst->base = new TypeData( TypeData::AggregateInst ); 399 dst->base->aggInst->aggregate = src; 400 if ( src->kind == TypeData::Aggregate ) { 401 dst->base->aggInst->params = maybeClone( src->aggregate->actuals ); 402 } 403 dst->base->qualifiers.splice( dst->base->qualifiers.end(), src->qualifiers ); 404 src = 0; 405 break; 406 407 default: 408 if ( dst->forall ) { 409 dst->forall->appendList( src->forall ); 410 } else { 411 dst->forall = src->forall; 412 } 413 src->forall = 0; 414 dst->base = src; 415 src = 0; 416 } 417 } 418 } 419 } 420 } 421 422 DeclarationNode *DeclarationNode::addType( DeclarationNode *o ) { 423 if ( o ) { 424 storageClasses.splice( storageClasses.end(), o->storageClasses ); 425 if ( o->type ) { 426 if ( ! type ) { 427 if ( o->type->kind == TypeData::Aggregate || o->type->kind == TypeData::Enum ) { 428 type = new TypeData( TypeData::AggregateInst ); 429 type->aggInst->aggregate = o->type; 430 if ( o->type->kind == TypeData::Aggregate ) { 431 type->aggInst->params = maybeClone( o->type->aggregate->actuals ); 432 } 433 type->qualifiers.splice( type->qualifiers.end(), o->type->qualifiers ); 434 } else { 435 type = o->type; 436 } 437 o->type = 0; 438 } else { 439 addTypeToType( o->type, type ); 440 } 441 } 442 if ( o->bitfieldWidth ) { 443 bitfieldWidth = o->bitfieldWidth; 444 } 445 } 446 delete o; 447 return this; 448 } 449 450 DeclarationNode *DeclarationNode::addTypedef() { 451 TypeData *newtype = new TypeData( TypeData::Symbolic ); 452 newtype->symbolic->params = 0; 453 newtype->symbolic->isTypedef = true; 454 newtype->symbolic->name = name; 455 newtype->base = type; 456 type = newtype; 457 return this; 458 } 459 460 DeclarationNode *DeclarationNode::addAssertions( DeclarationNode* assertions ) { 461 assert( type ); 462 switch ( type->kind ) { 463 case TypeData::Symbolic: 464 if ( type->symbolic->assertions ) { 465 type->symbolic->assertions->appendList( assertions ); 466 } else { 467 type->symbolic->assertions = assertions; 468 } 469 break; 470 471 case TypeData::Variable: 472 if ( type->variable->assertions ) { 473 type->variable->assertions->appendList( assertions ); 474 } else { 475 type->variable->assertions = assertions; 476 } 477 break; 478 479 default: 480 assert( false ); 481 } 482 483 return this; 484 } 485 486 DeclarationNode *DeclarationNode::addName( std::string* newname ) { 487 name = assign_strptr( newname ); 488 return this; 489 } 490 491 DeclarationNode *DeclarationNode::addBitfield( ExpressionNode *size ) { 492 bitfieldWidth = size; 493 return this; 494 } 495 496 DeclarationNode *DeclarationNode::addVarArgs() { 497 assert( type ); 498 hasEllipsis = true; 499 return this; 500 } 501 502 DeclarationNode *DeclarationNode::addFunctionBody( StatementNode *body ) { 503 assert( type ); 504 assert( type->kind == TypeData::Function ); 505 assert( type->function->body == 0 ); 506 type->function->body = body; 507 type->function->hasBody = true; 508 return this; 509 } 510 511 DeclarationNode *DeclarationNode::addOldDeclList( DeclarationNode *list ) { 512 assert( type ); 513 assert( type->kind == TypeData::Function ); 514 assert( type->function->oldDeclList == 0 ); 515 type->function->oldDeclList = list; 516 return this; 371 517 } 372 518 373 519 static void 374 addQualifiersToType( TypeData *&src, TypeData *dst ) 375 { 376 if( src && dst ) { 377 if( src->forall && dst->kind == TypeData::Function ) { 378 if( dst->forall ) { 379 dst->forall->appendList( src->forall ); 380 } else { 381 dst->forall = src->forall; 382 } 383 src->forall = 0; 384 } 385 if( dst->base ) { 386 addQualifiersToType( src, dst->base ); 387 } else if( dst->kind == TypeData::Function ) { 388 dst->base = src; 389 src = 0; 520 setBase( TypeData *&type, TypeData *newType ) { 521 if ( type ) { 522 TypeData *prevBase = type; 523 TypeData *curBase = type->base; 524 while( curBase != 0 ) { 525 prevBase = curBase; 526 curBase = curBase->base; 527 } 528 prevBase->base = newType; 390 529 } else { 391 dst->qualifiers.splice( dst->qualifiers.end(), src->qualifiers ); 392 } 393 } 394 } 395 396 DeclarationNode * 397 DeclarationNode::addQualifiers( DeclarationNode *q ) 398 { 399 if( q ) { 400 storageClasses.splice( storageClasses.end(), q->storageClasses ); 401 if( q->type ) { 402 if( !type ) { 403 type = new TypeData; 404 } 405 addQualifiersToType( q->type, type ); 406 if( q->type && q->type->forall ) { 407 if( type->forall ) { 408 type->forall->appendList( q->type->forall ); 409 } else { 410 type->forall = q->type->forall; 411 } 412 q->type->forall = 0; 413 } 414 } 415 } 416 delete q; 417 return this; 418 } 419 420 DeclarationNode * 421 DeclarationNode::copyStorageClasses( DeclarationNode *q ) 422 { 423 storageClasses = q->storageClasses; 424 return this; 425 } 426 427 static void 428 addTypeToType( TypeData *&src, TypeData *&dst ) 429 { 430 if( src && dst ) { 431 if( src->forall && dst->kind == TypeData::Function ) { 432 if( dst->forall ) { 433 dst->forall->appendList( src->forall ); 434 } else { 435 dst->forall = src->forall; 436 } 437 src->forall = 0; 438 } 439 if( dst->base ) { 440 addTypeToType( src, dst->base ); 530 type = newType; 531 } 532 } 533 534 DeclarationNode *DeclarationNode::addPointer( DeclarationNode *p ) { 535 if ( p ) { 536 assert( p->type->kind == TypeData::Pointer ); 537 setBase( type, p->type ); 538 p->type = 0; 539 delete p; 540 } 541 return this; 542 } 543 544 DeclarationNode *DeclarationNode::addArray( DeclarationNode *a ) { 545 if ( a ) { 546 assert( a->type->kind == TypeData::Array ); 547 setBase( type, a->type ); 548 a->type = 0; 549 delete a; 550 } 551 return this; 552 } 553 554 DeclarationNode *DeclarationNode::addNewPointer( DeclarationNode *p ) { 555 if ( p ) { 556 assert( p->type->kind == TypeData::Pointer ); 557 if ( type ) { 558 switch ( type->kind ) { 559 case TypeData::Aggregate: 560 case TypeData::Enum: 561 p->type->base = new TypeData( TypeData::AggregateInst ); 562 p->type->base->aggInst->aggregate = type; 563 if ( type->kind == TypeData::Aggregate ) { 564 p->type->base->aggInst->params = maybeClone( type->aggregate->actuals ); 565 } 566 p->type->base->qualifiers.splice( p->type->base->qualifiers.end(), type->qualifiers ); 567 break; 568 569 default: 570 p->type->base = type; 571 } 572 type = 0; 573 } 574 delete this; 575 return p; 441 576 } else { 442 switch( dst->kind ) { 443 case TypeData::Unknown: 444 src->qualifiers.splice( src->qualifiers.end(), dst->qualifiers ); 445 dst = src; 446 src = 0; 447 break; 448 449 case TypeData::Basic: 450 dst->qualifiers.splice( dst->qualifiers.end(), src->qualifiers ); 451 if( src->kind != TypeData::Unknown ) { 452 assert( src->kind == TypeData::Basic ); 453 dst->basic->modifiers.splice( dst->basic->modifiers.end(), src->basic->modifiers ); 454 dst->basic->typeSpec.splice( dst->basic->typeSpec.end(), src->basic->typeSpec ); 455 } 456 break; 457 458 default: 459 switch( src->kind ) { 460 case TypeData::Aggregate: 461 case TypeData::Enum: 462 dst->base = new TypeData( TypeData::AggregateInst ); 463 dst->base->aggInst->aggregate = src; 464 if( src->kind == TypeData::Aggregate ) { 465 dst->base->aggInst->params = maybeClone( src->aggregate->actuals ); 466 } 467 dst->base->qualifiers.splice( dst->base->qualifiers.end(), src->qualifiers ); 468 src = 0; 469 break; 470 471 default: 472 if( dst->forall ) { 473 dst->forall->appendList( src->forall ); 474 } else { 475 dst->forall = src->forall; 476 } 477 src->forall = 0; 478 dst->base = src; 479 src = 0; 480 } 481 } 482 } 483 } 484 } 485 486 DeclarationNode * 487 DeclarationNode::addType( DeclarationNode *o ) 488 { 489 if( o ) { 490 storageClasses.splice( storageClasses.end(), o->storageClasses ); 491 if ( o->type ) { 492 if( !type ) { 493 if( o->type->kind == TypeData::Aggregate || o->type->kind == TypeData::Enum ) { 494 type = new TypeData( TypeData::AggregateInst ); 495 type->aggInst->aggregate = o->type; 496 if( o->type->kind == TypeData::Aggregate ) { 497 type->aggInst->params = maybeClone( o->type->aggregate->actuals ); 498 } 499 type->qualifiers.splice( type->qualifiers.end(), o->type->qualifiers ); 577 return this; 578 } 579 } 580 581 static TypeData *findLast( TypeData *a ) { 582 assert( a ); 583 TypeData *cur = a; 584 while( cur->base ) { 585 cur = cur->base; 586 } 587 return cur; 588 } 589 590 DeclarationNode *DeclarationNode::addNewArray( DeclarationNode *a ) { 591 if ( a ) { 592 assert( a->type->kind == TypeData::Array ); 593 TypeData *lastArray = findLast( a->type ); 594 if ( type ) { 595 switch ( type->kind ) { 596 case TypeData::Aggregate: 597 case TypeData::Enum: 598 lastArray->base = new TypeData( TypeData::AggregateInst ); 599 lastArray->base->aggInst->aggregate = type; 600 if ( type->kind == TypeData::Aggregate ) { 601 lastArray->base->aggInst->params = maybeClone( type->aggregate->actuals ); 602 } 603 lastArray->base->qualifiers.splice( lastArray->base->qualifiers.end(), type->qualifiers ); 604 break; 605 606 default: 607 lastArray->base = type; 608 } 609 type = 0; 610 } 611 delete this; 612 return a; 613 } else { 614 return this; 615 } 616 } 617 618 DeclarationNode *DeclarationNode::addParamList( DeclarationNode *params ) { 619 TypeData *ftype = new TypeData( TypeData::Function ); 620 ftype->function->params = params; 621 setBase( type, ftype ); 622 return this; 623 } 624 625 static TypeData *addIdListToType( TypeData *type, DeclarationNode *ids ) { 626 if ( type ) { 627 if ( type->kind != TypeData::Function ) { 628 type->base = addIdListToType( type->base, ids ); 500 629 } else { 501 type = o->type; 502 } 503 o->type = 0; 504 } else { 505 addTypeToType( o->type, type ); 506 } 507 } 508 if( o->bitfieldWidth ) { 509 bitfieldWidth = o->bitfieldWidth; 510 } 511 } 512 delete o; 513 return this; 514 } 515 516 DeclarationNode * 517 DeclarationNode::addTypedef() 518 { 519 TypeData *newtype = new TypeData( TypeData::Symbolic ); 520 newtype->symbolic->params = 0; 521 newtype->symbolic->isTypedef = true; 522 newtype->symbolic->name = name; 523 newtype->base = type; 524 type = newtype; 525 return this; 526 } 527 528 DeclarationNode * 529 DeclarationNode::addAssertions( DeclarationNode* assertions ) 530 { 531 assert( type ); 532 switch( type->kind ) { 533 case TypeData::Symbolic: 534 if( type->symbolic->assertions ) { 535 type->symbolic->assertions->appendList( assertions ); 630 type->function->idList = ids; 631 } 632 return type; 536 633 } else { 537 type->symbolic->assertions = assertions; 538 } 539 break; 634 TypeData *newtype = new TypeData( TypeData::Function ); 635 newtype->function->idList = ids; 636 return newtype; 637 } 638 } 540 639 541 case TypeData::Variable: 542 if( type->variable->assertions ) { 543 type->variable->assertions->appendList( assertions ); 640 DeclarationNode *DeclarationNode::addIdList( DeclarationNode *ids ) { 641 type = addIdListToType( type, ids ); 642 return this; 643 } 644 645 DeclarationNode *DeclarationNode::addInitializer( InitializerNode *init ) { 646 //assert 647 initializer = init; 648 return this; 649 } 650 651 DeclarationNode *DeclarationNode::cloneBaseType( string *newName ) { 652 DeclarationNode *newnode = new DeclarationNode; 653 TypeData *srcType = type; 654 while( srcType->base ) { 655 srcType = srcType->base; 656 } 657 newnode->type = maybeClone( srcType ); 658 if ( newnode->type->kind == TypeData::AggregateInst ) { 659 // don't duplicate members 660 if ( newnode->type->aggInst->aggregate->kind == TypeData::Enum ) { 661 delete newnode->type->aggInst->aggregate->enumeration->constants; 662 newnode->type->aggInst->aggregate->enumeration->constants = 0; 663 } else { 664 assert( newnode->type->aggInst->aggregate->kind == TypeData::Aggregate ); 665 delete newnode->type->aggInst->aggregate->aggregate->members; 666 newnode->type->aggInst->aggregate->aggregate->members = 0; 667 } 668 } 669 newnode->type->forall = maybeClone( type->forall ); 670 newnode->storageClasses = storageClasses; 671 newnode->name = assign_strptr( newName ); 672 return newnode; 673 } 674 675 DeclarationNode *DeclarationNode::cloneBaseType( DeclarationNode *o ) { 676 if ( o ) { 677 o->storageClasses.insert( o->storageClasses.end(), storageClasses.begin(), storageClasses.end() ); 678 if ( type ) { 679 TypeData *srcType = type; 680 while( srcType->base ) { 681 srcType = srcType->base; 682 } 683 TypeData *newType = srcType->clone(); 684 if ( newType->kind == TypeData::AggregateInst ) { 685 // don't duplicate members 686 if ( newType->aggInst->aggregate->kind == TypeData::Enum ) { 687 delete newType->aggInst->aggregate->enumeration->constants; 688 newType->aggInst->aggregate->enumeration->constants = 0; 689 } else { 690 assert( newType->aggInst->aggregate->kind == TypeData::Aggregate ); 691 delete newType->aggInst->aggregate->aggregate->members; 692 newType->aggInst->aggregate->aggregate->members = 0; 693 } 694 } 695 newType->forall = maybeClone( type->forall ); 696 if ( ! o->type ) { 697 o->type = newType; 698 } else { 699 addTypeToType( newType, o->type ); 700 delete newType; 701 } 702 } 703 } 704 return o; 705 } 706 707 DeclarationNode *DeclarationNode::cloneType( string *newName ) { 708 DeclarationNode *newnode = new DeclarationNode; 709 newnode->type = maybeClone( type ); 710 newnode->storageClasses = storageClasses; 711 newnode->name = assign_strptr( newName ); 712 return newnode; 713 } 714 715 DeclarationNode *DeclarationNode::cloneType( DeclarationNode *o ) { 716 if ( o ) { 717 o->storageClasses.insert( o->storageClasses.end(), storageClasses.begin(), storageClasses.end() ); 718 if ( type ) { 719 TypeData *newType = type->clone(); 720 if ( ! o->type ) { 721 o->type = newType; 722 } else { 723 addTypeToType( newType, o->type ); 724 delete newType; 725 } 726 } 727 } 728 return o; 729 } 730 731 DeclarationNode *DeclarationNode::appendList( DeclarationNode *node ) { 732 if ( node != 0 ) { 733 set_link( node ); 734 } 735 return this; 736 } 737 738 DeclarationNode *DeclarationNode::extractAggregate() const { 739 if ( type ) { 740 TypeData *ret = type->extractAggregate(); 741 if ( ret ) { 742 DeclarationNode *newnode = new DeclarationNode; 743 newnode->type = ret; 744 return newnode; 745 } else { 746 return 0; 747 } 544 748 } else { 545 type->variable->assertions = assertions; 546 } 547 break; 548 549 default: 550 assert( false ); 551 } 552 553 return this; 554 } 555 556 DeclarationNode * 557 DeclarationNode::addName( std::string* newname ) 558 { 559 name = assign_strptr( newname ); 560 return this; 561 } 562 563 DeclarationNode * 564 DeclarationNode::addBitfield( ExpressionNode *size ) 565 { 566 bitfieldWidth = size; 567 return this; 568 } 569 570 DeclarationNode * 571 DeclarationNode::addVarArgs() 572 { 573 assert( type ); 574 hasEllipsis = true; 575 return this; 576 } 577 578 DeclarationNode * 579 DeclarationNode::addFunctionBody( StatementNode *body ) 580 { 581 assert( type ); 582 assert( type->kind == TypeData::Function ); 583 assert( type->function->body == 0 ); 584 type->function->body = body; 585 type->function->hasBody = true; 586 return this; 587 } 588 589 DeclarationNode * 590 DeclarationNode::addOldDeclList( DeclarationNode *list ) 591 { 592 assert( type ); 593 assert( type->kind == TypeData::Function ); 594 assert( type->function->oldDeclList == 0 ); 595 type->function->oldDeclList = list; 596 return this; 597 } 598 599 static void 600 setBase( TypeData *&type, TypeData *newType ) 601 { 602 if( type ) { 603 TypeData *prevBase = type; 604 TypeData *curBase = type->base; 605 while( curBase != 0 ) { 606 prevBase = curBase; 607 curBase = curBase->base; 608 } 609 prevBase->base = newType; 610 } else { 611 type = newType; 612 } 613 } 614 615 DeclarationNode * 616 DeclarationNode::addPointer( DeclarationNode *p ) 617 { 618 if( p ) { 619 assert( p->type->kind == TypeData::Pointer ); 620 setBase( type, p->type ); 621 p->type = 0; 622 delete p; 623 } 624 return this; 625 } 626 627 DeclarationNode * 628 DeclarationNode::addArray( DeclarationNode *a ) 629 { 630 if( a ) { 631 assert( a->type->kind == TypeData::Array ); 632 setBase( type, a->type ); 633 a->type = 0; 634 delete a; 635 } 636 return this; 637 } 638 639 DeclarationNode * 640 DeclarationNode::addNewPointer( DeclarationNode *p ) 641 { 642 if( p ) { 643 assert( p->type->kind == TypeData::Pointer ); 644 if( type ) { 645 switch( type->kind ) { 646 case TypeData::Aggregate: 647 case TypeData::Enum: 648 p->type->base = new TypeData( TypeData::AggregateInst ); 649 p->type->base->aggInst->aggregate = type; 650 if( type->kind == TypeData::Aggregate ) { 651 p->type->base->aggInst->params = maybeClone( type->aggregate->actuals ); 652 } 653 p->type->base->qualifiers.splice( p->type->base->qualifiers.end(), type->qualifiers ); 654 break; 655 656 default: 657 p->type->base = type; 658 } 659 type = 0; 660 } 661 delete this; 662 return p; 663 } else { 664 return this; 665 } 666 } 667 668 static TypeData * 669 findLast( TypeData *a ) 670 { 671 assert( a ); 672 TypeData *cur = a; 673 while( cur->base ) { 674 cur = cur->base; 675 } 676 return cur; 677 } 678 679 DeclarationNode * 680 DeclarationNode::addNewArray( DeclarationNode *a ) 681 { 682 if( a ) { 683 assert( a->type->kind == TypeData::Array ); 684 TypeData *lastArray = findLast( a->type ); 685 if( type ) { 686 switch( type->kind ) { 687 case TypeData::Aggregate: 688 case TypeData::Enum: 689 lastArray->base = new TypeData( TypeData::AggregateInst ); 690 lastArray->base->aggInst->aggregate = type; 691 if( type->kind == TypeData::Aggregate ) { 692 lastArray->base->aggInst->params = maybeClone( type->aggregate->actuals ); 693 } 694 lastArray->base->qualifiers.splice( lastArray->base->qualifiers.end(), type->qualifiers ); 695 break; 696 697 default: 698 lastArray->base = type; 699 } 700 type = 0; 701 } 702 delete this; 703 return a; 704 } else { 705 return this; 706 } 707 } 708 709 DeclarationNode * 710 DeclarationNode::addParamList( DeclarationNode *params ) 711 { 712 TypeData *ftype = new TypeData( TypeData::Function ); 713 ftype->function->params = params; 714 setBase( type, ftype ); 715 return this; 716 } 717 718 static TypeData* 719 addIdListToType( TypeData *type, DeclarationNode *ids ) 720 { 721 if( type ) { 722 if( type->kind != TypeData::Function ) { 723 type->base = addIdListToType( type->base, ids ); 724 } else { 725 type->function->idList = ids; 726 } 727 return type; 728 } else { 729 TypeData *newtype = new TypeData( TypeData::Function ); 730 newtype->function->idList = ids; 731 return newtype; 732 } 733 } 734 735 DeclarationNode * 736 DeclarationNode::addIdList( DeclarationNode *ids ) 737 { 738 type = addIdListToType( type, ids ); 739 return this; 740 } 741 742 DeclarationNode * 743 DeclarationNode::addInitializer( InitializerNode *init ) 744 { 745 //assert 746 initializer = init; 747 return this; 748 } 749 750 DeclarationNode * 751 DeclarationNode::cloneBaseType( string *newName ) 752 { 753 DeclarationNode *newnode = new DeclarationNode; 754 TypeData *srcType = type; 755 while( srcType->base ) { 756 srcType = srcType->base; 757 } 758 newnode->type = maybeClone( srcType ); 759 if( newnode->type->kind == TypeData::AggregateInst ) { 760 // don't duplicate members 761 if( newnode->type->aggInst->aggregate->kind == TypeData::Enum ) { 762 delete newnode->type->aggInst->aggregate->enumeration->constants; 763 newnode->type->aggInst->aggregate->enumeration->constants = 0; 764 } else { 765 assert( newnode->type->aggInst->aggregate->kind == TypeData::Aggregate ); 766 delete newnode->type->aggInst->aggregate->aggregate->members; 767 newnode->type->aggInst->aggregate->aggregate->members = 0; 768 } 769 } 770 newnode->type->forall = maybeClone( type->forall ); 771 newnode->storageClasses = storageClasses; 772 newnode->name = assign_strptr( newName ); 773 return newnode; 774 } 775 776 DeclarationNode * 777 DeclarationNode::cloneBaseType( DeclarationNode *o ) 778 { 779 if( o ) { 780 o->storageClasses.insert( o->storageClasses.end(), storageClasses.begin(), storageClasses.end() ); 781 if ( type ) { 782 TypeData *srcType = type; 783 while( srcType->base ) { 784 srcType = srcType->base; 785 } 786 TypeData *newType = srcType->clone(); 787 if( newType->kind == TypeData::AggregateInst ) { 788 // don't duplicate members 789 if( newType->aggInst->aggregate->kind == TypeData::Enum ) { 790 delete newType->aggInst->aggregate->enumeration->constants; 791 newType->aggInst->aggregate->enumeration->constants = 0; 792 } else { 793 assert( newType->aggInst->aggregate->kind == TypeData::Aggregate ); 794 delete newType->aggInst->aggregate->aggregate->members; 795 newType->aggInst->aggregate->aggregate->members = 0; 796 } 797 } 798 newType->forall = maybeClone( type->forall ); 799 if( !o->type ) { 800 o->type = newType; 801 } else { 802 addTypeToType( newType, o->type ); 803 delete newType; 804 } 805 } 806 } 807 return o; 808 } 809 810 DeclarationNode * 811 DeclarationNode::cloneType( string *newName ) 812 { 813 DeclarationNode *newnode = new DeclarationNode; 814 newnode->type = maybeClone( type ); 815 newnode->storageClasses = storageClasses; 816 newnode->name = assign_strptr( newName ); 817 return newnode; 818 } 819 820 DeclarationNode * 821 DeclarationNode::cloneType( DeclarationNode *o ) 822 { 823 if( o ) { 824 o->storageClasses.insert( o->storageClasses.end(), storageClasses.begin(), storageClasses.end() ); 825 if ( type ) { 826 TypeData *newType = type->clone(); 827 if( !o->type ) { 828 o->type = newType; 829 } else { 830 addTypeToType( newType, o->type ); 831 delete newType; 832 } 833 } 834 } 835 return o; 836 } 837 838 DeclarationNode * 839 DeclarationNode::appendList( DeclarationNode *node ) 840 { 841 if( node != 0 ) { 842 set_link( node ); 843 } 844 return this; 845 } 846 847 DeclarationNode* 848 DeclarationNode::extractAggregate() const 849 { 850 if( type ) { 851 TypeData *ret = type->extractAggregate(); 852 if( ret ) { 853 DeclarationNode *newnode = new DeclarationNode; 854 newnode->type = ret; 855 return newnode; 856 } else { 857 return 0; 858 } 859 } else { 860 return 0; 861 } 862 } 863 864 void buildList( const DeclarationNode *firstNode, std::list< Declaration* > &outputList ) 865 { 866 SemanticError errors; 867 std::back_insert_iterator< std::list< Declaration* > > out( outputList ); 868 const DeclarationNode *cur = firstNode; 869 while( cur ) { 870 try { 871 if( DeclarationNode *extr = cur->extractAggregate() ) { 872 // handle the case where a structure declaration is contained within an object or type 873 // declaration 874 Declaration *decl = extr->build(); 875 if( decl ) { 876 *out++ = decl; 877 } 878 } 879 Declaration *decl = cur->build(); 880 if( decl ) { 881 *out++ = decl; 882 } 883 } catch( SemanticError &e ) { 884 errors.append( e ); 885 } 886 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 887 } 888 if( !errors.isEmpty() ) { 889 throw errors; 890 } 891 } 892 893 void buildList( const DeclarationNode *firstNode, std::list< DeclarationWithType* > &outputList ) 894 { 895 SemanticError errors; 896 std::back_insert_iterator< std::list< DeclarationWithType* > > out( outputList ); 897 const DeclarationNode *cur = firstNode; 898 while( cur ) { 899 try { 900 /// if( DeclarationNode *extr = cur->extractAggregate() ) { 749 return 0; 750 } 751 } 752 753 void buildList( const DeclarationNode *firstNode, std::list< Declaration* > &outputList ) { 754 SemanticError errors; 755 std::back_insert_iterator< std::list< Declaration* > > out( outputList ); 756 const DeclarationNode *cur = firstNode; 757 while( cur ) { 758 try { 759 if ( DeclarationNode *extr = cur->extractAggregate() ) { 760 // handle the case where a structure declaration is contained within an object or type 761 // declaration 762 Declaration *decl = extr->build(); 763 if ( decl ) { 764 *out++ = decl; 765 } 766 } 767 Declaration *decl = cur->build(); 768 if ( decl ) { 769 *out++ = decl; 770 } 771 } catch( SemanticError &e ) { 772 errors.append( e ); 773 } 774 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 775 } 776 if ( ! errors.isEmpty() ) { 777 throw errors; 778 } 779 } 780 781 void buildList( const DeclarationNode *firstNode, std::list< DeclarationWithType* > &outputList ) { 782 SemanticError errors; 783 std::back_insert_iterator< std::list< DeclarationWithType* > > out( outputList ); 784 const DeclarationNode *cur = firstNode; 785 while( cur ) { 786 try { 787 /// if ( DeclarationNode *extr = cur->extractAggregate() ) { 901 788 /// // handle the case where a structure declaration is contained within an object or type 902 789 /// // declaration 903 790 /// Declaration *decl = extr->build(); 904 /// if ( decl ) {905 /// 791 /// if ( decl ) { 792 /// *out++ = decl; 906 793 /// } 907 794 /// } 908 Declaration *decl = cur->build(); 909 if( decl ) { 910 if( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( decl ) ) { 911 *out++ = dwt; 912 } else if( StructDecl *agg = dynamic_cast< StructDecl* >( decl ) ) { 913 StructInstType *inst = new StructInstType( Type::Qualifiers(), agg->get_name() ); 914 *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 ); 915 delete agg; 916 } else if( UnionDecl *agg = dynamic_cast< UnionDecl* >( decl ) ) { 917 UnionInstType *inst = new UnionInstType( Type::Qualifiers(), agg->get_name() ); 918 *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 ); 919 } 795 Declaration *decl = cur->build(); 796 if ( decl ) { 797 if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( decl ) ) { 798 *out++ = dwt; 799 } else if ( StructDecl *agg = dynamic_cast< StructDecl* >( decl ) ) { 800 StructInstType *inst = new StructInstType( Type::Qualifiers(), agg->get_name() ); 801 *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 ); 802 delete agg; 803 } else if ( UnionDecl *agg = dynamic_cast< UnionDecl* >( decl ) ) { 804 UnionInstType *inst = new UnionInstType( Type::Qualifiers(), agg->get_name() ); 805 *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 ); 806 } 807 } 808 } catch( SemanticError &e ) { 809 errors.append( e ); 810 } 811 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 812 } 813 if ( ! errors.isEmpty() ) { 814 throw errors; 815 } 816 } 817 818 void buildTypeList( const DeclarationNode *firstNode, std::list< Type* > &outputList ) { 819 SemanticError errors; 820 std::back_insert_iterator< std::list< Type* > > out( outputList ); 821 const DeclarationNode *cur = firstNode; 822 while( cur ) { 823 try { 824 *out++ = cur->buildType(); 825 } catch( SemanticError &e ) { 826 errors.append( e ); 827 } 828 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 829 } 830 if ( ! errors.isEmpty() ) { 831 throw errors; 832 } 833 } 834 835 Declaration *DeclarationNode::build() const { 836 837 if ( ! type ) { 838 if ( buildInline() ) { 839 throw SemanticError( "invalid inline specification in declaration of ", this ); 840 } else { 841 return new ObjectDecl( name, buildStorageClass(), linkage, maybeBuild< Expression >( bitfieldWidth ), 0, maybeBuild< Initializer >( initializer ) ); 842 } 843 } else { 844 Declaration *newDecl = type->buildDecl( name, buildStorageClass(), maybeBuild< Expression >( bitfieldWidth ), buildInline(), linkage, maybeBuild< Initializer >(initializer) ); 845 return newDecl; 846 } 847 // we should never get here 848 assert( false ); 849 return 0; 850 } 851 852 Type *DeclarationNode::buildType() const { 853 assert( type ); 854 855 switch ( type->kind ) { 856 case TypeData::Enum: 857 return new EnumInstType( type->buildQualifiers(), type->enumeration->name ); 858 case TypeData::Aggregate: { 859 ReferenceToType *ret; 860 switch ( type->aggregate->kind ) { 861 case DeclarationNode::Struct: 862 ret = new StructInstType( type->buildQualifiers(), type->aggregate->name ); 863 break; 864 865 case DeclarationNode::Union: 866 ret = new UnionInstType( type->buildQualifiers(), type->aggregate->name ); 867 break; 868 869 case DeclarationNode::Context: 870 ret = new ContextInstType( type->buildQualifiers(), type->aggregate->name ); 871 break; 872 873 default: 874 assert( false ); 875 } 876 buildList( type->aggregate->actuals, ret->get_parameters() ); 877 return ret; 920 878 } 921 } catch( SemanticError &e ) { 922 errors.append( e ); 923 } 924 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 925 } 926 if( !errors.isEmpty() ) { 927 throw errors; 928 } 929 } 930 931 void buildTypeList( const DeclarationNode *firstNode, std::list< Type* > &outputList ) 932 { 933 SemanticError errors; 934 std::back_insert_iterator< std::list< Type* > > out( outputList ); 935 const DeclarationNode *cur = firstNode; 936 while( cur ) { 937 try { 938 *out++ = cur->buildType(); 939 } catch( SemanticError &e ) { 940 errors.append( e ); 941 } 942 cur = dynamic_cast< DeclarationNode* >( cur->get_link() ); 943 } 944 if( !errors.isEmpty() ) { 945 throw errors; 946 } 947 } 948 949 Declaration * 950 DeclarationNode::build() const 951 { 952 953 if( !type ) { 954 if( buildInline() ) { 955 throw SemanticError( "invalid inline specification in declaration of ", this ); 879 case TypeData::Symbolic: { 880 TypeInstType *ret = new TypeInstType( type->buildQualifiers(), type->symbolic->name, false ); 881 buildList( type->symbolic->actuals, ret->get_parameters() ); 882 return ret; 883 } 884 default: 885 return type->build(); 886 } 887 } 888 889 Declaration::StorageClass DeclarationNode::buildStorageClass() const { 890 static const Declaration::StorageClass scMap[] = { 891 Declaration::Static, 892 Declaration::Auto, 893 Declaration::Extern, 894 Declaration::Register, 895 Declaration::NoStorageClass, // inline 896 Declaration::Fortran 897 }; 898 899 Declaration::StorageClass ret = Declaration::NoStorageClass; 900 for ( std::list< StorageClass >::const_iterator i = storageClasses.begin(); i != storageClasses.end(); ++i ) { 901 assert( unsigned( *i ) < sizeof( scMap ) / sizeof( scMap[0] ) ); 902 if ( *i == Inline ) continue; 903 if ( ret == Declaration::NoStorageClass ) { 904 ret = scMap[ *i ]; 905 } else { 906 throw SemanticError( "invalid combination of storage classes in declaration of ", this ); 907 } 908 } 909 return ret; 910 } 911 912 bool DeclarationNode::buildInline() const { 913 std::list< StorageClass >::const_iterator first = std::find( storageClasses.begin(), storageClasses.end(), Inline ); 914 if ( first == storageClasses.end() ) { 915 return false; 956 916 } else { 957 return new ObjectDecl( name, buildStorageClass(), linkage, maybeBuild< Expression >( bitfieldWidth ), 0, maybeBuild< Initializer >( initializer ) ); 958 } 959 } else { 960 Declaration *newDecl = type->buildDecl( name, buildStorageClass(), maybeBuild< Expression >( bitfieldWidth ), buildInline(), linkage, maybeBuild< Initializer >(initializer) ); 961 return newDecl; 962 } 963 // we should never get here 964 assert( false ); 965 return 0; 966 } 967 968 Type * 969 DeclarationNode::buildType() const 970 { 971 972 assert( type ); 973 974 switch( type->kind ) { 975 case TypeData::Enum: 976 return new EnumInstType( type->buildQualifiers(), type->enumeration->name ); 977 978 case TypeData::Aggregate: { 979 ReferenceToType *ret; 980 switch( type->aggregate->kind ) { 981 case DeclarationNode::Struct: 982 ret = new StructInstType( type->buildQualifiers(), type->aggregate->name ); 983 break; 984 985 case DeclarationNode::Union: 986 ret = new UnionInstType( type->buildQualifiers(), type->aggregate->name ); 987 break; 988 989 case DeclarationNode::Context: 990 ret = new ContextInstType( type->buildQualifiers(), type->aggregate->name ); 991 break; 992 993 default: 994 assert( false ); 995 } 996 buildList( type->aggregate->actuals, ret->get_parameters() ); 997 return ret; 998 } 999 1000 case TypeData::Symbolic: { 1001 TypeInstType *ret = new TypeInstType( type->buildQualifiers(), type->symbolic->name, false ); 1002 buildList( type->symbolic->actuals, ret->get_parameters() ); 1003 return ret; 1004 } 1005 1006 default: 1007 return type->build(); 1008 } 1009 } 1010 1011 Declaration::StorageClass 1012 DeclarationNode::buildStorageClass() const 1013 { 1014 static const Declaration::StorageClass scMap[] = { 1015 Declaration::Static, 1016 Declaration::Auto, 1017 Declaration::Extern, 1018 Declaration::Register, 1019 Declaration::NoStorageClass, // inline 1020 Declaration::Fortran 1021 }; 1022 1023 Declaration::StorageClass ret = Declaration::NoStorageClass; 1024 for( std::list< StorageClass >::const_iterator i = storageClasses.begin(); i != storageClasses.end(); ++i ) { 1025 assert( unsigned( *i ) < sizeof( scMap ) / sizeof( scMap[0] ) ); 1026 if( *i == Inline ) continue; 1027 if( ret == Declaration::NoStorageClass ) { 1028 ret = scMap[ *i ]; 1029 } else { 1030 throw SemanticError( "invalid combination of storage classes in declaration of ", this ); 1031 } 1032 } 1033 return ret; 1034 } 1035 1036 bool 1037 DeclarationNode::buildInline() const 1038 { 1039 std::list< StorageClass >::const_iterator first = std::find( storageClasses.begin(), storageClasses.end(), Inline ); 1040 if( first == storageClasses.end() ) { 917 std::list< StorageClass >::const_iterator next = std::find( ++first, storageClasses.end(), Inline ); 918 if ( next == storageClasses.end() ) { 919 return true; 920 } else { 921 throw SemanticError( "duplicate inline specification in declaration of ", this ); 922 } 923 } 924 // we should never get here 1041 925 return false; 1042 } else { 1043 std::list< StorageClass >::const_iterator next = std::find( ++first, storageClasses.end(), Inline ); 1044 if( next == storageClasses.end() ) { 1045 return true; 1046 } else { 1047 throw SemanticError( "duplicate inline specification in declaration of ", this ); 1048 } 1049 } 1050 // we should never get here 1051 return false; 1052 } 926 } -
translator/Parser/ExpressionNode.cc
r42dcae7 r3848e0e 1 /* -*- C++ -*- */2 1 #include <cassert> 3 2 #include <cctype> … … 15 14 using namespace std; 16 15 17 ExpressionNode::ExpressionNode() : ParseNode(), argName( 0 ) { 18 } 16 ExpressionNode::ExpressionNode() : ParseNode(), argName( 0 ) {} 19 17 20 18 ExpressionNode::ExpressionNode(string *name_) : ParseNode( *name_ ), argName( 0 ) { 21 delete name_; 22 } 23 24 ExpressionNode::ExpressionNode( const ExpressionNode &other ) 25 : ParseNode( other.name ) 26 { 27 if( other.argName ) { 28 argName = other.argName->clone(); 29 } else { 30 argName = 0; 31 } 19 delete name_; 20 } 21 22 ExpressionNode::ExpressionNode( const ExpressionNode &other ) : ParseNode( other.name ) { 23 if ( other.argName ) { 24 argName = other.argName->clone(); 25 } else { 26 argName = 0; 27 } 32 28 } 33 29 34 30 ExpressionNode * ExpressionNode::set_asArgName( std::string *aName ) { 35 argName = new VarRefNode(aName);36 return this;31 argName = new VarRefNode(aName); 32 return this; 37 33 } 38 34 39 35 ExpressionNode * ExpressionNode::set_asArgName( ExpressionNode *aDesignator ) { 40 argName = aDesignator;41 return this;36 argName = aDesignator; 37 return this; 42 38 } 43 39 44 40 void ExpressionNode::printDesignation( std::ostream &os, int indent ) const { 45 if( argName ) { 46 os << string(' ', indent) << "(designated by: "; 47 argName->printOneLine(os, indent ); 48 os << ")" << std::endl; 49 } 50 } 51 52 NullExprNode::NullExprNode() 53 { 54 } 55 56 NullExprNode * 57 NullExprNode::clone() const 58 { 59 return new NullExprNode(); 60 } 61 62 void 63 NullExprNode::print(std::ostream & os, int indent) const 64 { 65 printDesignation(os); 66 os << "null expression"; 67 } 68 69 void 70 NullExprNode::printOneLine(std::ostream & os, int indent) const 71 { 72 printDesignation(os); 73 os << "null"; 74 } 75 76 Expression * 77 NullExprNode::build() const 78 { 79 return 0; 41 if ( argName ) { 42 os << string(' ', indent) << "(designated by: "; 43 argName->printOneLine(os, indent ); 44 os << ")" << std::endl; 45 } 46 } 47 48 NullExprNode::NullExprNode() {} 49 50 NullExprNode *NullExprNode::clone() const { 51 return new NullExprNode(); 52 } 53 54 void NullExprNode::print(std::ostream & os, int indent) const { 55 printDesignation(os); 56 os << "null expression"; 57 } 58 59 void NullExprNode::printOneLine(std::ostream & os, int indent) const { 60 printDesignation(os); 61 os << "null"; 62 } 63 64 Expression *NullExprNode::build() const { 65 return 0; 80 66 } 81 67 82 68 CommaExprNode *ExpressionNode::add_to_list(ExpressionNode *exp){ 83 return new CommaExprNode(this, exp );69 return new CommaExprNode(this, exp ); 84 70 } 85 71 86 72 // enum ConstantNode::Type = { Integer, Float, Character, String, Range } 87 73 88 ConstantNode::ConstantNode(void) : 89 ExpressionNode(), sign(true), longs(0), size(0) 90 {} 91 92 ConstantNode::ConstantNode(string *name_) : 93 ExpressionNode(name_), sign(true), longs(0), size(0) 94 {} 95 96 ConstantNode::ConstantNode(Type t, string *inVal) : 97 type(t), sign(true), longs(0), size(0) 98 { 99 if( inVal ) { 100 value = *inVal; 101 delete inVal; 102 } else { 103 value = ""; 104 } 105 106 classify(value); 74 ConstantNode::ConstantNode(void) : ExpressionNode(), sign(true), longs(0), size(0) {} 75 76 ConstantNode::ConstantNode(string *name_) : ExpressionNode(name_), sign(true), longs(0), size(0) {} 77 78 ConstantNode::ConstantNode(Type t, string *inVal) : type(t), sign(true), longs(0), size(0) { 79 if ( inVal ) { 80 value = *inVal; 81 delete inVal; 82 } else { 83 value = ""; 84 } 85 86 classify(value); 107 87 } 108 88 109 89 ConstantNode::ConstantNode( const ConstantNode &other ) 110 : ExpressionNode( other ), type( other.type ), value( other.value ), sign( other.sign ), base( other.base ), longs( other.longs ), size( other.size ) 111 { 90 : ExpressionNode( other ), type( other.type ), value( other.value ), sign( other.sign ), base( other.base ), longs( other.longs ), size( other.size ) { 112 91 } 113 92 114 93 // for some reason, std::tolower doesn't work as an argument to std::transform in g++ 3.1 115 inline char 116 tolower_hack( char c ) 117 { 118 return std::tolower( c ); 94 inline char tolower_hack( char c ) { 95 return std::tolower( c ); 119 96 } 120 97 121 98 void ConstantNode::classify(std::string &str){ 122 switch(type){ 123 case Integer: 124 case Float: 125 { 126 std::string sfx(""); 127 char c; 128 int i = str.length() - 1; 129 130 while( i >= 0 && !isxdigit(c = str.at(i--)) ) 131 sfx += c; 132 133 value = str.substr( 0, i + 2 ); 134 135 // get rid of underscores 136 value.erase(remove(value.begin(), value.end(), '_'), value.end()); 137 138 std::transform(sfx.begin(), sfx.end(), sfx.begin(), tolower_hack); 139 140 if( sfx.find("ll") != string::npos ){ 141 longs = 2; 142 } else if (sfx.find("l") != string::npos ){ 143 longs = 1; 99 switch (type){ 100 case Integer: 101 case Float: 102 { 103 std::string sfx(""); 104 char c; 105 int i = str.length() - 1; 106 107 while ( i >= 0 && !isxdigit(c = str.at(i--)) ) 108 sfx += c; 109 110 value = str.substr( 0, i + 2 ); 111 112 // get rid of underscores 113 value.erase(remove(value.begin(), value.end(), '_'), value.end()); 114 115 std::transform(sfx.begin(), sfx.end(), sfx.begin(), tolower_hack); 116 117 if ( sfx.find("ll") != string::npos ){ 118 longs = 2; 119 } else if (sfx.find("l") != string::npos ){ 120 longs = 1; 121 } 122 123 assert((longs >= 0) && (longs <= 2)); 124 125 if ( sfx.find("u") != string::npos ) 126 sign = false; 127 128 break; 144 129 } 145 146 assert((longs >= 0) && (longs <= 2)); 147 148 if( sfx.find("u") != string::npos ) 149 sign = false; 150 130 case Character: 131 { 132 // remove underscores from hex and oct escapes 133 if (str.substr(1,2) == "\\x") 134 value.erase(remove(value.begin(), value.end(), '_'), value.end()); 135 136 break; 137 } 138 default: 139 // shouldn't be here 140 ; 141 } 142 } 143 144 ConstantNode::Type ConstantNode::get_type(void) const { 145 return type; 146 } 147 148 ConstantNode *ConstantNode::append( std::string *newValue ) { 149 if ( newValue ) { 150 if (type == String){ 151 std::string temp = *newValue; 152 value.resize( value.size() - 1 ); 153 value += newValue->substr(1, newValue->size()); 154 } else 155 value += *newValue; 156 157 delete newValue; 158 } 159 return this; 160 } 161 162 void ConstantNode::printOneLine(std::ostream &os, int indent ) const { 163 os << string(indent, ' '); 164 printDesignation(os); 165 166 switch ( type ) { 167 /* integers */ 168 case Integer: 169 os << value ; 151 170 break; 152 } 153 case Character: 154 { 155 // remove underscores from hex and oct escapes 156 if(str.substr(1,2) == "\\x") 157 value.erase(remove(value.begin(), value.end(), '_'), value.end()); 158 171 case Float: 172 os << value ; 159 173 break; 160 } 161 default: 162 // shouldn't be here 163 ; 164 } 165 } 166 167 ConstantNode::Type ConstantNode::get_type(void) const { 168 return type; 169 } 170 171 ConstantNode* 172 ConstantNode::append( std::string *newValue ) 173 { 174 if( newValue ) { 175 if (type == String){ 176 std::string temp = *newValue; 177 value.resize( value.size() - 1 ); 178 value += newValue->substr(1, newValue->size()); 179 } else 180 value += *newValue; 181 182 delete newValue; 183 } 184 return this; 185 } 186 187 void ConstantNode::printOneLine(std::ostream &os, int indent ) const 188 { 189 os << string(indent, ' '); 190 printDesignation(os); 191 192 switch( type ) { 193 /* integers */ 194 case Integer: 195 os << value ; 196 break; 197 case Float: 198 os << value ; 199 break; 200 201 case Character: 202 os << "'" << value << "'"; 203 break; 204 205 case String: 206 os << '"' << value << '"'; 207 break; 208 } 209 210 os << ' '; 211 } 212 213 void ConstantNode::print(std::ostream &os, int indent ) const 214 { 215 printOneLine( os, indent ); 216 os << endl; 174 175 case Character: 176 os << "'" << value << "'"; 177 break; 178 179 case String: 180 os << '"' << value << '"'; 181 break; 182 } 183 184 os << ' '; 185 } 186 187 void ConstantNode::print(std::ostream &os, int indent ) const { 188 printOneLine( os, indent ); 189 os << endl; 217 190 } 218 191 219 192 Expression *ConstantNode::build() const { 220 ::Type::Qualifiers q; 221 BasicType *bt; 222 223 switch(get_type()){ 224 case Integer: 225 /* Cfr. standard 6.4.4.1 */ 226 //bt.set_kind(BasicType::SignedInt); 227 bt = new BasicType(q, BasicType::SignedInt); 228 break; 229 230 case Float: 231 bt = new BasicType(q, BasicType::Float); 232 break; 233 234 case Character: 235 bt = new BasicType(q, BasicType::Char); 236 break; 237 238 case String: 239 // string should probably be a primitive type 240 ArrayType *at; 241 std::string value = get_value(); 242 at = new ArrayType(q, new BasicType(q, BasicType::Char), 243 new ConstantExpr( Constant( new BasicType(q, BasicType::SignedInt), 244 toString( value.size() - 1 ) ) ), // account for '\0' 245 false, false ); 246 247 return new ConstantExpr( Constant(at, value), maybeBuild< Expression >( get_argName() ) ); 248 } 249 250 return new ConstantExpr( Constant(bt, get_value()), maybeBuild< Expression >( get_argName() ) ); 251 } 252 193 ::Type::Qualifiers q; 194 BasicType *bt; 195 196 switch (get_type()){ 197 case Integer: 198 /* Cfr. standard 6.4.4.1 */ 199 //bt.set_kind(BasicType::SignedInt); 200 bt = new BasicType(q, BasicType::SignedInt); 201 break; 202 case Float: 203 bt = new BasicType(q, BasicType::Float); 204 break; 205 case Character: 206 bt = new BasicType(q, BasicType::Char); 207 break; 208 case String: 209 // string should probably be a primitive type 210 ArrayType *at; 211 std::string value = get_value(); 212 at = new ArrayType(q, new BasicType(q, BasicType::Char), 213 new ConstantExpr( Constant( new BasicType(q, BasicType::SignedInt), 214 toString( value.size() - 1 ) ) ), // account for '\0' 215 false, false ); 216 return new ConstantExpr( Constant(at, value), maybeBuild< Expression >( get_argName() ) ); 217 } 218 return new ConstantExpr( Constant(bt, get_value()), maybeBuild< Expression >( get_argName() ) ); 219 } 253 220 254 221 VarRefNode::VarRefNode() : isLabel(false) {} 255 222 256 VarRefNode::VarRefNode(string *name_, bool labelp) : 257 ExpressionNode(name_), isLabel(labelp) {} 258 259 VarRefNode::VarRefNode( const VarRefNode &other ) 260 : ExpressionNode( other ), isLabel( other.isLabel ) 261 { 223 VarRefNode::VarRefNode(string *name_, bool labelp) : ExpressionNode(name_), isLabel(labelp) {} 224 225 VarRefNode::VarRefNode( const VarRefNode &other ) : ExpressionNode( other ), isLabel( other.isLabel ) { 262 226 } 263 227 264 228 Expression *VarRefNode::build() const { 265 return new NameExpr( get_name(), maybeBuild< Expression >( get_argName() ) );229 return new NameExpr( get_name(), maybeBuild< Expression >( get_argName() ) ); 266 230 } 267 231 268 232 void VarRefNode::printOneLine(std::ostream &os, int indent ) const { 269 printDesignation(os);270 os << get_name() << ' ';233 printDesignation(os); 234 os << get_name() << ' '; 271 235 } 272 236 273 237 void VarRefNode::print(std::ostream &os, int indent ) const { 274 printDesignation(os); 275 os << '\r' << string(indent, ' ') << "Referencing: "; 276 277 os << "Variable: " << get_name(); 278 279 os << endl; 280 } 281 282 283 OperatorNode::OperatorNode(Type t):type(t) {} 284 285 OperatorNode::OperatorNode( const OperatorNode &other ) 286 : ExpressionNode( other ), type( other.type ) 287 { 238 printDesignation(os); 239 os << '\r' << string(indent, ' ') << "Referencing: "; 240 os << "Variable: " << get_name(); 241 os << endl; 242 } 243 244 OperatorNode::OperatorNode(Type t) : type(t) {} 245 246 OperatorNode::OperatorNode( const OperatorNode &other ) : ExpressionNode( other ), type( other.type ) { 288 247 } 289 248 … … 291 250 292 251 OperatorNode::Type OperatorNode::get_type(void) const{ 293 return type; 294 } 295 296 void OperatorNode::printOneLine( std::ostream &os, int indent ) const 297 { 298 printDesignation(os); 299 os << OpName[ type ] << ' '; 252 return type; 253 } 254 255 void OperatorNode::printOneLine( std::ostream &os, int indent ) const { 256 printDesignation(os); 257 os << OpName[ type ] << ' '; 300 258 } 301 259 302 260 void OperatorNode::print( std::ostream &os, int indent ) const{ 303 printDesignation(os); 304 os << '\r' << string(indent, ' ') << "Operator: " << OpName[type] << endl; 305 306 return; 261 printDesignation(os); 262 os << '\r' << string(indent, ' ') << "Operator: " << OpName[type] << endl; 263 return; 307 264 } 308 265 309 266 std::string OperatorNode::get_typename(void) const{ 310 return string(OpName[ type ]);311 } 312 313 const char *OperatorNode::OpName[] = 314 {"TupleC", "Comma", "TupleFieldSel",// "TuplePFieldSel", //n-adic267 return string(OpName[ type ]); 268 } 269 270 const char *OperatorNode::OpName[] = { 271 "TupleC", "Comma", "TupleFieldSel",// "TuplePFieldSel", //n-adic 315 272 // triadic 316 273 "Cond", "NCond", 317 274 // diadic 318 275 "SizeOf", "AlignOf", "Attr", "CompLit", "Plus", "Minus", "Mul", "Div", "Mod", "Or", 319 320 321 322 276 "And", "BitOr", "BitAnd", "Xor", "Cast", "LShift", "RShift", "LThan", "GThan", 277 "LEThan", "GEThan", "Eq", "Neq", "Assign", "MulAssn", "DivAssn", "ModAssn", "PlusAssn", 278 "MinusAssn", "LSAssn", "RSAssn", "AndAssn", "ERAssn", "OrAssn", "Index", "FieldSel","PFieldSel", 279 "Range", 323 280 // monadic 324 281 "UnPlus", "UnMinus", "AddressOf", "PointTo", "Neg", "BitNeg", "Incr", "IncrPost", "Decr", "DecrPost", "LabelAddress" 325 282 }; 326 283 327 284 CompositeExprNode::CompositeExprNode(void) : ExpressionNode(), function( 0 ), arguments( 0 ) { 328 285 } 329 286 330 CompositeExprNode::CompositeExprNode(string *name_) : ExpressionNode(name_), function( 0 ), arguments( 0 ) 331 { 287 CompositeExprNode::CompositeExprNode(string *name_) : ExpressionNode(name_), function( 0 ), arguments( 0 ) { 332 288 } 333 289 334 290 CompositeExprNode::CompositeExprNode(ExpressionNode *f, ExpressionNode *args): 335 function(f), arguments(args) {291 function(f), arguments(args) { 336 292 } 337 293 338 294 CompositeExprNode::CompositeExprNode(ExpressionNode *f, ExpressionNode *arg1, ExpressionNode *arg2): 339 function(f), arguments(arg1) { 340 arguments->set_link(arg2); 341 } 342 343 CompositeExprNode::CompositeExprNode( const CompositeExprNode &other ) 344 : ExpressionNode( other ), function( maybeClone( other.function ) ) 345 { 346 ParseNode *cur = other.arguments; 347 while( cur ) { 348 if( arguments ) { 349 arguments->set_link( cur->clone() ); 350 } else { 351 arguments = (ExpressionNode*)cur->clone(); 352 } 353 cur = cur->get_link(); 354 } 355 } 356 357 CompositeExprNode::~CompositeExprNode() 358 { 359 delete function; 360 delete arguments; 295 function(f), arguments(arg1) { 296 arguments->set_link(arg2); 297 } 298 299 CompositeExprNode::CompositeExprNode( const CompositeExprNode &other ) : ExpressionNode( other ), function( maybeClone( other.function ) ) { 300 ParseNode *cur = other.arguments; 301 while ( cur ) { 302 if ( arguments ) { 303 arguments->set_link( cur->clone() ); 304 } else { 305 arguments = (ExpressionNode*)cur->clone(); 306 } 307 cur = cur->get_link(); 308 } 309 } 310 311 CompositeExprNode::~CompositeExprNode() { 312 delete function; 313 delete arguments; 361 314 } 362 315 363 316 // the names that users use to define operator functions 364 static const char *opFuncName[] = 365 {"", "", "",317 static const char *opFuncName[] = { 318 "", "", "", 366 319 "", "", 367 320 // diadic 368 321 "", "", "", "", "?+?", "?-?", "?*?", "?/?", "?%?", "", "", 369 370 371 322 "?|?", "?&?", "?^?", "", "?<<?", "?>>?", "?<?", "?>?", "?<=?", 323 "?>=?", "?==?", "?!=?", "?=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", 324 "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?", "?[?]", "","","Range", 372 325 // monadic 373 326 "+?", "-?", "", "*?", "!?", "~?", "++?", "?++", "--?", "?--", "LabAddress" 374 327 }; 375 328 376 329 #include "utility.h" 330 377 331 Expression *CompositeExprNode::build() const { 378 OperatorNode *op; 379 std::list<Expression *> args; 380 381 buildList(get_args(), args); 382 383 if (!( op = dynamic_cast<OperatorNode *>(function)) ){ 384 // a function as opposed to an operator 385 return new UntypedExpr(function->build(), args, maybeBuild< Expression >( get_argName() )); 386 387 } else { 388 389 switch(op->get_type()){ 390 case OperatorNode::Incr: 391 case OperatorNode::Decr: 392 case OperatorNode::IncrPost: 393 case OperatorNode::DecrPost: 394 case OperatorNode::Assign: 395 case OperatorNode::MulAssn: 396 case OperatorNode::DivAssn: 397 case OperatorNode::ModAssn: 398 case OperatorNode::PlusAssn: 399 case OperatorNode::MinusAssn: 400 case OperatorNode::LSAssn: 401 case OperatorNode::RSAssn: 402 case OperatorNode::AndAssn: 403 case OperatorNode::ERAssn: 404 case OperatorNode::OrAssn: 405 // the rewrite rules for these expressions specify that the first argument has its address taken 406 assert( !args.empty() ); 407 args.front() = new AddressExpr( args.front() ); 408 break; 409 410 default: 411 /* do nothing */ 412 ; 413 } 414 415 switch(op->get_type()){ 416 417 case OperatorNode::Incr: 418 case OperatorNode::Decr: 419 case OperatorNode::IncrPost: 420 case OperatorNode::DecrPost: 421 case OperatorNode::Assign: 422 case OperatorNode::MulAssn: 423 case OperatorNode::DivAssn: 424 case OperatorNode::ModAssn: 425 case OperatorNode::PlusAssn: 426 case OperatorNode::MinusAssn: 427 case OperatorNode::LSAssn: 428 case OperatorNode::RSAssn: 429 case OperatorNode::AndAssn: 430 case OperatorNode::ERAssn: 431 case OperatorNode::OrAssn: 432 case OperatorNode::Plus: 433 case OperatorNode::Minus: 434 case OperatorNode::Mul: 435 case OperatorNode::Div: 436 case OperatorNode::Mod: 437 case OperatorNode::BitOr: 438 case OperatorNode::BitAnd: 439 case OperatorNode::Xor: 440 case OperatorNode::LShift: 441 case OperatorNode::RShift: 442 case OperatorNode::LThan: 443 case OperatorNode::GThan: 444 case OperatorNode::LEThan: 445 case OperatorNode::GEThan: 446 case OperatorNode::Eq: 447 case OperatorNode::Neq: 448 case OperatorNode::Index: 449 case OperatorNode::Range: 450 case OperatorNode::UnPlus: 451 case OperatorNode::UnMinus: 452 case OperatorNode::PointTo: 453 case OperatorNode::Neg: 454 case OperatorNode::BitNeg: 455 case OperatorNode::LabelAddress: 456 return new UntypedExpr( new NameExpr( opFuncName[ op->get_type() ] ), args ); 457 458 case OperatorNode::AddressOf: 459 assert( args.size() == 1 ); 460 assert( args.front() ); 461 462 return new AddressExpr( args.front() ); 463 464 case OperatorNode::Cast: 465 { 466 TypeValueNode * arg = dynamic_cast<TypeValueNode *>(get_args()); 467 assert( arg ); 468 469 DeclarationNode *decl_node = arg->get_decl(); 470 ExpressionNode *expr_node = dynamic_cast<ExpressionNode *>(arg->get_link()); 471 472 Type *targetType = decl_node->buildType(); 473 if( dynamic_cast< VoidType* >( targetType ) ) { 474 delete targetType; 475 return new CastExpr( expr_node->build(), maybeBuild< Expression >( get_argName() ) ); 476 } else { 477 return new CastExpr(expr_node->build(),targetType, maybeBuild< Expression >( get_argName() ) ); 478 } 479 } 480 481 case OperatorNode::FieldSel: 482 { 483 assert( args.size() == 2 ); 484 485 NameExpr *member = dynamic_cast<NameExpr *>(args.back()); 486 // TupleExpr *memberTup = dynamic_cast<TupleExpr *>(args.back()); 487 488 if ( member != 0 ) 489 { 490 UntypedMemberExpr *ret = new UntypedMemberExpr(member->get_name(), args.front()); 491 delete member; 492 return ret; 493 } 494 /* else if ( memberTup != 0 ) 495 { 496 UntypedMemberExpr *ret = new UntypedMemberExpr(memberTup->get_name(), args.front()); 497 delete member; 498 return ret; 499 } */ 332 OperatorNode *op; 333 std::list<Expression *> args; 334 335 buildList(get_args(), args); 336 337 if ( ! ( op = dynamic_cast<OperatorNode *>(function)) ) { 338 // a function as opposed to an operator 339 return new UntypedExpr(function->build(), args, maybeBuild< Expression >( get_argName() )); 340 } else { 341 switch (op->get_type()){ 342 case OperatorNode::Incr: 343 case OperatorNode::Decr: 344 case OperatorNode::IncrPost: 345 case OperatorNode::DecrPost: 346 case OperatorNode::Assign: 347 case OperatorNode::MulAssn: 348 case OperatorNode::DivAssn: 349 case OperatorNode::ModAssn: 350 case OperatorNode::PlusAssn: 351 case OperatorNode::MinusAssn: 352 case OperatorNode::LSAssn: 353 case OperatorNode::RSAssn: 354 case OperatorNode::AndAssn: 355 case OperatorNode::ERAssn: 356 case OperatorNode::OrAssn: 357 // the rewrite rules for these expressions specify that the first argument has its address taken 358 assert( !args.empty() ); 359 args.front() = new AddressExpr( args.front() ); 360 break; 361 default: 362 /* do nothing */ 363 ; 364 } 365 366 switch ( op->get_type() ) { 367 case OperatorNode::Incr: 368 case OperatorNode::Decr: 369 case OperatorNode::IncrPost: 370 case OperatorNode::DecrPost: 371 case OperatorNode::Assign: 372 case OperatorNode::MulAssn: 373 case OperatorNode::DivAssn: 374 case OperatorNode::ModAssn: 375 case OperatorNode::PlusAssn: 376 case OperatorNode::MinusAssn: 377 case OperatorNode::LSAssn: 378 case OperatorNode::RSAssn: 379 case OperatorNode::AndAssn: 380 case OperatorNode::ERAssn: 381 case OperatorNode::OrAssn: 382 case OperatorNode::Plus: 383 case OperatorNode::Minus: 384 case OperatorNode::Mul: 385 case OperatorNode::Div: 386 case OperatorNode::Mod: 387 case OperatorNode::BitOr: 388 case OperatorNode::BitAnd: 389 case OperatorNode::Xor: 390 case OperatorNode::LShift: 391 case OperatorNode::RShift: 392 case OperatorNode::LThan: 393 case OperatorNode::GThan: 394 case OperatorNode::LEThan: 395 case OperatorNode::GEThan: 396 case OperatorNode::Eq: 397 case OperatorNode::Neq: 398 case OperatorNode::Index: 399 case OperatorNode::Range: 400 case OperatorNode::UnPlus: 401 case OperatorNode::UnMinus: 402 case OperatorNode::PointTo: 403 case OperatorNode::Neg: 404 case OperatorNode::BitNeg: 405 case OperatorNode::LabelAddress: 406 return new UntypedExpr( new NameExpr( opFuncName[ op->get_type() ] ), args ); 407 case OperatorNode::AddressOf: 408 assert( args.size() == 1 ); 409 assert( args.front() ); 410 411 return new AddressExpr( args.front() ); 412 case OperatorNode::Cast: 413 { 414 TypeValueNode * arg = dynamic_cast<TypeValueNode *>(get_args()); 415 assert( arg ); 416 417 DeclarationNode *decl_node = arg->get_decl(); 418 ExpressionNode *expr_node = dynamic_cast<ExpressionNode *>(arg->get_link()); 419 420 Type *targetType = decl_node->buildType(); 421 if ( dynamic_cast< VoidType* >( targetType ) ) { 422 delete targetType; 423 return new CastExpr( expr_node->build(), maybeBuild< Expression >( get_argName() ) ); 424 } else { 425 return new CastExpr(expr_node->build(),targetType, maybeBuild< Expression >( get_argName() ) ); 426 } 427 } 428 case OperatorNode::FieldSel: 429 { 430 assert( args.size() == 2 ); 431 432 NameExpr *member = dynamic_cast<NameExpr *>(args.back()); 433 // TupleExpr *memberTup = dynamic_cast<TupleExpr *>(args.back()); 434 435 if ( member != 0 ) 436 { 437 UntypedMemberExpr *ret = new UntypedMemberExpr(member->get_name(), args.front()); 438 delete member; 439 return ret; 440 } 441 /* else if ( memberTup != 0 ) 442 { 443 UntypedMemberExpr *ret = new UntypedMemberExpr(memberTup->get_name(), args.front()); 444 delete member; 445 return ret; 446 } */ 447 else 448 assert( false ); 449 } 450 case OperatorNode::PFieldSel: 451 { 452 assert( args.size() == 2 ); 453 454 NameExpr *member = dynamic_cast<NameExpr *>(args.back()); // modify for Tuples xxx 455 assert( member != 0 ); 456 457 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 458 deref->get_args().push_back( args.front() ); 459 460 UntypedMemberExpr *ret = new UntypedMemberExpr(member->get_name(), deref); 461 delete member; 462 return ret; 463 } 464 case OperatorNode::AlignOf: 465 case OperatorNode::SizeOf: 466 { 467 /// bool isSizeOf = (op->get_type() == OperatorNode::SizeOf); 468 469 if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>(get_args()) ) { 470 return new SizeofExpr(arg->get_decl()->buildType()); 471 } else { 472 return new SizeofExpr(args.front()); 473 } 474 } 475 case OperatorNode::Attr: 476 { 477 VarRefNode *var = dynamic_cast<VarRefNode *>(get_args()); 478 assert( var ); 479 if ( !get_args()->get_link() ) { 480 return new AttrExpr(var->build(), (Expression*)0); 481 } else if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>(get_args()->get_link()) ) { 482 return new AttrExpr(var->build(), arg->get_decl()->buildType()); 483 } else { 484 return new AttrExpr(var->build(), args.back()); 485 } 486 } 487 case OperatorNode::CompLit: 488 throw UnimplementedError( "C99 compound literals" ); 489 // the short-circuited operators 490 case OperatorNode::Or: 491 case OperatorNode::And: 492 assert(args.size() == 2); 493 return new LogicalExpr( notZeroExpr( args.front() ), notZeroExpr( args.back() ), (op->get_type() == OperatorNode::And) ); 494 case OperatorNode::Cond: 495 { 496 assert(args.size() == 3); 497 std::list< Expression* >::const_iterator i = args.begin(); 498 Expression *arg1 = notZeroExpr( *i++ ); 499 Expression *arg2 = *i++; 500 Expression *arg3 = *i++; 501 return new ConditionalExpr( arg1, arg2, arg3 ); 502 } 503 case OperatorNode::NCond: 504 throw UnimplementedError( "GNU 2-argument conditional expression" ); 505 case OperatorNode::Comma: 506 { 507 assert(args.size() == 2); 508 std::list< Expression* >::const_iterator i = args.begin(); 509 Expression *ret = *i++; 510 while ( i != args.end() ) { 511 ret = new CommaExpr( ret, *i++ ); 512 } 513 return ret; 514 } 515 // Tuples 516 case OperatorNode::TupleC: 517 { 518 TupleExpr *ret = new TupleExpr(); 519 std::copy( args.begin(), args.end(), back_inserter( ret->get_exprs() ) ); 520 return ret; 521 } 522 default: 523 // shouldn't happen 524 return 0; 525 } 526 } 527 } 528 529 void CompositeExprNode::printOneLine(std::ostream &os, int indent) const { 530 printDesignation(os); 531 os << "( "; 532 function->printOneLine( os, indent ); 533 for( ExpressionNode *cur = arguments; cur != 0; cur = dynamic_cast< ExpressionNode* >( cur->get_link() ) ) { 534 cur->printOneLine( os, indent ); 535 } 536 os << ") "; 537 } 538 539 void CompositeExprNode::print(std::ostream &os, int indent) const { 540 printDesignation(os); 541 os << '\r' << string(indent, ' ') << "Application of: " << endl; 542 function->print( os, indent + ParseNode::indent_by ); 543 544 os << '\r' << string(indent, ' ') ; 545 if ( arguments ) { 546 os << "... on arguments: " << endl; 547 arguments->printList(os, indent + ParseNode::indent_by); 548 } else 549 os << "... on no arguments: " << endl; 550 } 551 552 void CompositeExprNode::set_function(ExpressionNode *f){ 553 function = f; 554 } 555 556 void CompositeExprNode::set_args(ExpressionNode *args){ 557 arguments = args; 558 } 559 560 ExpressionNode *CompositeExprNode::get_function(void) const { 561 return function; 562 } 563 564 ExpressionNode *CompositeExprNode::get_args(void) const { 565 return arguments; 566 } 567 568 void CompositeExprNode::add_arg(ExpressionNode *arg){ 569 if (arguments) 570 arguments->set_link(arg); 571 else 572 set_args(arg); 573 } 574 575 CommaExprNode::CommaExprNode(): CompositeExprNode(new OperatorNode(OperatorNode::Comma)) {} 576 577 CommaExprNode::CommaExprNode(ExpressionNode *exp) : CompositeExprNode( new OperatorNode(OperatorNode::Comma), exp ) { 578 } 579 580 CommaExprNode::CommaExprNode(ExpressionNode *exp1, ExpressionNode *exp2) : CompositeExprNode(new OperatorNode(OperatorNode::Comma), exp1, exp2) { 581 } 582 583 CommaExprNode *CommaExprNode::add_to_list(ExpressionNode *exp){ 584 add_arg(exp); 585 586 return this; 587 } 588 589 CommaExprNode::CommaExprNode( const CommaExprNode &other ) : CompositeExprNode( other ) { 590 } 591 592 ValofExprNode::ValofExprNode(StatementNode *s): body(s) {} 593 594 ValofExprNode::ValofExprNode( const ValofExprNode &other ) : ExpressionNode( other ), body( maybeClone( body ) ) { 595 } 596 597 ValofExprNode::~ValofExprNode() { 598 delete body; 599 } 600 601 void ValofExprNode::print( std::ostream &os, int indent ) const { 602 printDesignation(os); 603 os << string(indent, ' ') << "Valof Expression:" << std::endl; 604 get_body()->print(os, indent + 4); 605 } 606 607 void ValofExprNode::printOneLine( std::ostream &, int indent ) const { 608 assert( false ); 609 } 610 611 Expression *ValofExprNode::build() const { 612 return new UntypedValofExpr ( get_body()->build(), maybeBuild< Expression >( get_argName() ) ); 613 } 614 615 ForCtlExprNode::ForCtlExprNode(ParseNode *init_, ExpressionNode *cond, ExpressionNode *incr) throw (SemanticError) : condition(cond), change(incr) { 616 if ( init_ == 0 ) 617 init = 0; 618 else { 619 DeclarationNode *decl; 620 ExpressionNode *exp; 621 622 if ((decl = dynamic_cast<DeclarationNode *>(init_)) != 0) 623 init = new StatementNode(decl); 624 else if ((exp = dynamic_cast<ExpressionNode *>(init_)) != 0) 625 init = new StatementNode(StatementNode::Exp, exp); 500 626 else 501 assert( false ); 502 } 503 504 case OperatorNode::PFieldSel: 505 { 506 assert( args.size() == 2 ); 507 508 NameExpr *member = dynamic_cast<NameExpr *>(args.back()); // modify for Tuples xxx 509 assert( member != 0 ); 510 511 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 512 deref->get_args().push_back( args.front() ); 513 514 UntypedMemberExpr *ret = new UntypedMemberExpr(member->get_name(), deref); 515 delete member; 516 return ret; 517 } 518 519 case OperatorNode::AlignOf: 520 case OperatorNode::SizeOf: 521 { 522 /// bool isSizeOf = (op->get_type() == OperatorNode::SizeOf); 523 524 if( TypeValueNode * arg = dynamic_cast<TypeValueNode *>(get_args()) ) { 525 return new SizeofExpr(arg->get_decl()->buildType()); 526 } else { 527 return new SizeofExpr(args.front()); 528 } 529 } 530 531 case OperatorNode::Attr: 532 { 533 VarRefNode *var = dynamic_cast<VarRefNode *>(get_args()); 534 assert( var ); 535 if( !get_args()->get_link() ) { 536 return new AttrExpr(var->build(), (Expression*)0); 537 } else if( TypeValueNode * arg = dynamic_cast<TypeValueNode *>(get_args()->get_link()) ) { 538 return new AttrExpr(var->build(), arg->get_decl()->buildType()); 539 } else { 540 return new AttrExpr(var->build(), args.back()); 541 } 542 } 543 544 545 case OperatorNode::CompLit: 546 throw UnimplementedError( "C99 compound literals" ); 547 548 // the short-circuited operators 549 case OperatorNode::Or: 550 case OperatorNode::And: 551 assert(args.size() == 2); 552 return new LogicalExpr( notZeroExpr( args.front() ), notZeroExpr( args.back() ), (op->get_type() == OperatorNode::And) ); 553 554 case OperatorNode::Cond: 555 { 556 assert(args.size() == 3); 557 std::list< Expression* >::const_iterator i = args.begin(); 558 Expression *arg1 = notZeroExpr( *i++ ); 559 Expression *arg2 = *i++; 560 Expression *arg3 = *i++; 561 return new ConditionalExpr( arg1, arg2, arg3 ); 562 } 563 564 case OperatorNode::NCond: 565 throw UnimplementedError( "GNU 2-argument conditional expression" ); 566 567 case OperatorNode::Comma: 568 { 569 assert(args.size() == 2); 570 std::list< Expression* >::const_iterator i = args.begin(); 571 Expression *ret = *i++; 572 while( i != args.end() ) { 573 ret = new CommaExpr( ret, *i++ ); 574 } 575 return ret; 576 } 577 578 // Tuples 579 case OperatorNode::TupleC: 580 { 581 TupleExpr *ret = new TupleExpr(); 582 std::copy( args.begin(), args.end(), back_inserter( ret->get_exprs() ) ); 583 return ret; 584 } 585 586 default: 587 // shouldn't happen 588 return 0; 589 } 590 } 591 } 592 593 void CompositeExprNode::printOneLine(std::ostream &os, int indent) const 594 { 595 printDesignation(os); 596 os << "( "; 597 function->printOneLine( os, indent ); 598 for( ExpressionNode *cur = arguments; cur != 0; cur = dynamic_cast< ExpressionNode* >( cur->get_link() ) ) { 599 cur->printOneLine( os, indent ); 600 } 601 os << ") "; 602 } 603 604 void CompositeExprNode::print(std::ostream &os, int indent) const 605 { 606 printDesignation(os); 607 os << '\r' << string(indent, ' ') << "Application of: " << endl; 608 function->print( os, indent + ParseNode::indent_by ); 609 610 os << '\r' << string(indent, ' ') ; 611 if( arguments ) { 612 os << "... on arguments: " << endl; 613 arguments->printList(os, indent + ParseNode::indent_by); 614 } else 615 os << "... on no arguments: " << endl; 616 } 617 618 void CompositeExprNode::set_function(ExpressionNode *f){ 619 function = f; 620 } 621 622 void CompositeExprNode::set_args(ExpressionNode *args){ 623 arguments = args; 624 } 625 626 ExpressionNode *CompositeExprNode::get_function(void) const { 627 return function; 628 } 629 630 ExpressionNode *CompositeExprNode::get_args(void) const { 631 return arguments; 632 } 633 634 void CompositeExprNode::add_arg(ExpressionNode *arg){ 635 if(arguments) 636 arguments->set_link(arg); 637 else 638 set_args(arg); 639 } 640 641 CommaExprNode::CommaExprNode(): CompositeExprNode(new OperatorNode(OperatorNode::Comma)) {} 642 643 CommaExprNode::CommaExprNode(ExpressionNode *exp) 644 : CompositeExprNode( new OperatorNode(OperatorNode::Comma), exp ) 645 { 646 } 647 648 CommaExprNode::CommaExprNode(ExpressionNode *exp1, ExpressionNode *exp2) 649 : CompositeExprNode(new OperatorNode(OperatorNode::Comma), exp1, exp2) 650 { 651 } 652 653 CommaExprNode *CommaExprNode::add_to_list(ExpressionNode *exp){ 654 add_arg(exp); 655 656 return this; 657 } 658 659 CommaExprNode::CommaExprNode( const CommaExprNode &other ) 660 : CompositeExprNode( other ) 661 { 662 } 663 664 ValofExprNode::ValofExprNode(StatementNode *s): body(s) {} 665 666 ValofExprNode::ValofExprNode( const ValofExprNode &other ) 667 : ExpressionNode( other ), body( maybeClone( body ) ) 668 { 669 } 670 671 ValofExprNode::~ValofExprNode() { 672 delete body; 673 } 674 675 void ValofExprNode::print( std::ostream &os, int indent ) const { 676 printDesignation(os); 677 os << string(indent, ' ') << "Valof Expression:" << std::endl; 678 get_body()->print(os, indent + 4); 679 } 680 681 void ValofExprNode::printOneLine( std::ostream &, int indent ) const 682 { 683 assert( false ); 684 } 685 686 Expression *ValofExprNode::build() const { 687 return new UntypedValofExpr ( get_body()->build(), maybeBuild< Expression >( get_argName() ) ); 688 } 689 690 ForCtlExprNode::ForCtlExprNode(ParseNode *init_, ExpressionNode *cond, ExpressionNode *incr) 691 throw (SemanticError) 692 : condition(cond), change(incr) 693 { 694 if(init_ == 0) 695 init = 0; 696 else { 697 DeclarationNode *decl; 698 ExpressionNode *exp; 699 700 if((decl = dynamic_cast<DeclarationNode *>(init_)) != 0) 701 init = new StatementNode(decl); 702 else if((exp = dynamic_cast<ExpressionNode *>(init_)) != 0) 703 init = new StatementNode(StatementNode::Exp, exp); 704 else 705 throw SemanticError("Error in for control expression"); 706 } 627 throw SemanticError("Error in for control expression"); 628 } 707 629 } 708 630 709 631 ForCtlExprNode::ForCtlExprNode( const ForCtlExprNode &other ) 710 : ExpressionNode( other ), init( maybeClone( other.init ) ), condition( maybeClone( other.condition ) ), change( maybeClone( other.change ) ) 711 { 632 : ExpressionNode( other ), init( maybeClone( other.init ) ), condition( maybeClone( other.condition ) ), change( maybeClone( other.change ) ) { 712 633 } 713 634 714 635 ForCtlExprNode::~ForCtlExprNode(){ 715 delete init;716 delete condition;717 delete change;636 delete init; 637 delete condition; 638 delete change; 718 639 } 719 640 720 641 Expression *ForCtlExprNode::build() const { 721 // this shouldn't be used!722 assert( false );723 return 0;642 // this shouldn't be used! 643 assert( false ); 644 return 0; 724 645 } 725 646 726 647 void ForCtlExprNode::print( std::ostream &os, int indent ) const{ 727 os << string(indent,' ') << "For Control Expression -- : " << endl; 728 729 os << "\r" << string(indent + 2,' ') << "initialization: "; 730 if(init != 0) 731 init->print(os, indent + 4); 732 733 os << "\n\r" << string(indent + 2,' ') << "condition: "; 734 if(condition != 0) 735 condition->print(os, indent + 4); 736 os << "\n\r" << string(indent + 2,' ') << "increment: "; 737 if(change != 0) 738 change->print(os, indent + 4); 739 } 740 741 void 742 ForCtlExprNode::printOneLine( std::ostream &, int indent ) const 743 { 744 assert( false ); 648 os << string(indent,' ') << "For Control Expression -- : " << endl; 649 650 os << "\r" << string(indent + 2,' ') << "initialization: "; 651 if (init != 0) 652 init->print(os, indent + 4); 653 654 os << "\n\r" << string(indent + 2,' ') << "condition: "; 655 if (condition != 0) 656 condition->print(os, indent + 4); 657 os << "\n\r" << string(indent + 2,' ') << "increment: "; 658 if (change != 0) 659 change->print(os, indent + 4); 660 } 661 662 void ForCtlExprNode::printOneLine( std::ostream &, int indent ) const { 663 assert( false ); 745 664 } 746 665 747 666 TypeValueNode::TypeValueNode(DeclarationNode *decl) 748 : decl( decl ) 749 { 667 : decl( decl ) { 750 668 } 751 669 752 670 TypeValueNode::TypeValueNode( const TypeValueNode &other ) 753 : ExpressionNode( other ), decl( maybeClone( other.decl ) ) 754 { 755 } 756 757 Expression * 758 TypeValueNode::build() const 759 { 760 return new TypeExpr( decl->buildType() ); 761 } 762 763 void 764 TypeValueNode::print(std::ostream &os, int indent) const 765 { 766 os << std::string( indent, ' ' ) << "Type:"; 767 get_decl()->print(os, indent + 2); 768 } 769 770 void 771 TypeValueNode::printOneLine(std::ostream &os, int indent) const 772 { 773 os << "Type:"; 774 get_decl()->print(os, indent + 2); 775 } 776 777 ExpressionNode *flattenCommas( ExpressionNode *list ) 778 { 779 if( CompositeExprNode *composite = dynamic_cast< CompositeExprNode * >( list ) ) 780 { 781 OperatorNode *op; 782 if ( (op = dynamic_cast< OperatorNode * >( composite->get_function() )) && (op->get_type() == OperatorNode::Comma) ) 783 { 784 if ( ExpressionNode *next = dynamic_cast< ExpressionNode * >( list->get_link() ) ) 785 composite->add_arg( next ); 786 return flattenCommas( composite->get_args() ); 787 } 788 } 789 790 if ( ExpressionNode *next = dynamic_cast< ExpressionNode * >( list->get_link() ) ) 791 list->set_next( flattenCommas( next ) ); 792 793 return list; 794 } 795 796 ExpressionNode *tupleContents( ExpressionNode *tuple ) 797 { 798 if( CompositeExprNode *composite = dynamic_cast< CompositeExprNode * >( tuple ) ) { 799 OperatorNode *op = 0; 800 if ( (op = dynamic_cast< OperatorNode * >( composite->get_function() )) && (op->get_type() == OperatorNode::TupleC) ) 801 return composite->get_args(); 802 } 803 return tuple; 804 } 671 : ExpressionNode( other ), decl( maybeClone( other.decl ) ) { 672 } 673 674 Expression *TypeValueNode::build() const { 675 return new TypeExpr( decl->buildType() ); 676 } 677 678 void TypeValueNode::print(std::ostream &os, int indent) const { 679 os << std::string( indent, ' ' ) << "Type:"; 680 get_decl()->print(os, indent + 2); 681 } 682 683 void TypeValueNode::printOneLine(std::ostream &os, int indent) const { 684 os << "Type:"; 685 get_decl()->print(os, indent + 2); 686 } 687 688 ExpressionNode *flattenCommas( ExpressionNode *list ) { 689 if ( CompositeExprNode *composite = dynamic_cast< CompositeExprNode * >( list ) ) 690 { 691 OperatorNode *op; 692 if ( (op = dynamic_cast< OperatorNode * >( composite->get_function() )) && (op->get_type() == OperatorNode::Comma) ) 693 { 694 if ( ExpressionNode *next = dynamic_cast< ExpressionNode * >( list->get_link() ) ) 695 composite->add_arg( next ); 696 return flattenCommas( composite->get_args() ); 697 } 698 } 699 700 if ( ExpressionNode *next = dynamic_cast< ExpressionNode * >( list->get_link() ) ) 701 list->set_next( flattenCommas( next ) ); 702 703 return list; 704 } 705 706 ExpressionNode *tupleContents( ExpressionNode *tuple ) { 707 if ( CompositeExprNode *composite = dynamic_cast< CompositeExprNode * >( tuple ) ) { 708 OperatorNode *op = 0; 709 if ( (op = dynamic_cast< OperatorNode * >( composite->get_function() )) && (op->get_type() == OperatorNode::TupleC) ) 710 return composite->get_args(); 711 } 712 return tuple; 713 } -
translator/Parser/InitializerNode.cc
r42dcae7 r3848e0e 9 9 10 10 InitializerNode::InitializerNode( ExpressionNode *_expr, bool aggrp, ExpressionNode *des ) 11 : expr( _expr ), aggregate( aggrp ), designator( des ), kids( 0 ) 12 { 13 if ( aggrp ) 14 kids = dynamic_cast< InitializerNode *>( get_link() ); 11 : expr( _expr ), aggregate( aggrp ), designator( des ), kids( 0 ) { 12 if ( aggrp ) 13 kids = dynamic_cast< InitializerNode *>( get_link() ); 15 14 16 if ( kids != 0 )17 15 if ( kids != 0 ) 16 set_link( 0 ); 18 17 } 19 18 20 19 InitializerNode::InitializerNode( InitializerNode *init, bool aggrp, ExpressionNode *des ) 21 : aggregate( aggrp ), designator( des ), kids( 0 ) 22 { 23 if (init != 0) 24 set_link(init); 20 : aggregate( aggrp ), designator( des ), kids( 0 ) { 21 if ( init != 0 ) 22 set_link(init); 25 23 26 if ( aggrp )27 24 if ( aggrp ) 25 kids = dynamic_cast< InitializerNode *>( get_link() ); 28 26 29 if ( kids != 0 )30 27 if ( kids != 0 ) 28 set_next( 0 ); 31 29 } 32 30 33 31 InitializerNode::~InitializerNode() { 34 delete expr;32 delete expr; 35 33 } 36 34 37 35 void InitializerNode::print( std::ostream &os, int indent ) const { 38 os << std::string(indent, ' ') << "Initializer expression" << std::endl;36 os << std::string(indent, ' ') << "Initializer expression" << std::endl; 39 37 } 40 38 41 39 void InitializerNode::printOneLine( std::ostream &os ) const { 42 if (!aggregate) 43 { 44 45 if ( designator != 0 ) 46 { 47 os << "designated by: ("; 48 ExpressionNode *curdes = designator; 49 while( curdes != 0){ 50 curdes->printOneLine(os); 51 curdes = (ExpressionNode *)(curdes->get_link()); 52 if(curdes) os << ", "; 53 } 54 os << ")"; 40 if ( ! aggregate ) { 41 if ( designator != 0 ) { 42 os << "designated by: ("; 43 ExpressionNode *curdes = designator; 44 while( curdes != 0) { 45 curdes->printOneLine(os); 46 curdes = (ExpressionNode *)(curdes->get_link()); 47 if ( curdes ) os << ", "; 48 } 49 os << ")"; 55 50 } 56 57 if (expr) expr->printOneLine(os); 58 } 59 else // It's an aggregate 60 { 61 os << "[--"; 62 if( next_init() != 0 ) 63 next_init()->printOneLine(os); 64 65 if (aggregate) os << "--]"; 51 if ( expr ) expr->printOneLine(os); 52 } else { // It's an aggregate 53 os << "[--"; 54 if ( next_init() != 0 ) 55 next_init()->printOneLine(os); 56 if (aggregate) os << "--]"; 66 57 } 67 58 68 InitializerNode *moreInit;69 if ( get_link() != 0 && ((moreInit = dynamic_cast< InitializerNode * >( get_link() ) ) != 0) )70 59 InitializerNode *moreInit; 60 if ( get_link() != 0 && ((moreInit = dynamic_cast< InitializerNode * >( get_link() ) ) != 0) ) 61 moreInit->printOneLine( os ); 71 62 } 72 63 73 64 Initializer *InitializerNode::build() const { 74 // if ( get_expression() == 0 ) return 0; // XXX (?)65 // if ( get_expression() == 0 ) return 0; // XXX (?) 75 66 76 if ( aggregate ) 77 { 78 assert( next_init() != 0 ); 67 if ( aggregate ) { 68 assert( next_init() != 0 ); 79 69 80 81 70 std::list< Initializer *> initlist; 71 buildList<Initializer, InitializerNode>( next_init(), initlist ); 82 72 83 84 85 buildList<Expression, ExpressionNode>( designator, designlist );73 std::list< Expression *> designlist; 74 if ( designator != 0 ) 75 buildList<Expression, ExpressionNode>( designator, designlist ); 86 76 87 return new ListInit( initlist, designlist ); 88 } 89 else 90 { 91 std::list< Expression *> designators; 77 return new ListInit( initlist, designlist ); 78 } else { 79 std::list< Expression *> designators; 92 80 93 94 buildList<Expression, ExpressionNode>( designator, designators );81 if ( designator != 0 ) 82 buildList<Expression, ExpressionNode>( designator, designators ); 95 83 96 97 return new SingleInit( get_expression()->build(), designators );84 if ( get_expression() != 0) 85 return new SingleInit( get_expression()->build(), designators ); 98 86 } 99 87 100 return 0;88 return 0; 101 89 } 102 103 -
translator/Parser/LinkageSpec.cc
r42dcae7 r3848e0e 1 /*2 * This file is part of the Cforall project3 *4 * $Id: LinkageSpec.cc,v 1.3 2003/01/29 14:55:08 rcbilson Exp $5 *6 */7 8 1 #include <string> 9 2 #include <cassert> … … 12 5 #include "SemanticError.h" 13 6 14 /* static class method */ 15 LinkageSpec::Type 16 LinkageSpec::fromString( const std::string &stringSpec ) 17 { 18 if( stringSpec == "\"Cforall\"" ) { 19 return Cforall; 20 } else if( stringSpec == "\"C\"" ) { 21 return C; 22 } else { 23 throw SemanticError( "Invalid linkage specifier " + stringSpec ); 24 } 7 LinkageSpec::Type LinkageSpec::fromString( const std::string &stringSpec ) { 8 if ( stringSpec == "\"Cforall\"" ) { 9 return Cforall; 10 } else if ( stringSpec == "\"C\"" ) { 11 return C; 12 } else { 13 throw SemanticError( "Invalid linkage specifier " + stringSpec ); 14 } 25 15 } 26 16 27 /* static class method */ 28 std::string 29 LinkageSpec::toString( LinkageSpec::Type linkage ) 30 { 31 switch( linkage ) { 32 case Intrinsic: 33 return "intrinsic"; 34 35 case Cforall: 36 return "Cforall"; 37 38 case C: 39 return "C"; 40 41 case AutoGen: 42 return "automatically generated"; 43 44 case Compiler: 45 return "compiler built-in"; 46 } 47 assert( false ); 48 return ""; 17 std::string LinkageSpec::toString( LinkageSpec::Type linkage ) { 18 switch ( linkage ) { 19 case Intrinsic: 20 return "intrinsic"; 21 case Cforall: 22 return "Cforall"; 23 case C: 24 return "C"; 25 case AutoGen: 26 return "automatically generated"; 27 case Compiler: 28 return "compiler built-in"; 29 } 30 assert( false ); 31 return ""; 49 32 } 50 33 51 /* static class method */ 52 bool 53 LinkageSpec::isDecoratable( Type t ) 54 { 55 switch( t ) { 56 case Intrinsic: 57 case Cforall: 58 case AutoGen: 59 return true; 60 61 case C: 62 case Compiler: 34 bool LinkageSpec::isDecoratable( Type t ) { 35 switch ( t ) { 36 case Intrinsic: 37 case Cforall: 38 case AutoGen: 39 return true; 40 case C: 41 case Compiler: 42 return false; 43 } 44 assert( false ); 63 45 return false; 64 }65 assert( false );66 return false;67 46 } 68 47 69 /* static class method */ 70 bool 71 LinkageSpec::isGeneratable( Type t ) 72 { 73 switch( t ) { 74 case Intrinsic: 75 case Cforall: 76 case AutoGen: 77 case C: 78 return true; 79 80 case Compiler: 48 bool LinkageSpec::isGeneratable( Type t ) { 49 switch ( t ) { 50 case Intrinsic: 51 case Cforall: 52 case AutoGen: 53 case C: 54 return true; 55 case Compiler: 56 return false; 57 } 58 assert( false ); 81 59 return false; 82 }83 assert( false );84 return false;85 60 } 86 61 87 /* static class method */ 88 bool 89 LinkageSpec::isOverloadable( Type t ) 90 { 91 return isDecoratable( t ); 62 bool LinkageSpec::isOverloadable( Type t ) { 63 return isDecoratable( t ); 92 64 } 93 65 94 /* static class method */ 95 bool 96 LinkageSpec::isBuiltin( Type t ) 97 { 98 switch( t ) { 99 case Cforall: 100 case AutoGen: 101 case C: 66 bool LinkageSpec::isBuiltin( Type t ) { 67 switch ( t ) { 68 case Cforall: 69 case AutoGen: 70 case C: 71 return false; 72 case Intrinsic: 73 case Compiler: 74 return true; 75 } 76 assert( false ); 102 77 return false; 103 104 case Intrinsic:105 case Compiler:106 return true;107 }108 assert( false );109 return false;110 78 } 111 -
translator/Parser/LinkageSpec.h
r42dcae7 r3848e0e 1 /*2 * This file is part of the Cforall project3 *4 * $Id: LinkageSpec.h,v 1.3 2003/01/29 14:55:08 rcbilson Exp $5 *6 */7 8 1 #ifndef LINKAGESPEC_H 9 2 #define LINKAGESPEC_H … … 11 4 #include <string> 12 5 13 struct LinkageSpec 14 { 15 enum Type 16 { 17 Intrinsic, // C built-in defined in prelude 18 Cforall, // ordinary 19 C, // not overloadable, not mangled 20 AutoGen, // built by translator (struct assignment) 21 Compiler // gcc internal 22 }; 6 struct LinkageSpec { 7 enum Type { 8 Intrinsic, // C built-in defined in prelude 9 Cforall, // ordinary 10 C, // not overloadable, not mangled 11 AutoGen, // built by translator (struct assignment) 12 Compiler // gcc internal 13 }; 23 14 24 static Type fromString( const std::string& );25 static std::string toString( Type );15 static Type fromString( const std::string & ); 16 static std::string toString( Type ); 26 17 27 static bool isDecoratable( Type );28 static bool isGeneratable( Type );29 static bool isOverloadable( Type );30 static bool isBuiltin( Type );18 static bool isDecoratable( Type ); 19 static bool isGeneratable( Type ); 20 static bool isOverloadable( Type ); 21 static bool isBuiltin( Type ); 31 22 }; 32 23 33 #endif / * #ifndef LINKAGESPEC_H */24 #endif // LINKAGESPEC_H -
translator/Parser/ParseNode.cc
r42dcae7 r3848e0e 1 /* -*- C++ -*- */2 1 #include "ParseNode.h" 3 2 using namespace std; … … 6 5 int ParseNode::indent_by = 4; 7 6 8 ParseNode::ParseNode( void): next( 0 ) {};9 ParseNode::ParseNode (string _name) : name(_name), next( 0 ) {}7 ParseNode::ParseNode( void ) : next( 0 ) {}; 8 ParseNode::ParseNode( string _name ) : name( _name ), next( 0 ) {} 10 9 11 ParseNode *ParseNode::set_name (string _name) { 12 name = _name; 13 14 return this; 10 ParseNode *ParseNode::set_name( string _name ) { 11 name = _name; 12 return this; 15 13 } 16 14 17 ParseNode *ParseNode::set_name (string *_name) {18 name = *_name; // deep copy19 delete _name;15 ParseNode *ParseNode::set_name( string *_name ) { 16 name = *_name; // deep copy 17 delete _name; 20 18 21 return this;19 return this; 22 20 } 23 21 24 ParseNode::~ParseNode( void){25 delete next;22 ParseNode::~ParseNode( void ) { 23 delete next; 26 24 }; 27 25 28 string ParseNode::get_name( void) {29 return name;26 string ParseNode::get_name( void ) { 27 return name; 30 28 } 31 29 32 ParseNode *ParseNode::get_link( void) const {33 return next;30 ParseNode *ParseNode::get_link( void ) const { 31 return next; 34 32 } 35 33 36 34 ParseNode *ParseNode::get_last(void) { 37 ParseNode *current = this;35 ParseNode *current = this; 38 36 39 while(current->get_link() != 0)40 37 while( current->get_link() != 0 ) 38 current = current->get_link(); 41 39 42 return current;40 return current; 43 41 } 44 42 45 43 ParseNode *ParseNode::set_link(ParseNode *_next){ 46 ParseNode *follow;44 ParseNode *follow; 47 45 48 if(_next == 0) return this;46 if ( _next == 0 ) return this; 49 47 50 for(follow = this; follow->next != 0; follow = follow->next);51 follow->next = _next;48 for ( follow = this; follow->next != 0; follow = follow->next ); 49 follow->next = _next; 52 50 53 return this;51 return this; 54 52 } 55 53 56 54 const string ParseNode::get_name(void) const { 57 return name;55 return name; 58 56 } 59 57 60 void ParseNode::print(std::ostream &os, int indent) const 61 { 58 void ParseNode::print(std::ostream &os, int indent) const {} 59 60 61 void ParseNode::printList( std::ostream &os, int indent ) const { 62 print( os, indent ); 63 64 if ( next ) { 65 next->printList( os, indent ); 66 } 62 67 } 63 68 69 ParseNode &ParseNode::operator,( ParseNode &p ) { 70 set_link( &p ); 64 71 65 void ParseNode::printList(std::ostream &os, int indent) const 66 { 67 print( os, indent ); 68 69 if( next ) { 70 next->printList( os, indent ); 71 } 72 } 73 74 ParseNode &ParseNode::operator,(ParseNode &p){ 75 set_link(&p); 76 77 return *this; 72 return *this; 78 73 } 79 74 80 75 ParseNode *mkList(ParseNode &pn){ 81 /* it just relies on `operator,' to take care of the "arguments" and provides 82 a nice interface to an awful-looking address-of, rendering, for example 83 (StatementNode *)(&(*$5 + *$7)) into (StatementNode *)mkList(($5, $7)) 84 (although "nice" is probably not the word) 85 */ 86 87 return &pn; 76 /* it just relies on `operator,' to take care of the "arguments" and provides 77 a nice interface to an awful-looking address-of, rendering, for example 78 (StatementNode *)(&(*$5 + *$7)) into (StatementNode *)mkList(($5, $7)) 79 (although "nice" is probably not the word) 80 */ 81 return &pn; 88 82 } 89 83 -
translator/Parser/cfa.y
r42dcae7 r3848e0e 10 10 * Created On : Sat Sep 1 20:22:55 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Sun Nov 9 22:45:42201413 * Update Count : 8 8112 * Last Modified On : Tue Nov 25 23:52:54 2014 13 * Update Count : 890 14 14 */ 15 15 … … 563 563 | tuple assignment_opt /* CFA, tuple expression */ 564 564 { 565 if ( $2 == 0 ) {565 if ( $2 == 0 ) { 566 566 $$ = $1; 567 567 } else { … … 654 654 block_item 655 655 | block_item_list push block_item 656 { if ($1 != 0) { $1->set_link($3); $$ = $1; } }656 { if ($1 != 0) { $1->set_link($3); $$ = $1; } } 657 657 ; 658 658 … … 668 668 statement 669 669 | statement_list statement 670 { if ($1 != 0) { $1->set_link($2); $$ = $1; } }670 { if ($1 != 0) { $1->set_link($2); $$ = $1; } } 671 671 ; 672 672 … … 1870 1870 | external_definition_list 1871 1871 { 1872 if ( theTree ) {1872 if ( theTree ) { 1873 1873 theTree->appendList( $1 ); 1874 1874 } else { … … 1882 1882 | external_definition_list push external_definition 1883 1883 { 1884 if ( $1 ) {1884 if ( $1 ) { 1885 1885 $$ = $1->appendList( $3 ); 1886 1886 } else { … … 2732 2732 /* ----end of grammar----*/ 2733 2733 2734 void yyerror( char *string) {2734 void yyerror( char *string ) { 2735 2735 using std::cout; 2736 2736 using std::endl; 2737 if( yyfilename ) { 2738 cout << yyfilename << ":" << endl; 2737 cout << "Error "; 2738 if ( yyfilename ) { 2739 cout << "in file " << yyfilename << " "; 2739 2740 } 2740 cout << yylineno << ": syntax error reading token " << *(yylval.tok.str)<< endl;2741 cout << "at line " << yylineno << " reading token \"" << *(yylval.tok.str) << "\"" << endl; 2741 2742 } 2742 2743 -
translator/Parser/lex.l
r42dcae7 r3848e0e 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Tue Nov 11 08:10:05201413 * Update Count : 21512 * Last Modified On : Wed Dec 3 13:37:52 2014 13 * Update Count : 317 14 14 */ 15 15 … … 31 31 32 32 char *yyfilename; 33 std::string *strtext; // accumulate parts of character and string constant value 33 34 34 35 #define WHITE_RETURN(x) // do nothing … … 38 39 yylval.tok.loc.line = yylineno; \ 39 40 return(x) 41 #define RETURN_STR(x) yylval.tok.str = strtext; \ 42 yylval.tok.loc.file = yyfilename; \ 43 yylval.tok.loc.line = yylineno; \ 44 return(x) 40 45 41 46 #define KEYWORD_RETURN(x) RETURN_VAL(x) // keyword … … 49 54 #define NUMERIC_RETURN(x) rm_underscore(); RETURN_VAL(x) // numeric constant 50 55 51 void rm_underscore() { // remove underscores in constant or escape sequence 56 void rm_underscore() { 57 // remove underscores in numeric constant 52 58 int j = 0; 53 for ( int i = 0; i < yyleng; i += 1 ) {59 for ( int i = 0; yytext[i] != '\0'; i += 1 ) { 54 60 if ( yytext[i] != '_' ) { 55 61 yytext[j] = yytext[i]; … … 67 73 decimal [0-9] 68 74 hex [0-9a-fA-F] 69 universal_char "\\"((u {hex_quad})|(U{hex_quad}{2}))75 universal_char "\\"((u"_"?{hex_quad})|(U"_"?{hex_quad}{2})) 70 76 71 77 // identifier, GCC: $ in identifier … … 79 85 80 86 // numeric constants, CFA: '_' in constant 81 hex_quad {hex} {4}87 hex_quad {hex}("_"?{hex}){3} 82 88 integer_suffix "_"?(([uU][lL]?)|([uU]("ll"|"LL")?)|([lL][uU]?)|("ll"|"LL")[uU]?) 83 89 … … 106 112 simple_escape "\\"[abefnrtv'"?\\] 107 113 // ' stop highlighting 108 octal_escape "\\"{octal} {1,3}109 hex_escape "\\""x" {hex}+114 octal_escape "\\"{octal}("_"?{octal}){0,2} 115 hex_escape "\\""x""_"?{hex_digits} 110 116 escape_seq {simple_escape}|{octal_escape}|{hex_escape}|{universal_char} 111 117 … … 129 135 130 136 %x COMMENT 131 %x QUOTED 137 %x BKQUOTE 138 %x QUOTE 139 %x STRING 132 140 133 141 %% … … 141 149 lineno = strtol( yytext + 1, &end_num, 0 ); 142 150 begin_string = strchr( end_num, '"' ); 143 if ( begin_string ) {144 end_string = strchr( begin_string + 1, '"' );145 if( end_string ) {146 147 148 149 150 151 152 153 }151 if ( begin_string ) { 152 end_string = strchr( begin_string + 1, '"' ); 153 if ( end_string ) { 154 length = end_string - begin_string - 1; 155 filename = new char[ length + 1 ]; 156 memcpy( filename, begin_string + 1, length ); 157 filename[ length ] = '\0'; 158 //std::cout << "file " << filename << " line " << lineno << std::endl; 159 yylineno = lineno; 160 yyfilename = filename; 161 } 154 162 } 155 163 } … … 159 167 160 168 /* ignore C style comments */ 161 "/*" { BEGIN COMMENT;}169 "/*" { BEGIN COMMENT; } 162 170 <COMMENT>.|\n ; 163 <COMMENT>"*/" { BEGIN 0;}171 <COMMENT>"*/" { BEGIN 0; } 164 172 165 173 /* ignore C++ style comments */ … … 167 175 168 176 /* ignore whitespace */ 169 {h_white}+ { WHITE_RETURN(' ');}170 ({v_tab}|{c_return}|{form_feed})+ { WHITE_RETURN(' ');}171 ({h_white}|{v_tab}|{c_return}|{form_feed})*"\n" { NEWLINE_RETURN();}177 {h_white}+ { WHITE_RETURN(' '); } 178 ({v_tab}|{c_return}|{form_feed})+ { WHITE_RETURN(' '); } 179 ({h_white}|{v_tab}|{c_return}|{form_feed})*"\n" { NEWLINE_RETURN(); } 172 180 173 181 /* keywords */ 174 __alignof { KEYWORD_RETURN(ALIGNOF);} /* GCC */175 __alignof__ { KEYWORD_RETURN(ALIGNOF);} /* GCC */176 asm { KEYWORD_RETURN(ASM);}177 __asm { KEYWORD_RETURN(ASM);} /* GCC */178 __asm__ { KEYWORD_RETURN(ASM);} /* GCC */179 __attribute { KEYWORD_RETURN(ATTRIBUTE);} /* GCC */180 __attribute__ { KEYWORD_RETURN(ATTRIBUTE);} /* GCC */181 auto { KEYWORD_RETURN(AUTO);}182 _Bool { KEYWORD_RETURN(BOOL);} /* ANSI99 */183 break { KEYWORD_RETURN(BREAK);}184 case { KEYWORD_RETURN(CASE);}185 catch { KEYWORD_RETURN(CATCH);} /* CFA */186 char { KEYWORD_RETURN(CHAR);}187 choose { KEYWORD_RETURN(CHOOSE);} /* CFA */188 _Complex { KEYWORD_RETURN(COMPLEX);} /* ANSI99 */189 __complex { KEYWORD_RETURN(COMPLEX);} /* GCC */190 __complex__ { KEYWORD_RETURN(COMPLEX);} /* GCC */191 const { KEYWORD_RETURN(CONST);}192 __const { KEYWORD_RETURN(CONST);} /* GCC */193 __const__ { KEYWORD_RETURN(CONST);} /* GCC */194 context { KEYWORD_RETURN(CONTEXT);} /* CFA */195 continue { KEYWORD_RETURN(CONTINUE);}196 default { KEYWORD_RETURN(DEFAULT);}197 do { KEYWORD_RETURN(DO);}198 double { KEYWORD_RETURN(DOUBLE);}199 dtype { KEYWORD_RETURN(DTYPE);} /* CFA */200 else { KEYWORD_RETURN(ELSE);}201 enum { KEYWORD_RETURN(ENUM);}202 __extension__ { KEYWORD_RETURN(EXTENSION);} /* GCC */203 extern { KEYWORD_RETURN(EXTERN);}204 fallthru { KEYWORD_RETURN(FALLTHRU);} /* CFA */205 finally { KEYWORD_RETURN(FINALLY);} /* CFA */206 float { KEYWORD_RETURN(FLOAT);}207 for { KEYWORD_RETURN(FOR);}208 forall { KEYWORD_RETURN(FORALL);} /* CFA */209 fortran { KEYWORD_RETURN(FORTRAN);}210 ftype { KEYWORD_RETURN(FTYPE);} /* CFA */211 goto { KEYWORD_RETURN(GOTO);}212 if { KEYWORD_RETURN(IF);}213 _Imaginary { KEYWORD_RETURN(IMAGINARY);} /* ANSI99 */214 __imag { KEYWORD_RETURN(IMAGINARY);} /* GCC */215 __imag__ { KEYWORD_RETURN(IMAGINARY);} /* GCC */216 inline { KEYWORD_RETURN(INLINE);} /* ANSI99 */217 __inline { KEYWORD_RETURN(INLINE);} /* GCC */218 __inline__ { KEYWORD_RETURN(INLINE);} /* GCC */219 int { KEYWORD_RETURN(INT);}220 __label__ { KEYWORD_RETURN(LABEL);} /* GCC */221 long { KEYWORD_RETURN(LONG);}222 lvalue { KEYWORD_RETURN(LVALUE);} /* CFA */223 register { KEYWORD_RETURN(REGISTER);}224 restrict { KEYWORD_RETURN(RESTRICT);} /* ANSI99 */225 __restrict { KEYWORD_RETURN(RESTRICT);} /* GCC */226 __restrict__ { KEYWORD_RETURN(RESTRICT);} /* GCC */227 return { KEYWORD_RETURN(RETURN);}228 short { KEYWORD_RETURN(SHORT);}229 signed { KEYWORD_RETURN(SIGNED);}230 __signed { KEYWORD_RETURN(SIGNED);} /* GCC */231 __signed__ { KEYWORD_RETURN(SIGNED);} /* GCC */232 sizeof { KEYWORD_RETURN(SIZEOF);}233 static { KEYWORD_RETURN(STATIC);}234 struct { KEYWORD_RETURN(STRUCT);}235 switch { KEYWORD_RETURN(SWITCH);}236 throw { KEYWORD_RETURN(THROW);} /* CFA */237 try { KEYWORD_RETURN(TRY);} /* CFA */238 type { KEYWORD_RETURN(TYPE);} /* CFA */239 typedef { KEYWORD_RETURN(TYPEDEF);}240 typeof { KEYWORD_RETURN(TYPEOF);} /* GCC */241 __typeof { KEYWORD_RETURN(TYPEOF);} /* GCC */242 __typeof__ { KEYWORD_RETURN(TYPEOF);} /* GCC */243 union { KEYWORD_RETURN(UNION);}244 unsigned { KEYWORD_RETURN(UNSIGNED);}245 void { KEYWORD_RETURN(VOID);}246 volatile { KEYWORD_RETURN(VOLATILE);}247 __volatile { KEYWORD_RETURN(VOLATILE);} /* GCC */248 __volatile__ { KEYWORD_RETURN(VOLATILE);} /* GCC */249 while { KEYWORD_RETURN(WHILE);}182 __alignof { KEYWORD_RETURN(ALIGNOF); } // GCC 183 __alignof__ { KEYWORD_RETURN(ALIGNOF); } // GCC 184 asm { KEYWORD_RETURN(ASM); } 185 __asm { KEYWORD_RETURN(ASM); } // GCC 186 __asm__ { KEYWORD_RETURN(ASM); } // GCC 187 __attribute { KEYWORD_RETURN(ATTRIBUTE); } // GCC 188 __attribute__ { KEYWORD_RETURN(ATTRIBUTE); } // GCC 189 auto { KEYWORD_RETURN(AUTO); } 190 _Bool { KEYWORD_RETURN(BOOL); } // C99 191 break { KEYWORD_RETURN(BREAK); } 192 case { KEYWORD_RETURN(CASE); } 193 catch { KEYWORD_RETURN(CATCH); } // CFA 194 char { KEYWORD_RETURN(CHAR); } 195 choose { KEYWORD_RETURN(CHOOSE); } // CFA 196 _Complex { KEYWORD_RETURN(COMPLEX); } // C99 197 __complex { KEYWORD_RETURN(COMPLEX); } // GCC 198 __complex__ { KEYWORD_RETURN(COMPLEX); } // GCC 199 const { KEYWORD_RETURN(CONST); } 200 __const { KEYWORD_RETURN(CONST); } // GCC 201 __const__ { KEYWORD_RETURN(CONST); } // GCC 202 context { KEYWORD_RETURN(CONTEXT); } // CFA 203 continue { KEYWORD_RETURN(CONTINUE); } 204 default { KEYWORD_RETURN(DEFAULT); } 205 do { KEYWORD_RETURN(DO); } 206 double { KEYWORD_RETURN(DOUBLE); } 207 dtype { KEYWORD_RETURN(DTYPE); } // CFA 208 else { KEYWORD_RETURN(ELSE); } 209 enum { KEYWORD_RETURN(ENUM); } 210 __extension__ { KEYWORD_RETURN(EXTENSION); } // GCC 211 extern { KEYWORD_RETURN(EXTERN); } 212 fallthru { KEYWORD_RETURN(FALLTHRU); } // CFA 213 finally { KEYWORD_RETURN(FINALLY); } // CFA 214 float { KEYWORD_RETURN(FLOAT); } 215 for { KEYWORD_RETURN(FOR); } 216 forall { KEYWORD_RETURN(FORALL); } // CFA 217 fortran { KEYWORD_RETURN(FORTRAN); } 218 ftype { KEYWORD_RETURN(FTYPE); } // CFA 219 goto { KEYWORD_RETURN(GOTO); } 220 if { KEYWORD_RETURN(IF); } 221 _Imaginary { KEYWORD_RETURN(IMAGINARY); } // C99 222 __imag { KEYWORD_RETURN(IMAGINARY); } // GCC 223 __imag__ { KEYWORD_RETURN(IMAGINARY); } // GCC 224 inline { KEYWORD_RETURN(INLINE); } // C99 225 __inline { KEYWORD_RETURN(INLINE); } // GCC 226 __inline__ { KEYWORD_RETURN(INLINE); } // GCC 227 int { KEYWORD_RETURN(INT); } 228 __label__ { KEYWORD_RETURN(LABEL); } // GCC 229 long { KEYWORD_RETURN(LONG); } 230 lvalue { KEYWORD_RETURN(LVALUE); } // CFA 231 register { KEYWORD_RETURN(REGISTER); } 232 restrict { KEYWORD_RETURN(RESTRICT); } // C99 233 __restrict { KEYWORD_RETURN(RESTRICT); } // GCC 234 __restrict__ { KEYWORD_RETURN(RESTRICT); } // GCC 235 return { KEYWORD_RETURN(RETURN); } 236 short { KEYWORD_RETURN(SHORT); } 237 signed { KEYWORD_RETURN(SIGNED); } 238 __signed { KEYWORD_RETURN(SIGNED); } // GCC 239 __signed__ { KEYWORD_RETURN(SIGNED); } // GCC 240 sizeof { KEYWORD_RETURN(SIZEOF); } 241 static { KEYWORD_RETURN(STATIC); } 242 struct { KEYWORD_RETURN(STRUCT); } 243 switch { KEYWORD_RETURN(SWITCH); } 244 throw { KEYWORD_RETURN(THROW); } // CFA 245 try { KEYWORD_RETURN(TRY); } // CFA 246 type { KEYWORD_RETURN(TYPE); } // CFA 247 typedef { KEYWORD_RETURN(TYPEDEF); } 248 typeof { KEYWORD_RETURN(TYPEOF); } // GCC 249 __typeof { KEYWORD_RETURN(TYPEOF); } // GCC 250 __typeof__ { KEYWORD_RETURN(TYPEOF); } // GCC 251 union { KEYWORD_RETURN(UNION); } 252 unsigned { KEYWORD_RETURN(UNSIGNED); } 253 void { KEYWORD_RETURN(VOID); } 254 volatile { KEYWORD_RETURN(VOLATILE); } 255 __volatile { KEYWORD_RETURN(VOLATILE); } // GCC 256 __volatile__ { KEYWORD_RETURN(VOLATILE); } // GCC 257 while { KEYWORD_RETURN(WHILE); } 250 258 251 259 /* identifier */ 252 {identifier} { IDENTIFIER_RETURN();}253 {attr_identifier} { ATTRIBUTE_RETURN();}254 "`" { BEGIN QUOTED;}255 < QUOTED>{identifier} {IDENTIFIER_RETURN();}256 < QUOTED>"`" {BEGIN 0;}260 {identifier} { IDENTIFIER_RETURN(); } 261 {attr_identifier} { ATTRIBUTE_RETURN(); } 262 "`" { BEGIN BKQUOTE; } 263 <BKQUOTE>{identifier} { IDENTIFIER_RETURN(); } 264 <BKQUOTE>"`" { BEGIN 0; } 257 265 258 266 /* numeric constants */ 259 "0" { NUMERIC_RETURN(ZERO);} /* CFA */260 "1" { NUMERIC_RETURN(ONE);} /* CFA */261 {decimal_constant} { NUMERIC_RETURN(INTEGERconstant);}262 {octal_constant} { NUMERIC_RETURN(INTEGERconstant);}263 {hex_constant} { NUMERIC_RETURN(INTEGERconstant);}264 {floating_constant} { NUMERIC_RETURN(FLOATINGconstant);}265 {hex_floating_constant} { NUMERIC_RETURN(FLOATINGconstant);}267 "0" { NUMERIC_RETURN(ZERO); } // CFA 268 "1" { NUMERIC_RETURN(ONE); } // CFA 269 {decimal_constant} { NUMERIC_RETURN(INTEGERconstant); } 270 {octal_constant} { NUMERIC_RETURN(INTEGERconstant); } 271 {hex_constant} { NUMERIC_RETURN(INTEGERconstant); } 272 {floating_constant} { NUMERIC_RETURN(FLOATINGconstant); } 273 {hex_floating_constant} { NUMERIC_RETURN(FLOATINGconstant); } 266 274 267 275 /* character constant, allows empty value */ 268 "L"?[']([^'\\\n]|{escape_seq})*['] {RETURN_VAL(CHARACTERconstant);} 276 "L"?"_"?['] { BEGIN QUOTE; rm_underscore(); strtext = new std::string; *strtext += std::string( yytext ); } 277 <QUOTE>[^'\\\n]* { *strtext += std::string( yytext ); } 278 <QUOTE>['\n] { BEGIN 0; *strtext += std::string( yytext); RETURN_STR(CHARACTERconstant); } 269 279 /* ' stop highlighting */ 270 280 271 281 /* string constant */ 272 "L"?["]([^"\\\n]|{escape_seq})*["] {RETURN_VAL(STRINGliteral);} 282 "L"?"_"?["] { BEGIN STRING; rm_underscore(); strtext = new std::string; *strtext += std::string( yytext ); } 283 <STRING>[^"\\\n]* { *strtext += std::string( yytext ); } 284 <STRING>["\n] { BEGIN 0; *strtext += std::string( yytext); RETURN_STR(STRINGliteral); } 273 285 /* " stop highlighting */ 274 286 287 <QUOTE,STRING>{escape_seq} { rm_underscore(); *strtext += std::string( yytext ); } 288 <QUOTE,STRING>[\\] { *strtext += std::string( yytext ); } // unknown escape character 289 275 290 /* punctuation */ 276 "[" { ASCIIOP_RETURN();}277 "]" { ASCIIOP_RETURN();}278 "(" { ASCIIOP_RETURN();}279 ")" { ASCIIOP_RETURN();}280 "{" { ASCIIOP_RETURN();}281 "}" { ASCIIOP_RETURN();}282 "," { ASCIIOP_RETURN();} /* also operator */283 ":" { ASCIIOP_RETURN();}284 ";" { ASCIIOP_RETURN();}285 "." { ASCIIOP_RETURN();} /* also operator */286 "..." { NAMEDOP_RETURN(ELLIPSIS);}287 288 /* alternative ANSI99 brackets, "<:" & "<:<:" handled by preprocessor */289 "<:" { RETURN_VAL('[');}290 ":>" { RETURN_VAL(']');}291 "<%" { RETURN_VAL('{');}292 "%>" { RETURN_VAL('}');}291 "[" { ASCIIOP_RETURN(); } 292 "]" { ASCIIOP_RETURN(); } 293 "(" { ASCIIOP_RETURN(); } 294 ")" { ASCIIOP_RETURN(); } 295 "{" { ASCIIOP_RETURN(); } 296 "}" { ASCIIOP_RETURN(); } 297 "," { ASCIIOP_RETURN(); } // also operator 298 ":" { ASCIIOP_RETURN(); } 299 ";"