Changeset 1971 for to-imperative/trunk/trefal
- Timestamp:
- May 15, 2006, 10:20:13 PM (15 years ago)
- Location:
- to-imperative/trunk/trefal/samples
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
to-imperative/trunk/trefal/samples/fib.tpp
r1932 r1971 3 3 #include <refal/StdIO.hh> 4 4 #include <refal/Compare.hh> 5 6 namespace refal7 {8 9 using namespace rfrt;10 11 namespace fib12 {13 5 14 6 tfun int Fib; … … 24 16 static tval Expr _c_3; 25 17 26 tfun int Fib( tval Expr _v_arg1,tout Expr_v_res1){18 tfun int Fib( tval Expr _v_arg1,tout Expr _v_res1){ 27 19 { 28 20 { 29 if ((( Expr&)_v_arg1.get_len () != 1))21 if ((((Expr&)_v_arg1).get_len () != 1)) 30 22 { 31 23 goto _block1__branch1; 32 24 } 33 if (!( Expr&)_c_0.term_eq (_v_arg1, 0))25 if (!((Expr&)_c_0).term_eq (_v_arg1, 0)) 34 26 { 35 27 goto _block1__branch1; … … 40 32 _block1__branch1: {} 41 33 { 42 if ((( Expr&)_v_arg1.get_len () != 1))34 if ((((Expr&)_v_arg1).get_len () != 1)) 43 35 { 44 36 goto _block1__branch2; 45 37 } 46 if (!( Expr&)_c_1.term_eq (_v_arg1, 0))38 if (!((Expr&)_c_1).term_eq (_v_arg1, 0)) 47 39 { 48 40 goto _block1__branch2; … … 52 44 } 53 45 _block1__branch2: {} 54 if ((( Expr&)_v_arg1.get_len () != 1))46 if ((((Expr&)_v_arg1).get_len () != 1)) 55 47 { 56 48 RF_FUNC_ERROR (unexpected_fail); 57 49 } 58 if (!( Expr&)_v_arg1.symbol_at (0))50 if (!((Expr&)_v_arg1).symbol_at (0)) 59 51 { 60 52 RF_FUNC_ERROR (unexpected_fail); … … 64 56 Arithm::_m_( (_vs_1, _c_0), _v__m_1); 65 57 tval Expr _v_Fib1; 66 Fib( _v__m_1, _v_Fib1);58 fib::Fib( _v__m_1, _v_Fib1); 67 59 tval Expr _v__m_2; 68 60 Arithm::_m_( (_vs_1, _c_2), _v__m_2); 69 61 tval Expr _v_Fib2; 70 Fib( _v__m_2, _v_Fib2);62 fib::Fib( _v__m_2, _v_Fib2); 71 63 Arithm::_p_( (_v_Fib1, _v_Fib2), _v_res1); 72 64 } … … 74 66 } 75 67 76 tfun int Main( tout Expr _v_res1){68 tfun int Main( tout Expr _v_res1){ 77 69 tval Expr _v_Fib1; 78 Fib( _c_3, _v_Fib1);79 StdIO::PrintLN( _v_Fib1, /*void*/);70 fib::Fib( _c_3, _v_Fib1); 71 StdIO::PrintLN( _v_Fib1, ); 80 72 _v_res1 = empty; 81 73 } 82 83 }84 85 namespace fib86 {87 74 88 75 static void init_ () … … 93 80 _c_3 = Expr::create<Integer>("28"); 94 81 } 95 96 static AtStart init_registrator_ (&init_);97 98 }99 100 rfrt::Entry rf_entry (fib::Main);101 102 } -
to-imperative/trunk/trefal/samples/read.tpp
r1932 r1971 2 2 #include <refal/StdIO.hh> 3 3 4 namespace refal5 {6 7 using namespace rfrt;8 9 namespace read10 {11 12 4 tfun int Main; 13 5 14 tfun int Main( tout Expr _v_res1){6 tfun int Main( tout Expr _v_res1){ 15 7 tval Expr _v_Read1; 16 if (!StdIO::Read( /*void*/,_v_Read1))8 if (!StdIO::Read(_v_Read1)) 17 9 { 18 10 RF_FUNC_ERROR (unexpected_fail); 19 11 } 20 StdIO::PrintLN( _v_Read1, /*void*/);12 StdIO::PrintLN(_v_Read1); 21 13 _v_res1 = empty; 22 14 } 23 24 }25 26 rfrt::Entry rf_entry (read::Main);27 28 }
Note: See TracChangeset
for help on using the changeset viewer.