[cairo-commit] rcairo/gen gen.rb,1.2,1.3 load_api.rb,1.1,1.2
Evan Martin
commit at pdx.freedesktop.org
Wed Nov 19 10:51:53 PST 2003
Committed by: martine
Update of /cvs/cairo/rcairo/gen
In directory pdx:/tmp/cvs-serv21675/gen
Modified Files:
gen.rb load_api.rb
Log Message:
Update cairo.h parser to properly handle structs with exposed members, which
recently appeared in Cairo CVS.
(Unfortunately, this means I'll have to write my own getters/setters for each
member. I think I'll wait for the API to settle.)
Add a "ps" test that generates a simple postscript file (mostly to verify my
understanding of the mapping from C's FILE* to Ruby's File objects).
Index: gen.rb
===================================================================
RCS file: /cvs/cairo/rcairo/gen/gen.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gen.rb 28 Oct 2003 23:31:06 -0000 1.2
--- gen.rb 19 Nov 2003 18:51:51 -0000 1.3
***************
*** 15,19 ****
/* this file was autogenerated by gen.rb, available in the ruby-cairo cvs. */
! #include "shared.h"
'
--- 15,19 ----
/* this file was autogenerated by gen.rb, available in the ruby-cairo cvs. */
! #include "rbcairo.h"
'
***************
*** 40,43 ****
--- 40,45 ----
'cairo_set_target_image', # need special Cairo::Image class
+ 'cairo_set_target_ps', # need special file handling
+
'cairo_set_dash', # takes an array of dashes via double* ?
***************
*** 51,56 ****
'cairo_fill',
- 'cairo_text_extents', # get a whole bunch of attributes
-
'cairo_current_rgb_color', # returns a color triple
--- 53,56 ----
Index: load_api.rb
===================================================================
RCS file: /cvs/cairo/rcairo/gen/load_api.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** load_api.rb 28 Oct 2003 18:27:22 -0000 1.1
--- load_api.rb 19 Nov 2003 18:51:51 -0000 1.2
***************
*** 13,20 ****
file.gsub!(/\}\s*$/, '')
file.gsub!(/\n\n/, "\n")
! file.gsub!(/^\s*/, "")
! file.split(/;\s*/).each { |decl|
decl.gsub!(/\n/, " ")
decl.gsub!(/\s+/, " ")
case decl
when /^extern (.+?) (?:__external_linkage) (\w+) \((.+?)\)$/
--- 13,26 ----
file.gsub!(/\}\s*$/, '')
file.gsub!(/\n\n/, "\n")
! file.strip!
!
! # we used to just split on semicolon.
! # but typedef struct { a; } b; needs to slurp as one line.
! # now we have an ugly re.
! file.scan(/\S+[^\}\{]*?(?:\{.*?\})?[^\}\{]*?;/m) { |decl|
decl.gsub!(/\n/, " ")
decl.gsub!(/\s+/, " ")
+ decl.gsub!(/;\s*$/, '')
+ #puts "-->decl<-- #{decl}"
case decl
when /^extern (.+?) (?:__external_linkage) (\w+) \((.+?)\)$/
More information about the cairo-commit
mailing list