Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

Location:
EcnlProtoTool/trunk/mruby-1.3.0
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/mruby-1.3.0/src/variable.c

    r321 r331  
    55*/
    66
    7 #include "mruby.h"
    8 #include "mruby/array.h"
    9 #include "mruby/class.h"
    10 #include "mruby/proc.h"
    11 #include "mruby/string.h"
     7#include <mruby.h>
     8#include <mruby/array.h>
     9#include <mruby/class.h>
     10#include <mruby/proc.h>
     11#include <mruby/string.h>
    1212
    1313typedef int (iv_foreach_func)(mrb_state*,mrb_sym,mrb_value,void*);
     
    4545  iv_tbl *t;
    4646
    47   t = mrb_malloc(mrb, sizeof(iv_tbl));
     47  t = (iv_tbl*)mrb_malloc(mrb, sizeof(iv_tbl));
    4848  t->size = 0;
    4949  t->rootseg =  NULL;
     
    103103  }
    104104
    105   seg = mrb_malloc(mrb, sizeof(segment));
     105  seg = (segment*)mrb_malloc(mrb, sizeof(segment));
    106106  if (!seg) return;
    107107  seg->next = NULL;
     
    283283#else
    284284
    285 #include "mruby/khash.h"
     285#include <mruby/khash.h>
    286286
    287287#ifndef MRB_IVHASH_INIT_SIZE
     
    490490  iv_tbl *t = obj->iv;
    491491
     492  if (MRB_FROZEN_P(obj)) {
     493    mrb_raisef(mrb, E_RUNTIME_ERROR, "can't modify frozen %S", mrb_obj_value(obj));
     494  }
    492495  if (!t) {
    493496    t = obj->iv = iv_new(mrb);
     
    757760
    758761MRB_API mrb_value
    759 mrb_mod_cv_get(mrb_state *mrb, struct RClass * c, mrb_sym sym)
     762mrb_mod_cv_get(mrb_state *mrb, struct RClass *c, mrb_sym sym)
    760763{
    761764  struct RClass * cls = c;
    762765  mrb_value v;
     766  int given = FALSE;
    763767
    764768  while (c) {
    765769    if (c->iv && iv_get(mrb, c->iv, sym, &v)) {
    766       return v;
     770      given = TRUE;
    767771    }
    768772    c = c->super;
    769773  }
     774  if (given) return v;
    770775  if (cls && cls->tt == MRB_TT_SCLASS) {
    771776    mrb_value klass;
     
    774779                           mrb_intern_lit(mrb, "__attached__"));
    775780    c = mrb_class_ptr(klass);
    776     if (c->tt == MRB_TT_CLASS) {
     781    if (c->tt == MRB_TT_CLASS || c->tt == MRB_TT_MODULE) {
     782      given = FALSE;
    777783      while (c) {
    778784        if (c->iv && iv_get(mrb, c->iv, sym, &v)) {
    779           return v;
     785          given = TRUE;
    780786        }
    781787        c = c->super;
    782788      }
     789      if (given) return v;
    783790    }
    784791  }
     
    813820  }
    814821
    815   if (!cls->iv) {
    816     cls->iv = iv_new(mrb);
    817   }
    818 
    819   mrb_write_barrier(mrb, (struct RBasic*)cls);
    820   iv_put(mrb, cls->iv, sym, v);
     822  if (cls && cls->tt == MRB_TT_SCLASS) {
     823    mrb_value klass;
     824
     825    klass = mrb_obj_iv_get(mrb, (struct RObject*)cls,
     826                           mrb_intern_lit(mrb, "__attached__"));
     827    switch (mrb_type(klass)) {
     828    case MRB_TT_CLASS:
     829    case MRB_TT_MODULE:
     830    case MRB_TT_SCLASS:
     831      c = mrb_class_ptr(klass);
     832      break;
     833    default:
     834      c = cls;
     835      break;
     836    }
     837  }
     838  else{
     839    c = cls;
     840  }
     841
     842  if (!c->iv) {
     843    c->iv = iv_new(mrb);
     844  }
     845
     846  mrb_write_barrier(mrb, (struct RBasic*)c);
     847  iv_put(mrb, c->iv, sym, v);
    821848}
    822849
     
    927954      return v;
    928955    }
    929     if (c->tt == MRB_TT_SCLASS) {
     956    c2 = c;
     957    while (c2 && c2->tt == MRB_TT_SCLASS) {
    930958      mrb_value klass;
    931       klass = mrb_obj_iv_get(mrb, (struct RObject *)c,
     959      klass = mrb_obj_iv_get(mrb, (struct RObject *)c2,
    932960                             mrb_intern_lit(mrb, "__attached__"));
    933961      c2 = mrb_class_ptr(klass);
    934       if (c2->tt == MRB_TT_CLASS)
    935         c = c2;
    936     }
     962    }
     963    if (c2->tt == MRB_TT_CLASS || c2->tt == MRB_TT_MODULE) c = c2;
    937964    c2 = c;
    938965    for (;;) {
Note: See TracChangeset for help on using the changeset viewer.