More gtkdocs, added parser

This commit is contained in:
Yevgen Muntyan 2010-12-10 03:11:38 -08:00
parent ff62aeaf3e
commit e05fb32a89
45 changed files with 3908 additions and 58 deletions

View File

@ -1,6 +1,10 @@
ACLOCAL_AMFLAGS = -I m4 $(ACLOCAL_FLAGS)
SUBDIRS = po po-gsv doc moo
if MOO_ENABLE_MDP
mdp_api_dir = api
endif
SUBDIRS = po po-gsv $(mdp_api_dir) doc moo
unix_scripts = \
plat/unix/xdg-open \

48
api/Makefile.am Normal file
View File

@ -0,0 +1,48 @@
docparser_files = \
parsedocs.py \
mdp/__init__.py \
mdp/module.py \
mdp/docparser.py \
mdp/xmlwriter.py
mpi_files = \
parsexml.py \
gendefs.py \
mpi/__init__.py \
mpi/module.py \
mpi/defswriter.py
EXTRA_DIST = \
$(docparser_files) \
$(xmlparser_files) \
moo.xml
BUILT_SOURCES =
if MOO_DEV_MODE
include sourcefiles.mak
BUILT_SOURCES += moo.xml.stamp
moo.xml.stamp: $(docparser_files) $(source_files) Makefile
$(PYTHON) $(srcdir)/parsedocs.py \
--source-dir $(top_srcdir)/moo/mooapp \
--source-dir $(top_srcdir)/moo/mooedit \
--source-dir $(top_srcdir)/moo/moofileview \
--source-dir $(top_srcdir)/moo/mooutils \
--source-dir $(top_srcdir)/moo/plugins/usertools \
--source-dir $(top_srcdir)/moo/plugins/support \
--skip 'moofontsel.*' \
--output moo.xml.tmp && \
(cmp -s moo.xml.tmp $(srcdir)/moo.xml || mv moo.xml.tmp $(srcdir)/moo.xml)
rm -f moo.xml.tmp
echo stamp > moo.xml.stamp
BUILT_SOURCES += moo.defs.stamp
moo.defs.stamp: $(mpi_files) moo.xml Makefile
$(PYTHON) $(srcdir)/gendefs.py $(srcdir)/moo.xml > moo.defs.tmp && \
(cmp -s moo.defs.tmp $(srcdir)/moo.defs || mv moo.defs.tmp $(srcdir)/moo.defs)
rm -f moo.defs.tmp
echo stamp > moo.defs.stamp
endif

14
api/gendefs.py Normal file
View File

@ -0,0 +1,14 @@
#! /usr/bin/env python
import os
import re
import sys
import optparse
import fnmatch
from mpi.module import Module
from mpi.defswriter import Writer
for arg in sys.argv[1:]:
mod = Module.from_xml(arg)
Writer(sys.stdout).write(mod)

1
api/mdp/__init__.py Normal file
View File

@ -0,0 +1 @@
# empty

628
api/mdp/docparser.py Normal file
View File

@ -0,0 +1,628 @@
import re
import string
import sys
import os
DEBUG = False
class ParseError(RuntimeError):
def __init__(self, message, block=None):
if block:
RuntimeError.__init__(self, '%s in file %s, around line %d' % \
(message, block.filename, block.first_line))
else:
RuntimeError.__init__(self, message)
class DoxBlock(object):
def __init__(self, block):
object.__init__(self)
self.symbol = None
self.annotations = []
self.params = []
self.attributes = []
self.docs = []
self.__parse(block)
def __parse(self, block):
first_line = True
chunks = []
cur = [None, None, []]
for line in block.lines:
if first_line:
m = re.match(r'([\w\d_.-]+(:+[\w\d_.-]+)*)(:(\s.*)?)?$', line)
if m is None:
raise ParseError('bad id line', block)
cur[0] = m.group(1)
annotations, docs = self.__parse_annotations(m.group(4) or '')
cur[1] = annotations
cur[2] = [docs] if docs else []
elif not line:
if cur[0] is not None:
chunks.append(cur)
cur = [None, None, []]
elif cur[2]:
cur[2].append(line)
else:
m = re.match(r'(@[\w\d_.-]+|Returns|Return value|Since):(.*)$', line)
if m:
if cur[0] or cur[2]:
chunks.append(cur)
cur = [None, None, []]
cur[0] = m.group(1)
annotations, docs = self.__parse_annotations(m.group(2) or '')
cur[1] = annotations
cur[2] = [docs] if docs else []
else:
cur[2].append(line)
first_line = False
if cur[0] or cur[2]:
chunks.append(cur)
self.symbol = chunks[0][0]
self.annotations = chunks[0][1]
for chunk in chunks[1:]:
if chunk[0]:
if chunk[0].startswith('@'):
self.params.append(chunk)
else:
self.attributes.append(chunk)
else:
self.docs = chunk[2]
if not self.symbol:
raise ParseError('bad id line', block)
def __parse_annotations(self, text):
annotations = []
ann_start = -1
for i in xrange(len(text)):
c = text[i]
if c in ' \t':
pass
elif c == ':':
if ann_start < 0:
if annotations:
return annotations, text[i+1:].strip()
else:
return None, text
else:
pass
elif c != '(' and ann_start < 0:
if annotations:
raise ParseError('bad annotations')
return None, text
elif c == '(':
if ann_start >= 0:
raise ParseError('( inside ()')
ann_start = i
elif c == ')':
assert ann_start >= 0
if ann_start + 1 < i:
annotations.append(text[ann_start+1:i])
ann_start = -1
if ann_start >= 0:
raise ParseError('unterminated annotation')
if annotations:
return annotations, None
else:
return None, None
class Block(object):
def __init__(self, lines, filename, first_line, last_line):
object.__init__(self)
self.lines = list(lines)
self.filename = filename
self.first_line = first_line
self.last_line = last_line
class Symbol(object):
def __init__(self, name, annotations, docs, block):
object.__init__(self)
self.name = name
self.annotations = annotations
self.docs = docs
self.block = block
class Class(Symbol):
def __init__(self, name, annotations, docs, block):
Symbol.__init__(self, name, annotations, docs, block)
class Boxed(Symbol):
def __init__(self, name, annotations, docs, block):
Symbol.__init__(self, name, annotations, docs, block)
class Enum(Symbol):
def __init__(self, name, annotations, docs, block):
Symbol.__init__(self, name, annotations, docs, block)
class Flags(Symbol):
def __init__(self, name, annotations, docs, block):
Symbol.__init__(self, name, annotations, docs, block)
class Function(Symbol):
def __init__(self, name, annotations, params, retval, docs, block):
Symbol.__init__(self, name, annotations, docs, block)
self.params = params
self.retval = retval
class VMethod(Function):
def __init__(self, name, annotations, params, retval, docs, block):
Function.__init__(self, name, annotations, params, retval, docs, block)
class ParamBase(object):
def __init__(self, annotations=None, docs=None):
object.__init__(self)
self.docs = docs
self.type = None
self.annotations = annotations
class Param(ParamBase):
def __init__(self, name=None, annotations=None, docs=None):
ParamBase.__init__(self, annotations, docs)
self.name = name
class Retval(ParamBase):
def __init__(self, annotations=None, docs=None):
ParamBase.__init__(self, annotations, docs)
class Parser(object):
def __init__(self):
object.__init__(self)
self.classes = []
self.enums = []
self.functions = []
self.vmethods = []
self.__classes_dict = {}
self.__functions_dict = {}
self.__vmethods_dict = {}
def __split_block(self, block):
chunks = []
current_prefix = None
current_annotations = None
current_text = None
first_line = True
re_id = re.compile(r'([\w\d._-]+:(((\s*\([^()]\)\s*)+):)?')
re_special = re.compile(r'(@[\w\d._-]+|(SECTION|PROPERTY|SIGNAL)-[\w\d._-]+||Since|Returns|Return value):(((\s*\([^()]\)\s*)+):)?')
for line in block.lines:
if first_line:
line = re.sub(r'^SECTION:([\w\d_-]+):?', r'SECTION-\1:', line)
line = re.sub(r'^([\w\d_-]+):([\w\d_-]+):?', r'PROPERTY-\1-\2:', line)
line = re.sub(r'^([\w\d_-]+)::([\w\d_-]+):?', r'SIGNAL-\1-\2:', line)
first_line = False
if not line:
if current_prefix is not None:
chunks.append([current_prefix, current_annotations, current_text])
current_prefix = None
current_annotations = None
current_text = None
elif current_text is not None:
current_text.append(line)
else:
m = re_special.match(line)
if m:
if current_prefix is not None or current_text is not None:
chunks.append([current_prefix, current_annotations, current_text])
current_prefix = None
current_annotations = None
current_text = None
current_prefix = m.group(1)
suffix = m.group(4) or ''
annotations, text = self.__parse_annotations(suffix)
current_annotations = annotations
current_text = [text] if text else []
else:
if current_text is not None:
current_text.append(line)
else:
current_text = [line]
if current_text is not None:
chunks.append([current_prefix, current_annotations, current_text])
return chunks
def __parse_annotations(self, text):
annotations = []
ann_start = -1
for i in xrange(len(text)):
c = text[i]
if c in ' \t':
pass
elif c == ':':
if ann_start < 0:
if annotations:
return annotations, text[i+1:].strip()
else:
return None, text
else:
pass
elif c != '(' and ann_start < 0:
if annotations:
raise ParseError('bad annotations')
return None, text
elif c == '(':
if ann_start >= 0:
raise ParseError('( inside ()')
ann_start = i
elif c == ')':
assert ann_start >= 0
if ann_start + 1 < i:
annotations.append(text[ann_start+1:i])
ann_start = -1
if ann_start >= 0:
raise ParseError('unterminated annotation')
if annotations:
return annotations, None
else:
return None, None
def __parse_function(self, block):
db = DoxBlock(block)
params = []
retval = None
for p in db.params:
params.append(Param(p[0][1:], p[1], p[2]))
for attr in db.attributes:
if attr[0] in ('Returns', 'Return value'):
retval = Retval(attr[1], attr[2])
elif attr[0] in ('Since'):
pass
else:
raise ParseError('unknown attribute %s' % (attr[0],), block)
if ':' in db.symbol:
raise ParseError('bad function name %s' % (db.symbol,), block)
func = Function(db.symbol, db.annotations, params, retval, db.docs, block)
if DEBUG:
print 'func.name:', func.name
if func.name in self.__functions_dict:
raise ParseError('duplicated function %s' % (func.name,), block)
self.__functions_dict[func.name] = func
self.functions.append(func)
def __parse_class(self, block):
db = DoxBlock(block)
name = db.symbol
if name.startswith('class:'):
name = name[len('class:'):]
if db.params:
raise ParseError('class params', block)
if db.attributes:
raise ParseError('class attributes', block)
cls = Class(name, db.annotations, db.docs, block)
self.classes.append(cls)
def __parse_boxed(self, block):
db = DoxBlock(block)
name = db.symbol
if name.startswith('boxed:'):
name = name[len('boxed:'):]
if db.params:
raise ParseError('boxed params', block)
if db.attributes:
raise ParseError('boxed attributes', block)
cls = Boxed(name, db.annotations, db.docs, block)
self.classes.append(cls)
def __parse_enum(self, block):
db = DoxBlock(block)
name = db.symbol
if name.startswith('enum:'):
name = name[len('enum:'):]
if db.params:
raise ParseError('enum params', block)
if db.attributes:
raise ParseError('enum attributes', block)
enum = Enum(name, db.annotations, db.docs, block)
self.enums.append(enum)
def __parse_flags(self, block):
db = DoxBlock(block)
name = db.symbol
if name.startswith('flags:'):
name = name[len('flags:'):]
if db.params:
raise ParseError('flags params', block)
if db.attributes:
raise ParseError('flags attributes', block)
flags = Flags(name, db.annotations, db.docs, block)
self.enums.append(flags)
def __parse_block(self, block):
line = block.lines[0]
if line.startswith('class:'):
self.__parse_class(block)
elif line.startswith('boxed:'):
self.__parse_boxed(block)
elif line.startswith('enum:'):
self.__parse_enum(block)
elif line.startswith('flags:'):
self.__parse_flags(block)
elif line.startswith('SECTION:'):
pass
else:
self.__parse_function(block)
def __add_block(self, block, filename, first_line, last_line):
lines = []
for line in block:
if line.startswith('*'):
line = line[1:].strip()
if line or lines:
lines.append(line)
else:
first_line += 1
i = len(lines) - 1
while i >= 0:
if not lines[i]:
del lines[i]
i -= 1
last_line -= 1
else:
break
if lines:
assert last_line >= first_line
self.__parse_block(Block(lines, filename, first_line, last_line))
def __read_comments(self, filename):
block = None
first_line = 0
line_no = 0
for line in open(filename):
line = line.strip()
if not block:
if line.startswith('/**'):
line = line[3:]
if not line.startswith('*') and not '*/' in line:
block = [line]
first_line = line_no
else:
end = line.find('*/')
if end >= 0:
line = line[:end]
block.append(line)
self.__add_block(block, filename, first_line, line_no)
block = None
else:
block.append(line)
line_no += 1
if block:
raise ParseError('unterminated block in file %s' % (filename,))
def read_files(self, filenames):
for f in filenames:
print >> sys.stderr, 'parsing gtk-doc comments in file', f
self.__read_comments(f)
for f in filenames:
print >> sys.stderr, 'parsing declarations in file', f
self.__read_declarations(f)
# Code copied from h2def.py by Toby D. Reeves <toby@max.rl.plh.af.mil>
def __strip_comments(self, buf):
parts = []
lastpos = 0
while 1:
pos = string.find(buf, '/*', lastpos)
if pos >= 0:
if buf[pos:pos+len('/**vtable:')] != '/**vtable:':
parts.append(buf[lastpos:pos])
pos = string.find(buf, '*/', pos)
if pos >= 0:
lastpos = pos + 2
else:
break
else:
parts.append(buf[lastpos:pos+len('/**vtable:')])
lastpos = pos + len('/**vtable:')
else:
parts.append(buf[lastpos:])
break
return string.join(parts, '')
# Strips the dll API from buffer, for example WEBKIT_API
def __strip_dll_api(self, buf):
pat = re.compile("[A-Z]*_API ")
buf = pat.sub("", buf)
return buf
def __clean_func(self, buf):
"""
Ideally would make buf have a single prototype on each line.
Actually just cuts out a good deal of junk, but leaves lines
where a regex can figure prototypes out.
"""
# bulk comments
buf = self.__strip_comments(buf)
# dll api
buf = self.__strip_dll_api(buf)
# compact continued lines
pat = re.compile(r"""\\\n""", re.MULTILINE)
buf = pat.sub('', buf)
# Preprocess directives
pat = re.compile(r"""^[#].*?$""", re.MULTILINE)
buf = pat.sub('', buf)
#typedefs, stucts, and enums
pat = re.compile(r"""^(typedef|struct|enum)(\s|.|\n)*?;\s*""",
re.MULTILINE)
buf = pat.sub('', buf)
#strip DECLS macros
pat = re.compile(r"""G_(BEGIN|END)_DECLS|(BEGIN|END)_LIBGTOP_DECLS""", re.MULTILINE)
buf = pat.sub('', buf)
#extern "C"
pat = re.compile(r"""^\s*(extern)\s+\"C\"\s+{""", re.MULTILINE)
buf = pat.sub('', buf)
#multiple whitespace
pat = re.compile(r"""\s+""", re.MULTILINE)
buf = pat.sub(' ', buf)
#clean up line ends
pat = re.compile(r""";\s*""", re.MULTILINE)
buf = pat.sub('\n', buf)
buf = buf.lstrip()
#associate *, &, and [] with type instead of variable
#pat = re.compile(r'\s+([*|&]+)\s*(\w+)')
pat = re.compile(r' \s* ([*|&]+) \s* (\w+)', re.VERBOSE)
buf = pat.sub(r'\1 \2', buf)
pat = re.compile(r'\s+ (\w+) \[ \s* \]', re.VERBOSE)
buf = pat.sub(r'[] \1', buf)
buf = string.replace(buf, '/** vtable:', '/**vtable:')
pat = re.compile(r'(\w+) \s* \* \s* \(', re.VERBOSE)
buf = pat.sub(r'\1* (', buf)
# make return types that are const work.
buf = re.sub(r'\s*\*\s*G_CONST_RETURN\s*\*\s*', '** ', buf)
buf = string.replace(buf, 'G_CONST_RETURN ', 'const-')
buf = string.replace(buf, 'const ', 'const-')
#strip GSEAL macros from the middle of function declarations:
pat = re.compile(r"""GSEAL""", re.VERBOSE)
buf = pat.sub('', buf)
return buf
def __read_declarations_in_buf(self, buf, filename):
vproto_pat=re.compile(r"""
/\*\*\s*vtable:(?P<vtable>[\w\d_]+)\s*\*\*/\s*
(?P<ret>(-|\w|\&|\*)+\s*) # return type
\s+ # skip whitespace
\(\s*\*\s*(?P<vfunc>\w+)\s*\)
\s*[(] # match the function name until the opening (
\s*(?P<args>.*?)\s*[)] # group the function arguments
""", re.IGNORECASE|re.VERBOSE)
proto_pat=re.compile(r"""
(?P<ret>(-|\w|\&|\*)+\s*) # return type
\s+ # skip whitespace
(?P<func>\w+)\s*[(] # match the function name until the opening (
\s*(?P<args>.*?)\s*[)] # group the function arguments
""", re.IGNORECASE|re.VERBOSE)
arg_split_pat = re.compile("\s*,\s*")
buf = self.__clean_func(buf)
buf = string.split(buf,'\n')
for p in buf:
if not p:
continue
if DEBUG:
print 'matching line', repr(p)
fname = None
vfname = None
m = proto_pat.match(p)
if m is None:
if DEBUG:
print 'proto_pat not matched'
m = vproto_pat.match(p)
if m is None:
if DEBUG:
print 'vproto_pat not matched'
if p.find('vtable:') >= 0:
print "oops", repr(p)
if p.find('moo_file_enc_new') >= 0:
print '***', repr(p)
continue
else:
vfname = m.group('vfunc')
if DEBUG:
print 'proto_pat matched', repr(m.group(0))
print '+++ vfname', vfname
else:
if DEBUG:
print 'proto_pat matched', repr(m.group(0))
fname = m.group('func')
ret = m.group('ret')
if ret in ('return', 'else', 'if', 'switch'):
continue
if fname:
func = self.__functions_dict.get(fname)
if func is None:
continue
if DEBUG:
print 'match:|%s|' % fname
else:
func = self.__vmethods_dict.get(vfname)
if func is None:
func = VMethod('virtual:%s:%s' % (m.group('vtable'), m.group('vfunc')), None, None, None, None, None)
self.__vmethods_dict[func.name] = func
self.vmethods.append(func)
if DEBUG:
print 'match:|%s|' % func.name
args = m.group('args')
args = arg_split_pat.split(args)
for i in range(len(args)):
spaces = string.count(args[i], ' ')
if spaces > 1:
args[i] = string.replace(args[i], ' ', '-', spaces - 1)
if ret != 'void':
if func.retval is None:
func.retval = Retval()
if func.retval.type is None:
func.retval.type = ret
is_varargs = 0
has_args = len(args) > 0
for arg in args:
if arg == '...':
is_varargs = 1
elif arg in ('void', 'void '):
has_args = 0
if DEBUG:
print 'func ', ', '.join([p.name for p in func.params] if func.params else '')
if has_args and not is_varargs:
if func.params is None:
func.params = []
elif func.params:
assert len(func.params) == len(args)
for i in range(len(args)):
if DEBUG:
print 'arg:', args[i]
argtype, argname = string.split(args[i])
if DEBUG:
print argtype, argname
if len(func.params) <= i:
func.params.append(Param())
if func.params[i].name is None:
func.params[i].name = argname
if func.params[i].type is None:
func.params[i].type = argtype
if DEBUG:
print 'func ', ', '.join([p.name for p in func.params])
def __read_declarations(self, filename):
if DEBUG:
print filename
buf = open(filename).read()
self.__read_declarations_in_buf(buf, filename)

