Changeset 427854b for libcfa/prelude
- Timestamp:
- Mar 2, 2020, 4:59:27 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- dfa4360
- Parents:
- 37cdd97
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
r37cdd97 r427854b 48 48 void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )); 49 49 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )); 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 } 50 74 51 75 // implicit increment, decrement if += defined, and implicit not if != defined
Note: See TracChangeset
for help on using the changeset viewer.