Changeset 398
- Timestamp:
- 01/09/2008 00:01:45 (8 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
lib/shoes.rb (modified) (1 diff)
-
samples/jot.rb (modified) (1 diff)
-
shoes/world.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/shoes.rb
r326 r398 85 85 opts.banner = "Usage: shoes [options] (app.rb or app.shy)" 86 86 87 opts.separator ""88 opts.separator "Specific options:"89 90 87 opts.on("-m", "--manual", 91 "Open the built-in manual.") do |s|88 "Open the built-in manual.") do 92 89 @main_app = Shoes::Help 93 90 end 91 94 92 opts.on("-s", "--shy DIRECTORY", 95 93 "Compress a directory into a Shoes YAML (SHY) archive.") do |s| 96 94 @main_app = ShyMake.call(s) 95 end 96 97 opts.on_tail("-v", "--version", "Display the version info.") do 98 puts "shoes #{Shoes::RELEASE_NAME.downcase} (0.r#{Shoes::REVISION})" 99 raise SystemExit 100 end 101 102 opts.on_tail("-h", "--help", "Show this message") do 103 puts opts 104 raise SystemExit 97 105 end 98 106 end -
trunk/samples/jot.rb
r381 r398 4 4 5 5 Shoes.app :title => "vJot Clone", 6 :width => 420, :height => 560 do6 :width => 420, :height => 560, :resizable => false do 7 7 8 8 @note = NOTES.first -
trunk/shoes/world.c
r376 r398 52 52 } 53 53 54 static VALUE 55 shoes_load_begin(VALUE v) 56 { 57 char *bootup = (char *)v; 58 return rb_eval_string(bootup); 59 } 60 61 static VALUE 62 shoes_load_exception(VALUE v, VALUE exc) 63 { 64 return exc; 65 } 66 54 67 shoes_code 55 68 shoes_load(char *path, char *uri) … … 60 73 { 61 74 char bootup[SHOES_BUFSIZE]; 62 sprintf(bootup, 63 "begin;" 64 "Shoes.load(%%q<%s>);" 65 "rescue Object => e;" 66 SHOES_META 67 EXC_RUN 68 "end;" 69 "end;", path); 70 rb_eval_string(bootup); 75 sprintf(bootup, "Shoes.load(%%q<%s>);", path); 76 VALUE v = rb_rescue2(shoes_load_begin, (VALUE)bootup, shoes_load_exception, Qnil, rb_cObject, 0); 77 if (rb_obj_is_kind_of(v, rb_eException)) 78 { 79 VALUE msg = rb_funcall(v, rb_intern("message"), 0); 80 printf("%s\n", RSTRING_PTR(msg)); 81 return SHOES_QUIT; 82 } 71 83 } 72 84 … … 86 98 { 87 99 ruby_set_argv(argc, argv); 100 } 101 102 static VALUE 103 shoes_start_begin(VALUE v) 104 { 105 return rb_eval_string("$SHOES_URI = Shoes.args!"); 106 } 107 108 static VALUE 109 shoes_start_exception(VALUE v, VALUE exc) 110 { 111 return exc; 88 112 } 89 113 … … 118 142 119 143 char *load_uri_str = NULL; 120 VALUE load_uri = rb_ eval_string("$SHOES_URI = Shoes.args!");144 VALUE load_uri = rb_rescue2(shoes_start_begin, Qnil, shoes_start_exception, Qnil, rb_cObject, 0); 121 145 if (!RTEST(load_uri)) 122 146 return SHOES_QUIT; 147 if (rb_obj_is_kind_of(load_uri, rb_eSystemExit)) 148 return SHOES_QUIT; 149 if (rb_obj_is_kind_of(load_uri, rb_eException)) 150 { 151 VALUE msg = rb_funcall(load_uri, rb_intern("message"), 0); 152 printf("%s\n", RSTRING_PTR(msg)); 153 return SHOES_QUIT; 154 } 123 155 124 156 if (rb_obj_is_kind_of(load_uri, rb_cString))