488
api/mdp/module.py Normal file
View File

@ -0,0 +1,488 @@
import sys
import re
import mdp.docparser as dparser
def split_camel_case_name(name):
comps = []
cur = ''
for c in name:
if c.islower() or not cur:
cur += c
else:
comps.append(cur)
cur = c
if cur:
comps.append(cur)
return comps
def get_class_method_c_name_prefix(cls):
comps = split_camel_case_name(cls)
return '_'.join([c.lower() for c in comps]) + '_'
def strip_class_prefix(name, cls):
prefix = get_class_method_c_name_prefix(cls)
if name.startswith(prefix):
return name[len(prefix):]
else:
return name
def strip_module_prefix(name, mod):
prefix = get_class_method_c_name_prefix(mod)
if name.startswith(prefix):
return name[len(prefix):]
else:
return name
def strip_module_prefix_from_class(name, mod):
mod = mod.lower()
mod = mod[0].upper() + mod[1:]
if name.startswith(mod):
return name[len(mod):]
else:
return name
def make_gtype_id(cls):
comps = split_camel_case_name(cls)
comps = [comps[0]] + ['TYPE'] + comps[1:]
return '_'.join([c.upper() for c in comps])
class Type(object):
def __init__(self, name):
object.__init__(self)
self.name = name
class BasicType(Type):
def __init__(self, name):
Type.__init__(self, name)
class _GTypedType(Type):
def __init__(self, name, short_name, gtype_id, docs):
Type.__init__(self, name)
self.docs = docs
self.methods = []
self.gtype_id = gtype_id
self.short_name = short_name
class Enum(_GTypedType):
def __init__(self, name, short_name, gtype_id, docs):
_GTypedType.__init__(self, name, short_name, gtype_id, docs)
class Flags(_GTypedType):
def __init__(self, name, short_name, gtype_id, docs):
_GTypedType.__init__(self, name, short_name, gtype_id, docs)
class _InstanceType(_GTypedType):
def __init__(self, name, short_name, gtype_id, docs):
_GTypedType.__init__(self, name, short_name, gtype_id, docs)
self.constructor = None
class Class(_InstanceType):
def __init__(self, name, short_name, parent, gtype_id, docs):
_InstanceType.__init__(self, name, short_name, gtype_id, docs)
self.parent = parent
self.vmethods = []
class Boxed(_InstanceType):
def __init__(self, name, short_name, gtype_id, docs):
_InstanceType.__init__(self, name, short_name, gtype_id, docs)
class Symbol(object):
def __init__(self, name, c_name, docs):
object.__init__(self)
self.name = name
self.c_name = c_name
self.docs = docs
class FunctionBase(Symbol):
def __init__(self, name, c_name, params, retval, docs):
Symbol.__init__(self, name, c_name, docs)
self.params = params
self.retval = retval
class Function(FunctionBase):
def __init__(self, name, c_name, params, retval, docs):
FunctionBase.__init__(self, name, c_name, params, retval, docs)
class Method(FunctionBase):
def __init__(self, name, c_name, cls, params, retval, docs):
FunctionBase.__init__(self, name, c_name, params, retval, docs)
self.cls = cls
class VMethod(FunctionBase):
def __init__(self, name, cls, params, retval, docs):
FunctionBase.__init__(self, name, name, params, retval, docs)
self.cls = cls
class ParamBase(object):
def __init__(self, typ, docs):
object.__init__(self)
self.type = typ
self.docs = docs
self.attributes = {}
self.transfer_mode = None
self.element_type = None
self.array = False
self.array_fixed_len = None
self.array_len_param = None
self.array_zero_terminated = None
class Param(ParamBase):
def __init__(self, name, typ, docs):
ParamBase.__init__(self, typ, docs)
self.name = name
self.out = False
self.caller_allocates = False
self.callee_allocates = False
self.in_ = False
self.inout = False
self.allow_none = False
self.default_value = None
self.scope = 'call'
class Retval(ParamBase):
def __init__(self, typ, docs):
ParamBase.__init__(self, typ, docs)
class Module(object):
def __init__(self, name):
object.__init__(self)
self.name = name
self.classes = []
self.boxed = []
self.__class_dict = {}
self.boxed = []
self.functions = []
self.__methods = {}
self.__constructors = {}
self.__vmethods = {}
self.types = {}
self.enums = []
def __add_class(self, pcls):
name = pcls.name
short_name = getattr(pcls, 'short_name', strip_module_prefix_from_class(pcls.name, self.name))
gtype_id = getattr(pcls, 'gtype_id', make_gtype_id(pcls.name))
docs = pcls.docs
parent = None
constructable = False
for a in pcls.annotations:
pieces = a.split()
prefix = pieces[0]
if prefix == 'parent':
assert len(pieces) == 2
parent = pieces[1]
elif prefix == 'constructable':
assert len(pieces) == 1
constructable = True
else:
raise RuntimeError("unknown annotation '%s' in class %s" % (a, name))
cls = Class(name, short_name, parent, gtype_id, docs)
cls.constructable = constructable
self.classes.append(cls)
self.__class_dict[name] = cls
def __add_boxed(self, pcls):
name = pcls.name
short_name = getattr(pcls, 'short_name', strip_module_prefix_from_class(pcls.name, self.name))
gtype_id = getattr(pcls, 'gtype_id', make_gtype_id(pcls.name))
docs = pcls.docs
# for a in pcls.annotations:
# m = re.match(r'^parent\s+(\S+)\s*$', a)
# if m:
# parent = m.group(1)
# else:
# raise RuntimeError("unknown annotation '%s' in class %s" % (a, name))
cls = Boxed(name, short_name, gtype_id, docs)
self.boxed.append(cls)
self.__class_dict[name] = cls
def __add_enum(self, ptyp):
print 'enum', ptyp.name
name = ptyp.name
short_name = getattr(ptyp, 'short_name', strip_module_prefix_from_class(ptyp.name, self.name))
gtype_id = getattr(ptyp, 'gtype_id', make_gtype_id(ptyp.name))
docs = ptyp.docs
if ptyp.annotations:
for a in ptyp.annotations:
raise RuntimeError("unknown annotation '%s' in class %s" % (a, name))
if isinstance(ptyp, dparser.Enum):
enum = Enum(name, short_name, gtype_id, docs)
else:
enum = Flags(name, short_name, gtype_id, docs)
self.enums.append(enum)
def __parse_param_or_retval_annotation(self, annotation, param):
pieces = annotation.split()
prefix = pieces[0]
if prefix == 'transfer':
if len(pieces) > 2:
raise RuntimeError("invalid annotation '%s'" % (a,))
if not pieces[1] in ('none', 'container', 'full'):
raise RuntimeError("invalid annotation '%s'" % (a,))
param.transfer_mode = pieces[1]
return True
if prefix == 'element-type':
if len(pieces) > 3:
raise RuntimeError("invalid annotation '%s'" % (a,))
if len(pieces) == 2:
param.element_type = pieces[1]
else:
param.element_type = pieces[1:]
return True
if prefix == 'array':
if len(pieces) == 1:
param.array = True
return True
if len(pieces) > 2:
raise RuntimeError("invalid annotation '%s'" % (a,))
m = re.match(r'fixed-size\s*=\s*(\d+)$', pieces[1])
if m:
param.array_fixed_size = int(m.group(1))
return True
m = re.match(r'length\s*=\s*(\S+)$', pieces[1])
if m:
param.array_len_param = m.group(1)
return True
m = re.match(r'zero-terminated\s*=\s*(\d+)$', pieces[1])
if m:
param.array_zero_terminated = bool(int(m.group(1)))
return True
raise RuntimeError("invalid annotation '%s'" % (a,))
if prefix == 'type':
if len(pieces) > 2:
raise RuntimeError("invalid annotation '%s'" % (a,))
param.type = pieces[1]
return True
if '.' in prefix[1:-1] and len(pieces) == 2:
param.attributes[prefix] = pieces[1]
return False
def __parse_param_annotation(self, annotation, param):
pieces = annotation.split()
prefix = pieces[0]
if prefix == 'out':
if len(pieces) > 2:
raise RuntimeError("invalid annotation '%s'" % (a,))
if len(pieces) == 1:
param.out = True
return True
if pieces[1] == 'caller-allocates':
param.out = True
param.caller_allocates = True
return True
if pieces[1] == 'callee-allocates':
param.out = True
param.callee_allocates = True
return True
raise RuntimeError("invalid annotation '%s'" % (a,))
if prefix == 'in':
if len(pieces) > 1:
raise RuntimeError("invalid annotation '%s'" % (a,))
param.in_ = True
return True
if prefix == 'inout':
if len(pieces) > 1:
raise RuntimeError("invalid annotation '%s'" % (a,))
param.inout = True
return True
if prefix == 'allow-none':
if len(pieces) > 1:
raise RuntimeError("invalid annotation '%s'" % (a,))
param.allow_none = True
return True
if prefix == 'default':
if len(pieces) != 2:
raise RuntimeError("invalid annotation '%s'" % (a,))
param.default_value = pieces[1]
return True
if prefix == 'scope':
if len(pieces) != 2:
raise RuntimeError("invalid annotation '%s'" % (a,))
if not pieces[1] in ('call', 'async', 'notified'):
raise RuntimeError("invalid annotation '%s'" % (a,))
param.scope = pieces[1]
return True
if '.' in prefix[1:-1] and len(pieces) == 2:
param.attributes[prefix] = pieces[1]
return False
def __parse_retval(self, pretval):
retval = Retval(pretval.type, pretval.docs)
if pretval.annotations:
for a in pretval.annotations:
if not self.__parse_param_or_retval_annotation(a, retval):
raise RuntimeError("invalid annotation '%s'" % (a,))
if not retval.type:
raise RuntimeError('return type missing')
return retval
def __parse_param(self, pp):
print pp.name, pp.type, pp.docs
param = Param(pp.name, pp.type, pp.docs)
if pp.annotations:
for a in pp.annotations:
if self.__parse_param_or_retval_annotation(a, param):
pass
elif self.__parse_param_annotation(a, param):
pass
else:
raise RuntimeError("invalid annotation '%s'" % (a,))
if param.type is None:
raise RuntimeError('param type missing')
return param
def __add_vmethod(self, pfunc):
_, cls, name = pfunc.name.split(':')
assert _ == 'virtual'
params = []
retval = None
docs = pfunc.docs
if pfunc.annotations:
for a in pfunc.annotations:
raise RuntimeError("unknown annotation '%s' in function %s" % (a, name))
if pfunc.params:
for p in pfunc.params:
params.append(self.__parse_param(p))
if pfunc.retval:
retval = self.__parse_retval(pfunc.retval)
meth = VMethod(name, cls, params[1:], retval, docs)
this_class_methods = self.__vmethods.get(cls)
if not this_class_methods:
this_class_methods = []
self.__vmethods[cls] = this_class_methods
this_class_methods.append(meth)
def __add_function(self, pfunc):
name = pfunc.name
c_name = pfunc.name
params = []
retval = None
docs = pfunc.docs
cls = None
constructor_of = None
if pfunc.annotations:
for a in pfunc.annotations:
pieces = a.split()
prefix = pieces[0]
if prefix == 'constructor-of':
assert len(pieces) == 2
constructor_of = pieces[1]
else:
raise RuntimeError("unknown annotation '%s' in function %s" % (a, name))
if pfunc.params:
for p in pfunc.params:
params.append(self.__parse_param(p))
if pfunc.retval:
retval = self.__parse_retval(pfunc.retval)
if hasattr(pfunc, 'method_of'):
cls = pfunc.method_of
elif params:
m = re.match(r'(const-)?([\w\d_]+)\*', params[0].type)
if m:
cls = m.group(2)
if not self.__class_dict.has_key(cls):
cls = None
if cls:
name = strip_class_prefix(name, cls)
else:
name = strip_module_prefix(name, self.name)
if constructor_of:
func = Function(name, c_name, params, retval, docs)
if constructor_of in self.__constructors:
raise RuntimeError('duplicated constructor of class %s' % constructor_of)
self.__constructors[constructor_of] = func
elif cls:
meth = Method(name, c_name, cls, params[1:], retval, docs)
this_class_methods = self.__methods.get(cls)
if not this_class_methods:
this_class_methods = []
self.__methods[cls] = this_class_methods
this_class_methods.append(meth)
else:
func = Function(name, c_name, params, retval, docs)
self.functions.append(func)
def init_from_dox(self, blocks):
for b in blocks:
if isinstance(b, dparser.Class):
self.__add_class(b)
elif isinstance(b, dparser.Boxed):
self.__add_boxed(b)
elif isinstance(b, dparser.Enum) or isinstance(b, dparser.Flags):
self.__add_enum(b)
elif isinstance(b, dparser.Flags):
self.__add_flags(b)
elif isinstance(b, dparser.VMethod):
self.__add_vmethod(b)
elif isinstance(b, dparser.Function):
self.__add_function(b)
else:
raise RuntimeError('oops')
instance_types = {}
for cls in self.classes + self.boxed:
if cls.name in instance_types:
raise RuntimeError('duplicated class %s' % (cls.name,))
instance_types[cls.name] = cls
for cls in self.__constructors:
func = self.__constructors[cls]
if not cls in instance_types:
print >> sys.stderr, "Constructor of unknown class %s" % (cls,)
else:
cls = instance_types[cls]
if cls.constructor is not None:
raise RuntimeError('duplicated constructor in class %s' % cls)
cls.constructor = func
for cls in self.__methods:
methods = self.__methods[cls]
if not cls in instance_types:
print >> sys.stderr, "Methods of unknown class %s" % (cls,)
else:
cls = instance_types[cls]
for m in methods:
m.cls = cls
cls.methods += methods
for cls in self.__vmethods:
methods = self.__vmethods[cls]
if not cls in instance_types:
print >> sys.stderr, "Virtual methods of unknown class %s" % (cls,)
else:
cls = instance_types[cls]
for m in methods:
m.cls = cls
cls.vmethods += methods
def format_func(func):
if func.retval and func.retval.type:
s = func.retval.type + ' '
else:
s = 'void '
s += func.name
s += ' ('
for i in range(len(func.params)):
if i != 0:
s += ', '
p = func.params[i]
s += '%s %s' % (p.type, p.name)
s += ')'
return s
for cls in self.classes:
print 'class %s' % (cls.name,)
for meth in cls.methods:
print ' %s' % (format_func(meth),)
for func in self.functions:
print format_func(func)

