00001 /*-------------------------------------------------------------------------------- 00002 * / 00003 * / apeNEXT iso646 for nlcc 00004 * / 00005 * / $Id: iso646.h,v 1.16 2005/06/08 14:06:53 pleiter Exp $ 00006 * / 00007 * / ISO/IEC 9899:1999 (E) Standard 00008 * / #include <iso646.h> 00009 * / 00010 * / IMPLEMENTATION for APEnext: implem (iso646.h) 00011 * /------------------------------------------------------------------------------*/ 00012 00013 /*--------------------------------------------------------------------------------- 00014 * / NAME 00015 * / iso646.h - for programming in ISO 646 variant character sets 00016 * / (alternative spellings) 00017 * / 00018 * / SYNOPSIS 00019 * / #include <iso646.h> 00020 * / 00021 * / DESCRIPTION 00022 * / The <iso646.h> header defines the following eleven macros: 00023 * / and && boolean 00024 * / and_eq &= bit wise 00025 * / bitand & bit wise 00026 * / bitor | bit wise 00027 * / compl ~ bit wise 00028 * / not ! boolean 00029 * / not_eq != bit wise 00030 * / or || boolean 00031 * / or_eq |= bit wise 00032 * / xor ^ bit wise 00033 * / xor_eq ^= bit wise 00034 * / 00035 * / RETURN VALUE 00036 * / 00037 * / Notes 00038 * / 00039 /*------------------------------------------------------------------------------*/ 00040 00041 #ifndef _ISO646_H_ 00042 #define _ISO646_H_ 00043 00044 #include <nlibc.h> 00045 00046 /*-------------------------------------------------------------------------------- 00047 * / NAME 00048 * / and - logic and '&&' operation 00049 * / 00050 * / SYNOPSIS 00051 * / #include <iso646.h> 00052 * / 00053 * / boolean operand1 and (&&) boolean operand2 00054 * / 00055 * / DESCRIPTION 00056 * / With this operator a logic and-operation will be proceeded. 00057 * / The logic operation goes from left to right. If the operand1 00058 * / is false, operand2 will be ignored for the further proceeding. 00059 * / 00060 * / RETURN VALUE 00061 * / True (non-zero) value will be returned if both operands are true. 00062 * / Otherwise false 00063 * / 00064 * / Notes 00065 * / Following table gives the pissible combinations with logic and: 00066 * / Operand1 Operand2 Resutls 00067 * / true true true 00068 * / true false false 00069 * / false true false 00070 * / false false false 00071 * / 00072 * / IMPLEMENTATION for APEnext: implem (and) 00073 /*-------------------------------------------------------------------------------*/ 00074 #define and && 00075 00076 /*-------------------------------------------------------------------------------- 00077 * / NAME 00078 * / and_eq - Bitand '&' and assignment '=' operation 00079 * / 00080 * / SYNOPSIS 00081 * / #include <iso646.h> 00082 * / 00083 * / int operand1 and_eq (&=) int operand2 00084 * / 00085 * / DESCRIPTION 00086 * / bit_eq operation is used with int operand1 and int operand2, 00087 * / which are allowed to have any number of digits and will be 00088 * / compared bitwisely. The resulting bit is set 1 if the 00089 * / corresponding bits in both operands are 1. The bits is 0 00090 * / in other cases. The result is assigned to operand1 00091 * / 00092 * / RETURN VALUE 00093 * / The result of '&=' operation will be assigned to operand1 00094 * / 00095 * / Notes 00096 * / Can be used in order to delete/mask certain bits from two operands 00097 * / as follows: 00098 * / 0110 0001 00099 * / & 1101 1111 00100 * / ----------- 00101 * / 0100 0001 00102 * / Then the resulting bits-combinations will be assigned to operand1 00103 * / 00104 * / IMPLEMENTATION for APEnext: implem (and_eq) 00105 /*-------------------------------------------------------------------------------*/ 00106 #define and_eq &= 00107 00108 /*-------------------------------------------------------------------------------- 00109 * / NAME 00110 * / bitand - Bitand '&' operation 00111 * / 00112 * / SYNOPSIS 00113 * / #include <iso646.h> 00114 * / 00115 * / int int operand1 bitand (&) int operand2 00116 * / 00117 * / DESCRIPTION 00118 * / bitand operation used with operand1 and operand2, 00119 * / which are allowed to have any number of digits. 00120 * / The operand1 and operand2 will be compared bitwisely. 00121 * / The bit of the results is considered only if 00122 * / the corresponding bits in both operands are considered. 00123 * / 00124 * / RETURN VALUE 00125 * / 00126 * / Notes 00127 * / It can be used in order to delete/mask certain bits from operands 00128 * / as follows: 00129 * / 0110 0001 00130 * / & 1101 1111 00131 * / ----------- 00132 * / 0100 0001 00133 * / 00134 * / IMPLEMENTATION for APEnext: implem (bitand) 00135 /*----------------------------------------------------------------------------*/ 00136 #define bitand & 00137 00138 /*------------------------------------------------------------------------------ 00139 * / NAME 00140 * / bitor - Bitor '|' operation 00141 * / 00142 * / SYNOPSIS 00143 * / #include <iso646.h> 00144 * / 00145 * / int int operand1 bitor (|) int operand2 00146 * / 00147 * / DESCRIPTION 00148 * / bitor operation is used with int operand1 and int operand2, 00149 * / which are allowed to have any number of digits. 00150 * / The two operands will be compared bitwisely. The bit of the 00151 * / results is considered if the least the corresponding bit in one 00152 * / operand is considered. 00153 * / 00154 * / RETURN VALUE 00155 * / 00156 * / Notes 00157 * / It can be used in order to set certain bin in one operand. 00158 * / As in the above example, we can set certain bit 00159 * / in A in oder to get the letter a. 00160 * / 0100 0001 00161 * / | 0010 0000 00162 * / ----------- 00163 * / 0110 0001 00164 * / 00165 * / IMPLEMENTATION for APEnext: implem (bitor) 00166 /*------------------------------------------------------------------------------*/ 00167 #define bitor | 00168 00169 /*------------------------------------------------------------------------------- 00170 * / NAME 00171 * / compl - Bitwise complement '~' operation 00172 * / 00173 * / SYNOPSIS 00174 * / #include <iso646.h> 00175 * / 00176 * / compl (~) int operand 00177 * / 00178 * / DESCRIPTION 00179 * / The bitwise complement operand is used to flipp all bits of an 00180 * / int operand, which is as known allowed to have any number of digits. 00181 * / 00182 * / RETURN VALUE 00183 * / 00184 * / Notes 00185 * / It can be used in order to change all bits of operand as follows: 00186 * / ~ 0010 1000 00187 * / ----------- 00188 * / 1101 0111 00189 * / 00190 * / IMPLEMENTATION for APEnext: implem (compl) 00191 /*--------------------------------------------------------------------------------*/ 00192 #define compl ~ 00193 00194 00195 /*-------------------------------------------------------------------------------- 00196 * / NAME 00197 * / not - logicl not '!' operation 00198 * / 00199 * / SYNOPSIS 00200 * / #include <iso646.h> 00201 * / 00202 * / boolean not (!) boolean operand 00203 * / 00204 * / DESCRIPTION 00205 * / With this operator a logical not '!' 00206 * / operation will be proceeded, so that the 00207 * / logic value of operand will be modified into the other one. 00208 * / 00209 * / RETURN VALUE 00210 * / True (non-zero) if the operand was false (zero). 00211 * / If it was true (non-zero) the returned value is false (zero) 00212 * / 00213 * / Notes 00214 * / The logic value will be flipped 00215 * / 00216 * / IMPLEMENTATION for APEnext: implem (not) 00217 /*-------------------------------------------------------------------------------*/ 00218 #define not ! 00219 00220 /*-------------------------------------------------------------------------------- 00221 * / NAME 00222 * / not_eq - not equal '!=' operation 00223 * / 00224 * / SYNOPSIS 00225 * / #include <iso646.h> 00226 * / 00227 * / boolean int operand1 not_eq (!=) int operand2 00228 * / 00229 * / DESCRIPTION 00230 * / With this operation a logic not_eq will be proceeded. The operands 00231 * / are compared bitwise. If they are not equal the result is true, 00232 * / false otherwise. 00233 * / 00234 * / RETURN VALUE 00235 * / True (non-zero) if the two operands are not equal, 00236 * / otherwise false (zero). 00237 * / 00238 * / Notes 00239 * / There no assignment operation here 00240 * / 00241 * / IMPLEMENTATION for APEnext: implem (not_eq) 00242 /*-------------------------------------------------------------------------------*/ 00243 #define not_eq != 00244 00245 /*-------------------------------------------------------------------------------- 00246 * / NAME 00247 * / or - logic or '||' operation 00248 * / 00249 * / SYNOPSIS 00250 * / #include <iso646.h> 00251 * / 00252 * / boolean operand1 or (||) boolean operand2 00253 * / 00254 * / DESCRIPTION 00255 * / With this operation a logic or '||' will be proceeded. 00256 * / 00257 * / RETURN VALUE 00258 * / True (non-zero) value will be returnd if at leat one operand is true. 00259 * / Otherwise false (zero) 00260 * / 00261 * / Notes 00262 * / Following table gives the possible combinations with logic or: 00263 * / Operand1 Operand2 Results 00264 * / true true true 00265 * / true false true 00266 * / false true true 00267 * / false false false 00268 * / 00269 * / IMPLEMENTATION for APEnext: implem (or) 00270 /*-------------------------------------------------------------------------------*/ 00271 #define or || 00272 00273 /*-------------------------------------------------------------------------------- 00274 * / NAME 00275 * / or_eq - assignment or_eq '|=' operation 00276 * / 00277 * / SYNOPSIS 00278 * / #include <iso646.h> 00279 * / 00280 * / int operand1 or_eq (|=) int operand2 00281 * / 00282 * / DESCRIPTION 00283 * / With this operation an assignment or_eq will be proceeded. 00284 * / First a bitor (|) operation: operand1 and operand2 will 00285 * / be compared bitwise. The bits of the result are set to 1 00286 * / if at least the corresponding bits in one of the operands are 1. 00287 * / Second the resulting bits will be assigned to operand1 00288 * / 00289 * / RETURN VALUE 00290 * / The result of the '|' operation will be assigned to the operand1 00291 * / 00292 * / Notes 00293 * / Following table gives an examle for '|' operation: 00294 * / 0100 0001 00295 * / | 0010 0000 00296 * / ----------- 00297 * / 0110 0001 00298 * / 00299 * / IMPLEMENTATION for APEnext: implem (or_eq) 00300 /*-------------------------------------------------------------------------------*/ 00301 #define or_eq |= 00302 00303 00304 /*-------------------------------------------------------------------------------- 00305 * / NAME 00306 * / xor - Exclusive bitor operation 00307 * / 00308 * / SYNOPSIS 00309 * / #include <iso646.h> 00310 * / 00311 * / int operand1 xor (^) int operand 00312 * / 00313 * / DESCRIPTION 00314 * / The exclusive bitor '^' operation is used in order to compare 00315 * / the bits of operand1 00316 * / and operand2, which are allowed to have any number of digits. 00317 * / The bit is considered if the least the corresponding bit in one 00318 * / operand (but not in both operands) is considered. 00319 * / 00320 * / RETURN VALUE 00321 * / None 00322 * / 00323 * / Notes 00324 * / For example: 00325 * / 0001 1001 00326 * / ^ 0000 1100 00327 * / ----------- 00328 * / 0001 0101 00329 * / 00330 * / IMPLEMENTATION for APEnext: implem (xor) 00331 /*-------------------------------------------------------------------------------*/ 00332 #define xor ^ 00333 00334 00335 /*-------------------------------------------------------------------------------- 00336 * / NAME 00337 * / xor_eq - Exclusive bitor and assignment '^=' operations 00338 * / 00339 * / SYNOPSIS 00340 * / #include <iso646.h> 00341 * / 00342 * / int operand1 xor_eq (^=) int operand2 00343 * / 00344 * / DESCRIPTION 00345 * / The exclusive bitor operation is used in order to 00346 * / compare the bits of operand1 00347 * / and operand2, which are allowed to have any number of digits. 00348 * / The bit is considered if the least the corresponding bit in one 00349 * / operand (but not in both operands) is considered. 00350 * / The resulting bits are to be assigned to operand1 00351 * / 00352 * / RETURN VALUE 00353 * / The results will be assigned to operand1 00354 * / 00355 * / Notes 00356 * / For example ^-operation: 00357 * / 0001 1001 00358 * / ^ 0000 1100 00359 * / ----------- 00360 * / 0001 0101 00361 * / 00362 * / IMPLEMENTATION for APEnext: implem (xor_eq) 00363 /*-------------------------------------------------------------------------------*/ 00364 #define xor_eq ^= 00365 00366 00367 #endif /* _ISO646_H_ */ 00368 00369 /* @AT*/ 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382