From 77e50caaf2ef81cd91075cf836fed0e75718ffb4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 23:12:02 +0200 Subject: Adding debian version 1.8.3-2. Signed-off-by: Daniel Baumann --- debian/vendor-h2o/deps/mruby-errno/.travis.yml | 2 + debian/vendor-h2o/deps/mruby-errno/README.md | 27 + debian/vendor-h2o/deps/mruby-errno/mrbgem.rake | 6 + debian/vendor-h2o/deps/mruby-errno/run_test.rb | 26 + debian/vendor-h2o/deps/mruby-errno/src/errno.c | 175 +++++ debian/vendor-h2o/deps/mruby-errno/src/gen.rb | 25 + .../deps/mruby-errno/src/known_errors.def | 145 +++++ .../deps/mruby-errno/src/known_errors_def.cstub | 725 +++++++++++++++++++++ .../deps/mruby-errno/src/known_errors_e2c.cstub | 435 +++++++++++++ debian/vendor-h2o/deps/mruby-errno/test/errno.rb | 60 ++ 10 files changed, 1626 insertions(+) create mode 100644 debian/vendor-h2o/deps/mruby-errno/.travis.yml create mode 100644 debian/vendor-h2o/deps/mruby-errno/README.md create mode 100644 debian/vendor-h2o/deps/mruby-errno/mrbgem.rake create mode 100644 debian/vendor-h2o/deps/mruby-errno/run_test.rb create mode 100644 debian/vendor-h2o/deps/mruby-errno/src/errno.c create mode 100755 debian/vendor-h2o/deps/mruby-errno/src/gen.rb create mode 100644 debian/vendor-h2o/deps/mruby-errno/src/known_errors.def create mode 100644 debian/vendor-h2o/deps/mruby-errno/src/known_errors_def.cstub create mode 100644 debian/vendor-h2o/deps/mruby-errno/src/known_errors_e2c.cstub create mode 100644 debian/vendor-h2o/deps/mruby-errno/test/errno.rb (limited to 'debian/vendor-h2o/deps/mruby-errno') diff --git a/debian/vendor-h2o/deps/mruby-errno/.travis.yml b/debian/vendor-h2o/deps/mruby-errno/.travis.yml new file mode 100644 index 0000000..ffe2272 --- /dev/null +++ b/debian/vendor-h2o/deps/mruby-errno/.travis.yml @@ -0,0 +1,2 @@ +script: + - "ruby run_test.rb all test" diff --git a/debian/vendor-h2o/deps/mruby-errno/README.md b/debian/vendor-h2o/deps/mruby-errno/README.md new file mode 100644 index 0000000..e3c594c --- /dev/null +++ b/debian/vendor-h2o/deps/mruby-errno/README.md @@ -0,0 +1,27 @@ +mruby-errno +=========== + +Errno module for mruby + + +## License + +Copyright (c) 2013 Internet Initiative Japan Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/debian/vendor-h2o/deps/mruby-errno/mrbgem.rake b/debian/vendor-h2o/deps/mruby-errno/mrbgem.rake new file mode 100644 index 0000000..ba3d60d --- /dev/null +++ b/debian/vendor-h2o/deps/mruby-errno/mrbgem.rake @@ -0,0 +1,6 @@ +MRuby::Gem::Specification.new('mruby-errno') do |spec| + spec.license = 'MIT' + spec.authors = 'Internet Initiative Japan Inc.' + + spec.cc.include_paths << "#{build.root}/src" +end diff --git a/debian/vendor-h2o/deps/mruby-errno/run_test.rb b/debian/vendor-h2o/deps/mruby-errno/run_test.rb new file mode 100644 index 0000000..d9566a2 --- /dev/null +++ b/debian/vendor-h2o/deps/mruby-errno/run_test.rb @@ -0,0 +1,26 @@ +#!/usr/bin/env ruby +# +# mrbgems test runner +# + +gemname = File.basename(File.dirname(File.expand_path __FILE__)) + +if __FILE__ == $0 + repository, dir = 'https://github.com/mruby/mruby.git', 'tmp/mruby' + build_args = ARGV + build_args = ['all', 'test'] if build_args.nil? or build_args.empty? + + Dir.mkdir 'tmp' unless File.exist?('tmp') + unless File.exist?(dir) + system "git clone #{repository} #{dir}" + end + + exit system(%Q[cd #{dir}; MRUBY_CONFIG=#{File.expand_path __FILE__} ruby minirake #{build_args.join(' ')}]) +end + +MRuby::Build.new do |conf| + toolchain :gcc + conf.gembox 'default' + + conf.gem File.expand_path(File.dirname(__FILE__)) +end diff --git a/debian/vendor-h2o/deps/mruby-errno/src/errno.c b/debian/vendor-h2o/deps/mruby-errno/src/errno.c new file mode 100644 index 0000000..3617efd --- /dev/null +++ b/debian/vendor-h2o/deps/mruby-errno/src/errno.c @@ -0,0 +1,175 @@ +#include "mruby.h" +#include "mruby/array.h" +#include "mruby/class.h" +#include "mruby/hash.h" +#include "mruby/numeric.h" +#include "mruby/string.h" +#include "mruby/variable.h" +#include +#include +#include + +#if MRUBY_RELEASE_NO < 10000 +static struct RClass * +mrb_module_get(mrb_state *mrb, const char *name) +{ + return mrb_class_get(mrb, name); +} +#endif + +static mrb_value +mrb_sce_init(mrb_state *mrb, mrb_value self) +{ + mrb_value c, e2c, m, str; + mrb_int n; + int argc, no_errno = 0; + char buf[20]; + + argc = mrb_get_args(mrb, "o|i", &m, &n); + if (argc == 1) { + if (mrb_type(m) == MRB_TT_FIXNUM) { + n = mrb_fixnum(m); + m = mrb_nil_value(); + } else { + no_errno = 1; + } + } + if (!no_errno) { + e2c = mrb_const_get(mrb, mrb_obj_value(mrb_module_get(mrb, "Errno")), mrb_intern_lit(mrb, "Errno2class")); + c = mrb_hash_fetch(mrb, e2c, mrb_fixnum_value(n), mrb_nil_value()); + if (!mrb_nil_p(c)) { + mrb_basic_ptr(self)->c = mrb_class_ptr(c); + str = mrb_str_new_cstr(mrb, strerror(n)); + } else { + mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "errno"), mrb_fixnum_value(n)); + str = mrb_str_new_cstr(mrb, "Unknown error: "); + snprintf(buf, sizeof(buf), "%d", (int)n); + mrb_str_cat2(mrb, str, buf); + } + } else { + str = mrb_str_new_cstr(mrb, "unknown error"); + } + if (!mrb_nil_p(m)) { + mrb_str_cat2(mrb, str, " - "); + mrb_str_append(mrb, str, m); + } + mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "mesg"), str); + return self; +} + +static mrb_value +mrb_sce_errno(mrb_state *mrb, mrb_value self) +{ + struct RClass *c; + mrb_sym sym; + + c = mrb_class(mrb, self); + sym = mrb_intern_lit(mrb, "Errno"); +#if MRUBY_RELEASE_NO < 10000 + if (mrb_const_defined_at(mrb, c, sym)) { +#else + if (mrb_const_defined_at(mrb, mrb_obj_value(c), sym)) { +#endif + return mrb_const_get(mrb, mrb_obj_value(c), sym); + } else { + sym = mrb_intern_lit(mrb, "errno"); + return mrb_attr_get(mrb, self, sym); + } +} + +static mrb_value +mrb_sce_to_s(mrb_state *mrb, mrb_value self) +{ + return mrb_attr_get(mrb, self, mrb_intern_lit(mrb, "mesg")); +} + +static mrb_value +mrb_sce_sys_fail(mrb_state *mrb, mrb_value cls) +{ + struct RClass *cl, *sce; + mrb_value e, msg; + mrb_int no; + int argc; + char name[8]; + + sce = mrb_class_get(mrb, "SystemCallError"); + argc = mrb_get_args(mrb, "i|S", &no, &msg); + if (argc == 1) { + e = mrb_funcall(mrb, mrb_obj_value(sce), "new", 1, mrb_fixnum_value(no)); + } else { + e = mrb_funcall(mrb, mrb_obj_value(sce), "new", 2, msg, mrb_fixnum_value(no)); + } + if (mrb_obj_class(mrb, e) == sce) { + snprintf(name, sizeof(name), "E%03ld", (long)no); + cl = mrb_define_class_under(mrb, mrb_module_get(mrb, "Errno"), name, sce); + mrb_define_const(mrb, cl, "Errno", mrb_fixnum_value(no)); + mrb_basic_ptr(e)->c = cl; + } + mrb_exc_raise(mrb, e); + return mrb_nil_value(); /* NOTREACHED */ +} + +static mrb_value +mrb_exxx_init(mrb_state *mrb, mrb_value self) +{ + mrb_value m, no, str; + + no = mrb_const_get(mrb, mrb_obj_value(mrb_class(mrb, self)), mrb_intern_lit(mrb, "Errno")); + str = mrb_str_new_cstr(mrb, strerror(mrb_fixnum(no))); + + m = mrb_nil_value(); + mrb_get_args(mrb, "|S", &m); + if (!mrb_nil_p(m)) { + mrb_str_cat2(mrb, str, " - "); + mrb_str_append(mrb, str, m); + } + mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "mesg"), str); + return self; +} + +void +mrb_mruby_errno_gem_init(mrb_state *mrb) +{ + struct RClass *e, *eno, *sce, *ste; + mrb_value h, noerror; + + ste = mrb_class_get(mrb, "StandardError"); + + sce = mrb_define_class(mrb, "SystemCallError", ste); + mrb_define_class_method(mrb, sce, "_sys_fail", mrb_sce_sys_fail, MRB_ARGS_REQ(1)); + mrb_define_method(mrb, sce, "errno", mrb_sce_errno, MRB_ARGS_NONE()); + mrb_define_method(mrb, sce, "to_s", mrb_sce_to_s, MRB_ARGS_NONE()); + mrb_define_method(mrb, sce, "initialize", mrb_sce_init, MRB_ARGS_ARG(1, 1)); + + eno = mrb_define_module(mrb, "Errno"); + h = mrb_hash_new(mrb); + mrb_define_const(mrb, eno, "Errno2class", h); + + e = mrb_define_class_under(mrb, eno, "NOERROR", sce); + mrb_define_const(mrb, e, "Errno", mrb_fixnum_value(0)); + mrb_define_method(mrb, e, "initialize", mrb_exxx_init, MRB_ARGS_OPT(1)); + //mrb_define_method(mrb, e, "===", mrb_exxx_cmp, MRB_ARGS_REQ(1)); + noerror = mrb_obj_value(e); + +#define itsdefined(SYM) \ + do { \ + int ai = mrb_gc_arena_save(mrb); \ + e = mrb_define_class_under(mrb, eno, #SYM, sce); \ + mrb_define_const(mrb, e, "Errno", mrb_fixnum_value(SYM)); \ + mrb_define_method(mrb, e, "initialize", mrb_exxx_init, MRB_ARGS_OPT(1)); \ + mrb_hash_set(mrb, h, mrb_fixnum_value(SYM), mrb_obj_value(e)); \ + mrb_gc_arena_restore(mrb, ai); \ + } while (0) + +#define itsnotdefined(SYM) \ + do { \ + mrb_define_const(mrb, eno, #SYM, noerror); \ + } while (0) + +#include "known_errors_def.cstub" +} + +void +mrb_mruby_errno_gem_final(mrb_state *mrb) +{ +} diff --git a/debian/vendor-h2o/deps/mruby-errno/src/gen.rb b/debian/vendor-h2o/deps/mruby-errno/src/gen.rb new file mode 100755 index 0000000..12e6b30 --- /dev/null +++ b/debian/vendor-h2o/deps/mruby-errno/src/gen.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +Dir.chdir(File.dirname($0)) + +e = File.open("known_errors_e2c.cstub", "w") +d = File.open("known_errors_def.cstub", "w") + +IO.readlines("known_errors.def").each { |name| + next if name =~ /^#/ + name.strip! + + e.write <