rubyosa19 0.5.0 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,7 @@
27
27
  */
28
28
 
29
29
  #include "rbosa.h"
30
- #include <ruby/st.h>
30
+ #include <st.h>
31
31
 
32
32
  static VALUE mOSA;
33
33
  static VALUE cOSAElement;
@@ -161,8 +161,13 @@ rbosa_element_new (VALUE self, VALUE type, VALUE value)
161
161
  }
162
162
  else {
163
163
  Check_Type (value, T_STRING);
164
+ #ifdef RUBY_19
164
165
  c_value = RSTRING_PTR(value);
165
166
  c_value_size = RSTRING_LEN(value);
167
+ #else
168
+ c_value = RSTRING (value)->ptr;
169
+ c_value_size = RSTRING (value)->len;
170
+ #endif
166
171
  }
167
172
 
168
173
  error = AECreateDesc (ffc_type, c_value, c_value_size, &desc);
@@ -227,6 +232,9 @@ __rbosa_raise_potential_app_error (AEDesc *reply)
227
232
  return;
228
233
  }
229
234
 
235
+ if (errorNum == noErr)
236
+ return;
237
+
230
238
  /* The reply is an application error. */
231
239
 
232
240
  errorMsg = error_code_to_string(errorNum);
@@ -287,18 +295,32 @@ rbosa_app_send_event (VALUE self, VALUE event_class, VALUE event_id, VALUE param
287
295
  if (!NIL_P (params)) {
288
296
  unsigned i;
289
297
 
290
- for (i = 0; i < RARRAY_LEN(params); i++) {
298
+ #ifdef RUBY_19
299
+ for (i = 0; i < RARRAY_LEN(params); i++) {
300
+ #else
301
+ for (i = 0; i < RARRAY (params)->len; i++) {
302
+ #endif
291
303
  VALUE ary;
292
304
  VALUE type;
293
305
  VALUE element;
294
306
  FourCharCode code;
295
307
 
296
- ary = RARRAY_PTR(params)[i];
297
- if (NIL_P (ary) || RARRAY_LEN(ary) != 2)
308
+ #ifdef RUBY_19
309
+ ary = RARRAY_PTR(params)[i];
310
+ if (NIL_P (ary) || RARRAY_LEN(ary) != 2)
311
+ #else
312
+ ary = RARRAY (params)->ptr[i];
313
+ if (NIL_P (ary) || RARRAY (ary)->len != 2)
314
+ #endif
298
315
  continue;
299
316
 
317
+ #ifdef RUBY_19
300
318
  type = RARRAY_PTR(ary)[0];
301
319
  element = RARRAY_PTR(ary)[1];
320
+ #else
321
+ type = RARRAY (ary)->ptr[0];
322
+ element = RARRAY (ary)->ptr[1];
323
+ #endif
302
324
  code = RVAL2FOURCHAR (type);
303
325
 
304
326
  if (code == '----')
@@ -557,8 +579,13 @@ rbosa_elementlist_new (int argc, VALUE *argv, VALUE self)
557
579
  error_code_to_string (error), error);
558
580
 
559
581
  if (!NIL_P (ary)) {
582
+ #ifdef RUBY_19
560
583
  for (i = 0; i < RARRAY_LEN(ary); i++)
561
584
  __rbosa_elementlist_add (&list, RARRAY_PTR(ary)[i], i + 1);
585
+ #else
586
+ for (i = 0; i < RARRAY (ary)->len; i++)
587
+ __rbosa_elementlist_add (&list, RARRAY (ary)->ptr[i], i + 1);
588
+ #endif
562
589
  }
563
590
 
564
591
  return rbosa_element_make (self, &list, Qnil);
@@ -29,7 +29,7 @@
29
29
  #ifndef __RBOSA_H_
30
30
  #define __RBOSA_H_
31
31
 
32
- #include "osx_ruby.h"
32
+ #include <ruby.h>
33
33
  #include <Carbon/Carbon.h>
34
34
  #include <sys/param.h>
35
35
 
@@ -43,9 +43,15 @@ rbobj_to_fourchar (VALUE obj)
43
43
  obj = rb_obj_as_string (obj);
44
44
 
45
45
  if (rb_obj_is_kind_of (obj, rb_cString)) {
46
+ #ifdef RUBY_19
46
47
  if (RSTRING_LEN(obj) != 4)
47
48
  rb_raise (rb_eArgError, USAGE_MSG);
48
49
  result = *(FourCharCode*)(RSTRING_PTR(obj));
50
+ #else
51
+ if (RSTRING (obj)->len != 4)
52
+ rb_raise (rb_eArgError, USAGE_MSG);
53
+ result = *(FourCharCode*)(RSTRING (obj)->ptr);
54
+ #endif
49
55
  result = CFSwapInt32HostToBig (result);
50
56
  }
51
57
  else {
@@ -75,9 +81,14 @@ rbobj_to_alias_handle (VALUE obj, AliasHandle *alias)
75
81
  Check_Type (obj, T_STRING);
76
82
  *alias = NULL;
77
83
 
78
- URL = CFURLCreateFromFileSystemRepresentation (kCFAllocatorDefault,
79
- (const UInt8 *)RSTRING_PTR (obj),
80
- RSTRING_LEN(obj),
84
+ URL = CFURLCreateFromFileSystemRepresentation (kCFAllocatorDefault,
85
+ #ifdef RUBY_19
86
+ (const UInt8 *)RSTRING_PTR(obj),
87
+ RSTRING_LEN(obj),
88
+ #else
89
+ (const UInt8 *)RSTRING (obj)->ptr,
90
+ RSTRING (obj)->len,
91
+ #endif
81
92
  0 /* XXX: normally passing 0 even if it's a directory should
82
93
  not hurt, as we are just getting the FSRef. */);
83
94
  if (URL == NULL)
@@ -88,10 +99,18 @@ rbobj_to_alias_handle (VALUE obj, AliasHandle *alias)
88
99
  error = FSNewAlias (NULL, &ref, alias);
89
100
  if (error != noErr)
90
101
  rb_raise (rb_eArgError, "Cannot create alias handle for given filename '%s' : %s (%d)",
91
- RSTRING_PTR(obj), GetMacOSStatusErrorString (error), error);
102
+ #ifdef RUBY_19
103
+ RSTRING_PTR(obj), GetMacOSStatusErrorString (error), error);
104
+ #else
105
+ RSTRING (obj)->ptr, GetMacOSStatusErrorString (error), error);
106
+ #endif
92
107
  }
93
108
  else {
94
109
  rb_raise (rb_eArgError, "Cannot obtain the filesystem reference for given filename '%s'",
95
- RSTRING_PTR(obj));
110
+ #ifdef RUBY_19
111
+ RSTRING_PTR(obj));
112
+ #else
113
+ RSTRING (obj)->ptr);
114
+ #endif
96
115
  }
97
116
  }
