Changeset 6c12fd28


Ignore:
Timestamp:
May 8, 2020, 2:42:45 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
5c581cc
Parents:
dd4e2d7 (diff), 0dedf027 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
3 added
1 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • doc/bibliography/pl.bib

    rdd4e2d7 r6c12fd28  
    47594759    contributer = {pabuhr@plg},
    47604760    author      = {Gregory R. Andrews},
    4761     title       = {A Method for Solving Synronization Problems},
     4761    title       = {A Method for Solving Synchronization Problems},
    47624762    journal     = scp,
    47634763    volume      = 13,
  • libcfa/configure

    rdd4e2d7 r6c12fd28  
    790790enable_distcc
    791791with_cfa_name
     792enable_static
    792793enable_shared
    793 enable_static
    794794with_pic
    795795enable_fast_install
     
    14521452  --disable-silent-rules  verbose build output (undo: "make V=0")
    14531453  --enable-distcc     whether or not to enable distributed compilation
     1454  --enable-static[=PKGS]  build static libraries [default=no]
    14541455  --enable-shared[=PKGS]  build shared libraries [default=yes]
    1455   --enable-static[=PKGS]  build static libraries [default=yes]
    14561456  --enable-fast-install[=PKGS]
    14571457                          optimize for fast installation [default=yes]
     
    80308030
    80318031# Set options
     8032# Check whether --enable-static was given.
     8033if test "${enable_static+set}" = set; then :
     8034  enableval=$enable_static; p=${PACKAGE-default}
     8035    case $enableval in
     8036    yes) enable_static=yes ;;
     8037    no) enable_static=no ;;
     8038    *)
     8039     enable_static=no
     8040      # Look at the argument we got.  We use all the common list separators.
     8041      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
     8042      for pkg in $enableval; do
     8043        IFS=$lt_save_ifs
     8044        if test "X$pkg" = "X$p"; then
     8045          enable_static=yes
     8046        fi
     8047      done
     8048      IFS=$lt_save_ifs
     8049      ;;
     8050    esac
     8051else
     8052  enable_static=no
     8053fi
     8054
     8055
     8056
     8057
     8058
     8059
     8060
    80328061
    80338062
     
    80628091fi
    80638092
    8064 
    8065 
    8066 
    8067 
    8068 
    8069 
    8070 
    8071 
    8072   # Check whether --enable-static was given.
    8073 if test "${enable_static+set}" = set; then :
    8074   enableval=$enable_static; p=${PACKAGE-default}
    8075     case $enableval in
    8076     yes) enable_static=yes ;;
    8077     no) enable_static=no ;;
    8078     *)
    8079      enable_static=no
    8080       # Look at the argument we got.  We use all the common list separators.
    8081       lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
    8082       for pkg in $enableval; do
    8083         IFS=$lt_save_ifs
    8084         if test "X$pkg" = "X$p"; then
    8085           enable_static=yes
    8086         fi
    8087       done
    8088       IFS=$lt_save_ifs
    8089       ;;
    8090     esac
    8091 else
    8092   enable_static=yes
    8093 fi
    80948093
    80958094
     
    1772817727macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
    1772917728macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
     17729enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
    1773017730enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
    17731 enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
    1773217731pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
    1773317732enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
     
    1885718856macro_revision=$macro_revision
    1885818857
     18858# Whether or not to build static libraries.
     18859build_old_libs=$enable_static
     18860
    1885918861# Whether or not to build shared libraries.
    1886018862build_libtool_libs=$enable_shared
    18861 
    18862 # Whether or not to build static libraries.
    18863 build_old_libs=$enable_static
    1886418863
    1886518864# What type of objects to build.
  • libcfa/configure.ac

    rdd4e2d7 r6c12fd28  
    109109
    110110# Checks for programs.
    111 LT_INIT
     111LT_INIT([disable-static])
    112112
    113113AC_PROG_CXX
  • libcfa/src/bits/locks.hfa

    rdd4e2d7 r6c12fd28  
    115115                char * strerror(int);
    116116        }
    117         #define CHECKED(x) { int err = x; if( err != 0 ) abort("KERNEL ERROR: %s\n", strerror(err)); }
     117        #define CHECKED(x) { int err = x; if( err != 0 ) abort("KERNEL ERROR: Operation \"" #x "\" return error %d - %s\n", err, strerror(err)); }
    118118
    119119        struct __bin_sem_t {
  • libcfa/src/concurrency/kernel.cfa

    rdd4e2d7 r6c12fd28  
    901901        // Wake them up
    902902        __cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this->idles.head);
     903        /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
    903904        post( this->idles.head->idle );
    904905
     
    911912static bool __wake_proc(processor * this) {
    912913        __cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this);
    913         return post( this->idle );
     914
     915        disable_interrupts();
     916                /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
     917                bool ret = post( this->idle );
     918        enable_interrupts( __cfaabi_dbg_ctx );
     919
     920        return ret;
    914921}
    915922
  • libcfa/src/heap.cfa

    rdd4e2d7 r6c12fd28  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Apr 18 17:43:15 2020
    13 // Update Count     : 718
     12// Last Modified On : Wed May  6 17:29:26 2020
     13// Update Count     : 727
    1414//
    1515
     
    1919#include <errno.h>                                                                              // errno
    2020#include <string.h>                                                                             // memset, memcpy
     21#include <limits.h>                                                                             // ULONG_MAX
    2122extern "C" {
    2223#include <sys/mman.h>                                                                   // mmap, munmap
    2324} // extern "C"
    2425
    25 // #comment TD : Many of these should be merged into math I believe
    2626#include "bits/align.hfa"                                                               // libPow2
    2727#include "bits/defs.hfa"                                                                // likely, unlikely
     
    3030//#include "stdlib.hfa"                                                                 // bsearchl
    3131#include "malloc.h"
     32#include "bitmanip.hfa"                                                                 // ceiling
    3233
    3334#define MIN(x, y) (y > x ? x : y)
     
    8182};
    8283
     84size_t default_heap_expansion() __attribute__(( weak )) {
     85        return __CFA_DEFAULT_HEAP_EXPANSION__;
     86} // default_heap_expansion
     87
    8388size_t default_mmap_start() __attribute__(( weak )) {
    8489        return __CFA_DEFAULT_MMAP_START__;
    8590} // default_mmap_start
    86 
    87 size_t default_heap_expansion() __attribute__(( weak )) {
    88         return __CFA_DEFAULT_HEAP_EXPANSION__;
    89 } // default_heap_expansion
    9091
    9192
     
    360361
    361362
    362 static inline bool setHeapExpand( size_t value ) {
    363   if ( heapExpand < pageSize ) return true;
    364         heapExpand = value;
    365         return false;
    366 } // setHeapExpand
    367 
    368 
    369363// thunk problem
    370364size_t Bsearchl( unsigned int key, const unsigned int * vals, size_t dim ) {
     
    383377
    384378static inline bool setMmapStart( size_t value ) {               // true => mmapped, false => sbrk
    385   if ( value < pageSize || bucketSizes[NoBucketSizes - 1] < value ) return true;
     379  if ( value < pageSize || bucketSizes[NoBucketSizes - 1] < value ) return false;
    386380        mmapStart = value;                                                                      // set global
    387381
     
    390384        assert( maxBucketsUsed < NoBucketSizes );                       // subscript failure ?
    391385        assert( mmapStart <= bucketSizes[maxBucketsUsed] ); // search failure ?
    392         return false;
     386        return true;
    393387} // setMmapStart
    394388
     
    449443
    450444        #ifdef __CFA_DEBUG__
    451         checkHeader( addr < heapBegin || header < (HeapManager.Storage.Header *)heapBegin, name, addr ); // bad low address ?
     445        checkHeader( addr < heapBegin, name, addr );            // bad low address ?
    452446        #endif // __CFA_DEBUG__
    453447
     
    508502        // along with the block and is a multiple of the alignment size.
    509503
    510   if ( unlikely( size > ~0ul - sizeof(HeapManager.Storage) ) ) return 0p;
     504  if ( unlikely( size > ULONG_MAX - sizeof(HeapManager.Storage) ) ) return 0p;
    511505        size_t tsize = size + sizeof(HeapManager.Storage);
    512506        if ( likely( tsize < mmapStart ) ) {                            // small size => sbrk
     
    560554                block->header.kind.real.home = freeElem;                // pointer back to free list of apropriate size
    561555        } else {                                                                                        // large size => mmap
    562   if ( unlikely( size > ~0ul - pageSize ) ) return 0p;
     556  if ( unlikely( size > ULONG_MAX - pageSize ) ) return 0p;
    563557                tsize = libCeiling( tsize, pageSize );                  // must be multiple of page size
    564558                #ifdef __STATISTICS__
     
    702696        #endif // FASTLOOKUP
    703697
    704         if ( setMmapStart( default_mmap_start() ) ) {
     698        if ( ! setMmapStart( default_mmap_start() ) ) {
    705699                abort( "HeapManager : internal error, mmap start initialization failure." );
    706700        } // if
     
    708702
    709703        char * end = (char *)sbrk( 0 );
    710         sbrk( (char *)libCeiling( (long unsigned int)end, libAlign() ) - end ); // move start of heap to multiple of alignment
    711         heapBegin = heapEnd = sbrk( 0 );                                        // get new start point
     704        heapBegin = heapEnd = sbrk( (char *)libCeiling( (long unsigned int)end, libAlign() ) - end ); // move start of heap to multiple of alignment
    712705} // HeapManager
    713706
     
    735728        //assert( heapManager.heapBegin != 0 );
    736729        //heapManager{};
    737         if ( heapManager.heapBegin == 0p ) heapManager{};
     730        if ( heapManager.heapBegin == 0p ) heapManager{};       // sanity check
    738731} // memory_startup
    739732
     
    863856                #endif // __STATISTICS__
    864857
    865                 size_t size = dim * elemSize;
    866                 char * addr = (char *)mallocNoStats( size );
    867           if ( unlikely( addr == 0p ) ) return 0p;
    868 
    869                 HeapManager.Storage.Header * header;
    870                 HeapManager.FreeHeader * freeElem;
    871                 size_t bsize, alignment;
    872                 headers( "aalloc", addr, header, freeElem, bsize, alignment );
    873 
    874                 header->kind.real.blockSize |= 2;                               // mark as zero filled
    875                 return addr;
     858                return mallocNoStats( dim * elemSize );
    876859        } // aalloc
    877860
     
    914897       
    915898                // change size, DO NOT preserve STICKY PROPERTIES.
     899                free( oaddr );
    916900                void * naddr = mallocNoStats( size );                   // create new area
    917                 free( oaddr );
    918901                return naddr;
    919902        } // resize
     
    988971                #endif // __STATISTICS__
    989972
    990                 size_t size = dim * elemSize;
    991                 char * addr = (char *)memalignNoStats( alignment, size );
    992           if ( unlikely( addr == 0p ) ) return 0p;
    993                 HeapManager.Storage.Header * header;
    994                 HeapManager.FreeHeader * freeElem;
    995                 size_t bsize;
    996                 headers( "amemalign", addr, header, freeElem, bsize, alignment );
    997 
    998                 header->kind.real.blockSize |= 2;                               // mark as zero filled
    999                 return addr;
     973                return memalignNoStats( alignment, dim * elemSize );
    1000974        } // amemalign
    1001975
     
    10431017
    10441018        // Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc()
    1045         // or realloc().  Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is
     1019        // or realloc().  Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is
    10461020        // 0p, no operation is performed.
    10471021        void free( void * addr ) {
     
    11701144
    11711145
    1172         // Adjusts parameters that control the behavior of the memory-allocation functions (see malloc). The param argument
     1146        // Adjusts parameters that control the behaviour of the memory-allocation functions (see malloc). The param argument
    11731147        // specifies the parameter to be modified, and value specifies the new value for that parameter.
    11741148        int mallopt( int option, int value ) {
    11751149                choose( option ) {
    11761150                  case M_TOP_PAD:
    1177                         if ( setHeapExpand( value ) ) return 1;
     1151                        heapExpand = ceiling( value, pageSize ); return 1;
    11781152                  case M_MMAP_THRESHOLD:
    11791153                        if ( setMmapStart( value ) ) return 1;
     1154                        break;
    11801155                } // switch
    11811156                return 0;                                                                               // error, unsupported
  • libcfa/src/iostream.cfa

    rdd4e2d7 r6c12fd28  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 30 10:50:31 2020
    13 // Update Count     : 1001
     12// Last Modified On : Sat May  2 18:30:25 2020
     13// Update Count     : 1017
    1414//
    1515
     
    583583                                        if ( fmt.flags.pc && fmt.pc > 64 ) fmt.pc -= 64; else { fmt.flags.pc = false; fmt.pc = 0; } \
    584584                                        if ( fmt.flags.left ) { \
    585                                                 fmt2.wd = fmt.wd; \
    586                                                 if ( fmt2.wd <= 64 ) { \
    587                                                         fmt2.wd = 64; \
    588                                                 } else { \
    589                                                         if ( fmt.pc > 0 ) { \
    590                                                                 fmt2.wd -= fmt.pc; \
    591                                                         } else { \
    592                                                                 fmt2.wd = fmt.wd - high1( msig ); \
    593                                                         } /* if */ \
    594                                                         if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \
    595                                                         if ( fmt2.wd < 0 ) fmt2.wd = 0; \
    596                                                         fmt2.flags.left = true; \
    597                                                         fmt.wd = 0; \
    598                                                 } /* if */ \
    599                                                 printf( "left %d %d %x\n", f.wd, f.pc, f.all ); \
    600                                                 printf( "left %d %d %x\n", fmt.wd, fmt.pc, fmt.all ); \
     585                                                fmt.flags.left = false; \
     586                                                fmt.wd = 0; \
     587                                                /* printf( "L %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
     588                                                fmt2.flags.left = true; \
     589                                                int msigd = high1( msig ); \
     590                                                fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \
     591                                                if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; /* compensate for 0b base specifier */ \
     592                                                if ( (int)fmt2.wd < 64 ) fmt2.wd = 64; /* cast deals with negative value */ \
     593                                                fmt2.flags.pc = true; fmt2.pc = 64; \
    601594                                        } else { \
    602595                                                if ( fmt.wd > 64 ) fmt.wd -= 64; \
    603                                                 /* if ( ! fmt.flags.nobsdp && fmt.pc < fmt.wd ) fmt.wd -= 1; */ \
     596                                                else fmt.wd = 1; \
     597                                                /* printf( "R %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
    604598                                                fmt2.wd = 64; \
    605                                                 /* printf( "R %llo %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt2.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
    606599                                        } /* if */ \
    607                                         /* printf( "\nC %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
     600                                        /* printf( "C %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
    608601                                        (ostype &)(os | fmt | "" | fmt2); \
    609602                                } else if ( f.base == 'o' ) { \
     
    614607                                                fmt.flags.left = false; \
    615608                                                fmt.wd = 0; \
    616                                                 /* if ( fmt2.val > 1 && fmt.flags.pc && fmt.pc > 0 ) fmt.pc -= 1; */ \
    617609                                                /* printf( "L %llo %llo %llo %d %d '%c' %x %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all, fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
    618610                                                (ostype &)(os | fmt | "" | fmt2); \
    619611                                                sepOff( os ); \
    620612                                                fmt2.flags.left = true; \
    621                                                 int msigd = ceiling( high1( fmt.val ), 3 ) + 1; \
    622                                                 fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd) - 1; \
     613                                                int msigd = ceiling( high1( fmt.val ), 3 ); \
     614                                                fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \
     615                                                if ( ! fmt.flags.nobsdp ) fmt2.wd -= 1; /* compensate for 0 base specifier */ \
    623616                                                if ( (int)fmt2.wd < 21 ) fmt2.wd = 21; /* cast deals with negative value */ \
    624617                                                fmt2.flags.pc = true; fmt2.pc = 21; \
    625618                                        } else { \
    626619                                                if ( fmt.wd > 22 ) fmt.wd -= 22; \
    627                                                 /* compensate for leading 0 */ \
    628                                                 /*if ( ! fmt.flags.nobsdp && fmt.pc < fmt.wd ) fmt.wd -= 1;*/ \
    629                                                 fmt2.wd = 1; \
     620                                                else fmt.wd = 1; \
    630621                                                /* printf( "R %llo %llo %llo %d %d '%c' %x %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all, fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
    631622                                                (ostype &)(os | fmt | "" | fmt2); \
     
    636627                                        /* printf( "\nC %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
    637628                                        (ostype &)(os | fmt2); \
    638                                 } else { \
    639                                         if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; \
     629                                } else { /* f.base == 'x'  | f.base == 'X' */ \
     630                                        if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; else { fmt.flags.pc = false; fmt.pc = 0; } \
    640631                                        if ( fmt.flags.left ) { \
    641                                                 fmt2.wd = fmt.wd; \
    642                                                 if ( fmt2.wd <= 16 ) { \
    643                                                         fmt2.wd = 16; \
    644                                                 } else { \
    645                                                         if ( fmt.pc > 0 ) { \
    646                                                                 fmt2.wd -= fmt.pc; \
    647                                                         } else { \
    648                                                                 fmt2.wd = fmt.wd - ceiling2( high1( msig ), 4 ) / 4; \
    649                                                         } /* if */ \
    650                                                         if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \
    651                                                         if ( fmt2.wd < 0 ) fmt2.wd = 0; \
    652                                                         fmt2.flags.left = true; \
    653                                                         fmt.wd = 0; \
    654                                                 } /* if */ \
     632                                                fmt.flags.left = false; \
     633                                                fmt.wd = 0; \
     634                                                /* printf( "L %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
     635                                                fmt2.flags.left = true; \
     636                                                int msigd = high1( msig ); \
     637                                                fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \
     638                                                if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; /* compensate for 0x base specifier */ \
     639                                                if ( (int)fmt2.wd < 16 ) fmt2.wd = 16; /* cast deals with negative value */ \
     640                                                fmt2.flags.pc = true; fmt2.pc = 16; \
    655641                                        } else { \
     642                                                if ( fmt.wd > 16 ) fmt.wd -= 16; \
     643                                                else fmt.wd = 1; \
     644                                                /* printf( "R %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
    656645                                                fmt2.wd = 16; \
    657                                                 if ( fmt.wd > 16 ) fmt.wd -= 16; \
    658646                                        } /* if */ \
    659                                         fmt2.pc = 16; fmt2.flags.pc = true; \
     647                                        /* printf( "C %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
    660648                                        (ostype &)(os | fmt | "" | fmt2); \
    661649                                } /* if */ \
  • src/Parser/parser.yy

    rdd4e2d7 r6c12fd28  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  6 17:26:45 2020
    13 // Update Count     : 4474
     12// Last Modified On : Mon Apr 27 12:25:42 2020
     13// Update Count     : 4483
    1414//
    1515
     
    966966
    967967tuple_expression_list:
    968         assignment_expression_opt
    969         | tuple_expression_list ',' assignment_expression_opt
     968        assignment_expression
     969        | '@'                                                                                           // CFA
     970                { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; }
     971        | tuple_expression_list ',' assignment_expression
    970972                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
     973        | tuple_expression_list ',' '@'
     974                { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; }
    971975        ;
    972976
  • tests/exceptions/conditional.cfa

    rdd4e2d7 r6c12fd28  
    44// up the non-trivial exception is reasonable to do.
    55
    6 #include "except-mac.hfa"
     6#include <exception.hfa>
    77#include <stdio.h>
    88
    9 DECLARE_EXCEPT(num_error, BASE_EXCEPT,
     9VTABLE_DECLARATION(num_error)(
    1010        int (*code)(num_error *this);
    1111);
     
    3636    this.num = other.num;
    3737}
    38 void copy(num_error * this, num_error * other) {
    39         *this = *other;
    40 }
    4138void ^?{}(num_error & this) {
    4239    if( this.msg ) free( this.msg );
     
    4643}
    4744
    48 VTABLE_INSTANCE(num_error, BASE_EXCEPT, copy, ^?{},
    49         num_error_msg, num_error_code
     45VTABLE_INSTANCE(num_error)(
     46        num_error_msg,
     47        num_error_code,
    5048);
    5149
     
    5856
    5957        try {
    60                 THROW(&exc);
     58                throw &exc;
    6159        } catch (num_error * error ; 3 == error->virtual_table->code( error )) {
    6260                caught_num_error(3, error);
     
    6664
    6765        try {
    68                 THROW_RESUME(&exc);
     66                throwResume &exc;
    6967        } catchResume (num_error * error ; 3 == error->virtual_table->code( error )) {
    7068                caught_num_error(3, error);
  • tests/exceptions/finally.cfa

    rdd4e2d7 r6c12fd28  
    11// Finally Clause Tests
    22
    3 #include "except-mac.hfa"
     3#include <exception.hfa>
    44#include "except-io.hfa"
    55
     
    1212                try {
    1313                        printf("termination throw\n");
    14                         THROW(&exc);
     14                        throw &exc;
    1515                } finally {
    1616                        loud_exit a = "termination inner finally";
     
    2828                try {
    2929                        printf("resumption throw\n");
    30                         THROW_RESUME(&exc);
     30                        throwResume &exc;
    3131                } finally {
    3232                        loud_exit a = "resumption inner finally";
  • tests/exceptions/interact.cfa

    rdd4e2d7 r6c12fd28  
    11// Testing Interactions Between Termination and Resumption
    22
    3 #include "except-mac.hfa"
     3#include <exception.hfa>
    44#include "except-io.hfa"
    55
     
    1010        // Resume falls back to terminate.
    1111        try {
    12                 THROW_RESUME(&(star){});
     12                throwResume &(star){};
    1313        } catch (star *) {
    1414                printf("caught as termination\n");
     
    1717        try {
    1818                loud_region a = "try block with resume throw";
    19                 THROW_RESUME(&(star){});
     19                throwResume &(star){};
    2020        } catch (star *) {
    2121                printf("caught as termination\n");
     
    2929        try {
    3030                try {
    31                         THROW(&(star){});
     31                        throw &(star){};
    3232                } catchResume (star *) {
    3333                        printf("resume catch on terminate\n");
     
    4343        try {
    4444                try {
    45                         THROW_RESUME(&(star){});
     45                        throwResume &(star){};
    4646                } catch (star *) {
    4747                        printf("terminate catch on resume\n");
     
    5858                try {
    5959                        try {
    60                                 THROW(&(star){});
     60                                throw &(star){};
    6161                        } catchResume (star *) {
    6262                                printf("inner resume catch (error)\n");
     
    6464                } catch (star * error) {
    6565                        printf("termination catch, will resume\n");
    66                         THROW_RESUME(error);
     66                        throwResume error;
    6767                }
    6868        } catchResume (star *) {
     
    7575                try {
    7676                        try {
    77                                 THROW_RESUME(&(star){});
     77                                throwResume &(star){};
    7878                        } catch (star *) {
    7979                                printf("inner termination catch\n");
     
    8181                } catchResume (star * error) {
    8282                        printf("resumption catch, will terminate\n");
    83                         THROW(error);
     83                        throw error;
    8484                }
    8585        } catch (star *) {
     
    9494                                try {
    9595                                        printf("throwing resume moon\n");
    96                                         THROW_RESUME(&(moon){});
     96                                        throwResume &(moon){};
    9797                                } catch (star *) {
    9898                                        printf("termination catch\n");
    9999                                }
    100100                                printf("throwing resume star\n");
    101                                 THROW_RESUME(&(star){});
     101                                throwResume &(star){};
    102102                        } catchResume (star *) {
    103103                                printf("resumption star catch\n");
     
    105105                } catchResume (moon *) {
    106106                        printf("resumption moon catch, will terminate\n");
    107                         THROW(&(star){});
     107                        throw &(star){};
    108108                }
    109109        } catchResume (star *) {
  • tests/exceptions/resume.cfa

    rdd4e2d7 r6c12fd28  
    11// Resumption Exception Tests
    22
    3 #include "except-mac.hfa"
     3#include <exception.hfa>
    44#include "except-io.hfa"
    55
     
    1414                loud_exit a = "simple try clause";
    1515                printf("simple throw\n");
    16                 THROW_RESUME(&(zen){});
     16                throwResume &(zen){};
    1717                printf("end of try clause\n");
    1818        } catchResume (zen * error) {
     
    2525        try {
    2626                printf("throwing child exception\n");
    27                 THROW_RESUME(&(moment_of){});
     27                throwResume &(moment_of){};
    2828        } catchResume (zen *) {
    2929                printf("inner parent match\n");
     
    3636        try {
    3737                try {
    38                         THROW_RESUME(&(yin){});
     38                        throwResume &(yin){};
    3939                } catchResume (zen *) {
    4040                        printf("caught yin as zen\n");
     
    5252                        loud_exit a = "rethrow inner try";
    5353                        printf("rethrow inner try\n");
    54                         THROW_RESUME(&(zen){});
     54                        throwResume &(zen){};
    5555                } catchResume (zen *) {
    5656                        loud_exit a = "rethrowing catch clause";
     
    6767        try {
    6868                try {
    69                         THROW_RESUME(&(yin){});
     69                        throwResume &(yin){};
    7070                } catchResume (yin *) {
    7171                        printf("caught yin, will throw yang\n");
    72                         THROW_RESUME(&(yang){});
     72                        throwResume &(yang){};
    7373                } catchResume (yang *) {
    7474                        printf("caught exception from same try\n");
     
    8383                try {
    8484                        printf("throwing first exception\n");
    85                         THROW_RESUME(&(yin){});
     85                        throwResume &(yin){};
    8686                } catchResume (yin *) {
    8787                        printf("caught first exception\n");
    8888                        try {
    8989                                printf("throwing second exception\n");
    90                                 THROW_RESUME(&(yang){});
     90                                throwResume &(yang){};
    9191                        } catchResume (yang *) {
    9292                                printf("caught second exception\n");
     
    104104        try {
    105105                try {
    106                         THROW_RESUME(&(zen){});
    107                         THROW_RESUME(&(zen){});
     106                        throwResume &(zen){};
     107                        throwResume &(zen){};
    108108                } catchResume (zen *) {
    109109                        printf("inner catch\n");
    110110                }
    111                 THROW_RESUME(&(zen){});
     111                throwResume &(zen){};
    112112        } catchResume (zen *) {
    113113                printf("outer catch\n");
  • tests/exceptions/terminate.cfa

    rdd4e2d7 r6c12fd28  
    11// Termination Exception Tests
    22
    3 #include "except-mac.hfa"
     3#include <exception.hfa>
    44#include "except-io.hfa"
    55
     
    1414                loud_exit a = "simple try clause";
    1515                printf("simple throw\n");
    16                 THROW(&(zen){});
     16                throw &(zen){};
    1717                printf("end of try clause\n");
    1818        } catch (zen * error) {
     
    2525        try {
    2626                printf("throwing child exception\n");
    27                 THROW(&(moment_of){});
     27                throw &(moment_of){};
    2828        } catch (zen *) {
    2929                printf("inner parent match\n");
     
    3636        try {
    3737                try {
    38                         THROW(&(yin){});
     38                        throw &(yin){};
    3939                } catch (zen *) {
    4040                        printf("caught yin as zen\n");
     
    5252                        loud_exit a = "rethrow inner try";
    5353                        printf("rethrow inner try\n");
    54                         THROW(&(zen){});
     54                        throw &(zen){};
    5555                } catch (zen *) {
    5656                        loud_exit a = "rethrowing catch clause";
     
    6767        try {
    6868                try {
    69                         THROW(&(yin){});
     69                        throw &(yin){};
    7070                } catch (yin *) {
    7171                        printf("caught yin, will throw yang\n");
    72                         THROW(&(yang){});
     72                        throw &(yang){};
    7373                } catch (yang *) {
    7474                        printf("caught exception from same try\n");
     
    8383                try {
    8484                        printf("throwing first exception\n");
    85                         THROW(&(yin){});
     85                        throw &(yin){};
    8686                } catch (yin *) {
    8787                        printf("caught first exception\n");
    8888                        try {
    8989                                printf("throwing second exception\n");
    90                                 THROW(&(yang){});
     90                                throw &(yang){};
    9191                        } catch (yang *) {
    9292                                printf("caught second exception\n");
     
    104104        try {
    105105                try {
    106                         THROW(&(zen){});
    107                         THROW(&(zen){});
     106                        throw &(zen){};
     107                        throw &(zen){};
    108108                } catch (zen *) {
    109109                        printf("inner catch\n");
    110110                }
    111                 THROW(&(zen){});
     111                throw &(zen){};
    112112        } catch (zen *) {
    113113                printf("outer catch\n");
  • tests/manipulatorsOutput1.cfa

    rdd4e2d7 r6c12fd28  
    77// Created On       : Sat Jun  8 18:04:11 2019
    88// Last Modified By : Peter A. Buhr
    9 // Last Modified On : Mon Jun 10 12:37:28 2019
    10 // Update Count     : 8
     9// Last Modified On : Fri May  1 11:51:44 2020
     10// Update Count     : 9
    1111//
    1212
     
    1717        signed char sc = -12;
    1818        printf( "%hhd %2hhd %5.2hhd %-5.2hhd %hho %#hho %hhx %#hhx %#8hhx %#8.10hhx %#8.3hhX %+-8.3hhd %08hhd\n", sc, sc, sc, sc, sc, sc, sc, sc, sc, sc, sc, sc, sc );
    19         sout | sc | wd(2,sc) | wd(5,2,sc) | left(wd(5,2,sc)) | nobase(oct(sc)) | oct(sc) | nobase(hex(sc)) | hex(sc) | wd(8,hex(sc)) | wd(8,10,hex(sc)) | upcase(wd(8,3,hex(sc))) | left(sign(upcase(wd(8,3,sc)))) | pad0(wd(8,sc));
     19        sout | sc | wd(2,sc) | wd(5,2,sc) | left(wd(5,2,sc)) | nobase(oct(sc)) | oct(sc) | nonl;
     20        sout | nobase(hex(sc)) | hex(sc) | wd(8,hex(sc)) | wd(8,10,hex(sc)) | upcase(wd(8,3,hex(sc))) | nonl;
     21        sout | left(sign(upcase(wd(8,3,sc)))) | pad0(wd(8,sc));
    2022
    2123        sout | "unsigned char";
    2224        unsigned char usc = 12;
    2325        printf( "%hhu %2hhu %5.2hhu %-5.2hhu %hho %#hho %hhx %#hhx %#8hhx %#8.10hhx %#8.3hhX %-8.3hhu %08hhu\n", usc, usc, usc, usc, usc, usc, usc, usc, usc, usc, usc, usc, usc );
    24         sout | usc | wd(2,usc) | wd(5,2,usc) | left(wd(5,2,usc)) | nobase(oct(usc)) | oct(usc) | nobase(hex(usc)) | hex(usc) | wd(8,hex(usc)) | wd(8,10,hex(usc)) | upcase(wd(8,3,hex(usc))) | left(upcase(wd(8,3,usc))) | pad0(wd(8,usc));
     26        sout | usc | wd(2,usc) | wd(5,2,usc) | left(wd(5,2,usc)) | nobase(oct(usc)) | oct(usc) | nonl;
     27        sout | nobase(hex(usc)) | hex(usc) | wd(8,hex(usc)) | wd(8,10,hex(usc)) | upcase(wd(8,3,hex(usc))) | nonl;
     28        sout | left(upcase(wd(8,3,usc))) | pad0(wd(8,usc));
    2529
    2630        sout | "signed short int";
    2731        signed short int si = -12;
    2832        printf( "%hd %2hd %5.2hd %-5.2hd %ho %#ho %hx %#hx %#8hx %#8.10hx %#8.3hX %+-8.3hd %08hd\n", si, si, si, si, si, si, si, si, si, si, si, si, si );
    29         sout | si | wd(2,si) | wd(5,2,si) | left(wd(5,2,si)) | nobase(oct(si)) | oct(si) | nobase(hex(si)) | hex(si) | wd(8,hex(si)) | wd(8,10,hex(si)) | upcase(wd(8,3,hex(si))) | left(sign(upcase(wd(8,3,si)))) | pad0(wd(8,si));
     33        sout | si | wd(2,si) | wd(5,2,si) | left(wd(5,2,si)) | nobase(oct(si)) | oct(si) | nonl;
     34        sout | nobase(hex(si)) | hex(si) | wd(8,hex(si)) | wd(8,10,hex(si)) | upcase(wd(8,3,hex(si))) | nonl;
     35        sout | left(sign(upcase(wd(8,3,si)))) | pad0(wd(8,si));
    3036
    3137        sout | "unsigned short int";
    3238        unsigned short int usi = 12;
    3339        printf( "%hu %2hu %5.2hu %-5.2hu %ho %#ho %hx %#hx %#8hx %#8.10hx %#8.3hX %-8.3hu %08hu\n", usi, usi, usi, usi, usi, usi, usi, usi, usi, usi, usi, usi, usi );
    34         sout | usi | wd(2,usi) | wd(5,2,usi) | left(wd(5,2,usi)) | nobase(oct(usi)) | oct(usi) | nobase(hex(usi)) | hex(usi) | wd(8,hex(usi)) | wd(8,10,hex(usi)) | upcase(wd(8,3,hex(usi))) | left(upcase(wd(8,3,usi))) | pad0(wd(8,usi));
     40        sout | usi | wd(2,usi) | wd(5,2,usi) | left(wd(5,2,usi)) | nobase(oct(usi)) | oct(usi) | nonl;
     41        sout | nobase(hex(usi)) | hex(usi) | wd(8,hex(usi)) | wd(8,10,hex(usi)) | upcase(wd(8,3,hex(usi))) | nonl;
     42        sout | left(upcase(wd(8,3,usi))) | pad0(wd(8,usi));
    3543
    3644        sout | "signed int";
    3745        signed int i = -12;
    3846        printf( "%d %2d %5.2d %-5.2d %o %#o %x %#x %#8x %#8.10x %#8.3X %+-8.3d %08d\n", i, i, i, i, i, i, i, i, i, i, i, i, i );
    39         sout | i | wd(2,i) | wd(5,2,i) | left(wd(5,2,i)) | nobase(oct(i)) | oct(i) | nobase(hex(i)) | hex(i) | wd(8,hex(i)) | wd(8,10,hex(i)) | upcase(wd(8,3,hex(i))) | left(sign(upcase(wd(8,3,i)))) | pad0(wd(8,i));
     47        sout | i | wd(2,i) | wd(5,2,i) | left(wd(5,2,i)) | nobase(oct(i)) | oct(i) | nonl;
     48        sout | nobase(hex(i)) | hex(i) | wd(8,hex(i)) | wd(8,10,hex(i)) | upcase(wd(8,3,hex(i))) | nonl;
     49        sout | left(sign(upcase(wd(8,3,i)))) | pad0(wd(8,i));
    4050
    4151        sout | "unsigned int";
    4252        unsigned int ui = 12;
    4353        printf( "%u %2u %5.2u %-5.2u %o %#o %x %#x %#8x %#8.10x %#8.3X %-8.3u %08u\n", ui, ui, ui, ui, ui, ui, ui, ui, ui, ui, ui, ui, ui );
    44         sout | ui | wd(2,ui) | wd(5,2,ui) | left(wd(5,2,ui)) | nobase(oct(ui)) | oct(ui) | nobase(hex(ui)) | hex(ui) | wd(8,hex(ui)) | wd(8,10,hex(ui)) | upcase(wd(8,3,hex(ui))) | left(upcase(wd(8,3,ui))) | pad0(wd(8,ui));
     54        sout | ui | wd(2,ui) | wd(5,2,ui) | left(wd(5,2,ui)) | nobase(oct(ui)) | oct(ui) | nonl;
     55        sout | nobase(hex(ui)) | hex(ui) | wd(8,hex(ui)) | wd(8,10,hex(ui)) | upcase(wd(8,3,hex(ui))) | nonl;
     56        sout | left(upcase(wd(8,3,ui))) | pad0(wd(8,ui));
    4557
    4658        sout | "signed long long int";
    4759        signed long long int lli = -12;
    4860        printf( "%lld %2lld %5.2lld %-5.2lld %llo %#llo %llx %#llx %#8llx %#8.10llx %#8.3llX %+-8.3lld %08lld\n", lli, lli, lli, lli, lli, lli, lli, lli, lli, lli, lli, lli, lli );
    49         sout | lli | wd(2,lli) | wd(5,2,lli) | left(wd(5,2,lli)) | nobase(oct(lli)) | oct(lli) | nobase(hex(lli)) | hex(lli) | wd(8,hex(lli)) | wd(8,10,hex(lli)) | upcase(wd(8,3,hex(lli))) | left(sign(upcase(wd(8,3,lli)))) | pad0(wd(8,lli));
     61        sout | lli | wd(2,lli) | wd(5,2,lli) | left(wd(5,2,lli)) | nobase(oct(lli)) | oct(lli) | nonl;
     62        sout | nobase(hex(lli)) | hex(lli) | wd(8,hex(lli)) | wd(8,10,hex(lli)) | upcase(wd(8,3,hex(lli))) | nonl;
     63        sout | left(sign(upcase(wd(8,3,lli)))) | pad0(wd(8,lli));
    5064
    5165        sout | "unsigned long long int";
    5266        unsigned long long int ulli = 12;
    5367        printf( "%llu %2llu %5.2llu %-5.2llu %llo %#llo %llx %#llx %#8llx %#8.10llx %#8.3llX %-8.3llu %08llu\n", ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli );
    54         sout | ulli | wd(2,ulli) | wd(5,2,ulli) | left(wd(5,2,ulli)) | nobase(oct(ulli)) | oct(ulli) | nobase(hex(ulli)) | hex(ulli) | wd(8,hex(ulli)) | wd(8,10,hex(ulli)) | upcase(wd(8,3,hex(ulli))) | left(upcase(wd(8,3,ulli))) | pad0(wd(8,ulli));
     68        sout | ulli | wd(2,ulli) | wd(5,2,ulli) | left(wd(5,2,ulli)) | nobase(oct(ulli)) | oct(ulli) | nonl;
     69        sout | nobase(hex(ulli)) | hex(ulli) | wd(8,hex(ulli)) | wd(8,10,hex(ulli)) | upcase(wd(8,3,hex(ulli))) | nonl;
     70        sout | left(upcase(wd(8,3,ulli))) | pad0(wd(8,ulli));
    5571
    5672        sout | nl | "binary integral";
    57         sout | bin(0) | bin(13) | upcase(bin(13)) | nobase(bin(13)) | left(wd(8,bin(13))) | wd(8,bin(13)) | pad0(left(wd(8,bin(13)))) | pad0(wd(8,bin(13))) | pad0(wd(8,10,bin(13))) | pad0(wd(8,6,bin(13)));
     73        sout | bin(0) | bin(13) | upcase(bin(13)) | nobase(bin(13)) | left(wd(8,bin(13))) | wd(8,bin(13)) | nonl;
     74        sout | pad0(left(wd(8,bin(13)))) | pad0(wd(8,bin(13))) | pad0(wd(8,10,bin(13))) | pad0(wd(8,6,bin(13)));
    5875
    5976
     
    6279        printf( "%g  %8g %#8g %g %8g %8.0g %#8.0g %8.2g %#8.2g %-8.2g %-8.2g %-#8.2g %-+8.2g %-+#8.2g %08.2g %8.2E %8.2a %#8.2A %#8.2e\n",
    6380                    0.0,3.0F,3.0F, f,  f,    f,     f,    f,     f,  3.0F,      f,      f,      f,       f,     f,    f,    f,     f,     f );
    64         sout | 0.0 | wd(8, 3.0F) | nodp(wd(8, 3.0F)) | f | wd(8, f) | ws(8,0, f) | nodp(ws(8,0, f)) | ws(8,2, f) | nodp(ws(8,2, f)) | left(ws(8,2, 3.0F)) | left(ws(8,2, f)) | left(nodp(ws(8,2, f))) | left(sign(ws(8,2, f))) | left(sign(nodp(ws(8,2, f)))) | pad0(ws(8,2, f)) | upcase(wd(8,2, sci(f))) | wd(8,2, hex(f)) | upcase(wd(8,2, hex(f))) | nodp(wd(8,2, sci(f)));
     81        sout | 0.0 | wd(8, 3.0F) | nodp(wd(8, 3.0F)) | f | wd(8, f) | ws(8,0, f) | nodp(ws(8,0, f)) | ws(8,2, f) | nodp(ws(8,2, f)) | nonl;
     82        sout | left(ws(8,2, 3.0F)) | left(ws(8,2, f)) | left(nodp(ws(8,2, f))) | left(sign(ws(8,2, f))) | left(sign(nodp(ws(8,2, f)))) | nonl;
     83        sout | pad0(ws(8,2, f)) | upcase(wd(8,2, sci(f))) | wd(8,2, hex(f)) | upcase(wd(8,2, hex(f))) | nodp(wd(8,2, sci(f)));
    6584
    6685        sout | "double";
     
    6887        printf( "%g  %#8f %g %8f %#8.0f %8.0f %8.2f %-8.2f %-+#8.2f %08.2F %8.2E %8.2a %8.2A %8.2e\n",
    6988                        0.0,  3.0, d,  d,     d,    d,    d,     d,       d,     d,    d,    d,    d,    d );
    70         sout | 0.0 | wd(8, 3.0) | d | wd(8, d) | nodp(wd(8,0, d)) | wd(8,0, d) | wd(8,2, d) | left(wd(8,2, d)) | left(sign(wd(8,2, d))) | pad0(upcase(wd(8,2, d))) | upcase(wd(8,2, sci(d))) | wd(8,2, hex(d)) | upcase(wd(8,2, hex(d))) | wd(8,2, sci(d));
     89        sout | 0.0 | wd(8, 3.0) | d | wd(8, d) | nodp(wd(8,0, d)) | wd(8,0, d) | wd(8,2, d) | nonl;
     90        sout | left(wd(8,2, d)) | left(sign(wd(8,2, d))) | pad0(upcase(wd(8,2, d))) | upcase(wd(8,2, sci(d))) | wd(8,2, hex(d)) | upcase(wd(8,2, hex(d))) | wd(8,2, sci(d));
    7191
    7292        sout | "long double";
     
    7494        printf( "%Lg  %#8Lf %Lg %8Lf %#8.0Lf %8.0Lf %8.2Lf %-8.2Lf %-+#8.2Lf %08.2LF %8.2LE %8.2La %8.2LA %8.2Le\n",
    7595                        0.0L,  3.0L, ld,  ld,     ld,    ld,    ld,     ld,       ld,     ld,    ld,    ld,    ld,    ld );
    76         sout | 0.0L | wd(8, 3.0L) | ld | wd(8, ld) | nodp(wd(8,0, ld)) | wd(8,0, ld) | wd(8,2, ld) | left(wd(8,2, ld)) | left(sign(wd(8,2, ld))) | pad0(upcase(wd(8,2, ld))) | upcase(wd(8,2, sci(ld))) | wd(8,2, hex(ld)) | upcase(wd(8,2, hex(ld))) | wd(8,2, sci(ld));
     96        sout | 0.0L | wd(8, 3.0L) | ld | wd(8, ld) | nodp(wd(8,0, ld)) | wd(8,0, ld) | wd(8,2, ld) | nonl;
     97        sout | left(wd(8,2, ld)) | left(sign(wd(8,2, ld))) | pad0(upcase(wd(8,2, ld))) | upcase(wd(8,2, sci(ld))) | wd(8,2, hex(ld)) | upcase(wd(8,2, hex(ld))) | wd(8,2, sci(ld));
    7798
    7899
     
    80101        char c = 'a';
    81102        printf( "%c %2c %5c %-5c %hho %#hho %hhx %#hhx %#8hhx %#8hhX %-8c %8c\n", c, c, c, c, c, c, c, c, c, c, c, c );
    82         sout | c | ' ' | wd(2,c) | wd(5,c) | left(wd(5,c)) | nobase(oct(c)) | oct(c) | nobase(hex(c)) | hex(c) | wd(8,hex(c)) | upcase(wd(8,hex(c))) | left(wd(8,c)) | wd(8,c);
     103        sout | c | ' ' | wd(2,c) | wd(5,c) | left(wd(5,c)) | nobase(oct(c)) | oct(c) | nonl;
     104        sout | nobase(hex(c)) | hex(c) | wd(8,hex(c)) | upcase(wd(8,hex(c))) | left(wd(8,c)) | wd(8,c);
    83105
    84106        sout | nl | "string";
  • tests/manipulatorsOutput3.cfa

    rdd4e2d7 r6c12fd28  
    5252    sout | left(wd( 10,40, oct(y) )) | 'X';
    5353
    54     y = 123456789;
     54    y = 01234567;
    5555    sout | left(wd( 45, 49, oct(y) )) | 'X';
     56    y = -y;
     57    sout | wd(0, oct(y)) | 'Y';
     58    sout | left(wd(0, oct(y))) | 'Y';
    5659    sout | nl;
    5760
     
    6669    sout | left(wd( 45,49, upcase(hex(x)) )) | 'X';
    6770
    68     sout | nl | nl;
     71    sout | nl;
    6972
    7073    int128 divisor = 0x4b3b4ca85a86c47a;
    7174    divisor <<= 16;
    7275    divisor += 0x98a224000000000;
     76   
     77    // base 2
     78    sout | "base 2";
     79    sout | bin(divisor);
     80    sout | upcase(bin(divisor));
     81    sout | wd(38, upcase(bin(divisor)));
     82    sout | wd(40, upcase(bin(divisor)));
     83    sout | wd(40, 38, upcase(bin(divisor)));
     84    sout | wd(40, 30, upcase(bin(divisor)));
     85    sout | pad0(sign(wd(40, 38, upcase(bin(divisor)))));
     86    sout | nl;
     87   
     88    // oct
     89    sout | "base 8";
     90    sout | upcase(oct(divisor));
     91    sout | wd(38, upcase(oct(divisor)));
     92    sout | wd(40, upcase(oct(divisor)));
     93    sout | wd(40, 38, upcase(oct(divisor)));
     94    sout | wd(40, 30, upcase(oct(divisor)));
     95    sout | pad0(sign(wd(40, 38, upcase(oct(divisor)))));
     96    sout | nl;
    7397
    74     // base 10
     98    // decimal
     99    sout | "base 10";
    75100    sout | divisor;
    76101    sout | wd(2, divisor);
     
    87112    sout | pad0(wd(40, divisor));
    88113    sout | pad0(sign(wd(40,divisor)));
    89    
    90     // base 2
    91     sout | upcase(bin(divisor));
    92     sout | wd(38, upcase(bin(divisor)));
    93     sout | wd(40, upcase(bin(divisor)));
    94     sout | wd(40, 38, upcase(bin(divisor)));
    95     sout | wd(40, 30, upcase(bin(divisor)));
    96     sout | pad0(sign(wd(40, 38, upcase(bin(divisor)))));
    97    
    98     // oct
    99     sout | upcase(oct(divisor));
    100     sout | wd(38, upcase(oct(divisor)));
    101     sout | wd(40, upcase(oct(divisor)));
    102     sout | wd(40, 38, upcase(oct(divisor)));
    103     sout | wd(40, 30, upcase(oct(divisor)));
    104     sout | pad0(sign(wd(40, 38, upcase(oct(divisor)))));
     114    sout | nl;
    105115   
    106116    // hex
     117    sout | "base 16";
    107118    sout | upcase(hex(divisor));
    108119    sout | wd(38, upcase(hex(divisor)));
     
    111122    sout | wd(40, 30, upcase(hex(divisor)));
    112123    sout | pad0(sign(wd(40, 38, upcase(hex(divisor)))));
     124    sout | nl;
    113125
    114126   
Note: See TracChangeset for help on using the changeset viewer.