151
api/mdp/xmlwriter.py Normal file
View File

@ -0,0 +1,151 @@
import xml.etree.ElementTree as etree
import mdp.module as module
class Writer(object):
def __init__(self, out):
object.__init__(self)
self.out = out
self.xml = etree.TreeBuilder()
self.__tag_opened = False
self.__depth = 0
def __start_tag(self, tag, attrs={}):
if self.__tag_opened:
self.xml.data('\n')
if self.__depth > 0:
self.xml.data(' ' * self.__depth)
elm = self.xml.start(tag, attrs)
self.__tag_opened = True
self.__depth += 1
return elm
def __end_tag(self, tag):
if not self.__tag_opened and self.__depth > 1:
self.xml.data(' ' * (self.__depth - 1))
elm = self.xml.end(tag)
self.xml.data('\n')
self.__tag_opened = False
self.__depth -= 1
return elm
def __write_docs(self, docs):
if not docs:
return
self.__start_tag('doc')
docs = ' '.join(docs)
self.xml.data(docs)
self.__end_tag('doc')
def __write_param_or_retval_annotations(self, param, elm):
for k in param.attributes:
elm.set(k, self.attributes[v])
if param.transfer_mode is not None:
elm.set('transfer_mode', param.transfer_mode)
if param.element_type is not None:
elm.set('element_type', param.element_type)
if param.array:
elm.set('array', '1')
if param.array_fixed_len is not None:
elm.set('array_fixed_len', str(param.array_fixed_len))
if param.array_len_param is not None:
elm.set('array_len_param', param.array_len_param)
if param.array_zero_terminated:
elm.set('array_zero_terminated', '1')
def __write_param_annotations(self, param, elm):
self.__write_param_or_retval_annotations(param, elm)
if param.inout:
elm.set('inout', '1')
elif param.out:
elm.set('out', '1')
if param.caller_allocates:
elm.set('caller_allocates', '1')
elif param.callee_allocates:
elm.set('callee_allocates', '1')
if param.allow_none:
elm.set('allow_none', '1')
if param.default_value is not None:
elm.set('default_value', param.default_value)
if param.scope != 'call':
elm.set('scope', param.scope)
def __write_retval_annotations(self, retval, elm):
self.__write_param_or_retval_annotations(retval, elm)
def __write_param(self, param):
dic = dict(name=param.name, type=param.type)
elm = self.__start_tag('param', dic)
self.__write_param_annotations(param, elm)
self.__write_docs(param.docs)
self.__end_tag('param')
def __write_retval(self, retval):
dic = dict(type=retval.type)
elm = self.__start_tag('retval', dic)
self.__write_retval_annotations(retval, elm)
self.__write_docs(retval.docs)
self.__end_tag('retval')
def __write_class(self, cls):
dic = dict(name=cls.name, short_name=cls.short_name, parent=cls.parent, gtype_id=cls.gtype_id)
if cls.constructable:
dic['constructable'] = '1'
self.__start_tag('class', dic)
if cls.constructor is not None:
self.__write_function(cls.constructor, 'constructor')
for meth in cls.vmethods:
self.__write_function(meth, 'virtual')
for meth in cls.methods:
self.__write_function(meth, 'method')
self.__write_docs(cls.docs)
self.__end_tag('class')
def __write_boxed(self, cls):
dic = dict(name=cls.name, short_name=cls.short_name, gtype_id=cls.gtype_id)
self.__start_tag('boxed', dic)
if cls.constructor is not None:
self.__write_function(cls.constructor, 'constructor')
for meth in cls.methods:
self.__write_function(meth, 'method')
self.__write_docs(cls.docs)
self.__end_tag('boxed')
def __write_enum(self, enum):
if isinstance(enum, module.Enum):
tag = 'enum'
else:
tag = 'flags'
dic = dict(name=enum.name, short_name=enum.short_name, gtype_id=enum.gtype_id)
self.__start_tag(tag, dic)
self.__write_docs(enum.docs)
self.__end_tag(tag)
def __write_function(self, func, tag):
dic = dict(name=func.name)
if tag != 'virtual':
dic['c_name'] = func.c_name
self.__start_tag(tag, dic)
for p in func.params:
self.__write_param(p)
if func.retval:
self.__write_retval(func.retval)
self.__write_docs(func.docs)
self.__end_tag(tag)
def write(self, module):
self.__start_tag('module', dict(name=module.name))
for cls in module.classes:
self.__write_class(cls)
for cls in module.boxed:
self.__write_boxed(cls)
for enum in module.enums:
self.__write_enum(enum)
for func in module.functions:
self.__write_function(func, 'function')
self.__end_tag('module')
elm = self.xml.close()
etree.ElementTree(elm).write(self.out)
def write_xml(module, out):
Writer(out).write(module)

1112
api/moo.defs Normal file

File diff suppressed because it is too large Load Diff

348
api/moo.xml Normal file
View File

