htmlgrid 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.0.3 / 23.12.2011
2
+
3
+ * patch grid.c for Ruby 1.9.3
4
+
1
5
  === 1.0.2 / 23.12.2011
2
6
 
3
7
  * Fix FachinfoDocument encoding error
data/ext/htmlgrid/grid.c CHANGED
@@ -288,14 +288,16 @@ VALUE grid_width(self)
288
288
  VALUE grid_cat_attribute(pair, string)
289
289
  VALUE pair, string;
290
290
  {
291
- VALUE val;
291
+ VALUE val, tmp1, tmp2;
292
292
  char *key, *value;
293
293
  long len;
294
294
  val = rb_ary_entry(pair, 1);
295
295
  if(val == Qnil)
296
296
  return string;
297
- key = STR2CSTR(rb_ary_entry(pair, 0));
298
- value = STR2CSTR(rb_funcall(val, rb_intern("to_s"), 0));
297
+ tmp1 = rb_ary_entry(pair, 0);
298
+ key = StringValuePtr(tmp1);
299
+ tmp2 = rb_funcall(val, rb_intern("to_s"), 0);
300
+ value = StringValuePtr(tmp2);
299
301
  char attr[strlen(key) + strlen(value) + 5];
300
302
  len = sprintf(attr, " %s=\"%s\"", key, value);
301
303
  return rb_str_cat(string, attr, len);
@@ -333,8 +335,9 @@ VALUE grid_store_allowed_attribute(pair, attrs)
333
335
  VALUE pair, attrs;
334
336
  {
335
337
  char* key;
336
-
337
- key = STR2CSTR(rb_ary_entry(pair, 0));
338
+ VALUE tmp;
339
+ tmp = rb_ary_entry(pair, 0);
340
+ key = StringValuePtr(tmp);
338
341
  if( strcasecmp(key, "align") == 0
339
342
  || strcasecmp(key, "class") == 0
340
343
  || strcasecmp(key, "colspan") == 0
@@ -367,6 +370,7 @@ VALUE grid_to_html(self, cgi)
367
370
  long idx, cdx, xval, yval, spanplus, len;
368
371
  Data_Get_Struct(self, cGrid, cg);
369
372
  //attrs = rb_iv_get(self, "@attributes");
373
+ //printf("getin grid_to_html\n");
370
374
  result = rb_str_new2("");
371
375
  grid_cat_starttag(result, "TABLE", cg->attributes);
372
376
  for(idx=0, yval=0; yval < cg->height; yval++)
@@ -416,13 +420,25 @@ VALUE grid_to_html(self, cgi)
416
420
  for(cdx=0; cdx<cf->content_count; cdx++)
417
421
  {
418
422
  item = cf->content[cdx];
423
+ //item => ODDB::View::WelcomeHead
424
+ //printf("item.encoding = %s \n", StringValuePtr(item));
425
+ //printf("item.encoding = %s \n", rb_enc_get(item)->name);
419
426
  if(rb_obj_class(item) == rb_cString)
420
427
  rb_str_concat(result, item);
421
428
  else if(rb_respond_to(item, id_to_html))
422
429
  {
423
430
  VALUE item_html = rb_funcall(item, id_to_html, 1, cgi);
424
- if(rb_obj_is_kind_of(item_html, rb_cString) == Qtrue)
431
+ if(rb_obj_is_kind_of(item_html, rb_cString) == Qtrue){
432
+ // koko
433
+ //result = rb_str_force_encoding(result, "UTF-8");
434
+ //item_html = rb_str_force_encoding(item_html, "UTF-8");
435
+ //VALUE enc;
436
+ //enc = rb_obj_encoding(result);
437
+ //printf("encoding type ");
438
+ //printf("%s %s\n", rb_enc_get(result)->name, rb_enc_get(item_html)->name);
425
439
  rb_str_concat(result, item_html);
440
+ //printf("4\n");
441
+ }
426
442
  }
427
443
  else if(rb_obj_is_kind_of(item, rb_eException) == Qtrue)
428
444
  {
@@ -441,12 +457,14 @@ VALUE grid_to_html(self, cgi)
441
457
  else
442
458
  rb_str_concat(result, rb_funcall(item, id_to_s, 0));
443
459
  }
460
+ //printf("10\n");
444
461
  }
445
462
  grid_cat_endtag(result, cf->tag);
446
463
  }
447
464
  rb_str_cat(result, tr_close, 5);
448
465
  }
449
466
  rb_str_cat(result, "</TABLE>", 8);
467
+ //printf("end grid_to_html\n");
450
468
  return result;
451
469
  }
452
470
 
@@ -749,7 +767,7 @@ void grid_field_add_tag(cf, tagname)
749
767
  cField * cf;
750
768
  VALUE tagname;
751
769
  {
752
- strcpy(cf->tag, STR2CSTR(tagname));
770
+ strcpy(cf->tag, StringValuePtr(tagname));
753
771
  }
754
772
 
755
773
  VALUE grid_add_tag(argc, argv, self)
data/lib/htmlgrid/grid.rb CHANGED
@@ -25,7 +25,7 @@
25
25
  # HtmlGrid::Grid -- htmlgrid -- 09.12.2011 -- mhatakeyama@ywesee.com
26
26
  # HtmlGrid::Grid -- htmlgrid -- 12.01.2010 -- hwyss@ywesee.com
27
27
  begin
28
- VERSION = '1.0.2'
28
+ VERSION = '1.0.3'
29
29
  begin
30
30
  # for gem install
31
31
  ext_dir = File.expand_path('../../ext/htmlgrid', File.dirname(__FILE__))
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmlgrid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Masaomi Hatakeyama, Zeno R.R. Davatz