# Copyright (C) 2001 Tobias Peters # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. $verbose = false # The prefix for all C identifiers introduced by libgdome-ruby C_NAME_PREFIX = "rbdom" # the prefix used by gdome's class identifiers Gdome_class_prefix = "Gdome" # the prefix used by gdome's method identifiers Gdome_method_prefix = Gdome_class_prefix.downcase() + "_" # gdome2 abbreviates all interface names in method names. Here is how: Gdome_ABBREVIATIONS = { "DOMString" => "str", "Node" => "n" , "Element" => "el" , "Attr" => "a" , "CharacterData" => "cd" , "Text" => "t" , "CDATASection" => "cds", "Comment" => "c" , "DOMImplementation" => "di" , "Document" => "doc", "DocumentFragment" => "df" , "DocumentType" => "dt" , "Entity" => "ent", "EntityReference" => "er" , "NamedNodeMap" => "nnm", "NodeList" => "nl" , "Notation" => "not", "ProcessingInstruction" => "pi" } # The name used by libgdome for the C struct providing this interface. # interface might be a string containing the name of the interface or # an object that responds to to_s def gdome_class_name(interface) " " + Gdome_class_prefix + interface.to_s() + " " end # The name used by libgdome-ruby for the VALUE holding a reference to the class # that provides this interface. # interface might be a string containing the name of the interface or # an object that responds to to_s def rbdom_class_name(interface) " " + C_NAME_PREFIX + "_class_" + interface.to_s() + " " end # The name used by libgdome for the C function providing this method of this # interface. # interface and methods might be a strings containing the names of the # interface or method, or they might be objects of type Idl_Interface or # Idl_Method, respectively def gdome_method_name(interface, method) " " + Gdome_method_prefix + Gdome_ABBREVIATIONS[interface.to_s()] + "_" + method.to_s() + " " end # The name used by libgdome-ruby for the C function providing this method of # this interface. # interface and methods might be a strings containing the names of the # interface or method, or they might be objects of type Idl_Interface or # Idl_Method, respectively def rbdom_method_name(interface, method) " " + C_NAME_PREFIX + "_method_" + interface.to_s() + "_" + method.to_s() + " " end # The name of the C function that wraps a C struct (holding an instance of # interface) in a ruby object of the desired class def c2rb_name(interface) " " + C_NAME_PREFIX + "_c2rb_" + interface.to_s() + " " end # The name of the C function that extracts a wrapped C struct (holding an # instance of interface) from the corresponding ruby object def rb2c_name(interface) " " + C_NAME_PREFIX + "_rb2c_" + interface.to_s() + " " end