gobject-introspection r229 - in trunk: . giscanner
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r229 - in trunk: . giscanner
- Date: Sat, 26 Apr 2008 03:37:07 +0100 (BST)
Author: johan
Date: Sat Apr 26 02:37:07 2008
New Revision: 229
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=229&view=rev
Log:
2008-04-25 Johan Dahlin <johan gnome org>
* giscanner/Makefile.am:
* giscanner/ast.py:
* giscanner/gidlparser.py:
* giscanner/gidlwriter.py:
* giscanner/girwriter.py:
* giscanner/glibast.py:
* giscanner/glibtransformer.py:
* giscanner/transformer.py:
Split out nodes to ast.py and glibast.py
Added:
trunk/giscanner/ast.py (contents, props changed)
trunk/giscanner/glibast.py (contents, props changed)
Modified:
trunk/ChangeLog
trunk/giscanner/Makefile.am
trunk/giscanner/gidlparser.py
trunk/giscanner/gidlwriter.py
trunk/giscanner/girwriter.py
trunk/giscanner/glibtransformer.py
trunk/giscanner/transformer.py
Modified: trunk/giscanner/Makefile.am
==============================================================================
--- trunk/giscanner/Makefile.am (original)
+++ trunk/giscanner/Makefile.am Sat Apr 26 02:37:07 2008
@@ -27,7 +27,9 @@
pkgpyexec_LTLIBRARIES = _giscanner.la
pkgpyexec_PYTHON = \
__init__.py \
+ ast.py \
cgobject.py \
+ gidlast.py \
gidlparser.py \
gidlwriter.py \
girwriter.py \
Added: trunk/giscanner/ast.py
==============================================================================
--- (empty file)
+++ trunk/giscanner/ast.py Sat Apr 26 02:37:07 2008
@@ -0,0 +1,149 @@
+# -*- Mode: Python -*-
+# GObject-Introspection - a framework for introspecting GObject libraries
+# Copyright (C) 2008 Johan Dahlin
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+
+class Node(object):
+ def __init__(self, name=None):
+ self.name = name
+
+
+class Function(Node):
+ def __init__(self, name, retval, parameters, symbol):
+ Node.__init__(self, name)
+ self.retval = retval
+ self.parameters = parameters
+ self.symbol = symbol
+
+ def __repr__(self):
+ return '%s(%r, %r, %r)' % (self.__class__.__name__,
+ self.name, self.retval,
+ self.parameters)
+
+
+class VFunction(Function):
+ pass
+
+
+class Parameter(Node):
+ def __init__(self, name, type):
+ Node.__init__(self, name)
+ self.type = type
+ self.direction = 'in'
+ self.transfer = 'none'
+
+ def __repr__(self):
+ return 'Parameter(%r, %r)' % (self.name, self.type)
+
+
+class Enum(Node):
+ def __init__(self, name, members):
+ Node.__init__(self, name)
+ self.members = members
+
+ def __repr__(self):
+ return 'Enum(%r, %r)' % (self.name, self.members)
+
+
+class Member(Node):
+ def __init__(self, name, value):
+ Node.__init__(self, name)
+ self.value = value
+
+ def __repr__(self):
+ return 'Member(%r, %r)' % (self.name, self.value)
+
+
+class Struct(Node):
+ def __init__(self, name):
+ Node.__init__(self, name)
+ self.fields = []
+
+ def __repr__(self):
+ return 'Struct(%r)' % (self.name,)
+
+
+class Return(Node):
+ def __init__(self, type):
+ Node.__init__(self)
+ self.type = type
+ self.transfer = 'none'
+
+ def __repr__(self):
+ return 'Return(%r)' % (self.type,)
+
+
+class Class(Node):
+ def __init__(self, name, parent):
+ Node.__init__(self, name)
+ self.parent = parent
+ self.methods = []
+ self.constructors = []
+ self.properties = []
+ self.fields = []
+
+ def __repr__(self):
+ return '%s(%r, %r, %r)' % (
+ self.__class__.__name__,
+ self.name, self.parent, self.methods)
+
+
+class Interface(Node):
+ def __init__(self, name):
+ Node.__init__(self, name)
+ self.methods = []
+ self.properties = []
+ self.fields = []
+
+ def __repr__(self):
+ return '%s(%r, %r)' % (
+ self.__class__.__name__,
+ self.name, self.methods)
+
+
+class Constant(Node):
+ def __init__(self, name, type, value):
+ Node.__init__(self, name)
+ self.type = type
+ self.value = value
+
+ def __repr__(self):
+ return 'Constant(%r, %r, %r)' % (
+ self.name, self.type, self.value)
+
+
+class Property(Node):
+ def __init__(self, name, type):
+ Node.__init__(self, name)
+ self.type = type
+
+ def __repr__(self):
+ return '%s(%r, %r, %r)' % (
+ self.__class__.__name__,
+ self.name, self.type, self.value)
+
+
+class Callback(Node):
+ def __init__(self, name, retval, parameters):
+ Node.__init__(self, name)
+ self.retval = retval
+ self.parameters = parameters
+
+ def __repr__(self):
+ return 'Callback(%r, %r, %r)' % (
+ self.name, self.retval, self.parameters)
Modified: trunk/giscanner/gidlparser.py
==============================================================================
--- trunk/giscanner/gidlparser.py (original)
+++ trunk/giscanner/gidlparser.py Sat Apr 26 02:37:07 2008
@@ -19,7 +19,7 @@
from xml.etree.ElementTree import parse
-from .glibtransformer import GLibObject
+from .glibast import GLibObject
class GIDLParser(object):
Modified: trunk/giscanner/gidlwriter.py
==============================================================================
--- trunk/giscanner/gidlwriter.py (original)
+++ trunk/giscanner/gidlwriter.py Sat Apr 26 02:37:07 2008
@@ -19,9 +19,9 @@
from __future__ import with_statement
-from .glibtransformer import (GLibBoxed, GLibEnum, GLibEnumMember,
- GLibFlags, GLibObject, GLibInterface)
-from .transformer import Callback, Class, Enum, Function, Interface
+from .ast import Callback, Class, Enum, Function, Interface
+from .glibast import (GLibBoxed, GLibEnum, GLibEnumMember,
+ GLibFlags, GLibObject, GLibInterface)
from .xmlwriter import XMLWriter
Modified: trunk/giscanner/girwriter.py
==============================================================================
--- trunk/giscanner/girwriter.py (original)
+++ trunk/giscanner/girwriter.py Sat Apr 26 02:37:07 2008
@@ -19,9 +19,9 @@
from __future__ import with_statement
-from .glibtransformer import (GLibBoxed, GLibEnum, GLibEnumMember,
- GLibFlags, GLibObject, GLibInterface)
-from .transformer import Callback, Class, Enum, Function, Interface
+from .ast import Callback, Class, Enum, Function, Interface
+from .glibast import (GLibBoxed, GLibEnum, GLibEnumMember,
+ GLibFlags, GLibObject, GLibInterface)
from .xmlwriter import XMLWriter
Added: trunk/giscanner/glibast.py
==============================================================================
--- (empty file)
+++ trunk/giscanner/glibast.py Sat Apr 26 02:37:07 2008
@@ -0,0 +1,79 @@
+# -*- Mode: Python -*-
+# GObject-Introspection - a framework for introspecting GObject libraries
+# Copyright (C) 2008 Johan Dahlin
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+from .ast import Class, Enum, Interface, Member, Node, Property, Struct
+
+
+class GLibEnum(Enum):
+ def __init__(self, name, members, type_name, get_type):
+ Enum.__init__(self, name, members)
+ self.type_name = type_name
+ self.get_type = get_type
+
+ def __repr__(self):
+ return '%s(%r, %r, %r)' % (
+ self.__class__.__name__,
+ self.name,
+ self.members,
+ self.get_type)
+
+
+class GLibFlags(GLibEnum):
+ pass
+
+
+class GLibEnumMember(Member):
+ def __init__(self, name, value, nick):
+ Member.__init__(self, name, value)
+ self.nick = nick
+
+
+class GLibObject(Class):
+ def __init__(self, name, parent, type_name, get_type):
+ Class.__init__(self, name, parent)
+ self.type_name = type_name
+ self.get_type = get_type
+ self.signals = []
+
+class GLibBoxed(Struct):
+ def __init__(self, name, type_name, get_type):
+ Struct.__init__(self, name)
+ self.constructors = []
+ self.methods = []
+ self.type_name = type_name
+ self.get_type = get_type
+
+
+class GLibInterface(Interface):
+ def __init__(self, name, type_name, get_type):
+ Interface.__init__(self, name)
+ self.type_name = type_name
+ self.get_type = get_type
+ self.signals = []
+
+
+class GLibProperty(Property):
+ pass
+
+
+class GLibSignal(Node):
+ def __init__(self, name, retval):
+ Node.__init__(self, name)
+ self.retval = retval
+ self.parameters = []
Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py (original)
+++ trunk/giscanner/glibtransformer.py Sat Apr 26 02:37:07 2008
@@ -23,8 +23,11 @@
from . import cgobject
from .odict import odict
-from .transformer import (Callback, Class, Enum, Function, Interface,
- Member, Node, Parameter, Property, Return, Struct)
+from .ast import (Callback, Enum, Function,
+ Parameter, Property, Return, Struct)
+from .glibast import (GLibBoxed, GLibEnum, GLibEnumMember, GLibFlags, GLibInterface,
+ GLibObject, GLibSignal)
+
# Copied from h2defs.py
_upperstr_pat1 = re.compile(r'([^A-Z])([A-Z])')
@@ -50,63 +53,6 @@
return libname
-class GLibEnum(Enum):
- def __init__(self, name, members, type_name, get_type):
- Enum.__init__(self, name, members)
- self.type_name = type_name
- self.get_type = get_type
-
- def __repr__(self):
- return '%s(%r, %r, %r)' % (
- self.__class__.__name__,
- self.name,
- self.members,
- self.get_type)
-
-
-class GLibFlags(GLibEnum):
- pass
-
-
-class GLibEnumMember(Member):
- def __init__(self, name, value, nick):
- Member.__init__(self, name, value)
- self.nick = nick
-
-
-class GLibObject(Class):
- def __init__(self, name, parent, type_name, get_type):
- Class.__init__(self, name, parent)
- self.type_name = type_name
- self.get_type = get_type
- self.signals = []
-
-class GLibBoxed(Struct):
- def __init__(self, name, type_name, get_type):
- Struct.__init__(self, name)
- self.constructors = []
- self.methods = []
- self.type_name = type_name
- self.get_type = get_type
-
-
-class GLibInterface(Interface):
- def __init__(self, name, type_name, get_type):
- Interface.__init__(self, name)
- self.type_name = type_name
- self.get_type = get_type
- self.signals = []
-
-
-class GLibProperty(Property):
- pass
-
-
-class GLibSignal(Node):
- def __init__(self, name, retval):
- Node.__init__(self, name)
- self.retval = retval
- self.parameters = []
class GLibTransformer(object):
Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py (original)
+++ trunk/giscanner/transformer.py Sat Apr 26 02:37:07 2008
@@ -18,137 +18,8 @@
#
import giscanner
-
-
-class Node(object):
- def __init__(self, name=None):
- self.name = name
-
-
-class Function(Node):
- def __init__(self, name, retval, parameters, symbol):
- Node.__init__(self, name)
- self.retval = retval
- self.parameters = parameters
- self.symbol = symbol
-
- def __repr__(self):
- return '%s(%r, %r, %r)' % (self.__class__.__name__,
- self.name, self.retval,
- self.parameters)
-
-
-class VFunction(Function):
- pass
-
-
-class Parameter(Node):
- def __init__(self, name, type):
- Node.__init__(self, name)
- self.type = type
- self.direction = 'in'
- self.transfer = 'none'
-
- def __repr__(self):
- return 'Parameter(%r, %r)' % (self.name, self.type)
-
-
-class Enum(Node):
- def __init__(self, name, members):
- Node.__init__(self, name)
- self.members = members
-
- def __repr__(self):
- return 'Enum(%r, %r)' % (self.name, self.members)
-
-
-class Member(Node):
- def __init__(self, name, value):
- Node.__init__(self, name)
- self.value = value
-
- def __repr__(self):
- return 'Member(%r, %r)' % (self.name, self.value)
-
-
-class Struct(Node):
- def __init__(self, name):
- Node.__init__(self, name)
- self.fields = []
-
- def __repr__(self):
- return 'Struct(%r)' % (self.name,)
-
-
-class Return(Node):
- def __init__(self, type):
- Node.__init__(self)
- self.type = type
- self.transfer = 'none'
-
- def __repr__(self):
- return 'Return(%r)' % (self.type,)
-
-
-class Class(Node):
- def __init__(self, name, parent):
- Node.__init__(self, name)
- self.parent = parent
- self.methods = []
- self.constructors = []
- self.properties = []
- self.fields = []
-
- def __repr__(self):
- return '%s(%r, %r, %r)' % (
- self.__class__.__name__,
- self.name, self.parent, self.methods)
-
-
-class Interface(Node):
- def __init__(self, name):
- Node.__init__(self, name)
- self.methods = []
- self.properties = []
- self.fields = []
-
- def __repr__(self):
- return '%s(%r, %r)' % (
- self.__class__.__name__,
- self.name, self.methods)
-
-
-class Constant(Node):
- def __init__(self, name, type, value):
- Node.__init__(self, name)
- self.type = type
- self.value = value
-
- def __repr__(self):
- return 'Constant(%r, %r, %r)' % (
- self.name, self.type, self.value)
-
-
-class Property(Node):
- def __init__(self, name, type):
- Node.__init__(self, name)
- self.type = type
-
- def __repr__(self):
- return '%s(%r, %r, %r)' % (
- self.__class__.__name__,
- self.name, self.type, self.value)
-
-
-class Callback(Node):
- def __init__(self, name, retval, parameters):
- Node.__init__(self, name)
- self.retval = retval
- self.parameters = parameters
-
- def __repr__(self):
- return 'Callback(%r, %r, %r)' % (
- self.name, self.retval, self.parameters)
+from giscanner.ast import (Callback, Enum, Function, Member, Parameter,
+ Return, Struct)
class Transformer(object):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]