Changeset 6c12fd28
- Timestamp:
- May 8, 2020, 2:42:45 PM (5 years ago)
- 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. - Files:
-
- 3 added
- 1 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/bibliography/pl.bib
rdd4e2d7 r6c12fd28 4759 4759 contributer = {pabuhr@plg}, 4760 4760 author = {Gregory R. Andrews}, 4761 title = {A Method for Solving Syn ronization Problems},4761 title = {A Method for Solving Synchronization Problems}, 4762 4762 journal = scp, 4763 4763 volume = 13, -
libcfa/configure
rdd4e2d7 r6c12fd28 790 790 enable_distcc 791 791 with_cfa_name 792 enable_static 792 793 enable_shared 793 enable_static794 794 with_pic 795 795 enable_fast_install … … 1452 1452 --disable-silent-rules verbose build output (undo: "make V=0") 1453 1453 --enable-distcc whether or not to enable distributed compilation 1454 --enable-static[=PKGS] build static libraries [default=no] 1454 1455 --enable-shared[=PKGS] build shared libraries [default=yes] 1455 --enable-static[=PKGS] build static libraries [default=yes]1456 1456 --enable-fast-install[=PKGS] 1457 1457 optimize for fast installation [default=yes] … … 8030 8030 8031 8031 # Set options 8032 # Check whether --enable-static was given. 8033 if 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 8051 else 8052 enable_static=no 8053 fi 8054 8055 8056 8057 8058 8059 8060 8032 8061 8033 8062 … … 8062 8091 fi 8063 8092 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 in8076 yes) enable_static=yes ;;8077 no) enable_static=no ;;8078 *)8079 enable_static=no8080 # 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; do8083 IFS=$lt_save_ifs8084 if test "X$pkg" = "X$p"; then8085 enable_static=yes8086 fi8087 done8088 IFS=$lt_save_ifs8089 ;;8090 esac8091 else8092 enable_static=yes8093 fi8094 8093 8095 8094 … … 17728 17727 macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' 17729 17728 macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' 17729 enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' 17730 17730 enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' 17731 enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'17732 17731 pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' 17733 17732 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' … … 18857 18856 macro_revision=$macro_revision 18858 18857 18858 # Whether or not to build static libraries. 18859 build_old_libs=$enable_static 18860 18859 18861 # Whether or not to build shared libraries. 18860 18862 build_libtool_libs=$enable_shared 18861 18862 # Whether or not to build static libraries.18863 build_old_libs=$enable_static18864 18863 18865 18864 # What type of objects to build. -
libcfa/configure.ac
rdd4e2d7 r6c12fd28 109 109 110 110 # Checks for programs. 111 LT_INIT 111 LT_INIT([disable-static]) 112 112 113 113 AC_PROG_CXX -
libcfa/src/bits/locks.hfa
rdd4e2d7 r6c12fd28 115 115 char * strerror(int); 116 116 } 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)); } 118 118 119 119 struct __bin_sem_t { -
libcfa/src/concurrency/kernel.cfa
rdd4e2d7 r6c12fd28 901 901 // Wake them up 902 902 __cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this->idles.head); 903 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 903 904 post( this->idles.head->idle ); 904 905 … … 911 912 static bool __wake_proc(processor * this) { 912 913 __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; 914 921 } 915 922 -
libcfa/src/heap.cfa
rdd4e2d7 r6c12fd28 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 18 17:43:15202013 // Update Count : 7 1812 // Last Modified On : Wed May 6 17:29:26 2020 13 // Update Count : 727 14 14 // 15 15 … … 19 19 #include <errno.h> // errno 20 20 #include <string.h> // memset, memcpy 21 #include <limits.h> // ULONG_MAX 21 22 extern "C" { 22 23 #include <sys/mman.h> // mmap, munmap 23 24 } // extern "C" 24 25 25 // #comment TD : Many of these should be merged into math I believe26 26 #include "bits/align.hfa" // libPow2 27 27 #include "bits/defs.hfa" // likely, unlikely … … 30 30 //#include "stdlib.hfa" // bsearchl 31 31 #include "malloc.h" 32 #include "bitmanip.hfa" // ceiling 32 33 33 34 #define MIN(x, y) (y > x ? x : y) … … 81 82 }; 82 83 84 size_t default_heap_expansion() __attribute__(( weak )) { 85 return __CFA_DEFAULT_HEAP_EXPANSION__; 86 } // default_heap_expansion 87 83 88 size_t default_mmap_start() __attribute__(( weak )) { 84 89 return __CFA_DEFAULT_MMAP_START__; 85 90 } // default_mmap_start 86 87 size_t default_heap_expansion() __attribute__(( weak )) {88 return __CFA_DEFAULT_HEAP_EXPANSION__;89 } // default_heap_expansion90 91 91 92 … … 360 361 361 362 362 static inline bool setHeapExpand( size_t value ) {363 if ( heapExpand < pageSize ) return true;364 heapExpand = value;365 return false;366 } // setHeapExpand367 368 369 363 // thunk problem 370 364 size_t Bsearchl( unsigned int key, const unsigned int * vals, size_t dim ) { … … 383 377 384 378 static 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; 386 380 mmapStart = value; // set global 387 381 … … 390 384 assert( maxBucketsUsed < NoBucketSizes ); // subscript failure ? 391 385 assert( mmapStart <= bucketSizes[maxBucketsUsed] ); // search failure ? 392 return false;386 return true; 393 387 } // setMmapStart 394 388 … … 449 443 450 444 #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 ? 452 446 #endif // __CFA_DEBUG__ 453 447 … … 508 502 // along with the block and is a multiple of the alignment size. 509 503 510 if ( unlikely( size > ~0ul- sizeof(HeapManager.Storage) ) ) return 0p;504 if ( unlikely( size > ULONG_MAX - sizeof(HeapManager.Storage) ) ) return 0p; 511 505 size_t tsize = size + sizeof(HeapManager.Storage); 512 506 if ( likely( tsize < mmapStart ) ) { // small size => sbrk … … 560 554 block->header.kind.real.home = freeElem; // pointer back to free list of apropriate size 561 555 } else { // large size => mmap 562 if ( unlikely( size > ~0ul- pageSize ) ) return 0p;556 if ( unlikely( size > ULONG_MAX - pageSize ) ) return 0p; 563 557 tsize = libCeiling( tsize, pageSize ); // must be multiple of page size 564 558 #ifdef __STATISTICS__ … … 702 696 #endif // FASTLOOKUP 703 697 704 if ( setMmapStart( default_mmap_start() ) ) {698 if ( ! setMmapStart( default_mmap_start() ) ) { 705 699 abort( "HeapManager : internal error, mmap start initialization failure." ); 706 700 } // if … … 708 702 709 703 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 712 705 } // HeapManager 713 706 … … 735 728 //assert( heapManager.heapBegin != 0 ); 736 729 //heapManager{}; 737 if ( heapManager.heapBegin == 0p ) heapManager{}; 730 if ( heapManager.heapBegin == 0p ) heapManager{}; // sanity check 738 731 } // memory_startup 739 732 … … 863 856 #endif // __STATISTICS__ 864 857 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 ); 876 859 } // aalloc 877 860 … … 914 897 915 898 // change size, DO NOT preserve STICKY PROPERTIES. 899 free( oaddr ); 916 900 void * naddr = mallocNoStats( size ); // create new area 917 free( oaddr );918 901 return naddr; 919 902 } // resize … … 988 971 #endif // __STATISTICS__ 989 972 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 ); 1000 974 } // amemalign 1001 975 … … 1043 1017 1044 1018 // 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 behavio r occurs. If ptr is1019 // or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is 1046 1020 // 0p, no operation is performed. 1047 1021 void free( void * addr ) { … … 1170 1144 1171 1145 1172 // Adjusts parameters that control the behavio r of the memory-allocation functions (see malloc). The param argument1146 // Adjusts parameters that control the behaviour of the memory-allocation functions (see malloc). The param argument 1173 1147 // specifies the parameter to be modified, and value specifies the new value for that parameter. 1174 1148 int mallopt( int option, int value ) { 1175 1149 choose( option ) { 1176 1150 case M_TOP_PAD: 1177 if ( setHeapExpand( value ) )return 1;1151 heapExpand = ceiling( value, pageSize ); return 1; 1178 1152 case M_MMAP_THRESHOLD: 1179 1153 if ( setMmapStart( value ) ) return 1; 1154 break; 1180 1155 } // switch 1181 1156 return 0; // error, unsupported -
libcfa/src/iostream.cfa
rdd4e2d7 r6c12fd28 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Apr 30 10:50:31202013 // Update Count : 10 0112 // Last Modified On : Sat May 2 18:30:25 2020 13 // Update Count : 1017 14 14 // 15 15 … … 583 583 if ( fmt.flags.pc && fmt.pc > 64 ) fmt.pc -= 64; else { fmt.flags.pc = false; fmt.pc = 0; } \ 584 584 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; \ 601 594 } else { \ 602 595 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 ); */ \ 604 598 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 ); */ \606 599 } /* 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 ); */ \ 608 601 (ostype &)(os | fmt | "" | fmt2); \ 609 602 } else if ( f.base == 'o' ) { \ … … 614 607 fmt.flags.left = false; \ 615 608 fmt.wd = 0; \ 616 /* if ( fmt2.val > 1 && fmt.flags.pc && fmt.pc > 0 ) fmt.pc -= 1; */ \617 609 /* 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 ); */ \ 618 610 (ostype &)(os | fmt | "" | fmt2); \ 619 611 sepOff( os ); \ 620 612 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 */ \ 623 616 if ( (int)fmt2.wd < 21 ) fmt2.wd = 21; /* cast deals with negative value */ \ 624 617 fmt2.flags.pc = true; fmt2.pc = 21; \ 625 618 } else { \ 626 619 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; \ 630 621 /* 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 ); */ \ 631 622 (ostype &)(os | fmt | "" | fmt2); \ … … 636 627 /* printf( "\nC %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \ 637 628 (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; } \ 640 631 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; \ 655 641 } 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 ); */ \ 656 645 fmt2.wd = 16; \ 657 if ( fmt.wd > 16 ) fmt.wd -= 16; \658 646 } /* 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 ); */ \ 660 648 (ostype &)(os | fmt | "" | fmt2); \ 661 649 } /* if */ \ -
src/Parser/parser.yy
rdd4e2d7 r6c12fd28 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 6 17:26:45202013 // Update Count : 44 7412 // Last Modified On : Mon Apr 27 12:25:42 2020 13 // Update Count : 4483 14 14 // 15 15 … … 966 966 967 967 tuple_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 970 972 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 973 | tuple_expression_list ',' '@' 974 { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; } 971 975 ; 972 976 -
tests/exceptions/conditional.cfa
rdd4e2d7 r6c12fd28 4 4 // up the non-trivial exception is reasonable to do. 5 5 6 #include "except-mac.hfa"6 #include <exception.hfa> 7 7 #include <stdio.h> 8 8 9 DECLARE_EXCEPT(num_error, BASE_EXCEPT, 9 VTABLE_DECLARATION(num_error)( 10 10 int (*code)(num_error *this); 11 11 ); … … 36 36 this.num = other.num; 37 37 } 38 void copy(num_error * this, num_error * other) {39 *this = *other;40 }41 38 void ^?{}(num_error & this) { 42 39 if( this.msg ) free( this.msg ); … … 46 43 } 47 44 48 VTABLE_INSTANCE(num_error, BASE_EXCEPT, copy, ^?{}, 49 num_error_msg, num_error_code 45 VTABLE_INSTANCE(num_error)( 46 num_error_msg, 47 num_error_code, 50 48 ); 51 49 … … 58 56 59 57 try { 60 THROW(&exc);58 throw &exc; 61 59 } catch (num_error * error ; 3 == error->virtual_table->code( error )) { 62 60 caught_num_error(3, error); … … 66 64 67 65 try { 68 THROW_RESUME(&exc);66 throwResume &exc; 69 67 } catchResume (num_error * error ; 3 == error->virtual_table->code( error )) { 70 68 caught_num_error(3, error); -
tests/exceptions/finally.cfa
rdd4e2d7 r6c12fd28 1 1 // Finally Clause Tests 2 2 3 #include "except-mac.hfa"3 #include <exception.hfa> 4 4 #include "except-io.hfa" 5 5 … … 12 12 try { 13 13 printf("termination throw\n"); 14 THROW(&exc);14 throw &exc; 15 15 } finally { 16 16 loud_exit a = "termination inner finally"; … … 28 28 try { 29 29 printf("resumption throw\n"); 30 THROW_RESUME(&exc);30 throwResume &exc; 31 31 } finally { 32 32 loud_exit a = "resumption inner finally"; -
tests/exceptions/interact.cfa
rdd4e2d7 r6c12fd28 1 1 // Testing Interactions Between Termination and Resumption 2 2 3 #include "except-mac.hfa"3 #include <exception.hfa> 4 4 #include "except-io.hfa" 5 5 … … 10 10 // Resume falls back to terminate. 11 11 try { 12 THROW_RESUME(&(star){});12 throwResume &(star){}; 13 13 } catch (star *) { 14 14 printf("caught as termination\n"); … … 17 17 try { 18 18 loud_region a = "try block with resume throw"; 19 THROW_RESUME(&(star){});19 throwResume &(star){}; 20 20 } catch (star *) { 21 21 printf("caught as termination\n"); … … 29 29 try { 30 30 try { 31 THROW(&(star){});31 throw &(star){}; 32 32 } catchResume (star *) { 33 33 printf("resume catch on terminate\n"); … … 43 43 try { 44 44 try { 45 THROW_RESUME(&(star){});45 throwResume &(star){}; 46 46 } catch (star *) { 47 47 printf("terminate catch on resume\n"); … … 58 58 try { 59 59 try { 60 THROW(&(star){});60 throw &(star){}; 61 61 } catchResume (star *) { 62 62 printf("inner resume catch (error)\n"); … … 64 64 } catch (star * error) { 65 65 printf("termination catch, will resume\n"); 66 THROW_RESUME(error);66 throwResume error; 67 67 } 68 68 } catchResume (star *) { … … 75 75 try { 76 76 try { 77 THROW_RESUME(&(star){});77 throwResume &(star){}; 78 78 } catch (star *) { 79 79 printf("inner termination catch\n"); … … 81 81 } catchResume (star * error) { 82 82 printf("resumption catch, will terminate\n"); 83 THROW(error);83 throw error; 84 84 } 85 85 } catch (star *) { … … 94 94 try { 95 95 printf("throwing resume moon\n"); 96 THROW_RESUME(&(moon){});96 throwResume &(moon){}; 97 97 } catch (star *) { 98 98 printf("termination catch\n"); 99 99 } 100 100 printf("throwing resume star\n"); 101 THROW_RESUME(&(star){});101 throwResume &(star){}; 102 102 } catchResume (star *) { 103 103 printf("resumption star catch\n"); … … 105 105 } catchResume (moon *) { 106 106 printf("resumption moon catch, will terminate\n"); 107 THROW(&(star){});107 throw &(star){}; 108 108 } 109 109 } catchResume (star *) { -
tests/exceptions/resume.cfa
rdd4e2d7 r6c12fd28 1 1 // Resumption Exception Tests 2 2 3 #include "except-mac.hfa"3 #include <exception.hfa> 4 4 #include "except-io.hfa" 5 5 … … 14 14 loud_exit a = "simple try clause"; 15 15 printf("simple throw\n"); 16 THROW_RESUME(&(zen){});16 throwResume &(zen){}; 17 17 printf("end of try clause\n"); 18 18 } catchResume (zen * error) { … … 25 25 try { 26 26 printf("throwing child exception\n"); 27 THROW_RESUME(&(moment_of){});27 throwResume &(moment_of){}; 28 28 } catchResume (zen *) { 29 29 printf("inner parent match\n"); … … 36 36 try { 37 37 try { 38 THROW_RESUME(&(yin){});38 throwResume &(yin){}; 39 39 } catchResume (zen *) { 40 40 printf("caught yin as zen\n"); … … 52 52 loud_exit a = "rethrow inner try"; 53 53 printf("rethrow inner try\n"); 54 THROW_RESUME(&(zen){});54 throwResume &(zen){}; 55 55 } catchResume (zen *) { 56 56 loud_exit a = "rethrowing catch clause"; … … 67 67 try { 68 68 try { 69 THROW_RESUME(&(yin){});69 throwResume &(yin){}; 70 70 } catchResume (yin *) { 71 71 printf("caught yin, will throw yang\n"); 72 THROW_RESUME(&(yang){});72 throwResume &(yang){}; 73 73 } catchResume (yang *) { 74 74 printf("caught exception from same try\n"); … … 83 83 try { 84 84 printf("throwing first exception\n"); 85 THROW_RESUME(&(yin){});85 throwResume &(yin){}; 86 86 } catchResume (yin *) { 87 87 printf("caught first exception\n"); 88 88 try { 89 89 printf("throwing second exception\n"); 90 THROW_RESUME(&(yang){});90 throwResume &(yang){}; 91 91 } catchResume (yang *) { 92 92 printf("caught second exception\n"); … … 104 104 try { 105 105 try { 106 THROW_RESUME(&(zen){});107 THROW_RESUME(&(zen){});106 throwResume &(zen){}; 107 throwResume &(zen){}; 108 108 } catchResume (zen *) { 109 109 printf("inner catch\n"); 110 110 } 111 THROW_RESUME(&(zen){});111 throwResume &(zen){}; 112 112 } catchResume (zen *) { 113 113 printf("outer catch\n"); -
tests/exceptions/terminate.cfa
rdd4e2d7 r6c12fd28 1 1 // Termination Exception Tests 2 2 3 #include "except-mac.hfa"3 #include <exception.hfa> 4 4 #include "except-io.hfa" 5 5 … … 14 14 loud_exit a = "simple try clause"; 15 15 printf("simple throw\n"); 16 THROW(&(zen){});16 throw &(zen){}; 17 17 printf("end of try clause\n"); 18 18 } catch (zen * error) { … … 25 25 try { 26 26 printf("throwing child exception\n"); 27 THROW(&(moment_of){});27 throw &(moment_of){}; 28 28 } catch (zen *) { 29 29 printf("inner parent match\n"); … … 36 36 try { 37 37 try { 38 THROW(&(yin){});38 throw &(yin){}; 39 39 } catch (zen *) { 40 40 printf("caught yin as zen\n"); … … 52 52 loud_exit a = "rethrow inner try"; 53 53 printf("rethrow inner try\n"); 54 THROW(&(zen){});54 throw &(zen){}; 55 55 } catch (zen *) { 56 56 loud_exit a = "rethrowing catch clause"; … … 67 67 try { 68 68 try { 69 THROW(&(yin){});69 throw &(yin){}; 70 70 } catch (yin *) { 71 71 printf("caught yin, will throw yang\n"); 72 THROW(&(yang){});72 throw &(yang){}; 73 73 } catch (yang *) { 74 74 printf("caught exception from same try\n"); … … 83 83 try { 84 84 printf("throwing first exception\n"); 85 THROW(&(yin){});85 throw &(yin){}; 86 86 } catch (yin *) { 87 87 printf("caught first exception\n"); 88 88 try { 89 89 printf("throwing second exception\n"); 90 THROW(&(yang){});90 throw &(yang){}; 91 91 } catch (yang *) { 92 92 printf("caught second exception\n"); … … 104 104 try { 105 105 try { 106 THROW(&(zen){});107 THROW(&(zen){});106 throw &(zen){}; 107 throw &(zen){}; 108 108 } catch (zen *) { 109 109 printf("inner catch\n"); 110 110 } 111 THROW(&(zen){});111 throw &(zen){}; 112 112 } catch (zen *) { 113 113 printf("outer catch\n"); -
tests/manipulatorsOutput1.cfa
rdd4e2d7 r6c12fd28 7 7 // Created On : Sat Jun 8 18:04:11 2019 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Mon Jun 10 12:37:28 201910 // Update Count : 89 // Last Modified On : Fri May 1 11:51:44 2020 10 // Update Count : 9 11 11 // 12 12 … … 17 17 signed char sc = -12; 18 18 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)); 20 22 21 23 sout | "unsigned char"; 22 24 unsigned char usc = 12; 23 25 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)); 25 29 26 30 sout | "signed short int"; 27 31 signed short int si = -12; 28 32 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)); 30 36 31 37 sout | "unsigned short int"; 32 38 unsigned short int usi = 12; 33 39 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)); 35 43 36 44 sout | "signed int"; 37 45 signed int i = -12; 38 46 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)); 40 50 41 51 sout | "unsigned int"; 42 52 unsigned int ui = 12; 43 53 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)); 45 57 46 58 sout | "signed long long int"; 47 59 signed long long int lli = -12; 48 60 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)); 50 64 51 65 sout | "unsigned long long int"; 52 66 unsigned long long int ulli = 12; 53 67 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)); 55 71 56 72 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))); 58 75 59 76 … … 62 79 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", 63 80 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))); 65 84 66 85 sout | "double"; … … 68 87 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", 69 88 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)); 71 91 72 92 sout | "long double"; … … 74 94 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", 75 95 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)); 77 98 78 99 … … 80 101 char c = 'a'; 81 102 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); 83 105 84 106 sout | nl | "string"; -
tests/manipulatorsOutput3.cfa
rdd4e2d7 r6c12fd28 52 52 sout | left(wd( 10,40, oct(y) )) | 'X'; 53 53 54 y = 123456789;54 y = 01234567; 55 55 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'; 56 59 sout | nl; 57 60 … … 66 69 sout | left(wd( 45,49, upcase(hex(x)) )) | 'X'; 67 70 68 sout | nl | nl;71 sout | nl; 69 72 70 73 int128 divisor = 0x4b3b4ca85a86c47a; 71 74 divisor <<= 16; 72 75 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; 73 97 74 // base 10 98 // decimal 99 sout | "base 10"; 75 100 sout | divisor; 76 101 sout | wd(2, divisor); … … 87 112 sout | pad0(wd(40, divisor)); 88 113 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; 105 115 106 116 // hex 117 sout | "base 16"; 107 118 sout | upcase(hex(divisor)); 108 119 sout | wd(38, upcase(hex(divisor))); … … 111 122 sout | wd(40, 30, upcase(hex(divisor))); 112 123 sout | pad0(sign(wd(40, 38, upcase(hex(divisor))))); 124 sout | nl; 113 125 114 126
Note: See TracChangeset
for help on using the changeset viewer.