Changeset 7dc2e57b
- Timestamp:
- Jul 15, 2019, 2:43:38 PM (6 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:
- a87d40b, e67991f
- Parents:
- ce12e2b (diff), 4f37255 (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. - Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
rce12e2b r7dc2e57b 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Tue Jun 25 08:51:33201914 %% Update Count : 387 113 %% Last Modified On : Sat Jul 13 18:36:18 2019 14 %% Update Count : 3876 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 2697 2697 \subsection{Expressions} 2698 2698 2699 % Change order of expression evaluation. 2700 % http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0145r2.pdf 2701 2699 2702 Multiple-return-value functions provide \CFA with a new syntax for expressing a combination of expressions in the return statement and a combination of types in a function signature. 2700 2703 These notions are generalized to provide \CFA with \newterm{tuple expression}s and \newterm{tuple type}s. … … 3506 3509 3507 3510 \item 3508 A separator does not appear before or after a null (empty) C string .3511 A separator does not appear before or after a null (empty) C string, which is a local mechanism to disable insertion of the separator character. 3509 3512 \begin{cfa} 3510 3513 sout | 1 | "" | 2 | "" | 3; 3511 3514 123 3512 3515 \end{cfa} 3513 which is a local mechanism to disable insertion of the separator character.3514 3516 3515 3517 \item 3516 3518 {\lstset{language=CFA,deletedelim=**[is][]{¢}{¢}} 3517 A sep erator does not appear before a C string starting with the (extended) \Index*{ASCII}\index{ASCII!extended} characters: \lstinline[basicstyle=\tt]@,.;!?)]}%¢»@3519 A separator does not appear before a C string starting with the (extended) \Index*{ASCII}\index{ASCII!extended} characters: \lstinline[basicstyle=\tt]@,.;!?)]}%¢»@, where \lstinline[basicstyle=\tt]@»@ is a closing citation mark. 3518 3520 \begin{cfa}[belowskip=0pt] 3519 3521 sout | 1 | ", x" | 2 | ". x" | 3 | "; x" | 4 | "! x" | 5 | "? x" | 6 | "% x" … … 3523 3525 1®,® x 2®.® x 3®;® x 4®!® x 5®?® x 6®%® x 7§\color{red}\textcent§ x 8®»® x 9®)® x 10®]® x 11®}® x 3524 3526 \end{cfa}}% 3525 where \lstinline[basicstyle=\tt]@»@ is a closing citation mark. 3526 3527 \item 3528 A separator does not appear after a C string ending with the (extended) \Index*{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off,basicstyle=\tt]@([{=$£¥¡¿«@ 3527 3528 \item 3529 A separator does not appear after a C string ending with the (extended) \Index*{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off,basicstyle=\tt]@([{=$£¥¡¿«@, where \lstinline[basicstyle=\tt]@¡¿@ are inverted opening exclamation and question marks, and \lstinline[basicstyle=\tt]@«@ is an opening citation mark. 3529 3530 %$ 3530 3531 \begin{cfa}[mathescape=off] … … 3537 3538 \end{cfa} 3538 3539 %$ 3539 where \lstinline[basicstyle=\tt]@¡¿@ are inverted opening exclamation and question marks, and \lstinline[basicstyle=\tt]@«@ is an opening citation mark.3540 3540 3541 3541 \item … … 3651 3651 The tuple separator also responses to being turned on and off. 3652 3652 \begin{cfa}[belowskip=0pt] 3653 sout | t1 | sepOff | t2; §\C{// locally turn on/off implicit separator}§3653 sout | t1 | sepOff | t2; §\C{// turn off implicit separator for the next item}§ 3654 3654 \end{cfa} 3655 3655 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 3675 3675 \subsection{Newline Manipulators} 3676 3676 3677 The following \Index{manipulator } controls\Index{newline separation} for input and output.3677 The following \Index{manipulators} control \Index{newline separation} for input and output. 3678 3678 3679 3679 For input: … … 3773 3773 3774 3774 \item 3775 \Indexc{nobase}( integer )\index{manipulator!nobase@©nobase©} do not precede ©bin©, ©oct©, ©hex© with ©0b©/©0B©, ©0©, or ©0x©/©0X©. Printing the base is the default. 3775 \Indexc{nobase}( integer )\index{manipulator!nobase@©nobase©} do not precede ©bin©, ©oct©, ©hex© with ©0b©/©0B©, ©0©, or ©0x©/©0X©. 3776 Printing the base is the default. 3776 3777 \begin{cfa}[belowskip=0pt] 3777 3778 sout | nobase( bin( 27 ) ) | nobase( oct( 27 ) ) | nobase( hex( 27 ) ); -
libcfa/src/bits/debug.cfa
rce12e2b r7dc2e57b 9 9 // Author : Thierry Delisle 10 10 // Created On : Thu Mar 30 12:30:01 2017 11 // Last Modified By : 12 // Last Modified On : 13 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jul 14 22:17:35 2019 13 // Update Count : 4 14 14 // 15 15 … … 23 23 } 24 24 25 enum { buffer_size = 512};25 enum { buffer_size = 4096 }; 26 26 static char buffer[ buffer_size ]; 27 27 -
libcfa/src/fstream.cfa
rce12e2b r7dc2e57b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:03:53201913 // Update Count : 34 412 // Last Modified On : Sun Jul 14 11:51:10 2019 13 // Update Count : 347 14 14 // 15 15 … … 119 119 #ifdef __CFA_DEBUG__ 120 120 if ( file == 0 ) { 121 abort ( IO_MSG "open output file \"%s\", %s", name, strerror( errno ));121 abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno ); 122 122 } // if 123 123 #endif // __CFA_DEBUG__ … … 133 133 134 134 if ( fclose( (FILE *)(os.file) ) == EOF ) { 135 abort ( IO_MSG "close output %s", strerror( errno ));135 abort | IO_MSG "close output" | nl | strerror( errno ); 136 136 } // if 137 137 } // close … … 139 139 ofstream & write( ofstream & os, const char * data, size_t size ) { 140 140 if ( fail( os ) ) { 141 abort ( "attempt write I/O on failed stream\n" );141 abort | IO_MSG "attempt write I/O on failed stream"; 142 142 } // if 143 143 144 144 if ( fwrite( data, 1, size, (FILE *)(os.file) ) != size ) { 145 abort ( IO_MSG "write %s", strerror( errno ));145 abort | IO_MSG "write" | nl | strerror( errno ); 146 146 } // if 147 147 return os; … … 154 154 if ( len == EOF ) { 155 155 if ( ferror( (FILE *)(os.file) ) ) { 156 abort ( "invalid write\n" );156 abort | IO_MSG "invalid write"; 157 157 } // if 158 158 } // if … … 211 211 #ifdef __CFA_DEBUG__ 212 212 if ( file == 0 ) { 213 abort ( IO_MSG "open input file \"%s\", %s\n", name, strerror( errno ));213 abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno ); 214 214 } // if 215 215 #endif // __CFA_DEBUG__ … … 225 225 226 226 if ( fclose( (FILE *)(is.file) ) == EOF ) { 227 abort ( IO_MSG "close input %s", strerror( errno ));227 abort | IO_MSG "close input" | nl | strerror( errno ); 228 228 } // if 229 229 } // close … … 231 231 ifstream & read( ifstream & is, char * data, size_t size ) { 232 232 if ( fail( is ) ) { 233 abort ( "attempt read I/O on failed stream\n" );233 abort | IO_MSG "attempt read I/O on failed stream"; 234 234 } // if 235 235 236 236 if ( fread( data, size, 1, (FILE *)(is.file) ) == 0 ) { 237 abort ( IO_MSG "read %s", strerror( errno ));237 abort | IO_MSG "read" | nl | strerror( errno ); 238 238 } // if 239 239 return is; … … 242 242 ifstream &ungetc( ifstream & is, char c ) { 243 243 if ( fail( is ) ) { 244 abort ( "attempt ungetc I/O on failed stream\n" );244 abort | IO_MSG "attempt ungetc I/O on failed stream"; 245 245 } // if 246 246 247 247 if ( ungetc( c, (FILE *)(is.file) ) == EOF ) { 248 abort ( IO_MSG "ungetc %s", strerror( errno ));248 abort | IO_MSG "ungetc" | nl | strerror( errno ); 249 249 } // if 250 250 return is; … … 258 258 if ( len == EOF ) { 259 259 if ( ferror( (FILE *)(is.file) ) ) { 260 abort ( "invalid read\n" );260 abort | IO_MSG "invalid read"; 261 261 } // if 262 262 } // if -
libcfa/src/gmp.hfa
rce12e2b r7dc2e57b 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:02:55 201913 // Update Count : 2 612 // Last Modified On : Sat Jul 13 15:25:05 2019 13 // Update Count : 27 14 14 // 15 15 … … 43 43 Int ?=?( Int & lhs, long int rhs ) { mpz_set_si( lhs.mpz, rhs ); return lhs; } 44 44 Int ?=?( Int & lhs, unsigned long int rhs ) { mpz_set_ui( lhs.mpz, rhs ); return lhs; } 45 Int ?=?( Int & lhs, const char * rhs ) { if ( mpz_set_str( lhs.mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return lhs; }45 Int ?=?( Int & lhs, const char * rhs ) { if ( mpz_set_str( lhs.mpz, rhs, 0 ) ) { abort | "invalid string conversion"; } return lhs; } 46 46 47 47 char ?=?( char & lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; } -
libcfa/src/interpose.cfa
rce12e2b r7dc2e57b 10 10 // Created On : Wed Mar 29 16:10:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at May 5 11:37:35 201813 // Update Count : 11 112 // Last Modified On : Sun Jul 14 22:57:16 2019 13 // Update Count : 116 14 14 // 15 15 … … 81 81 //============================================================================================= 82 82 83 void sigHandler_segv 84 void sigHandler_ill 85 void sigHandler_fpe 86 void sigHandler_ab ort( __CFA_SIGPARMS__ );87 void sigHandler_term 83 void sigHandler_segv( __CFA_SIGPARMS__ ); 84 void sigHandler_ill ( __CFA_SIGPARMS__ ); 85 void sigHandler_fpe ( __CFA_SIGPARMS__ ); 86 void sigHandler_abrt( __CFA_SIGPARMS__ ); 87 void sigHandler_term( __CFA_SIGPARMS__ ); 88 88 89 89 struct { … … 110 110 __cfaabi_sigaction( SIGILL , sigHandler_ill , SA_SIGINFO ); 111 111 __cfaabi_sigaction( SIGFPE , sigHandler_fpe , SA_SIGINFO ); 112 __cfaabi_sigaction( SIGABRT, sigHandler_ab ort, SA_SIGINFO | SA_RESETHAND);112 __cfaabi_sigaction( SIGABRT, sigHandler_abrt, SA_SIGINFO | SA_RESETHAND); 113 113 __cfaabi_sigaction( SIGTERM, sigHandler_term , SA_SIGINFO ); 114 114 __cfaabi_sigaction( SIGINT , sigHandler_term , SA_SIGINFO ); … … 204 204 if ( *p == '(' ) { 205 205 name = p; 206 } 207 else if ( *p == '+' ) { 206 } else if ( *p == '+' ) { 208 207 offset_begin = p; 209 } 210 else if ( *p == ')' ) { 208 } else if ( *p == ')' ) { 211 209 offset_end = p; 212 210 break; … … 223 221 224 222 __cfaabi_dbg_bits_print_nolock( "(%i) %s : %s + %s %s\n", frameNo, messages[i], name, offset_begin, offset_end); 225 } 226 // otherwise, print the whole line 227 else { 223 } else { // otherwise, print the whole line 228 224 __cfaabi_dbg_bits_print_nolock( "(%i) %s\n", frameNo, messages[i] ); 229 225 } … … 258 254 } 259 255 260 void sigHandler_ab ort( __CFA_SIGPARMS__ ) {256 void sigHandler_abrt( __CFA_SIGPARMS__ ) { 261 257 __cfaabi_backtrace(); 262 258 -
libcfa/src/iostream.cfa
rce12e2b r7dc2e57b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:04:13201913 // Update Count : 8 1912 // Last Modified On : Sat Jul 13 08:07:59 2019 13 // Update Count : 821 14 14 // 15 15 … … 499 499 if ( ! f.flags.left ) { \ 500 500 buf[i] = '.'; buf[i + 1] = '\0'; \ 501 if ( buf[0] == ' ' ) bufbeg = 1; 501 if ( buf[0] == ' ' ) bufbeg = 1; /* decimal point within width */ \ 502 502 } else { \ 503 503 for ( i = 0; i < len && buf[i] != ' '; i += 1 ); /* trailing blank ? */ \ … … 546 546 forall( dtype ostype | ostream( ostype ) ) { 547 547 ostype & ?|?( ostype & os, _Ostream_Manip(char) f ) { 548 if ( f.base != 'c' ) { 548 if ( f.base != 'c' ) { // bespoke binary/octal/hex format 549 549 _Ostream_Manip(unsigned char) fmtuc @= { f.val, f.wd, f.pc, f.base, {'\0'} }; 550 550 fmtuc.flags.pc = f.flags.pc; … … 558 558 559 559 #define CFMTNP "% * " 560 char fmtstr[sizeof(CFMTNP)]; 560 char fmtstr[sizeof(CFMTNP)]; // sizeof includes '\0' 561 561 memcpy( &fmtstr, CFMTNP, sizeof(CFMTNP) ); 562 int star = 1; 562 int star = 1; // position before first '*' 563 563 564 564 // Insert flags into spaces before '*', from right to left. … … 566 566 fmtstr[star] = '%'; 567 567 568 fmtstr[sizeof(CFMTNP)-2] = f.base; 568 fmtstr[sizeof(CFMTNP)-2] = f.base; // sizeof includes '\0' 569 569 // printf( "%d %s\n", f.wd, &fmtstr[star] ); 570 570 fmt( os, &fmtstr[star], f.wd, f.val ); … … 631 631 else { 632 632 fprintf( stderr, "invalid Boolean constant\n" ); 633 abort(); 633 abort(); // cannot use abort stream 634 634 } // if 635 635 return is; … … 639 639 char temp; 640 640 for () { 641 fmt( is, "%c", &temp ); 641 fmt( is, "%c", &temp ); // must pass pointer through varg to fmt 642 642 // do not overwrite parameter with newline unless appropriate 643 643 if ( temp != '\n' || getANL( is ) ) { c = temp; break; } … … 773 773 if ( ! f.s ) { 774 774 // printf( "skip %s %d\n", f.scanset, f.wd ); 775 if ( f.wd == -1 ) fmt( is, f.scanset, "" ); 775 if ( f.wd == -1 ) fmt( is, f.scanset, "" ); // no input arguments 776 776 else for ( f.wd ) fmt( is, "%*c" ); 777 777 return is; -
libcfa/src/rational.cfa
rce12e2b r7dc2e57b 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 1 2:02:36201913 // Update Count : 18 312 // Last Modified On : Fri Jul 12 18:12:08 2019 13 // Update Count : 184 14 14 // 15 15 … … 35 35 static RationalImpl simplify( RationalImpl & n, RationalImpl & d ) { 36 36 if ( d == (RationalImpl){0} ) { 37 abort ( "Invalid rational number construction: denominator cannot be equal to 0.\n" );37 abort | "Invalid rational number construction: denominator cannot be equal to 0."; 38 38 } // exit 39 39 if ( d < (RationalImpl){0} ) { d = -d; n = -n; } // move sign to numerator -
libcfa/src/time.cfa
rce12e2b r7dc2e57b 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:03:19201913 // Update Count : 5912 // Last Modified On : Sat Jul 13 08:41:55 2019 13 // Update Count : 65 14 14 // 15 15 16 16 #include "time.hfa" 17 #include " iostream.hfa"17 #include "fstream.hfa" 18 18 #include <stdio.h> // snprintf 19 19 #include <assert.h> … … 52 52 53 53 #ifdef __CFA_DEBUG__ 54 #define CreateFmt "Attempt to create Time( year=%d (>=1970), month=%d (1-12), day=%d (1-31), hour=%d (0-23), min=%d (0-59), sec=%d (0-60), nsec=%d (0-999_999_999), " \ 55 "which exceeds range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038." 54 static void tabort( int year, int month, int day, int hour, int min, int sec, int nsec ) { 55 abort | "Attempt to create Time( year=" | year | "(>=1970), month=" | month | "(1-12), day=" | day | "(1-31), hour=" | hour | "(0-23), min=" | min | "(0-59), sec=" | sec 56 | "(0-60), nsec=" | nsec | "(0-999_999_999), which exceeds range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038."; 57 } // tabort 56 58 #endif // __CFA_DEBUG__ 57 59 … … 63 65 #ifdef __CFA_DEBUG__ 64 66 if ( month < 1 || 12 < month ) { 65 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );67 tabort( year, month, day, hour, min, sec, nsec ); 66 68 } // if 67 69 #endif // __CFA_DEBUG__ … … 69 71 #ifdef __CFA_DEBUG__ 70 72 if ( day < 1 || 31 < day ) { 71 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );73 tabort( year, month, day, hour, min, sec, nsec ); 72 74 } // if 73 75 #endif // __CFA_DEBUG__ … … 79 81 #ifdef __CFA_DEBUG__ 80 82 if ( epochsec == (time_t)-1 ) { 81 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );83 tabort( year, month, day, hour, min, sec, nsec ); 82 84 } // if 83 85 #endif // __CFA_DEBUG__ … … 85 87 #ifdef __CFA_DEBUG__ 86 88 if ( tv > 2147483647LL * TIMEGRAN ) { // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038. 87 abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );89 tabort( year, month, day, hour, min, sec, nsec ); 88 90 } // if 89 91 #endif // __CFA_DEBUG__ -
src/Parser/parser.yy
rce12e2b r7dc2e57b 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 28 17:06:37201913 // Update Count : 435 412 // Last Modified On : Sun Jul 14 07:54:30 2019 13 // Update Count : 4355 14 14 // 15 15 … … 678 678 679 679 argument_expression_list: 680 argument_expression 680 // empty 681 { $$ = nullptr; } 682 | argument_expression 681 683 | argument_expression_list ',' argument_expression 682 684 { $$ = (ExpressionNode *)( $1->set_last( $3 )); } … … 684 686 685 687 argument_expression: 686 // empty 687 { $$ = nullptr; } 688 | '@' // CFA, default parameter 688 '@' // CFA, default parameter 689 689 { SemanticError( yylloc, "Default parameter for argument is currently unimplemented." ); $$ = nullptr; } 690 690 // { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); } -
tests/math1.cfa
rce12e2b r7dc2e57b 10 10 // Created On : Fri Apr 22 14:59:21 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 12 12:04:56201913 // Update Count : 11 112 // Last Modified On : Sun Jul 14 10:16:45 2019 13 // Update Count : 112 14 14 // 15 15 … … 33 33 sout | quot | l; 34 34 sout | "div:" | div( 3.6F, 0.5F ) | div( 3.6D, 0.5D ) | div( 3.6L, 0.5L ); 35 sout | "fma:" | fma( 3.0F, -1.0F, 1.0F ) | fma( 3.0D, -1.0D, 1.0D ) | fma( 3.0L, -1.0L, ,1.0L );35 sout | "fma:" | fma( 3.0F, -1.0F, 1.0F ) | fma( 3.0D, -1.0D, 1.0D ) | fma( 3.0L, -1.0L, 1.0L ); 36 36 sout | "fdim:" | fdim( 1.0F, -1.0F ) | fdim( 1.0D, -1.0D ) | fdim( 1.0L, -1.0L ); 37 37 sout | "nan:" | (float)nan( "" ) | (double)nan( "" ) | (long double)nan( "" );
Note: See TracChangeset
for help on using the changeset viewer.