ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        with_gc
      
      
        
          | Last change
 on this file since fdfced6 was             f4e3419d, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago | 
        
          | 
restructure paper documents
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            787 bytes | 
      
      
| Rev | Line |  | 
|---|
| [0d10090] | 1 | #include <stdio.h> | 
|---|
| [c87cd93] | 2 | #include "cfa-pair.h" | 
|---|
| [0d10090] | 3 | #include "cfa-print.h" | 
|---|
|  | 4 |  | 
|---|
|  | 5 | forall(otype T, ttype Params | { void print(FILE*, T); void print(FILE*, Params); }) | 
|---|
|  | 6 | void print(FILE* out, T arg, Params rest) { | 
|---|
|  | 7 | print(out, arg); | 
|---|
|  | 8 | print(out, rest); | 
|---|
|  | 9 | } | 
|---|
|  | 10 |  | 
|---|
|  | 11 | void print(FILE* out, const char* x) { fprintf(out, "%s", x); } | 
|---|
|  | 12 |  | 
|---|
|  | 13 | void print(FILE* out, _Bool x) { fprintf(out, "%s", x ? "true" : "false"); } | 
|---|
|  | 14 |  | 
|---|
|  | 15 | void print(FILE* out, char x) { | 
|---|
|  | 16 | if ( 0x20 <= x && x <= 0x7E ) { fprintf(out, "'%c'", x); } | 
|---|
|  | 17 | else { fprintf(out, "'\\%x'", x); } | 
|---|
|  | 18 | } | 
|---|
|  | 19 |  | 
|---|
|  | 20 | void print(FILE* out, int x) { fprintf(out, "%d", x); } | 
|---|
|  | 21 |  | 
|---|
|  | 22 | forall(otype R, otype S | { void print(FILE*, R); void print(FILE*, S); }) | 
|---|
|  | 23 | void print(FILE* out, pair(R, S) x) { | 
|---|
|  | 24 | fprintf(out, "["); | 
|---|
|  | 25 | print(out, x.first); | 
|---|
|  | 26 | fprintf(out, ", "); | 
|---|
|  | 27 | print(out, x.second); | 
|---|
|  | 28 | fprintf(out, "]"); | 
|---|
|  | 29 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.