ferret 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/README +6 -5
  2. data/Rakefile +34 -13
  3. data/TODO +1 -0
  4. data/TUTORIAL +1 -1
  5. data/ext/analysis.c +87 -70
  6. data/ext/analysis.h +18 -6
  7. data/ext/array.c +1 -2
  8. data/ext/array.h +1 -1
  9. data/ext/bitvector.c +10 -6
  10. data/ext/bitvector.h +2 -2
  11. data/ext/compound_io.c +30 -27
  12. data/ext/document.c +15 -15
  13. data/ext/document.h +5 -5
  14. data/ext/except.c +2 -0
  15. data/ext/except.h +25 -23
  16. data/ext/extconf.rb +1 -0
  17. data/ext/ferret.c +10 -8
  18. data/ext/ferret.h +9 -8
  19. data/ext/field.c +29 -25
  20. data/ext/filter.c +52 -14
  21. data/ext/frtio.h +13 -0
  22. data/ext/fs_store.c +115 -170
  23. data/ext/global.c +9 -8
  24. data/ext/global.h +17 -13
  25. data/ext/hash.c +13 -19
  26. data/ext/hash.h +11 -11
  27. data/ext/hashset.c +5 -7
  28. data/ext/hashset.h +9 -8
  29. data/ext/helper.c +1 -1
  30. data/ext/helper.h +2 -1
  31. data/ext/inc/except.h +25 -23
  32. data/ext/inc/lang.h +11 -1
  33. data/ext/ind.c +33 -21
  34. data/ext/index.h +44 -39
  35. data/ext/index_io.c +61 -57
  36. data/ext/index_rw.c +418 -361
  37. data/ext/lang.c +10 -0
  38. data/ext/lang.h +11 -1
  39. data/ext/nix_io.c +135 -0
  40. data/ext/priorityqueue.c +16 -16
  41. data/ext/priorityqueue.h +9 -6
  42. data/ext/q_boolean.c +128 -76
  43. data/ext/q_const_score.c +20 -20
  44. data/ext/q_filtered_query.c +20 -20
  45. data/ext/q_fuzzy.c +37 -23
  46. data/ext/q_match_all.c +15 -19
  47. data/ext/q_multi_phrase.c +87 -46
  48. data/ext/q_parser.c +247 -119
  49. data/ext/q_phrase.c +86 -52
  50. data/ext/q_prefix.c +25 -14
  51. data/ext/q_range.c +59 -14
  52. data/ext/q_span.c +263 -172
  53. data/ext/q_term.c +62 -51
  54. data/ext/q_wildcard.c +24 -13
  55. data/ext/r_analysis.c +328 -80
  56. data/ext/r_doc.c +11 -6
  57. data/ext/r_index_io.c +40 -32
  58. data/ext/r_qparser.c +15 -14
  59. data/ext/r_search.c +270 -152
  60. data/ext/r_store.c +32 -17
  61. data/ext/ram_store.c +38 -22
  62. data/ext/search.c +617 -87
  63. data/ext/search.h +227 -163
  64. data/ext/similarity.c +54 -45
  65. data/ext/similarity.h +3 -3
  66. data/ext/sort.c +132 -53
  67. data/ext/store.c +21 -2
  68. data/ext/store.h +14 -14
  69. data/ext/tags +4322 -232
  70. data/ext/term.c +140 -109
  71. data/ext/termdocs.c +74 -60
  72. data/ext/vector.c +181 -152
  73. data/ext/w32_io.c +150 -0
  74. data/lib/ferret.rb +1 -1
  75. data/lib/ferret/analysis/standard_tokenizer.rb +4 -3
  76. data/lib/ferret/document/field.rb +1 -1
  77. data/lib/ferret/index/field_infos.rb +1 -1
  78. data/lib/ferret/index/term.rb +1 -1
  79. data/lib/ferret/query_parser/query_parser.tab.rb +8 -24
  80. data/lib/ferret/search.rb +1 -0
  81. data/lib/ferret/search/boolean_query.rb +0 -4
  82. data/lib/ferret/search/index_searcher.rb +21 -8
  83. data/lib/ferret/search/multi_phrase_query.rb +7 -0
  84. data/lib/ferret/search/multi_searcher.rb +261 -0
  85. data/lib/ferret/search/phrase_query.rb +1 -1
  86. data/lib/ferret/search/query.rb +34 -5
  87. data/lib/ferret/search/sort.rb +7 -3
  88. data/lib/ferret/search/sort_field.rb +8 -4
  89. data/lib/ferret/store/fs_store.rb +13 -6
  90. data/lib/ferret/store/index_io.rb +0 -14
  91. data/lib/ferret/store/ram_store.rb +3 -2
  92. data/lib/rferret.rb +1 -1
  93. data/test/unit/analysis/ctc_analyzer.rb +131 -0
  94. data/test/unit/analysis/ctc_tokenstream.rb +98 -9
  95. data/test/unit/index/tc_index.rb +40 -1
  96. data/test/unit/index/tc_term.rb +7 -0
  97. data/test/unit/index/th_doc.rb +8 -0
  98. data/test/unit/query_parser/tc_query_parser.rb +6 -4
  99. data/test/unit/search/rtc_sort_field.rb +6 -6
  100. data/test/unit/search/tc_index_searcher.rb +8 -0
  101. data/test/unit/search/tc_multi_searcher.rb +275 -0
  102. data/test/unit/search/tc_multi_searcher2.rb +126 -0
  103. data/test/unit/search/tc_search_and_sort.rb +66 -0
  104. metadata +31 -26
  105. data/test/unit/query_parser/rtc_query_parser.rb +0 -138
