Changeset 01f78e0 for doc/theses/andrew_beach_MMath/code
- Timestamp:
- Aug 30, 2021, 9:01:51 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
- Children:
- 2a3f0d9
- Parents:
- 9cb6514
- Location:
- doc/theses/andrew_beach_MMath/code
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/resume-fixup-empty-f.cfa
r9cb6514 r01f78e0 4 4 #include <stdlib.hfa> // strto 5 5 6 voidnounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) {6 int nounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) { 7 7 if (frames) { 8 nounwind_fixup(frames - 1, raised_rtn); 8 int rtn = nounwind_fixup(frames - 1, raised_rtn); 9 if ( rtn == 42 ) printf( "42" ); // make non-tail recursive 10 return rtn; 11 9 12 } else { 10 13 int fixup = 17; 11 14 raised_rtn(fixup); 15 return fixup; 12 16 } 13 17 } … … 25 29 void raised(int & fixup) { 26 30 fixup = total_frames + 42; // use local scope => lexical link 31 if ( total_frames == 42 ) printf( "42" ); 27 32 } 28 33 -
doc/theses/andrew_beach_MMath/code/resume-fixup-empty-r.cfa
r9cb6514 r01f78e0 10 10 vtable(fixup_exception) fixup_vt; 11 11 12 voidnounwind_empty(unsigned int frames) {12 int nounwind_empty(unsigned int frames) { 13 13 if (frames) { 14 nounwind_empty(frames - 1); 14 int rtn = nounwind_empty(frames - 1); 15 if ( rtn == 42 ) printf( "42" ); // make non-tail recursive 16 return rtn; 15 17 } else { 16 18 int fixup = 17; 17 19 throwResume (fixup_exception){&fixup_vt, fixup}; // change bad fixup 20 return fixup; 18 21 } 19 22 }
Note: See TracChangeset
for help on using the changeset viewer.