Ignore:
Timestamp:
Jul 9, 2020, 8:51:43 AM (4 years ago)
Author:
coas-nagasima
Message:

mrubyを2.1.1に更新

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

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/mruby-2.1.1/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c

    r331 r439  
    1 #include <stdio.h>
     1#include <mruby.h>
     2
     3#ifdef MRB_DISABLE_STDIO
     4# error mruby-bin-mrbc conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
     5#endif
     6
    27#include <stdlib.h>
    38#include <string.h>
    4 #include <mruby.h>
    59#include <mruby/compile.h>
    610#include <mruby/dump.h>
     
    1923  mrb_bool check_syntax : 1;
    2024  mrb_bool verbose      : 1;
     25  mrb_bool remove_lv    : 1;
    2126  unsigned int flags    : 4;
    2227};
     
    3439  "-e           generate little endian iseq data",
    3540  "-E           generate big endian iseq data",
     41  "--remove-lv  remove local variables",
    3642  "--verbose    run at verbose mode",
    3743  "--version    print the version",
     
    7076parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
    7177{
    72   char *outfile = NULL;
    7378  static const struct mrbc_args args_zero = { 0 };
    7479  int i;
     
    8590        if (args->outfile) {
    8691          fprintf(stderr, "%s: an output file is already specified. (%s)\n",
    87                   args->prog, outfile);
     92                  args->prog, args->outfile);
    8893          return -1;
    8994        }
     
    143148          exit(EXIT_SUCCESS);
    144149        }
     150        else if (strcmp(argv[i] + 2, "remove-lv") == 0) {
     151          args->remove_lv = TRUE;
     152          break;
     153        }
    145154        return -1;
    146155      default:
     
    179188  }
    180189  fn = args->argv[args->idx++];
    181   p->f = fopen(fn, "r");
     190  p->f = fopen(fn, "rb");
    182191  if (p->f == NULL) {
    183192    fprintf(stderr, "%s: cannot open program file. (%s)\n", args->prog, fn);
     
    206215  else {
    207216    need_close = TRUE;
    208     if ((infile = fopen(input, "r")) == NULL) {
     217    if ((infile = fopen(input, "rb")) == NULL) {
    209218      fprintf(stderr, "%s: cannot open program file. (%s)\n", args->prog, input);
    210219      return mrb_nil_value();
     
    233242  mrb_irep *irep = proc->body.irep;
    234243
     244  if (args->remove_lv) {
     245    mrb_irep_remove_lv(mrb, irep);
     246  }
    235247  if (args->initname) {
    236248    n = mrb_dump_irep_cfunc(mrb, irep, args->flags, wfp, args->initname);
Note: See TracChangeset for help on using the changeset viewer.