@ -0,0 +1,348 @@
<module name="Moo">
<class gtype_id="MOO_TYPE_EDITOR" name="MooEditor" parent="GObject" short_name="Editor">
<method c_name="moo_editor_get_ui_xml" name="get_ui_xml">
<retval type="MooUiXml*" />
</method>
</class>
<class gtype_id="MOO_TYPE_EDIT_WINDOW" name="MooEditWindow" parent="MooWindow" short_name="EditWindow">
<method c_name="moo_edit_window_add_pane" name="add_pane">
<param name="user_id" type="const-char*" />
<param name="widget" type="GtkWidget*" />
<param name="label" type="MooPaneLabel*" />
<param name="position" type="MooPanePosition" />
<retval type="MooPane*" />
</method>
<method c_name="moo_edit_window_remove_pane" name="remove_pane">
<param name="user_id" type="const-char*" />
<retval type="gboolean" />
</method>
<method c_name="moo_edit_window_get_pane" name="get_pane">
<param name="user_id" type="const-char*" />
<retval type="GtkWidget*" />
</method>
</class>
<class constructable="1" gtype_id="MOO_TYPE_TEXT_VIEW" name="MooTextView" parent="GtkTextView" short_name="TextView" />
<class gtype_id="MOO_TYPE_EDIT_BOOKMARK" name="MooEditBookmark" parent="MooLineMark" short_name="EditBookmark" />
<class gtype_id="MOO_TYPE_TEXT_BUFFER" name="MooTextBuffer" parent="GtkTextBuffer" short_name="TextBuffer" />
<class gtype_id="MOO_TYPE_PLUGIN" name="MooPlugin" parent="GObject" short_name="Plugin">
<virtual name="init">
<retval type="gboolean" />
</virtual>
<virtual name="deinit" />
<virtual name="attach_win">
<param name="window" type="MooEditWindow*" />
</virtual>
<virtual name="detach_win">
<param name="window" type="MooEditWindow*" />
</virtual>
<virtual name="attach_doc">
<param name="doc" type="MooEdit*" />
<param name="window" type="MooEditWindow*" />
</virtual>
<virtual name="detach_doc">
<param name="doc" type="MooEdit*" />
<param name="window" type="MooEditWindow*" />
</virtual>
<virtual name="create_prefs_page">
<retval type="GtkWidget*" />
</virtual>
<method c_name="moo_plugin_set_info" name="set_info">
<param name="info" type="MooPluginInfo*" />
</method>
<method c_name="moo_plugin_set_doc_plugin_type" name="set_doc_plugin_type">
<param name="type" type="GType" />
</method>
<method c_name="moo_plugin_set_win_plugin_type" name="set_win_plugin_type">
<param name="type" type="GType" />
</method>
</class>
<class gtype_id="MOO_TYPE_WIN_PLUGIN" name="MooWinPlugin" parent="GObject" short_name="WinPlugin">
<virtual name="create">
<retval type="gboolean" />
</virtual>
<virtual name="destroy" />
<method c_name="moo_win_plugin_get_window" name="get_window">
<retval type="MooEditWindow*" />
</method>
<method c_name="moo_win_plugin_get_plugin" name="get_plugin">
<retval type="MooPlugin*" />
</method>
</class>
<class gtype_id="MOO_TYPE_DOC_PLUGIN" name="MooDocPlugin" parent="GObject" short_name="DocPlugin">
<virtual name="create">
<retval type="gboolean" />
</virtual>
<virtual name="destroy" />
<method c_name="moo_doc_plugin_get_window" name="get_window">
<retval type="MooEditWindow*" />
</method>
<method c_name="moo_doc_plugin_get_doc" name="get_doc">
<retval type="MooEdit*" />
</method>
<method c_name="moo_doc_plugin_get_plugin" name="get_plugin">
<retval type="MooPlugin*" />
</method>
</class>
<class gtype_id="MOO_TYPE_EDIT" name="MooEdit" parent="MooTextView" short_name="Edit">
<method c_name="moo_edit_is_empty" name="is_empty">
<retval type="gboolean" />
<doc>This function returns whether the document is "empty", i.e. is not modified, is untitled, and contains no text.</doc>
</method>
<method c_name="moo_edit_get_lang_id" name="get_lang_id">
<retval type="const-char*">
<doc> id of language currently used in the document. If no language is used, then string "none" is returned.</doc>
</retval>
</method>
<method c_name="moo_edit_reload" name="reload">
<param allow_none="1" default_value="NULL" name="encoding" type="const-char*">
<doc>encoding to use. If %NULL, current document encoding will be used.</doc>
</param>
<param allow_none="1" name="error" type="GError**">
<doc>location for returned error or %NULL</doc>
</param>
<retval type="gboolean">
<doc> whether document was successfully reloaded</doc>
</retval>
<doc>Reload document from disk </doc>
</method>
<method c_name="moo_edit_close" name="close">
<param default_value="TRUE" name="ask_confirm" type="gboolean">
<doc>whether user should be asked if he wants to save changes before cloing if the document is modified.</doc>
</param>
<retval type="gboolean">
<doc> whether document was closed</doc>
</retval>
</method>
</class>
<class gtype_id="MOO_TYPE_EDIT_ACTION" name="MooEditAction" parent="MooAction" short_name="EditAction">
<virtual name="check_state" />
<virtual name="check_visible">
<retval type="gboolean" />
</virtual>
<virtual name="check_sensitive">
<retval type="gboolean" />
</virtual>
</class>
<class constructable="1" gtype_id="MOO_TYPE_LINE_MARK" name="MooLineMark" parent="GObject" short_name="LineMark" />
<class constructable="1" gtype_id="MOO_TYPE_PANED" name="MooPaned" parent="GtkBin" short_name="Paned" />
<class gtype_id="MOO_TYPE_MENU_ACTION" name="MooMenuAction" parent="MooAction" short_name="MenuAction" />
<class constructable="1" gtype_id="MOO_TYPE_PREFS_PAGE" name="MooPrefsPage" parent="GtkVBox" short_name="PrefsPage">
<virtual name="init" />
<virtual name="apply" />
</class>
<class gtype_id="MOO_TYPE_WINDOW" name="MooWindow" parent="GtkWindow" short_name="Window" />
<class constructable="1" gtype_id="MOO_TYPE_HISTORY_LIST" name="MooHistoryList" parent="GObject" short_name="HistoryList" />
<class constructable="1" gtype_id="MOO_TYPE_BIG_PANED" name="MooBigPaned" parent="GtkFrame" short_name="BigPaned" />
<class constructable="1" gtype_id="MOO_TYPE_UI_XML" name="MooUiXml" parent="GObject" short_name="UiXml">
<method c_name="moo_ui_xml_new_merge_id" name="new_merge_id">
<retval type="guint" />
</method>
</class>
<class constructable="1" gtype_id="MOO_TYPE_ENTRY" name="MooEntry" parent="GtkEntry" short_name="Entry" />
<class constructable="1" gtype_id="MOO_TYPE_NOTEBOOK" name="MooNotebook" parent="GtkNotebook" short_name="Notebook" />
<class gtype_id="MOO_TYPE_HISTORY_MGR" name="MooHistoryMgr" parent="GObject" short_name="HistoryMgr" />
<class constructable="1" gtype_id="MOO_TYPE_FILE_DIALOG" name="MooFileDialog" parent="GObject" short_name="FileDialog" />
<class gtype_id="MOO_TYPE_PANE" name="MooPane" parent="GtkObject" short_name="Pane">
<method c_name="moo_pane_set_label" name="set_label">
<param name="label" type="MooPaneLabel*" />
</method>
<method c_name="moo_pane_get_params" name="get_params">
<retval type="MooPaneParams*" />
</method>
<method c_name="moo_pane_get_label" name="get_label">
<retval type="MooPaneLabel*" />
</method>
<method c_name="moo_pane_set_params" name="set_params">
<param name="params" type="MooPaneParams*" />
</method>
<method c_name="moo_pane_set_detachable" name="set_detachable">
<param name="detachable" type="gboolean" />
</method>
<method c_name="moo_pane_set_removable" name="set_removable">
<param name="removable" type="gboolean" />
</method>
<method c_name="moo_pane_get_detachable" name="get_detachable">
<retval type="gboolean" />
</method>
<method c_name="moo_pane_get_removable" name="get_removable">
<retval type="gboolean" />
</method>
<method c_name="moo_pane_set_frame_markup" name="set_frame_markup">
<param allow_none="1" name="markup" type="const-char*" />
</method>
<method c_name="moo_pane_set_frame_text" name="set_frame_text">
<param allow_none="1" name="text" type="const-char*" />
</method>
<method c_name="moo_pane_set_drag_dest" name="set_drag_dest" />
<method c_name="moo_pane_unset_drag_dest" name="unset_drag_dest" />
<method c_name="moo_pane_get_id" name="get_id">
<retval type="const-char*" />
</method>
<method c_name="moo_pane_get_child" name="get_child">
<retval type="GtkWidget*" />
</method>
<method c_name="moo_pane_open" name="open" />
<method c_name="moo_pane_present" name="present" />
<method c_name="moo_pane_attach" name="attach" />
<method c_name="moo_pane_detach" name="detach" />
<method c_name="moo_pane_get_index" name="get_index">
<retval type="int" />
</method>
</class>
<class gtype_id="MOO_TYPE_MENU_TOOL_BUTTON" name="MooMenuToolButton" parent="GtkToggleToolButton" short_name="MenuToolButton" />
<class constructable="1" gtype_id="MOO_TYPE_MENU_MGR" name="MooMenuMgr" parent="GObject" short_name="MenuMgr" />
<class constructable="1" gtype_id="MOO_TYPE_COMBO" name="MooCombo" parent="GtkTable" short_name="Combo" />
<class gtype_id="MOO_TYPE_ACTION" name="MooAction" parent="GtkAction" short_name="Action" />
<class constructable="1" gtype_id="MOO_TYPE_HISTORY_COMBO" name="MooHistoryCombo" parent="MooCombo" short_name="HistoryCombo" />
<class constructable="1" gtype_id="MOO_TYPE_PREFS_DIALOG" name="MooPrefsDialog" parent="GtkDialog" short_name="PrefsDialog">
<virtual name="init" />
<virtual name="apply" />
</class>
<class gtype_id="MOO_TYPE_GLADE_XML" name="MooGladeXml" parent="GObject" short_name="GladeXml" />
<class gtype_id="MOO_TYPE_COMMAND" name="MooCommand" parent="GObject" short_name="Command">
<virtual name="check_sensitive">
<param name="doc" type="MooEdit*" />
<param name="window" type="MooEditWindow*" />
<retval type="gboolean" />
</virtual>
<virtual name="run">
<param name="ctx" type="MooCommandContext*" />
</virtual>
</class>
<class constructable="1" gtype_id="MOO_TYPE_COMMAND_CONTEXT" name="MooCommandContext" parent="GObject" short_name="CommandContext" />
<class gtype_id="MOO_TYPE_COMMAND_FACTORY" name="MooCommandFactory" parent="GObject" short_name="CommandFactory">
<virtual name="create_command">
<param name="data" type="MooCommandData*" />
<param name="options" type="const-char*" />
<retval type="MooCommand*" />
</virtual>
<virtual name="create_widget">
<retval type="GtkWidget*" />
</virtual>
<virtual name="load_data">
<param name="widget" type="GtkWidget*" />
<param name="data" type="MooCommandData*" />
</virtual>
<virtual name="save_data">
<param name="widget" type="GtkWidget*" />
<param name="data" type="MooCommandData*" />
<retval type="gboolean" />
</virtual>
<virtual name="data_equal">
<param name="data1" type="MooCommandData*" />
<param name="data2" type="MooCommandData*" />
<retval type="gboolean" />
</virtual>
</class>
<class constructable="1" gtype_id="MOO_TYPE_LINE_VIEW" name="MooLineView" parent="MooTextView" short_name="LineView" />
<class constructable="1" gtype_id="MOO_TYPE_CMD_VIEW" name="MooCmdView" parent="MooLineView" short_name="CmdView" />
<boxed gtype_id="MOO_TYPE_PLUGIN_INFO" name="MooPluginInfo" short_name="PluginInfo">
<constructor c_name="moo_plugin_info_new" name="plugin_info_new">
<param name="name" type="const-char*" />
<param name="description" type="const-char*" />
<param name="author" type="const-char*" />
<param name="version" type="const-char*" />
<retval type="MooPluginInfo*" />
</constructor>
</boxed>
<boxed gtype_id="MOO_TYPE_PLUGIN_PARAMS" name="MooPluginParams" short_name="PluginParams">
<constructor c_name="moo_plugin_params_new" name="plugin_params_new">
<param name="enabled" type="gboolean" />
<param name="visible" type="gboolean" />
<retval type="MooPluginParams*" />
</constructor>
</boxed>
<boxed gtype_id="MOO_TYPE_FILE_ENC" name="MooFileEnc" short_name="FileEnc">
<constructor c_name="moo_file_enc_new" name="file_enc_new">
<param name="file" type="GFile*" />
<param name="encoding" type="const-char*" />
<retval type="MooFileEnc*" />
</constructor>
</boxed>
<boxed gtype_id="MOO_TYPE_PANE_LABEL" name="MooPaneLabel" short_name="PaneLabel">
<constructor c_name="moo_pane_label_new" name="pane_label_new">
<param allow_none="1" default_value="NULL" name="icon_name" type="const-char*" />
<param allow_none="1" default_value="NULL" name="icon_pixbuf" type="GdkPixbuf*" />
<param allow_none="1" default_value="NULL" name="label_text" type="const-char*" />
<param allow_none="1" default_value="NULL" name="window_title" type="const-char*" />
<retval type="MooPaneLabel*" />
</constructor>
</boxed>
<boxed gtype_id="MOO_TYPE_COMMAND_DATA" name="MooCommandData" short_name="CommandData" />
<enum gtype_id="MOO_TYPE_LINE_END_TYPE" name="MooLineEndType" short_name="LineEndType" />
<flags gtype_id="MOO_TYPE_TEXT_SEARCH_FLAGS" name="MooTextSearchFlags" short_name="TextSearchFlags" />
<flags gtype_id="MOO_TYPE_FIND_FLAGS" name="MooFindFlags" short_name="FindFlags" />
<flags gtype_id="MOO_TYPE_EDIT_STATUS" name="MooEditStatus" short_name="EditStatus" />
<enum gtype_id="MOO_TYPE_PANE_POSITION" name="MooPanePosition" short_name="PanePosition" />
<function c_name="moo_editor_instance" name="editor_instance">
<retval type="MooEditor*" />
</function>
<function c_name="moo_prefs_new_key_bool" name="prefs_new_key_bool">
<param name="key" type="const-char*" />
<param default_value="FALSE" name="default_val" type="gboolean" />
</function>
<function c_name="moo_prefs_new_key_int" name="prefs_new_key_int">
<param name="key" type="const-char*" />
<param default_value="0" name="default_val" type="int" />
</function>
<function c_name="moo_prefs_new_key_string" name="prefs_new_key_string">
<param name="key" type="const-char*" />
<param allow_none="1" default_value="NULL" name="default_val" type="const-char*" />
</function>
<function c_name="moo_prefs_get_string" name="prefs_get_string">
<param name="key" type="const-char*" />
<retval type="const-char*" />
</function>
<function c_name="moo_prefs_get_filename" name="prefs_get_filename">
<param name="key" type="const-char*" />
<retval type="const-char*" />
</function>
<function c_name="moo_prefs_get_file" name="prefs_get_file">
<param name="key" type="const-char*" />
<retval transfer_mode="full" type="GFile*" />
</function>
<function c_name="moo_prefs_get_bool" name="prefs_get_bool">
<param name="key" type="const-char*" />
<retval type="gboolean" />
</function>
<function c_name="moo_prefs_get_int" name="prefs_get_int">
<param name="key" type="const-char*" />
<retval type="int" />
</function>
<function c_name="moo_prefs_set_string" name="prefs_set_string">
<param name="key" type="const-char*" />
<param allow_none="1" name="val" type="const-char*" />
</function>
<function c_name="moo_prefs_set_filename" name="prefs_set_filename">
<param name="key" type="const-char*" />
<param allow_none="1" name="val" type="const-char*" />
</function>
<function c_name="moo_prefs_set_file" name="prefs_set_file">
<param name="key" type="const-char*" />
<param allow_none="1" name="val" type="GFile*" />
</function>
<function c_name="moo_prefs_set_int" name="prefs_set_int">
<param name="key" type="const-char*" />
<param name="val" type="int" />
</function>
<function c_name="moo_prefs_set_bool" name="prefs_set_bool">
<param name="key" type="const-char*" />
<param name="val" type="gboolean" />
</function>
<function c_name="moo_dgettext" name="dgettext">
<param name="domain" type="const-char*" />
<param name="string" type="const-char*" />
<retval type="const-char*" />
</function>
<function c_name="moo_gettext" name="gettext">
<param name="string" type="const-char*" />
<retval type="const-char*" />
</function>
<function c_name="moo_command_factory_register" name="command_factory_register">
<param name="name" type="const-char*" />
<param name="display_name" type="const-char*" />
<param name="factory" type="MooCommandFactory*" />
<param allow_none="1" name="keys" type="strv" />
<param name="extension" type="const-char*" />
</function>
</module>

