• R/O
  • SSH
  • HTTPS

naniya: Commit


Commit MetaInfo

Revision234 (tree)
Zeit2009-09-28 18:14:24
Autornotanpe

Log Message

セルフサービス用のコードを追加。
ついでに、「ち」を普通の特殊検索に変更。

Ändern Zusammenfassung

Diff

--- branches/mty-makai/mty.c (revision 233)
+++ branches/mty-makai/mty.c (revision 234)
@@ -72,10 +72,8 @@
7272 int umeLen;
7373
7474 FILE *nfp; /* 全数 */
75+FILE *cfp; /* ち */
7576 FILE *tfp; /* ↑以外の特殊検索 */
76-#ifdef CHIN
77-FILE *cfp; /* ち */
78-#endif /* CHIN */
7977 #ifdef REON
8078 FILE *rfp; /* 正規表現 */
8179 #endif /* REON */
@@ -102,6 +100,11 @@
102100 #define DEF_GEAR 10
103101 int gear;
104102
103+#ifdef SELF
104+#define SELF_LIM_CNT 50
105+#define SELF_LIM_SEC 60 * 60 * 1000 /* 1h */
106+#endif /* SELF */
107+
105108 unsigned char saltChar[2];
106109
107110 #ifdef ALLKEY
@@ -132,8 +135,8 @@
132135 #define ST_NIKO 1<<0x1 /* 二構 */
133136 #define ST_BUOO 1<<0x8 /* ぶお */
134137 #define ST_DOSU 1<<0x9 /* 怒数 */
135-#define ST_CHIN 1<<0xb /* ^Chinko Uni では感嘆用のフラグ */
136-#define ST_EROI 1<<0xc /* エロい人 Uni では拡飛のフラグ */
138+#define ST_CHIN 1<<0xb /* ちん Uni では感嘆用のフラグ */
139+#define ST_EROI 1<<0xc /* エロ Uni では拡飛のフラグ */
137140 #define ST_HREN 1<<0xd /* 飛連 */
138141 #define ST_YAKU 1<<0xe /* 八雲 */
139142
@@ -156,6 +159,7 @@
156159 case '9': special |= (ST_DOSU | ST_ALLN); break;
157160 case 'd': special |= ST_HREN; break;
158161 case 'e': special |= ST_YAKU; break;
162+ case 'Y': special |= ST_CHIN; break;
159163 case 'Z': special |= ST_EROI; break;
160164 case 'S':
161165 seedOffset = atoi( str + 4 );
@@ -1235,14 +1239,14 @@
12351239 char *trip;
12361240 unsigned char *kind;
12371241 {
1238-#ifdef CHIN
1239- /* 強制的に検索 */
1240- if ( trip[0] == 'C' && trip[1] == 'h' && trip[2] == 'i' &&
1241- trip[3] == 'n' && trip[4] == 'k' && trip[5] == 'o' ) {
1242- strcpy( kind, "ち" );
1243- return( cfp );
1242+ if ( special & ST_CHIN ) {
1243+ /* ^Chi(r */
1244+ if ( trip[0] == 'C' && trip[1] == 'h' && trip[2] == 'i' &&
1245+ trip[3] == 'n' && trip[4] == 'k' && trip[5] == 'o' ) {
1246+ strcpy( kind, "ち" );
1247+ return( cfp );
1248+ }
12441249 }
1245-#endif /* CHIN */
12461250
12471251 if ( special & ST_BUOO ) {
12481252 /* ぶお [A-Za-z]aoo[A-Za-z]uoo$ */
@@ -1558,9 +1562,6 @@
15581562 /* タゲ読み込み */
15591563 root_expr = expr_parse( "target.txt" );
15601564
1561-#ifdef CHIN
1562- special |= ST_CHIN;
1563-#endif /* CHIN */
15641565 if ( verbose ) {
15651566 printf( "特殊検索オプション : " );
15661567 if ( special & ST_DOSU ) {
@@ -1579,6 +1580,9 @@
15791580 if ( special & ST_BUOO ) {
15801581 printf( "ぶお " );
15811582 }
1583+ if ( special & ST_CHIN ) {
1584+ printf( "ちん " );
1585+ }
15821586 if ( special & ST_HREN ) {
15831587 printf( "飛連 " );
15841588 }
@@ -1777,13 +1781,11 @@
17771781 return errno;
17781782 }
17791783 setvbuf( nfp, NULL, _IONBF, BUFSIZ );
1780-#ifdef CHIN
17811784 if ( (cfp = fopen( "logchi.txt", "at" )) == NULL ) {
17821785 perror( "logchi.txt" );
17831786 return errno;
17841787 }
17851788 setvbuf( cfp, NULL, _IONBF, BUFSIZ );
1786-#endif /* CHIN */
17871789 #ifdef REON
17881790 if ( (rfp = fopen( "logreg.txt", "at" )) == NULL ) {
17891791 perror( "logreg.txt" );
@@ -2032,6 +2034,10 @@
20322034 cr = 0;
20332035 {
20342036 unsigned char len[10];
2037+#ifdef SELF
2038+ static hitCount = 0;
2039+#endif /* SELF */
2040+
20352041 sprintf( len, "%02d", hitLen );
20362042 #ifdef NAMA
20372043 hit( ofp, hash, pkt_c->uk.key, kk, k, len, MAKAI_FALSE );
@@ -2038,6 +2044,13 @@
20382044 #else /* NAMA */
20392045 hit( ofp, hash, pkt_c->uk.key, kk, k, len, MAKAI_TRUE );
20402046 #endif /* NAMA */
2047+
2048+#ifdef SELF
2049+ hitCount++;
2050+ if ( hitCount >= SELF_LIM_CNT ) {
2051+ exit( 0 );
2052+ }
2053+#endif /* SELF */
20412054 }
20422055 }
20432056 }
@@ -2061,6 +2074,11 @@
20612074 int a, b, c;
20622075 /* 通算(単位 ktrips/sec) */
20632076 diffTime = curTime - status.startTime;
2077+#ifdef SELF
2078+ if ( diffTime >= SELF_LIM_SEC ) {
2079+ exit( 0 );
2080+ }
2081+#endif /* SELF */
20642082 a = status.loop / ((1000 / USEC_SEC) * diffTime);
20652083 #ifdef BENCH
20662084 if ( (diffTime / USEC_SEC) > (BENCH * 60) ) {
--- branches/mty-makai/target.txt (revision 233)
+++ branches/mty-makai/target.txt (revision 234)
@@ -44,4 +44,5 @@
4444 #[9] 怒数
4545 #[d] 飛連
4646 #[e] 八雲
47+#[Y] ちん
4748 #[Z] エロ
Show on old repository browser