Changeset 3ac5fd8 for libcfa/src
- Timestamp:
- Aug 17, 2024, 3:15:21 PM (4 months ago)
- Branches:
- master
- Children:
- df2e00f
- Parents:
- afb15cf
- Location:
- libcfa/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string_res.cfa
rafb15cf r3ac5fd8 10 10 // Created On : Fri Sep 03 11:00:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Apr 15 21:56:27202413 // Update Count : 8 512 // Last Modified On : Sat Aug 17 14:08:01 2024 13 // Update Count : 86 14 14 // 15 15 … … 251 251 252 252 ifstream & ?|?( ifstream & is, _Istream_Rquoted f ) with( f.rstr ) { 253 if ( eof( is ) ) throwResume ExceptionInst( missing_data);253 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 254 254 int args; 255 255 fini: { -
libcfa/src/enum.cfa
rafb15cf r3ac5fd8 40 40 istype & ?|?( istype & is, E & e ) { 41 41 // fprintf( stderr, "here0\n" ); 42 if ( eof( is ) ) throwResume ExceptionInst( missing_data);42 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 43 43 44 44 // Match longest input enumerator string to enumerator labels, where enumerator names are unique. … … 59 59 60 60 fmt( is, " " ); // skip optional whitespace 61 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 62 61 63 for ( c; max ) { // scan columns of the label matix (some columns missing) 62 64 int args = fmt( is, "%c", &ch ); // read character -
libcfa/src/iostream.cfa
rafb15cf r3ac5fd8 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 2 07:38:44202413 // Update Count : 20 2112 // Last Modified On : Sat Aug 17 12:31:47 2024 13 // Update Count : 2038 14 14 // 15 15 … … 777 777 forall( istype & | basic_istream( istype ) ) { 778 778 istype & ?|?( istype & is, bool & b ) { 779 if ( eof( is ) ) throwResume ExceptionInst( missing_data);779 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 780 780 int len = -1; // len not set if no match 781 // Optional leading whitespace at start of strings.781 // remove optional leading whitespace at start of strings. 782 782 fmt( is, " " FALSE "%n", &len ); // try false 783 783 if ( len != sizeof( FALSE ) - 1 ) { // -1 removes null terminate … … 792 792 793 793 istype & ?|?( istype & is, char & c ) { 794 if ( eof( is ) ) throwResume ExceptionInst( missing_data);794 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 795 795 char temp; 796 796 for () { 797 797 int args = fmt( is, "%c", &temp ); 798 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); 798 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 799 assert( args == 1 ); // if not EOF => a single character must be read 799 800 // do not overwrite parameter with newline unless appropriate 800 801 if ( temp != '\n' || getANL$( is ) ) { c = temp; break; } 801 if ( eof( is ) ) break;802 802 } // for 803 803 return is; … … 805 805 806 806 istype & ?|?( istype & is, signed char & sc ) { 807 if ( eof( is ) ) throwResume ExceptionInst( missing_data);808 int args = fmt( is, "%hhi", &sc ); 809 if ( args != 1 ) throwResume ExceptionInst( missing_data );807 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 808 int args = fmt( is, "%hhi", &sc ); // can be multiple characters (100) 809 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); 810 810 return is; 811 811 } // ?|? 812 812 813 813 istype & ?|?( istype & is, unsigned char & usc ) { 814 if ( eof( is ) ) throwResume ExceptionInst( missing_data);815 int args = fmt( is, "%hhi", &usc ); 814 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 815 int args = fmt( is, "%hhi", &usc ); // can be multiple characters (-100) 816 816 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); 817 817 return is; … … 819 819 820 820 istype & ?|?( istype & is, short int & si ) { 821 if ( eof( is ) ) throwResume ExceptionInst( missing_data);821 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 822 822 int args = fmt( is, "%hi", &si ); 823 823 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 826 826 827 827 istype & ?|?( istype & is, unsigned short int & usi ) { 828 if ( eof( is ) ) throwResume ExceptionInst( missing_data);828 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 829 829 int args = fmt( is, "%hi", &usi ); 830 830 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 833 833 834 834 istype & ?|?( istype & is, int & i ) { 835 if ( eof( is ) ) throwResume ExceptionInst( missing_data);835 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 836 836 int args = fmt( is, "%i", &i ); 837 837 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 840 840 841 841 istype & ?|?( istype & is, unsigned int & ui ) { 842 if ( eof( is ) ) throwResume ExceptionInst( missing_data);842 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 843 843 int args = fmt( is, "%i", &ui ); 844 844 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 847 847 848 848 istype & ?|?( istype & is, long int & li ) { 849 if ( eof( is ) ) throwResume ExceptionInst( missing_data);849 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 850 850 int args = fmt( is, "%li", &li ); 851 851 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 854 854 855 855 istype & ?|?( istype & is, unsigned long int & ulli ) { 856 if ( eof( is ) ) throwResume ExceptionInst( missing_data);856 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 857 857 int args = fmt( is, "%li", &ulli ); 858 858 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 861 861 862 862 istype & ?|?( istype & is, long long int & lli ) { 863 if ( eof( is ) ) throwResume ExceptionInst( missing_data);863 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 864 864 int args = fmt( is, "%lli", &lli ); 865 865 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 868 868 869 869 istype & ?|?( istype & is, unsigned long long int & ulli ) { 870 if ( eof( is ) ) throwResume ExceptionInst( missing_data);870 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 871 871 int args = fmt( is, "%lli", &ulli ); 872 872 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 891 891 } // for 892 892 if ( sign ) ullli = -ullli; 893 } else if ( sign ) ungetc( '-', is ); // return minus when no digits893 } // if 894 894 return is; 895 895 } // ?|? … … 897 897 898 898 istype & ?|?( istype & is, float & f ) { 899 if ( eof( is ) ) throwResume ExceptionInst( missing_data);899 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 900 900 int args = fmt( is, "%f", &f ); 901 901 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 904 904 905 905 istype & ?|?( istype & is, double & d ) { 906 if ( eof( is ) ) throwResume ExceptionInst( missing_data);906 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 907 907 int args = fmt( is, "%lf", &d ); 908 908 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 911 911 912 912 istype & ?|?( istype & is, long double & ld ) { 913 if ( eof( is ) ) throwResume ExceptionInst( missing_data);913 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 914 914 int args = fmt( is, "%Lf", &ld ); 915 915 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); … … 918 918 919 919 istype & ?|?( istype & is, float _Complex & fc ) { 920 if ( eof( is ) ) throwResume ExceptionInst( missing_data);920 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 921 921 float re, im; 922 922 int args = fmt( is, "%f%fi", &re, &im ); … … 927 927 928 928 istype & ?|?( istype & is, double _Complex & dc ) { 929 if ( eof( is ) ) throwResume ExceptionInst( missing_data);929 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 930 930 double re, im; 931 931 int args = fmt( is, "%lf%lfi", &re, &im ); … … 936 936 937 937 istype & ?|?( istype & is, long double _Complex & ldc ) { 938 if ( eof( is ) ) throwResume ExceptionInst( missing_data);938 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 939 939 long double re, im; 940 940 int args = fmt( is, "%Lf%Lfi", &re, &im ); … … 945 945 946 946 istype & ?|?( istype & is, const char fmt[] ) { // match text 947 if ( eof( is ) ) throwResume ExceptionInst( missing_data);947 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 948 948 size_t len = strlen( fmt ); 949 949 char fmtstr[len + 16]; … … 953 953 // scanf cursor does not move if no match 954 954 fmt( is, fmtstr, &len ); 955 if ( ! eof( is ) &&len == -1 ) throwResume ExceptionInst( missing_data );955 if ( len == -1 ) throwResume ExceptionInst( missing_data ); 956 956 return is; 957 957 } // ?|? … … 987 987 forall( istype & | basic_istream( istype ) ) { 988 988 istype & ?|?( istype & is, _Istream_Cskip f ) { 989 if ( eof( is ) ) throwResume ExceptionInst( missing_data);989 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 990 990 if ( f.scanset ) { 991 991 int nscanset = strlen(f.scanset); … … 1000 1000 for ( f.wd ) { // skip N characters 1001 1001 int args = fmt( is, "%c", &ch ); 1002 if ( args != 1 ) throwResume ExceptionInst( missing_data );1002 if ( ! eof( is ) && args != 1 ) throwResume ExceptionInst( missing_data ); 1003 1003 } // for 1004 1004 } // if … … 1007 1007 1008 1008 istype & ?|?( istype & is, _Istream_Cquoted f ) with( f.cstr ) { 1009 if ( eof( is ) ) throwResume ExceptionInst( missing_data);1009 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 1010 1010 int args; 1011 1011 fini: { … … 1032 1032 1033 1033 istype & ?|?( istype & is, _Istream_Cstr f ) with( f.cstr ) { 1034 if ( eof( is ) ) throwResume ExceptionInst( missing_data);1034 if ( eof( is ) ) throwResume ExceptionInst( end_of_file ); 1035 1035 const char * scanset; 1036 1036 size_t nscanset = 0; -
libcfa/src/iostream.hfa
rafb15cf r3ac5fd8 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 2 07:37:57202413 // Update Count : 76 012 // Last Modified On : Thu Aug 15 18:21:22 2024 13 // Update Count : 761 14 14 // 15 15 … … 374 374 // *********************************** exceptions *********************************** 375 375 376 ExceptionDecl( end_of_file ); // read encounters end of file 376 377 ExceptionDecl( missing_data ); // read finds no appropriate data 377 378 ExceptionDecl( cstring_length ); // character string size exceeded -
libcfa/src/parseconfig.cfa
rafb15cf r3ac5fd8 105 105 106 106 static [ bool ] comments( & ifstream in, size_t size, [] char name ) { 107 while () { 108 in | wdi( size, name ); 109 if ( eof( in ) ) return true; 110 if ( name[0] != '#' ) return false; 111 in | nl; // ignore remainder of line 112 } // while 107 bool comment = false; 108 try { 109 while () { 110 in | wdi( size, name ); 111 if ( name[0] != '#' ) break; 112 in | nl; // ignore remainder of line 113 } // while 114 } catch( end_of_file * ) { 115 comment = true; 116 } // try 117 return comment; 113 118 } // comments 114 119 … … 125 130 [256] char value; 126 131 127 while () { // parameter names can appear in any order 128 // NOTE: Must add check to see if already read in value for this key, 129 // once we switch to using hash table as intermediate storage 130 if ( comments( in, 64, key ) ) break; // eof ? 131 in | wdi( 256, value ); 132 133 add_kv_pair( *kv_pairs, key, value ); 134 135 if ( eof( in ) ) break; 136 in | nl; // ignore remainder of line 137 } // for 132 try { 133 while () { // parameter names can appear in any order 134 // NOTE: Must add check to see if already read in value for this key, 135 // once we switch to using hash table as intermediate storage 136 if ( comments( in, 64, key ) ) break; // eof ? 137 in | wdi( 256, value ); 138 139 add_kv_pair( *kv_pairs, key, value ); 140 141 in | nl; // ignore remainder of line 142 } // while 143 } catch( end_of_file * ) { 144 } // try 138 145 } catch( open_failure * ex; ex->istream == &in ) { 139 146 delete( kv_pairs );
Note: See TracChangeset
for help on using the changeset viewer.