Changeset 90152a4 for tests/io2.c


Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
b7c89aa
Parents:
f9feab8 (diff), 305581d (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.
Message:

Merge branch 'master' into cleanup-dtors

File:
1 moved

Legend:

Unmodified
Added
Removed
  • tests/io2.c

    rf9feab8 r90152a4  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // io.c --
    8 // 
     6//
     7// io2.c --
     8//
    99// Author           : Peter A. Buhr
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 11 08:53:41 2017
    13 // Update Count     : 81
    14 // 
     12// Last Modified On : Thu May 24 21:17:41 2018
     13// Update Count     : 103
     14//
    1515
    16 #include <fstream>
     16#include <fstream.hfa>
     17
     18 #define xstr(s) str(s)
     19#define str(s) #s
    1720
    1821int main() {
    19         char c;                                                                                         // basic types
     22        _Bool b;                                                                                        // basic types
     23        char c;
    2024        signed char sc;
    2125        unsigned char usc;
     
    3741        char s1[size], s2[size];
    3842
    39         int x = 3, y = 5, z = 7;
    40         sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
    41         sout | 1 | 2 | 3 | endl;
    42         sout | '1' | '2' | '3' | endl;
    43         sout | 1 | "" | 2 | "" | 3 | endl;
    44         sout | endl;
    45 
    46         sout | "opening delimiters" | endl;
    47         sout
    48                 | "x (" | 1
    49                 | "x [" | 2
    50                 | "x {" | 3
    51                 | "x =" | 4
    52                 | "x $" | 5
    53                 | "x £" | 6
    54                 | "x ¥" | 7
    55                 | "x ¡" | 8
    56                 | "x ¿" | 9
    57                 | "x «" | 10
    58                 | endl | endl;
    59 
    60         sout | "closing delimiters" | endl;
    61         sout
    62                 | 1 | ", x"
    63                 | 2 | ". x"
    64                 | 3 | "; x"
    65                 | 4 | "! x"
    66                 | 5 | "? x"
    67                 | 6 | "% x"
    68                 | 7 | "¢ x"
    69                 | 8 | "» x"
    70                 | 9 | ") x"
    71                 | 10 | "] x"
    72                 | 11 | "} x"
    73                 | endl | endl;
    74 
    75         sout | "opening/closing delimiters" | endl;
    76         sout
    77                 | "x`" | 1 | "`x'" | 2
    78                 | "'x\"" | 3 | "\"x:" | 4
    79                 | ":x " | 5 | " x\t" | 6
    80                 | "\tx\f" | 7 | "\fx\v" | 8
    81                 | "\vx\n" | 9 | "\nx\r" | 10
    82                 | "\rx"
    83                 | endl | endl;
    84 
    85         sout | "override opening/closing delimiters" | endl;
    86         sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl;
    87         sout | endl;
    88 
    89         ifstream in;                                                                            // create / open file
    90         open( &in, "io.data", "r" );
     43        ifstream in = { xstr(IN_DIR) "io.data" };                                               // create / open file
    9144
    9245        sout | "input bacis types" | endl;
    93         &in | c | sc | usc                                                                      // character
    94                 | si | usi | i | ui | li | uli | lli | ulli             // integral
    95                 | f | d | ld                                                                    // floating point
    96                 | fc | dc | ldc                                                                 // floating-point complex
    97                 | cstr( s1 ) | cstr( s2, size );                                // C string, length unchecked and checked
     46        in       | b                                                                                    // boolean
     47                 | c | sc | usc                                                                 // character
     48                 | si | usi | i | ui | li | uli | lli | ulli    // integral
     49                 | f | d | ld                                                                   // floating point
     50                 | fc | dc | ldc                                                                // floating-point complex
     51                 | cstr( s1 ) | cstr( s2, size );                               // C string, length unchecked and checked
    9852        sout | endl;
    9953
    10054        sout | "output basic types" | endl;
    101         sout | c | ' ' | sc | ' ' | usc | endl                          // character
    102                 | si | usi | i | ui | li | uli | lli | ulli | endl // integral
    103                 | f | d | ld | endl                                                             // floating point
    104                 | fc | dc | ldc | endl;                                                 // complex
     55        sout | b | endl                                                                         // boolean
     56                 | c | ' ' | sc | ' ' | usc | endl                              // character
     57                 | si | usi | i | ui | li | uli | lli | ulli | endl // integral
     58                 | f | d | ld | endl                                                    // floating point
     59                 | fc | dc | ldc | endl;                                                // complex
    10560        sout | endl;
    10661
     
    11267        sout | "toggle separator" | endl;
    11368        sout | f | "" | d | "" | ld | endl                                      // floating point without separator
    114                 | sepDisable | fc | dc | ldc | endl                             // complex without separator
    115                 | fc | sepOn | dc | ldc | endl                                  // local separator add
    116                 | sepEnable | fc | dc | ldc | endl                              // complex with separator
    117                 | fc | sepOff | dc | ldc | endl                                 // local separator removal
    118                 | s1 | sepOff | s2 | endl                                               // local separator removal
    119                 | s1 | "" | s2 | endl;                                                  // local separator removal
     69                 | sepDisable | fc | dc | ldc | endl                    // complex without separator
     70                 | fc | sepOn | dc | ldc | endl                                 // local separator add
     71                 | sepEnable | fc | dc | ldc | endl                             // complex with separator
     72                 | fc | sepOff | dc | ldc | endl                                // local separator removal
     73                 | s1 | sepOff | s2 | endl                                              // local separator removal
     74                 | s1 | "" | s2 | endl;                                                 // local separator removal
    12075        sout | endl;
    12176
     
    12580        sout | " to \"" | sep | "\"" | endl;
    12681        sout | f | d | ld | endl
    127                 | fc | dc | ldc | endl
    128                 | s1 | s2 | endl
    129                 | t1 | t2 | endl;                                                               // print tuple
     82                 | fc | dc | ldc | endl
     83                 | s1 | s2 | endl
     84                 | t1 | t2 | endl;                                                              // print tuple
    13085        sout | endl;
    13186        sout | "from \"" | sep | "\" ";
     
    13388        sout | "to \"" | sep | "\"" | endl;
    13489        sout | f | d | ld | endl
    135                 | fc | dc | ldc | endl
    136                 | s1 | s2 | endl
    137                 | t1 | t2 | endl;                                                               // print tuple
     90                 | fc | dc | ldc | endl
     91                 | s1 | s2 | endl
     92                 | t1 | t2 | endl;                                                              // print tuple
    13893        sout | endl;
    13994
     
    179134// Local Variables: //
    180135// tab-width: 4 //
    181 // compile-command: "cfa io.c" //
     136// compile-command: "cfa io2.c" //
    182137// End: //
Note: See TracChangeset for help on using the changeset viewer.