Changeset eaace25
- Timestamp:
- Jul 7, 2017, 12:26:31 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 67f2170
- Parents:
- 3873b5a1 (diff), 7c03d6d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/LinkageSpec.cc
r3873b5a1 reaace25 10 10 // Created On : Sat May 16 13:22:09 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 11:51:00 201713 // Update Count : 2 412 // Last Modified On : Fri Jul 7 11:11:00 2017 13 // Update Count : 25 14 14 // 15 15 … … 22 22 #include "Common/SemanticError.h" 23 23 24 LinkageSpec::Spec LinkageSpec::linkageCheck( const string * spec ) { 24 namespace LinkageSpec { 25 26 Spec linkageCheck( const string * spec ) { 27 assert( spec ); 25 28 unique_ptr<const string> guard( spec ); // allocated by lexer 26 29 if ( *spec == "\"Cforall\"" ) { … … 35 38 } 36 39 37 string LinkageSpec::linkageName( LinkageSpec::Spec linkage ) { 38 assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs ); 39 static const char *linkageKinds[LinkageSpec::NoOfSpecs] = { 40 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", "cfa built-in", "c built-in", 41 }; 42 return linkageKinds[linkage]; 40 Spec linkageUpdate( Spec old_spec, const string * cmd ) { 41 assert( cmd ); 42 unique_ptr<const string> guard( cmd ); // allocated by lexer 43 if ( *cmd == "\"Cforall\"" ) { 44 old_spec.is_mangled = true; 45 return old_spec; 46 } else if ( *cmd == "\"C\"" ) { 47 old_spec.is_mangled = false; 48 return old_spec; 49 } else { 50 throw SemanticError( "Invalid linkage specifier " + *cmd ); 51 } // if 43 52 } 44 53 45 bool LinkageSpec::isMangled( Spec spec ) { 46 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs ); 47 static bool decoratable[LinkageSpec::NoOfSpecs] = { 48 // Intrinsic, Cforall, C, AutoGen, Compiler, 49 true, true, false, true, false, 50 // Builtin, BuiltinC, 51 true, false, 52 }; 53 return decoratable[spec]; 54 std::string linkageName( Spec linkage ) { 55 switch ( linkage ) { 56 case Intrinsic: 57 return "intrinsic"; 58 case C: 59 return "C"; 60 case Cforall: 61 return "Cforall"; 62 case AutoGen: 63 return "autogenerated cfa"; 64 case Compiler: 65 return "compiler built-in"; 66 case BuiltinCFA: 67 return "cfa built-in"; 68 case BuiltinC: 69 return "c built-in"; 70 default: 71 return "<unnamed linkage spec>"; 72 } 54 73 } 55 74 56 bool LinkageSpec::isGeneratable( Spec spec ) { 57 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs ); 58 static bool generatable[LinkageSpec::NoOfSpecs] = { 59 // Intrinsic, Cforall, C, AutoGen, Compiler, 60 true, true, true, true, false, 61 // Builtin, BuiltinC, 62 true, true, 63 }; 64 return generatable[spec]; 65 } 66 67 bool LinkageSpec::isOverridable( Spec spec ) { 68 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs ); 69 static bool overridable[LinkageSpec::NoOfSpecs] = { 70 // Intrinsic, Cforall, C, AutoGen, Compiler, 71 true, false, false, true, false, 72 // Builtin, BuiltinC, 73 false, false, 74 }; 75 return overridable[spec]; 76 } 77 78 bool LinkageSpec::isBuiltin( Spec spec ) { 79 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs ); 80 static bool builtin[LinkageSpec::NoOfSpecs] = { 81 // Intrinsic, Cforall, C, AutoGen, Compiler, 82 true, false, false, false, true, 83 // Builtin, BuiltinC, 84 true, true, 85 }; 86 return builtin[spec]; 87 } 75 } // LinkageSpec 88 76 89 77 // Local Variables: // -
src/Parser/LinkageSpec.h
r3873b5a1 reaace25 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LinkageSpec.h -- 7 // LinkageSpec.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:24:28 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 11:50:00 201713 // Update Count : 1 212 // Last Modified On : Fri Jul 7 11:03:00 2017 13 // Update Count : 13 14 14 // 15 15 … … 19 19 #include <string> 20 20 21 struct LinkageSpec { 22 enum Spec { 23 Intrinsic, // C built-in defined in prelude 24 Cforall, // ordinary 25 C, // not overloadable, not mangled 26 AutoGen, // built by translator (struct assignment) 27 Compiler, // gcc internal 28 Builtin, // mangled builtins 29 BuiltinC, // non-mangled builtins 30 NoOfSpecs 21 namespace LinkageSpec { 22 // All linkage specs are some combination of these flags: 23 enum { 24 Mangle = 1 << 0, 25 Generate = 1 << 1, 26 Overrideable = 1 << 2, 27 Builtin = 1 << 3, 28 29 NoOfSpecs = 1 << 4, 31 30 }; 32 33 static Spec linkageCheck( const std::string * ); 34 static std::string linkageName( Spec ); 35 36 static bool isMangled( Spec ); 37 static bool isGeneratable( Spec ); 38 static bool isOverridable( Spec ); 39 static bool isBuiltin( Spec ); 31 32 union Spec { 33 unsigned int val; 34 struct { 35 bool is_mangled : 1; 36 bool is_generatable : 1; 37 bool is_overridable : 1; 38 bool is_builtin : 1; 39 }; 40 constexpr Spec( unsigned int val ) : val( val ) {} 41 constexpr Spec( Spec const &other ) : val( other.val ) {} 42 // Operators may go here. 43 // Supports == and != 44 constexpr operator unsigned int () const { return val; } 45 }; 46 47 48 Spec linkageCheck( const std::string * ); 49 // Returns the Spec with the given name (limited to C, Cforall & BuiltinC) 50 Spec linkageUpdate( Spec old_spec, const std::string * cmd ); 51 /* If cmd = "C" returns a Spec that is old_spec with is_mangled = false 52 * If cmd = "Cforall" returns old_spec Spec with is_mangled = true 53 */ 54 55 std::string linkageName( Spec ); 56 57 // To Update: LinkageSpec::isXyz( cur_spec ) -> cur_spec.is_xyz 58 inline bool isMangled( Spec spec ) { return spec.is_mangled; } 59 inline bool isGeneratable( Spec spec ) { return spec.is_generatable; } 60 inline bool isOverridable( Spec spec ) { return spec.is_overridable; } 61 inline bool isBuiltin( Spec spec ) { return spec.is_builtin; } 62 63 // Pre-defined flag combinations: 64 // C built-in defined in prelude 65 constexpr Spec const Intrinsic = { Mangle | Generate | Overrideable | Builtin }; 66 // ordinary 67 constexpr Spec const Cforall = { Mangle | Generate }; 68 // not overloadable, not mangled 69 constexpr Spec const C = { Generate }; 70 // built by translator (struct assignment) 71 constexpr Spec const AutoGen = { Mangle | Generate | Overrideable }; 72 // gcc internal 73 constexpr Spec const Compiler = { Builtin }; 74 // mangled builtins 75 constexpr Spec const BuiltinCFA = { Mangle | Generate | Builtin }; 76 // non-mangled builtins 77 constexpr Spec const BuiltinC = { Generate | Builtin }; 40 78 }; 41 79 -
src/libcfa/concurrency/CtxSwitch-i386.S
r3873b5a1 reaace25 98 98 ret 99 99 100 .text101 .align 2102 .globl CtxGet103 CtxGet:104 movl %esp,SP_OFFSET(%eax)105 movl %ebp,FP_OFFSET(%eax)106 107 ret108 109 100 // Local Variables: // 110 101 // compile-command: "make install" // -
src/libcfa/concurrency/CtxSwitch-x86_64.S
r3873b5a1 reaace25 1 // -*- Mode: Asm -*- 1 // -*- Mode: Asm -*- 2 2 // 3 3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 18 18 // Free Software Foundation; either version 2.1 of the License, or (at your 19 19 // option) any later version. 20 // 20 // 21 21 // This library is distributed in the hope that it will be useful, but WITHOUT 22 22 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23 23 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 24 24 // for more details. 25 // 25 // 26 26 // You should have received a copy of the GNU Lesser General Public License 27 27 // along with this library. 28 // 28 // 29 29 30 30 // This context switch routine depends on the fact that the stack of a new … … 93 93 .globl CtxInvokeStub 94 94 CtxInvokeStub: 95 movq %rbx, %rdi 95 movq %rbx, %rdi 96 96 jmp *%r12 97 98 .text99 .align 2100 .globl CtxGet101 CtxGet:102 movq %rsp,SP_OFFSET(%rdi)103 movq %rbp,FP_OFFSET(%rdi)104 105 ret106 97 107 98 // Local Variables: // -
src/libcfa/concurrency/invoke.h
r3873b5a1 reaace25 112 112 extern void CtxInvokeStub( void ); 113 113 void CtxSwitch( void * from, void * to ) asm ("CtxSwitch"); 114 void CtxGet( void * this ) asm ("CtxGet"); 114 115 #if defined( __x86_64__ ) 116 #define CtxGet( ctx ) __asm__ ( \ 117 "movq %%rsp,%0\n" \ 118 "movq %%rbp,%1\n" \ 119 : "=rm" (ctx.SP), "=rm" (ctx.FP) ) 120 #elif defined( __i386__ ) 121 #define CtxGet( ctx ) __asm__ ( \ 122 "movl %%esp,%0\n" \ 123 "movl %%ebp,%1\n" \ 124 : "=rm" (ctx.SP), "=rm" (ctx.FP) ) 125 #endif 115 126 116 127 #endif //_INVOKE_PRIVATE_H_ -
src/libcfa/concurrency/kernel.c
r3873b5a1 reaace25 75 75 76 76 void ?{}( current_stack_info_t * this ) { 77 CtxGet( &this->ctx );77 CtxGet( this->ctx ); 78 78 this->base = this->ctx.FP; 79 79 this->storage = this->ctx.SP; -
src/libcfa/fstream
r3873b5a1 reaace25 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 1 16:37:53201713 // Update Count : 11 212 // Last Modified On : Fri Jul 7 08:32:38 2017 13 // Update Count : 117 14 14 // 15 15 16 #ifndef __FSTREAM_H__ 17 #define __FSTREAM_H__ 16 #pragma once 18 17 19 18 #include "iostream" 20 19 21 enum { sep arateSize = 16 };20 enum { sepSize = 16 }; 22 21 struct ofstream { 23 22 void * file; 24 23 _Bool sepDefault; 25 24 _Bool sepOnOff; 26 _Bool lastSepOn;25 _Bool sawNL; 27 26 const char * sepCur; 28 char separator[sep arateSize];29 char tupleSeparator[sep arateSize];27 char separator[sepSize]; 28 char tupleSeparator[sepSize]; 30 29 }; // ofstream 31 30 … … 36 35 const char * sepGetCur( ofstream * ); 37 36 void sepSetCur( ofstream *, const char * ); 38 _Bool lastSepOn( ofstream * ); 37 _Bool getNL( ofstream * ); 38 void setNL( ofstream *, _Bool ); 39 39 40 40 // public … … 75 75 extern ifstream * sin; 76 76 77 #endif // __FSTREAM_H__78 79 77 // Local Variables: // 80 78 // mode: c // -
src/libcfa/fstream.c
r3873b5a1 reaace25 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 1 16:37:54201713 // Update Count : 2 4212 // Last Modified On : Thu Jul 6 18:38:25 2017 13 // Update Count : 251 14 14 // 15 15 … … 33 33 this->sepDefault = sepDefault; 34 34 this->sepOnOff = sepOnOff; 35 this->lastSepOn = false;36 35 sepSet( this, separator ); 37 36 sepSetCur( this, sepGet( this ) ); … … 40 39 41 40 // private 42 _Bool lastSepOn( ofstream * os ) { return os->lastSepOn; } 43 _Bool sepPrt( ofstream * os ) { os->lastSepOn = false; return os->sepOnOff; } 41 _Bool sepPrt( ofstream * os ) { setNL( os, false ); return os->sepOnOff; } 44 42 void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; } 45 43 void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; } 46 44 const char * sepGetCur( ofstream * os ) { return os->sepCur; } 47 45 void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; } 46 _Bool getNL( ofstream * os ) { return os->sawNL; } 47 void setNL( ofstream * os, _Bool state ) { os->sawNL = state; } 48 48 49 49 // public 50 void sepOn( ofstream * os ) { os-> lastSepOn = true; os->sepOnOff = true; }51 void sepOff( ofstream * os ) { os-> lastSepOn = false; os->sepOnOff = 0; }50 void sepOn( ofstream * os ) { os->sepOnOff = ! getNL( os ); } 51 void sepOff( ofstream * os ) { os->sepOnOff = false; } 52 52 53 53 _Bool sepDisable( ofstream *os ) { 54 54 _Bool temp = os->sepDefault; 55 55 os->sepDefault = false; 56 os->lastSepOn = false;57 56 sepReset( os ); 58 57 return temp; … … 69 68 void sepSet( ofstream * os, const char * s ) { 70 69 assert( s ); 71 strncpy( os->separator, s, sep arateSize - 1 );72 os->separator[sep arateSize - 1] = '\0';70 strncpy( os->separator, s, sepSize - 1 ); 71 os->separator[sepSize - 1] = '\0'; 73 72 } // sepSet 74 73 … … 76 75 void sepSetTuple( ofstream * os, const char * s ) { 77 76 assert( s ); 78 strncpy( os->tupleSeparator, s, sep arateSize - 1 );79 os->tupleSeparator[sep arateSize - 1] = '\0';77 strncpy( os->tupleSeparator, s, sepSize - 1 ); 78 os->tupleSeparator[sepSize - 1] = '\0'; 80 79 } // sepSet 81 80 … … 153 152 154 153 void open( ifstream * is, const char * name, const char * mode ) { 155 FILE * t= fopen( name, mode );156 if ( t == 0 ) {// do not change unless successful154 FILE *file = fopen( name, mode ); 155 if ( file == 0 ) { // do not change unless successful 157 156 fprintf( stderr, IO_MSG "open input file \"%s\", ", name ); 158 157 perror( 0 ); 159 158 exit( EXIT_FAILURE ); 160 159 } // if 161 is->file = t;160 is->file = file; 162 161 } // open 163 162 -
src/libcfa/gmp
r3873b5a1 reaace25 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 27 09:55:51201713 // Update Count : 1 412 // Last Modified On : Fri Jul 7 09:33:20 2017 13 // Update Count : 15 14 14 // 15 15 16 16 // https://gmplib.org/gmp-man-6.1.1.pdf 17 18 #pragma once 17 19 18 20 #include <gmp.h> // GNU multi-precise integers -
src/libcfa/iostream
r3873b5a1 reaace25 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jul 2 08:42:56201713 // Update Count : 11 012 // Last Modified On : Fri Jul 7 08:35:59 2017 13 // Update Count : 118 14 14 // 15 15 16 #ifndef __IOSTREAM_H__ 17 #define __IOSTREAM_H__ 16 #pragma once 18 17 19 18 #include "iterator" … … 26 25 const char * sepGetCur( ostype * ); // get current separator string 27 26 void sepSetCur( ostype *, const char * ); // set current separator string 28 _Bool lastSepOn( ostype * ); // last manipulator is setOn (context sensitive) 27 _Bool getNL( ostype * ); // check newline 28 void setNL( ostype *, _Bool ); // saw newline 29 29 // public 30 30 void sepOn( ostype * ); // turn separator state on … … 82 82 forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, ostype * (*)( ostype * ) ); 83 83 forall( dtype ostype | ostream( ostype ) ) ostype * endl( ostype * ); 84 forall( dtype ostype | ostream( ostype ) ) ostype * sep( ostype * ); 85 forall( dtype ostype | ostream( ostype ) ) ostype * sepTuple( ostype * ); 84 86 forall( dtype ostype | ostream( ostype ) ) ostype * sepOn( ostype * ); 85 87 forall( dtype ostype | ostream( ostype ) ) ostype * sepOff( ostype * ); … … 137 139 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrC ); 138 140 139 #endif // __IOSTREAM_H140 141 141 // Local Variables: // 142 142 // mode: c // -
src/libcfa/iostream.c
r3873b5a1 reaace25 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jul 2 08:54:02201713 // Update Count : 3 7512 // Last Modified On : Thu Jul 6 18:14:17 2017 13 // Update Count : 396 14 14 // 15 15 … … 18 18 extern "C" { 19 19 #include <stdio.h> 20 #include <stdbool.h> // true/false 20 21 #include <string.h> // strlen 21 22 #include <float.h> // DBL_DIG, LDBL_DIG … … 24 25 25 26 forall( dtype ostype | ostream( ostype ) ) 26 ostype * ?|?( ostype * os, char c ) { 27 fmt( os, "%c", c ); 27 ostype * ?|?( ostype * os, char ch ) { 28 fmt( os, "%c", ch ); 29 if ( ch == '\n' ) setNL( os, true ); 28 30 sepOff( os ); 29 31 return os; … … 180 182 181 183 // last character IS spacing or opening punctuation => turn off separator for next item 182 unsigned int len = strlen( cp ), posn = len - 1;183 ch = cp[ posn];// must make unsigned184 size_t len = strlen( cp ); 185 ch = cp[len - 1]; // must make unsigned 184 186 if ( sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) { 185 187 sepOn( os ); … … 187 189 sepOff( os ); 188 190 } // if 191 if ( ch == '\n' ) setNL( os, true ); // check *AFTER* sepPrt call above as it resets NL flag 189 192 return write( os, cp, len ); 190 193 } // ?|? … … 216 219 217 220 forall( dtype ostype | ostream( ostype ) ) 221 ostype * sep( ostype * os ) { 222 os | sepGet( os ); 223 return os; 224 } // sep 225 226 forall( dtype ostype | ostream( ostype ) ) 227 ostype * sepTuple( ostype * os ) { 228 os | sepGetTuple( os ); 229 return os; 230 } // sepTuple 231 232 forall( dtype ostype | ostream( ostype ) ) 218 233 ostype * endl( ostype * os ) { 219 if ( lastSepOn( os ) ) fmt( os, "%s", sepGetCur( os ) );220 234 os | '\n'; 235 setNL( os, true ); 221 236 flush( os ); 222 237 sepOff( os ); // prepare for next line -
src/libcfa/iterator
r3873b5a1 reaace25 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 18:06:05 201613 // Update Count : 912 // Last Modified On : Fri Jul 7 08:37:25 2017 13 // Update Count : 10 14 14 // 15 15 16 #ifndef ITERATOR_H 17 #define ITERATOR_H 16 #pragma once 18 17 19 18 // An iterator can be used to traverse a data structure. … … 39 38 40 39 forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) ) 41 void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) );40 void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) ); 42 41 43 42 forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) ) 44 void for_each_reverse( iterator_type begin, iterator_type end, void (*func)( elt_type ) ); 45 46 #endif // ITERATOR_H 43 void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) ); 47 44 48 45 // Local Variables: // -
src/libcfa/iterator.c
r3873b5a1 reaace25 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 18:08:11 201613 // Update Count : 2 712 // Last Modified On : Fri Jul 7 08:38:23 2017 13 // Update Count : 28 14 14 // 15 15 … … 17 17 18 18 forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) ) 19 void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) ) {19 void for_each( iterator_type begin, iterator_type end, void (* func)( elt_type ) ) { 20 20 for ( iterator_type i = begin; i != end; ++i ) { 21 21 func( *i ); 22 } 23 } 22 } // for 23 } // for_each 24 24 25 25 forall( otype iterator_type, otype elt_type | iterator( iterator_type, elt_type ) ) 26 void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) ) {26 void for_each_reverse( iterator_type begin, iterator_type end, void (* func)( elt_type ) ) { 27 27 for ( iterator_type i = end; i != begin; ) { 28 28 --i; 29 29 func( *i ); 30 } 31 } 30 } // for 31 } // for_each_reverse 32 32 33 33 // Local Variables: // -
src/libcfa/limits
r3873b5a1 reaace25 10 10 // Created On : Wed Apr 6 18:06:52 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Apr 6 21:08:16 201613 // Update Count : 612 // Last Modified On : Fri Jul 7 09:33:57 2017 13 // Update Count : 7 14 14 // 15 15 16 #ifndef LIMITS_H 17 #define LIMITS_H 16 #pragma once 18 17 19 18 // Integral Constants … … 110 109 extern const long _Complex _1_SQRT_2; // 1 / sqrt(2) 111 110 112 #endif // LIMITS_H113 114 111 // Local Variables: // 115 112 // mode: c // -
src/libcfa/math
r3873b5a1 reaace25 10 10 // Created On : Mon Apr 18 23:37:04 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 24 17:40:39 2017 13 // Update Count : 60 14 // 15 16 #ifndef MATH_H 17 #define MATH_H 12 // Last Modified On : Fri Jul 7 09:34:15 2017 13 // Update Count : 61 14 // 15 16 #pragma once 18 17 19 18 extern "C" { … … 345 344 long double scalbln( long double, long int ); 346 345 347 #endif // MATH_H348 349 346 // Local Variables: // 350 347 // mode: c // -
src/libcfa/rational
r3873b5a1 reaace25 12 12 // Created On : Wed Apr 6 17:56:25 2016 13 13 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Mon May 15 21:30:12201715 // Update Count : 9 014 // Last Modified On : Fri Jul 7 09:34:33 2017 15 // Update Count : 93 16 16 // 17 17 18 #ifndef RATIONAL_H 19 #define RATIONAL_H 18 #pragma once 20 19 21 20 #include "iostream" … … 47 46 // implementation 48 47 49 forall 48 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 50 49 struct Rational { 51 50 RationalImpl numerator, denominator; // invariant: denominator > 0 … … 54 53 // constructors 55 54 56 forall 55 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 57 56 void ?{}( Rational(RationalImpl) * r ); 58 57 59 forall 58 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 60 59 void ?{}( Rational(RationalImpl) * r, RationalImpl n ); 61 60 62 forall 61 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 63 62 void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ); 64 63 65 forall 64 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 66 65 void ?{}( Rational(RationalImpl) * r, zero_t ); 67 66 68 forall 67 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 69 68 void ?{}( Rational(RationalImpl) * r, one_t ); 70 69 71 // getter for numerator/denominator70 // numerator/denominator getter 72 71 73 forall 72 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 74 73 RationalImpl numerator( Rational(RationalImpl) r ); 75 74 76 forall 75 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 77 76 RationalImpl denominator( Rational(RationalImpl) r ); 78 forall ( otype RationalImpl | arithmetic( RationalImpl ) ) 77 78 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 79 79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ); 80 80 81 // setter for numerator/denominator81 // numerator/denominator setter 82 82 83 forall 83 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 84 84 RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ); 85 85 86 forall 86 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 87 87 RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ); 88 88 89 89 // comparison 90 90 91 forall 91 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 92 92 int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 93 93 94 forall 94 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 95 95 int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 96 96 97 forall 97 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 98 98 int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 99 99 100 forall 100 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 101 101 int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 102 102 103 forall 103 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 104 104 int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 105 105 106 forall 106 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 107 107 int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 108 108 109 109 // arithmetic 110 110 111 forall 111 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 112 112 Rational(RationalImpl) +?( Rational(RationalImpl) r ); 113 113 114 forall 114 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 115 115 Rational(RationalImpl) -?( Rational(RationalImpl) r ); 116 116 117 forall 117 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 118 118 Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 119 119 120 forall 120 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 121 121 Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 122 122 123 forall 123 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 124 124 Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 125 125 126 forall 126 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 127 127 Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ); 128 128 129 129 // conversion 130 forall 130 forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } ) 131 131 double widen( Rational(RationalImpl) r ); 132 forall 132 forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); RationalImpl convert( double );} ) 133 133 Rational(RationalImpl) narrow( double f, RationalImpl md ); 134 134 135 135 // I/O 136 forall 136 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 137 137 forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } ) 138 138 istype * ?|?( istype *, Rational(RationalImpl) * ); 139 139 140 forall 140 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 141 141 forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } ) 142 142 ostype * ?|?( ostype *, Rational(RationalImpl ) ); 143 144 #endif // RATIONAL_H145 143 146 144 // Local Variables: // -
src/libcfa/rational.c
r3873b5a1 reaace25 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 15 21:29:23201713 // Update Count : 1 4912 // Last Modified On : Tue May 16 18:35:36 2017 13 // Update Count : 150 14 14 // 15 15 … … 22 22 // Calculate greatest common denominator of two numbers, the first of which may be negative. Used to reduce rationals. 23 23 // alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm 24 forall 24 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 25 25 static RationalImpl gcd( RationalImpl a, RationalImpl b ) { 26 26 for ( ;; ) { // Euclid's algorithm … … 33 33 } // gcd 34 34 35 forall 35 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 36 36 static RationalImpl simplify( RationalImpl * n, RationalImpl * d ) { 37 37 if ( *d == (RationalImpl){0} ) { … … 46 46 // constructors 47 47 48 forall 48 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 49 49 void ?{}( Rational(RationalImpl) * r ) { 50 50 r{ (RationalImpl){0}, (RationalImpl){1} }; 51 51 } // rational 52 52 53 forall 53 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 54 54 void ?{}( Rational(RationalImpl) * r, RationalImpl n ) { 55 55 r{ n, (RationalImpl){1} }; 56 56 } // rational 57 57 58 forall 58 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 59 59 void ?{}( Rational(RationalImpl) * r, RationalImpl n, RationalImpl d ) { 60 60 RationalImpl t = simplify( &n, &d ); // simplify … … 66 66 // getter for numerator/denominator 67 67 68 forall 68 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 69 69 RationalImpl numerator( Rational(RationalImpl) r ) { 70 70 return r.numerator; 71 71 } // numerator 72 72 73 forall 73 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 74 74 RationalImpl denominator( Rational(RationalImpl) r ) { 75 75 return r.denominator; 76 76 } // denominator 77 77 78 forall 78 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 79 79 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational(RationalImpl) src ) { 80 80 return *dest = src.[ numerator, denominator ]; … … 83 83 // setter for numerator/denominator 84 84 85 forall 85 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 86 86 RationalImpl numerator( Rational(RationalImpl) r, RationalImpl n ) { 87 87 RationalImpl prev = r.numerator; … … 92 92 } // numerator 93 93 94 forall 94 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 95 95 RationalImpl denominator( Rational(RationalImpl) r, RationalImpl d ) { 96 96 RationalImpl prev = r.denominator; … … 104 104 // comparison 105 105 106 forall 106 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 107 107 int ?==?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 108 108 return l.numerator * r.denominator == l.denominator * r.numerator; 109 109 } // ?==? 110 110 111 forall 111 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 112 112 int ?!=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 113 113 return ! ( l == r ); 114 114 } // ?!=? 115 115 116 forall 116 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 117 117 int ?<?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 118 118 return l.numerator * r.denominator < l.denominator * r.numerator; 119 119 } // ?<? 120 120 121 forall 121 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 122 122 int ?<=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 123 123 return l.numerator * r.denominator <= l.denominator * r.numerator; 124 124 } // ?<=? 125 125 126 forall 126 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 127 127 int ?>?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 128 128 return ! ( l <= r ); 129 129 } // ?>? 130 130 131 forall 131 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 132 132 int ?>=?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 133 133 return ! ( l < r ); … … 137 137 // arithmetic 138 138 139 forall 139 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 140 140 Rational(RationalImpl) +?( Rational(RationalImpl) r ) { 141 141 Rational(RationalImpl) t = { r.numerator, r.denominator }; … … 143 143 } // +? 144 144 145 forall 145 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 146 146 Rational(RationalImpl) -?( Rational(RationalImpl) r ) { 147 147 Rational(RationalImpl) t = { -r.numerator, r.denominator }; … … 149 149 } // -? 150 150 151 forall 151 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 152 152 Rational(RationalImpl) ?+?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 153 153 if ( l.denominator == r.denominator ) { // special case … … 160 160 } // ?+? 161 161 162 forall 162 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 163 163 Rational(RationalImpl) ?-?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 164 164 if ( l.denominator == r.denominator ) { // special case … … 171 171 } // ?-? 172 172 173 forall 173 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 174 174 Rational(RationalImpl) ?*?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 175 175 Rational(RationalImpl) t = { l.numerator * r.numerator, l.denominator * r.denominator }; … … 177 177 } // ?*? 178 178 179 forall 179 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 180 180 Rational(RationalImpl) ?/?( Rational(RationalImpl) l, Rational(RationalImpl) r ) { 181 181 if ( r.numerator < (RationalImpl){0} ) { … … 190 190 // conversion 191 191 192 forall 192 forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); } ) 193 193 double widen( Rational(RationalImpl) r ) { 194 194 return convert( r.numerator ) / convert( r.denominator ); … … 196 196 197 197 // http://www.ics.uci.edu/~eppstein/numth/frap.c 198 forall 198 forall( otype RationalImpl | arithmetic( RationalImpl ) | { double convert( RationalImpl ); RationalImpl convert( double ); } ) 199 199 Rational(RationalImpl) narrow( double f, RationalImpl md ) { 200 200 if ( md <= (RationalImpl){1} ) { // maximum fractional digits too small? … … 227 227 // I/O 228 228 229 forall 229 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 230 230 forall( dtype istype | istream( istype ) | { istype * ?|?( istype *, RationalImpl * ); } ) 231 231 istype * ?|?( istype * is, Rational(RationalImpl) * r ) { … … 238 238 } // ?|? 239 239 240 forall 240 forall( otype RationalImpl | arithmetic( RationalImpl ) ) 241 241 forall( dtype ostype | ostream( ostype ) | { ostype * ?|?( ostype *, RationalImpl ); } ) 242 242 ostype * ?|?( ostype * os, Rational(RationalImpl ) r ) { -
src/libcfa/stdlib
r3873b5a1 reaace25 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 2 15:51:03 2017 13 // Update Count : 218 14 // 15 16 #ifndef STDLIB_H 17 #define STDLIB_H 12 // Last Modified On : Fri Jul 7 09:34:49 2017 13 // Update Count : 219 14 // 15 16 #pragma once 18 17 19 18 //--------------------------------------- … … 232 231 void swap( T * t1, T * t2 ); 233 232 234 #endif // STDLIB_H235 236 233 // Local Variables: // 237 234 // mode: c // -
src/main.cc
r3873b5a1 reaace25 10 10 // Author : Richard C. Bilson 11 11 // Created On : Fri May 15 23:12:02 2015 12 // Last Modified By : Peter A. Buhr13 // Last Modified On : Thu Jun 29 12:46:50 201714 // Update Count : 44 112 // Last Modified By : Andrew Beach 13 // Last Modified On : Fri Jul 7 11:13:00 2017 14 // Update Count : 442 15 15 // 16 16 … … 206 206 FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" ); 207 207 assertf( builtins, "cannot open builtins.cf\n" ); 208 parse( builtins, LinkageSpec::Builtin );208 parse( builtins, LinkageSpec::BuiltinCFA ); 209 209 } // if 210 210 } // if -
src/tests/.expect/32/math.txt
r3873b5a1 reaace25 22 22 cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i 23 23 tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i 24 asin:1.5708 1.5707963267949 1.57079632679489662 0.6662 4+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i24 asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i 25 25 acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i 26 26 atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i -
src/tests/.expect/io.txt
r3873b5a1 reaace25 4 4 123 5 5 6 opening delimiters 6 opening delimiters 7 7 x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10 8 8 9 closing delimiters 10 1, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x 9 closing delimiters 10 1, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x 11 11 12 opening/closing delimiters 12 opening/closing delimiters 13 13 x`1`x'2'x"3"x:4:x 5 x 6 x 14 14 7 … … 19 19 x 20 20 10 21 x 21 x 22 22 23 override opening/closing delimiters 23 override opening/closing delimiters 24 24 x ( 1 ) x 2 , x 3 :x: 4 25 25 26 input bacis types 26 input bacis types 27 27 28 output basic types 28 output basic types 29 29 A 30 30 1 2 3 4 5 6 7 8 … … 32 32 1.1+2.3i 1.1-2.3i 1.1-2.3i 33 33 34 tuples 35 1, 2, 3 3, 4, 534 tuples 35 1, 2, 3 4, 5, 6 36 36 37 toggle separator 37 toggle separator 38 38 1.11.21.3 39 39 1.1+2.3i1.1-2.3i1.1-2.3i 40 abcxyz 41 abcxyz 40 1.1+2.3i 1.1-2.3i1.1-2.3i 41 1.1+2.3i 1.1-2.3i 1.1-2.3i 42 1.1+2.3i1.1-2.3i 1.1-2.3i 43 abcxyz 44 abcxyz 42 45 43 change separator 44 from " "to ", $"46 change separator 47 from " " to ", $" 45 48 1.1, $1.2, $1.3 46 49 1.1+2.3i, $1.1-2.3i, $1.1-2.3i 47 abc, $xyz , $48 1, 2, 3, $ 3, 4, 550 abc, $xyz 51 1, 2, 3, $4, 5, 6 49 52 50 from ", $" to " "53 from ", $" to " " 51 54 1.1 1.2 1.3 52 55 1.1+2.3i 1.1-2.3i 1.1-2.3i 53 abc xyz 54 1, 2, 3 3, 4, 556 abc xyz 57 1, 2, 3 4, 5, 6 55 58 56 1 2 3 59 check sepOn/sepOff 60 1 2 3 57 61 12 3 58 1 2 359 62 1 2 3 60 63 1 2 3 61 64 65 1 2 3 66 67 check enable/disable 62 68 123 63 69 1 23 … … 65 71 123 66 72 1 2 3 67 123 73 123 68 74 1 2 3 69 75 70 1 2 3 3 4 5" "71 1, 2, 3 3, 4, 5 ","72 1, 2, 3 3, 4, 576 1 2 3 4 5 6 " " 77 1, 2, 3 4, 5, 6 " " 78 1, 2, 3 4, 5, 6 73 79 74 80 3, 4, a, 7.2 75 81 3, 4, a, 7.2 76 82 3 4 a 7.2 77 83 3 4 a 7.234a7.23 4 a 7.2 78 84 3-4-a-7.2^3^4^3-4-a-7.2 -
src/tests/Makefile.am
r3873b5a1 reaace25 29 29 30 30 # applies to both programs 31 EXTRA_FLAGS = 32 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS} 31 DEBUG_FLAGS = 32 33 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ 34 if !BUILD_DEBUG 35 BUILD_FLAGS += -nodebug 36 else 37 if !BUILD_RELEASE 38 BUILD_FLAGS += -debug 39 else 40 BUILD_FLAGS += ${DEBUG_FLAGS} 41 endif 42 endif 43 33 44 TEST_FLAGS = $(if $(test), 2> .err/${@}.log, ) 34 45 AM_CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS} -
src/tests/Makefile.in
r3873b5a1 reaace25 92 92 host_triplet = @host@ 93 93 @BUILD_CONCURRENCY_TRUE@am__append_1 = coroutine thread monitor 94 @BUILD_DEBUG_FALSE@am__append_2 = -nodebug 95 @BUILD_DEBUG_TRUE@@BUILD_RELEASE_FALSE@am__append_3 = -debug 96 @BUILD_DEBUG_TRUE@@BUILD_RELEASE_TRUE@am__append_4 = ${DEBUG_FLAGS} 94 97 EXTRA_PROGRAMS = fstream_test$(EXEEXT) vector_test$(EXEEXT) \ 95 98 avl_test$(EXEEXT) … … 320 323 321 324 # applies to both programs 322 EXTRA_FLAGS = 323 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS} 325 DEBUG_FLAGS = 326 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ \ 327 $(am__append_2) $(am__append_3) $(am__append_4) 324 328 TEST_FLAGS = $(if $(test), 2> .err/${@}.log, ) 325 329 AM_CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS} -
src/tests/io.c
r3873b5a1 reaace25 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jul 2 09:40:58201713 // Update Count : 6812 // Last Modified On : Thu Jul 6 23:26:12 2017 13 // Update Count : 78 14 14 // 15 15 … … 104 104 105 105 sout | "tuples" | endl; 106 [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 3, [ 4, 5] ];106 [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 4, [ 5, 6 ] ]; 107 107 sout | t1 | t2 | endl; // print tuple 108 108 sout | endl; … … 110 110 sout | "toggle separator" | endl; 111 111 sout | f | "" | d | "" | ld | endl // floating point without separator 112 | sepDisable | fc | dc | ldc | sepEnable | endl // complex without separator 113 | sepOn | s1 | sepOff | s2 | endl // local separator removal 114 | s1 | "" | s2 | endl; // C string without separator 112 | sepDisable | fc | dc | ldc | endl // complex without separator 113 | fc | sepOn | dc | ldc | endl // local separator add 114 | sepEnable | fc | dc | ldc | endl // complex with separator 115 | fc | sepOff | dc | ldc | endl // local separator removal 116 | s1 | sepOff | s2 | endl // local separator removal 117 | s1 | "" | s2 | endl; // local separator removal 115 118 sout | endl; 116 119 117 120 sout | "change separator" | endl; 118 sout | "from \" " | sepGet( sout )| "\"";121 sout | "from \"" | sep | "\""; 119 122 sepSet( sout, ", $" ); // change separator, maximum of 15 characters 120 sout | " to \" " | sepGet( sout )| "\"" | endl;123 sout | " to \"" | sep | "\"" | endl; 121 124 sout | f | d | ld | endl 122 125 | fc | dc | ldc | endl … … 124 127 | t1 | t2 | endl; // print tuple 125 128 sout | endl; 126 sout | "from \"" | sep Get( sout ) | "\"";129 sout | "from \"" | sep | "\" "; 127 130 sepSet( sout, " " ); // restore separator 128 sout | "to \"" | sep Get( sout )| "\"" | endl;131 sout | "to \"" | sep | "\"" | endl; 129 132 sout | f | d | ld | endl 130 133 | fc | dc | ldc | endl … … 133 136 sout | endl; 134 137 135 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // separator at start/end of line 138 sout | "check sepOn/sepOff" | endl; 139 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // no separator at start/end of line 136 140 sout | 1 | sepOff | 2 | 3 | endl; // locally turn off implicit separator 137 sout | sepOn | 1 | 2 | 3 | sepOn | sepOff | endl; // separator at startof line138 sout | 1 | 2 | 3 | endl | sepOn; //separator at start of next line141 sout | sepOn | sepOn | 1 | 2 | 3 | sepOn | sepOff | sepOn | '\n'; // no separator at start/end of line 142 sout | 1 | 2 | 3 | "\n\n" | sepOn; // no separator at start of next line 139 143 sout | 1 | 2 | 3 | endl; 140 144 sout | endl; 141 145 146 sout | "check enable/disable" | endl; 142 147 sout | sepDisable | 1 | 2 | 3 | endl; // globally turn off implicit separation 143 148 sout | 1 | sepOn | 2 | 3 | endl; // locally turn on implicit separator … … 149 154 sout | endl; 150 155 156 // sout | fmt( d, "%8.3f" ) || endl; 157 // sout | endl; 158 151 159 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " 152 sout | t1 | t2 | " \"" | sep GetTuple( sout )| "\"" | endl;160 sout | t1 | t2 | " \"" | sep | "\"" | endl; 153 161 sepSetTuple( sout, ", " ); // reset tuple separator to ", " 154 sout | t1 | t2 | " \"" | sep GetTuple( sout )| "\"" | endl;162 sout | t1 | t2 | " \"" | sep | "\"" | endl; 155 163 sout | t1 | t2 | endl; // print tuple 156 164 sout | endl; -
src/tests/test.py
r3873b5a1 reaace25 166 166 167 167 # build, skipping to next test on error 168 make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)168 make_ret, _ = sh("""%s test=yes DEBUG_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run) 169 169 170 170 retcode = 0 … … 202 202 error = myfile.read() 203 203 204 204 205 205 # clean the executable 206 206 sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
Note: See TracChangeset
for help on using the changeset viewer.