File without changes
@@ -331,12 +331,20 @@ rbosa_scripting_info (VALUE self, VALUE hash)
331
331
  remote = CSTR2RVAL (c_remote);
332
332
  }
333
333
 
334
+ #ifdef RUBY_19
334
335
  if (RHASH_TBL(hash)->num_entries > 0) {
336
+ #else
337
+ if (RHASH (hash)->tbl->num_entries > 0) {
338
+ #endif
335
339
  VALUE keys;
336
340
 
337
341
  keys = rb_funcall (hash, rb_intern ("keys"), 0);
338
342
  rb_raise (rb_eArgError, "inappropriate argument(s): %s",
343
+ #ifdef RUBY_19
339
344
  RSTRING_PTR(rb_inspect (keys)));
345
+ #else
346
+ RSTRING (rb_inspect (keys))->ptr);
347
+ #endif
340
348
  }
341
349
 
342
350
  if (NIL_P (remote)) {
metadata CHANGED
@@ -1,63 +1,96 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rubyosa19
3
- version: !ruby/object:Gem::Version
4
- version: 0.5.0
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.5.4
6
6
  platform: ruby
7
- authors:
8
- - Alain Hoang
9
- - Jan Dvorak
10
- - Minh Thu Vo
11
- - James Adam
12
- - Paolo Bosetti
7
+ authors:
8
+ - Laurent Sansonetti
9
+ - Paolo Bosetti (adapting for 1.9)
13
10
  autorequire:
14
11
  bindir: bin
15
12
  cert_chain: []
16
- date: 2012-04-18 00:00:00.000000000 Z
17
- dependencies: []
18
- description: This is a modernization of the glorious but unmaintained rubyosa version,
19
- aimed at making it compatible with ruby 1.9.x series. At the moment, it successfully
20
- compiles on OS X Lion.
13
+
14
+ date: 2011-03-03 00:00:00 -08:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: libxml-ruby
19
+ prerelease: false
20
+ requirement: &id001 !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 1.1.3
26
+ type: :runtime
27
+ version_requirements: *id001
28
+ description: RubyOSA is a bridge that connects Ruby to the Apple Event Manager, automatically populating the API according to the target application's scriptable definition. This version is 1.9.2 compatible!
21
29
  email: p4010@me.com
22
- executables: []
23
- extensions:
24
- - ext/rubyosa/extconf.rb
30
+ executables:
31
+ - rdoc-osa
32
+ extensions:
33
+ - extconf.rb
25
34
  extra_rdoc_files: []
26
- files:
27
- - lib/rubyosa/rbosa.rb
28
- - lib/rubyosa/rbosa_properties.rb
29
- - lib/rubyosa.rb
30
- - ext/rubyosa/rbosa.c
31
- - ext/rubyosa/rbosa_conv.c
32
- - ext/rubyosa/rbosa_err.c
33
- - ext/rubyosa/rbosa_sdef.c
34
- - ext/rubyosa/osx_intern.h
35
- - ext/rubyosa/osx_ruby.h
36
- - ext/rubyosa/rbosa.h
37
- - ext/rubyosa/extconf.rb
38
- homepage: http://github.com/pbosetti/rubyosa19
35
+
36
+ files:
37
+ - README.markdown
38
+ - COPYRIGHT
39
+ - AUTHORS
40
+ - extconf.rb
41
+ - src/rbosa.c
42
+ - src/rbosa.h
43
+ - src/rbosa_conv.c
44
+ - src/rbosa_sdef.c
45
+ - src/rbosa_err.c
46
+ - src/lib/rbosa.rb
47
+ - src/lib/rbosa_properties.rb
48
+ - sample/Finder/show_desktop.rb
49
+ - sample/iChat/uptime.rb
50
+ - sample/iTunes/control.rb
51
+ - sample/iTunes/fade_volume.rb
52
+ - sample/iTunes/inspect.rb
53
+ - sample/QuickTime/play_all.rb
54
+ - sample/misc/sdef.rb
55
+ - sample/BBEdit/unix_script.rb
56
+ - sample/TextEdit/hello_world.rb
57
+ - sample/iChat/image.rb
58
+ - sample/iTunes/artwork.rb
59
+ - sample/Mail/get_selected_mail.rb
60
+ - sample/AddressBook/inspect.rb
61
+ - sample/iTunes/tag_genre_lastfm.rb
62
+ - data/rubyosa/rdoc_html.rb
63
+ - sample/Photoshop/new_doc.rb
64
+ - sample/Photoshop/new_doc_with_text.rb
65
+ - sample/iTunes/name_that_tune.rb
66
+ - bin/rdoc-osa
67
+ has_rdoc: true
68
+ homepage: http://github.com/pbosetti/rubyosa
39
69
  licenses: []
70
+
40
71
  post_install_message:
41
72
  rdoc_options: []
42
- require_paths:
73
+
74
+ require_paths:
43
75
  - lib
44
- required_ruby_version: !ruby/object:Gem::Requirement
76
+ required_ruby_version: !ruby/object:Gem::Requirement
45
77
  none: false
46
- requirements:
47
- - - ! '>='
48
- - !ruby/object:Gem::Version
49
- version: '0'
50
- required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
83
  none: false
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
55
- version: '0'
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
56
88
  requirements: []
57
- rubyforge_project: rubyosa19
58
- rubygems_version: 1.8.21
89
+
90
+ rubyforge_project: rubyosa
91
+ rubygems_version: 1.5.2
59
92
  signing_key:
60
93
  specification_version: 3
61
- summary: Ruby 1.9.x OSA script interface
94
+ summary: A Ruby/AppleEvent bridge.
62
95
  test_files: []
63
- has_rdoc: false
96
+