Changes in / [7dc2e57b:ce12e2b]


Ignore:
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • doc/user/user.tex

    r7dc2e57b rce12e2b  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sat Jul 13 18:36:18 2019
    14 %% Update Count     : 3876
     13%% Last Modified On : Tue Jun 25 08:51:33 2019
     14%% Update Count     : 3871
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    26972697\subsection{Expressions}
    26982698
    2699 % Change order of expression evaluation.
    2700 % http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0145r2.pdf
    2701 
    27022699Multiple-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.
    27032700These notions are generalized to provide \CFA with \newterm{tuple expression}s and \newterm{tuple type}s.
     
    35093506
    35103507\item
    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.
     3508A separator does not appear before or after a null (empty) C string.
    35123509\begin{cfa}
    35133510sout | 1 | "" | 2 | "" | 3;
    35143511123
    35153512\end{cfa}
     3513which is a local mechanism to disable insertion of the separator character.
    35163514
    35173515\item
    35183516{\lstset{language=CFA,deletedelim=**[is][]{¢}{¢}}
    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.
     3517A seperator does not appear before a C string starting with the (extended) \Index*{ASCII}\index{ASCII!extended} characters: \lstinline[basicstyle=\tt]@,.;!?)]}%¢»@
    35203518\begin{cfa}[belowskip=0pt]
    35213519sout | 1 | ", x" | 2 | ". x" | 3 | "; x" | 4 | "! x" | 5 | "? x" | 6 | "% x"
     
    352535231®,® x 2®.® x 3®;® x 4®!® x 5®?® x 6®%® x 7§\color{red}\textcent§ x 8®»® x 9®)® x 10®]® x 11®}® x
    35263524\end{cfa}}%
    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.
     3525where \lstinline[basicstyle=\tt]@»@ is a closing citation mark.
     3526
     3527\item
     3528A separator does not appear after a C string ending with the (extended) \Index*{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off,basicstyle=\tt]@([{=$£¥¡¿«@
    35303529%$
    35313530\begin{cfa}[mathescape=off]
     
    35383537\end{cfa}
    35393538%$
     3539where \lstinline[basicstyle=\tt]@¡¿@ are inverted opening exclamation and question marks, and \lstinline[basicstyle=\tt]@«@ is an opening citation mark.
    35403540
    35413541\item
     
    36513651The tuple separator also responses to being turned on and off.
    36523652\begin{cfa}[belowskip=0pt]
    3653 sout | t1 | sepOff | t2; §\C{// turn off implicit separator for the next item
     3653sout | t1 | sepOff | t2; §\C{// locally turn on/off implicit separator
    36543654\end{cfa}
    36553655\begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt]
     
    36753675\subsection{Newline Manipulators}
    36763676
    3677 The following \Index{manipulators} control \Index{newline separation} for input and output.
     3677The following \Index{manipulator} controls \Index{newline separation} for input and output.
    36783678
    36793679For input:
     
    37733773
    37743774\item
    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.
     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.
    37773776\begin{cfa}[belowskip=0pt]
    37783777sout | nobase( bin( 27 ) ) | nobase( oct( 27 ) ) | nobase( hex( 27 ) );
  • libcfa/src/bits/debug.cfa

    r7dc2e57b rce12e2b  
    99// Author           : Thierry Delisle
    1010// Created On       : Thu Mar 30 12:30:01 2017
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 14 22:17:35 2019
    13 // Update Count     : 4
     11// Last Modified By :
     12// Last Modified On :
     13// Update Count     : 1
    1414//
    1515
     
    2323}
    2424
    25 enum { buffer_size = 4096 };
     25enum { buffer_size = 512 };
    2626static char buffer[ buffer_size ];
    2727
  • libcfa/src/fstream.cfa

    r7dc2e57b rce12e2b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 14 11:51:10 2019
    13 // Update Count     : 347
     12// Last Modified On : Fri Jul 12 12:03:53 2019
     13// Update Count     : 344
    1414//
    1515
     
    119119        #ifdef __CFA_DEBUG__
    120120        if ( file == 0 ) {
    121                 abort | IO_MSG "open output file \"" | name | "\"" | nl | strerror( errno );
     121                abort( IO_MSG "open output file \"%s\", %s", name, strerror( errno ) );
    122122        } // if
    123123        #endif // __CFA_DEBUG__
     
    133133
    134134        if ( fclose( (FILE *)(os.file) ) == EOF ) {
    135                 abort | IO_MSG "close output" | nl | strerror( errno );
     135                abort( IO_MSG "close output %s", strerror( errno ) );
    136136        } // if
    137137} // close
     
    139139ofstream & write( ofstream & os, const char * data, size_t size ) {
    140140        if ( fail( os ) ) {
    141                 abort | IO_MSG "attempt write I/O on failed stream";
     141                abort( "attempt write I/O on failed stream\n" );
    142142        } // if
    143143
    144144        if ( fwrite( data, 1, size, (FILE *)(os.file) ) != size ) {
    145                 abort | IO_MSG "write" | nl | strerror( errno );
     145                abort( IO_MSG "write %s", strerror( errno ) );
    146146        } // if
    147147        return os;
     
    154154        if ( len == EOF ) {
    155155                if ( ferror( (FILE *)(os.file) ) ) {
    156                         abort | IO_MSG "invalid write";
     156                        abort( "invalid write\n" );
    157157                } // if
    158158        } // if
     
    211211        #ifdef __CFA_DEBUG__
    212212        if ( file == 0 ) {
    213                 abort | IO_MSG "open input file \"" | name | "\"" | nl | strerror( errno );
     213                abort( IO_MSG "open input file \"%s\", %s\n", name, strerror( errno ) );
    214214        } // if
    215215        #endif // __CFA_DEBUG__
     
    225225
    226226        if ( fclose( (FILE *)(is.file) ) == EOF ) {
    227                 abort | IO_MSG "close input" | nl | strerror( errno );
     227                abort( IO_MSG "close input %s", strerror( errno ) );
    228228        } // if
    229229} // close
     
    231231ifstream & read( ifstream & is, char * data, size_t size ) {
    232232        if ( fail( is ) ) {
    233                 abort | IO_MSG "attempt read I/O on failed stream";
     233                abort( "attempt read I/O on failed stream\n" );
    234234        } // if
    235235
    236236        if ( fread( data, size, 1, (FILE *)(is.file) ) == 0 ) {
    237                 abort | IO_MSG "read" | nl | strerror( errno );
     237                abort( IO_MSG "read %s", strerror( errno ) );
    238238        } // if
    239239        return is;
     
    242242ifstream &ungetc( ifstream & is, char c ) {
    243243        if ( fail( is ) ) {
    244                 abort | IO_MSG "attempt ungetc I/O on failed stream";
     244                abort( "attempt ungetc I/O on failed stream\n" );
    245245        } // if
    246246
    247247        if ( ungetc( c, (FILE *)(is.file) ) == EOF ) {
    248                 abort | IO_MSG "ungetc" | nl | strerror( errno );
     248                abort( IO_MSG "ungetc %s", strerror( errno ) );
    249249        } // if
    250250        return is;
     
    258258        if ( len == EOF ) {
    259259                if ( ferror( (FILE *)(is.file) ) ) {
    260                         abort | IO_MSG "invalid read";
     260                        abort( "invalid read\n" );
    261261                } // if
    262262        } // if
  • libcfa/src/gmp.hfa

    r7dc2e57b rce12e2b  
    1010// Created On       : Tue Apr 19 08:43:43 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 13 15:25:05 2019
    13 // Update Count     : 27
     12// Last Modified On : Fri Jul 12 12:02:55 2019
     13// Update Count     : 26
    1414//
    1515
     
    4343        Int ?=?( Int & lhs, long int rhs ) { mpz_set_si( lhs.mpz, rhs ); return lhs; }
    4444        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 ) ) { abort | "invalid string conversion"; } 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; }
    4646
    4747        char ?=?( char & lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); lhs = val; return lhs; }
  • libcfa/src/interpose.cfa

    r7dc2e57b rce12e2b  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 14 22:57:16 2019
    13 // Update Count     : 116
     12// Last Modified On : Sat May  5 11:37:35 2018
     13// Update Count     : 111
    1414//
    1515
     
    8181//=============================================================================================
    8282
    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__ );
     83void sigHandler_segv ( __CFA_SIGPARMS__ );
     84void sigHandler_ill  ( __CFA_SIGPARMS__ );
     85void sigHandler_fpe  ( __CFA_SIGPARMS__ );
     86void sigHandler_abort( __CFA_SIGPARMS__ );
     87void sigHandler_term ( __CFA_SIGPARMS__ );
    8888
    8989struct {
     
    110110                __cfaabi_sigaction( SIGILL , sigHandler_ill  , SA_SIGINFO );
    111111                __cfaabi_sigaction( SIGFPE , sigHandler_fpe  , SA_SIGINFO );
    112                 __cfaabi_sigaction( SIGABRT, sigHandler_abrt, SA_SIGINFO | SA_RESETHAND);
     112                __cfaabi_sigaction( SIGABRT, sigHandler_abort, SA_SIGINFO | SA_RESETHAND);
    113113                __cfaabi_sigaction( SIGTERM, sigHandler_term , SA_SIGINFO );
    114114                __cfaabi_sigaction( SIGINT , sigHandler_term , SA_SIGINFO );
     
    204204                        if ( *p == '(' ) {
    205205                                name = p;
    206                         } else if ( *p == '+' ) {
     206                        }
     207                        else if ( *p == '+' ) {
    207208                                offset_begin = p;
    208                         } else if ( *p == ')' ) {
     209                        }
     210                        else if ( *p == ')' ) {
    209211                                offset_end = p;
    210212                                break;
     
    221223
    222224                        __cfaabi_dbg_bits_print_nolock( "(%i) %s : %s + %s %s\n", frameNo, messages[i], name, offset_begin, offset_end);
    223                 } else {                                                                                // otherwise, print the whole line
     225                }
     226                // otherwise, print the whole line
     227                else {
    224228                        __cfaabi_dbg_bits_print_nolock( "(%i) %s\n", frameNo, messages[i] );
    225229                }
     
    254258}
    255259
    256 void sigHandler_abrt( __CFA_SIGPARMS__ ) {
     260void sigHandler_abort( __CFA_SIGPARMS__ ) {
    257261        __cfaabi_backtrace();
    258262
  • libcfa/src/iostream.cfa

    r7dc2e57b rce12e2b  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 13 08:07:59 2019
    13 // Update Count     : 821
     12// Last Modified On : Fri Jul 12 12:04:13 2019
     13// Update Count     : 819
    1414//
    1515
     
    499499                                if ( ! f.flags.left ) { \
    500500                                        buf[i] = '.'; buf[i + 1] = '\0'; \
    501                                         if ( buf[0] == ' ' ) bufbeg = 1;        /* decimal point within width */ \
     501                                        if ( buf[0] == ' ' ) bufbeg = 1; /* decimal point within width */ \
    502502                                } else { \
    503503                                        for ( i = 0; i < len && buf[i] != ' '; i += 1 ); /* trailing blank ? */ \
     
    546546forall( dtype ostype | ostream( ostype ) ) {
    547547        ostype & ?|?( ostype & os, _Ostream_Manip(char) f ) {
    548                 if ( f.base != 'c' ) {                                                  // bespoke binary/octal/hex format
     548                if ( f.base != 'c' ) {                                                          // bespoke binary/octal/hex format
    549549                        _Ostream_Manip(unsigned char) fmtuc @= { f.val, f.wd, f.pc, f.base, {'\0'} };
    550550                        fmtuc.flags.pc = f.flags.pc;
     
    558558
    559559                #define CFMTNP "% * "
    560                 char fmtstr[sizeof(CFMTNP)];                                    // sizeof includes '\0'
     560                char fmtstr[sizeof(CFMTNP)];                                            // sizeof includes '\0'
    561561                memcpy( &fmtstr, CFMTNP, sizeof(CFMTNP) );
    562                 int star = 1;                                                                   // position before first '*'
     562                int star = 1;                                                                           // position before first '*'
    563563
    564564                // Insert flags into spaces before '*', from right to left.
     
    566566                fmtstr[star] = '%';
    567567
    568                 fmtstr[sizeof(CFMTNP)-2] = f.base;                              // sizeof includes '\0'
     568                fmtstr[sizeof(CFMTNP)-2] = f.base;                                      // sizeof includes '\0'
    569569                // printf( "%d %s\n", f.wd, &fmtstr[star] );
    570570                fmt( os, &fmtstr[star], f.wd, f.val );
     
    631631                else {
    632632                        fprintf( stderr, "invalid Boolean constant\n" );
    633                         abort();                                                                        // cannot use abort stream
     633                        abort();
    634634                } // if
    635635                return is;
     
    639639                char temp;
    640640                for () {
    641                         fmt( is, "%c", &temp );                                         // must pass pointer through varg to fmt
     641                        fmt( is, "%c", &temp );                                                 // must pass pointer through varg to fmt
    642642                        // do not overwrite parameter with newline unless appropriate
    643643                        if ( temp != '\n' || getANL( is ) ) { c = temp; break; }
     
    773773        if ( ! f.s ) {
    774774                // printf( "skip %s %d\n", f.scanset, f.wd );
    775                 if ( f.wd == -1 ) fmt( is, f.scanset, "" );             // no input arguments
     775                if ( f.wd == -1 ) fmt( is, f.scanset, "" ); // no input arguments
    776776                else for ( f.wd ) fmt( is, "%*c" );
    777777                return is;
  • libcfa/src/rational.cfa

    r7dc2e57b rce12e2b  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 12 18:12:08 2019
    13 // Update Count     : 184
     12// Last Modified On : Fri Jul 12 12:02:36 2019
     13// Update Count     : 183
    1414//
    1515
     
    3535        static RationalImpl simplify( RationalImpl & n, RationalImpl & d ) {
    3636                if ( d == (RationalImpl){0} ) {
    37                         abort | "Invalid rational number construction: denominator cannot be equal to 0.";
     37                        abort( "Invalid rational number construction: denominator cannot be equal to 0.\n" );
    3838                } // exit
    3939                if ( d < (RationalImpl){0} ) { d = -d; n = -n; } // move sign to numerator
  • libcfa/src/time.cfa

    r7dc2e57b rce12e2b  
    1010// Created On       : Tue Mar 27 13:33:14 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 13 08:41:55 2019
    13 // Update Count     : 65
     12// Last Modified On : Fri Jul 12 12:03:19 2019
     13// Update Count     : 59
    1414//
    1515
    1616#include "time.hfa"
    17 #include "fstream.hfa"
     17#include "iostream.hfa"
    1818#include <stdio.h>                                                                              // snprintf
    1919#include <assert.h>
     
    5252
    5353#ifdef __CFA_DEBUG__
    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
     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."
    5856#endif // __CFA_DEBUG__
    5957
     
    6563#ifdef __CFA_DEBUG__
    6664        if ( month < 1 || 12 < month ) {
    67                 tabort( year, month, day, hour, min, sec, nsec );
     65                abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );
    6866        } // if
    6967#endif // __CFA_DEBUG__
     
    7169#ifdef __CFA_DEBUG__
    7270        if ( day < 1 || 31 < day ) {
    73                 tabort( year, month, day, hour, min, sec, nsec );
     71                abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );
    7472        } // if
    7573#endif // __CFA_DEBUG__
     
    8179#ifdef __CFA_DEBUG__
    8280        if ( epochsec == (time_t)-1 ) {
    83                 tabort( year, month, day, hour, min, sec, nsec );
     81                abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );
    8482        } // if
    8583#endif // __CFA_DEBUG__
     
    8785#ifdef __CFA_DEBUG__
    8886        if ( tv > 2147483647LL * TIMEGRAN ) {                           // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038.
    89                 tabort( year, month, day, hour, min, sec, nsec );
     87                abort( CreateFmt, year, month, day, hour, (int)min, sec, nsec );
    9088        } // if
    9189#endif // __CFA_DEBUG__
  • src/Parser/parser.yy

    r7dc2e57b rce12e2b  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 14 07:54:30 2019
    13 // Update Count     : 4355
     12// Last Modified On : Tue May 28 17:06:37 2019
     13// Update Count     : 4354
    1414//
    1515
     
    678678
    679679argument_expression_list:
     680        argument_expression
     681        | argument_expression_list ',' argument_expression
     682                { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
     683        ;
     684
     685argument_expression:
    680686        // empty
    681687                { $$ = nullptr; }
    682         | argument_expression
    683         | argument_expression_list ',' argument_expression
    684                 { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
    685         ;
    686 
    687 argument_expression:
    688         '@'                                                                                                     // CFA, default parameter
     688        | '@'                                                                                           // CFA, default parameter
    689689                { SemanticError( yylloc, "Default parameter for argument is currently unimplemented." ); $$ = nullptr; }
    690690                // { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); }
  • tests/math1.cfa

    r7dc2e57b rce12e2b  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 14 10:16:45 2019
    13 // Update Count     : 112
     12// Last Modified On : Fri Jul 12 12:04:56 2019
     13// Update Count     : 111
    1414//
    1515
     
    3333        sout | quot | l;
    3434        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 );
    3636        sout | "fdim:" | fdim( 1.0F, -1.0F ) | fdim( 1.0D, -1.0D ) | fdim( 1.0L, -1.0L );
    3737        sout | "nan:" | (float)nan( "" ) | (double)nan( "" ) | (long double)nan( "" );
Note: See TracChangeset for help on using the changeset viewer.