1
api/mpi/__init__.py Normal file
View File

@ -0,0 +1 @@
# empty

147
api/mpi/defswriter.py Normal file
View File

@ -0,0 +1,147 @@
from mpi.module import *
class_template = """\
(define-object %(short_name)s
(in-module "%(module)s")
(parent "%(parent)s")
(c-name "%(name)s")
(gtype-id "%(gtype_id)s")
)
"""
method_start_template = """\
(define-method %(name)s
(of-object "%(class)s")
(c-name "%(c_name)s")
(return-type "%(return_type)s")
"""
vmethod_start_template = """\
(define-virtual %(name)s
(of-object "%(class)s")
(return-type "%(return_type)s")
"""
function_start_template = """\
(define-function %(name)s
(c-name "%(c_name)s")
(return-type "%(return_type)s")
"""
type_template = """\
(define-%(what)s %(short_name)s
(in-module "%(module)s")
(c-name "%(name)s")
(gtype-id "%(gtype_id)s")
)
"""
class Writer(object):
def __init__(self, out):
object.__init__(self)
self.out = out
self.module = None
def __write_class_decl(self, cls):
dic = dict(name=cls.name,
short_name=cls.short_name,
module=self.module.name,
parent=cls.parent,
gtype_id=cls.gtype_id)
self.out.write(class_template % dic)
self.out.write('\n')
def __write_boxed_decl(self, cls):
dic = dict(name=cls.name,
short_name=cls.short_name,
module=self.module.name,
gtype_id=cls.gtype_id,
what='boxed')
self.out.write(type_template % dic)
self.out.write('\n')
def __write_enum_decl(self, cls):
dic = dict(name=cls.name,
short_name=cls.short_name,
module=self.module.name,
gtype_id=cls.gtype_id,
what='enum' if isinstance(cls, Enum) else 'flags')
self.out.write(type_template % dic)
self.out.write('\n')
def __write_function_or_method(self, meth, cls):
if meth.retval:
return_type = meth.retval.type
else:
return_type = 'none'
dic = dict(name=meth.name, c_name=meth.c_name, return_type=return_type)
if not cls:
self.out.write(function_start_template % dic)
elif isinstance(meth, Constructor):
dic['class'] = cls.name
self.out.write(function_start_template % dic)
self.out.write(' (is-constructor-of %s)\n' % cls.name)
elif isinstance(meth, VMethod):
dic['class'] = cls.name
self.out.write(vmethod_start_template % dic)
else:
dic['class'] = cls.name
self.out.write(method_start_template % dic)
if meth.retval:
if meth.retval.transfer_mode == 'full':
self.out.write(' (caller-owns-return #t)\n')
elif meth.retval.transfer_mode is not None:
raise RuntimeError('do not know how to handle transfer mode %s' % (meth.retval.transfer_mode,))
if meth.params:
self.out.write(' (parameters\n')
for p in meth.params:
self.out.write(' \'("%s" "%s"' % (p.type, p.name))
if p.allow_none:
self.out.write(' (null-ok)')
if p.default_value is not None:
self.out.write(' (default "%s")' % (p.default_value,))
self.out.write(')\n')
self.out.write(' )\n')
self.out.write(')\n\n')
def __write_class_method(self, meth, cls):
self.__write_function_or_method(meth, cls)
def __write_class_methods(self, cls):
self.out.write('; methods of %s\n\n' % cls.name)
if cls.constructor is not None:
self.__write_function_or_method(cls.constructor, cls)
if hasattr(cls, 'constructable') and cls.constructable:
cons = Constructor()
cons.name = '%s__new' % cls.name
cons.c_name = cons.name
self.__write_function_or_method(cons, cls)
if isinstance(cls, Class):
for meth in cls.vmethods:
self.__write_class_method(meth, cls)
for meth in cls.methods:
self.__write_class_method(meth, cls)
def __write_function(self, func):
self.__write_function_or_method(func, None)
def write(self, module):
self.module = module
self.out.write('; -*- scheme -*-\n\n')
self.out.write('; classes\n\n')
for cls in module.get_classes():
self.__write_class_decl(cls)
self.out.write('; boxed types\n\n')
for cls in module.get_boxed():
self.__write_boxed_decl(cls)
self.out.write('; enums and flags\n\n')
for enum in module.get_enums():
self.__write_enum_decl(enum)
for cls in module.get_classes():
self.__write_class_methods(cls)
for cls in module.get_boxed():
self.__write_class_methods(cls)
self.out.write('; functions\n\n')
for func in module.get_functions():
self.__write_function(func)
self.module = None

298
api/mpi/module.py Normal file
View File

@ -0,0 +1,298 @@
import xml.etree.ElementTree as _etree
class Doc(object):
def __init__(self, text):
object.__init__(self)
self.text = text
@staticmethod
def from_xml(elm):
return Doc(elm.text)
def _set_unique_attribute(obj, attr, value):
if getattr(obj, attr) is not None:
raise RuntimeError("duplicated attribute '%s'" % (attr,))
setattr(obj, attr, value)
def _set_unique_attribute_bool(obj, attr, value):
if value.lower() in ('0', 'false', 'no'):
value = False
elif value.lower() in ('1', 'true', 'yes'):
value = True
else:
raise RuntimeError("bad value '%s' for boolean attribute '%s'" % (value, attr))
_set_unique_attribute(obj, attr, value)
class _XmlObject(object):
def __init__(self):
object.__init__(self)
self.doc = None
@classmethod
def from_xml(cls, elm, *args):
obj = cls()
obj._parse_xml(elm, *args)
return obj
def _parse_xml_element(self, elm):
if elm.tag == 'doc':
_set_unique_attribute(self, 'doc', Doc.from_xml(elm))
else:
raise RuntimeError('unknown element %s' % (elm.tag,))
def _parse_attribute(self, attr, value):
return False
def _parse_xml(self, elm, *args):
for attr, value in elm.items():
if not self._parse_attribute(attr, value):
raise RuntimeError('unknown attribute %s' % (attr,))
for child in elm.getchildren():
self._parse_xml_element(child)
class _ParamBase(_XmlObject):
def __init__(self):
_XmlObject.__init__(self)
self.type = None
self.transfer_mode = None
def _parse_attribute(self, attr, value):
if attr in ('type', 'transfer_mode'):
_set_unique_attribute(self, attr, value)
else:
return _XmlObject._parse_attribute(self, attr, value)
return True
class Param(_ParamBase):
def __init__(self):
_ParamBase.__init__(self)
self.name = None
self.default_value = None
self.allow_none = None
def _parse_attribute(self, attr, value):
if attr in ('default_value', 'name'):
_set_unique_attribute(self, attr, value)
elif attr == 'allow_none':
_set_unique_attribute_bool(self, attr, value)
else:
return _ParamBase._parse_attribute(self, attr, value)
return True
class Retval(_ParamBase):
def __init__(self):
_ParamBase.__init__(self)
class _FunctionBase(_XmlObject):
def __init__(self):
_XmlObject.__init__(self)
self.name = None
self.c_name = None
self.retval = None
self.params = []
def _parse_attribute(self, attr, value):
if attr in ('c_name', 'name'):
_set_unique_attribute(self, attr, value)
else:
return _XmlObject._parse_attribute(self, attr, value)
return True
def _parse_xml_element(self, elm):
if elm.tag == 'retval':
_set_unique_attribute(self, 'retval', Retval.from_xml(elm))
elif elm.tag == 'param':
self.params.append(Param.from_xml(elm))
else:
_XmlObject._parse_xml_element(self, elm)
def _parse_xml(self, elm, *args):
_XmlObject._parse_xml(self, elm, *args)
if not self.name:
raise RuntimeError('function name missing')
if not self.c_name:
raise RuntimeError('function c_name missing')
class Function(_FunctionBase):
def __init__(self):
_FunctionBase.__init__(self)
class Constructor(_FunctionBase):
def __init__(self):
_FunctionBase.__init__(self)
class Method(_FunctionBase):
def __init__(self):
_FunctionBase.__init__(self)
class VMethod(_FunctionBase):
def __init__(self):
_FunctionBase.__init__(self)
self.c_name = "fake"
class _GTypedType(_XmlObject):
def __init__(self):
_XmlObject.__init__(self)
self.name = None
self.short_name = None
self.gtype_id = None
def _parse_attribute(self, attr, value):
if attr in ('short_name', 'name', 'gtype_id'):
_set_unique_attribute(self, attr, value)
else:
return _XmlObject._parse_attribute(self, attr, value)
return True
def _parse_xml(self, elm, *args):
_XmlObject._parse_xml(self, elm, *args)
if self.name is None:
raise RuntimeError('class name missing')
if self.short_name is None:
raise RuntimeError('class short name missing')
if self.gtype_id is None:
raise RuntimeError('class gtype missing')
class Enum(_GTypedType):
def __init__(self):
_GTypedType.__init__(self)
class Flags(_GTypedType):
def __init__(self):
_GTypedType.__init__(self)
class _InstanceType(_GTypedType):
def __init__(self):
_GTypedType.__init__(self)
self.constructor = None
self.methods = []
self.__method_hash = {}
def _parse_xml_element(self, elm):
if elm.tag == 'method':
meth = Method.from_xml(elm, self)
assert not meth.name in self.__method_hash
self.__method_hash[meth.name] = meth
self.methods.append(meth)
elif elm.tag == 'constructor':
assert not self.constructor
self.constructor = Constructor.from_xml(elm)
else:
_GTypedType._parse_xml_element(self, elm)
class Boxed(_InstanceType):
def __init__(self):
_InstanceType.__init__(self)
class Class(_InstanceType):
def __init__(self):
_InstanceType.__init__(self)
self.parent = None
self.vmethods = []
self.constructable = None
self.__vmethod_hash = {}
def _parse_attribute(self, attr, value):
if attr in ('parent'):
_set_unique_attribute(self, attr, value)
elif attr in ('constructable'):
_set_unique_attribute_bool(self, attr, value)
else:
return _InstanceType._parse_attribute(self, attr, value)
return True
def _parse_xml_element(self, elm):
if elm.tag == 'virtual':
meth = VMethod.from_xml(elm, self)
assert not meth.name in self.__vmethod_hash
self.__vmethod_hash[meth.name] = meth
self.vmethods.append(meth)
else:
_InstanceType._parse_xml_element(self, elm)
def _parse_xml(self, elm, *args):
_InstanceType._parse_xml(self, elm, *args)
if self.parent is None:
raise RuntimeError('class parent name missing')
if self.constructable and self.constructor:
raise RuntimeError('both constructor and constructable attributes present')
class Module(object):
def __init__(self):
object.__init__(self)
self.name = None
self.__classes = []
self.__boxed = []
self.__enums = []
self.__class_hash = {}
self.__functions = []
self.__function_hash = {}
self.__import_modules = []
self.__parsing_done = False
def __add_type(self, typ):
if typ.name in self.__class_hash:
raise RuntimeError('duplicated type %s' % typ.name)
self.__class_hash[typ.name] = typ
def __finish_parsing(self):
if self.__parsing_done:
return
self.__parsing_done = True
def get_classes(self):
self.__finish_parsing()
return list(self.__classes)
def get_boxed(self):
self.__finish_parsing()
return list(self.__boxed)
def get_enums(self):
self.__finish_parsing()
return list(self.__enums)
def get_functions(self):
self.__finish_parsing()
return list(self.__functions)
def __parse_module_entry(self, elm):
if elm.tag == 'class':
cls = Class.from_xml(elm)
self.__add_type(cls)
self.__classes.append(cls)
elif elm.tag == 'boxed':
cls = Boxed.from_xml(elm)
self.__add_type(cls)
self.__boxed.append(cls)
elif elm.tag == 'enum':
enum = Enum.from_xml(elm)
self.__add_type(enum)
self.__enums.append(enum)
elif elm.tag == 'flags':
enum = Flags.from_xml(elm)
self.__add_type(enum)
self.__enums.append(enum)
elif elm.tag == 'function':
func = Function.from_xml(elm)
assert not func.name in self.__function_hash
self.__function_hash[func.name] = func
self.__functions.append(func)
else:
raise RuntimeError('unknown element %s' % (elm.tag,))
def import_module(self, mod):
self.__import_modules.append(mod)
@staticmethod
def from_xml(filename):
mod = Module()
xml = _etree.ElementTree()
xml.parse(filename)
root = xml.getroot()
assert root.tag == 'module'
mod.name = root.get('name')
assert mod.name is not None
for elm in root.getchildren():
mod.__parse_module_entry(elm)
return mod

