LANGUAGE
Function
-Ci
None
None
__TRIGRAPHS__
None
If certain tokens are not available on your keyboard, they are replaced with keywords as shown in the following table.
| Bigraph Keyword | Token Replaced | Trigraph Keyword | Token Replaced | Additional Keyword | Token Replaced |
|---|---|---|---|---|---|
| <% | } | ??= | # | and | && |
| %> | } | ??/ | \ | and_eq | &= |
| <: | [ | ??' | ^ | bitand | & |
| :> | ] | ??( | [ | bitor | | |
| %: | # | ??) | ] | compl | ~ |
| %:%: | ## | ??! | | | not | ! |
| ??< | { | or | || | ||
| ??> | } | or_eq | |= | ||
| ??- | ~ | xor | ^ | ||
| xor_eq | ^= | ||||
| not_eq | != |
-Ci
The example in the following listing shows the use of trigraphs, bigraphs, and the additional keywords with the corresponding normal C source.
int Trigraphs(int argc, char * argv??(??)) ??< if (argc<1 ??!??! *argv??(1??)=='??/0') return 0; printf("Hello, %s??/n", argv??(1??)); ??> %:define TEST_NEW_THIS 5 %:define cat(a,b) a%:%:b ??=define arraycheck(a,b,c) a??(i??) ??!??! b??(i??) int i; int cat(a,b); char a<:10:>; char b<:10:>; void Trigraph2(void) <% if (i and ab) <% i and_eq TEST_NEW_THIS; i = i bitand 0x03; i = i bitor 0x8; i = compl i; i = not i; %> else if (ab or i) <% i or_eq 0x5; i = i xor 0x12; i xor_eq 99; %> else if (i not_eq 5) <% cat(a,b) = 5; if (a??(i??) || b[i])<%%> if (arraycheck(a,b,i)) <% i = 0; %> %> %> /* is the same as ... */ int Trigraphs(int argc, char * argv[]) { if (argc<1 || *argv[1]=='\0') return 0; printf("Hello, %s\n", argv[1]); } #define TEST_NEW_THIS 5 #define cat(a,b) a##b #define arraycheck(a,b,c) a[i] || b[i] int i; int cat(a,b); char a[10]; char b[10]; void Trigraph2(void){ if (i && ab) { i &= TEST_NEW_THIS; i = i & 0x03; i = i | 0x8; i = ~i; i = !i; } else if (ab || i) { i |= 0x5; i = i ^ 0x12; i ^= 99; } else if (i != 5) { cat(a,b) = 5; if (a[i] || b[i]){} if (arraycheck(a,b,i)) { i = 0; } } }