Changes in libcfa/prelude/builtins.c [0d8266c:427854b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
r0d8266c r427854b 10 10 // Created On : Fri Jul 21 16:21:03 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jun 25 18:06:52201913 // Update Count : 9712 // Last Modified On : Thu Nov 21 16:31:39 2019 13 // Update Count : 101 14 14 // 15 15 … … 49 49 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )); 50 50 51 forall(dtype T) 52 static inline T & identity(T & i) { 53 return i; 54 } 55 56 // generator support 57 struct $generator { 58 inline int; 59 }; 60 61 static inline void ?{}($generator & this) { ((int&)this) = 0; } 62 static inline void ^?{}($generator &) {} 63 64 trait is_generator(dtype T) { 65 void main(T & this); 66 $generator * get_generator(T & this); 67 }; 68 69 forall(dtype T | is_generator(T)) 70 static inline T & resume(T & gen) { 71 main(gen); 72 return gen; 73 } 74 51 75 // implicit increment, decrement if += defined, and implicit not if != defined 52 76 … … 69 93 70 94 // universal typed pointer constant 71 // Compiler issue: there is a problem with anonymous types that do not have a size. 72 static inline forall( dtype DT | sized(DT) ) DT * intptr( uintptr_t addr ) { return (DT *)addr; } 95 static inline forall( dtype DT ) DT * intptr( uintptr_t addr ) { return (DT *)addr; } 73 96 74 97 // exponentiation operator implementation
Note:
See TracChangeset
for help on using the changeset viewer.