48
api/parsedocs.py Normal file
View File

@ -0,0 +1,48 @@
#! /usr/bin/env python
import os
import re
import sys
import optparse
import fnmatch
from mdp.docparser import Parser
from mdp.module import Module
import mdp.xmlwriter
def read_files(files):
p = Parser()
p.read_files(files)
mod = Module('Moo')
mod.init_from_dox(p.classes + p.enums + p.functions + p.vmethods)
return mod
def parse_args():
op = optparse.OptionParser()
op.add_option("--source-dir", dest="source_dirs", action="append",
help="parse source files from DIR", metavar="DIR")
op.add_option("--skip", dest="skip_globs", action="append",
help="skip files which match pattern PAT", metavar="PAT")
op.add_option("--output", dest="output", action="store",
help="write result to FILE", metavar="FILE")
(opts, args) = op.parse_args()
if args:
op.error("too many arguments")
source_files = []
skip_pat = None
if opts.skip_globs:
skip_pat = re.compile('|'.join([fnmatch.translate(g) for g in opts.skip_globs]))
for source_dir in opts.source_dirs:
for root, dirs, files in os.walk(source_dir):
for f in files:
if f.endswith('.c') or f.endswith('.h'):
if skip_pat is None or not skip_pat.match(f):
source_files.append(os.path.join(root, f))
if not source_files:
op.error("no input files")
return opts, source_files
opts, files = parse_args()
mod = read_files(files)
with open(opts.output, 'w') as out:
mdp.xmlwriter.write_xml(mod, out)

12
api/parsexml.py Normal file
View File

@ -0,0 +1,12 @@
#! /usr/bin/env python
import os
import re
import sys
import optparse
import fnmatch
from mpi.module import Module
for arg in sys.argv[1:]:
mod = Module.from_xml(arg)

289
api/sourcefiles.mak Normal file
View File

@ -0,0 +1,289 @@
source_files = \
../moo/mooapp/mooapp-private.h\
../moo/mooapp/mooappabout.c\
../moo/mooapp/mooapp.c\
../moo/mooapp/moohtml.h\
../moo/mooapp/mooapp-info.h\
../moo/mooapp/moolinklabel.c\
../moo/mooapp/moolinklabel.h\
../moo/mooapp/mooapp-accels.h\
../moo/mooapp/mooappabout.h\
../moo/mooapp/moohtml.c\
../moo/mooapp/mooapp.h\
../moo/mooedit/mooeditor.c\
../moo/mooedit/moolangmgr.h\
../moo/mooedit/mootextsearch.h\
../moo/mooedit/mootextfind.h\
../moo/mooedit/mooeditwindow.c\
../moo/mooedit/mooeditfiltersettings.c\
../moo/mooedit/mooeditor-private.h\
../moo/mooedit/mooedithistoryitem.h\
../moo/mooedit/mootextview-private.h\
../moo/mooedit/mootextprint.h\
../moo/mooedit/mooindenter.c\
../moo/mooedit/mooplugin-loader.h\
../moo/mooedit/mooeditor-tests.c\
../moo/mooedit/mootextview.c\
../moo/mooedit/mootextprint-private.h\
../moo/mooedit/moolinemark.h\
../moo/mooedit/mootextprint.c\
../moo/mooedit/mooeditconfig.h\
../moo/mooedit/mooedit-fileops.c\
../moo/mooedit/mootextstylescheme.h\
../moo/mooedit/moofold.h\
../moo/mooedit/mooedit-enums.c\
../moo/mooedit/mooedit-private.h\
../moo/mooedit/moofileenc.h\
../moo/mooedit/mootextbuffer.h\
../moo/mooedit/moolangmgr.c\
../moo/mooedit/mooeditaction-factory.h\
../moo/mooedit/mooeditor-impl.h\
../moo/mooedit/mooeditprefs.c\
../moo/mooedit/mootext-private.h\
../moo/mooedit/mooeditbookmark.c\
../moo/mooedit/moolinebuffer.c\
../moo/mooedit/mooeditprefspage.c\
../moo/mooedit/mootextiter.h\
../moo/mooedit/mootextsearch.c\
../moo/mooedit/mooedit-misc.c\
../moo/mooedit/moolang-private.h\
../moo/mooedit/mootextview.h\
../moo/mooedit/mootextview-input.c\
../moo/mooedit/mooindenter.h\
../moo/mooedit/mooeditdialogs.h\
../moo/mooedit/mooplugin-macro.h\
../moo/mooedit/mootextbuffer.c\
../moo/mooedit/mootextbtree.c\
../moo/mooedit/mooeditdialogs.c\
../moo/mooedit/mooeditaction-factory.c\
../moo/mooedit/mooplugin.c\
../moo/mooedit/mooprintpreview.h\
../moo/mooedit/mooedit-enums.h\
../moo/mooedit/mooeditwindow.h\
../moo/mooedit/moolang.c\
../moo/mooedit/mooprintpreview.c\
../moo/mooedit/mooeditwindow-impl.h\
../moo/mooedit/mootextbtree.h\
../moo/mooedit/mooplugin-loader.c\
../moo/mooedit/mooedit.c\
../moo/mooedit/mootextsearch-private.h\
../moo/mooedit/mooeditprefs.h\
../moo/mooedit/moofileenc.c\
../moo/mooedit/mooplugin.h\
../moo/mooedit/mooeditconfig.c\
../moo/mooedit/moolangmgr-private.h\
../moo/mooedit/mooeditor-tests.h\
../moo/mooedit/mooedithistoryitem.c\
../moo/mooedit/mooeditor.h\
../moo/mooedit/mooedit-accels.h\
../moo/mooedit/mooeditfiltersettings.h\
../moo/mooedit/moofold.c\
../moo/mooedit/mooedit.h\
../moo/mooedit/mooedit-impl.h\
../moo/mooedit/mooeditaction.h\
../moo/mooedit/mootextstylescheme.c\
../moo/mooedit/mooeditaction.c\
../moo/mooedit/moolinebuffer.h\
../moo/mooedit/mooedit-fileops.h\
../moo/mooedit/moolinemark.c\
../moo/mooedit/mootextfind.c\
../moo/mooedit/moolang.h\
../moo/mooedit/mooeditbookmark.h\
../moo/mooedit/mooedittypes.h\
../moo/moofileview/moofileview-dialogs.h\
../moo/moofileview/mooiconview.h\
../moo/moofileview/moofileview-private.h\
../moo/moofileview/mootreeview.c\
../moo/moofileview/moofilesystem.h\
../moo/moofileview/moobookmarkview.h\
../moo/moofileview/moofolder-private.h\
../moo/moofileview/moofileentry.c\
../moo/moofileview/moofileview-dialogs.c\
../moo/moofileview/moofolder.c\
../moo/moofileview/moofileview.h\
../moo/moofileview/moobookmarkmgr.c\
../moo/moofileview/moofile.c\
../moo/moofileview/moofileview-tools.c\
../moo/moofileview/moofileentry.h\
../moo/moofileview/moofolder.h\
../moo/moofileview/moobookmarkmgr.h\
../moo/moofileview/moofileview-aux.h\
../moo/moofileview/moobookmarkview.c\
../moo/moofileview/moofoldermodel-private.h\
../moo/moofileview/moofile-private.h\
../moo/moofileview/moofileview-accels.h\
../moo/moofileview/mooiconview.c\
../moo/moofileview/moofileview.c\
../moo/moofileview/moofileview-impl.h\
../moo/moofileview/mootreeview.h\
../moo/moofileview/moofoldermodel.h\
../moo/moofileview/moofileview-tools.h\
../moo/moofileview/moofilesystem.c\
../moo/moofileview/moofoldermodel.c\
../moo/moofileview/moofile.h\
../moo/mooutils/mooutils-file.h\
../moo/mooutils/mooclosure.c\
../moo/mooutils/mooundo.h\
../moo/mooutils/moo-mime.h\
../moo/mooutils/mooappinput.h\
../moo/mooutils/mooutils-messages.h\
../moo/mooutils/mooutils-treeview.h\
../moo/mooutils/mooprefsdialog.h\
../moo/mooutils/moocompat.h\
../moo/mooutils/mooutils-file.c\
../moo/mooutils/mooaccelprefs.c\
../moo/mooutils/mooactiongroup.h\
../moo/mooutils/moohelp.h\
../moo/mooutils/mooencodings.c\
../moo/mooutils/mooutils-macros.h\
../moo/mooutils/mooactionbase-private.h\
../moo/mooutils/moopaned.c\
../moo/mooutils/moofiltermgr.h\
../moo/mooutils/mooonce.h\
../moo/mooutils/mooaccelbutton.h\
../moo/mooutils/moowin32/ms/sys/time.h\
../moo/mooutils/moowin32/ms/unistd.h\
../moo/mooutils/moowin32/mingw/fnmatch.h\
../moo/mooutils/moowin32/mingw/netinet/in.h\
../moo/mooutils/moowin32/mingw/sys/mman.h\
../moo/mooutils/stock-select-all-16.h\
../moo/mooutils/moomenuaction.c\
../moo/mooutils/mooglade.h\
../moo/mooutils/moouixml.h\
../moo/mooutils/mooprefspage.c\
../moo/mooutils/moo-environ.h\
../moo/mooutils/stock-file-24.h\
../moo/mooutils/moofilewatch.h\
../moo/mooutils/mooutils-gobject.h\
../moo/mooutils/mooundo.c\
../moo/mooutils/mooaccel.h\
../moo/mooutils/moowindow.c\
../moo/mooutils/moo-test-utils.c\
../moo/mooutils/mooutils-gobject-private.h\
../moo/mooutils/moohistorylist.c\
../moo/mooutils/mooutils-win32.c\
../moo/mooutils/moomenutoolbutton.h\
../moo/mooutils/moolist.h\
../moo/mooutils/moobigpaned.c\
../moo/mooutils/mooactioncollection.h\
../moo/mooutils/moospawn.c\
../moo/mooutils/mooapp-ipc.h\
../moo/mooutils/mooencodings-data.h\
../moo/mooutils/mooutils-fs.c\
../moo/mooutils/moomenuaction.h\
../moo/mooutils/moomenu.h\
../moo/mooutils/mooatom.h\
../moo/mooutils/mooactionbase.h\
../moo/mooutils/mooarray.h\
../moo/mooutils/moostock.c\
../moo/mooutils/moouixml.c\
../moo/mooutils/mooentry.c\
../moo/mooutils/moo-test-macros.h\
../moo/mooutils/moofileicon.h\
../moo/mooutils/mooencodings.h\
../moo/mooutils/moospawn.h\
../moo/mooutils/moonotebook.c\
../moo/mooutils/stock-file-selector-24.h\
../moo/mooutils/moofiledialog.h\
../moo/mooutils/moohistorymgr.c\
../moo/mooutils/mooactionbase.c\
../moo/mooutils/moofontsel.c\
../moo/mooutils/mooaccelprefs.h\
../moo/mooutils/mooprefspage.h\
../moo/mooutils/mooi18n.h\
../moo/mooutils/moofileicon.c\
../moo/mooutils/moomarkup.h\
../moo/mooutils/moowindow.h\
../moo/mooutils/moohistorycombo.h\
../moo/mooutils/moofiltermgr.c\
../moo/mooutils/mooutils-misc.c\
../moo/mooutils/mooutils-thread.h\
../moo/mooutils/moopane.h\
../moo/mooutils/moofilewatch.c\
../moo/mooutils/moofiledialog.c\
../moo/mooutils/moopane.c\
../moo/mooutils/moofilewriter.h\
../moo/mooutils/mooprefs.c\
../moo/mooutils/moohelp.c\
../moo/mooutils/moomenutoolbutton.c\
../moo/mooutils/mooutils-enums.h\
../moo/mooutils/moomenu.c\
../moo/mooutils/moostat.h\
../moo/mooutils/mooappinput.c\
../moo/mooutils/mootype-macros.h\
../moo/mooutils/mooutils-misc.h\
../moo/mooutils/mooutils-fs.h\
../moo/mooutils/mooactionfactory.h\
../moo/mooutils/moostock.h\
../moo/mooutils/mooutils-enums.c\
../moo/mooutils/stock-select-all-24.h\
../moo/mooutils/mooeditops.h\
../moo/mooutils/moohistorymgr.h\
../moo/mooutils/mooaccel.c\
../moo/mooutils/moofilewriter-private.h\
../moo/mooutils/moo-mime.c\
../moo/mooutils/moodialogs.c\
../moo/mooutils/mooutils-mem.h\
../moo/mooutils/mooutils-treeview.c\
../moo/mooutils/mootypedecl-macros.h\
../moo/mooutils/mooentry.h\
../moo/mooutils/moomenumgr.c\
../moo/mooutils/moocombo.c\
../moo/mooutils/mooaction.c\
../moo/mooutils/mooutils-debug.h\
../moo/mooutils/moodialogs.h\
../moo/mooutils/mooeditops.c\
../moo/mooutils/moopaned.h\
../moo/mooutils/moohistorycombo.c\
../moo/mooutils/mooaction.h\
../moo/mooutils/mooaction-private.h\
../moo/mooutils/mooapp-ipc.c\
../moo/mooutils/mooprefsdialog.c\
../moo/mooutils/mooutils-gobject.c\
../moo/mooutils/mooutils.h\
../moo/mooutils/moobigpaned.h\
../moo/mooutils/mooprefs.h\
../moo/mooutils/mooaccelbutton.c\
../moo/mooutils/moocombo.h\
../moo/mooutils/mooactionfactory.c\
../moo/mooutils/mooactioncollection.c\
../moo/mooutils/moofontsel.h\
../moo/mooutils/stock-terminal-24.h\
../moo/mooutils/mooutils-tests.h\
../moo/mooutils/moomenumgr.h\
../moo/mooutils/mooutils-thread.c\
../moo/mooutils/moohistorylist.h\
../moo/mooutils/mooclosure.h\
../moo/mooutils/moonotebook.h\
../moo/mooutils/mooi18n.c\
../moo/mooutils/mooglade.c\
../moo/mooutils/moo-test-utils.h\
../moo/mooutils/moofilewriter.c\
../moo/mooutils/mooactiongroup.c\
../moo/mooutils/moomarkup.c\
../moo/plugins/usertools/exe/moocommand-exe.c\
../moo/plugins/usertools/exe/moocommand-exe.h\
../moo/plugins/usertools/moocommanddisplay.h\
../moo/plugins/usertools/moousertools-enums.h\
../moo/plugins/usertools/moousertools-prefs.c\
../moo/plugins/usertools/mookeyfile.h\
../moo/plugins/usertools/lua/moocommand-lua.h\
../moo/plugins/usertools/moocommand-private.h\
../moo/plugins/usertools/moousertools-prefs.h\
../moo/plugins/usertools/moousertools.h\
../moo/plugins/usertools/moousertools-enums.c\
../moo/plugins/usertools/moocommand.c\
../moo/plugins/usertools/moooutputfilterregex.h\
../moo/plugins/usertools/moousertools.c\
../moo/plugins/usertools/moooutputfilterregex.c\
../moo/plugins/usertools/moocommanddisplay.c\
../moo/plugins/usertools/mookeyfile.c\
../moo/plugins/usertools/moocommand.h\
../moo/plugins/support/moolineview.c\
../moo/plugins/support/moocmdview.c\
../moo/plugins/support/moooutputfilter.h\
../moo/plugins/support/mooeditwindowoutput.h\
../moo/plugins/support/moolineview.h\
../moo/plugins/support/moocmdview.h\
../moo/plugins/support/moooutputfilter.c\
../moo/plugins/support/mooeditwindowoutput.c

