• R/O
  • SSH
  • HTTPS

tsukurimashou: Commit


Commit MetaInfo

Revision220 (tree)
Time2012-02-05 00:10:26
Authormskala

Log Message

UTF-8 fixes, coverage checking, etc.

Change Summary

Incremental Difference

--- trunk/idsgrep/parse.c (revision 219)
+++ trunk/idsgrep/parse.c (revision 220)
@@ -42,7 +42,7 @@
4242
4343 /* can't parse if we are in an error state */
4444 if (parse_state==PS_ERROR)
45- return 0;
45+ return 0; /* SNH */
4646
4747 /* reset state if the tree has been consumed */
4848 if ((stack_ptr==0) && (parse_state==PS_COMPLETE_TREE))
@@ -95,7 +95,7 @@
9595
9696 /* check for continuation */
9797 if ((inp[offs+1]&0xC0)!=0x80) {
98- offs++;
98+ offs+=2;
9999 continue;
100100 }
101101
@@ -114,14 +114,15 @@
114114 return offs;
115115
116116 /* check for continuation */
117- if ((inp[offs+1]&0xC0)!=0x80) {
118- offs++;
117+ if (((inp[offs+1]&0xC0)!=0x80)
118+ || ((inp[offs+2]&0xC0)!=0x80)) {
119+ offs+=3;
119120 continue;
120121 }
121122
122123 /* check for overlong */
123- if ((inp[offs]&0xFE)==0xC0) {
124- offs+=2;
124+ if (((inp[offs]&0xFF)==0xE0) && ((inp[offs+1]&0xE0)==0x80)) {
125+ offs+=3;
125126 continue;
126127 }
127128 clen=3;
@@ -134,14 +135,16 @@
134135 return offs;
135136
136137 /* check for continuation */
137- if ((inp[offs+1]&0xC0)!=0x80) {
138- offs++;
138+ if (((inp[offs+1]&0xC0)!=0x80)
139+ || ((inp[offs+2]&0xC0)!=0x80)
140+ || ((inp[offs+3]&0xC0)!=0x80)) {
141+ offs+=4;
139142 continue;
140143 }
141144
142145 /* check for overlong */
143- if ((inp[offs]&0xFE)==0xC0) {
144- offs+=2;
146+ if (((inp[offs]&0xFF)==0xF0) && ((inp[offs+1]&0xF0)==0x80)) {
147+ offs+=4;
145148 continue;
146149 }
147150 clen=4;
@@ -357,8 +360,8 @@
357360 hs=new_string(strlen(fctr),fctr);
358361
359362 if ((hs->arity>-2) && (hs->arity!=arity)) {
360- puts("attempt to register conflicting arities for functor");
361- exit(1);
363+ puts("attempt to register conflicting arities for functor"); /* SNH */
364+ exit(1); /* SNH */
362365 }
363366
364367 hs->arity=arity;
@@ -372,8 +375,8 @@
372375 cs=new_string(strlen(canon),canon);
373376
374377 if ((hs->arity>-2) && (cs->arity!=hs->arity)) {
375- puts("attempt to register conflicting arities for functor");
376- exit(1);
378+ puts("attempt to register conflicting arities for functor"); /* SNH */
379+ exit(1); /* SNH */
377380 }
378381
379382 hs->arity=cs->arity;
--- trunk/idsgrep/configure.ac (revision 219)
+++ trunk/idsgrep/configure.ac (revision 220)
@@ -167,7 +167,7 @@
167167 AC_CONFIG_HEADERS([config.h])
168168 AC_CONFIG_MACRO_DIR([m4])
169169 AC_REVISION([$Id: configure.ac 1015 2011-12-15 22:24:32Z mskala $])
170-AC_COPYRIGHT([Copyright (C) 2011 Matthew Skala])
170+AC_COPYRIGHT([Copyright (C) 2012 Matthew Skala])
171171 AC_SUBST([release_date],["January 26, 2012"])
172172 #
173173 ############################################################################
--- trunk/idsgrep/Makefile.am (revision 219)
+++ trunk/idsgrep/Makefile.am (revision 220)
@@ -1,11 +1,32 @@
11 ## Process this file with automake to produce Makefile.in
22
3+#
4+# Makefile source for IDSgrep
5+# Copyright (C) 2012 Matthew Skala
6+#
7+# This program is free software: you can redistribute it and/or modify
8+# it under the terms of the GNU General Public License as published by
9+# the Free Software Foundation, version 3.
10+#
11+# This program is distributed in the hope that it will be useful,
12+# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+# GNU General Public License for more details.
15+#
16+# You should have received a copy of the GNU General Public License
17+# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+#
19+# Matthew Skala
20+# http://ansuz.sooke.bc.ca/
21+# mskala@ansuz.sooke.bc.ca
22+#
23+
324 ACLOCAL_AMFLAGS = -I m4
425
526 mvp:=$(if $(VPATH),$(VPATH),.)
627
728 if COND_GCOV
8- MAYBE_COVERAGE=--coverage --no-inline-small-functions
29+ MAYBE_COVERAGE=--coverage --no-inline
930 endif
1031 if COND_KANJIVG
1132 MAYBE_KVDATA=kanjivg.eids
@@ -70,7 +91,8 @@
7091
7192 GCOV_TESTS = \
7293 test/andor test/anynot test/basicmatch test/bighash test/demorgan \
73- test/kvg-grone test/messages test/spacing test/tsu-grone
94+ test/equal test/kvg-grone test/messages test/spacing test/tsu-grone \
95+ test/unord test/utf8
7496
7597 define GCDEP_RECIPE
7698 $1.log: test/rmgcda.log
--- trunk/idsgrep/match.c (revision 219)
+++ trunk/idsgrep/match.c (revision 220)
@@ -363,16 +363,16 @@
363363
364364 /**********************************************************************/
365365
366-NODE *assoc_match_fn(NODE *ms) {
366+NODE *assoc_match_fn(NODE *ms) { /* SNH */
367367 /* FIXME */
368- ms->match_result=MR_TRUE;
369- return ms;
368+ ms->match_result=MR_TRUE; /* SNH */
369+ return ms; /* SNH */
370370 }
371371
372-NODE *regex_match_fn(NODE *ms) {
372+NODE *regex_match_fn(NODE *ms) { /* SNH */
373373 /* FIXME */
374- ms->match_result=MR_TRUE;
375- return ms;
374+ ms->match_result=MR_TRUE; /* SNH */
375+ return ms; /* SNH */
376376 }
377377
378378 /**********************************************************************/
@@ -414,8 +414,8 @@
414414 tmpn->match_result=MR_TRUE;
415415 break;
416416 default:
417- puts("illegal match result");
418- exit(1);
417+ puts("illegal match result"); /* SNH */
418+ exit(1); /* SNH */
419419 }
420420 if ((tmpn->match_result==MR_TRUE) ||
421421 (tmpn->match_result==MR_FALSE)) {
--- trunk/idsgrep/idsgrep.c (revision 219)
+++ trunk/idsgrep/idsgrep.c (revision 220)
@@ -220,7 +220,7 @@
220220 process_file(match_pattern,argv[optind++],num_files>1?0:-1);
221221
222222 /* read stdin if no other choices */
223- if (num_files==0)
223+ if ((num_files==0) && (dictname==NULL))
224224 process_file(match_pattern,"-",-1);
225225
226226 exit(0);
Show on old repository browser