data/ext/global.c CHANGED
@@ -17,7 +17,7 @@ int min3(int a, int b, int c)
17
17
  return MIN3(a, b, c);
18
18
  }
19
19
 
20
- int min(int a, int b)
20
+ int min2(int a, int b)
21
21
  {
22
22
  return MIN(a, b);
23
23
  }
@@ -27,7 +27,7 @@ int max3(int a, int b, int c)
27
27
  return MAX3(a, b, c);
28
28
  }
29
29
 
30
- int max(int a, int b)
30
+ int max2(int a, int b)
31
31
  {
32
32
  return MAX(a, b);
33
33
  }
@@ -127,8 +127,8 @@ char *progname(void)
127
127
  /* concatenate two strings freeing the second */
128
128
  char *estrcat(char *str1, char *str2)
129
129
  {
130
- int len1 = strlen(str1);
131
- int len2 = strlen(str2);
130
+ size_t len1 = strlen(str1);
131
+ size_t len2 = strlen(str2);
132
132
  REALLOC_N(str1, char, len1 + len2 + 3); // leave room for <CR>
133
133
  memcpy(str1 + len1, str2, len2 + 1); // make sure '\0' copied too
134
134
  free(str2);
@@ -138,10 +138,11 @@ char *estrcat(char *str1, char *str2)
138
138
  /* epstrdup: duplicate a string with a format, report if error */
139
139
  char *epstrdup(const char *fmt, int len, ...)
140
140
  {
141
+ char *string;
141
142
  va_list args;
142
- len += strlen(fmt);
143
+ len += (int)strlen(fmt);
143
144
 
144
- char *string = ALLOC_N(char, len + 1);
145
+ string = ALLOC_N(char, len + 1);
145
146
  va_start(args, len);
146
147
  vsprintf(string, fmt, args);
147
148
  va_end(args);
@@ -227,7 +228,7 @@ char *strfmt(const char *fmt, ...)
227
228
  char *string;
228
229
  char *p = (char *)fmt, *q;
229
230
  va_list args;
230
- int len = strlen(fmt) + 1;
231
+ int len = (int)strlen(fmt) + 1;
231
232
  int slen;
232
233
  char *s;
233
234
  long i;
@@ -244,7 +245,7 @@ char *strfmt(const char *fmt, ...)
244
245
  p++;
245
246
  s = va_arg(args, char *);
246
247
  if (s) {
247
- slen = strlen(s);
248
+ slen = (int)strlen(s);
248
249
  len += slen;
249
250
  *q = 0;
250
251
  REALLOC_N(string, char, len);
data/ext/global.h CHANGED
@@ -4,29 +4,34 @@
4
4
  #include <stdlib.h>
5
5
  #include <stdio.h>
6
6
  #include <assert.h>
7
- //#define DEBUG
7
+ /*
8
+ #define DEBUG
8
9
  #define VALGRIND
9
-
10
+ */
10
11
  #define false 0
11
12
  #define true 1
12
13
 
13
- typedef unsigned char bool;
14
+ typedef unsigned int bool;
14
15
  typedef unsigned char uchar;
15
16
  typedef unsigned int uint;
16
17
 
17
- typedef void (*destroy_func_t)(void *p);
18
+ typedef void (*free_ft)(void *key);
18
19
 
19
20
  #include "lang.h"
20
21
  #include "except.h"
21
22
 
23
+ #define ref(obj) obj->ref_cnt++
24
+ #define deref(obj) obj->ref_cnt--
25
+
22
26
  #define MAX_WORD_SIZE 255
23
- #define MAX_PATH 1024
27
+ #define MAX_FILE_PATH 1024
24
28
  #define MAX_BUFFER_SIZE 1024
25
29
  #define ARRAY_INIT_SIZE 4
26
30
 
27
31
  #define NELEMS(array) sizeof(array)/sizeof(array[0])
28
32
 
29
33
  #define ZEROSET(ptr, type, n) memset(ptr, 0, sizeof(type)*(n))
34
+ #define ALLOC_AND_ZERO(type) (type*)memset(emalloc(sizeof(type)), 0, sizeof(type))
30
35
  #define ALLOC_AND_ZERO_N(type,n) (type*)ZEROSET(emalloc(sizeof(type)*(n)), type, n)
31
36
 
32
37
  #define MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -50,7 +55,6 @@ typedef void (*destroy_func_t)(void *p);
50
55
  #define Jx fprintf(stderr,"%s, %d: %s\n", __FILE__, __LINE__, __func__);
51
56
  #define Xj fprintf(stdout,"%s, %d: %s\n", __FILE__, __LINE__, __func__);
52
57
 
53
- #define efree free
54
58
  extern void *emalloc(size_t n);
55
59
  extern void *erealloc(void *ptr, size_t n);
56
60
  extern char *estrdup(const char *s);
@@ -63,12 +67,12 @@ extern int scmp(const void *p1, const void *p2);
63
67
  extern int icmp(const void *p1, const void *p2);
64
68
  extern int icmp_risky(const void *p1, const void *p2);
65
69
 
66
- int min(int a, int b);
67
- int min3(int a, int b, int c);
68
- int max(int a, int b);
69
- int max3(int a, int b, int c);
70
+ extern int min2(int a, int b);
71
+ extern int min3(int a, int b, int c);
72
+ extern int max2(int a, int b);
73
+ extern int max3(int a, int b, int c);
70
74
 
71
- char *dbl_to_s(char *buf, double num);
72
- void lower_str(char *str);
73
- char *strfmt(const char *fmt, ...);
75
+ extern char *dbl_to_s(char *buf, double num);
76
+ extern void lower_str(char *str);
77
+ extern char *strfmt(const char *fmt, ...);
74
78
  #endif
data/ext/hash.c CHANGED
@@ -255,11 +255,9 @@ HshEntry *h_lookup(HshTable *ht, register const void *key)
255
255
 
256
256
  typedef void (*free_func)(void *);
257
257
  void dummy_free(void *p)
258
- {
259
- //printf("Shouldn't do nuthin");
260
- }
258
+ { }
261
259
 
262
- HshTable *h_new_str(void (*free_key)(void *key), void (*free_value)(void *value))
260
+ HshTable *h_new_str(free_ft free_key, free_ft free_value)
263
261
  {
264
262
  HshTable *ht;
265
263
  if (num_free_hts > 0) {
@@ -278,10 +276,7 @@ HshTable *h_new_str(void (*free_key)(void *key), void (*free_value)(void *value)
278
276
  return ht;
279
277
  }
280
278
 
281
- HshTable *h_new(unsigned int (*hash)(const void *key),
282
- int (*eq)(const void *key1, const void *key2),
283
- void (*free_key)(void *key),
284
- void (*free_value)(void *value))
279
+ HshTable *h_new(hash_ft hash, eq_ft eq, free_ft free_key, free_ft free_value)
285
280
  {
286
281
  HshTable *ht = h_new_str(free_key, free_value);
287
282
 
@@ -298,7 +293,7 @@ void h_clear(HshTable *ht)
298
293
  free_func free_key = ht->free_key;
299
294
  free_func free_value = ht->free_value;
300
295
 
301
- // Clear all the hash values and keys as necessary
296
+ /* Clear all the hash values and keys as necessary */
302
297
  for (i = 0; i <= ht->mask; i++) {
303
298
  he = &ht->table[i];
304
299
  if (he->key != NULL && he->key != dummy_key) {
@@ -309,13 +304,15 @@ void h_clear(HshTable *ht)
309
304
  }
310
305
  ht->used = 0;
311
306
  ht->fill = 0;
307
+ /* for some reason the following line doesn't seem to help */
308
+ /* ZEROSET(ht->table, HshEntry, ht->mask + 1); */
312
309
  }
313
310
 
314
311
  void h_destroy(HshTable *ht)
315
312
  {
316
313
  h_clear(ht);
317
314
 
318
- // if a new table was created, be sure to free it
315
+ /* if a new table was created, be sure to free it */
319
316
  if (ht->table != ht->smalltable) free(ht->table);
320
317
 
321
318
  if (num_free_hts < MAX_FREE_HASH_TABLES) {
@@ -389,20 +386,16 @@ int h_resize(HshTable *ht, int min_newsize) {
389
386
  }
390
387
  memset(ht->table, 0, sizeof(HshEntry) * newsize);
391
388
  i = ht->used;
392
- //i = ht->fill;
393
389
  ht->fill = ht->used;
394
390
  ht->mask = newsize - 1;
395
- int j = 0;
391
+
396
392
  for (he_old = oldtable; i > 0; he_old++) {
397
- j++;
398
- if (he_old->value != NULL) {// active entry
393
+ if (he_old->value != NULL) {/* active entry */
399
394
  he_new = ht->lookup(ht, he_old->key);
400
395
  he_new->key = he_old->key;
401
396
  he_new->value = he_old->value;
402
397
  i--;
403
- //} else if (he_old->key == dummy_key) { //dummy entry
404
- // i--;
405
- } // else empty entry so nothing to do
398
+ } /* else empty entry so nothing to do */
406
399
  }
407
400
  if (oldtable != smallcopy && oldtable != ht->smalltable)
408
401
  free(oldtable);
@@ -453,7 +446,7 @@ void h_each(HshTable *ht,
453
446
  HshEntry *he;
454
447
  int i = ht->used;
455
448
  for (he = ht->table; i > 0; he++) {
456
- if (he->value != NULL) {// active entry
449
+ if (he->value != NULL) {/* active entry */
457
450
  each_kv(he->key, he->value, arg);
458
451
  i--;
459
452
  }
@@ -468,6 +461,7 @@ HshTable *h_clone(HshTable *ht,
468
461
  HshEntry *he;
469
462
  int i = ht->used;
470
463
  HshTable *ht_clone;
464
+
471
465
  if (ht->lookup == &h_lookup_str) {
472
466
  ht_clone = h_new_str(ht->free_key, ht->free_value);
473
467
  } else {
@@ -475,7 +469,7 @@ HshTable *h_clone(HshTable *ht,
475
469
  }
476
470
 
477
471
  for (he = ht->table; i > 0; he++) {
478
- if (he->value != NULL) {// active entry
472
+ if (he->value != NULL) {/* active entry */
479
473
  key = clone_key ? clone_key(he->key) : he->key;
480
474
  value = clone_value ? clone_value(he->value) : he->value;
481
475
  h_set(ht_clone, key, value);
data/ext/hash.h CHANGED
@@ -27,8 +27,8 @@ void *ht_delete(HashEntry **ht, char *name);
27
27
  ****************************************************************************/
28
28
 
29
29
  #define Hsh_MINSIZE 8
30
- #define SLOW_DOWN 50000 // stop increasing the hash table so quickly to
31
- // conserve memory
30
+ #define SLOW_DOWN 50000 /* stop increasing the hash table so quickly to
31
+ * conserve memory */
32
32
  extern char *dummy_key;
33
33
  enum {
34
34
  HASH_KEY_DOES_NOT_EXIST = 0,
@@ -45,24 +45,24 @@ typedef struct {
45
45
  typedef struct HshTable {
46
46
  int fill; /* # Active + # Dummy */
47
47
  int used; /* # Active */
48
- int mask;
48
+ int mask; /* size of table - 1 */
49
49
 
50
50
  /* table points to smalltable for small tables, else to
51
51
  * additional malloc'ed memory. */
52
52
  HshEntry *table;
53
53
  HshEntry smalltable[Hsh_MINSIZE];
54
- HshEntry *(*lookup)(struct HshTable *ht, const void *key);
54
+ HshEntry *(*lookup)(struct HshTable *ht, register const void *key);
55
55
  unsigned int (*hash)(const void *key);
56
56
  int (*eq)(const void *key1, const void *key2);
57
- void (*free_key)(void *key);
58
- void (*free_value)(void *value);
57
+ free_ft free_key;
58
+ free_ft free_value;
59
59
  } HshTable;
60
60
 
61
- HshTable *h_new_str(void (*free_key)(void *key), void (*free_value)(void *value));
62
- HshTable *h_new(unsigned int (*hash)(const void *key),
63
- int (*eq)(const void *key1, const void *key2),
64
- void (*free_key)(void *key),
65
- void (*free_value)(void *value));
61
+ typedef unsigned int (*hash_ft)(const void *key);
62
+ typedef int (*eq_ft)(const void *key1, const void *key2);
63
+
64
+ HshTable *h_new_str(free_ft free_key, free_ft free_value);
65
+ HshTable *h_new(hash_ft hash, eq_ft eq, free_ft free_key, free_ft free_value);
66
66
  void h_destroy(HshTable *ht);
67
67
  void h_clear(HshTable *ht);
68
68
 
data/ext/hashset.c CHANGED
@@ -16,7 +16,7 @@ HashSet *hs_create(unsigned int (*hash)(const void *p),
16
16
  void (*free_elem)(void *p))
17
17
  {
18
18
  HashSet *hs = ALLOC(HashSet);
19
- hs->ht = h_new(hash, eq, NULL, &efree);
19
+ hs->ht = h_new(hash, eq, NULL, &free);
20
20
  hs->elems = NULL;
21
21
  hs->capa = hs->size = 0;
22
22
  if (free_elem == NULL)
@@ -29,7 +29,7 @@ HashSet *hs_create(unsigned int (*hash)(const void *p),
29
29
  HashSet *hs_str_create(void (*free_elem)(void *p))
30
30
  {
31
31
  HashSet *hs = ALLOC(HashSet);
32
- hs->ht = h_new_str(NULL, &efree);
32
+ hs->ht = h_new_str((free_ft)NULL, &free);
33
33
  hs->elems = NULL;
34
34
  hs->capa = hs->size = 0;
35
35
  if (free_elem == NULL)
@@ -39,9 +39,8 @@ HashSet *hs_str_create(void (*free_elem)(void *p))
39
39
  return hs;
40
40
  }
41
41
 
42
- void hs_destroy(void *p)
42
+ void hs_destroy(HashSet *hs)
43
43
  {
44
- HashSet *hs = (HashSet *)p;
45
44
  h_destroy(hs->ht);
46
45
  free(hs->elems);
47
46
  free(hs);
@@ -54,14 +53,13 @@ void hs_clear(HashSet *self)
54
53
  hs_del(self, self->elems[i]);
55
54
  }
56
55
 
57
- void hs_destroy_all(void *p)
56
+ void hs_destroy_all(HashSet *hs)
58
57
  {
59
58
  int i;
60
- HashSet *hs = (HashSet *)p;
61
59
  if (hs->free_elem != &dummy_free)
62
60
  for (i = 0; i < hs->size; i++)
63
61
  hs->free_elem(hs->elems[i]);
64
- hs_destroy(p);
62
+ hs_destroy(hs);
65
63
  }
66
64
 
67
65
  int hs_add(HashSet *hs, void *elem)
data/ext/hashset.h CHANGED
@@ -17,8 +17,8 @@ HashSet *hs_create(unsigned int (*hash)(const void *p),
17
17
  int (*eq)(const void *p1, const void *p2),
18
18
  void (*free_elem)(void *p));
19
19
  HashSet *hs_str_create(void (*free_elem)(void *p));
20
- void hs_destroy(void *p);
21
- void hs_destroy_all(void *p);
20
+ void hs_destroy(HashSet *hs);
21
+ void hs_destroy_all(HashSet *hs);
22
22
  int hs_add(HashSet *hs, void *elem);
23
23
  int hs_del(HashSet *hs, void *elem);
24
24
  void *hs_rem(HashSet *hs, void *elem);
@@ -27,11 +27,12 @@ HashSet *hs_merge(HashSet *hs, HashSet *other);
27
27
  void *hs_orig(HashSet *hs, void *elem);
28
28
  void hs_clear(HashSet *self);
29
29
 
30
- // TODO: finish these functions.
31
- //int hs_osf(HashSet *hs, void *elem);
32
- //HashSet hs_or(HashSet *hs1, HashSet *h2);
33
- //HashSet hs_excl_or(HashSet *hs1, HashSet *h2);
34
- //HashSet hs_and(HashSet *hs1, HashSet *h2);
35
- //HashSet hs_mask(HashSet *hs1, HashSet *h2);
30
+ /* TODO: finish these functions.
31
+ int hs_osf(HashSet *hs, void *elem);
32
+ HashSet hs_or(HashSet *hs1, HashSet *h2);
33
+ HashSet hs_excl_or(HashSet *hs1, HashSet *h2);
34
+ HashSet hs_and(HashSet *hs1, HashSet *h2);
35
+ HashSet hs_mask(HashSet *hs1, HashSet *h2);
36
+ */
36
37
 
37
38
  #endif
data/ext/helper.c CHANGED
@@ -1,4 +1,4 @@
1
- #include <string.h>
1
+ #include "helper.h"
2
2
 
3
3
  inline int hlp_string_diff(register const char *const s1,
4
4
  register const char *const s2)
data/ext/helper.h CHANGED
@@ -1,5 +1,6 @@
1
1
  #ifndef FRT_HELPER_H
2
2
  #define FRT_HELPER_H
3
3
 
4
- int hlp_string_diff(char *s1, char *s2);
4
+ extern inline int hlp_string_diff(register const char *const s1,
5
+ register const char *const s2);
5
6
  #endif
data/ext/inc/except.h CHANGED
@@ -7,7 +7,6 @@
7
7
  #define BODY 0
8
8
  #define FINALLY -1
9
9
  #define EXCEPTION 1
10
- #define ERROR 1
11
10
  #define IO_ERROR 2
12
11
  #define ARG_ERROR 3
13
12
  #define EOF_ERROR 4
@@ -29,35 +28,38 @@ RUBY_EXTERN int rb_thread_critical;
29
28
  extern xcontext_t *xtop_context;
30
29
 
31
30
  #define TRY\
32
- xcontext_t xcontext;\
33
- rb_thread_critical = Qtrue;\
34
- xcontext.next = xtop_context;\
35
- xtop_context = &xcontext;\
36
- xcontext.handled = true;\
37
- xcontext.in_finally = false;\
38
- switch (setjmp(xcontext.jbuf)) {\
39
- case BODY:
31
+ do {\
32
+ xcontext_t xcontext;\
33
+ rb_thread_critical = Qtrue;\
34
+ xcontext.next = xtop_context;\
35
+ xtop_context = &xcontext;\
36
+ xcontext.handled = true;\
37
+ xcontext.in_finally = false;\
38
+ switch (setjmp(xcontext.jbuf)) {\
39
+ case BODY:
40
40
 
41
41
 
42
42
  #define XENDTRY\
43
- }\
44
- xtop_context = xcontext.next;\
45
- if (!xcontext.handled) {\
46
- RAISE(xcontext.excode, xcontext.msg);\
47
- }\
48
- rb_thread_critical = 0;
49
-
50
- #define ENDTRY\
51
- }\
52
- if (!xcontext.in_finally) {\
43
+ }\
53
44
  xtop_context = xcontext.next;\
54
45
  if (!xcontext.handled) {\
55
46
  RAISE(xcontext.excode, xcontext.msg);\
56
47
  }\
57
- xcontext.in_finally = 1;\
58
- longjmp(xcontext.jbuf, FINALLY);\
59
- }\
60
- rb_thread_critical = 0;
48
+ rb_thread_critical = 0;\
49
+ } while (0);
50
+
51
+ #define ENDTRY\
52
+ }\
53
+ if (!xcontext.in_finally) {\
54
+ xtop_context = xcontext.next;\
55
+ if (!xcontext.handled) {\
56
+ RAISE(xcontext.excode, xcontext.msg);\
57
+ }\
58
+ xcontext.in_finally = 1;\
59
+ longjmp(xcontext.jbuf, FINALLY);\
60
+ }\
61
+ rb_thread_critical = 0;\
62
+ } while (0);
61
63
 
62
64
  #define XFINALLY default: xcontext.in_finally = 1;
63
65
 
data/ext/inc/lang.h CHANGED
@@ -7,7 +7,17 @@
7
7
  #define FERRET_EXT
8
8
 
9
9
  #define MAX_ERROR_LEN 2048
10
- #define eprintf(...) ft_raise(__FILE__, __LINE__, __VA_ARGS__)
10
+
11
+ typedef LONG_LONG llong;
12
+ typedef unsigned LONG_LONG ullong;
13
+
14
+ #ifdef WIN32
15
+ # undef close
16
+ # undef rename
17
+ extern void eprintf(VALUE etype, const char *fmt, ...);
18
+ #else
19
+ # define eprintf(...) ft_raise(__FILE__, __LINE__, __VA_ARGS__)
20
+ #endif
11
21
  extern void ft_raise(char *file, int line_num, VALUE etype, const char *fmt, ...);
12
22
  extern void weprintf(const char *fmt, ...);
13
23
  extern char *progname(void);