View File

@ -120,8 +120,17 @@ AC_ARG_ENABLE(install-hooks,
])
AM_CONDITIONAL(MOO_ENABLE_INSTALL_HOOKS, test "x$MOO_ENABLE_INSTALL_HOOKS" = "xyes")
AC_ARG_ENABLE(mdp,
AC_HELP_STRING([--enable-mdp],[enable fun stuff]),[
MOO_ENABLE_MDP="$enable_mdp"
],[
MOO_ENABLE_MDP="no"
])
AM_CONDITIONAL(MOO_ENABLE_MDP, test "x$MOO_ENABLE_MDP" = "xyes")
AC_CONFIG_FILES([
Makefile
api/Makefile
doc/Makefile
moo/Makefile
po/Makefile

View File

@ -547,6 +547,9 @@ get_top_window (MooEditor *editor)
}
/**
* moo_editor_get_ui_xml:
*/
MooUiXml *
moo_editor_get_ui_xml (MooEditor *editor)
{

View File

@ -2885,6 +2885,9 @@ moo_edit_window_add_pane_full (MooEditWindow *window,
return pane;
}
/**
* moo_edit_window_add_pane:
*/
MooPane *
moo_edit_window_add_pane (MooEditWindow *window,
const char *user_id,
@ -2897,6 +2900,9 @@ moo_edit_window_add_pane (MooEditWindow *window,
}
/**
* moo_edit_window_remove_pane:
*/
gboolean
moo_edit_window_remove_pane (MooEditWindow *window,
const char *user_id)
@ -2916,6 +2922,9 @@ moo_edit_window_remove_pane (MooEditWindow *window,
}
/**
* moo_edit_window_get_pane:
*/
GtkWidget*
moo_edit_window_get_pane (MooEditWindow *window,
const char *user_id)

View File

@ -10,6 +10,9 @@ MOO_DEFINE_BOXED_TYPE_C (MooFileEnc, moo_file_enc)
MOO_DEFINE_PTR_ARRAY (MooFileEncArray, moo_file_enc_array, MooFileEnc,
moo_file_enc_copy, moo_file_enc_free)
/**
* moo_file_enc_new: (constructor-of MooFileEnc)
**/
MooFileEnc *
moo_file_enc_new (GFile *file,
const char *encoding)

View File

@ -15,7 +15,7 @@
*/
/**
* class:MooLineMark: (parent GObject)
* class:MooLineMark: (parent GObject) (constructable)
**/
#define MOOEDIT_COMPILATION

View File

@ -25,6 +25,14 @@
* class:MooDocPlugin: (parent GObject)
**/
/**
* boxed:MooPluginInfo:
**/
/**
* boxed:MooPluginParams:
**/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@ -642,6 +650,57 @@ moo_doc_plugin_lookup (const char *plugin_id,
}
/**
* moo_win_plugin_get_window:
**/
MooEditWindow *
moo_win_plugin_get_window (MooWinPlugin *wplugin)
{
moo_return_val_if_fail (MOO_IS_WIN_PLUGIN (wplugin), NULL);
return wplugin->window;
}
/**
* moo_win_plugin_get_plugin:
**/
MooPlugin *
moo_win_plugin_get_plugin (MooWinPlugin *wplugin)
{
moo_return_val_if_fail (MOO_IS_WIN_PLUGIN (wplugin), NULL);
return wplugin->plugin;
}
/**
* moo_doc_plugin_get_window:
**/
MooEditWindow *
moo_doc_plugin_get_window (MooDocPlugin *dplugin)
{
moo_return_val_if_fail (MOO_IS_DOC_PLUGIN (dplugin), NULL);
return dplugin->window;
}
/**
* moo_doc_plugin_get_doc:
**/
MooEdit *
moo_doc_plugin_get_doc (MooDocPlugin *dplugin)
{
moo_return_val_if_fail (MOO_IS_DOC_PLUGIN (dplugin), NULL);
return dplugin->doc;
}
/**
* moo_doc_plugin_get_plugin:
**/
MooPlugin *
moo_doc_plugin_get_plugin (MooDocPlugin *dplugin)
{
moo_return_val_if_fail (MOO_IS_DOC_PLUGIN (dplugin), NULL);
return dplugin->plugin;
}
static gboolean
plugin_info_check (const MooPluginInfo *info)
{
@ -1002,6 +1061,9 @@ moo_plugin_visible (MooPlugin *plugin)
}
/**
* moo_plugin_set_info:
*/
void
moo_plugin_set_info (MooPlugin *plugin,
MooPluginInfo *info)
@ -1016,6 +1078,9 @@ moo_plugin_set_info (MooPlugin *plugin,
}
/**
* moo_plugin_set_doc_plugin_type:
*/
void
moo_plugin_set_doc_plugin_type (MooPlugin *plugin,
GType type)
@ -1026,6 +1091,9 @@ moo_plugin_set_doc_plugin_type (MooPlugin *plugin,
}
/**
* moo_plugin_set_win_plugin_type:
*/
void
moo_plugin_set_win_plugin_type (MooPlugin *plugin,
GType type)
@ -1036,6 +1104,9 @@ moo_plugin_set_win_plugin_type (MooPlugin *plugin,
}
/**
* moo_plugin_info_new: (constructor-of MooPluginInfo)
*/
MooPluginInfo *
moo_plugin_info_new (const char *name,
const char *description,
@ -1079,6 +1150,9 @@ moo_plugin_info_free (MooPluginInfo *info)
}
/**
* moo_plugin_params_new: (constructor-of MooPluginParams)
*/
MooPluginParams *
moo_plugin_params_new (gboolean enabled,
gboolean visible)

View File

@ -294,6 +294,11 @@ void moo_plugin_method_new_valist(const char *name,
guint n_params,
va_list args);
MooEditWindow *moo_win_plugin_get_window (MooWinPlugin *wplugin);
MooPlugin *moo_win_plugin_get_plugin (MooWinPlugin *wplugin);
MooEditWindow *moo_doc_plugin_get_window (MooDocPlugin *dplugin);
MooEdit *moo_doc_plugin_get_doc (MooDocPlugin *dplugin);
MooPlugin *moo_doc_plugin_get_plugin (MooDocPlugin *dplugin);
G_END_DECLS

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooTextView: (parent GtkTextView)
* class:MooTextView: (parent GtkTextView) (constructable)
**/
#define MOOEDIT_COMPILATION

View File

@ -192,14 +192,14 @@ class WinPlugin(moo.WinPlugin):
self.terminal.set_size(self.terminal.get_column_count(), 10)
self.terminal.set_size_request(10, 10)
self.pane = self.window.add_pane(TERMINAL_PLUGIN_ID, frame, label, moo.PANE_POS_BOTTOM)
self.pane = self.get_window().add_pane(TERMINAL_PLUGIN_ID, frame, label, moo.PANE_POS_BOTTOM)
self.terminal.connect('icon-title-changed', self.terminal_icon_title_changed)
self.terminal_icon_title_changed()
return True
def do_destroy(self):
self.window.remove_pane(TERMINAL_PLUGIN_ID)
self.get_window().remove_pane(TERMINAL_PLUGIN_ID)
def terminal_icon_title_changed(self, *whatever):
self.pane.set_frame_text(self.terminal.get_icon_title())

View File

@ -5,13 +5,19 @@ moo_python_sources += \
built_moo_python_sources += \
moopython/pygtk/moo-mod.h
if MOO_ENABLE_MDP
moo_defs = $(top_srcdir)/api/moo.defs
moo_defs_files = $(moo_defs)
else
moo_defs = $(srcdir)/moopython/pygtk/moo.defs
moo_defs_files = \
moopython/pygtk/mooedit.defs \
moopython/pygtk/mooapp.defs \
moopython/pygtk/mooutils.defs \
moopython/pygtk/moofileview.defs \
moopython/pygtk/moopaned.defs \
moopython/pygtk/moo.defs
$(moo_defs)
endif
moo_override_files = \
moopython/pygtk/mooutils.override \
@ -49,7 +55,7 @@ moopython/pygtk/moo-mod.c: $(moo_override_files) $(moo_defs_files) $(codegen_fil
--register $(PYGTK_DEFS_DIR)/gdk-types.defs \
--override $(srcdir)/moopython/pygtk/moo.override \
--outfilename moopython/pygtk/moo-mod.c \
$(srcdir)/moopython/pygtk/moo.defs > $@.tmp && \
$(moo_defs) > $@.tmp && \
mv $@.tmp $@
moopython/pygtk/moo-mod.h: moopython/pygtk/moo.py $(top_srcdir)/tools/xml2h.py

View File

@ -42,6 +42,7 @@ headers
#include "mooutils/moodialogs.h"
#include "mooutils/moofilewatch.h"
#include "mooutils/moomenuaction.h"
#include "mooutils/moomenutoolbutton.h"
#include "mooutils/moonotebook.h"
#include "mooutils/mooundo.h"
@ -58,6 +59,7 @@ headers
#include "mooedit/mooeditaction-factory.h"
#include "mooedit/mootextbuffer.h"
#include "mooedit/moolangmgr.h"
#include "mooedit/moofileenc.h"
#include "plugins/support/moocmdview.h"
#include "plugins/support/mooeditwindowoutput.h"
@ -91,9 +93,11 @@ import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
import gtk.Action as PyGtkAction_Type
import gtk.RadioAction as PyGtkRadioAction_Type
import gtk.ToggleAction as PyGtkToggleAction_Type
import gtk.ToggleToolButton as PyGtkToggleToolButton_Type
import gtk.Object as PyGtkObject_Type
import gtk.Container as PyGtkContainer_Type
import gtk.AccelGroup as PyGtkAccelGroup_Type
import gtk.Notebook as PyGtkNotebook_Type
import gio.File as PyGFile_Type
%%
ignore-glob

View File

@ -827,6 +827,12 @@
(return-type "none")
)
(define-method get_window
(of-object "MooWinPlugin")
(c-name "moo_win_plugin_get_window")
(return-type "MooEditWindow*")
)
;; MooDocPlugin
@ -2541,15 +2547,15 @@
)
(define-function _edit_class_add_action
(c-name "moo_edit_class_add_action")
(return-type "none")
)
(define-function edit_class_remove_action
(c-name "moo_edit_class_remove_action")
(return-type "none")
(parameters
'("const-char*" "id")
)
)
; (define-function _edit_class_add_action
; (c-name "moo_edit_class_add_action")
; (return-type "none")
; )
;
; (define-function edit_class_remove_action
; (c-name "moo_edit_class_remove_action")
; (return-type "none")
; (parameters
; '("const-char*" "id")
; )
; )

View File

@ -737,17 +737,17 @@
)
)
(define-method fill_widget
(of-object "MooGladeXML")
(c-name "moo_glade_xml_fill_widget")
(return-type "gboolean")
(parameters
'("GtkWidget*" "target")
'("const-char*" "buffer")
'("const-char*" "target_name")
'("GError**" "error")
)
)
; (define-method fill_widget
; (of-object "MooGladeXML")
; (c-name "moo_glade_xml_fill_widget")
; (return-type "gboolean")
; (parameters
; '("GtkWidget*" "target")
; '("const-char*" "buffer")
; '("const-char*" "target_name")
; '("GError**" "error")
; )
; )
(define-function glade_xml_new_from_file
(c-name "moo_glade_xml_new")
@ -1827,11 +1827,11 @@
;; From moo/mooutils/mooclosure.h
(define-function moo_closure_new
(c-name "moo_closure_new")
(is-constructor-of "MooClosure")
(return-type "MooClosure*")
)
; (define-function moo_closure_new
; (c-name "moo_closure_new")
; (is-constructor-of "MooClosure")
; (return-type "MooClosure*")
; )
(define-method invoke
(of-object "MooClosure")
@ -2315,16 +2315,16 @@
(return-type "strv")
)
(define-function file_dialog
(c-name "moo_file_dialog")
(return-type "const-char*")
(parameters
'("MooFileDialogType" "type")
'("GtkWidget*" "parent" (null-ok) (default "NULL"))
'("const-char*" "title" (null-ok) (default "NULL"))
'("const-char*" "start_dir" (null-ok) (default "NULL"))
)
)
; (define-function file_dialog
; (c-name "moo_file_dialog")
; (return-type "const-char*")
; (parameters
; '("MooFileDialogType" "type")
; '("GtkWidget*" "parent" (null-ok) (default "NULL"))
; '("const-char*" "title" (null-ok) (default "NULL"))
; '("const-char*" "start_dir" (null-ok) (default "NULL"))
; )
; )
(define-function file_dialogp
(c-name "moo_file_dialogp")

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooBigPaned: (parent GtkFrame)
* class:MooBigPaned: (parent GtkFrame) (constructable)
**/
#ifdef HAVE_CONFIG_H

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooCombo: (parent GtkTable)
* class:MooCombo: (parent GtkTable) (constructable)
**/
#include "marshals.h"

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooEntry: (parent GtkEntry)
* class:MooEntry: (parent GtkEntry) (constructable)
**/
#include "marshals.h"

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooFileDialog: (parent GObject)
* class:MooFileDialog: (parent GObject) (constructable)
**/
#include "config.h"

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooHistoryCombo: (parent MooCombo)
* class:MooHistoryCombo: (parent MooCombo) (constructable)
**/
#include "marshals.h"

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooHistoryList: (parent GObject)
* class:MooHistoryList: (parent GObject) (constructable)
**/
#include "marshals.h"

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooMenuMgr: (parent GObject)
* class:MooMenuMgr: (parent GObject) (constructable)
**/
#include "mooutils/moomenumgr.h"

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooNotebook: (parent GtkNotebook)
* class:MooNotebook: (parent GtkNotebook) (constructable)
**/
#ifdef HAVE_CONFIG_H

View File

@ -202,6 +202,9 @@ update_label_widgets (MooPane *pane)
set_pane_window_icon_and_title (pane);
}
/**
* moo_pane_set_label:
**/
void
moo_pane_set_label (MooPane *pane,
MooPaneLabel *label)
@ -221,6 +224,9 @@ moo_pane_set_label (MooPane *pane,
}
/**
* moo_pane_get_params:
**/
MooPaneParams *
moo_pane_get_params (MooPane *pane)
{
@ -228,6 +234,9 @@ moo_pane_get_params (MooPane *pane)
return moo_pane_params_copy (pane->params);
}
/**
* moo_pane_get_label:
**/
MooPaneLabel *
moo_pane_get_label (MooPane *pane)
{
@ -236,6 +245,9 @@ moo_pane_get_label (MooPane *pane)
}
/**
* moo_pane_set_params:
**/
void
moo_pane_set_params (MooPane *pane,
MooPaneParams *params)
@ -264,6 +276,9 @@ moo_pane_set_params (MooPane *pane,
}
/**
* moo_pane_set_detachable:
**/
void
moo_pane_set_detachable (MooPane *pane,
gboolean detachable)
@ -285,6 +300,9 @@ moo_pane_set_detachable (MooPane *pane,
}
/**
* moo_pane_set_removable:
**/
void
moo_pane_set_removable (MooPane *pane,
gboolean removable)
@ -303,6 +321,9 @@ moo_pane_set_removable (MooPane *pane,
}
/**
* moo_pane_get_detachable:
**/
gboolean
moo_pane_get_detachable (MooPane *pane)
{
@ -310,6 +331,9 @@ moo_pane_get_detachable (MooPane *pane)
return pane->detachable;
}
/**
* moo_pane_get_removable:
**/
gboolean
moo_pane_get_removable (MooPane *pane)
{
@ -543,6 +567,12 @@ update_sticky_button (MooPane *pane)
}
/**
* moo_pane_set_frame_markup:
*
* @pane:
* @markup: (allow-none):
**/
void
moo_pane_set_frame_markup (MooPane *pane,
const char *text)
@ -568,6 +598,12 @@ moo_pane_set_frame_markup (MooPane *pane,
gtk_label_set_markup (GTK_LABEL (pane->frame_label_window), text);
}
/**
* moo_pane_set_frame_text:
*
* @pane:
* @text: (allow-none):
**/
void
moo_pane_set_frame_text (MooPane *pane,
const char *text)
@ -928,6 +964,9 @@ setup_button_dnd (MooPane *pane)
G_CALLBACK (button_drag_leave), pane);
}
/**
* moo_pane_set_drag_dest:
**/
void
moo_pane_set_drag_dest (MooPane *pane)
{
@ -941,6 +980,9 @@ moo_pane_set_drag_dest (MooPane *pane)
setup_button_dnd (pane);
}
/**
* moo_pane_unset_drag_dest:
**/
void
moo_pane_unset_drag_dest (MooPane *pane)
{
@ -1026,6 +1068,9 @@ _moo_pane_new (GtkWidget *child,
return pane;
}
/**
* moo_pane_get_id:
**/
const char *
moo_pane_get_id (MooPane *pane)
{
@ -1137,6 +1182,9 @@ _moo_pane_get_window (MooPane *pane)
return pane->window;
}
/**
* moo_pane_get_child:
**/
GtkWidget *
moo_pane_get_child (MooPane *pane)
{
@ -1470,6 +1518,9 @@ _moo_pane_try_remove (MooPane *pane)
}
/**
* moo_pane_open:
**/
void
moo_pane_open (MooPane *pane)
{
@ -1478,6 +1529,9 @@ moo_pane_open (MooPane *pane)
moo_paned_open_pane (pane->parent, pane);
}
/**
* moo_pane_present:
**/
void
moo_pane_present (MooPane *pane)
{
@ -1486,6 +1540,9 @@ moo_pane_present (MooPane *pane)
moo_paned_present_pane (pane->parent, pane);
}
/**
* moo_pane_attach:
**/
void
moo_pane_attach (MooPane *pane)
{
@ -1494,6 +1551,9 @@ moo_pane_attach (MooPane *pane)
moo_paned_attach_pane (pane->parent, pane);
}
/**
* moo_pane_detach:
**/
void
moo_pane_detach (MooPane *pane)
{
@ -1503,6 +1563,9 @@ moo_pane_detach (MooPane *pane)
}
/**
* moo_pane_get_index:
**/
int
moo_pane_get_index (MooPane *pane)
{

View File

@ -14,7 +14,11 @@
*/
/**
* class:MooPaned: (parent GtkBin)
* class:MooPaned: (parent GtkBin) (constructable)
**/
/**
* boxed:MooPaneLabel:
**/
#ifdef HAVE_CONFIG_H
@ -3010,6 +3014,9 @@ moo_paned_is_open (MooPaned *paned)
}
/**
* enum:MooPanePosition
*/
GType
moo_pane_position_get_type (void)
{
@ -3214,6 +3221,14 @@ moo_paned_set_handle_cursor_type (MooPaned *paned,
}
/**
* moo_pane_label_new: (constructor-of MooPaneLabel)
*
* @icon_name: (allow-none) (default NULL):
* @icon_pixbuf: (allow-none) (default NULL):
* @label_text: (allow-none) (default NULL):
* @window_title: (allow-none) (default NULL):
*/
MooPaneLabel *
moo_pane_label_new (const char *icon_stock_id,
GdkPixbuf *pixbuf,

View File

@ -893,6 +893,12 @@ moo_prefs_save (const char *file_rc,
/* Helpers
*/
/**
* moo_prefs_new_key_bool:
*
* @key:
* @default_val: (default FALSE):
*/
void
moo_prefs_new_key_bool (const char *key,
gboolean default_val)
@ -909,6 +915,12 @@ moo_prefs_new_key_bool (const char *key,
}
/**
* moo_prefs_new_key_int:
*
* @key:
* @default_val: (default 0):
*/
void
moo_prefs_new_key_int (const char *key,
int default_val)
@ -949,6 +961,9 @@ moo_prefs_new_key_string (const char *key,
}
/**
* moo_prefs_get_string:
*/
const char *
moo_prefs_get_string (const char *key)
{
@ -961,6 +976,9 @@ moo_prefs_get_string (const char *key)
}
/**
* moo_prefs_get_filename:
*/
const char *
moo_prefs_get_filename (const char *key)
{
@ -987,6 +1005,11 @@ moo_prefs_get_filename (const char *key)
return val;
}
/**
* moo_prefs_get_file:
*
* Returns: (transfer full):
*/
GFile *
moo_prefs_get_file (const char *key)
{
@ -995,6 +1018,9 @@ moo_prefs_get_file (const char *key)
}
/**
* moo_prefs_get_bool:
*/
gboolean
moo_prefs_get_bool (const char *key)
{
@ -1011,6 +1037,9 @@ moo_prefs_get_bool (const char *key)
}
/**
* moo_prefs_get_int:
*/
int
moo_prefs_get_int (const char *key)
{
@ -1027,6 +1056,12 @@ moo_prefs_get_int (const char *key)
}
/**
* moo_prefs_set_string:
*
* @key:
* @val: (allow-none)
*/
void
moo_prefs_set_string (const char *key,
const char *val)
@ -1043,6 +1078,12 @@ moo_prefs_set_string (const char *key,
}
/**
* moo_prefs_set_filename:
*
* @key:
* @val: (allow-none)
*/
void
moo_prefs_set_filename (const char *key,
const char *val)
@ -1069,6 +1110,12 @@ moo_prefs_set_filename (const char *key,
g_free (utf8_val);
}
/**
* moo_prefs_set_file:
*
* @key:
* @val: (allow-none)
*/
void
moo_prefs_set_file (const char *key,
GFile *val)
@ -1089,6 +1136,9 @@ moo_prefs_set_file (const char *key,
}
/**
* moo_prefs_set_int:
*/
void
moo_prefs_set_int (const char *key,
int val)
@ -1104,6 +1154,9 @@ moo_prefs_set_int (const char *key,
}
/**
* moo_prefs_set_bool:
*/
void
moo_prefs_set_bool (const char *key,
gboolean val)

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooPrefsDialog: (parent GtkDialog)
* class:MooPrefsDialog: (parent GtkDialog) (constructable)
**/
#include "config.h"

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooPrefsPage: (parent GtkVBox)
* class:MooPrefsPage: (parent GtkVBox) (constructable)
**/
#include "mooutils/mooprefspage.h"

View File

@ -14,7 +14,7 @@
*/
/**
* class:MooUiXml: (parent GObject)
* class:MooUiXml: (parent GObject) (constructable)
**/
#include "mooutils/mooaction-private.h"
@ -844,6 +844,9 @@ xml_add_markup (MooUiXml *xml,
}
/**
* moo_ui_xml_new_merge_id:
*/
guint
moo_ui_xml_new_merge_id (MooUiXml *xml)
{

View File

@ -13,6 +13,10 @@
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* class:MooCmdView: (parent MooLineView) (constructable)
**/
#include "moocmdview.h"
#include "mooedit/mooeditwindow.h"
#include "marshals.h"

View File

@ -13,6 +13,10 @@
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* class:MooLineView: (parent MooTextView) (constructable)
**/
#include "moolineview.h"
#include "marshals.h"
#include "mooutils/mooutils-gobject.h"

View File

@ -18,7 +18,7 @@
**/
/**
* class:MooCommandContext: (parent GObject)
* class:MooCommandContext: (parent GObject) (constructable)
**/
/**