diff --git a/oblong b/oblong new file mode 100755 index 0000000..80c79ae Binary files /dev/null and b/oblong differ diff --git a/oblong.c b/oblong.c index 9499d0e..c0543c2 100644 --- a/oblong.c +++ b/oblong.c @@ -301,8 +301,8 @@ void procargs ( int nargs , char ** arg ) // int nargs =2 for [oblong -f] **arg if ( !numreplications ) numreplications = 1 ; if ( maxram > 0 ) { fprintf ( stderr , "\nUsing %.2f MBytes of RAM for matrix buffers\n" , maxram ) ; - fflush ( stderr ) ; //清空缓存区 *** - maxram *= 1024 * 1024 ; } // *** + fflush ( stderr ) ; //清空缓存区 + maxram *= 1024 * 1024 ; } // maxram = maxram * 1024 * 1024; reportheader = '\r' ; if ( !isatty( fileno( stderr ) ) ) { errout ( verbose , "Verbose allowed only when STDERR goes to screen" ) ; @@ -318,10 +318,10 @@ void procargs ( int nargs , char ** arg ) // int nargs =2 for [oblong -f] **arg void init_bit_counters ( void ) { - int a , b , c ; - for ( a = 0 ; a < 65536 ; ++ a ) { - for ( b = 1 , c = 0 ; b <= a ; b <<= 1 ) - if ( ( b & a ) ) ++ c ; + int a , b , c ; // bitct[65536] + for ( a = 0 ; a < 65536 ; ++ a ) { // a 0 -> 65535 + for ( b = 1 , c = 0 ; b <= a ; b <<= 1 ) // <= 是 < 或 =; + if ( ( b & a ) ) ++ c ; // c++; bitct [ a ] = c ; } } @@ -848,10 +848,10 @@ void read_input ( void ) char c ; double prop , secs , prevprop ; clock_t beg , end ; - strcpy ( nampt , " " ) ; - if ( treeinp != NULL ) { - while ( strcmp ( nampt , "tread" ) && !feof ( treeinp ) ) - fscanf ( treeinp , " %7s" , nampt ) ; + strcpy ( nampt , " " ) ; // nampt = " " + if ( treeinp != NULL ) { // int is NULL (L34), but can specific the tree file (L273) + while ( strcmp ( nampt , "tread" ) && !feof ( treeinp ) ) //feof 如果 EOF 返回非 0,没有EOF 返回 0, strcmp 0 相同,非0 则执行,即 非 tread 并且 没有 EOF 且执行 + fscanf ( treeinp , " %7s" , nampt ) ; // 输入长度为 7 的 string errout ( feof ( treeinp ) , "String \"tread\" not found in tree file" ) ; fscanf ( treeinp , " %c" , &c ) ; errout ( c != 39 , "Number of trees should be indicated in the title of tree-file" ) ;