GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: a tiny graphical app kit for ruby
Homepage: http://code.whytheluckystiff.net/shoes
Clone URL: git://github.com/why/shoes.git
 * shoes/ruby.h: show an alert box for `--help` and `--version` on 
 windows.
why (author)
Wed Jan 09 08:32:24 -0800 2008
commit  9375602fc4ebd39ff8267b7ad052f23fb2949614
tree    f0a6cad432ac689c823d98419ac702c9e428f126
parent  3aac36e04e9a1d3f19180e1b73e02e54671bc9f9
...
95
96
97
98
99
 
100
101
102
103
104
 
105
106
107
...
95
96
97
 
 
98
99
100
101
 
 
102
103
104
105
0
@@ -95,13 +95,11 @@ class Shoes
0
     end
0
 
0
     opts.on_tail("-v", "--version", "Display the version info.") do
0
- puts "shoes #{Shoes::RELEASE_NAME.downcase} (0.r#{Shoes::REVISION})"
0
- raise SystemExit
0
+ raise SystemExit, "shoes #{Shoes::RELEASE_NAME.downcase} (0.r#{Shoes::REVISION})"
0
     end
0
 
0
     opts.on_tail("-h", "--help", "Show this message") do
0
- puts opts
0
- raise SystemExit
0
+ raise SystemExit, opts.to_s
0
     end
0
   end
0
 
...
42
43
44
 
 
 
 
 
 
 
 
 
 
45
46
47
...
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
0
@@ -42,6 +42,16 @@ void shoes_ruby_init(void);
0
 //
0
 #define SHOES_META \
0
   "(class << Shoes; self; end).instance_eval do;"
0
+#ifdef SHOES_WIN32
0
+#define QUIT_ALERT_MSG() MessageBox(NULL, RSTRING_PTR(msg), "Shoes", MB_OK)
0
+#else
0
+#define QUIT_ALERT_MSG() printf("%s\n", RSTRING_PTR(msg))
0
+#endif
0
+#define QUIT_ALERT(v) \
0
+ VALUE msg = rb_ary_entry(rb_funcall(rb_funcall(v, rb_intern("message"), 0), rb_intern("split"), 2, \
0
+ rb_eval_string("/:\\d+:/"), INT2NUM(2)), 1); \
0
+ QUIT_ALERT_MSG(); \
0
+ return SHOES_QUIT;
0
 #define EXC_ALERT \
0
   "proc do; alert %{#{@exc.message}\\n#{@exc.backtrace.map { |x| %{\\n * #{x}}}}}; end"
0
 #define EXC_MARKUP \
...
76
77
78
79
80
81
 
82
83
84
...
144
145
146
147
148
149
150
151
152
153
 
154
155
156
...
76
77
78
 
 
 
79
80
81
82
...
142
143
144
 
 
145
146
 
 
 
147
148
149
150
0
@@ -76,9 +76,7 @@ shoes_load(char *path, char *uri)
0
     VALUE v = rb_rescue2(CASTHOOK(shoes_load_begin), (VALUE)bootup, CASTHOOK(shoes_load_exception), Qnil, rb_cObject, 0);
0
     if (rb_obj_is_kind_of(v, rb_eException))
0
     {
0
- VALUE msg = rb_funcall(v, rb_intern("message"), 0);
0
- printf("%s\n", RSTRING_PTR(msg));
0
- return SHOES_QUIT;
0
+ QUIT_ALERT(v);
0
     }
0
   }
0
 
0
@@ -144,13 +142,9 @@ shoes_start(char *path, char *uri)
0
   VALUE load_uri = rb_rescue2(CASTHOOK(shoes_start_begin), Qnil, CASTHOOK(shoes_start_exception), Qnil, rb_cObject, 0);
0
   if (!RTEST(load_uri))
0
     return SHOES_QUIT;
0
- if (rb_obj_is_kind_of(load_uri, rb_eSystemExit))
0
- return SHOES_QUIT;
0
   if (rb_obj_is_kind_of(load_uri, rb_eException))
0
   {
0
- VALUE msg = rb_funcall(load_uri, rb_intern("message"), 0);
0
- printf("%s\n", RSTRING_PTR(msg));
0
- return SHOES_QUIT;
0
+ QUIT_ALERT(load_uri);
0
   }
0
 
0
   if (rb_obj_is_kind_of(load_uri, rb_cString))

Comments

    No one has commented yet.