Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/mty-makai/mty.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 197 by notanpe, Thu Jun 19 09:07:06 2008 UTC revision 198 by notanpe, Tue Jun 24 04:17:10 2008 UTC
# Line 54  Line 54 
54  #endif  #endif
55    
56  /* MAKAI start */  /* MAKAI start */
57    #define TRIP_LEN 10
58    
59  #define MIN_THREAD  1  #define MIN_THREAD  1
60  #define MAX_THREAD 32  #define MAX_THREAD 32
61  int     nThread = 0;  int     nThread = 0;
# Line 62  int    nThread = 0; Line 64  int    nThread = 0;
64  #define MAX_UME 6  #define MAX_UME 6
65  unsigned char   umeStr[10];  unsigned char   umeStr[10];
66  int     umeLen;  int     umeLen;
67    
68    FILE    *tfp;
69  /* MAKAI end */  /* MAKAI end */
70    
71  /* CRYPT64 記述子 */  /* CRYPT64 記述子 */
# Line 91  struct DT *kd[8 + 8]; Line 95  struct DT *kd[8 + 8];
95  struct DT *dtidx[0x100 + 1];  struct DT *dtidx[0x100 + 1];
96  #endif  #endif
97    
98    /* MAKAI start */
99    int     special = 0;
100    #define ST_ALLN 1
101    #define ST_NIKO 1<<1
102    
103    void
104    comment( str )
105    char    *str;
106    {
107    /*
108    [0] 全数
109    [1] 二構
110    [2] 飛石
111    [3] 回文
112    [4] 山彦
113    [5] 双連
114    [6] 最長
115    [7] 最短
116    [8] ぼる
117    [a] 増大
118    [b] 減少
119    [c] 拡飛
120    [d] 飛連
121    [e] 八雲
122    [f] 浪漫
123    [g] 怒連
124    */
125      if ( strlen( str ) >= 4 ) {
126       if ( str[1] == '[' && str[3] == ']' ) {
127        switch ( str[2] ) {
128         case '0':
129          special |= ST_ALLN;
130          printf( "全数\n" );
131          break;
132         case '1':
133          special |= ST_NIKO;
134          printf( "二構\n" );
135          break;
136        }
137       }
138      }
139    }
140    /* MAKAI end */
141    
142  /* 指定されたクラスと入っているキーから、classify を行う */  /* 指定されたクラスと入っているキーから、classify を行う */
143  void  void
144  key_make_map(uint8_t *key, int n)  key_make_map(uint8_t *key, int n)
# Line 1318  char   *path; Line 1366  char   *path;
1366    printf( " str : 先頭に埋め込む文字列 ( %d ≦ str のバイト数 ≦ %d )\n",    printf( " str : 先頭に埋め込む文字列 ( %d ≦ str のバイト数 ≦ %d )\n",
1367             MIN_UME, MAX_UME );             MIN_UME, MAX_UME );
1368  }  }
1369    
1370    /* ヒット時には出力ファイルへのポインタを返す */
1371    FILE *
1372    checkSpecial( trip )
1373    char    *trip;
1374    {
1375      if ( special & ST_ALLN ) {
1376       /* 全数字 */
1377       if ( isdigit( trip[0] ) && isdigit( trip[1] ) && isdigit( trip[2] ) &&
1378            isdigit( trip[3] ) && isdigit( trip[4] ) && isdigit( trip[5] ) &&
1379            isdigit( trip[6] ) && isdigit( trip[7] ) && isdigit( trip[8] ) &&
1380            isdigit( trip[9] ) ) {
1381        return( tfp );
1382       }
1383      }
1384    
1385      if ( special & ST_NIKO ) {
1386       /* 二構 */
1387       int  i;
1388       char ch1, ch2;
1389    
1390       ch1 = trip[0];
1391       for ( i = 1; i < TRIP_LEN; i++ ) {
1392        if ( trip[i] != ch1 ) break;
1393       }
1394       ch2 = trip[i];
1395       for ( ; i < TRIP_LEN; i++ ) {
1396        if ( trip[i] != ch1 && trip[i] != ch2 ) goto NONIKO;
1397       }
1398       return( tfp );
1399      }
1400      NONIKO:
1401    
1402      return( NULL );
1403    }
1404  /* MAKAI end */  /* MAKAI end */
1405    
1406  /***************************************************************  /***************************************************************
# Line 1551  main(int argc, char *argv[]) Line 1634  main(int argc, char *argv[])
1634    
1635    setvbuf(ofp, NULL, _IONBF, BUFSIZ);   /* XXX MSVCRT では _IOLBF が期待通りに動作しない */    setvbuf(ofp, NULL, _IONBF, BUFSIZ);   /* XXX MSVCRT では _IOLBF が期待通りに動作しない */
1636    
1637    /* MAKAI start */
1638      if ( (tfp = fopen("logspe.txt", "at")) == NULL ) {
1639       perror("logspe.txt");
1640       return errno;
1641      }
1642      setvbuf( tfp, NULL, _IONBF, BUFSIZ );
1643    /* MAKAI end */
1644    
1645    mincnt = 0x7FFFFFFF;    mincnt = 0x7FFFFFFF;
1646    nblk_hit = nblk_total = 0;    nblk_hit = nblk_total = 0;
1647    nap_hit = nap_total = 0;    nap_hit = nap_total = 0;
# Line 1771  main(int argc, char *argv[]) Line 1862  main(int argc, char *argv[])
1862            for (kk = 0; kk < N_ALU; kk++)            for (kk = 0; kk < N_ALU; kk++)
1863                  {                  {
1864                    ALU_T t;                    ALU_T t;
1865    
1866    /* MAKAI start */
1867      static uint64_t xhash[64];
1868    
1869      if ( special ) {
1870       CALL_TR64( &pkt_c->param64.lr[0][0].q[kk / (N_ALU / N_Q)], xhash );
1871       xhash_loaded = 1;
1872      }
1873    /* MAKAI end */
1874    
1875                    if (!(kk & (N_ALU / N_Q - 1)))                    if (!(kk & (N_ALU / N_Q - 1)))
1876                          nblk_total++, xhash_loaded = 0;                          nblk_total++, xhash_loaded = 0;
1877    
1878    /* MAKAI start */
1879      if ( special ) {
1880      char hash[16];
1881      uint8_t buf[32];
1882      FILE  *lfp;
1883    
1884      for ( k = 0; k < ALU_BITS; k++ ) {
1885       for ( i = 1; i < 11; i++ ) {
1886        unsigned c = 0;
1887    
1888        c = (xhash[(ALU_BITS * kk + k) & 63] >> (6 * (i - 1))) & 0x3F;
1889        hash[i - 1] = C64[c];
1890       }
1891       hash[10] = 0;
1892       if ( (lfp = checkSpecial( hash )) != NULL ) {
1893        struct timeb tb;
1894        struct tm *plt;
1895    
1896        ftime( &tb );
1897        plt = localtime( &tb.time );
1898        memcpy( buf, pkt_c->uk.key, 8 );
1899        buf[8] = buf[9] = 0;
1900        buf[7] = ( buf[7] & - ( 1 << N_STRIDE ) & 0x7F ) + ALU_BITS * kk + k;
1901        if ( cr ) fprintf( stderr, "\n" );
1902        cr = 0;
1903        if ( translate( buf, 0, 1 ) ) {
1904         log_printf( lfp, "◆%s #%s"
1905                     "\t%04d/%02d/%02d %02d:%02d:%02d.%03d"
1906                     "\t(%02X %02X %02X %02X %02X %02X %02X %02X/%02X) ☆\n",
1907                     hash, buf,
1908                     plt->tm_year + 1900, plt->tm_mon + 1, plt->tm_mday,
1909                     plt->tm_hour, plt->tm_min, plt->tm_sec, tb.millitm,
1910                     buf[0], buf[1], buf[2], buf[3], buf[4],
1911                     buf[5], buf[6], buf[7], buf[8] );
1912        } else {
1913         log_printf( lfp, "◆%s 残念でした"
1914                     "\t%04d/%02d/%02d %02d:%02d:%02d.%03d"
1915                     "\t(%02X %02X %02X %02X %02X %02X %02X %02X/%02X) ☆\n",
1916                     hash,
1917                     plt->tm_year + 1900, plt->tm_mon + 1, plt->tm_mday,
1918                     plt->tm_hour, plt->tm_min, plt->tm_sec, tb.millitm,
1919                     buf[0], buf[1], buf[2], buf[3], buf[4],
1920                     buf[5], buf[6], buf[7], buf[8] );
1921        }
1922       }
1923      }
1924      }
1925    /* MAKAI end */
1926    
1927                    t = pkt_hit->param64.hit[HIT_ANY].a[kk];                    t = pkt_hit->param64.hit[HIT_ANY].a[kk];
1928                    if (!t)                    if (!t)
1929                          continue;                          continue;
# Line 1782  main(int argc, char *argv[]) Line 1932  main(int argc, char *argv[])
1932    
1933                    for (k = 0; k < ALU_BITS; k++)                    for (k = 0; k < ALU_BITS; k++)
1934                          {                          {
1935    
1936    /* MAKAI start */
1937    #if 0
1938                            static uint64_t xhash[64];                            static uint64_t xhash[64];
1939    #endif /* 0 */
1940    /* MAKAI end */
1941    
1942                            char hash[16];                            char hash[16];
1943                            uint8_t buf[32];                            uint8_t buf[32];
1944                            struct timeb tb;                            struct timeb tb;
1945                            struct tm *plt;                            struct tm *plt;
1946    
1947  /* MAKAI start */  /* MAKAI start */
1948    int   hitLen;    int   hitLen;
1949  /* MAKAI end */  /* MAKAI end */

Legend:
Removed from v.197  
changed lines
  Added in v.198

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26