Changes in / [7cd8827:5a5d31a]


Ignore:
Location:
examples
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • examples/Tuple.c

    r7cd8827 r5a5d31a  
    11int f( int, int );
    22int g( int, int, int );
    3 static
    4 [ int, int *, * int, int ] h( int a, int b, * int c, [] char d );
     3static [ int, int *, * int, int ] h( int a, int b, * int c, [] char d );
    54
    65struct inner {
     
    1514
    1615const volatile [ int, int ] t1;
    17 static const [ int, int ] t2;
     16static const [ int, const int ] t2;
    1817const static [ int, const int ] t3;
    1918
     
    2221
    2322[ short x, unsigned y ] f1( int w ) {
    24 //      return [ y, x ] = [ x, y ] = [ w, 23 ];
     23        [ y, x ] = [ x, y ] = [ w, 23 ];
    2524}
    2625
    2726[ [ int, char, long, int ] r ] g1() {
    28         short int x, p;
     27        short x, p;
    2928        unsigned int y;
    3029        [ int, int ] z;
    3130
    32         [ x, y, z ] = [ p, f( 17, 18 ), 4, 3 ];
    33 //      [ x, y, z ] = ([short, unsigned int, [int, int]])([ p, f( 17, 18 ), 4, 3 ]);
     31        [ x, y, z ] = [ p, f( 17 ), 3 ];
     32        [ x, y, z ] = ([short, unsigned int, [int, int]])([ p, f( 17 ), 3 ]);
    3433        r = [ x, y, z ];
    3534}
     
    3736[ int rc ] main( int argc, ** char argv ) {
    3837        int a, b, c, d;
    39 //      struct outer t = { .[ f1, f4 ] : [ 1, 7.0 ] };
     38        struct outer t = { .[ f1,f4 ] : [ 1,7.0 ] };
    4039        f( [ 3,5 ] );
    4140        g( [ 3,5 ], 3 );
     
    4342        g( t1, 3 );
    4443
    45 //      [ , , , ];                                              /* empty tuple */
     44        [ , , , ];                                              /* empty tuple */
    4645        [ 3, 5 ];
    4746        [ a, b ] = 3;
    48 //      [ a, b ] = [ 4.6 ];
    49         [ a, b ] = 4.6;
     47        [ a, b ] = [ 4.6 ];
    5048        [ a, b ] = [ c, d ] = [ 3, 5 ];
    51 //      [ a, b, [ c ] ] = [ 2, [ a, b ] ];
    52         [ a, b, c ] = [ 2, [ a, b ] ];
     49        [ a, b, [ c ] ] = [ 2,[ a, b ] ];
    5350        [ a, b ] = 3 > 4 ? [ b, 6 ] : [ 7, 8 ];
    5451
     
    5956        [ a, b ] = t1 = [ c, d ];
    6057        [ a, b ] = t1 = t2 = [ c, d ];
    61 //      t1 = [ 3, 4 ] = [ 3, 4 ] = t1 = [ 3, 4 ];
     58        t1 = [ 3, 4 ] = [ 3, 4 ] = t1 = [ 3, 4 ];
    6259
    6360        s.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ];
    64 //      s.[ f1, i.[ f2, f3 ], f4 ] = h( 3, 3, (* int)0, "abc" );
    65 //      [ a, , b, ] = h( 3, 3, 0, "abc" );                      /* ignore some results */
    66         sp->[ f4, f1 ] = sp->[ f1, f4 ];
     61        s.[ f1, i.[ f2, f3 ], f4 ] = h( 3, 3, 0, "abc" );
     62        [ a, , b, ] = h( 3, 3, 0, "abc" );                      /* ignore some results */
     63        sp->[ f4,f1 ] = sp->[ f1, f4 ];
    6764        printf( "expecting 3, 17, 23, 4; got %d, %d, %d, %d\n", s.[ f4, i.[ f3, f2 ], f1 ] );
    6865        rc = 0;
  • examples/includes.c

    r7cd8827 r5a5d31a  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Nov 15 23:06:24 2017
    13 // Update Count     : 597
     12// Last Modified On : Tue Jul 12 17:59:25 2016
     13// Update Count     : 371
    1414//
    1515
     
    2222#endif // __CFA__
    2323
     24#if 0
    2425#if 1
    2526#define _GNU_SOURCE
     27#include <aio.h>
    2628#include <a.out.h>
    27 #include <aio.h>
    2829#include <aliases.h>
    2930#include <alloca.h>
     
    3334#include <argz.h>
    3435#include <assert.h>
    35 //#include <bfd.h>
    36 // #include <bfdlink.h>                         // keyword with
     36#include <bfd.h>
     37#include <bfdlink.h>
    3738#include <byteswap.h>
    38 #include <bzlib.h>
    3939#include <cblas.h>
    4040#include <cblas_f77.h>
    4141#include <complex.h>
    42 #include <com_err.h>
    4342#include <cpio.h>
    4443#include <crypt.h>
    4544#include <ctype.h>
    4645#include <curses.h>
     46//#include <demangle.h>
    4747#include <dialog.h>
    4848#include <dirent.h>
    4949#include <dis-asm.h>
     50#endif
     51#if 0
    5052#include <dlfcn.h>
    5153#include <dlg_colors.h>
     
    6163#include <evdns.h>
    6264#include <event.h>
    63 
    64 // #include <evhttp.h>
    65 // #include <sys/queue.h>
    66 // #include <evrpc.h>                                   // evrpc.h depends on sys/queue.h
    67 // #include <evutil.h>
    68 // #include <execinfo.h>
    69 // #include <expat.h>
    70 // #include <expat_config.h>
    71 // #include <expat_external.h>
    72 // #include <fcntl.h>
    73 // #include <features.h>
    74 // #include <fenv.h>
    75 // #include <fmtmsg.h>
    76 // #include <fnmatch.h>
    77 // #include <form.h>
    78 // #include <fpu_control.h>
    79 // #include <fstab.h>
    80 // #include <fts.h>
    81 // #include <ftw.h>
    82 // #include <gconv.h>
    83 // #include <getopt.h>
    84 // #include <gettext-po.h>
    85 // #include <glob.h>
    86 // #include <gmp.h>
    87 // #include <gnu-versions.h>
    88 // #include <grp.h>
    89 // #include <gshadow.h>
    90 // #include <gssapi.h>
    91 // #include <hwloc.h>                                   // keyword thread (setjmp)
    92 // #include <iconv.h>
    93 // #include <idna.h>
    94 // #include <idn-free.h>
    95 // #include <idn-int.h>
    96 // #include <idn-int.h>
    97 // #include <ifaddrs.h>
    98 // #include <inttypes.h>
    99 // #include <jerror.h>
    100 
     65#include <evhttp.h>
     66#endif
     67#if 0
     68#include <evrpc.h>
     69#include <evutil.h>
     70#include <execinfo.h>
     71#include <expat.h>
     72#include <expat_config.h>
     73#include <expat_external.h>
     74#include <fcntl.h>
     75#include <features.h>
     76#include <fenv.h>
     77#include <float.h>
     78#include <fmtmsg.h>
     79#include <fnmatch.h>
     80#include <form.h>
     81#include <fpu_control.h>
     82#include <fstab.h>
     83//#include <ft2build.h>
     84#include <fts.h>
     85#include <ftw.h>
     86#include <gconv.h>
     87//#include <gcrypt.h>
     88//#include <gcrypt-module.h>
     89#include <getopt.h>
     90//#include <gettext-po.h>
     91#include <glob.h>
     92//#include <gmp.h>                      // infinite loop
     93////#include <gmpxx.h>
     94//#include <gmp-x86_64.h>
     95#include <gnu-versions.h>
     96//#include <gpg-error.h>
     97#include <grp.h>
     98#include <gshadow.h>
     99#include <iconv.h>
     100#include <idna.h>
     101#include <idn-free.h>
     102#include <idn-int.h>
     103#include <ieee754.h>
     104#include <ifaddrs.h>
     105#include <inttypes.h>
     106#include <iso646.h>
     107#include <jerror.h>
    101108//#include <jmorecfg.h>
    102109//#include <jpegint.h>
    103 // #include <jpeglib.h>
    104 // #include <kdb.h>
    105 // #include <krb5.h>                                    // keyword enable
    106 // #include <langinfo.h>
    107 // #include <lastlog.h>
    108 // #include <lber.h>
    109 // #include <lber_types.h>
    110 // #include <ldap.h>
    111 // #include <ldap_cdefs.h>
    112 // #include <ldap_features.h>
    113 // #include <ldap_schema.h>
    114 // #include <ldap_utf8.h>
    115 // #include <ldif.h>
    116 // #include <libgen.h>
    117 // #include <libintl.h>
    118 // #include <libio.h>
    119 // #include <libtasn1.h>
    120 // #include <libudev.h>
    121 // #include <limits.h>
    122 // #include <link.h>
    123 // #include <locale.h>
    124 // #include <ltdl.h>
    125 // #include <lzma.h>
    126 // #include <malloc.h>
    127 // #include <math.h>
    128 // #include <mcheck.h>
    129 // #include <memory.h>
    130 // #include <menu.h>
    131 // #include <mntent.h>
    132 // #include <monetary.h>
    133 // #include <mqueue.h>
    134 // #include <ncurses.h>
    135 // #include <ncurses_dll.h>
    136 // #include <nc_tparm.h>
    137 // #include <netdb.h>
    138 // #include <nl_types.h>
    139 // #include <nss.h>
    140 // #include <numa.h>
    141 // #include <numacompat1.h>
    142 // #include <numaif.h>
    143 // #include <obstack.h>
    144 // #include <panel.h>
    145 // #include <paths.h>
    146 // #include <pciaccess.h>
    147 // #include <pcre.h>
    148 // //#include <pcreposix.h>                     // conflicts with regex.h
    149 // #include <plugin-api.h>
    150 // #include <png.h>                                                                             // setjmp
    151 // #include <pngconf.h>                                                                 // setjmp
    152 // #include <poll.h>
    153 // #include <pr29.h>
    154 // #include <printf.h>
    155 // #include <profile.h>
    156 // #include <pthread.h>                                                                 // setjmp
    157 // #include <pty.h>
    158 // #include <punycode.h>
    159 // #include <pwd.h>
    160 // #define INIT ;                                               // needed for regex.h
    161 // #define GETC() 'a'
    162 // #define PEEKC() 'a'
    163 // #define UNGETC( c ) ;
    164 // #define RETURN( ptr ) ;
    165 // #define ERROR( val ) ;
    166 // #include <regex.h>
    167 // //#include <regexp.h>                                // GNU C Library no longer implements
    168 // #include <resolv.h>
    169 // #include <re_comp.h>
    170 // #include <sched.h>
    171 // #include <search.h>
    172 // #include <semaphore.h>
    173 // #include <setjmp.h>
    174 // #include <sgtty.h>
    175 // #include <shadow.h>
    176 // #include <signal.h>
    177 // #include <spawn.h>
    178 // #include <stab.h>
    179 // #include <stdatomic.h>
    180 // #include <stdarg.h>
    181 // #include <stdbool.h>
    182 // #include <stdint.h>
    183 // #include <stddef.h>
    184 // #include <stdio.h>
    185 // #include <stdio_ext.h>
    186 // #include <stdlib.h>
    187 // #include <string.h>
    188 // #include <stringprep.h>
    189 // #include <strings.h>
    190 // #include <stropts.h>
    191 // #include <sudo_plugin.h>
    192 // #include <symcat.h>
    193 // #include <syscall.h>
    194 // #include <sysexits.h>
    195 // #include <syslog.h>
    196 // #include <tar.h>
    197 // #include <term.h>
    198 // #include <termcap.h>
    199 // #include <termio.h>
    200 // #include <termios.h>
    201 // //#include <term_entry.h>
    202 // #include <tgmath.h>
    203 // #include <thread_db.h>                       // CFA bug
    204 // #include <tic.h>
    205 // #include <time.h>
    206 // #include <tld.h>
    207 // #include <ttyent.h>
    208 // #include <turbojpeg.h>
    209 // #include <ucontext.h>
    210 // #include <ulimit.h>
    211 // #include <unctrl.h>
    212 // #include <unistd.h>
    213 // #include <ustat.h>
    214 // #include <utime.h>
    215 // #include <utmp.h>
    216 // #include <utmpx.h>
    217 // #include <wait.h>
    218 // #include <wchar.h>
    219 // #include <wctype.h>
    220 // #include <wordexp.h>
    221 // #include <xlocale.h>
    222 // #include <values.h>
    223 // #include <zconf.h>
    224 // #include <zlib.h>
    225 // #include <_G_config.h>
    226 
    227 // #include <jpeglib.h>                         // after stdlib.h/stdio.h
    228 // #include <jpegint.h>
    229 // #include <jmorecfg.h>
    230 #if 0
     110//#include <jpeglib.h>
     111#include <limits.h>
     112#include <locale.h>
     113#include <math.h>
     114#include <ncurses.h>
     115#include <setjmp.h>
     116#include <signal.h>
     117#include <stdarg.h>
     118#include <stdbool.h>
     119#include <stddef.h>
     120#include <stdlib.h>
     121#include <stdio.h>
     122#include <string.h>
     123#include <tgmath.h>
     124#include <time.h>
     125#include <unistd.h>
     126#include <wchar.h>
     127#include <wctype.h>
    231128#endif // 0
    232129
     
    234131
    235132#define _GNU_SOURCE
     133//#include <bfd.h>
     134//#include <error.h>
    236135
    237 #include <setjmp.h>
     136#include <demangle.h>
    238137
    239138#endif // 0
  • examples/twice.c

    r7cd8827 r5a5d31a  
    77// twice.c --
    88//
    9 // Author           : Peter A. Buhr
     9// Author           : Richard C. Bilson
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct 19 21:52:57 2017
    13 // Update Count     : 46
     12// Last Modified On : Tue Mar  8 22:04:58 2016
     13// Update Count     : 16
    1414//
    1515
    1616#include <fstream.hfa>
    1717
    18 forall( otype T | { T ?+?( T, T ); } )
     18forall( otype T | { T ?+?( T, T ); T ?++( T * ); [T] ?+=?( T *, T ); } )
    1919T twice( const T t ) {
    2020        return t + t;
    2121}
    2222
    23 // char does not have addition
    24 char ?+?( char op1, char op2 ) { return (int)op1 + op2; } // cast forces integer addition or recursion
     23int main( void ) {
     24        // char does not have addition
     25        char ?+?( char op1, char op2 ) { return (int)op1 + op2; } // cast forces integer addition or recursion
     26        char ++?( char *op ) { *op += 1; return *op; }
     27        char ?++( char *op ) { char temp = *op; *op += 1; return temp; }
    2528
    26 // signed char does not have addition
    27 signed char ?+?( signed char op1, signed char op2 ) { return (int)op1 + op2; } // cast forces integer addition or recursion
    28 
    29 int main( void ) {
    30         sout | twice( ' ' ) | ' ' | twice( (signed char)0 ) | twice( (int)1 ) | twice( 3.2 ) | endl;
     29        sout | twice( 'a' ) | ' ' | twice( 1 ) | twice( 3.2 ) | endl;
    3130}
    3231
Note: See TracChangeset for help on using the changeset viewer.