Changeset 77bc259
- Timestamp:
- Feb 12, 2024, 1:07:26 PM (14 months ago)
- Branches:
- master
- Children:
- c185ca9
- Parents:
- 6b228cae
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified libcfa/src/Exception.hfa ¶
r6b228cae r77bc259 2 2 3 3 // TEMPORARY 4 #define ExceptionDecl( name, fields... ) exception name{ fields }; __attribute__(( cfa_linkonce )) vtable( name ) name ## _vt 5 #define ExceptionInst( name, values... ) (name){ &name ## _vt, values } 4 #define ExceptionDecl( name, fields... ) exception name{ fields }; \ 5 __attribute__(( cfa_linkonce )) vtable( name ) name ## _vt 6 #define ExceptionArgs( name, args... ) &name ## _vt, args 7 #define ExceptionInst( name, args... ) (name){ ExceptionArgs( name, args ) } -
TabularUnified libcfa/src/fstream.cfa ¶
r6b228cae r77bc259 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 1 18:32:15 202413 // Update Count : 5 7512 // Last Modified On : Sun Feb 11 20:55:45 2024 13 // Update Count : 580 14 14 // 15 15 … … 321 321 322 322 323 static vtable(open_failure) open_failure_vt;324 325 323 // exception I/O constructors 326 324 void ?{}( open_failure & ex, ofstream & ostream ) with( ex ) { … … 337 335 338 336 339 static vtable(close_failure) close_failure_vt;340 341 337 // exception I/O constructors 342 338 void ?{}( close_failure & ex, ofstream & ostream ) with( ex ) { … … 353 349 354 350 355 static vtable(write_failure) write_failure_vt;356 357 351 // exception I/O constructors 358 352 void ?{}( write_failure & ex, ofstream & ostream ) with( ex ) { … … 369 363 370 364 371 static vtable(read_failure) read_failure_vt;372 373 365 // exception I/O constructors 374 366 void ?{}( read_failure & ex, ofstream & ostream ) with( ex ) { -
TabularUnified libcfa/src/fstream.hfa ¶
r6b228cae r77bc259 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Oct 18 20:30:12 202313 // Update Count : 2 6112 // Last Modified On : Sun Feb 11 20:35:00 2024 13 // Update Count : 274 14 14 // 15 15 … … 139 139 140 140 141 exception open_failure { 141 ExceptionDecl( open_failure, 142 142 union { 143 143 ofstream * ostream; … … 146 146 // TEMPORARY: need polymorphic exceptions 147 147 int tag; // 1 => ostream; 0 => istream 148 };148 ); 149 149 150 150 void ?{}( open_failure & this, ofstream & ); 151 151 void ?{}( open_failure & this, ifstream & ); 152 152 153 exception close_failure { 153 ExceptionDecl( close_failure, 154 154 union { 155 155 ofstream * ostream; … … 158 158 // TEMPORARY: need polymorphic exceptions 159 159 int tag; // 1 => ostream; 0 => istream 160 };160 ); 161 161 162 162 void ?{}( close_failure & this, ofstream & ); 163 163 void ?{}( close_failure & this, ifstream & ); 164 164 165 exception write_failure { 165 ExceptionDecl( write_failure, 166 166 union { 167 167 ofstream * ostream; … … 170 170 // TEMPORARY: need polymorphic exceptions 171 171 int tag; // 1 => ostream; 0 => istream 172 };172 ); 173 173 174 174 void ?{}( write_failure & this, ofstream & ); 175 175 void ?{}( write_failure & this, ifstream & ); 176 176 177 exception read_failure { 177 ExceptionDecl( read_failure, 178 178 union { 179 179 ofstream * ostream; … … 182 182 // TEMPORARY: need polymorphic exceptions 183 183 int tag; // 1 => ostream; 0 => istream 184 };184 ); 185 185 186 186 void ?{}( read_failure & this, ofstream & ); -
TabularUnified tests/exceptions/pingpong_nonlocal.cfa ¶
r6b228cae r77bc259 2 2 #include <thread.hfa> 3 3 #include <mutex_stmt.hfa> 4 #include <Exception.hfa> 4 5 5 exception num_ping_pongs { int num; }; 6 vtable(num_ping_pongs) num_ping_pongs_vt; 6 ExceptionDecl( num_ping_pongs, int num; ); 7 7 8 8 thread Ping_Pong { … … 16 16 this.name = name; 17 17 cnt = 0; 18 ?{}( except, &num_ping_pongs_vt, 0);18 ?{}( except, ExceptionArgs( num_ping_pongs, 0 ) ); 19 19 } 20 20 … … 29 29 for () { 30 30 while( ! poll( this ) ) { yield(); } 31 31 inc_resume_at( cnt ); 32 32 } 33 33 } catchResume( num_ping_pongs * e; e->num < numtimes ) { … … 37 37 mutex( sout ) sout | name | "catch" | cnt | e->num; 38 38 if ( e->num == numtimes ) { 39 39 inc_resume_at( e->num ); 40 40 } 41 41 } … … 49 49 &ping.partner = &pong; // create cycle 50 50 &pong.partner = &ping; 51 num_ping_pongs except{ &num_ping_pongs_vt, 0 }; 52 resumeAt( pong, except ); 51 resumeAt( pong, ExceptionInst( num_ping_pongs, 0 ) ); 53 52 } 54 53 sout | "main end";
Note: See TracChangeset
for help on using the changeset viewer.