• R/O
  • SSH
  • HTTPS

tsukurimashou: Commit


Commit MetaInfo

Revision495 (tree)
Time2014-01-02 01:16:18
Authormskala

Log Message

IDSgrep test coverage

Change Summary

Incremental Difference

--- trunk/idsgrep/match.c (revision 494)
+++ trunk/idsgrep/match.c (revision 495)
@@ -379,7 +379,7 @@
379379 void check_memoization(void) {
380380 int hard_node_count;
381381 HASHED_STRING *hs;
382-return;
382+
383383 /* References subtracted off:
384384 * 2 for the new_string() calls right here
385385 * 2 because . and * are single characters and therefore immortal
--- trunk/idsgrep/Makefile.am (revision 494)
+++ trunk/idsgrep/Makefile.am (revision 495)
@@ -145,8 +145,8 @@
145145 test/andor test/anynot test/assoc test/basicmatch test/backslash \
146146 test/bighash test/cooked test/demorgan test/equal test/filtcalc \
147147 test/genbv test/kvg-grone test/messages test/parsedict test/regex \
148- test/spacing test/speed test/tsu-grone test/unilist test/unord \
149- test/userpred test/utf8
148+ test/spacing test/speed test/truncate test/tsu-grone test/unilist \
149+ test/unord test/userpred test/utf8
150150
151151 define GCDEP_RECIPE
152152 $1.log: test/rmgcda.log
--- trunk/idsgrep/cook.c (revision 494)
+++ trunk/idsgrep/cook.c (revision 495)
@@ -47,10 +47,12 @@
4747 static char output_recipe[NUM_OUTPUT_SETTINGS]="100000913250";
4848
4949 static char *bracketed_colours[6]={
50- "0;41;30","0;37","0;32","0;35","0;36","0;33"};
50+ "\e[0;41;30m","\e[0;37m","\e[0;32m","\e[0;35m","\e[0;36m","\e[0;33m"};
5151 static char *sweetened_colours[6]={
52- "0;41;30","1;37","1;32","1;35","1;36","1;33"};
52+ "\e[0;41;30m","\e[1;37m","\e[1;32m","\e[1;35m","\e[1;36m","\e[1;33m"};
5353
54+static char *current_colour="";
55+
5456 #define NUM_PRESET_RECIPES 5
5557
5658 static struct {char *name,*recipe;} preset_recipe[NUM_PRESET_RECIPES]={
@@ -122,6 +124,7 @@
122124 if ((cp[i]=='\n') || (cp[i]=='\f')) {
123125 fwrite(wrap_buffer,1,buffered_bytes,f);
124126 fputc(cp[i],f);
127+ fputs(current_colour,f);
125128 buffered_bytes=0;
126129 buffered_columns=0;
127130 current_column=0;
@@ -147,9 +150,10 @@
147150 if ((i>=len) || ((cp[i]&0xC0)!=0x80))
148151 break;
149152 };
150-
153+
151154 if (current_column+buffered_columns>76) {
152155 fwrite("\n ",1,4,f);
156+ fputs(current_colour,f);
153157 fwrite(wrap_buffer,1,buffered_bytes,f);
154158 current_column=3+buffered_columns;
155159 buffered_columns=0;
@@ -318,8 +322,10 @@
318322 int i;
319323
320324 wrap_flush(f);
321- if (colourize_output)
322- fprintf(f,"\e[%sm",bracketed_colours[br->arity+2]);
325+ if (colourize_output) {
326+ current_colour=bracketed_colours[br->arity+2];
327+ fputs(current_colour,f);
328+ }
323329
324330 wrap_allowed=1;
325331 wrap_write(br->data,br->length,f);
@@ -371,8 +377,10 @@
371377 (ms->arity==0) &&
372378 (ms->functor==semicolon)) {
373379 wrap_flush(f);
374- if (colourize_output)
375- fprintf(f,"\e[%sm",sweetened_colours[1]);
380+ if (colourize_output) {
381+ current_colour=sweetened_colours[1];
382+ fputs(current_colour,f);
383+ }
376384 wrap_allowed=1;
377385 write_maybe_escaped_char(ms->head->data,NULL,f);
378386
@@ -411,8 +419,10 @@
411419 (mf->mate==NULL) &&
412420 (char_length(mf->data)==mf->length)) {
413421 wrap_flush(f);
414- if (colourize_output)
415- fprintf(f,"\e[%sm",sweetened_colours[mf->arity+2]);
422+ if (colourize_output) {
423+ current_colour=sweetened_colours[mf->arity+2];
424+ fputs(current_colour,f);
425+ }
416426 wrap_allowed=1;
417427 wrap_write(mf->data,mf->length,f);
418428
--- trunk/idsgrep/idsgrep.c (revision 494)
+++ trunk/idsgrep/idsgrep.c (revision 495)
@@ -304,6 +304,7 @@
304304 fclose(idxfile);
305305 free(ir);
306306 fprintf(stderr,"can't open %s for reading\n",fn);
307+ /* not fatal - should still look in other files */
307308 return;
308309 }
309310 offset=(off_t)0;
@@ -339,6 +340,7 @@
339340 fclose(idxfile);
340341 free(ir);
341342 fprintf(stderr,"error seeking in %s\n",fn);
343+ /* not fatal - should still look in other files */
342344 return;
343345 }
344346 offset=ir[ir_done].offset;
@@ -598,7 +600,7 @@
598600 /* read stdin or complain */
599601 if ((num_files==0) && (generate_list==0)) {
600602 if (dictname==NULL)
601- process_file(match_pattern,"-",-1);
603+ process_file_indexed(match_pattern,"-",-1);
602604 else
603605 puts("(no dictionaries were searched)");
604606 }
@@ -607,8 +609,8 @@
607609 if (report_statistics) {
608610 getrusage(RUSAGE_SELF,&rub);
609611 if (rua.ru_utime.tv_usec>rub.ru_utime.tv_usec) {
610- rub.ru_utime.tv_usec+=1000000;
611- rub.ru_utime.tv_sec--;
612+ rub.ru_utime.tv_usec+=1000000; /* GCI */
613+ rub.ru_utime.tv_sec--; /* GCI */
612614 }
613615 printf("STATS %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64
614616 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %d.%06d %d ",
Show on old repository browser