summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore34
-rw-r--r--AUTHORS1
-rw-r--r--COPYING340
-rw-r--r--ChangeLog0
-rw-r--r--INSTALL291
-rw-r--r--MAINTAINERS4
-rw-r--r--Makefile.am17
-rw-r--r--NEWS0
-rw-r--r--README0
-rwxr-xr-xautogen.sh18
-rw-r--r--configure.ac143
-rw-r--r--doc/Makefile.am16
-rw-r--r--libvaladoc/Makefile.am (renamed from src/libvaladoc/Makefile.am)0
-rw-r--r--libvaladoc/api/array.vala (renamed from src/libvaladoc/api/array.vala)0
-rw-r--r--libvaladoc/api/attribute.vala (renamed from src/libvaladoc/api/attribute.vala)0
-rw-r--r--libvaladoc/api/attributeargument.vala (renamed from src/libvaladoc/api/attributeargument.vala)0
-rw-r--r--libvaladoc/api/browsable.vala (renamed from src/libvaladoc/api/browsable.vala)0
-rw-r--r--libvaladoc/api/callable.vala (renamed from src/libvaladoc/api/callable.vala)0
-rw-r--r--libvaladoc/api/childsymbolregistrar.vala (renamed from src/libvaladoc/api/childsymbolregistrar.vala)0
-rw-r--r--libvaladoc/api/class.vala (renamed from src/libvaladoc/api/class.vala)0
-rw-r--r--libvaladoc/api/constant.vala (renamed from src/libvaladoc/api/constant.vala)0
-rw-r--r--libvaladoc/api/delegate.vala (renamed from src/libvaladoc/api/delegate.vala)0
-rw-r--r--libvaladoc/api/driver.vala (renamed from src/libvaladoc/api/driver.vala)0
-rw-r--r--libvaladoc/api/enum.vala (renamed from src/libvaladoc/api/enum.vala)0
-rw-r--r--libvaladoc/api/enumvalue.vala (renamed from src/libvaladoc/api/enumvalue.vala)0
-rw-r--r--libvaladoc/api/errorcode.vala (renamed from src/libvaladoc/api/errorcode.vala)0
-rw-r--r--libvaladoc/api/errordomain.vala (renamed from src/libvaladoc/api/errordomain.vala)0
-rw-r--r--libvaladoc/api/field.vala (renamed from src/libvaladoc/api/field.vala)0
-rw-r--r--libvaladoc/api/formalparameter.vala (renamed from src/libvaladoc/api/formalparameter.vala)0
-rw-r--r--libvaladoc/api/formalparametertype.vala (renamed from src/libvaladoc/api/formalparametertype.vala)0
-rw-r--r--libvaladoc/api/girsourcecomment.vala (renamed from src/libvaladoc/api/girsourcecomment.vala)0
-rw-r--r--libvaladoc/api/interface.vala (renamed from src/libvaladoc/api/interface.vala)0
-rw-r--r--libvaladoc/api/item.vala (renamed from src/libvaladoc/api/item.vala)0
-rw-r--r--libvaladoc/api/member.vala (renamed from src/libvaladoc/api/member.vala)0
-rw-r--r--libvaladoc/api/method.vala (renamed from src/libvaladoc/api/method.vala)0
-rw-r--r--libvaladoc/api/methodbindingtype.vala (renamed from src/libvaladoc/api/methodbindingtype.vala)0
-rw-r--r--libvaladoc/api/namespace.vala (renamed from src/libvaladoc/api/namespace.vala)0
-rw-r--r--libvaladoc/api/node.vala (renamed from src/libvaladoc/api/node.vala)0
-rw-r--r--libvaladoc/api/nodetype.vala (renamed from src/libvaladoc/api/nodetype.vala)0
-rw-r--r--libvaladoc/api/ownership.vala (renamed from src/libvaladoc/api/ownership.vala)0
-rw-r--r--libvaladoc/api/package.vala (renamed from src/libvaladoc/api/package.vala)0
-rw-r--r--libvaladoc/api/pointer.vala (renamed from src/libvaladoc/api/pointer.vala)0
-rw-r--r--libvaladoc/api/property.vala (renamed from src/libvaladoc/api/property.vala)0
-rw-r--r--libvaladoc/api/propertyaccessor.vala (renamed from src/libvaladoc/api/propertyaccessor.vala)0
-rw-r--r--libvaladoc/api/propertyaccessortype.vala (renamed from src/libvaladoc/api/propertyaccessortype.vala)0
-rw-r--r--libvaladoc/api/propertybindingtype.vala (renamed from src/libvaladoc/api/propertybindingtype.vala)0
-rw-r--r--libvaladoc/api/signal.vala (renamed from src/libvaladoc/api/signal.vala)0
-rw-r--r--libvaladoc/api/signaturebuilder.vala (renamed from src/libvaladoc/api/signaturebuilder.vala)0
-rw-r--r--libvaladoc/api/sourcecomment.vala (renamed from src/libvaladoc/api/sourcecomment.vala)0
-rw-r--r--libvaladoc/api/sourcefile.vala (renamed from src/libvaladoc/api/sourcefile.vala)0
-rw-r--r--libvaladoc/api/struct.vala (renamed from src/libvaladoc/api/struct.vala)0
-rw-r--r--libvaladoc/api/symbol.vala (renamed from src/libvaladoc/api/symbol.vala)0
-rw-r--r--libvaladoc/api/symbolaccessibility.vala (renamed from src/libvaladoc/api/symbolaccessibility.vala)0
-rw-r--r--libvaladoc/api/tree.vala (renamed from src/libvaladoc/api/tree.vala)0
-rw-r--r--libvaladoc/api/typeparameter.vala (renamed from src/libvaladoc/api/typeparameter.vala)0
-rw-r--r--libvaladoc/api/typereference.vala (renamed from src/libvaladoc/api/typereference.vala)0
-rw-r--r--libvaladoc/api/typesymbol.vala (renamed from src/libvaladoc/api/typesymbol.vala)0
-rw-r--r--libvaladoc/api/visitor.vala (renamed from src/libvaladoc/api/visitor.vala)0
-rw-r--r--libvaladoc/charts/chart.vala (renamed from src/libvaladoc/charts/chart.vala)0
-rw-r--r--libvaladoc/charts/chartfactory.vala (renamed from src/libvaladoc/charts/chartfactory.vala)0
-rw-r--r--libvaladoc/charts/hierarchychart.vala (renamed from src/libvaladoc/charts/hierarchychart.vala)0
-rw-r--r--libvaladoc/charts/simplechartfactory.vala (renamed from src/libvaladoc/charts/simplechartfactory.vala)0
-rw-r--r--libvaladoc/content/block.vala (renamed from src/libvaladoc/content/block.vala)0
-rw-r--r--libvaladoc/content/blockcontent.vala (renamed from src/libvaladoc/content/blockcontent.vala)0
-rw-r--r--libvaladoc/content/comment.vala (renamed from src/libvaladoc/content/comment.vala)0
-rw-r--r--libvaladoc/content/contentelement.vala (renamed from src/libvaladoc/content/contentelement.vala)0
-rw-r--r--libvaladoc/content/contentfactory.vala (renamed from src/libvaladoc/content/contentfactory.vala)0
-rw-r--r--libvaladoc/content/contentrenderer.vala (renamed from src/libvaladoc/content/contentrenderer.vala)0
-rw-r--r--libvaladoc/content/contentvisitor.vala (renamed from src/libvaladoc/content/contentvisitor.vala)0
-rw-r--r--libvaladoc/content/embedded.vala (renamed from src/libvaladoc/content/embedded.vala)0
-rw-r--r--libvaladoc/content/headline.vala (renamed from src/libvaladoc/content/headline.vala)0
-rw-r--r--libvaladoc/content/inline.vala (renamed from src/libvaladoc/content/inline.vala)0
-rw-r--r--libvaladoc/content/inlinecontent.vala (renamed from src/libvaladoc/content/inlinecontent.vala)0
-rw-r--r--libvaladoc/content/inlinetaglet.vala (renamed from src/libvaladoc/content/inlinetaglet.vala)0
-rw-r--r--libvaladoc/content/link.vala (renamed from src/libvaladoc/content/link.vala)0
-rw-r--r--libvaladoc/content/list.vala (renamed from src/libvaladoc/content/list.vala)0
-rw-r--r--libvaladoc/content/listitem.vala (renamed from src/libvaladoc/content/listitem.vala)0
-rw-r--r--libvaladoc/content/note.vala (renamed from src/libvaladoc/content/note.vala)0
-rw-r--r--libvaladoc/content/page.vala (renamed from src/libvaladoc/content/page.vala)0
-rw-r--r--libvaladoc/content/paragraph.vala (renamed from src/libvaladoc/content/paragraph.vala)0
-rw-r--r--libvaladoc/content/resourcelocator.vala (renamed from src/libvaladoc/content/resourcelocator.vala)0
-rw-r--r--libvaladoc/content/run.vala (renamed from src/libvaladoc/content/run.vala)0
-rw-r--r--libvaladoc/content/sourcecode.vala (renamed from src/libvaladoc/content/sourcecode.vala)0
-rw-r--r--libvaladoc/content/styleattributes.vala (renamed from src/libvaladoc/content/styleattributes.vala)0
-rw-r--r--libvaladoc/content/symbollink.vala (renamed from src/libvaladoc/content/symbollink.vala)0
-rw-r--r--libvaladoc/content/table.vala (renamed from src/libvaladoc/content/table.vala)0
-rw-r--r--libvaladoc/content/tablecell.vala (renamed from src/libvaladoc/content/tablecell.vala)0
-rw-r--r--libvaladoc/content/tablerow.vala (renamed from src/libvaladoc/content/tablerow.vala)0
-rw-r--r--libvaladoc/content/taglet.vala (renamed from src/libvaladoc/content/taglet.vala)0
-rw-r--r--libvaladoc/content/text.vala (renamed from src/libvaladoc/content/text.vala)0
-rw-r--r--libvaladoc/content/warning.vala (renamed from src/libvaladoc/content/warning.vala)0
-rw-r--r--libvaladoc/content/wikilink.vala (renamed from src/libvaladoc/content/wikilink.vala)0
-rw-r--r--libvaladoc/ctyperesolver.vala (renamed from src/libvaladoc/ctyperesolver.vala)0
-rw-r--r--libvaladoc/devhelp-markupwriter.vala (renamed from src/libvaladoc/devhelp-markupwriter.vala)0
-rw-r--r--libvaladoc/doclet.vala (renamed from src/libvaladoc/doclet.vala)0
-rw-r--r--libvaladoc/documentation/commentscanner.vala (renamed from src/libvaladoc/documentation/commentscanner.vala)0
-rw-r--r--libvaladoc/documentation/documentation.vala (renamed from src/libvaladoc/documentation/documentation.vala)0
-rw-r--r--libvaladoc/documentation/documentationparser.vala (renamed from src/libvaladoc/documentation/documentationparser.vala)0
-rw-r--r--libvaladoc/documentation/girmetadata.vala (renamed from src/libvaladoc/documentation/girmetadata.vala)0
-rw-r--r--libvaladoc/documentation/gtkdoccommentparser.vala (renamed from src/libvaladoc/documentation/gtkdoccommentparser.vala)0
-rw-r--r--libvaladoc/documentation/gtkdoccommentscanner.vala (renamed from src/libvaladoc/documentation/gtkdoccommentscanner.vala)0
-rw-r--r--libvaladoc/documentation/gtkdocmarkdownparser.vala (renamed from src/libvaladoc/documentation/gtkdocmarkdownparser.vala)0
-rw-r--r--libvaladoc/documentation/gtkdocmarkdownscanner.vala (renamed from src/libvaladoc/documentation/gtkdocmarkdownscanner.vala)0
-rw-r--r--libvaladoc/documentation/importerhelper.vala (renamed from src/libvaladoc/documentation/importerhelper.vala)0
-rw-r--r--libvaladoc/documentation/wiki.vala (renamed from src/libvaladoc/documentation/wiki.vala)0
-rw-r--r--libvaladoc/documentation/wikiscanner.vala (renamed from src/libvaladoc/documentation/wikiscanner.vala)0
-rw-r--r--libvaladoc/errorreporter.vala (renamed from src/libvaladoc/errorreporter.vala)0
-rw-r--r--libvaladoc/filehelper.vala (renamed from src/libvaladoc/filehelper.vala)0
-rw-r--r--libvaladoc/gtkdocmarkupwriter.vala (renamed from src/libvaladoc/gtkdocmarkupwriter.vala)0
-rw-r--r--libvaladoc/gtkdocrenderer.vala (renamed from src/libvaladoc/gtkdocrenderer.vala)0
-rw-r--r--libvaladoc/highlighter/codescanner.vala (renamed from src/libvaladoc/highlighter/codescanner.vala)0
-rw-r--r--libvaladoc/highlighter/codetoken.vala (renamed from src/libvaladoc/highlighter/codetoken.vala)0
-rw-r--r--libvaladoc/highlighter/highlighter.vala (renamed from src/libvaladoc/highlighter/highlighter.vala)0
-rw-r--r--libvaladoc/highlighter/scanner.vala (renamed from src/libvaladoc/highlighter/scanner.vala)0
-rw-r--r--libvaladoc/highlighter/xmlscanner.vala (renamed from src/libvaladoc/highlighter/xmlscanner.vala)0
-rw-r--r--libvaladoc/html/basicdoclet.vala (renamed from src/libvaladoc/html/basicdoclet.vala)0
-rw-r--r--libvaladoc/html/cssclassresolver.vala (renamed from src/libvaladoc/html/cssclassresolver.vala)0
-rw-r--r--libvaladoc/html/htmlchartfactory.vala (renamed from src/libvaladoc/html/htmlchartfactory.vala)0
-rw-r--r--libvaladoc/html/htmlmarkupwriter.vala (renamed from src/libvaladoc/html/htmlmarkupwriter.vala)0
-rw-r--r--libvaladoc/html/htmlrenderer.vala (renamed from src/libvaladoc/html/htmlrenderer.vala)0
-rw-r--r--libvaladoc/html/linkhelper.vala (renamed from src/libvaladoc/html/linkhelper.vala)0
-rw-r--r--libvaladoc/importer/documentationimporter.vala (renamed from src/libvaladoc/importer/documentationimporter.vala)0
-rw-r--r--libvaladoc/importer/girdocumentationimporter.vala (renamed from src/libvaladoc/importer/girdocumentationimporter.vala)0
-rw-r--r--libvaladoc/importer/internalidregistrar.vala (renamed from src/libvaladoc/importer/internalidregistrar.vala)0
-rw-r--r--libvaladoc/importer/valadocdocumentationimporter.vala (renamed from src/libvaladoc/importer/valadocdocumentationimporter.vala)0
-rw-r--r--libvaladoc/importer/valadocdocumentationimporterscanner.vala (renamed from src/libvaladoc/importer/valadocdocumentationimporterscanner.vala)0
-rw-r--r--libvaladoc/markupreader.vala (renamed from src/libvaladoc/markupreader.vala)0
-rw-r--r--libvaladoc/markupsourcelocation.vala (renamed from src/libvaladoc/markupsourcelocation.vala)0
-rw-r--r--libvaladoc/markuptokentype.vala (renamed from src/libvaladoc/markuptokentype.vala)0
-rw-r--r--libvaladoc/markupwriter.vala (renamed from src/libvaladoc/markupwriter.vala)0
-rw-r--r--libvaladoc/moduleloader.vala (renamed from src/libvaladoc/moduleloader.vala)0
-rw-r--r--libvaladoc/parser/manyrule.vala (renamed from src/libvaladoc/parser/manyrule.vala)0
-rw-r--r--libvaladoc/parser/oneofrule.vala (renamed from src/libvaladoc/parser/oneofrule.vala)0
-rw-r--r--libvaladoc/parser/optionalrule.vala (renamed from src/libvaladoc/parser/optionalrule.vala)0
-rw-r--r--libvaladoc/parser/parser.vala (renamed from src/libvaladoc/parser/parser.vala)0
-rw-r--r--libvaladoc/parser/parsercallback.vala (renamed from src/libvaladoc/parser/parsercallback.vala)0
-rw-r--r--libvaladoc/parser/rule.vala (renamed from src/libvaladoc/parser/rule.vala)0
-rw-r--r--libvaladoc/parser/scanner.vala (renamed from src/libvaladoc/parser/scanner.vala)0
-rw-r--r--libvaladoc/parser/sequencerule.vala (renamed from src/libvaladoc/parser/sequencerule.vala)0
-rw-r--r--libvaladoc/parser/sourcelocation.vala (renamed from src/libvaladoc/parser/sourcelocation.vala)0
-rw-r--r--libvaladoc/parser/stubrule.vala (renamed from src/libvaladoc/parser/stubrule.vala)0
-rw-r--r--libvaladoc/parser/token.vala (renamed from src/libvaladoc/parser/token.vala)0
-rw-r--r--libvaladoc/parser/tokentype.vala (renamed from src/libvaladoc/parser/tokentype.vala)0
-rw-r--r--libvaladoc/settings.vala (renamed from src/libvaladoc/settings.vala)0
-rw-r--r--libvaladoc/taglets/tagletdeprecated.vala (renamed from src/libvaladoc/taglets/tagletdeprecated.vala)0
-rw-r--r--libvaladoc/taglets/tagletinheritdoc.vala (renamed from src/libvaladoc/taglets/tagletinheritdoc.vala)0
-rw-r--r--libvaladoc/taglets/tagletinit.vala (renamed from src/libvaladoc/taglets/tagletinit.vala)0
-rw-r--r--libvaladoc/taglets/tagletlink.vala (renamed from src/libvaladoc/taglets/tagletlink.vala)0
-rw-r--r--libvaladoc/taglets/tagletparam.vala (renamed from src/libvaladoc/taglets/tagletparam.vala)0
-rw-r--r--libvaladoc/taglets/tagletreturn.vala (renamed from src/libvaladoc/taglets/tagletreturn.vala)0
-rw-r--r--libvaladoc/taglets/tagletsee.vala (renamed from src/libvaladoc/taglets/tagletsee.vala)0
-rw-r--r--libvaladoc/taglets/tagletsince.vala (renamed from src/libvaladoc/taglets/tagletsince.vala)0
-rw-r--r--libvaladoc/taglets/tagletthrows.vala (renamed from src/libvaladoc/taglets/tagletthrows.vala)0
-rw-r--r--libvaladoc/valadoc-1.0.deps.in (renamed from src/libvaladoc/valadoc-1.0.deps.in)0
-rw-r--r--libvaladoc/valadoc-1.0.pc.in (renamed from src/libvaladoc/valadoc-1.0.pc.in)0
-rw-r--r--src/Makefile.am14
-rw-r--r--src/driver/0.20.x/Makefile.am72
-rw-r--r--src/driver/0.20.x/driver.vala69
-rw-r--r--src/driver/0.20.x/treebuilder.vala1524
-rw-r--r--src/driver/0.22.x/Makefile.am72
-rw-r--r--src/driver/0.22.x/driver.vala69
-rw-r--r--src/driver/0.22.x/girwriter.vala204
-rw-r--r--src/driver/0.22.x/initializerbuilder.vala669
-rw-r--r--src/driver/0.22.x/symbolresolver.vala323
-rw-r--r--src/driver/0.22.x/treebuilder.vala1524
-rw-r--r--src/driver/0.24.x/Makefile.am72
-rw-r--r--src/driver/0.24.x/girwriter.vala204
-rw-r--r--src/driver/0.24.x/initializerbuilder.vala669
-rw-r--r--src/driver/0.24.x/symbolresolver.vala323
-rw-r--r--src/driver/0.24.x/treebuilder.vala1524
-rw-r--r--src/driver/0.26.x/Makefile.am72
-rw-r--r--src/driver/0.26.x/driver.vala70
-rw-r--r--src/driver/0.26.x/girwriter.vala204
-rw-r--r--src/driver/0.26.x/initializerbuilder.vala669
-rw-r--r--src/driver/0.26.x/symbolresolver.vala323
-rw-r--r--src/driver/0.26.x/treebuilder.vala1524
-rw-r--r--src/driver/0.28.x/Makefile.am72
-rw-r--r--src/driver/0.28.x/driver.vala70
-rw-r--r--src/driver/0.28.x/girwriter.vala204
-rw-r--r--src/driver/0.28.x/initializerbuilder.vala669
-rw-r--r--src/driver/0.28.x/symbolresolver.vala323
-rw-r--r--src/driver/0.28.x/treebuilder.vala1524
-rw-r--r--src/driver/0.30.x/Makefile.am72
-rw-r--r--src/driver/0.30.x/driver.vala70
-rw-r--r--src/driver/0.30.x/girwriter.vala204
-rw-r--r--src/driver/0.30.x/initializerbuilder.vala669
-rw-r--r--src/driver/0.30.x/symbolresolver.vala323
-rw-r--r--src/driver/0.30.x/treebuilder.vala1524
-rw-r--r--src/driver/0.32.x/Makefile.am72
-rw-r--r--src/driver/0.32.x/driver.vala70
-rw-r--r--src/driver/0.32.x/girwriter.vala204
-rw-r--r--src/driver/0.32.x/initializerbuilder.vala669
-rw-r--r--src/driver/0.32.x/symbolresolver.vala323
-rw-r--r--src/driver/0.32.x/treebuilder.vala1541
-rw-r--r--src/driver/0.34.x/Makefile.am72
-rw-r--r--src/driver/0.34.x/driver.vala70
-rw-r--r--src/driver/0.34.x/girwriter.vala204
-rw-r--r--src/driver/0.34.x/initializerbuilder.vala669
-rw-r--r--src/driver/0.34.x/symbolresolver.vala323
-rw-r--r--src/driver/0.34.x/treebuilder.vala1541
-rw-r--r--src/driver/0.36.x/Makefile.am72
-rw-r--r--src/driver/0.36.x/driver.vala70
-rw-r--r--src/driver/0.36.x/girwriter.vala204
-rw-r--r--src/driver/0.36.x/initializerbuilder.vala669
-rw-r--r--src/driver/0.36.x/symbolresolver.vala323
-rw-r--r--src/driver/Makefile.am51
-rw-r--r--src/vapi/config.vapi21
-rw-r--r--src/vapi/libgvc.vapi237
-rw-r--r--valadoc.doap36
-rw-r--r--valadoc/Makefile.am (renamed from src/valadoc/Makefile.am)0
-rw-r--r--valadoc/THANKS (renamed from THANKS)0
-rw-r--r--valadoc/doclets/Makefile.am (renamed from src/doclets/Makefile.am)0
-rw-r--r--valadoc/doclets/devhelp/Makefile.am (renamed from src/doclets/devhelp/Makefile.am)0
-rw-r--r--valadoc/doclets/devhelp/doclet.vala (renamed from src/doclets/devhelp/doclet.vala)0
-rw-r--r--valadoc/doclets/gtkdoc/Makefile.am (renamed from src/doclets/gtkdoc/Makefile.am)0
-rw-r--r--valadoc/doclets/gtkdoc/commentconverter.vala (renamed from src/doclets/gtkdoc/commentconverter.vala)0
-rw-r--r--valadoc/doclets/gtkdoc/dbus.vala (renamed from src/doclets/gtkdoc/dbus.vala)0
-rw-r--r--valadoc/doclets/gtkdoc/doclet.vala (renamed from src/doclets/gtkdoc/doclet.vala)0
-rw-r--r--valadoc/doclets/gtkdoc/gcomment.vala (renamed from src/doclets/gtkdoc/gcomment.vala)0
-rw-r--r--valadoc/doclets/gtkdoc/generator.vala (renamed from src/doclets/gtkdoc/generator.vala)0
-rw-r--r--valadoc/doclets/gtkdoc/utils.vala (renamed from src/doclets/gtkdoc/utils.vala)0
-rw-r--r--valadoc/doclets/html/Makefile.am (renamed from src/doclets/html/Makefile.am)0
-rw-r--r--valadoc/doclets/html/doclet.vala (renamed from src/doclets/html/doclet.vala)0
-rw-r--r--valadoc/driver.vala (renamed from src/driver/0.24.x/driver.vala)0
-rw-r--r--valadoc/girwriter.vala (renamed from src/driver/0.20.x/girwriter.vala)0
-rw-r--r--valadoc/icons/Makefile.am (renamed from icons/Makefile.am)0
-rw-r--r--valadoc/icons/abstractclass.png (renamed from icons/abstractclass.png)bin693 -> 693 bytes
-rw-r--r--valadoc/icons/abstractmethod.png (renamed from icons/abstractmethod.png)bin482 -> 482 bytes
-rw-r--r--valadoc/icons/abstractproperty.png (renamed from icons/abstractproperty.png)bin776 -> 776 bytes
-rw-r--r--valadoc/icons/class.png (renamed from icons/class.png)bin624 -> 624 bytes
-rw-r--r--valadoc/icons/coll_close.png (renamed from icons/coll_close.png)bin185 -> 185 bytes
-rw-r--r--valadoc/icons/coll_open.png (renamed from icons/coll_open.png)bin204 -> 204 bytes
-rw-r--r--valadoc/icons/constant.png (renamed from icons/constant.png)bin489 -> 489 bytes
-rw-r--r--valadoc/icons/constructor.png (renamed from icons/constructor.png)bin418 -> 418 bytes
-rw-r--r--valadoc/icons/delegate.png (renamed from icons/delegate.png)bin688 -> 688 bytes
-rw-r--r--valadoc/icons/devhelpstyle.css (renamed from icons/devhelpstyle.css)0
-rw-r--r--valadoc/icons/enum.png (renamed from icons/enum.png)bin634 -> 634 bytes
-rw-r--r--valadoc/icons/enumvalue.png (renamed from icons/enumvalue.png)bin2978 -> 2978 bytes
-rw-r--r--valadoc/icons/errorcode.png (renamed from icons/errorcode.png)bin340 -> 340 bytes
-rw-r--r--valadoc/icons/errordomain.png (renamed from icons/errordomain.png)bin668 -> 668 bytes
-rw-r--r--valadoc/icons/field.png (renamed from icons/field.png)bin560 -> 560 bytes
-rw-r--r--valadoc/icons/interface.png (renamed from icons/interface.png)bin544 -> 544 bytes
-rw-r--r--valadoc/icons/method.png (renamed from icons/method.png)bin559 -> 559 bytes
-rw-r--r--valadoc/icons/namespace.png (renamed from icons/namespace.png)bin390 -> 390 bytes
-rw-r--r--valadoc/icons/package.png (renamed from icons/package.png)bin633 -> 633 bytes
-rw-r--r--valadoc/icons/packages.png (renamed from icons/packages.png)bin618 -> 618 bytes
-rw-r--r--valadoc/icons/property.png (renamed from icons/property.png)bin884 -> 884 bytes
-rw-r--r--valadoc/icons/scripts.js (renamed from icons/scripts.js)0
-rw-r--r--valadoc/icons/signal.png (renamed from icons/signal.png)bin536 -> 536 bytes
-rw-r--r--valadoc/icons/staticmethod.png (renamed from icons/staticmethod.png)bin580 -> 580 bytes
-rw-r--r--valadoc/icons/struct.png (renamed from icons/struct.png)bin329 -> 329 bytes
-rw-r--r--valadoc/icons/style.css (renamed from icons/style.css)0
-rw-r--r--valadoc/icons/tip.png (renamed from icons/tip.png)bin766 -> 766 bytes
-rw-r--r--valadoc/icons/virtualmethod.png (renamed from icons/virtualmethod.png)bin608 -> 608 bytes
-rw-r--r--valadoc/icons/virtualproperty.png (renamed from icons/virtualproperty.png)bin765 -> 765 bytes
-rw-r--r--valadoc/icons/warning.png (renamed from icons/warning.png)bin2959 -> 2959 bytes
-rw-r--r--valadoc/icons/wikistyle.css (renamed from icons/wikistyle.css)0
-rw-r--r--valadoc/initializerbuilder.vala (renamed from src/driver/0.20.x/initializerbuilder.vala)0
-rw-r--r--valadoc/symbolresolver.vala (renamed from src/driver/0.20.x/symbolresolver.vala)0
-rw-r--r--valadoc/tests/Makefile.am (renamed from tests/Makefile.am)0
-rw-r--r--valadoc/tests/drivers/api-test.data.vapi (renamed from tests/drivers/api-test.data.vapi)0
-rw-r--r--valadoc/tests/drivers/driver-0-20.vala (renamed from tests/drivers/driver-0-20.vala)0
-rw-r--r--valadoc/tests/drivers/driver-0-22.vala (renamed from tests/drivers/driver-0-22.vala)0
-rw-r--r--valadoc/tests/drivers/driver-0-24.vala (renamed from tests/drivers/driver-0-24.vala)0
-rw-r--r--valadoc/tests/drivers/driver-0-26.vala (renamed from tests/drivers/driver-0-26.vala)0
-rw-r--r--valadoc/tests/drivers/driver-0-28.vala (renamed from tests/drivers/driver-0-28.vala)0
-rw-r--r--valadoc/tests/drivers/driver-0-30.vala (renamed from tests/drivers/driver-0-30.vala)0
-rw-r--r--valadoc/tests/drivers/driver-0-32.vala (renamed from tests/drivers/driver-0-32.vala)0
-rw-r--r--valadoc/tests/drivers/driver-0-34.vala (renamed from tests/drivers/driver-0-34.vala)0
-rw-r--r--valadoc/tests/drivers/driver-0-36.vala (renamed from tests/drivers/driver-0-36.vala)0
-rw-r--r--valadoc/tests/drivers/generic-api-test.vala (renamed from tests/drivers/generic-api-test.vala)0
-rw-r--r--valadoc/tests/libvaladoc/errorreporter.vala (renamed from tests/libvaladoc/errorreporter.vala)0
-rw-r--r--valadoc/tests/libvaladoc/gtkdoc-scanner.vala (renamed from tests/libvaladoc/gtkdoc-scanner.vala)0
-rw-r--r--valadoc/tests/libvaladoc/markupreader.vala (renamed from tests/libvaladoc/markupreader.vala)0
-rw-r--r--valadoc/tests/libvaladoc/parser/generic-scanner.vala (renamed from tests/libvaladoc/parser/generic-scanner.vala)0
-rw-r--r--valadoc/tests/libvaladoc/parser/manyrule.vala (renamed from tests/libvaladoc/parser/manyrule.vala)0
-rw-r--r--valadoc/tests/libvaladoc/parser/oneofrule.vala (renamed from tests/libvaladoc/parser/oneofrule.vala)0
-rw-r--r--valadoc/tests/libvaladoc/parser/optionalrule.vala (renamed from tests/libvaladoc/parser/optionalrule.vala)0
-rw-r--r--valadoc/tests/libvaladoc/parser/sequencerule.vala (renamed from tests/libvaladoc/parser/sequencerule.vala)0
-rw-r--r--valadoc/tests/libvaladoc/parser/stubrule.vala (renamed from tests/libvaladoc/parser/stubrule.vala)0
-rwxr-xr-xvaladoc/tests/testrunner.sh (renamed from tests/testrunner.sh)0
-rw-r--r--valadoc/treebuilder.vala (renamed from src/driver/0.36.x/treebuilder.vala)0
-rw-r--r--valadoc/valadoc.vala (renamed from src/valadoc/valadoc.vala)0
283 files changed, 0 insertions, 24223 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index b31f516bf..000000000
--- a/.gitignore
+++ /dev/null
@@ -1,34 +0,0 @@
-Makefile.in
-Makefile
-*~
-*.o
-*.lo
-*.la
-*.c
-*.h
-*.stamp
-*.gir
-*.vapi
-*.deps
-.deps
-.libs
-.dirstamp
-
-config.*
-aclocal.m4
-autom4te.cache
-build-aux
-ChangeLog
-configure
-depcomp
-libtool
-install-sh
-m4
-missing
-ltmain.sh
-ylwrap
-compile
-stamp-h1
-*.pc
-
-src/valadoc/valadoc
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 00dc670ea..000000000
--- a/AUTHORS
+++ /dev/null
@@ -1 +0,0 @@
-Florian Brosch <flo.brosch@gmail.com>
diff --git a/COPYING b/COPYING
deleted file mode 100644
index 08ddefd04..000000000
--- a/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
-
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index e69de29bb..000000000
--- a/ChangeLog
+++ /dev/null
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 8b82ade08..000000000
--- a/INSTALL
+++ /dev/null
@@ -1,291 +0,0 @@
-Installation Instructions
-*************************
-
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008 Free Software Foundation, Inc.
-
- This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
-
-Basic Installation
-==================
-
- Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package. The following
-more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
-
- It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
- The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system.
-
- Running `configure' might take a while. While running, it prints
- some messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
- 6. Often, you can also type `make uninstall' to remove the installed
- files again.
-
-Compilers and Options
-=====================
-
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. Run `./configure --help'
-for details on some of the pertinent environment variables.
-
- You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment. Here
-is an example:
-
- ./configure CC=c99 CFLAGS=-g LIBS=-lposix
-
- *Note Defining Variables::, for more details.
-
-Compiling For Multiple Architectures
-====================================
-
- You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you can use GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- With a non-GNU `make', it is safer to compile the package for one
-architecture at a time in the source code directory. After you have
-installed the package for one architecture, use `make distclean' before
-reconfiguring for another architecture.
-
- On MacOS X 10.5 and later systems, you can create libraries and
-executables that work on multiple system types--known as "fat" or
-"universal" binaries--by specifying multiple `-arch' options to the
-compiler but only a single `-arch' option to the preprocessor. Like
-this:
-
- ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
- CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
- CPP="gcc -E" CXXCPP="g++ -E"
-
- This is not guaranteed to produce working output in all cases, you
-may have to build one architecture at a time and combine the results
-using the `lipo' tool if you have problems.
-
-Installation Names
-==================
-
- By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc. You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
-PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Particular systems
-==================
-
- On HP-UX, the default C compiler is not ANSI C compatible. If GNU
-CC is not installed, it is recommended to use the following options in
-order to use an ANSI C compiler:
-
- ./configure CC="cc -Ae"
-
-and if that doesn't work, install pre-built binaries of GCC for HP-UX.
-
- On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
-parse its `<wchar.h>' header file. The option `-nodtk' can be used as
-a workaround. If GNU CC is not installed, it is therefore recommended
-to try
-
- ./configure CC="cc"
-
-and if that doesn't work, try
-
- ./configure CC="cc -nodtk"
-
-Specifying the System Type
-==========================
-
- There may be some features `configure' cannot figure out
-automatically, but needs to determine by the type of machine the package
-will run on. Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
-a message saying it cannot guess the machine type, give it the
-`--build=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
-
- CPU-COMPANY-SYSTEM
-
-where SYSTEM can have one of these forms:
-
- OS KERNEL-OS
-
- See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the machine type.
-
- If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
-produce code for.
-
- If you want to _use_ a cross compiler, that generates code for a
-platform different from the build platform, you should specify the
-"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
-
-Sharing Defaults
-================
-
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Defining Variables
-==================
-
- Variables not defined in a site shell script can be set in the
-environment passed to `configure'. However, some packages may run
-configure again during the build, and the customized values of these
-variables may be lost. In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'. For example:
-
- ./configure CC=/usr/local2/bin/gcc
-
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).
-
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug. Until the bug is fixed you can use this workaround:
-
- CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-`configure' Invocation
-======================
-
- `configure' recognizes the following options to control how it
-operates.
-
-`--help'
-`-h'
- Print a summary of all of the options to `configure', and exit.
-
-`--help=short'
-`--help=recursive'
- Print a summary of the options unique to this package's
- `configure', and exit. The `short' variant lists options used
- only in the top level, while the `recursive' variant lists options
- also present in any nested packages.
-
-`--version'
-`-V'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`--cache-file=FILE'
- Enable the cache: use and save the results of the tests in FILE,
- traditionally `config.cache'. FILE defaults to `/dev/null' to
- disable caching.
-
-`--config-cache'
-`-C'
- Alias for `--cache-file=config.cache'.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`--prefix=DIR'
- Use DIR as the installation prefix. *Note Installation Names::
- for more details, including other options available for fine-tuning
- the installation locations.
-
-`--no-create'
-`-n'
- Run the configure checks, but stop before creating any output
- files.
-
-`configure' also accepts some other, not widely useful, options. Run
-`configure --help' for more details.
-
diff --git a/MAINTAINERS b/MAINTAINERS
deleted file mode 100644
index 53f5dc2ee..000000000
--- a/MAINTAINERS
+++ /dev/null
@@ -1,4 +0,0 @@
-Florian Brosch
-E-mail: flo.brosch@gmail.com
-Userid: flobrosch
-
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 0c214ce72..000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-# Makefile.am
-
-NULL =
-
-ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-
-SUBDIRS = src \
- tests \
- icons \
- doc \
- $(NULL)
-
-
-.PHONY: test
-test:
- cd tests && $(MAKE) $(AM_MAKEFLAGS) check
-
diff --git a/NEWS b/NEWS
deleted file mode 100644
index e69de29bb..000000000
--- a/NEWS
+++ /dev/null
diff --git a/README b/README
deleted file mode 100644
index e69de29bb..000000000
--- a/README
+++ /dev/null
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 944efd33b..000000000
--- a/autogen.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-test -n "$srcdir" || srcdir=`dirname "$0"`
-test -n "$srcdir" || srcdir=.
-
-olddir=`pwd`
-cd $srcdir
-
-AUTORECONF=`which autoreconf`
-if test -z $AUTORECONF; then
- echo "*** No autoreconf found, please install it ***"
- exit 1
-fi
-
-autoreconf --force --install --verbose
-
-cd $olddir
-test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index ceeba4062..000000000
--- a/configure.ac
+++ /dev/null
@@ -1,143 +0,0 @@
-dnl configure.in
-AC_PREREQ([2.65])
-AC_INIT([valadoc],[0.36.0],
- [https://bugzilla.gnome.org/browse.cgi?product=valadoc],
- [valadoc],
- [https://wiki.gnome.org/Projects/Valadoc])
-
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_SRCDIR([Makefile.am])
-AC_CONFIG_HEADERS(config.h)
-AC_CONFIG_SRCDIR([configure.ac])
-AM_INIT_AUTOMAKE([1.11 foreign tar-ustar dist-xz no-dist-gzip subdir-objects])
-
-AM_MAINTAINER_MODE([enable])
-
-AC_PROG_CC
-AC_PROG_INSTALL
-LT_INIT([disable-static])
-PKG_PROG_PKG_CONFIG([0.21])
-
-AC_CHECK_PROG([HELP2MAN], [help2man], [help2man])
-AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN = xhelp2man])
-
-##
-## Settings:
-##
-
-VALA_REQUIRED=0.19.0
-LIBGEE_REQUIRED=0.19.91
-LIBGVC_REQUIRED=2.16
-GLIB_REQUIRED=2.24.0
-LIBGDKPIXBUF_REQUIRED=2.0
-
-
-
-##
-## Dependencies:
-##
-
-AC_SUBST(VALAFLAGS)
-AM_PROG_VALAC([$VALA_REQUIRED])
-
-PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
-
-PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
-
-PKG_CHECK_MODULES(GMODULE, gmodule-2.0 >= $GLIB_REQUIRED)
-
-PKG_CHECK_MODULES(LIBGEE, gee-0.8 >= $LIBGEE_REQUIRED)
-
-
-AC_MSG_CHECKING([for CGRAPH])
-valadoc_tmp_LIBADD="$LIBADD"
-valadoc_tmp_CFLAGS="$CFLAGS"
-LIBADD="$LIBADD $LIBGVC_LIBS"
-CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
-AC_RUN_IFELSE(
- [AC_LANG_SOURCE([
- #include <gvc.h>
-
- int main(void) {
- #ifdef WITH_CGRAPH
- return 0;
- #else
- return -1;
- #endif
- }
- ])], [
- AC_MSG_RESULT([yes])
- VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
- have_cgraph=yes
- ], [
- AC_MSG_RESULT([no])
- have_cgraph=no
- ]
-)
-LIBADD="$valadoc_tmp_LIBADD"
-CFLAGS="$valadoc_tmp_CFLAGS"
-AM_CONDITIONAL(HAVE_CGRAPH, test "$have_cgraph" = "yes")
-
-
-##
-## Drivers:
-##
-
-PKG_CHECK_MODULES(LIBVALA_0_36_X, libvala-0.36 > 0.35.0, have_libvala_0_36_x="yes", have_libvala_0_36_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_36_X, test "$have_libvala_0_36_x" = "yes")
-
-PKG_CHECK_MODULES(LIBVALA_0_34_X, libvala-0.34 > 0.33.0, have_libvala_0_34_x="yes", have_libvala_0_34_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_34_X, test "$have_libvala_0_34_x" = "yes")
-
-PKG_CHECK_MODULES(LIBVALA_0_32_X, libvala-0.32 > 0.31.0, have_libvala_0_32_x="yes", have_libvala_0_32_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_32_X, test "$have_libvala_0_32_x" = "yes")
-
-PKG_CHECK_MODULES(LIBVALA_0_30_X, libvala-0.30 > 0.29.0, have_libvala_0_30_x="yes", have_libvala_0_30_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_30_X, test "$have_libvala_0_30_x" = "yes")
-
-PKG_CHECK_MODULES(LIBVALA_0_28_X, libvala-0.28 > 0.27.0, have_libvala_0_28_x="yes", have_libvala_0_28_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_28_X, test "$have_libvala_0_28_x" = "yes")
-
-PKG_CHECK_MODULES(LIBVALA_0_26_X, libvala-0.26 > 0.25.2, have_libvala_0_26_x="yes", have_libvala_0_26_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_26_X, test "$have_libvala_0_26_x" = "yes")
-
-PKG_CHECK_MODULES(LIBVALA_0_24_X, libvala-0.24 > 0.23.1, have_libvala_0_24_x="yes", have_libvala_0_24_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_24_X, test "$have_libvala_0_24_x" = "yes")
-
-PKG_CHECK_MODULES(LIBVALA_0_22_X, libvala-0.22 >= 0.21.0, have_libvala_0_22_x="yes", have_libvala_0_22_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_22_X, test "$have_libvala_0_22_x" = "yes")
-
-PKG_CHECK_MODULES(LIBVALA_0_20_X, libvala-0.20 >= 0.19.0, have_libvala_0_20_x="yes", have_libvala_0_20_x="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_20_X, test "$have_libvala_0_20_x" = "yes")
-
-
-AC_CONFIG_FILES([
-Makefile
-src/libvaladoc/valadoc-1.0.pc
-src/libvaladoc/valadoc-1.0.deps
-src/Makefile
-icons/Makefile
-doc/Makefile
-src/libvaladoc/Makefile
-src/driver/Makefile
-src/driver/0.20.x/Makefile
-src/driver/0.22.x/Makefile
-src/driver/0.24.x/Makefile
-src/driver/0.26.x/Makefile
-src/driver/0.28.x/Makefile
-src/driver/0.30.x/Makefile
-src/driver/0.32.x/Makefile
-src/driver/0.34.x/Makefile
-src/driver/0.36.x/Makefile
-src/doclets/Makefile
-src/doclets/html/Makefile
-src/doclets/devhelp/Makefile
-src/doclets/gtkdoc/Makefile
-src/valadoc/Makefile
-tests/Makefile
-])
-
-AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
deleted file mode 100644
index 2ae874a5a..000000000
--- a/doc/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-dist_man_MANS = valadoc.1
-
-EXTRA_DIST = valadoc.h2m
-
-if HAVE_HELP2MAN
-manpages: valadoc.1
- @rm $^
- $(MAKE) $(AM_MAKEFLAGS) $^
-
-valadoc.1:
- $(HELP2MAN) $(top_builddir)/src/valadoc/valadoc \
- --include $(srcdir)/valadoc.h2m \
- --libtool --no-info \
- --output=$@
-endif
-
diff --git a/src/libvaladoc/Makefile.am b/libvaladoc/Makefile.am
index a53b08892..a53b08892 100644
--- a/src/libvaladoc/Makefile.am
+++ b/libvaladoc/Makefile.am
diff --git a/src/libvaladoc/api/array.vala b/libvaladoc/api/array.vala
index cfbd64291..cfbd64291 100644
--- a/src/libvaladoc/api/array.vala
+++ b/libvaladoc/api/array.vala
diff --git a/src/libvaladoc/api/attribute.vala b/libvaladoc/api/attribute.vala
index 04fac9b18..04fac9b18 100644
--- a/src/libvaladoc/api/attribute.vala
+++ b/libvaladoc/api/attribute.vala
diff --git a/src/libvaladoc/api/attributeargument.vala b/libvaladoc/api/attributeargument.vala
index 7bcd0c6d8..7bcd0c6d8 100644
--- a/src/libvaladoc/api/attributeargument.vala
+++ b/libvaladoc/api/attributeargument.vala
diff --git a/src/libvaladoc/api/browsable.vala b/libvaladoc/api/browsable.vala
index 498ba0dd8..498ba0dd8 100644
--- a/src/libvaladoc/api/browsable.vala
+++ b/libvaladoc/api/browsable.vala
diff --git a/src/libvaladoc/api/callable.vala b/libvaladoc/api/callable.vala
index 60515ee1b..60515ee1b 100644
--- a/src/libvaladoc/api/callable.vala
+++ b/libvaladoc/api/callable.vala
diff --git a/src/libvaladoc/api/childsymbolregistrar.vala b/libvaladoc/api/childsymbolregistrar.vala
index e044327b0..e044327b0 100644
--- a/src/libvaladoc/api/childsymbolregistrar.vala
+++ b/libvaladoc/api/childsymbolregistrar.vala
diff --git a/src/libvaladoc/api/class.vala b/libvaladoc/api/class.vala
index 8d792a75a..8d792a75a 100644
--- a/src/libvaladoc/api/class.vala
+++ b/libvaladoc/api/class.vala
diff --git a/src/libvaladoc/api/constant.vala b/libvaladoc/api/constant.vala
index 351584be4..351584be4 100644
--- a/src/libvaladoc/api/constant.vala
+++ b/libvaladoc/api/constant.vala
diff --git a/src/libvaladoc/api/delegate.vala b/libvaladoc/api/delegate.vala
index cd7e7c552..cd7e7c552 100644
--- a/src/libvaladoc/api/delegate.vala
+++ b/libvaladoc/api/delegate.vala
diff --git a/src/libvaladoc/api/driver.vala b/libvaladoc/api/driver.vala
index a43abcff0..a43abcff0 100644
--- a/src/libvaladoc/api/driver.vala
+++ b/libvaladoc/api/driver.vala
diff --git a/src/libvaladoc/api/enum.vala b/libvaladoc/api/enum.vala
index 230c0bb64..230c0bb64 100644
--- a/src/libvaladoc/api/enum.vala
+++ b/libvaladoc/api/enum.vala
diff --git a/src/libvaladoc/api/enumvalue.vala b/libvaladoc/api/enumvalue.vala
index 34804ff55..34804ff55 100644
--- a/src/libvaladoc/api/enumvalue.vala
+++ b/libvaladoc/api/enumvalue.vala
diff --git a/src/libvaladoc/api/errorcode.vala b/libvaladoc/api/errorcode.vala
index d7cf55128..d7cf55128 100644
--- a/src/libvaladoc/api/errorcode.vala
+++ b/libvaladoc/api/errorcode.vala
diff --git a/src/libvaladoc/api/errordomain.vala b/libvaladoc/api/errordomain.vala
index 969f294a3..969f294a3 100644
--- a/src/libvaladoc/api/errordomain.vala
+++ b/libvaladoc/api/errordomain.vala
diff --git a/src/libvaladoc/api/field.vala b/libvaladoc/api/field.vala
index a167c35b8..a167c35b8 100644
--- a/src/libvaladoc/api/field.vala
+++ b/libvaladoc/api/field.vala
diff --git a/src/libvaladoc/api/formalparameter.vala b/libvaladoc/api/formalparameter.vala
index 82ed872a2..82ed872a2 100644
--- a/src/libvaladoc/api/formalparameter.vala
+++ b/libvaladoc/api/formalparameter.vala
diff --git a/src/libvaladoc/api/formalparametertype.vala b/libvaladoc/api/formalparametertype.vala
index d95cc0f5f..d95cc0f5f 100644
--- a/src/libvaladoc/api/formalparametertype.vala
+++ b/libvaladoc/api/formalparametertype.vala
diff --git a/src/libvaladoc/api/girsourcecomment.vala b/libvaladoc/api/girsourcecomment.vala
index c935ba39e..c935ba39e 100644
--- a/src/libvaladoc/api/girsourcecomment.vala
+++ b/libvaladoc/api/girsourcecomment.vala
diff --git a/src/libvaladoc/api/interface.vala b/libvaladoc/api/interface.vala
index c75846ed8..c75846ed8 100644
--- a/src/libvaladoc/api/interface.vala
+++ b/libvaladoc/api/interface.vala
diff --git a/src/libvaladoc/api/item.vala b/libvaladoc/api/item.vala
index 63b994736..63b994736 100644
--- a/src/libvaladoc/api/item.vala
+++ b/libvaladoc/api/item.vala
diff --git a/src/libvaladoc/api/member.vala b/libvaladoc/api/member.vala
index b8271c37b..b8271c37b 100644
--- a/src/libvaladoc/api/member.vala
+++ b/libvaladoc/api/member.vala
diff --git a/src/libvaladoc/api/method.vala b/libvaladoc/api/method.vala
index ce891e112..ce891e112 100644
--- a/src/libvaladoc/api/method.vala
+++ b/libvaladoc/api/method.vala
diff --git a/src/libvaladoc/api/methodbindingtype.vala b/libvaladoc/api/methodbindingtype.vala
index c340c30b6..c340c30b6 100644
--- a/src/libvaladoc/api/methodbindingtype.vala
+++ b/libvaladoc/api/methodbindingtype.vala
diff --git a/src/libvaladoc/api/namespace.vala b/libvaladoc/api/namespace.vala
index c2cba30d4..c2cba30d4 100644
--- a/src/libvaladoc/api/namespace.vala
+++ b/libvaladoc/api/namespace.vala
diff --git a/src/libvaladoc/api/node.vala b/libvaladoc/api/node.vala
index 580828ff6..580828ff6 100644
--- a/src/libvaladoc/api/node.vala
+++ b/libvaladoc/api/node.vala
diff --git a/src/libvaladoc/api/nodetype.vala b/libvaladoc/api/nodetype.vala
index 1fbc22e66..1fbc22e66 100644
--- a/src/libvaladoc/api/nodetype.vala
+++ b/libvaladoc/api/nodetype.vala
diff --git a/src/libvaladoc/api/ownership.vala b/libvaladoc/api/ownership.vala
index eb4f5b0fc..eb4f5b0fc 100644
--- a/src/libvaladoc/api/ownership.vala
+++ b/libvaladoc/api/ownership.vala
diff --git a/src/libvaladoc/api/package.vala b/libvaladoc/api/package.vala
index 8c2cad184..8c2cad184 100644
--- a/src/libvaladoc/api/package.vala
+++ b/libvaladoc/api/package.vala
diff --git a/src/libvaladoc/api/pointer.vala b/libvaladoc/api/pointer.vala
index aec541bb8..aec541bb8 100644
--- a/src/libvaladoc/api/pointer.vala
+++ b/libvaladoc/api/pointer.vala
diff --git a/src/libvaladoc/api/property.vala b/libvaladoc/api/property.vala
index 556c7c9bf..556c7c9bf 100644
--- a/src/libvaladoc/api/property.vala
+++ b/libvaladoc/api/property.vala
diff --git a/src/libvaladoc/api/propertyaccessor.vala b/libvaladoc/api/propertyaccessor.vala
index 0a79dd3fc..0a79dd3fc 100644
--- a/src/libvaladoc/api/propertyaccessor.vala
+++ b/libvaladoc/api/propertyaccessor.vala
diff --git a/src/libvaladoc/api/propertyaccessortype.vala b/libvaladoc/api/propertyaccessortype.vala
index 609815ae0..609815ae0 100644
--- a/src/libvaladoc/api/propertyaccessortype.vala
+++ b/libvaladoc/api/propertyaccessortype.vala
diff --git a/src/libvaladoc/api/propertybindingtype.vala b/libvaladoc/api/propertybindingtype.vala
index a8ce1617b..a8ce1617b 100644
--- a/src/libvaladoc/api/propertybindingtype.vala
+++ b/libvaladoc/api/propertybindingtype.vala
diff --git a/src/libvaladoc/api/signal.vala b/libvaladoc/api/signal.vala
index 4bbbb2320..4bbbb2320 100644
--- a/src/libvaladoc/api/signal.vala
+++ b/libvaladoc/api/signal.vala
diff --git a/src/libvaladoc/api/signaturebuilder.vala b/libvaladoc/api/signaturebuilder.vala
index 158bd6e41..158bd6e41 100644
--- a/src/libvaladoc/api/signaturebuilder.vala
+++ b/libvaladoc/api/signaturebuilder.vala
diff --git a/src/libvaladoc/api/sourcecomment.vala b/libvaladoc/api/sourcecomment.vala
index df6d1e1da..df6d1e1da 100644
--- a/src/libvaladoc/api/sourcecomment.vala
+++ b/libvaladoc/api/sourcecomment.vala
diff --git a/src/libvaladoc/api/sourcefile.vala b/libvaladoc/api/sourcefile.vala
index 46d1801be..46d1801be 100644
--- a/src/libvaladoc/api/sourcefile.vala
+++ b/libvaladoc/api/sourcefile.vala
diff --git a/src/libvaladoc/api/struct.vala b/libvaladoc/api/struct.vala
index e1df479c3..e1df479c3 100644
--- a/src/libvaladoc/api/struct.vala
+++ b/libvaladoc/api/struct.vala
diff --git a/src/libvaladoc/api/symbol.vala b/libvaladoc/api/symbol.vala
index aec2bdd75..aec2bdd75 100644
--- a/src/libvaladoc/api/symbol.vala
+++ b/libvaladoc/api/symbol.vala
diff --git a/src/libvaladoc/api/symbolaccessibility.vala b/libvaladoc/api/symbolaccessibility.vala
index 9b78aa671..9b78aa671 100644
--- a/src/libvaladoc/api/symbolaccessibility.vala
+++ b/libvaladoc/api/symbolaccessibility.vala
diff --git a/src/libvaladoc/api/tree.vala b/libvaladoc/api/tree.vala
index a5ae3c54b..a5ae3c54b 100644
--- a/src/libvaladoc/api/tree.vala
+++ b/libvaladoc/api/tree.vala
diff --git a/src/libvaladoc/api/typeparameter.vala b/libvaladoc/api/typeparameter.vala
index b5f33b860..b5f33b860 100644
--- a/src/libvaladoc/api/typeparameter.vala
+++ b/libvaladoc/api/typeparameter.vala
diff --git a/src/libvaladoc/api/typereference.vala b/libvaladoc/api/typereference.vala
index 0d5bffc1f..0d5bffc1f 100644
--- a/src/libvaladoc/api/typereference.vala
+++ b/libvaladoc/api/typereference.vala
diff --git a/src/libvaladoc/api/typesymbol.vala b/libvaladoc/api/typesymbol.vala
index 3574688e6..3574688e6 100644
--- a/src/libvaladoc/api/typesymbol.vala
+++ b/libvaladoc/api/typesymbol.vala
diff --git a/src/libvaladoc/api/visitor.vala b/libvaladoc/api/visitor.vala
index bf66a456b..bf66a456b 100644
--- a/src/libvaladoc/api/visitor.vala
+++ b/libvaladoc/api/visitor.vala
diff --git a/src/libvaladoc/charts/chart.vala b/libvaladoc/charts/chart.vala
index a6307d7ff..a6307d7ff 100644
--- a/src/libvaladoc/charts/chart.vala
+++ b/libvaladoc/charts/chart.vala
diff --git a/src/libvaladoc/charts/chartfactory.vala b/libvaladoc/charts/chartfactory.vala
index c2582ab9f..c2582ab9f 100644
--- a/src/libvaladoc/charts/chartfactory.vala
+++ b/libvaladoc/charts/chartfactory.vala
diff --git a/src/libvaladoc/charts/hierarchychart.vala b/libvaladoc/charts/hierarchychart.vala
index ce3613488..ce3613488 100644
--- a/src/libvaladoc/charts/hierarchychart.vala
+++ b/libvaladoc/charts/hierarchychart.vala
diff --git a/src/libvaladoc/charts/simplechartfactory.vala b/libvaladoc/charts/simplechartfactory.vala
index 06da97e13..06da97e13 100644
--- a/src/libvaladoc/charts/simplechartfactory.vala
+++ b/libvaladoc/charts/simplechartfactory.vala
diff --git a/src/libvaladoc/content/block.vala b/libvaladoc/content/block.vala
index 99273aee1..99273aee1 100644
--- a/src/libvaladoc/content/block.vala
+++ b/libvaladoc/content/block.vala
diff --git a/src/libvaladoc/content/blockcontent.vala b/libvaladoc/content/blockcontent.vala
index 47e99a217..47e99a217 100644
--- a/src/libvaladoc/content/blockcontent.vala
+++ b/libvaladoc/content/blockcontent.vala
diff --git a/src/libvaladoc/content/comment.vala b/libvaladoc/content/comment.vala
index f4ba4a09f..f4ba4a09f 100644
--- a/src/libvaladoc/content/comment.vala
+++ b/libvaladoc/content/comment.vala
diff --git a/src/libvaladoc/content/contentelement.vala b/libvaladoc/content/contentelement.vala
index 6e2c65934..6e2c65934 100644
--- a/src/libvaladoc/content/contentelement.vala
+++ b/libvaladoc/content/contentelement.vala
diff --git a/src/libvaladoc/content/contentfactory.vala b/libvaladoc/content/contentfactory.vala
index dda8a8763..dda8a8763 100644
--- a/src/libvaladoc/content/contentfactory.vala
+++ b/libvaladoc/content/contentfactory.vala
diff --git a/src/libvaladoc/content/contentrenderer.vala b/libvaladoc/content/contentrenderer.vala
index 153e35deb..153e35deb 100644
--- a/src/libvaladoc/content/contentrenderer.vala
+++ b/libvaladoc/content/contentrenderer.vala
diff --git a/src/libvaladoc/content/contentvisitor.vala b/libvaladoc/content/contentvisitor.vala
index d1b14c453..d1b14c453 100644
--- a/src/libvaladoc/content/contentvisitor.vala
+++ b/libvaladoc/content/contentvisitor.vala
diff --git a/src/libvaladoc/content/embedded.vala b/libvaladoc/content/embedded.vala
index b1d7d9525..b1d7d9525 100644
--- a/src/libvaladoc/content/embedded.vala
+++ b/libvaladoc/content/embedded.vala
diff --git a/src/libvaladoc/content/headline.vala b/libvaladoc/content/headline.vala
index 56a4a443e..56a4a443e 100644
--- a/src/libvaladoc/content/headline.vala
+++ b/libvaladoc/content/headline.vala
diff --git a/src/libvaladoc/content/inline.vala b/libvaladoc/content/inline.vala
index 3a6af7564..3a6af7564 100644
--- a/src/libvaladoc/content/inline.vala
+++ b/libvaladoc/content/inline.vala
diff --git a/src/libvaladoc/content/inlinecontent.vala b/libvaladoc/content/inlinecontent.vala
index f67ee4e1a..f67ee4e1a 100644
--- a/src/libvaladoc/content/inlinecontent.vala
+++ b/libvaladoc/content/inlinecontent.vala
diff --git a/src/libvaladoc/content/inlinetaglet.vala b/libvaladoc/content/inlinetaglet.vala
index 812eab39a..812eab39a 100644
--- a/src/libvaladoc/content/inlinetaglet.vala
+++ b/libvaladoc/content/inlinetaglet.vala
diff --git a/src/libvaladoc/content/link.vala b/libvaladoc/content/link.vala
index ba641e7e5..ba641e7e5 100644
--- a/src/libvaladoc/content/link.vala
+++ b/libvaladoc/content/link.vala
diff --git a/src/libvaladoc/content/list.vala b/libvaladoc/content/list.vala
index b23452648..b23452648 100644
--- a/src/libvaladoc/content/list.vala
+++ b/libvaladoc/content/list.vala
diff --git a/src/libvaladoc/content/listitem.vala b/libvaladoc/content/listitem.vala
index 299ce4e4e..299ce4e4e 100644
--- a/src/libvaladoc/content/listitem.vala
+++ b/libvaladoc/content/listitem.vala
diff --git a/src/libvaladoc/content/note.vala b/libvaladoc/content/note.vala
index d35347e05..d35347e05 100644
--- a/src/libvaladoc/content/note.vala
+++ b/libvaladoc/content/note.vala
diff --git a/src/libvaladoc/content/page.vala b/libvaladoc/content/page.vala
index f180be84f..f180be84f 100644
--- a/src/libvaladoc/content/page.vala
+++ b/libvaladoc/content/page.vala
diff --git a/src/libvaladoc/content/paragraph.vala b/libvaladoc/content/paragraph.vala
index 6d474b940..6d474b940 100644
--- a/src/libvaladoc/content/paragraph.vala
+++ b/libvaladoc/content/paragraph.vala
diff --git a/src/libvaladoc/content/resourcelocator.vala b/libvaladoc/content/resourcelocator.vala
index beffdfd0e..beffdfd0e 100644
--- a/src/libvaladoc/content/resourcelocator.vala
+++ b/libvaladoc/content/resourcelocator.vala
diff --git a/src/libvaladoc/content/run.vala b/libvaladoc/content/run.vala
index 01eace6b2..01eace6b2 100644
--- a/src/libvaladoc/content/run.vala
+++ b/libvaladoc/content/run.vala
diff --git a/src/libvaladoc/content/sourcecode.vala b/libvaladoc/content/sourcecode.vala
index 31803f026..31803f026 100644
--- a/src/libvaladoc/content/sourcecode.vala
+++ b/libvaladoc/content/sourcecode.vala
diff --git a/src/libvaladoc/content/styleattributes.vala b/libvaladoc/content/styleattributes.vala
index c24893aaf..c24893aaf 100644
--- a/src/libvaladoc/content/styleattributes.vala
+++ b/libvaladoc/content/styleattributes.vala
diff --git a/src/libvaladoc/content/symbollink.vala b/libvaladoc/content/symbollink.vala
index 70e528495..70e528495 100644
--- a/src/libvaladoc/content/symbollink.vala
+++ b/libvaladoc/content/symbollink.vala
diff --git a/src/libvaladoc/content/table.vala b/libvaladoc/content/table.vala
index 0a7941a04..0a7941a04 100644
--- a/src/libvaladoc/content/table.vala
+++ b/libvaladoc/content/table.vala
diff --git a/src/libvaladoc/content/tablecell.vala b/libvaladoc/content/tablecell.vala
index 50c7fd4ba..50c7fd4ba 100644
--- a/src/libvaladoc/content/tablecell.vala
+++ b/libvaladoc/content/tablecell.vala
diff --git a/src/libvaladoc/content/tablerow.vala b/libvaladoc/content/tablerow.vala
index d8759caac..d8759caac 100644
--- a/src/libvaladoc/content/tablerow.vala
+++ b/libvaladoc/content/tablerow.vala
diff --git a/src/libvaladoc/content/taglet.vala b/libvaladoc/content/taglet.vala
index c492621a1..c492621a1 100644
--- a/src/libvaladoc/content/taglet.vala
+++ b/libvaladoc/content/taglet.vala
diff --git a/src/libvaladoc/content/text.vala b/libvaladoc/content/text.vala
index 42ce1e15f..42ce1e15f 100644
--- a/src/libvaladoc/content/text.vala
+++ b/libvaladoc/content/text.vala
diff --git a/src/libvaladoc/content/warning.vala b/libvaladoc/content/warning.vala
index 445a447f8..445a447f8 100644
--- a/src/libvaladoc/content/warning.vala
+++ b/libvaladoc/content/warning.vala
diff --git a/src/libvaladoc/content/wikilink.vala b/libvaladoc/content/wikilink.vala
index 1c180316b..1c180316b 100644
--- a/src/libvaladoc/content/wikilink.vala
+++ b/libvaladoc/content/wikilink.vala
diff --git a/src/libvaladoc/ctyperesolver.vala b/libvaladoc/ctyperesolver.vala
index 6901d960e..6901d960e 100644
--- a/src/libvaladoc/ctyperesolver.vala
+++ b/libvaladoc/ctyperesolver.vala
diff --git a/src/libvaladoc/devhelp-markupwriter.vala b/libvaladoc/devhelp-markupwriter.vala
index ae524384c..ae524384c 100644
--- a/src/libvaladoc/devhelp-markupwriter.vala
+++ b/libvaladoc/devhelp-markupwriter.vala
diff --git a/src/libvaladoc/doclet.vala b/libvaladoc/doclet.vala
index c8c580444..c8c580444 100644
--- a/src/libvaladoc/doclet.vala
+++ b/libvaladoc/doclet.vala
diff --git a/src/libvaladoc/documentation/commentscanner.vala b/libvaladoc/documentation/commentscanner.vala
index ad0160167..ad0160167 100644
--- a/src/libvaladoc/documentation/commentscanner.vala
+++ b/libvaladoc/documentation/commentscanner.vala
diff --git a/src/libvaladoc/documentation/documentation.vala b/libvaladoc/documentation/documentation.vala
index 6df57eaa4..6df57eaa4 100644
--- a/src/libvaladoc/documentation/documentation.vala
+++ b/libvaladoc/documentation/documentation.vala
diff --git a/src/libvaladoc/documentation/documentationparser.vala b/libvaladoc/documentation/documentationparser.vala
index fe6d68505..fe6d68505 100644
--- a/src/libvaladoc/documentation/documentationparser.vala
+++ b/libvaladoc/documentation/documentationparser.vala
diff --git a/src/libvaladoc/documentation/girmetadata.vala b/libvaladoc/documentation/girmetadata.vala
index 2dbae65e4..2dbae65e4 100644
--- a/src/libvaladoc/documentation/girmetadata.vala
+++ b/libvaladoc/documentation/girmetadata.vala
diff --git a/src/libvaladoc/documentation/gtkdoccommentparser.vala b/libvaladoc/documentation/gtkdoccommentparser.vala
index 81dc52a8f..81dc52a8f 100644
--- a/src/libvaladoc/documentation/gtkdoccommentparser.vala
+++ b/libvaladoc/documentation/gtkdoccommentparser.vala
diff --git a/src/libvaladoc/documentation/gtkdoccommentscanner.vala b/libvaladoc/documentation/gtkdoccommentscanner.vala
index 75f2d58ed..75f2d58ed 100644
--- a/src/libvaladoc/documentation/gtkdoccommentscanner.vala
+++ b/libvaladoc/documentation/gtkdoccommentscanner.vala
diff --git a/src/libvaladoc/documentation/gtkdocmarkdownparser.vala b/libvaladoc/documentation/gtkdocmarkdownparser.vala
index ff52e9542..ff52e9542 100644
--- a/src/libvaladoc/documentation/gtkdocmarkdownparser.vala
+++ b/libvaladoc/documentation/gtkdocmarkdownparser.vala
diff --git a/src/libvaladoc/documentation/gtkdocmarkdownscanner.vala b/libvaladoc/documentation/gtkdocmarkdownscanner.vala
index 1908957d6..1908957d6 100644
--- a/src/libvaladoc/documentation/gtkdocmarkdownscanner.vala
+++ b/libvaladoc/documentation/gtkdocmarkdownscanner.vala
diff --git a/src/libvaladoc/documentation/importerhelper.vala b/libvaladoc/documentation/importerhelper.vala
index 3f7501836..3f7501836 100644
--- a/src/libvaladoc/documentation/importerhelper.vala
+++ b/libvaladoc/documentation/importerhelper.vala
diff --git a/src/libvaladoc/documentation/wiki.vala b/libvaladoc/documentation/wiki.vala
index 0f8f4929e..0f8f4929e 100644
--- a/src/libvaladoc/documentation/wiki.vala
+++ b/libvaladoc/documentation/wiki.vala
diff --git a/src/libvaladoc/documentation/wikiscanner.vala b/libvaladoc/documentation/wikiscanner.vala
index 81f6ae8e2..81f6ae8e2 100644
--- a/src/libvaladoc/documentation/wikiscanner.vala
+++ b/libvaladoc/documentation/wikiscanner.vala
diff --git a/src/libvaladoc/errorreporter.vala b/libvaladoc/errorreporter.vala
index 5b9543e62..5b9543e62 100644
--- a/src/libvaladoc/errorreporter.vala
+++ b/libvaladoc/errorreporter.vala
diff --git a/src/libvaladoc/filehelper.vala b/libvaladoc/filehelper.vala
index bc2369b36..bc2369b36 100644
--- a/src/libvaladoc/filehelper.vala
+++ b/libvaladoc/filehelper.vala
diff --git a/src/libvaladoc/gtkdocmarkupwriter.vala b/libvaladoc/gtkdocmarkupwriter.vala
index 1e7276789..1e7276789 100644
--- a/src/libvaladoc/gtkdocmarkupwriter.vala
+++ b/libvaladoc/gtkdocmarkupwriter.vala
diff --git a/src/libvaladoc/gtkdocrenderer.vala b/libvaladoc/gtkdocrenderer.vala
index 877d7c5c9..877d7c5c9 100644
--- a/src/libvaladoc/gtkdocrenderer.vala
+++ b/libvaladoc/gtkdocrenderer.vala
diff --git a/src/libvaladoc/highlighter/codescanner.vala b/libvaladoc/highlighter/codescanner.vala
index 8b15ee755..8b15ee755 100644
--- a/src/libvaladoc/highlighter/codescanner.vala
+++ b/libvaladoc/highlighter/codescanner.vala
diff --git a/src/libvaladoc/highlighter/codetoken.vala b/libvaladoc/highlighter/codetoken.vala
index 1a02195ea..1a02195ea 100644
--- a/src/libvaladoc/highlighter/codetoken.vala
+++ b/libvaladoc/highlighter/codetoken.vala
diff --git a/src/libvaladoc/highlighter/highlighter.vala b/libvaladoc/highlighter/highlighter.vala
index 3c2578033..3c2578033 100644
--- a/src/libvaladoc/highlighter/highlighter.vala
+++ b/libvaladoc/highlighter/highlighter.vala
diff --git a/src/libvaladoc/highlighter/scanner.vala b/libvaladoc/highlighter/scanner.vala
index 20eedcfb2..20eedcfb2 100644
--- a/src/libvaladoc/highlighter/scanner.vala
+++ b/libvaladoc/highlighter/scanner.vala
diff --git a/src/libvaladoc/highlighter/xmlscanner.vala b/libvaladoc/highlighter/xmlscanner.vala
index 38b87c5ee..38b87c5ee 100644
--- a/src/libvaladoc/highlighter/xmlscanner.vala
+++ b/libvaladoc/highlighter/xmlscanner.vala
diff --git a/src/libvaladoc/html/basicdoclet.vala b/libvaladoc/html/basicdoclet.vala
index 8e51234a2..8e51234a2 100644
--- a/src/libvaladoc/html/basicdoclet.vala
+++ b/libvaladoc/html/basicdoclet.vala
diff --git a/src/libvaladoc/html/cssclassresolver.vala b/libvaladoc/html/cssclassresolver.vala
index e8961aeeb..e8961aeeb 100644
--- a/src/libvaladoc/html/cssclassresolver.vala
+++ b/libvaladoc/html/cssclassresolver.vala
diff --git a/src/libvaladoc/html/htmlchartfactory.vala b/libvaladoc/html/htmlchartfactory.vala
index 1b63b4e13..1b63b4e13 100644
--- a/src/libvaladoc/html/htmlchartfactory.vala
+++ b/libvaladoc/html/htmlchartfactory.vala
diff --git a/src/libvaladoc/html/htmlmarkupwriter.vala b/libvaladoc/html/htmlmarkupwriter.vala
index 15ed9efd1..15ed9efd1 100644
--- a/src/libvaladoc/html/htmlmarkupwriter.vala
+++ b/libvaladoc/html/htmlmarkupwriter.vala
diff --git a/src/libvaladoc/html/htmlrenderer.vala b/libvaladoc/html/htmlrenderer.vala
index bdd78a09d..bdd78a09d 100644
--- a/src/libvaladoc/html/htmlrenderer.vala
+++ b/libvaladoc/html/htmlrenderer.vala
diff --git a/src/libvaladoc/html/linkhelper.vala b/libvaladoc/html/linkhelper.vala
index 0f990bb43..0f990bb43 100644
--- a/src/libvaladoc/html/linkhelper.vala
+++ b/libvaladoc/html/linkhelper.vala
diff --git a/src/libvaladoc/importer/documentationimporter.vala b/libvaladoc/importer/documentationimporter.vala
index 1a0f0bab5..1a0f0bab5 100644
--- a/src/libvaladoc/importer/documentationimporter.vala
+++ b/libvaladoc/importer/documentationimporter.vala
diff --git a/src/libvaladoc/importer/girdocumentationimporter.vala b/libvaladoc/importer/girdocumentationimporter.vala
index 3228dbec1..3228dbec1 100644
--- a/src/libvaladoc/importer/girdocumentationimporter.vala
+++ b/libvaladoc/importer/girdocumentationimporter.vala
diff --git a/src/libvaladoc/importer/internalidregistrar.vala b/libvaladoc/importer/internalidregistrar.vala
index a9ece0117..a9ece0117 100644
--- a/src/libvaladoc/importer/internalidregistrar.vala
+++ b/libvaladoc/importer/internalidregistrar.vala
diff --git a/src/libvaladoc/importer/valadocdocumentationimporter.vala b/libvaladoc/importer/valadocdocumentationimporter.vala
index b74b430f6..b74b430f6 100644
--- a/src/libvaladoc/importer/valadocdocumentationimporter.vala
+++ b/libvaladoc/importer/valadocdocumentationimporter.vala
diff --git a/src/libvaladoc/importer/valadocdocumentationimporterscanner.vala b/libvaladoc/importer/valadocdocumentationimporterscanner.vala
index 5c4a4428d..5c4a4428d 100644
--- a/src/libvaladoc/importer/valadocdocumentationimporterscanner.vala
+++ b/libvaladoc/importer/valadocdocumentationimporterscanner.vala
diff --git a/src/libvaladoc/markupreader.vala b/libvaladoc/markupreader.vala
index 9f24177e4..9f24177e4 100644
--- a/src/libvaladoc/markupreader.vala
+++ b/libvaladoc/markupreader.vala
diff --git a/src/libvaladoc/markupsourcelocation.vala b/libvaladoc/markupsourcelocation.vala
index af7dff1b2..af7dff1b2 100644
--- a/src/libvaladoc/markupsourcelocation.vala
+++ b/libvaladoc/markupsourcelocation.vala
diff --git a/src/libvaladoc/markuptokentype.vala b/libvaladoc/markuptokentype.vala
index d2dcad74f..d2dcad74f 100644
--- a/src/libvaladoc/markuptokentype.vala
+++ b/libvaladoc/markuptokentype.vala
diff --git a/src/libvaladoc/markupwriter.vala b/libvaladoc/markupwriter.vala
index 28a61ffe7..28a61ffe7 100644
--- a/src/libvaladoc/markupwriter.vala
+++ b/libvaladoc/markupwriter.vala
diff --git a/src/libvaladoc/moduleloader.vala b/libvaladoc/moduleloader.vala
index 911be76f7..911be76f7 100644
--- a/src/libvaladoc/moduleloader.vala
+++ b/libvaladoc/moduleloader.vala
diff --git a/src/libvaladoc/parser/manyrule.vala b/libvaladoc/parser/manyrule.vala
index 093223ac9..093223ac9 100644
--- a/src/libvaladoc/parser/manyrule.vala
+++ b/libvaladoc/parser/manyrule.vala
diff --git a/src/libvaladoc/parser/oneofrule.vala b/libvaladoc/parser/oneofrule.vala
index 946335233..946335233 100644
--- a/src/libvaladoc/parser/oneofrule.vala
+++ b/libvaladoc/parser/oneofrule.vala
diff --git a/src/libvaladoc/parser/optionalrule.vala b/libvaladoc/parser/optionalrule.vala
index 6945afa38..6945afa38 100644
--- a/src/libvaladoc/parser/optionalrule.vala
+++ b/libvaladoc/parser/optionalrule.vala
diff --git a/src/libvaladoc/parser/parser.vala b/libvaladoc/parser/parser.vala
index bf3a59889..bf3a59889 100644
--- a/src/libvaladoc/parser/parser.vala
+++ b/libvaladoc/parser/parser.vala
diff --git a/src/libvaladoc/parser/parsercallback.vala b/libvaladoc/parser/parsercallback.vala
index c6fef181f..c6fef181f 100644
--- a/src/libvaladoc/parser/parsercallback.vala
+++ b/libvaladoc/parser/parsercallback.vala
diff --git a/src/libvaladoc/parser/rule.vala b/libvaladoc/parser/rule.vala
index 7ecbc3563..7ecbc3563 100644
--- a/src/libvaladoc/parser/rule.vala
+++ b/libvaladoc/parser/rule.vala
diff --git a/src/libvaladoc/parser/scanner.vala b/libvaladoc/parser/scanner.vala
index 86acd23af..86acd23af 100644
--- a/src/libvaladoc/parser/scanner.vala
+++ b/libvaladoc/parser/scanner.vala
diff --git a/src/libvaladoc/parser/sequencerule.vala b/libvaladoc/parser/sequencerule.vala
index f14cf070d..f14cf070d 100644
--- a/src/libvaladoc/parser/sequencerule.vala
+++ b/libvaladoc/parser/sequencerule.vala
diff --git a/src/libvaladoc/parser/sourcelocation.vala b/libvaladoc/parser/sourcelocation.vala
index 51b5bc1f9..51b5bc1f9 100644
--- a/src/libvaladoc/parser/sourcelocation.vala
+++ b/libvaladoc/parser/sourcelocation.vala
diff --git a/src/libvaladoc/parser/stubrule.vala b/libvaladoc/parser/stubrule.vala
index 0f6f97930..0f6f97930 100644
--- a/src/libvaladoc/parser/stubrule.vala
+++ b/libvaladoc/parser/stubrule.vala
diff --git a/src/libvaladoc/parser/token.vala b/libvaladoc/parser/token.vala
index 6cbff5ed1..6cbff5ed1 100644
--- a/src/libvaladoc/parser/token.vala
+++ b/libvaladoc/parser/token.vala
diff --git a/src/libvaladoc/parser/tokentype.vala b/libvaladoc/parser/tokentype.vala
index 3cad35ea7..3cad35ea7 100644
--- a/src/libvaladoc/parser/tokentype.vala
+++ b/libvaladoc/parser/tokentype.vala
diff --git a/src/libvaladoc/settings.vala b/libvaladoc/settings.vala
index 823dd5b20..823dd5b20 100644
--- a/src/libvaladoc/settings.vala
+++ b/libvaladoc/settings.vala
diff --git a/src/libvaladoc/taglets/tagletdeprecated.vala b/libvaladoc/taglets/tagletdeprecated.vala
index c77457935..c77457935 100644
--- a/src/libvaladoc/taglets/tagletdeprecated.vala
+++ b/libvaladoc/taglets/tagletdeprecated.vala
diff --git a/src/libvaladoc/taglets/tagletinheritdoc.vala b/libvaladoc/taglets/tagletinheritdoc.vala
index d8b288545..d8b288545 100644
--- a/src/libvaladoc/taglets/tagletinheritdoc.vala
+++ b/libvaladoc/taglets/tagletinheritdoc.vala
diff --git a/src/libvaladoc/taglets/tagletinit.vala b/libvaladoc/taglets/tagletinit.vala
index 7e88126aa..7e88126aa 100644
--- a/src/libvaladoc/taglets/tagletinit.vala
+++ b/libvaladoc/taglets/tagletinit.vala
diff --git a/src/libvaladoc/taglets/tagletlink.vala b/libvaladoc/taglets/tagletlink.vala
index b489a5898..b489a5898 100644
--- a/src/libvaladoc/taglets/tagletlink.vala
+++ b/libvaladoc/taglets/tagletlink.vala
diff --git a/src/libvaladoc/taglets/tagletparam.vala b/libvaladoc/taglets/tagletparam.vala
index 651a9ed3f..651a9ed3f 100644
--- a/src/libvaladoc/taglets/tagletparam.vala
+++ b/libvaladoc/taglets/tagletparam.vala
diff --git a/src/libvaladoc/taglets/tagletreturn.vala b/libvaladoc/taglets/tagletreturn.vala
index ef3e4ecf4..ef3e4ecf4 100644
--- a/src/libvaladoc/taglets/tagletreturn.vala
+++ b/libvaladoc/taglets/tagletreturn.vala
diff --git a/src/libvaladoc/taglets/tagletsee.vala b/libvaladoc/taglets/tagletsee.vala
index 1e096fda7..1e096fda7 100644
--- a/src/libvaladoc/taglets/tagletsee.vala
+++ b/libvaladoc/taglets/tagletsee.vala
diff --git a/src/libvaladoc/taglets/tagletsince.vala b/libvaladoc/taglets/tagletsince.vala
index fccc063ef..fccc063ef 100644
--- a/src/libvaladoc/taglets/tagletsince.vala
+++ b/libvaladoc/taglets/tagletsince.vala
diff --git a/src/libvaladoc/taglets/tagletthrows.vala b/libvaladoc/taglets/tagletthrows.vala
index 6d3631c7f..6d3631c7f 100644
--- a/src/libvaladoc/taglets/tagletthrows.vala
+++ b/libvaladoc/taglets/tagletthrows.vala
diff --git a/src/libvaladoc/valadoc-1.0.deps.in b/libvaladoc/valadoc-1.0.deps.in
index 485c5a5ce..485c5a5ce 100644
--- a/src/libvaladoc/valadoc-1.0.deps.in
+++ b/libvaladoc/valadoc-1.0.deps.in
diff --git a/src/libvaladoc/valadoc-1.0.pc.in b/libvaladoc/valadoc-1.0.pc.in
index 8cf9ab02e..8cf9ab02e 100644
--- a/src/libvaladoc/valadoc-1.0.pc.in
+++ b/libvaladoc/valadoc-1.0.pc.in
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 63efb92ef..000000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-NULL =
-
-SUBDIRS = \
- libvaladoc \
- valadoc \
- doclets \
- driver \
- $(NULL)
-
-EXTRA_DIST = \
- vapi/config.vapi \
- vapi/libgvc.vapi \
- $(NULL)
-
diff --git a/src/driver/0.20.x/Makefile.am b/src/driver/0.20.x/Makefile.am
deleted file mode 100644
index cafd9c2be..000000000
--- a/src/driver/0.20.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.20 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_20_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.20.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.20 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_20_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.20.x/driver.vala b/src/driver/0.20.x/driver.vala
deleted file mode 100644
index 6bed3b942..000000000
--- a/src/driver/0.20.x/driver.vala
+++ /dev/null
@@ -1,69 +0,0 @@
-/* driver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
- private SymbolResolver resolver;
- private Api.Tree? tree;
-
- public void write_gir (Settings settings, ErrorReporter reporter) {
- var gir_writer = new Drivers.GirWriter (resolver);
-
- // put .gir file in current directory unless -d has been explicitly specified
- string gir_directory = ".";
- if (settings.gir_directory != null) {
- gir_directory = settings.gir_directory;
- }
-
- gir_writer.write_file ((Vala.CodeContext) tree.data,
- gir_directory,
- settings.gir_namespace,
- settings.gir_version,
- settings.pkg_name);
- }
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- TreeBuilder builder = new TreeBuilder ();
- tree = builder.build (settings, reporter);
- if (reporter.errors > 0) {
- return null;
- }
-
- resolver = new SymbolResolver (builder);
- tree.accept (resolver);
-
- return tree;
- }
-}
-
-
-public Type register_plugin (Valadoc.ModuleLoader module_loader) {
- return typeof (Valadoc.Drivers.Driver);
-}
-
diff --git a/src/driver/0.20.x/treebuilder.vala b/src/driver/0.20.x/treebuilder.vala
deleted file mode 100644
index 59df9b6d3..000000000
--- a/src/driver/0.20.x/treebuilder.vala
+++ /dev/null
@@ -1,1524 +0,0 @@
-/* treebuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-using Gee;
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
- private ArrayList<PackageMetaData> packages = new ArrayList<PackageMetaData> ();
- private PackageMetaData source_package;
-
- private HashMap<Vala.SourceFile, SourceFile> files = new HashMap<Vala.SourceFile, SourceFile> ();
- private HashMap<Vala.Symbol, Symbol> symbol_map = new HashMap<Vala.Symbol, Symbol> ();
-
- private ErrorReporter reporter;
- private Settings settings;
-
- private Api.Node current_node;
- private Api.Tree tree;
-
- private Valadoc.Api.Class glib_error = null;
-
-
- //
- // Accessors
- //
-
- public Api.Class get_glib_error () {
- return glib_error;
- }
-
- public HashMap<Vala.Symbol, Symbol> get_symbol_map () {
- return symbol_map;
- }
-
-
- //
- //
- //
-
- private class PackageMetaData {
- public Package package;
- public HashMap<Vala.Namespace, Namespace> namespaces = new HashMap<Vala.Namespace, Namespace> ();
- public ArrayList<Vala.SourceFile> files = new ArrayList<Vala.SourceFile> ();
-
- public PackageMetaData (Package package) {
- this.package = package;
- }
-
- public Namespace get_namespace (Vala.Namespace vns, SourceFile file) {
- Namespace? ns = namespaces.get (vns);
- if (ns != null) {
- return ns;
- }
-
- // find documentation comment if existing:
- SourceComment? comment = null;
- if (vns.source_reference != null) {
- foreach (Vala.Comment c in vns.get_comments()) {
- if (c.source_reference.file == file.data ||
- (c.source_reference.file.file_type == Vala.SourceFileType.SOURCE
- && ((Vala.SourceFile) file.data).file_type == Vala.SourceFileType.SOURCE)
- ) {
- Vala.SourceReference pos = c.source_reference;
- if (c is Vala.GirComment) {
- comment = new GirSourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- } else {
- comment = new SourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- break;
- }
- }
- }
-
- // find parent if existing
- var parent_vns = vns.parent_symbol;
-
- if (parent_vns == null) {
- ns = new Namespace (package, file, vns.name, comment, vns);
- package.add_child (ns);
- } else {
- Namespace parent_ns = get_namespace ((Vala.Namespace) parent_vns, file);
- ns = new Namespace (parent_ns, file, vns.name, comment, vns);
- parent_ns.add_child (ns);
- }
-
- namespaces.set (vns, ns);
- return ns;
- }
-
- public void register_source_file (Vala.SourceFile file) {
- files.add (file);
- }
-
- public bool is_package_for_file (Vala.SourceFile source_file) {
- if (source_file.file_type == Vala.SourceFileType.SOURCE && !package.is_package) {
- return true;
- }
-
- return files.contains (source_file);
- }
- }
-
-
- //
- // Type constructor translation helpers:
- //
-
- private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
- Pointer ptr = new Pointer (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.base_type;
- if (vntype is Vala.PointerType) {
- ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
- } else if (vntype is Vala.ArrayType) {
- ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
- } else {
- ptr.data_type = create_type_reference (vntype, ptr, caller);
- }
-
- return ptr;
- }
-
- private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
- Api.Array arr = new Api.Array (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.element_type;
- if (vntype is Vala.ArrayType) {
- arr.data_type = create_array ((Vala.ArrayType) vntype, arr, caller);
- } else {
- arr.data_type = create_type_reference (vntype, arr, caller);
- }
-
- return arr;
- }
-
- private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
- bool is_nullable = vtyperef != null
- && vtyperef.nullable
- && !(vtyperef is Vala.GenericType)
- && !(vtyperef is Vala.PointerType);
- string? signature = (vtyperef != null
- && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
- bool pass_ownership = type_reference_pass_ownership (vtyperef);
- Ownership ownership = get_type_reference_ownership (vtyperef);
- bool is_dynamic = vtyperef != null && vtyperef.is_dynamic;
-
- TypeReference type_ref = new TypeReference (parent,
- ownership,
- pass_ownership,
- is_dynamic,
- is_nullable,
- signature,
- vtyperef);
-
- if (vtyperef is Vala.PointerType) {
- type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef, type_ref, caller);
- } else if (vtyperef is Vala.ArrayType) {
- type_ref.data_type = create_array ((Vala.ArrayType) vtyperef, type_ref, caller);
- //} else if (vtyperef is Vala.GenericType) {
- // type_ref.data_type = new TypeParameter (caller,
- // caller.get_source_file (),
- // ((Vala.GenericType) vtyperef).type_parameter.name,
- // vtyperef);
- }
-
- // type parameters:
- if (vtyperef != null) {
- foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
- var type_param = create_type_reference (vdtype, type_ref, caller);
- type_ref.add_type_argument (type_param);
- }
- }
-
- return type_ref;
- }
-
-
-
- //
- // Translation helpers:
- //
-
- private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
- // attributes without arguments:
- string[] attributes = {
- "ReturnsModifiedPointer",
- "DestroysInstance",
- "GenericAccessors",
- "NoAccessorMethod",
- "NoArrayLength",
- "Experimental",
- "Diagnostics",
- "PrintfFormat",
- "PointerType",
- "ScanfFormat",
- "ThreadLocal",
- "SimpleType",
- "HasEmitter",
- "ModuleInit",
- "NoWrapper",
- "Immutable",
- "ErrorBase",
- "NoReturn",
- "NoThrow",
- "Compact",
- "Assert",
- "Flags"
- };
-
- string? tmp = "";
-
- foreach (Vala.Attribute att in lst) {
- if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- new_attribute.add_boolean ("has_target", false, att);
- parent.add_attribute (new_attribute);
- } else if (att.name == "Deprecated") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
-
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- } else if (att.name in attributes) {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- }
- }
- }
-
- private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
- }
-
- private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
- }
-
- private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
- }
-
- private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
- }
-
- private string? get_finalize_function_name (Vala.Class element) {
- if (!element.is_fundamental ()) {
- return null;
- }
-
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_free_function_name (Vala.Class element) {
- if (!element.is_compact) {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
- }
-
- private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
- }
-
- private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
- }
-
- private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
- }
-
- private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
- }
-
-
- private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
- }
-
- private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
- }
-
- private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
- }
-
- private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
- }
-
- private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
- }
-
- private string? get_nick (Vala.Property prop) {
- return Vala.CCodeBaseModule.get_ccode_nick (prop);
- }
-
- private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
- }
-
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- if (comment is Vala.GirComment) {
- var tmp = new GirSourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- if (((Vala.GirComment) comment).return_content != null) {
- Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
- tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content,
- file,
- return_pos.begin.line,
- return_pos.begin.column,
- return_pos.end.line,
- return_pos.end.column);
- }
-
- Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
- while (it.next ()) {
- Vala.Comment vala_param = it.get_value ();
- Vala.SourceReference param_pos = vala_param.source_reference;
- var param_comment = new SourceComment (vala_param.content,
- file,
- param_pos.begin.line,
- param_pos.begin.column,
- param_pos.end.line,
- param_pos.end.column);
- tmp.add_parameter_content (it.get_key (), param_comment);
- }
- return tmp;
- } else {
- return new SourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- }
-
- return null;
- }
-
- private string get_method_name (Vala.Method element) {
- if (element is Vala.CreationMethod) {
- if (element.name == ".new") {
- return element.parent_symbol.name;
- } else {
- return element.parent_symbol.name + "." + element.name;
- }
- }
-
- return element.name;
- }
-
- private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- }
-
- private string? get_private_cname (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- string? cname = get_cname (element);
- return (cname != null)? cname + "Private" : null;
- }
-
- private string? get_class_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_class_type_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
- return (name != null && name != "")? name : null;
- }
-
- private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
- string? name = get_is_type_macro_name (element);
- return (name != null)? name + "_CLASS" : null;
- }
-
- private string? get_type_function_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_type_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
- }
-
- private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && !((Vala.Class) element).is_compact)
- || element is Vala.Interface)
- {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- } else {
- return null;
- }
- }
-
- private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
- }
-
- private PackageMetaData? get_package_meta_data (Package pkg) {
- foreach (PackageMetaData data in packages) {
- if (data.package == pkg) {
- return data;
- }
- }
-
- return null;
- }
-
- private PackageMetaData register_package (Package package) {
- PackageMetaData meta_data = new PackageMetaData (package);
- tree.add_package (package);
- packages.add (meta_data);
- return meta_data;
- }
-
- private SourceFile register_source_file (PackageMetaData meta_data, Vala.SourceFile source_file) {
- SourceFile file = new SourceFile (meta_data.package,
- source_file.get_relative_filename (),
- source_file.get_csource_filename (),
- source_file);
- files.set (source_file, file);
-
- meta_data.register_source_file (source_file);
- return file;
- }
-
- private SourceFile? get_source_file (Vala.Symbol symbol) {
- Vala.SourceReference source_ref = symbol.source_reference;
- if (source_ref == null) {
- return null;
- }
-
- SourceFile? file = files.get (source_ref.file);
- assert (file != null);
- return file;
- }
-
- private Package? find_package_for_file (Vala.SourceFile source_file) {
- foreach (PackageMetaData pkg in this.packages) {
- if (pkg.is_package_for_file (source_file)) {
- return pkg.package;
- }
- }
-
- return null;
- }
-
-
- private Namespace get_namespace (Package pkg, Vala.Symbol symbol, SourceFile? file) {
- // Find the closest namespace in our vala-tree
- Vala.Symbol namespace_symbol = symbol;
- while (!(namespace_symbol is Vala.Namespace)) {
- namespace_symbol = namespace_symbol.parent_symbol;
- }
-
- PackageMetaData? meta_data = get_package_meta_data (pkg);
- assert (meta_data != null);
-
- return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
- }
-
- private MethodBindingType get_method_binding_type (Vala.Method element) {
- if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.is_abstract) {
- return MethodBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return MethodBindingType.VIRTUAL;
- } else if (element.overrides) {
- return MethodBindingType.OVERRIDE;
- } else if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.binding != Vala.MemberBinding.INSTANCE) {
- return MethodBindingType.STATIC;
- }
- return MethodBindingType.UNMODIFIED;
- }
-
-
- private SymbolAccessibility get_access_modifier(Vala.Symbol symbol) {
- switch (symbol.access) {
- case Vala.SymbolAccessibility.PROTECTED:
- return SymbolAccessibility.PROTECTED;
-
- case Vala.SymbolAccessibility.INTERNAL:
- return SymbolAccessibility.INTERNAL;
-
- case Vala.SymbolAccessibility.PRIVATE:
- return SymbolAccessibility.PRIVATE;
-
- case Vala.SymbolAccessibility.PUBLIC:
- return SymbolAccessibility.PUBLIC;
-
- default:
- error ("Unknown symbol accessibility modifier found");
- }
- }
-
- private PropertyAccessorType get_property_accessor_type (Vala.PropertyAccessor element) {
- if (element.construction) {
- if (element.writable) {
- return (PropertyAccessorType.CONSTRUCT | PropertyAccessorType.SET);
- }
- return PropertyAccessorType.CONSTRUCT;
- } else if (element.writable) {
- return PropertyAccessorType.SET;
- } else if (element.readable) {
- return PropertyAccessorType.GET;
- }
-
- error ("Unknown symbol accessibility type");
- }
-
- private bool type_reference_pass_ownership (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode? node = element.parent_node;
- if (node == null) {
- return false;
- }
- if (node is Vala.Parameter) {
- return (((Vala.Parameter)node).direction == Vala.ParameterDirection.IN &&
- ((Vala.Parameter)node).variable_type.value_owned);
- }
- if (node is Vala.Property) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_unowned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are weak, not unowned
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true)
- {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)
- ? element.is_weak ()
- : false;
- }
-
- private bool is_type_reference_owned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode parent = element.parent_node;
-
- // parameter:
- if (parent is Vala.Parameter) {
- if (((Vala.Parameter)parent).direction != Vala.ParameterDirection.IN) {
- return false;
- }
- return ((Vala.Parameter)parent).variable_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_weak (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are unowned, not weak
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false)
- {
- return false;
- }
-
- // arrays are unowned, not weak
- if (element is Vala.ArrayType) {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)? element.is_weak () : false;
- }
-
- private Ownership get_type_reference_ownership (Vala.DataType? element) {
- if (is_type_reference_owned (element)) {
- return Ownership.OWNED;
- } else if (is_type_reference_weak (element)) {
- return Ownership.WEAK;
- } else if (is_type_reference_unowned (element)) {
- return Ownership.UNOWNED;
- }
-
- return Ownership.DEFAULT;
- }
-
- private Ownership get_property_ownership (Vala.PropertyAccessor element) {
- if (element.value_type.value_owned) {
- return Ownership.OWNED;
- }
-
- // the exact type (weak, unowned) does not matter
- return Ownership.UNOWNED;
- }
-
- private PropertyBindingType get_property_binding_type (Vala.Property element) {
- if (element.is_abstract) {
- return PropertyBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return PropertyBindingType.VIRTUAL;
- } else if (element.overrides) {
- return PropertyBindingType.OVERRIDE;
- }
-
- return PropertyBindingType.UNMODIFIED;
- }
-
- private FormalParameterType get_formal_parameter_type (Vala.Parameter element) {
- if (element.direction == Vala.ParameterDirection.OUT) {
- return FormalParameterType.OUT;
- } else if (element.direction == Vala.ParameterDirection.REF) {
- return FormalParameterType.REF;
- } else if (element.direction == Vala.ParameterDirection.IN) {
- return FormalParameterType.IN;
- }
-
- error ("Unknown formal parameter type");
- }
-
-
- //
- // Vala tree creation:
- //
-
- private string get_package_name (string path) {
- string file_name = Path.get_basename (path);
- return file_name.substring (0, file_name.last_index_of_char ('.'));
- }
-
- private bool add_package (Vala.CodeContext context, string pkg) {
- // ignore multiple occurences of the same package
- if (context.has_package (pkg)) {
- return true;
- }
-
- string vapi_name = pkg + ".vapi";
- string gir_name = pkg + ".gir";
- foreach (string source_file in settings.source_files) {
- string basename = Path.get_basename (source_file);
- if (basename == vapi_name || basename == gir_name) {
- return true;
- }
- }
-
-
- var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
- if (package_path == null) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
- return false;
- }
-
- context.add_package (pkg);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
- context.add_source_file (vfile);
- Package vdpkg = new Package (pkg, true, null);
- register_source_file (register_package (vdpkg), vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)), pkg);
- return true;
- }
-
- private void add_deps (Vala.CodeContext context, string file_path, string pkg_name) {
- if (FileUtils.test (file_path, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (file_path, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep = dep.strip ();
- if (dep != "") {
- if (!add_package (context, dep)) {
- Vala.Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg_name));
- }
- }
- }
- } catch (FileError e) {
- Vala.Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
- }
-
- /**
- * Adds the specified packages to the list of used packages.
- *
- * @param context The code context
- * @param packages a list of package names
- */
- private void add_depencies (Vala.CodeContext context, string[] packages) {
- foreach (string package in packages) {
- if (!add_package (context, package)) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
- }
- }
- }
-
- /**
- * Add the specified source file to the context. Only .vala, .vapi, .gs,
- * and .c files are supported.
- */
- private void add_documented_files (Vala.CodeContext context, string[] sources) {
- if (sources == null) {
- return;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, source_file);
-
- if (context.profile == Vala.Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- context.root.add_using_directive (ns_ref);
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) {
- string file_name = get_package_name (source);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
- context.add_source_file (vfile);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (source), "%s.deps".printf (file_name)), file_name);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- tree.add_external_c_files (rpath);
- } else {
- Vala.Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Vala.Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- private Vala.CodeContext create_valac_tree (Settings settings) {
- // init context:
- var context = new Vala.CodeContext ();
- Vala.CodeContext.push (context);
-
-
- // settings:
- context.experimental = settings.experimental;
- context.experimental_non_null = settings.experimental || settings.experimental_non_null;
- context.vapi_directories = settings.vapi_directories;
- context.report.enable_warnings = settings.verbose;
- context.metadata_directories = settings.metadata_directories;
- context.gir_directories = settings.gir_directories;
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
-
- // add default packages:
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Vala.Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- for (int i = 2; i <= 20; i += 2) {
- context.add_define ("VALA_0_%d".printf (i));
- }
-
- if (context.profile == Vala.Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 12;
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- if (settings.target_glib != null && settings.target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
- Vala.Report.error (null, "Invalid format for --target-glib");
- }
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
-
- // default packages
- if (!this.add_package (context, "glib-2.0")) { //
- Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package (context, "gobject-2.0")) { //
- Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
-
- // add user defined files:
- add_depencies (context, settings.packages);
- if (reporter.errors > 0) {
- return context;
- }
-
- add_documented_files (context, settings.source_files);
- if (reporter.errors > 0) {
- return context;
- }
-
-
- // parse vala-code:
- Vala.Parser parser = new Vala.Parser ();
-
- parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- // parse gir:
- Vala.GirParser gir_parser = new Vala.GirParser ();
-
- gir_parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
-
-
- // check context:
- context.check ();
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- return context;
- }
-
-
-
- //
- // Valadoc tree creation:
- //
-
- private void process_children (Api.Node node, Vala.CodeNode element) {
- Api.Node old_node = current_node;
- current_node = node;
- element.accept_children (this);
- current_node = old_node;
- }
-
- private Api.Node get_parent_node_for (Vala.Symbol element) {
- if (current_node != null) {
- return current_node;
- }
-
- Vala.SourceFile vala_source_file = element.source_reference.file;
- Package package = find_package_for_file (vala_source_file);
- SourceFile? source_file = get_source_file (element);
-
- return get_namespace (package, element, source_file);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Vala.Namespace element) {
- element.accept_children (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_class == null && element.name == "string";
-
- Class node = new Class (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_private_cname (element),
- get_class_macro_name (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_class_type_macro_name (element),
- get_is_class_type_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- get_ccode_type_id (element),
- get_param_spec_function (element),
- get_ref_function (element),
- get_unref_function (element),
- get_free_function_name (element),
- get_finalize_function_name (element),
- get_take_value_function (element),
- get_get_value_function (element),
- get_set_value_function (element),
- element.is_fundamental (),
- element.is_abstract,
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // relations
- foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
- var type_ref = create_type_reference (vala_type_ref, node, node);
-
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else if (vala_type_ref.data_type is Vala.Class) {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
-
- // save GLib.Error
- if (glib_error == null && node.get_full_name () == "GLib.Error") {
- glib_error = node;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Interface node = new Interface (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_interface_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // prerequisites:
- foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
- TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_type == null
- && (element.is_boolean_type ()
- || element.is_floating_type ()
- || element.is_integer_type ());
-
- Struct node = new Struct (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- get_ccode_type_id (element),
- get_dup_function (element),
- get_copy_function (element),
- get_destroy_function (element),
- get_free_function (element),
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // parent type:
- Vala.ValueType? basetype = element.base_type as Vala.ValueType;
- if (basetype != null) {
- node.base_type = create_type_reference (basetype, node, node);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Field node = new Field (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element.binding == Vala.MemberBinding.STATIC,
- element.is_volatile,
- element);
- node.field_type = create_type_reference (element.variable_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Property node = new Property (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_nick (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.is_dbus_visible (element),
- get_property_binding_type (element),
- element);
- node.property_type = create_type_reference (element.property_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // Process property type
- if (element.get_accessor != null) {
- var accessor = element.get_accessor;
- node.getter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- if (element.set_accessor != null) {
- var accessor = element.set_accessor;
- node.setter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusServerModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusServerModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Api.Signal node = new Api.Signal (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- (element.default_handler != null)? get_cname (element.default_handler) : null,
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.is_dbus_visible (element),
- element.is_virtual,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Delegate node = new Delegate (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- !element.has_target,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Enum (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue element) {
- Api.Enum parent = (Enum) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.EnumValue (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Constant node = new Constant (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element);
- node.constant_type = create_type_reference (element.type_reference, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new ErrorDomain (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_quark_macro_name (element),
- get_quark_function_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode element) {
- Api.ErrorDomain parent = (ErrorDomain) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- if (file == null) {
- file = parent.get_source_file ();
- }
-
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.ErrorCode (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (Vala.TypeParameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- Symbol node = new TypeParameter (parent,
- file,
- element.name,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (Vala.Parameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- FormalParameter node = new FormalParameter (parent,
- file,
- element.name,
- get_access_modifier(element),
- get_formal_parameter_type (element),
- element.ellipsis,
- element);
- node.parameter_type = create_type_reference (element.variable_type, node, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
-
- //
- // startpoint:
- //
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.settings = settings;
- this.reporter = reporter;
-
- this.tree = new Api.Tree (reporter, settings);
- var context = create_valac_tree (settings);
- this.tree.data = context;
-
- reporter.warnings_offset = context.report.get_warnings ();
- reporter.errors_offset = context.report.get_errors ();
-
- if (context == null) {
- return null;
- }
-
- // TODO: Register all packages here
- // register packages included by gir-files
- foreach (Vala.SourceFile vfile in context.get_source_files ()) {
- if (vfile.file_type == Vala.SourceFileType.PACKAGE
- && vfile.get_nodes ().size > 0
- && files.has_key (vfile) == false)
- {
- Package vdpkg = new Package (get_package_name (vfile.filename), true, null);
- register_source_file (register_package (vdpkg), vfile);
- }
- }
-
- context.accept(this);
-
- return (reporter.errors == 0)? tree : null;
- }
-}
-
-
diff --git a/src/driver/0.22.x/Makefile.am b/src/driver/0.22.x/Makefile.am
deleted file mode 100644
index 4f114b7e8..000000000
--- a/src/driver/0.22.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.22 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_22_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.22.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.22 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_22_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.22.x/driver.vala b/src/driver/0.22.x/driver.vala
deleted file mode 100644
index 6bed3b942..000000000
--- a/src/driver/0.22.x/driver.vala
+++ /dev/null
@@ -1,69 +0,0 @@
-/* driver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
- private SymbolResolver resolver;
- private Api.Tree? tree;
-
- public void write_gir (Settings settings, ErrorReporter reporter) {
- var gir_writer = new Drivers.GirWriter (resolver);
-
- // put .gir file in current directory unless -d has been explicitly specified
- string gir_directory = ".";
- if (settings.gir_directory != null) {
- gir_directory = settings.gir_directory;
- }
-
- gir_writer.write_file ((Vala.CodeContext) tree.data,
- gir_directory,
- settings.gir_namespace,
- settings.gir_version,
- settings.pkg_name);
- }
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- TreeBuilder builder = new TreeBuilder ();
- tree = builder.build (settings, reporter);
- if (reporter.errors > 0) {
- return null;
- }
-
- resolver = new SymbolResolver (builder);
- tree.accept (resolver);
-
- return tree;
- }
-}
-
-
-public Type register_plugin (Valadoc.ModuleLoader module_loader) {
- return typeof (Valadoc.Drivers.Driver);
-}
-
diff --git a/src/driver/0.22.x/girwriter.vala b/src/driver/0.22.x/girwriter.vala
deleted file mode 100644
index c250854d6..000000000
--- a/src/driver/0.22.x/girwriter.vala
+++ /dev/null
@@ -1,204 +0,0 @@
-/* girwriter.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-
-
-/**
- * Code visitor generating .gir file for the public interface.
- */
-public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
- private GtkdocRenderer renderer;
- private SymbolResolver resolver;
-
- public GirWriter (SymbolResolver resolver) {
- this.renderer = new GtkdocRenderer ();
- this.resolver = resolver;
- }
-
- private string? translate (Content.Comment? documentation) {
- if (documentation == null) {
- return null;
- }
-
- renderer.render_symbol (documentation);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- private string? translate_taglet (Content.Taglet? taglet) {
- if (taglet == null) {
- return null;
- }
-
- renderer.render_children (taglet);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- protected override string? get_interface_comment (Vala.Interface viface) {
- Interface iface = resolver.resolve (viface) as Interface;
- return translate (iface.documentation);
- }
-
- protected override string? get_struct_comment (Vala.Struct vst) {
- Struct st = resolver.resolve (vst) as Struct;
- return translate (st.documentation);
- }
-
- protected override string? get_enum_comment (Vala.Enum ven) {
- Enum en = resolver.resolve (ven) as Enum;
- return translate (en.documentation);
- }
-
- protected override string? get_class_comment (Vala.Class vc) {
- Class c = resolver.resolve (vc) as Class;
- return translate (c.documentation);
- }
-
- protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
- ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
- return translate (ecode.documentation);
- }
-
- protected override string? get_enum_value_comment (Vala.EnumValue vev) {
- Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
- return translate (ev.documentation);
- }
-
- protected override string? get_constant_comment (Vala.Constant vc) {
- Constant c = resolver.resolve (vc) as Constant;
- return translate (c.documentation);
- }
-
- protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
- ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
- return translate (edomain.documentation);
- }
-
- protected override string? get_field_comment (Vala.Field vf) {
- Field f = resolver.resolve (vf) as Field;
- return translate (f.documentation);
- }
-
- protected override string? get_delegate_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- return translate (cb.documentation);
- }
-
- protected override string? get_method_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- return translate (m.documentation);
- }
-
- protected override string? get_property_comment (Vala.Property vprop) {
- Property prop = resolver.resolve (vprop) as Property;
- return translate (prop.documentation);
- }
-
- protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- if (cb.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = cb.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_return_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- if (sig.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = sig.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_method_return_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- if (m.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = m.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- return translate (sig.documentation);
- }
-
- protected override string? get_parameter_comment (Vala.Parameter param) {
- Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
- if (symbol == null) {
- return null;
- }
-
- Content.Comment? documentation = symbol.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
- foreach (Content.Taglet _taglet in taglets) {
- Taglets.Param taglet = (Taglets.Param) _taglet;
- if (taglet.parameter_name == param.name) {
- return translate_taglet (taglet);
- }
- }
-
- return null;
- }
-}
-
-
diff --git a/src/driver/0.22.x/initializerbuilder.vala b/src/driver/0.22.x/initializerbuilder.vala
deleted file mode 100644
index 7b26ab51f..000000000
--- a/src/driver/0.22.x/initializerbuilder.vala
+++ /dev/null
@@ -1,669 +0,0 @@
-/* initializerbuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Content;
-using Gee;
-
-
-private class Valadoc.Api.InitializerBuilder : Vala.CodeVisitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private SignatureBuilder signature;
-
- private Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void write_node (Vala.Symbol vsymbol) {
- signature.append_symbol (resolve (vsymbol));
- }
-
- private void write_type (Vala.DataType vsymbol) {
- if (vsymbol.data_type != null) {
- write_node (vsymbol.data_type);
- } else {
- signature.append_literal ("null");
- }
-
- var type_args = vsymbol.get_type_arguments ();
- if (type_args.size > 0) {
- signature.append ("<");
- bool first = true;
- foreach (Vala.DataType type_arg in type_args) {
- if (!first) {
- signature.append (",");
- } else {
- first = false;
- }
- if (!type_arg.value_owned) {
- signature.append_keyword ("weak");
- }
- signature.append (type_arg.to_qualified_string (null));
- }
- signature.append (">");
- }
-
- if (vsymbol.nullable) {
- signature.append ("?");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_array_creation_expression (Vala.ArrayCreationExpression expr) {
- signature.append_keyword ("new");
- write_type (expr.element_type);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression size in expr.get_sizes ()) {
- if (!first) {
- signature.append (", ", false);
- }
- size.accept (this);
- first = false;
- }
-
- signature.append ("]", false);
-
- if (expr.initializer_list != null) {
- signature.append (" ", false);
- expr.initializer_list.accept (this);
- }
- }
-
- public InitializerBuilder (SignatureBuilder signature, HashMap<Vala.Symbol, Symbol> symbol_map) {
- this.symbol_map = symbol_map;
- this.signature = signature;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_binary_expression (Vala.BinaryExpression expr) {
- expr.left.accept (this);
-
- switch (expr.operator) {
- case Vala.BinaryOperator.PLUS:
- signature.append ("+ ");
- break;
-
- case Vala.BinaryOperator.MINUS:
- signature.append ("- ");
- break;
-
- case Vala.BinaryOperator.MUL:
- signature.append ("* ");
- break;
-
- case Vala.BinaryOperator.DIV:
- signature.append ("/ ");
- break;
-
- case Vala.BinaryOperator.MOD:
- signature.append ("% ");
- break;
-
- case Vala.BinaryOperator.SHIFT_LEFT:
- signature.append ("<< ");
- break;
-
- case Vala.BinaryOperator.SHIFT_RIGHT:
- signature.append (">> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN:
- signature.append ("< ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN:
- signature.append ("> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN_OR_EQUAL:
- signature.append ("<= ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN_OR_EQUAL:
- signature.append (">= ");
- break;
-
- case Vala.BinaryOperator.EQUALITY:
- signature.append ("== ");
- break;
-
- case Vala.BinaryOperator.INEQUALITY:
- signature.append ("!= ");
- break;
-
- case Vala.BinaryOperator.BITWISE_AND:
- signature.append ("& ");
- break;
-
- case Vala.BinaryOperator.BITWISE_OR:
- signature.append ("| ");
- break;
-
- case Vala.BinaryOperator.BITWISE_XOR:
- signature.append ("^ ");
- break;
-
- case Vala.BinaryOperator.AND:
- signature.append ("&& ");
- break;
-
- case Vala.BinaryOperator.OR:
- signature.append ("|| ");
- break;
-
- case Vala.BinaryOperator.IN:
- signature.append_keyword ("in");
- signature.append (" ");
- break;
-
- case Vala.BinaryOperator.COALESCE:
- signature.append ("?? ");
- break;
-
- default:
- assert_not_reached ();
- }
-
- expr.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_unary_expression (Vala.UnaryExpression expr) {
- switch (expr.operator) {
- case Vala.UnaryOperator.PLUS:
- signature.append ("+");
- break;
-
- case Vala.UnaryOperator.MINUS:
- signature.append ("-");
- break;
-
- case Vala.UnaryOperator.LOGICAL_NEGATION:
- signature.append ("!");
- break;
-
- case Vala.UnaryOperator.BITWISE_COMPLEMENT:
- signature.append ("~");
- break;
-
- case Vala.UnaryOperator.INCREMENT:
- signature.append ("++");
- break;
-
- case Vala.UnaryOperator.DECREMENT:
- signature.append ("--");
- break;
-
- case Vala.UnaryOperator.REF:
- signature.append_keyword ("ref");
- break;
-
- case Vala.UnaryOperator.OUT:
- signature.append_keyword ("out");
- break;
-
- default:
- assert_not_reached ();
- }
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_assignment (Vala.Assignment a) {
- a.left.accept (this);
-
- switch (a.operator) {
- case Vala.AssignmentOperator.SIMPLE:
- signature.append ("=");
- break;
-
- case Vala.AssignmentOperator.BITWISE_OR:
- signature.append ("|");
- break;
-
- case Vala.AssignmentOperator.BITWISE_AND:
- signature.append ("&");
- break;
-
- case Vala.AssignmentOperator.BITWISE_XOR:
- signature.append ("^");
- break;
-
- case Vala.AssignmentOperator.ADD:
- signature.append ("+");
- break;
-
- case Vala.AssignmentOperator.SUB:
- signature.append ("-");
- break;
-
- case Vala.AssignmentOperator.MUL:
- signature.append ("*");
- break;
-
- case Vala.AssignmentOperator.DIV:
- signature.append ("/");
- break;
-
- case Vala.AssignmentOperator.PERCENT:
- signature.append ("%");
- break;
-
- case Vala.AssignmentOperator.SHIFT_LEFT:
- signature.append ("<<");
- break;
-
- case Vala.AssignmentOperator.SHIFT_RIGHT:
- signature.append (">>");
- break;
-
- default:
- assert_not_reached ();
- }
-
- a.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_cast_expression (Vala.CastExpression expr) {
- if (expr.is_non_null_cast) {
- signature.append ("(!)");
- expr.inner.accept (this);
- return;
- }
-
- if (!expr.is_silent_cast) {
- signature.append ("(", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- expr.inner.accept (this);
-
- if (expr.is_silent_cast) {
- signature.append_keyword ("as");
- write_type (expr.type_reference);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_initializer_list (Vala.InitializerList list) {
- signature.append ("{", false);
-
- bool first = true;
- foreach (Vala.Expression initializer in list.get_initializers ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
- initializer.accept (this);
- }
-
- signature.append ("}", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_member_access (Vala.MemberAccess expr) {
- if (expr.symbol_reference != null) {
- expr.symbol_reference.accept (this);
- } else {
- signature.append (expr.member_name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_element_access (Vala.ElementAccess expr) {
- expr.container.accept (this);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression index in expr.get_indices ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
-
- index.accept (this);
- }
-
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_pointer_indirection (Vala.PointerIndirection expr) {
- signature.append ("*", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_addressof_expression (Vala.AddressofExpression expr) {
- signature.append ("&", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_reference_transfer_expression (Vala.ReferenceTransferExpression expr) {
- signature.append ("(", false).append_keyword ("owned", false).append (")", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_check (Vala.TypeCheck expr) {
- expr.expression.accept (this);
- signature.append_keyword ("is");
- write_type (expr.type_reference);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method_call (Vala.MethodCall expr) {
- // symbol-name:
- expr.call.symbol_reference.accept (this);
-
- // parameters:
- signature.append (" (", false);
- bool first = true;
- foreach (Vala.Expression literal in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
-
- literal.accept (this);
- first = false;
- }
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_slice_expression (Vala.SliceExpression expr) {
- expr.container.accept (this);
- signature.append ("[", false);
- expr.start.accept (this);
- signature.append (":", false);
- expr.stop.accept (this);
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_base_access (Vala.BaseAccess expr) {
- signature.append_keyword ("base", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_postfix_expression (Vala.PostfixExpression expr) {
- expr.inner.accept (this);
- if (expr.increment) {
- signature.append ("++", false);
- } else {
- signature.append ("--", false);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_object_creation_expression (Vala.ObjectCreationExpression expr) {
- if (!expr.struct_creation) {
- signature.append_keyword ("new");
- }
-
- signature.append_symbol (resolve (expr.symbol_reference));
-
- signature.append (" (", false);
-
- //TODO: rm conditional space
- bool first = true;
- foreach (Vala.Expression arg in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
- arg.accept (this);
- first = false;
- }
-
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_sizeof_expression (Vala.SizeofExpression expr) {
- signature.append_keyword ("sizeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_typeof_expression (Vala.TypeofExpression expr) {
- signature.append_keyword ("typeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_lambda_expression (Vala.LambdaExpression expr) {
- signature.append ("(", false);
-
- bool first = true;
- foreach (Vala.Parameter param in expr.get_parameters ()) {
- if (!first) {
- signature.append (", ", false);
- }
- signature.append (param.name, false);
- first = false;
- }
-
-
- signature.append (") => {", false);
- signature.append_highlighted (" [...] ", false);
- signature.append ("}", false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_boolean_literal (Vala.BooleanLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_character_literal (Vala.CharacterLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_integer_literal (Vala.IntegerLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_real_literal (Vala.RealLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_regex_literal (Vala.RegexLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_string_literal (Vala.StringLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_null_literal (Vala.NullLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field field) {
- write_node (field);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant constant) {
- write_node (constant);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue ev) {
- write_node (ev);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode ec) {
- write_node (ec);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate d) {
- write_node (d);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal sig) {
- write_node (sig);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class c) {
- write_node (c);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct s) {
- write_node (s);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface i) {
- write_node (i);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum en) {
- write_node (en);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain ed) {
- write_node (ed);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property prop) {
- write_node (prop);
- }
-}
-
diff --git a/src/driver/0.22.x/symbolresolver.vala b/src/driver/0.22.x/symbolresolver.vala
deleted file mode 100644
index 4adc06b1a..000000000
--- a/src/driver/0.22.x/symbolresolver.vala
+++ /dev/null
@@ -1,323 +0,0 @@
-/* symbolresolver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-public class Valadoc.Drivers.SymbolResolver : Visitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private Valadoc.Api.Class glib_error;
- private Api.Tree root;
-
- public SymbolResolver (TreeBuilder builder) {
- this.symbol_map = builder.get_symbol_map ();
- this.glib_error = builder.get_glib_error ();
- }
-
- public Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void resolve_thrown_list (Symbol symbol, Vala.List<Vala.DataType> types) {
- foreach (Vala.DataType type in types) {
- Vala.ErrorDomain vala_edom = (Vala.ErrorDomain) type.data_type;
- Symbol? edom = symbol_map.get (vala_edom);
- symbol.add_child (edom ?? glib_error);
- }
- }
-
- private void resolve_array_type_references (Api.Array ptr) {
- Api.Item data_type = ptr.data_type;
- if (data_type == null) {
- // void
- } else if (data_type is Api.Array) {
- resolve_array_type_references ((Api.Array) data_type);
- } else if (data_type is Pointer) {
- resolve_pointer_type_references ((Api.Pointer) data_type);
- } else {
- resolve_type_reference ((TypeReference) data_type);
- }
- }
-
- private void resolve_pointer_type_references (Pointer ptr) {
- Api.Item type = ptr.data_type;
- if (type == null) {
- // void
- } else if (type is Api.Array) {
- resolve_array_type_references ((Api.Array) type);
- } else if (type is Pointer) {
- resolve_pointer_type_references ((Pointer) type);
- } else {
- resolve_type_reference ((TypeReference) type);
- }
- }
-
- private void resolve_type_reference (TypeReference reference) {
- Vala.DataType vtyperef = (Vala.DataType) reference.data;
- if (vtyperef is Vala.ErrorType) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
- if (verrdom != null) {
- reference.data_type = resolve (verrdom);
- } else {
- reference.data_type = glib_error;
- }
- } else if (vtyperef is Vala.DelegateType) {
- reference.data_type = resolve (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else if (vtyperef is Vala.GenericType) {
- reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
- } else if (vtyperef.data_type != null) {
- reference.data_type = resolve (vtyperef.data_type);
- }
-
- // Type parameters:
- foreach (TypeReference type_param_ref in reference.get_type_arguments ()) {
- resolve_type_reference (type_param_ref);
- }
-
- if (reference.data_type is Pointer) {
- resolve_pointer_type_references ((Pointer)reference.data_type);
- } else if (reference.data_type is Api.Array) {
- resolve_array_type_references ((Api.Array)reference.data_type);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_tree (Api.Tree item) {
- this.root = item;
- item.accept_children (this);
- this.root = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_package (Package item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Namespace item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Interface item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (var type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Class item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (TypeReference type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Struct item) {
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Property item) {
- Vala.Property vala_property = item.data as Vala.Property;
- Vala.Property? base_vala_property = null;
-
- if (vala_property.base_property != null) {
- base_vala_property = vala_property.base_property;
- } else if (vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property == vala_property && vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property != null) {
- item.base_property = (Property?) resolve (base_vala_property);
- }
-
- resolve_type_reference (item.property_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Field item) {
- resolve_type_reference (item.field_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Constant item) {
- resolve_type_reference (item.constant_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Delegate item) {
- Vala.Delegate vala_delegate = item.data as Vala.Delegate;
-
- resolve_type_reference (item.return_type);
-
- resolve_thrown_list (item, vala_delegate.get_error_types ());
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Api.Signal item) {
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Method item) {
- Vala.Method vala_method = item.data as Vala.Method;
- Vala.Method? base_vala_method = null;
- if (vala_method.base_method != null) {
- base_vala_method = vala_method.base_method;
- } else if (vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method == vala_method && vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method != null) {
- item.base_method = (Method?) resolve (base_vala_method);
- }
-
- resolve_thrown_list (item, vala_method.get_error_types ());
-
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (TypeParameter item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (FormalParameter item) {
- if (item.ellipsis) {
- return;
- }
-
- if (((Vala.Parameter) item.data).initializer != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.Parameter) item.data).initializer.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- resolve_type_reference (item.parameter_type);
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (ErrorDomain item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (ErrorCode item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Enum item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Api.EnumValue item) {
-
- if (((Vala.EnumValue) item.data).value != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.EnumValue) item.data).value.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- item.accept_all_children (this, false);
- }
-}
-
-
-
diff --git a/src/driver/0.22.x/treebuilder.vala b/src/driver/0.22.x/treebuilder.vala
deleted file mode 100644
index bb4ef567c..000000000
--- a/src/driver/0.22.x/treebuilder.vala
+++ /dev/null
@@ -1,1524 +0,0 @@
-/* treebuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-using Gee;
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
- private ArrayList<PackageMetaData> packages = new ArrayList<PackageMetaData> ();
- private PackageMetaData source_package;
-
- private HashMap<Vala.SourceFile, SourceFile> files = new HashMap<Vala.SourceFile, SourceFile> ();
- private HashMap<Vala.Symbol, Symbol> symbol_map = new HashMap<Vala.Symbol, Symbol> ();
-
- private ErrorReporter reporter;
- private Settings settings;
-
- private Api.Node current_node;
- private Api.Tree tree;
-
- private Valadoc.Api.Class glib_error = null;
-
-
- //
- // Accessors
- //
-
- public Api.Class get_glib_error () {
- return glib_error;
- }
-
- public HashMap<Vala.Symbol, Symbol> get_symbol_map () {
- return symbol_map;
- }
-
-
- //
- //
- //
-
- private class PackageMetaData {
- public Package package;
- public HashMap<Vala.Namespace, Namespace> namespaces = new HashMap<Vala.Namespace, Namespace> ();
- public ArrayList<Vala.SourceFile> files = new ArrayList<Vala.SourceFile> ();
-
- public PackageMetaData (Package package) {
- this.package = package;
- }
-
- public Namespace get_namespace (Vala.Namespace vns, SourceFile file) {
- Namespace? ns = namespaces.get (vns);
- if (ns != null) {
- return ns;
- }
-
- // find documentation comment if existing:
- SourceComment? comment = null;
- if (vns.source_reference != null) {
- foreach (Vala.Comment c in vns.get_comments()) {
- if (c.source_reference.file == file.data ||
- (c.source_reference.file.file_type == Vala.SourceFileType.SOURCE
- && ((Vala.SourceFile) file.data).file_type == Vala.SourceFileType.SOURCE)
- ) {
- Vala.SourceReference pos = c.source_reference;
- if (c is Vala.GirComment) {
- comment = new GirSourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- } else {
- comment = new SourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- break;
- }
- }
- }
-
- // find parent if existing
- var parent_vns = vns.parent_symbol;
-
- if (parent_vns == null) {
- ns = new Namespace (package, file, vns.name, comment, vns);
- package.add_child (ns);
- } else {
- Namespace parent_ns = get_namespace ((Vala.Namespace) parent_vns, file);
- ns = new Namespace (parent_ns, file, vns.name, comment, vns);
- parent_ns.add_child (ns);
- }
-
- namespaces.set (vns, ns);
- return ns;
- }
-
- public void register_source_file (Vala.SourceFile file) {
- files.add (file);
- }
-
- public bool is_package_for_file (Vala.SourceFile source_file) {
- if (source_file.file_type == Vala.SourceFileType.SOURCE && !package.is_package) {
- return true;
- }
-
- return files.contains (source_file);
- }
- }
-
-
- //
- // Type constructor translation helpers:
- //
-
- private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
- Pointer ptr = new Pointer (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.base_type;
- if (vntype is Vala.PointerType) {
- ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
- } else if (vntype is Vala.ArrayType) {
- ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
- } else {
- ptr.data_type = create_type_reference (vntype, ptr, caller);
- }
-
- return ptr;
- }
-
- private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
- Api.Array arr = new Api.Array (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.element_type;
- if (vntype is Vala.ArrayType) {
- arr.data_type = create_array ((Vala.ArrayType) vntype, arr, caller);
- } else {
- arr.data_type = create_type_reference (vntype, arr, caller);
- }
-
- return arr;
- }
-
- private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
- bool is_nullable = vtyperef != null
- && vtyperef.nullable
- && !(vtyperef is Vala.GenericType)
- && !(vtyperef is Vala.PointerType);
- string? signature = (vtyperef != null
- && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
- bool pass_ownership = type_reference_pass_ownership (vtyperef);
- Ownership ownership = get_type_reference_ownership (vtyperef);
- bool is_dynamic = vtyperef != null && vtyperef.is_dynamic;
-
- TypeReference type_ref = new TypeReference (parent,
- ownership,
- pass_ownership,
- is_dynamic,
- is_nullable,
- signature,
- vtyperef);
-
- if (vtyperef is Vala.PointerType) {
- type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef, type_ref, caller);
- } else if (vtyperef is Vala.ArrayType) {
- type_ref.data_type = create_array ((Vala.ArrayType) vtyperef, type_ref, caller);
- //} else if (vtyperef is Vala.GenericType) {
- // type_ref.data_type = new TypeParameter (caller,
- // caller.get_source_file (),
- // ((Vala.GenericType) vtyperef).type_parameter.name,
- // vtyperef);
- }
-
- // type parameters:
- if (vtyperef != null) {
- foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
- var type_param = create_type_reference (vdtype, type_ref, caller);
- type_ref.add_type_argument (type_param);
- }
- }
-
- return type_ref;
- }
-
-
-
- //
- // Translation helpers:
- //
-
- private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
- // attributes without arguments:
- string[] attributes = {
- "ReturnsModifiedPointer",
- "DestroysInstance",
- "GenericAccessors",
- "NoAccessorMethod",
- "NoArrayLength",
- "Experimental",
- "Diagnostics",
- "PrintfFormat",
- "PointerType",
- "ScanfFormat",
- "ThreadLocal",
- "SimpleType",
- "HasEmitter",
- "ModuleInit",
- "NoWrapper",
- "Immutable",
- "ErrorBase",
- "NoReturn",
- "NoThrow",
- "Compact",
- "Assert",
- "Flags"
- };
-
- string? tmp = "";
-
- foreach (Vala.Attribute att in lst) {
- if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- new_attribute.add_boolean ("has_target", false, att);
- parent.add_attribute (new_attribute);
- } else if (att.name == "Deprecated") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
-
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- } else if (att.name in attributes) {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- }
- }
- }
-
- private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
- }
-
- private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
- }
-
- private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
- }
-
- private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
- }
-
- private string? get_finalize_function_name (Vala.Class element) {
- if (!element.is_fundamental ()) {
- return null;
- }
-
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_free_function_name (Vala.Class element) {
- if (!element.is_compact) {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
- }
-
- private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
- }
-
- private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
- }
-
- private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
- }
-
- private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
- }
-
-
- private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
- }
-
- private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
- }
-
- private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
- }
-
- private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
- }
-
- private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
- }
-
- private string? get_nick (Vala.Property prop) {
- return Vala.CCodeBaseModule.get_ccode_nick (prop);
- }
-
- private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
- }
-
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- if (comment is Vala.GirComment) {
- var tmp = new GirSourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- if (((Vala.GirComment) comment).return_content != null) {
- Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
- tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content,
- file,
- return_pos.begin.line,
- return_pos.begin.column,
- return_pos.end.line,
- return_pos.end.column);
- }
-
- Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
- while (it.next ()) {
- Vala.Comment vala_param = it.get_value ();
- Vala.SourceReference param_pos = vala_param.source_reference;
- var param_comment = new SourceComment (vala_param.content,
- file,
- param_pos.begin.line,
- param_pos.begin.column,
- param_pos.end.line,
- param_pos.end.column);
- tmp.add_parameter_content (it.get_key (), param_comment);
- }
- return tmp;
- } else {
- return new SourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- }
-
- return null;
- }
-
- private string get_method_name (Vala.Method element) {
- if (element is Vala.CreationMethod) {
- if (element.name == ".new") {
- return element.parent_symbol.name;
- } else {
- return element.parent_symbol.name + "." + element.name;
- }
- }
-
- return element.name;
- }
-
- private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- }
-
- private string? get_private_cname (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- string? cname = get_cname (element);
- return (cname != null)? cname + "Private" : null;
- }
-
- private string? get_class_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_class_type_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
- return (name != null && name != "")? name : null;
- }
-
- private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
- string? name = get_is_type_macro_name (element);
- return (name != null)? name + "_CLASS" : null;
- }
-
- private string? get_type_function_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_type_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
- }
-
- private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && !((Vala.Class) element).is_compact)
- || element is Vala.Interface)
- {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- } else {
- return null;
- }
- }
-
- private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
- }
-
- private PackageMetaData? get_package_meta_data (Package pkg) {
- foreach (PackageMetaData data in packages) {
- if (data.package == pkg) {
- return data;
- }
- }
-
- return null;
- }
-
- private PackageMetaData register_package (Package package) {
- PackageMetaData meta_data = new PackageMetaData (package);
- tree.add_package (package);
- packages.add (meta_data);
- return meta_data;
- }
-
- private SourceFile register_source_file (PackageMetaData meta_data, Vala.SourceFile source_file) {
- SourceFile file = new SourceFile (meta_data.package,
- source_file.get_relative_filename (),
- source_file.get_csource_filename (),
- source_file);
- files.set (source_file, file);
-
- meta_data.register_source_file (source_file);
- return file;
- }
-
- private SourceFile? get_source_file (Vala.Symbol symbol) {
- Vala.SourceReference source_ref = symbol.source_reference;
- if (source_ref == null) {
- return null;
- }
-
- SourceFile? file = files.get (source_ref.file);
- assert (file != null);
- return file;
- }
-
- private Package? find_package_for_file (Vala.SourceFile source_file) {
- foreach (PackageMetaData pkg in this.packages) {
- if (pkg.is_package_for_file (source_file)) {
- return pkg.package;
- }
- }
-
- return null;
- }
-
-
- private Namespace get_namespace (Package pkg, Vala.Symbol symbol, SourceFile? file) {
- // Find the closest namespace in our vala-tree
- Vala.Symbol namespace_symbol = symbol;
- while (!(namespace_symbol is Vala.Namespace)) {
- namespace_symbol = namespace_symbol.parent_symbol;
- }
-
- PackageMetaData? meta_data = get_package_meta_data (pkg);
- assert (meta_data != null);
-
- return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
- }
-
- private MethodBindingType get_method_binding_type (Vala.Method element) {
- if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.is_abstract) {
- return MethodBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return MethodBindingType.VIRTUAL;
- } else if (element.overrides) {
- return MethodBindingType.OVERRIDE;
- } else if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.binding != Vala.MemberBinding.INSTANCE) {
- return MethodBindingType.STATIC;
- }
- return MethodBindingType.UNMODIFIED;
- }
-
-
- private SymbolAccessibility get_access_modifier(Vala.Symbol symbol) {
- switch (symbol.access) {
- case Vala.SymbolAccessibility.PROTECTED:
- return SymbolAccessibility.PROTECTED;
-
- case Vala.SymbolAccessibility.INTERNAL:
- return SymbolAccessibility.INTERNAL;
-
- case Vala.SymbolAccessibility.PRIVATE:
- return SymbolAccessibility.PRIVATE;
-
- case Vala.SymbolAccessibility.PUBLIC:
- return SymbolAccessibility.PUBLIC;
-
- default:
- error ("Unknown symbol accessibility modifier found");
- }
- }
-
- private PropertyAccessorType get_property_accessor_type (Vala.PropertyAccessor element) {
- if (element.construction) {
- if (element.writable) {
- return (PropertyAccessorType.CONSTRUCT | PropertyAccessorType.SET);
- }
- return PropertyAccessorType.CONSTRUCT;
- } else if (element.writable) {
- return PropertyAccessorType.SET;
- } else if (element.readable) {
- return PropertyAccessorType.GET;
- }
-
- error ("Unknown symbol accessibility type");
- }
-
- private bool type_reference_pass_ownership (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode? node = element.parent_node;
- if (node == null) {
- return false;
- }
- if (node is Vala.Parameter) {
- return (((Vala.Parameter)node).direction == Vala.ParameterDirection.IN &&
- ((Vala.Parameter)node).variable_type.value_owned);
- }
- if (node is Vala.Property) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_unowned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are weak, not unowned
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true)
- {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)
- ? element.is_weak ()
- : false;
- }
-
- private bool is_type_reference_owned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode parent = element.parent_node;
-
- // parameter:
- if (parent is Vala.Parameter) {
- if (((Vala.Parameter)parent).direction != Vala.ParameterDirection.IN) {
- return false;
- }
- return ((Vala.Parameter)parent).variable_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_weak (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are unowned, not weak
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false)
- {
- return false;
- }
-
- // arrays are unowned, not weak
- if (element is Vala.ArrayType) {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)? element.is_weak () : false;
- }
-
- private Ownership get_type_reference_ownership (Vala.DataType? element) {
- if (is_type_reference_owned (element)) {
- return Ownership.OWNED;
- } else if (is_type_reference_weak (element)) {
- return Ownership.WEAK;
- } else if (is_type_reference_unowned (element)) {
- return Ownership.UNOWNED;
- }
-
- return Ownership.DEFAULT;
- }
-
- private Ownership get_property_ownership (Vala.PropertyAccessor element) {
- if (element.value_type.value_owned) {
- return Ownership.OWNED;
- }
-
- // the exact type (weak, unowned) does not matter
- return Ownership.UNOWNED;
- }
-
- private PropertyBindingType get_property_binding_type (Vala.Property element) {
- if (element.is_abstract) {
- return PropertyBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return PropertyBindingType.VIRTUAL;
- } else if (element.overrides) {
- return PropertyBindingType.OVERRIDE;
- }
-
- return PropertyBindingType.UNMODIFIED;
- }
-
- private FormalParameterType get_formal_parameter_type (Vala.Parameter element) {
- if (element.direction == Vala.ParameterDirection.OUT) {
- return FormalParameterType.OUT;
- } else if (element.direction == Vala.ParameterDirection.REF) {
- return FormalParameterType.REF;
- } else if (element.direction == Vala.ParameterDirection.IN) {
- return FormalParameterType.IN;
- }
-
- error ("Unknown formal parameter type");
- }
-
-
- //
- // Vala tree creation:
- //
-
- private string get_package_name (string path) {
- string file_name = Path.get_basename (path);
- return file_name.substring (0, file_name.last_index_of_char ('.'));
- }
-
- private bool add_package (Vala.CodeContext context, string pkg) {
- // ignore multiple occurences of the same package
- if (context.has_package (pkg)) {
- return true;
- }
-
- string vapi_name = pkg + ".vapi";
- string gir_name = pkg + ".gir";
- foreach (string source_file in settings.source_files) {
- string basename = Path.get_basename (source_file);
- if (basename == vapi_name || basename == gir_name) {
- return true;
- }
- }
-
-
- var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
- if (package_path == null) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
- return false;
- }
-
- context.add_package (pkg);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
- context.add_source_file (vfile);
- Package vdpkg = new Package (pkg, true, null);
- register_source_file (register_package (vdpkg), vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)), pkg);
- return true;
- }
-
- private void add_deps (Vala.CodeContext context, string file_path, string pkg_name) {
- if (FileUtils.test (file_path, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (file_path, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep = dep.strip ();
- if (dep != "") {
- if (!add_package (context, dep)) {
- Vala.Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg_name));
- }
- }
- }
- } catch (FileError e) {
- Vala.Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
- }
-
- /**
- * Adds the specified packages to the list of used packages.
- *
- * @param context The code context
- * @param packages a list of package names
- */
- private void add_depencies (Vala.CodeContext context, string[] packages) {
- foreach (string package in packages) {
- if (!add_package (context, package)) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
- }
- }
- }
-
- /**
- * Add the specified source file to the context. Only .vala, .vapi, .gs,
- * and .c files are supported.
- */
- private void add_documented_files (Vala.CodeContext context, string[] sources) {
- if (sources == null) {
- return;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, source_file);
-
- if (context.profile == Vala.Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- context.root.add_using_directive (ns_ref);
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) {
- string file_name = get_package_name (source);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
- context.add_source_file (vfile);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (source), "%s.deps".printf (file_name)), file_name);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- tree.add_external_c_files (rpath);
- } else {
- Vala.Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Vala.Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- private Vala.CodeContext create_valac_tree (Settings settings) {
- // init context:
- var context = new Vala.CodeContext ();
- Vala.CodeContext.push (context);
-
-
- // settings:
- context.experimental = settings.experimental;
- context.experimental_non_null = settings.experimental || settings.experimental_non_null;
- context.vapi_directories = settings.vapi_directories;
- context.report.enable_warnings = settings.verbose;
- context.metadata_directories = settings.metadata_directories;
- context.gir_directories = settings.gir_directories;
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
-
- // add default packages:
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Vala.Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- for (int i = 2; i <= 22; i += 2) {
- context.add_define ("VALA_0_%d".printf (i));
- }
-
- if (context.profile == Vala.Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 12;
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- if (settings.target_glib != null && settings.target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
- Vala.Report.error (null, "Invalid format for --target-glib");
- }
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
-
- // default packages
- if (!this.add_package (context, "glib-2.0")) { //
- Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package (context, "gobject-2.0")) { //
- Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
-
- // add user defined files:
- add_depencies (context, settings.packages);
- if (reporter.errors > 0) {
- return context;
- }
-
- add_documented_files (context, settings.source_files);
- if (reporter.errors > 0) {
- return context;
- }
-
-
- // parse vala-code:
- Vala.Parser parser = new Vala.Parser ();
-
- parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- // parse gir:
- Vala.GirParser gir_parser = new Vala.GirParser ();
-
- gir_parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
-
-
- // check context:
- context.check ();
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- return context;
- }
-
-
-
- //
- // Valadoc tree creation:
- //
-
- private void process_children (Api.Node node, Vala.CodeNode element) {
- Api.Node old_node = current_node;
- current_node = node;
- element.accept_children (this);
- current_node = old_node;
- }
-
- private Api.Node get_parent_node_for (Vala.Symbol element) {
- if (current_node != null) {
- return current_node;
- }
-
- Vala.SourceFile vala_source_file = element.source_reference.file;
- Package package = find_package_for_file (vala_source_file);
- SourceFile? source_file = get_source_file (element);
-
- return get_namespace (package, element, source_file);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Vala.Namespace element) {
- element.accept_children (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_class == null && element.name == "string";
-
- Class node = new Class (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_private_cname (element),
- get_class_macro_name (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_class_type_macro_name (element),
- get_is_class_type_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- get_ccode_type_id (element),
- get_param_spec_function (element),
- get_ref_function (element),
- get_unref_function (element),
- get_free_function_name (element),
- get_finalize_function_name (element),
- get_take_value_function (element),
- get_get_value_function (element),
- get_set_value_function (element),
- element.is_fundamental (),
- element.is_abstract,
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // relations
- foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
- var type_ref = create_type_reference (vala_type_ref, node, node);
-
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else if (vala_type_ref.data_type is Vala.Class) {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
-
- // save GLib.Error
- if (glib_error == null && node.get_full_name () == "GLib.Error") {
- glib_error = node;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Interface node = new Interface (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_interface_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // prerequisites:
- foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
- TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_type == null
- && (element.is_boolean_type ()
- || element.is_floating_type ()
- || element.is_integer_type ());
-
- Struct node = new Struct (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- get_ccode_type_id (element),
- get_dup_function (element),
- get_copy_function (element),
- get_destroy_function (element),
- get_free_function (element),
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // parent type:
- Vala.ValueType? basetype = element.base_type as Vala.ValueType;
- if (basetype != null) {
- node.base_type = create_type_reference (basetype, node, node);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Field node = new Field (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element.binding == Vala.MemberBinding.STATIC,
- element.is_volatile,
- element);
- node.field_type = create_type_reference (element.variable_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Property node = new Property (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_nick (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.is_dbus_visible (element),
- get_property_binding_type (element),
- element);
- node.property_type = create_type_reference (element.property_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // Process property type
- if (element.get_accessor != null) {
- var accessor = element.get_accessor;
- node.getter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- if (element.set_accessor != null) {
- var accessor = element.set_accessor;
- node.setter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusServerModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusServerModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Api.Signal node = new Api.Signal (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- (element.default_handler != null)? get_cname (element.default_handler) : null,
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.is_dbus_visible (element),
- element.is_virtual,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Delegate node = new Delegate (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- !element.has_target,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Enum (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue element) {
- Api.Enum parent = (Enum) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.EnumValue (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Constant node = new Constant (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element);
- node.constant_type = create_type_reference (element.type_reference, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new ErrorDomain (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_quark_macro_name (element),
- get_quark_function_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode element) {
- Api.ErrorDomain parent = (ErrorDomain) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- if (file == null) {
- file = parent.get_source_file ();
- }
-
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.ErrorCode (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (Vala.TypeParameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- Symbol node = new TypeParameter (parent,
- file,
- element.name,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (Vala.Parameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- FormalParameter node = new FormalParameter (parent,
- file,
- element.name,
- get_access_modifier(element),
- get_formal_parameter_type (element),
- element.ellipsis,
- element);
- node.parameter_type = create_type_reference (element.variable_type, node, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
-
- //
- // startpoint:
- //
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.settings = settings;
- this.reporter = reporter;
-
- this.tree = new Api.Tree (reporter, settings);
- var context = create_valac_tree (settings);
- this.tree.data = context;
-
- reporter.warnings_offset = context.report.get_warnings ();
- reporter.errors_offset = context.report.get_errors ();
-
- if (context == null) {
- return null;
- }
-
- // TODO: Register all packages here
- // register packages included by gir-files
- foreach (Vala.SourceFile vfile in context.get_source_files ()) {
- if (vfile.file_type == Vala.SourceFileType.PACKAGE
- && vfile.get_nodes ().size > 0
- && files.has_key (vfile) == false)
- {
- Package vdpkg = new Package (get_package_name (vfile.filename), true, null);
- register_source_file (register_package (vdpkg), vfile);
- }
- }
-
- context.accept(this);
-
- return (reporter.errors == 0)? tree : null;
- }
-}
-
-
diff --git a/src/driver/0.24.x/Makefile.am b/src/driver/0.24.x/Makefile.am
deleted file mode 100644
index 1331ac5d8..000000000
--- a/src/driver/0.24.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.24 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_24_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.24.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.24 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_24_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.24.x/girwriter.vala b/src/driver/0.24.x/girwriter.vala
deleted file mode 100644
index c250854d6..000000000
--- a/src/driver/0.24.x/girwriter.vala
+++ /dev/null
@@ -1,204 +0,0 @@
-/* girwriter.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-
-
-/**
- * Code visitor generating .gir file for the public interface.
- */
-public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
- private GtkdocRenderer renderer;
- private SymbolResolver resolver;
-
- public GirWriter (SymbolResolver resolver) {
- this.renderer = new GtkdocRenderer ();
- this.resolver = resolver;
- }
-
- private string? translate (Content.Comment? documentation) {
- if (documentation == null) {
- return null;
- }
-
- renderer.render_symbol (documentation);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- private string? translate_taglet (Content.Taglet? taglet) {
- if (taglet == null) {
- return null;
- }
-
- renderer.render_children (taglet);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- protected override string? get_interface_comment (Vala.Interface viface) {
- Interface iface = resolver.resolve (viface) as Interface;
- return translate (iface.documentation);
- }
-
- protected override string? get_struct_comment (Vala.Struct vst) {
- Struct st = resolver.resolve (vst) as Struct;
- return translate (st.documentation);
- }
-
- protected override string? get_enum_comment (Vala.Enum ven) {
- Enum en = resolver.resolve (ven) as Enum;
- return translate (en.documentation);
- }
-
- protected override string? get_class_comment (Vala.Class vc) {
- Class c = resolver.resolve (vc) as Class;
- return translate (c.documentation);
- }
-
- protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
- ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
- return translate (ecode.documentation);
- }
-
- protected override string? get_enum_value_comment (Vala.EnumValue vev) {
- Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
- return translate (ev.documentation);
- }
-
- protected override string? get_constant_comment (Vala.Constant vc) {
- Constant c = resolver.resolve (vc) as Constant;
- return translate (c.documentation);
- }
-
- protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
- ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
- return translate (edomain.documentation);
- }
-
- protected override string? get_field_comment (Vala.Field vf) {
- Field f = resolver.resolve (vf) as Field;
- return translate (f.documentation);
- }
-
- protected override string? get_delegate_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- return translate (cb.documentation);
- }
-
- protected override string? get_method_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- return translate (m.documentation);
- }
-
- protected override string? get_property_comment (Vala.Property vprop) {
- Property prop = resolver.resolve (vprop) as Property;
- return translate (prop.documentation);
- }
-
- protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- if (cb.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = cb.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_return_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- if (sig.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = sig.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_method_return_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- if (m.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = m.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- return translate (sig.documentation);
- }
-
- protected override string? get_parameter_comment (Vala.Parameter param) {
- Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
- if (symbol == null) {
- return null;
- }
-
- Content.Comment? documentation = symbol.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
- foreach (Content.Taglet _taglet in taglets) {
- Taglets.Param taglet = (Taglets.Param) _taglet;
- if (taglet.parameter_name == param.name) {
- return translate_taglet (taglet);
- }
- }
-
- return null;
- }
-}
-
-
diff --git a/src/driver/0.24.x/initializerbuilder.vala b/src/driver/0.24.x/initializerbuilder.vala
deleted file mode 100644
index 7b26ab51f..000000000
--- a/src/driver/0.24.x/initializerbuilder.vala
+++ /dev/null
@@ -1,669 +0,0 @@
-/* initializerbuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Content;
-using Gee;
-
-
-private class Valadoc.Api.InitializerBuilder : Vala.CodeVisitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private SignatureBuilder signature;
-
- private Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void write_node (Vala.Symbol vsymbol) {
- signature.append_symbol (resolve (vsymbol));
- }
-
- private void write_type (Vala.DataType vsymbol) {
- if (vsymbol.data_type != null) {
- write_node (vsymbol.data_type);
- } else {
- signature.append_literal ("null");
- }
-
- var type_args = vsymbol.get_type_arguments ();
- if (type_args.size > 0) {
- signature.append ("<");
- bool first = true;
- foreach (Vala.DataType type_arg in type_args) {
- if (!first) {
- signature.append (",");
- } else {
- first = false;
- }
- if (!type_arg.value_owned) {
- signature.append_keyword ("weak");
- }
- signature.append (type_arg.to_qualified_string (null));
- }
- signature.append (">");
- }
-
- if (vsymbol.nullable) {
- signature.append ("?");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_array_creation_expression (Vala.ArrayCreationExpression expr) {
- signature.append_keyword ("new");
- write_type (expr.element_type);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression size in expr.get_sizes ()) {
- if (!first) {
- signature.append (", ", false);
- }
- size.accept (this);
- first = false;
- }
-
- signature.append ("]", false);
-
- if (expr.initializer_list != null) {
- signature.append (" ", false);
- expr.initializer_list.accept (this);
- }
- }
-
- public InitializerBuilder (SignatureBuilder signature, HashMap<Vala.Symbol, Symbol> symbol_map) {
- this.symbol_map = symbol_map;
- this.signature = signature;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_binary_expression (Vala.BinaryExpression expr) {
- expr.left.accept (this);
-
- switch (expr.operator) {
- case Vala.BinaryOperator.PLUS:
- signature.append ("+ ");
- break;
-
- case Vala.BinaryOperator.MINUS:
- signature.append ("- ");
- break;
-
- case Vala.BinaryOperator.MUL:
- signature.append ("* ");
- break;
-
- case Vala.BinaryOperator.DIV:
- signature.append ("/ ");
- break;
-
- case Vala.BinaryOperator.MOD:
- signature.append ("% ");
- break;
-
- case Vala.BinaryOperator.SHIFT_LEFT:
- signature.append ("<< ");
- break;
-
- case Vala.BinaryOperator.SHIFT_RIGHT:
- signature.append (">> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN:
- signature.append ("< ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN:
- signature.append ("> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN_OR_EQUAL:
- signature.append ("<= ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN_OR_EQUAL:
- signature.append (">= ");
- break;
-
- case Vala.BinaryOperator.EQUALITY:
- signature.append ("== ");
- break;
-
- case Vala.BinaryOperator.INEQUALITY:
- signature.append ("!= ");
- break;
-
- case Vala.BinaryOperator.BITWISE_AND:
- signature.append ("& ");
- break;
-
- case Vala.BinaryOperator.BITWISE_OR:
- signature.append ("| ");
- break;
-
- case Vala.BinaryOperator.BITWISE_XOR:
- signature.append ("^ ");
- break;
-
- case Vala.BinaryOperator.AND:
- signature.append ("&& ");
- break;
-
- case Vala.BinaryOperator.OR:
- signature.append ("|| ");
- break;
-
- case Vala.BinaryOperator.IN:
- signature.append_keyword ("in");
- signature.append (" ");
- break;
-
- case Vala.BinaryOperator.COALESCE:
- signature.append ("?? ");
- break;
-
- default:
- assert_not_reached ();
- }
-
- expr.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_unary_expression (Vala.UnaryExpression expr) {
- switch (expr.operator) {
- case Vala.UnaryOperator.PLUS:
- signature.append ("+");
- break;
-
- case Vala.UnaryOperator.MINUS:
- signature.append ("-");
- break;
-
- case Vala.UnaryOperator.LOGICAL_NEGATION:
- signature.append ("!");
- break;
-
- case Vala.UnaryOperator.BITWISE_COMPLEMENT:
- signature.append ("~");
- break;
-
- case Vala.UnaryOperator.INCREMENT:
- signature.append ("++");
- break;
-
- case Vala.UnaryOperator.DECREMENT:
- signature.append ("--");
- break;
-
- case Vala.UnaryOperator.REF:
- signature.append_keyword ("ref");
- break;
-
- case Vala.UnaryOperator.OUT:
- signature.append_keyword ("out");
- break;
-
- default:
- assert_not_reached ();
- }
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_assignment (Vala.Assignment a) {
- a.left.accept (this);
-
- switch (a.operator) {
- case Vala.AssignmentOperator.SIMPLE:
- signature.append ("=");
- break;
-
- case Vala.AssignmentOperator.BITWISE_OR:
- signature.append ("|");
- break;
-
- case Vala.AssignmentOperator.BITWISE_AND:
- signature.append ("&");
- break;
-
- case Vala.AssignmentOperator.BITWISE_XOR:
- signature.append ("^");
- break;
-
- case Vala.AssignmentOperator.ADD:
- signature.append ("+");
- break;
-
- case Vala.AssignmentOperator.SUB:
- signature.append ("-");
- break;
-
- case Vala.AssignmentOperator.MUL:
- signature.append ("*");
- break;
-
- case Vala.AssignmentOperator.DIV:
- signature.append ("/");
- break;
-
- case Vala.AssignmentOperator.PERCENT:
- signature.append ("%");
- break;
-
- case Vala.AssignmentOperator.SHIFT_LEFT:
- signature.append ("<<");
- break;
-
- case Vala.AssignmentOperator.SHIFT_RIGHT:
- signature.append (">>");
- break;
-
- default:
- assert_not_reached ();
- }
-
- a.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_cast_expression (Vala.CastExpression expr) {
- if (expr.is_non_null_cast) {
- signature.append ("(!)");
- expr.inner.accept (this);
- return;
- }
-
- if (!expr.is_silent_cast) {
- signature.append ("(", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- expr.inner.accept (this);
-
- if (expr.is_silent_cast) {
- signature.append_keyword ("as");
- write_type (expr.type_reference);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_initializer_list (Vala.InitializerList list) {
- signature.append ("{", false);
-
- bool first = true;
- foreach (Vala.Expression initializer in list.get_initializers ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
- initializer.accept (this);
- }
-
- signature.append ("}", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_member_access (Vala.MemberAccess expr) {
- if (expr.symbol_reference != null) {
- expr.symbol_reference.accept (this);
- } else {
- signature.append (expr.member_name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_element_access (Vala.ElementAccess expr) {
- expr.container.accept (this);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression index in expr.get_indices ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
-
- index.accept (this);
- }
-
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_pointer_indirection (Vala.PointerIndirection expr) {
- signature.append ("*", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_addressof_expression (Vala.AddressofExpression expr) {
- signature.append ("&", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_reference_transfer_expression (Vala.ReferenceTransferExpression expr) {
- signature.append ("(", false).append_keyword ("owned", false).append (")", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_check (Vala.TypeCheck expr) {
- expr.expression.accept (this);
- signature.append_keyword ("is");
- write_type (expr.type_reference);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method_call (Vala.MethodCall expr) {
- // symbol-name:
- expr.call.symbol_reference.accept (this);
-
- // parameters:
- signature.append (" (", false);
- bool first = true;
- foreach (Vala.Expression literal in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
-
- literal.accept (this);
- first = false;
- }
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_slice_expression (Vala.SliceExpression expr) {
- expr.container.accept (this);
- signature.append ("[", false);
- expr.start.accept (this);
- signature.append (":", false);
- expr.stop.accept (this);
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_base_access (Vala.BaseAccess expr) {
- signature.append_keyword ("base", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_postfix_expression (Vala.PostfixExpression expr) {
- expr.inner.accept (this);
- if (expr.increment) {
- signature.append ("++", false);
- } else {
- signature.append ("--", false);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_object_creation_expression (Vala.ObjectCreationExpression expr) {
- if (!expr.struct_creation) {
- signature.append_keyword ("new");
- }
-
- signature.append_symbol (resolve (expr.symbol_reference));
-
- signature.append (" (", false);
-
- //TODO: rm conditional space
- bool first = true;
- foreach (Vala.Expression arg in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
- arg.accept (this);
- first = false;
- }
-
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_sizeof_expression (Vala.SizeofExpression expr) {
- signature.append_keyword ("sizeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_typeof_expression (Vala.TypeofExpression expr) {
- signature.append_keyword ("typeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_lambda_expression (Vala.LambdaExpression expr) {
- signature.append ("(", false);
-
- bool first = true;
- foreach (Vala.Parameter param in expr.get_parameters ()) {
- if (!first) {
- signature.append (", ", false);
- }
- signature.append (param.name, false);
- first = false;
- }
-
-
- signature.append (") => {", false);
- signature.append_highlighted (" [...] ", false);
- signature.append ("}", false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_boolean_literal (Vala.BooleanLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_character_literal (Vala.CharacterLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_integer_literal (Vala.IntegerLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_real_literal (Vala.RealLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_regex_literal (Vala.RegexLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_string_literal (Vala.StringLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_null_literal (Vala.NullLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field field) {
- write_node (field);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant constant) {
- write_node (constant);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue ev) {
- write_node (ev);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode ec) {
- write_node (ec);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate d) {
- write_node (d);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal sig) {
- write_node (sig);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class c) {
- write_node (c);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct s) {
- write_node (s);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface i) {
- write_node (i);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum en) {
- write_node (en);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain ed) {
- write_node (ed);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property prop) {
- write_node (prop);
- }
-}
-
diff --git a/src/driver/0.24.x/symbolresolver.vala b/src/driver/0.24.x/symbolresolver.vala
deleted file mode 100644
index 4adc06b1a..000000000
--- a/src/driver/0.24.x/symbolresolver.vala
+++ /dev/null
@@ -1,323 +0,0 @@
-/* symbolresolver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-public class Valadoc.Drivers.SymbolResolver : Visitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private Valadoc.Api.Class glib_error;
- private Api.Tree root;
-
- public SymbolResolver (TreeBuilder builder) {
- this.symbol_map = builder.get_symbol_map ();
- this.glib_error = builder.get_glib_error ();
- }
-
- public Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void resolve_thrown_list (Symbol symbol, Vala.List<Vala.DataType> types) {
- foreach (Vala.DataType type in types) {
- Vala.ErrorDomain vala_edom = (Vala.ErrorDomain) type.data_type;
- Symbol? edom = symbol_map.get (vala_edom);
- symbol.add_child (edom ?? glib_error);
- }
- }
-
- private void resolve_array_type_references (Api.Array ptr) {
- Api.Item data_type = ptr.data_type;
- if (data_type == null) {
- // void
- } else if (data_type is Api.Array) {
- resolve_array_type_references ((Api.Array) data_type);
- } else if (data_type is Pointer) {
- resolve_pointer_type_references ((Api.Pointer) data_type);
- } else {
- resolve_type_reference ((TypeReference) data_type);
- }
- }
-
- private void resolve_pointer_type_references (Pointer ptr) {
- Api.Item type = ptr.data_type;
- if (type == null) {
- // void
- } else if (type is Api.Array) {
- resolve_array_type_references ((Api.Array) type);
- } else if (type is Pointer) {
- resolve_pointer_type_references ((Pointer) type);
- } else {
- resolve_type_reference ((TypeReference) type);
- }
- }
-
- private void resolve_type_reference (TypeReference reference) {
- Vala.DataType vtyperef = (Vala.DataType) reference.data;
- if (vtyperef is Vala.ErrorType) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
- if (verrdom != null) {
- reference.data_type = resolve (verrdom);
- } else {
- reference.data_type = glib_error;
- }
- } else if (vtyperef is Vala.DelegateType) {
- reference.data_type = resolve (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else if (vtyperef is Vala.GenericType) {
- reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
- } else if (vtyperef.data_type != null) {
- reference.data_type = resolve (vtyperef.data_type);
- }
-
- // Type parameters:
- foreach (TypeReference type_param_ref in reference.get_type_arguments ()) {
- resolve_type_reference (type_param_ref);
- }
-
- if (reference.data_type is Pointer) {
- resolve_pointer_type_references ((Pointer)reference.data_type);
- } else if (reference.data_type is Api.Array) {
- resolve_array_type_references ((Api.Array)reference.data_type);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_tree (Api.Tree item) {
- this.root = item;
- item.accept_children (this);
- this.root = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_package (Package item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Namespace item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Interface item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (var type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Class item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (TypeReference type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Struct item) {
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Property item) {
- Vala.Property vala_property = item.data as Vala.Property;
- Vala.Property? base_vala_property = null;
-
- if (vala_property.base_property != null) {
- base_vala_property = vala_property.base_property;
- } else if (vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property == vala_property && vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property != null) {
- item.base_property = (Property?) resolve (base_vala_property);
- }
-
- resolve_type_reference (item.property_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Field item) {
- resolve_type_reference (item.field_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Constant item) {
- resolve_type_reference (item.constant_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Delegate item) {
- Vala.Delegate vala_delegate = item.data as Vala.Delegate;
-
- resolve_type_reference (item.return_type);
-
- resolve_thrown_list (item, vala_delegate.get_error_types ());
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Api.Signal item) {
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Method item) {
- Vala.Method vala_method = item.data as Vala.Method;
- Vala.Method? base_vala_method = null;
- if (vala_method.base_method != null) {
- base_vala_method = vala_method.base_method;
- } else if (vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method == vala_method && vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method != null) {
- item.base_method = (Method?) resolve (base_vala_method);
- }
-
- resolve_thrown_list (item, vala_method.get_error_types ());
-
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (TypeParameter item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (FormalParameter item) {
- if (item.ellipsis) {
- return;
- }
-
- if (((Vala.Parameter) item.data).initializer != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.Parameter) item.data).initializer.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- resolve_type_reference (item.parameter_type);
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (ErrorDomain item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (ErrorCode item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Enum item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Api.EnumValue item) {
-
- if (((Vala.EnumValue) item.data).value != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.EnumValue) item.data).value.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- item.accept_all_children (this, false);
- }
-}
-
-
-
diff --git a/src/driver/0.24.x/treebuilder.vala b/src/driver/0.24.x/treebuilder.vala
deleted file mode 100644
index 591109795..000000000
--- a/src/driver/0.24.x/treebuilder.vala
+++ /dev/null
@@ -1,1524 +0,0 @@
-/* treebuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-using Gee;
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
- private ArrayList<PackageMetaData> packages = new ArrayList<PackageMetaData> ();
- private PackageMetaData source_package;
-
- private HashMap<Vala.SourceFile, SourceFile> files = new HashMap<Vala.SourceFile, SourceFile> ();
- private HashMap<Vala.Symbol, Symbol> symbol_map = new HashMap<Vala.Symbol, Symbol> ();
-
- private ErrorReporter reporter;
- private Settings settings;
-
- private Api.Node current_node;
- private Api.Tree tree;
-
- private Valadoc.Api.Class glib_error = null;
-
-
- //
- // Accessors
- //
-
- public Api.Class get_glib_error () {
- return glib_error;
- }
-
- public HashMap<Vala.Symbol, Symbol> get_symbol_map () {
- return symbol_map;
- }
-
-
- //
- //
- //
-
- private class PackageMetaData {
- public Package package;
- public HashMap<Vala.Namespace, Namespace> namespaces = new HashMap<Vala.Namespace, Namespace> ();
- public ArrayList<Vala.SourceFile> files = new ArrayList<Vala.SourceFile> ();
-
- public PackageMetaData (Package package) {
- this.package = package;
- }
-
- public Namespace get_namespace (Vala.Namespace vns, SourceFile file) {
- Namespace? ns = namespaces.get (vns);
- if (ns != null) {
- return ns;
- }
-
- // find documentation comment if existing:
- SourceComment? comment = null;
- if (vns.source_reference != null) {
- foreach (Vala.Comment c in vns.get_comments()) {
- if (c.source_reference.file == file.data ||
- (c.source_reference.file.file_type == Vala.SourceFileType.SOURCE
- && ((Vala.SourceFile) file.data).file_type == Vala.SourceFileType.SOURCE)
- ) {
- Vala.SourceReference pos = c.source_reference;
- if (c is Vala.GirComment) {
- comment = new GirSourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- } else {
- comment = new SourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- break;
- }
- }
- }
-
- // find parent if existing
- var parent_vns = vns.parent_symbol;
-
- if (parent_vns == null) {
- ns = new Namespace (package, file, vns.name, comment, vns);
- package.add_child (ns);
- } else {
- Namespace parent_ns = get_namespace ((Vala.Namespace) parent_vns, file);
- ns = new Namespace (parent_ns, file, vns.name, comment, vns);
- parent_ns.add_child (ns);
- }
-
- namespaces.set (vns, ns);
- return ns;
- }
-
- public void register_source_file (Vala.SourceFile file) {
- files.add (file);
- }
-
- public bool is_package_for_file (Vala.SourceFile source_file) {
- if (source_file.file_type == Vala.SourceFileType.SOURCE && !package.is_package) {
- return true;
- }
-
- return files.contains (source_file);
- }
- }
-
-
- //
- // Type constructor translation helpers:
- //
-
- private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
- Pointer ptr = new Pointer (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.base_type;
- if (vntype is Vala.PointerType) {
- ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
- } else if (vntype is Vala.ArrayType) {
- ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
- } else {
- ptr.data_type = create_type_reference (vntype, ptr, caller);
- }
-
- return ptr;
- }
-
- private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
- Api.Array arr = new Api.Array (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.element_type;
- if (vntype is Vala.ArrayType) {
- arr.data_type = create_array ((Vala.ArrayType) vntype, arr, caller);
- } else {
- arr.data_type = create_type_reference (vntype, arr, caller);
- }
-
- return arr;
- }
-
- private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
- bool is_nullable = vtyperef != null
- && vtyperef.nullable
- && !(vtyperef is Vala.GenericType)
- && !(vtyperef is Vala.PointerType);
- string? signature = (vtyperef != null
- && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
- bool pass_ownership = type_reference_pass_ownership (vtyperef);
- Ownership ownership = get_type_reference_ownership (vtyperef);
- bool is_dynamic = vtyperef != null && vtyperef.is_dynamic;
-
- TypeReference type_ref = new TypeReference (parent,
- ownership,
- pass_ownership,
- is_dynamic,
- is_nullable,
- signature,
- vtyperef);
-
- if (vtyperef is Vala.PointerType) {
- type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef, type_ref, caller);
- } else if (vtyperef is Vala.ArrayType) {
- type_ref.data_type = create_array ((Vala.ArrayType) vtyperef, type_ref, caller);
- //} else if (vtyperef is Vala.GenericType) {
- // type_ref.data_type = new TypeParameter (caller,
- // caller.get_source_file (),
- // ((Vala.GenericType) vtyperef).type_parameter.name,
- // vtyperef);
- }
-
- // type parameters:
- if (vtyperef != null) {
- foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
- var type_param = create_type_reference (vdtype, type_ref, caller);
- type_ref.add_type_argument (type_param);
- }
- }
-
- return type_ref;
- }
-
-
-
- //
- // Translation helpers:
- //
-
- private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
- // attributes without arguments:
- string[] attributes = {
- "ReturnsModifiedPointer",
- "DestroysInstance",
- "GenericAccessors",
- "NoAccessorMethod",
- "NoArrayLength",
- "Experimental",
- "Diagnostics",
- "PrintfFormat",
- "PointerType",
- "ScanfFormat",
- "ThreadLocal",
- "SimpleType",
- "HasEmitter",
- "ModuleInit",
- "NoWrapper",
- "Immutable",
- "ErrorBase",
- "NoReturn",
- "NoThrow",
- "Compact",
- "Assert",
- "Flags"
- };
-
- string? tmp = "";
-
- foreach (Vala.Attribute att in lst) {
- if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- new_attribute.add_boolean ("has_target", false, att);
- parent.add_attribute (new_attribute);
- } else if (att.name == "Deprecated") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
-
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- } else if (att.name in attributes) {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- }
- }
- }
-
- private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
- }
-
- private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
- }
-
- private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
- }
-
- private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
- }
-
- private string? get_finalize_function_name (Vala.Class element) {
- if (!element.is_fundamental ()) {
- return null;
- }
-
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_free_function_name (Vala.Class element) {
- if (!element.is_compact) {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
- }
-
- private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
- }
-
- private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
- }
-
- private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
- }
-
- private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
- }
-
-
- private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
- }
-
- private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
- }
-
- private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
- }
-
- private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
- }
-
- private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
- }
-
- private string? get_nick (Vala.Property prop) {
- return Vala.CCodeBaseModule.get_ccode_nick (prop);
- }
-
- private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
- }
-
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- if (comment is Vala.GirComment) {
- var tmp = new GirSourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- if (((Vala.GirComment) comment).return_content != null) {
- Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
- tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content,
- file,
- return_pos.begin.line,
- return_pos.begin.column,
- return_pos.end.line,
- return_pos.end.column);
- }
-
- Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
- while (it.next ()) {
- Vala.Comment vala_param = it.get_value ();
- Vala.SourceReference param_pos = vala_param.source_reference;
- var param_comment = new SourceComment (vala_param.content,
- file,
- param_pos.begin.line,
- param_pos.begin.column,
- param_pos.end.line,
- param_pos.end.column);
- tmp.add_parameter_content (it.get_key (), param_comment);
- }
- return tmp;
- } else {
- return new SourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- }
-
- return null;
- }
-
- private string get_method_name (Vala.Method element) {
- if (element is Vala.CreationMethod) {
- if (element.name == ".new") {
- return element.parent_symbol.name;
- } else {
- return element.parent_symbol.name + "." + element.name;
- }
- }
-
- return element.name;
- }
-
- private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- }
-
- private string? get_private_cname (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- string? cname = get_cname (element);
- return (cname != null)? cname + "Private" : null;
- }
-
- private string? get_class_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_class_type_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
- return (name != null && name != "")? name : null;
- }
-
- private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
- string? name = get_is_type_macro_name (element);
- return (name != null)? name + "_CLASS" : null;
- }
-
- private string? get_type_function_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_type_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
- }
-
- private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && !((Vala.Class) element).is_compact)
- || element is Vala.Interface)
- {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- } else {
- return null;
- }
- }
-
- private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
- }
-
- private PackageMetaData? get_package_meta_data (Package pkg) {
- foreach (PackageMetaData data in packages) {
- if (data.package == pkg) {
- return data;
- }
- }
-
- return null;
- }
-
- private PackageMetaData register_package (Package package) {
- PackageMetaData meta_data = new PackageMetaData (package);
- tree.add_package (package);
- packages.add (meta_data);
- return meta_data;
- }
-
- private SourceFile register_source_file (PackageMetaData meta_data, Vala.SourceFile source_file) {
- SourceFile file = new SourceFile (meta_data.package,
- source_file.get_relative_filename (),
- source_file.get_csource_filename (),
- source_file);
- files.set (source_file, file);
-
- meta_data.register_source_file (source_file);
- return file;
- }
-
- private SourceFile? get_source_file (Vala.Symbol symbol) {
- Vala.SourceReference source_ref = symbol.source_reference;
- if (source_ref == null) {
- return null;
- }
-
- SourceFile? file = files.get (source_ref.file);
- assert (file != null);
- return file;
- }
-
- private Package? find_package_for_file (Vala.SourceFile source_file) {
- foreach (PackageMetaData pkg in this.packages) {
- if (pkg.is_package_for_file (source_file)) {
- return pkg.package;
- }
- }
-
- return null;
- }
-
-
- private Namespace get_namespace (Package pkg, Vala.Symbol symbol, SourceFile? file) {
- // Find the closest namespace in our vala-tree
- Vala.Symbol namespace_symbol = symbol;
- while (!(namespace_symbol is Vala.Namespace)) {
- namespace_symbol = namespace_symbol.parent_symbol;
- }
-
- PackageMetaData? meta_data = get_package_meta_data (pkg);
- assert (meta_data != null);
-
- return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
- }
-
- private MethodBindingType get_method_binding_type (Vala.Method element) {
- if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.is_abstract) {
- return MethodBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return MethodBindingType.VIRTUAL;
- } else if (element.overrides) {
- return MethodBindingType.OVERRIDE;
- } else if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.binding != Vala.MemberBinding.INSTANCE) {
- return MethodBindingType.STATIC;
- }
- return MethodBindingType.UNMODIFIED;
- }
-
-
- private SymbolAccessibility get_access_modifier(Vala.Symbol symbol) {
- switch (symbol.access) {
- case Vala.SymbolAccessibility.PROTECTED:
- return SymbolAccessibility.PROTECTED;
-
- case Vala.SymbolAccessibility.INTERNAL:
- return SymbolAccessibility.INTERNAL;
-
- case Vala.SymbolAccessibility.PRIVATE:
- return SymbolAccessibility.PRIVATE;
-
- case Vala.SymbolAccessibility.PUBLIC:
- return SymbolAccessibility.PUBLIC;
-
- default:
- error ("Unknown symbol accessibility modifier found");
- }
- }
-
- private PropertyAccessorType get_property_accessor_type (Vala.PropertyAccessor element) {
- if (element.construction) {
- if (element.writable) {
- return (PropertyAccessorType.CONSTRUCT | PropertyAccessorType.SET);
- }
- return PropertyAccessorType.CONSTRUCT;
- } else if (element.writable) {
- return PropertyAccessorType.SET;
- } else if (element.readable) {
- return PropertyAccessorType.GET;
- }
-
- error ("Unknown symbol accessibility type");
- }
-
- private bool type_reference_pass_ownership (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode? node = element.parent_node;
- if (node == null) {
- return false;
- }
- if (node is Vala.Parameter) {
- return (((Vala.Parameter)node).direction == Vala.ParameterDirection.IN &&
- ((Vala.Parameter)node).variable_type.value_owned);
- }
- if (node is Vala.Property) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_unowned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are weak, not unowned
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true)
- {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)
- ? element.is_weak ()
- : false;
- }
-
- private bool is_type_reference_owned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode parent = element.parent_node;
-
- // parameter:
- if (parent is Vala.Parameter) {
- if (((Vala.Parameter)parent).direction != Vala.ParameterDirection.IN) {
- return false;
- }
- return ((Vala.Parameter)parent).variable_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_weak (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are unowned, not weak
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false)
- {
- return false;
- }
-
- // arrays are unowned, not weak
- if (element is Vala.ArrayType) {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)? element.is_weak () : false;
- }
-
- private Ownership get_type_reference_ownership (Vala.DataType? element) {
- if (is_type_reference_owned (element)) {
- return Ownership.OWNED;
- } else if (is_type_reference_weak (element)) {
- return Ownership.WEAK;
- } else if (is_type_reference_unowned (element)) {
- return Ownership.UNOWNED;
- }
-
- return Ownership.DEFAULT;
- }
-
- private Ownership get_property_ownership (Vala.PropertyAccessor element) {
- if (element.value_type.value_owned) {
- return Ownership.OWNED;
- }
-
- // the exact type (weak, unowned) does not matter
- return Ownership.UNOWNED;
- }
-
- private PropertyBindingType get_property_binding_type (Vala.Property element) {
- if (element.is_abstract) {
- return PropertyBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return PropertyBindingType.VIRTUAL;
- } else if (element.overrides) {
- return PropertyBindingType.OVERRIDE;
- }
-
- return PropertyBindingType.UNMODIFIED;
- }
-
- private FormalParameterType get_formal_parameter_type (Vala.Parameter element) {
- if (element.direction == Vala.ParameterDirection.OUT) {
- return FormalParameterType.OUT;
- } else if (element.direction == Vala.ParameterDirection.REF) {
- return FormalParameterType.REF;
- } else if (element.direction == Vala.ParameterDirection.IN) {
- return FormalParameterType.IN;
- }
-
- error ("Unknown formal parameter type");
- }
-
-
- //
- // Vala tree creation:
- //
-
- private string get_package_name (string path) {
- string file_name = Path.get_basename (path);
- return file_name.substring (0, file_name.last_index_of_char ('.'));
- }
-
- private bool add_package (Vala.CodeContext context, string pkg) {
- // ignore multiple occurences of the same package
- if (context.has_package (pkg)) {
- return true;
- }
-
- string vapi_name = pkg + ".vapi";
- string gir_name = pkg + ".gir";
- foreach (string source_file in settings.source_files) {
- string basename = Path.get_basename (source_file);
- if (basename == vapi_name || basename == gir_name) {
- return true;
- }
- }
-
-
- var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
- if (package_path == null) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
- return false;
- }
-
- context.add_package (pkg);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
- context.add_source_file (vfile);
- Package vdpkg = new Package (pkg, true, null);
- register_source_file (register_package (vdpkg), vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)), pkg);
- return true;
- }
-
- private void add_deps (Vala.CodeContext context, string file_path, string pkg_name) {
- if (FileUtils.test (file_path, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (file_path, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep = dep.strip ();
- if (dep != "") {
- if (!add_package (context, dep)) {
- Vala.Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg_name));
- }
- }
- }
- } catch (FileError e) {
- Vala.Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
- }
-
- /**
- * Adds the specified packages to the list of used packages.
- *
- * @param context The code context
- * @param packages a list of package names
- */
- private void add_depencies (Vala.CodeContext context, string[] packages) {
- foreach (string package in packages) {
- if (!add_package (context, package)) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
- }
- }
- }
-
- /**
- * Add the specified source file to the context. Only .vala, .vapi, .gs,
- * and .c files are supported.
- */
- private void add_documented_files (Vala.CodeContext context, string[] sources) {
- if (sources == null) {
- return;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, source_file);
-
- if (context.profile == Vala.Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- context.root.add_using_directive (ns_ref);
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) {
- string file_name = get_package_name (source);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
- context.add_source_file (vfile);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (source), "%s.deps".printf (file_name)), file_name);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- tree.add_external_c_files (rpath);
- } else {
- Vala.Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Vala.Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- private Vala.CodeContext create_valac_tree (Settings settings) {
- // init context:
- var context = new Vala.CodeContext ();
- Vala.CodeContext.push (context);
-
-
- // settings:
- context.experimental = settings.experimental;
- context.experimental_non_null = settings.experimental || settings.experimental_non_null;
- context.vapi_directories = settings.vapi_directories;
- context.report.enable_warnings = settings.verbose;
- context.metadata_directories = settings.metadata_directories;
- context.gir_directories = settings.gir_directories;
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
-
- // add default packages:
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Vala.Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- for (int i = 2; i <= 24; i += 2) {
- context.add_define ("VALA_0_%d".printf (i));
- }
-
- if (context.profile == Vala.Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 12;
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- if (settings.target_glib != null && settings.target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
- Vala.Report.error (null, "Invalid format for --target-glib");
- }
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
-
- // default packages
- if (!this.add_package (context, "glib-2.0")) { //
- Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package (context, "gobject-2.0")) { //
- Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
-
- // add user defined files:
- add_depencies (context, settings.packages);
- if (reporter.errors > 0) {
- return context;
- }
-
- add_documented_files (context, settings.source_files);
- if (reporter.errors > 0) {
- return context;
- }
-
-
- // parse vala-code:
- Vala.Parser parser = new Vala.Parser ();
-
- parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- // parse gir:
- Vala.GirParser gir_parser = new Vala.GirParser ();
-
- gir_parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
-
-
- // check context:
- context.check ();
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- return context;
- }
-
-
-
- //
- // Valadoc tree creation:
- //
-
- private void process_children (Api.Node node, Vala.CodeNode element) {
- Api.Node old_node = current_node;
- current_node = node;
- element.accept_children (this);
- current_node = old_node;
- }
-
- private Api.Node get_parent_node_for (Vala.Symbol element) {
- if (current_node != null) {
- return current_node;
- }
-
- Vala.SourceFile vala_source_file = element.source_reference.file;
- Package package = find_package_for_file (vala_source_file);
- SourceFile? source_file = get_source_file (element);
-
- return get_namespace (package, element, source_file);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Vala.Namespace element) {
- element.accept_children (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_class == null && element.name == "string";
-
- Class node = new Class (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_private_cname (element),
- get_class_macro_name (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_class_type_macro_name (element),
- get_is_class_type_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- get_ccode_type_id (element),
- get_param_spec_function (element),
- get_ref_function (element),
- get_unref_function (element),
- get_free_function_name (element),
- get_finalize_function_name (element),
- get_take_value_function (element),
- get_get_value_function (element),
- get_set_value_function (element),
- element.is_fundamental (),
- element.is_abstract,
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // relations
- foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
- var type_ref = create_type_reference (vala_type_ref, node, node);
-
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else if (vala_type_ref.data_type is Vala.Class) {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
-
- // save GLib.Error
- if (glib_error == null && node.get_full_name () == "GLib.Error") {
- glib_error = node;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Interface node = new Interface (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_interface_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // prerequisites:
- foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
- TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_type == null
- && (element.is_boolean_type ()
- || element.is_floating_type ()
- || element.is_integer_type ());
-
- Struct node = new Struct (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- get_ccode_type_id (element),
- get_dup_function (element),
- get_copy_function (element),
- get_destroy_function (element),
- get_free_function (element),
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // parent type:
- Vala.ValueType? basetype = element.base_type as Vala.ValueType;
- if (basetype != null) {
- node.base_type = create_type_reference (basetype, node, node);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Field node = new Field (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element.binding == Vala.MemberBinding.STATIC,
- element.is_volatile,
- element);
- node.field_type = create_type_reference (element.variable_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Property node = new Property (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_nick (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.is_dbus_visible (element),
- get_property_binding_type (element),
- element);
- node.property_type = create_type_reference (element.property_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // Process property type
- if (element.get_accessor != null) {
- var accessor = element.get_accessor;
- node.getter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- if (element.set_accessor != null) {
- var accessor = element.set_accessor;
- node.setter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusServerModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusServerModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Api.Signal node = new Api.Signal (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- (element.default_handler != null)? get_cname (element.default_handler) : null,
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusServerModule.is_dbus_visible (element),
- element.is_virtual,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Delegate node = new Delegate (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- !element.has_target,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Enum (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue element) {
- Api.Enum parent = (Enum) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.EnumValue (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Constant node = new Constant (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element);
- node.constant_type = create_type_reference (element.type_reference, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new ErrorDomain (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_quark_macro_name (element),
- get_quark_function_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode element) {
- Api.ErrorDomain parent = (ErrorDomain) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- if (file == null) {
- file = parent.get_source_file ();
- }
-
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.ErrorCode (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (Vala.TypeParameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- Symbol node = new TypeParameter (parent,
- file,
- element.name,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (Vala.Parameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- FormalParameter node = new FormalParameter (parent,
- file,
- element.name,
- get_access_modifier(element),
- get_formal_parameter_type (element),
- element.ellipsis,
- element);
- node.parameter_type = create_type_reference (element.variable_type, node, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
-
- //
- // startpoint:
- //
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.settings = settings;
- this.reporter = reporter;
-
- this.tree = new Api.Tree (reporter, settings);
- var context = create_valac_tree (settings);
- this.tree.data = context;
-
- reporter.warnings_offset = context.report.get_warnings ();
- reporter.errors_offset = context.report.get_errors ();
-
- if (context == null) {
- return null;
- }
-
- // TODO: Register all packages here
- // register packages included by gir-files
- foreach (Vala.SourceFile vfile in context.get_source_files ()) {
- if (vfile.file_type == Vala.SourceFileType.PACKAGE
- && vfile.get_nodes ().size > 0
- && files.has_key (vfile) == false)
- {
- Package vdpkg = new Package (get_package_name (vfile.filename), true, null);
- register_source_file (register_package (vdpkg), vfile);
- }
- }
-
- context.accept(this);
-
- return (reporter.errors == 0)? tree : null;
- }
-}
-
-
diff --git a/src/driver/0.26.x/Makefile.am b/src/driver/0.26.x/Makefile.am
deleted file mode 100644
index bff3f52eb..000000000
--- a/src/driver/0.26.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.26 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_26_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.26.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.26 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_26_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.26.x/driver.vala b/src/driver/0.26.x/driver.vala
deleted file mode 100644
index 902d28d4b..000000000
--- a/src/driver/0.26.x/driver.vala
+++ /dev/null
@@ -1,70 +0,0 @@
-/* driver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
- private SymbolResolver resolver;
- private Api.Tree? tree;
-
- public void write_gir (Settings settings, ErrorReporter reporter) {
- var gir_writer = new Drivers.GirWriter (resolver);
-
- // put .gir file in current directory unless -d has been explicitly specified
- string gir_directory = ".";
- if (settings.gir_directory != null) {
- gir_directory = settings.gir_directory;
- }
-
- gir_writer.write_file ((Vala.CodeContext) tree.data,
- gir_directory,
- "%s-%s.gir".printf (settings.gir_namespace, settings.gir_version),
- settings.gir_namespace,
- settings.gir_version,
- settings.pkg_name);
- }
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- TreeBuilder builder = new TreeBuilder ();
- tree = builder.build (settings, reporter);
- if (reporter.errors > 0) {
- return null;
- }
-
- resolver = new SymbolResolver (builder);
- tree.accept (resolver);
-
- return tree;
- }
-}
-
-
-public Type register_plugin (Valadoc.ModuleLoader module_loader) {
- return typeof (Valadoc.Drivers.Driver);
-}
-
diff --git a/src/driver/0.26.x/girwriter.vala b/src/driver/0.26.x/girwriter.vala
deleted file mode 100644
index c250854d6..000000000
--- a/src/driver/0.26.x/girwriter.vala
+++ /dev/null
@@ -1,204 +0,0 @@
-/* girwriter.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-
-
-/**
- * Code visitor generating .gir file for the public interface.
- */
-public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
- private GtkdocRenderer renderer;
- private SymbolResolver resolver;
-
- public GirWriter (SymbolResolver resolver) {
- this.renderer = new GtkdocRenderer ();
- this.resolver = resolver;
- }
-
- private string? translate (Content.Comment? documentation) {
- if (documentation == null) {
- return null;
- }
-
- renderer.render_symbol (documentation);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- private string? translate_taglet (Content.Taglet? taglet) {
- if (taglet == null) {
- return null;
- }
-
- renderer.render_children (taglet);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- protected override string? get_interface_comment (Vala.Interface viface) {
- Interface iface = resolver.resolve (viface) as Interface;
- return translate (iface.documentation);
- }
-
- protected override string? get_struct_comment (Vala.Struct vst) {
- Struct st = resolver.resolve (vst) as Struct;
- return translate (st.documentation);
- }
-
- protected override string? get_enum_comment (Vala.Enum ven) {
- Enum en = resolver.resolve (ven) as Enum;
- return translate (en.documentation);
- }
-
- protected override string? get_class_comment (Vala.Class vc) {
- Class c = resolver.resolve (vc) as Class;
- return translate (c.documentation);
- }
-
- protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
- ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
- return translate (ecode.documentation);
- }
-
- protected override string? get_enum_value_comment (Vala.EnumValue vev) {
- Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
- return translate (ev.documentation);
- }
-
- protected override string? get_constant_comment (Vala.Constant vc) {
- Constant c = resolver.resolve (vc) as Constant;
- return translate (c.documentation);
- }
-
- protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
- ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
- return translate (edomain.documentation);
- }
-
- protected override string? get_field_comment (Vala.Field vf) {
- Field f = resolver.resolve (vf) as Field;
- return translate (f.documentation);
- }
-
- protected override string? get_delegate_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- return translate (cb.documentation);
- }
-
- protected override string? get_method_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- return translate (m.documentation);
- }
-
- protected override string? get_property_comment (Vala.Property vprop) {
- Property prop = resolver.resolve (vprop) as Property;
- return translate (prop.documentation);
- }
-
- protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- if (cb.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = cb.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_return_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- if (sig.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = sig.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_method_return_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- if (m.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = m.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- return translate (sig.documentation);
- }
-
- protected override string? get_parameter_comment (Vala.Parameter param) {
- Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
- if (symbol == null) {
- return null;
- }
-
- Content.Comment? documentation = symbol.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
- foreach (Content.Taglet _taglet in taglets) {
- Taglets.Param taglet = (Taglets.Param) _taglet;
- if (taglet.parameter_name == param.name) {
- return translate_taglet (taglet);
- }
- }
-
- return null;
- }
-}
-
-
diff --git a/src/driver/0.26.x/initializerbuilder.vala b/src/driver/0.26.x/initializerbuilder.vala
deleted file mode 100644
index 7b26ab51f..000000000
--- a/src/driver/0.26.x/initializerbuilder.vala
+++ /dev/null
@@ -1,669 +0,0 @@
-/* initializerbuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Content;
-using Gee;
-
-
-private class Valadoc.Api.InitializerBuilder : Vala.CodeVisitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private SignatureBuilder signature;
-
- private Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void write_node (Vala.Symbol vsymbol) {
- signature.append_symbol (resolve (vsymbol));
- }
-
- private void write_type (Vala.DataType vsymbol) {
- if (vsymbol.data_type != null) {
- write_node (vsymbol.data_type);
- } else {
- signature.append_literal ("null");
- }
-
- var type_args = vsymbol.get_type_arguments ();
- if (type_args.size > 0) {
- signature.append ("<");
- bool first = true;
- foreach (Vala.DataType type_arg in type_args) {
- if (!first) {
- signature.append (",");
- } else {
- first = false;
- }
- if (!type_arg.value_owned) {
- signature.append_keyword ("weak");
- }
- signature.append (type_arg.to_qualified_string (null));
- }
- signature.append (">");
- }
-
- if (vsymbol.nullable) {
- signature.append ("?");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_array_creation_expression (Vala.ArrayCreationExpression expr) {
- signature.append_keyword ("new");
- write_type (expr.element_type);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression size in expr.get_sizes ()) {
- if (!first) {
- signature.append (", ", false);
- }
- size.accept (this);
- first = false;
- }
-
- signature.append ("]", false);
-
- if (expr.initializer_list != null) {
- signature.append (" ", false);
- expr.initializer_list.accept (this);
- }
- }
-
- public InitializerBuilder (SignatureBuilder signature, HashMap<Vala.Symbol, Symbol> symbol_map) {
- this.symbol_map = symbol_map;
- this.signature = signature;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_binary_expression (Vala.BinaryExpression expr) {
- expr.left.accept (this);
-
- switch (expr.operator) {
- case Vala.BinaryOperator.PLUS:
- signature.append ("+ ");
- break;
-
- case Vala.BinaryOperator.MINUS:
- signature.append ("- ");
- break;
-
- case Vala.BinaryOperator.MUL:
- signature.append ("* ");
- break;
-
- case Vala.BinaryOperator.DIV:
- signature.append ("/ ");
- break;
-
- case Vala.BinaryOperator.MOD:
- signature.append ("% ");
- break;
-
- case Vala.BinaryOperator.SHIFT_LEFT:
- signature.append ("<< ");
- break;
-
- case Vala.BinaryOperator.SHIFT_RIGHT:
- signature.append (">> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN:
- signature.append ("< ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN:
- signature.append ("> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN_OR_EQUAL:
- signature.append ("<= ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN_OR_EQUAL:
- signature.append (">= ");
- break;
-
- case Vala.BinaryOperator.EQUALITY:
- signature.append ("== ");
- break;
-
- case Vala.BinaryOperator.INEQUALITY:
- signature.append ("!= ");
- break;
-
- case Vala.BinaryOperator.BITWISE_AND:
- signature.append ("& ");
- break;
-
- case Vala.BinaryOperator.BITWISE_OR:
- signature.append ("| ");
- break;
-
- case Vala.BinaryOperator.BITWISE_XOR:
- signature.append ("^ ");
- break;
-
- case Vala.BinaryOperator.AND:
- signature.append ("&& ");
- break;
-
- case Vala.BinaryOperator.OR:
- signature.append ("|| ");
- break;
-
- case Vala.BinaryOperator.IN:
- signature.append_keyword ("in");
- signature.append (" ");
- break;
-
- case Vala.BinaryOperator.COALESCE:
- signature.append ("?? ");
- break;
-
- default:
- assert_not_reached ();
- }
-
- expr.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_unary_expression (Vala.UnaryExpression expr) {
- switch (expr.operator) {
- case Vala.UnaryOperator.PLUS:
- signature.append ("+");
- break;
-
- case Vala.UnaryOperator.MINUS:
- signature.append ("-");
- break;
-
- case Vala.UnaryOperator.LOGICAL_NEGATION:
- signature.append ("!");
- break;
-
- case Vala.UnaryOperator.BITWISE_COMPLEMENT:
- signature.append ("~");
- break;
-
- case Vala.UnaryOperator.INCREMENT:
- signature.append ("++");
- break;
-
- case Vala.UnaryOperator.DECREMENT:
- signature.append ("--");
- break;
-
- case Vala.UnaryOperator.REF:
- signature.append_keyword ("ref");
- break;
-
- case Vala.UnaryOperator.OUT:
- signature.append_keyword ("out");
- break;
-
- default:
- assert_not_reached ();
- }
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_assignment (Vala.Assignment a) {
- a.left.accept (this);
-
- switch (a.operator) {
- case Vala.AssignmentOperator.SIMPLE:
- signature.append ("=");
- break;
-
- case Vala.AssignmentOperator.BITWISE_OR:
- signature.append ("|");
- break;
-
- case Vala.AssignmentOperator.BITWISE_AND:
- signature.append ("&");
- break;
-
- case Vala.AssignmentOperator.BITWISE_XOR:
- signature.append ("^");
- break;
-
- case Vala.AssignmentOperator.ADD:
- signature.append ("+");
- break;
-
- case Vala.AssignmentOperator.SUB:
- signature.append ("-");
- break;
-
- case Vala.AssignmentOperator.MUL:
- signature.append ("*");
- break;
-
- case Vala.AssignmentOperator.DIV:
- signature.append ("/");
- break;
-
- case Vala.AssignmentOperator.PERCENT:
- signature.append ("%");
- break;
-
- case Vala.AssignmentOperator.SHIFT_LEFT:
- signature.append ("<<");
- break;
-
- case Vala.AssignmentOperator.SHIFT_RIGHT:
- signature.append (">>");
- break;
-
- default:
- assert_not_reached ();
- }
-
- a.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_cast_expression (Vala.CastExpression expr) {
- if (expr.is_non_null_cast) {
- signature.append ("(!)");
- expr.inner.accept (this);
- return;
- }
-
- if (!expr.is_silent_cast) {
- signature.append ("(", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- expr.inner.accept (this);
-
- if (expr.is_silent_cast) {
- signature.append_keyword ("as");
- write_type (expr.type_reference);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_initializer_list (Vala.InitializerList list) {
- signature.append ("{", false);
-
- bool first = true;
- foreach (Vala.Expression initializer in list.get_initializers ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
- initializer.accept (this);
- }
-
- signature.append ("}", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_member_access (Vala.MemberAccess expr) {
- if (expr.symbol_reference != null) {
- expr.symbol_reference.accept (this);
- } else {
- signature.append (expr.member_name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_element_access (Vala.ElementAccess expr) {
- expr.container.accept (this);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression index in expr.get_indices ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
-
- index.accept (this);
- }
-
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_pointer_indirection (Vala.PointerIndirection expr) {
- signature.append ("*", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_addressof_expression (Vala.AddressofExpression expr) {
- signature.append ("&", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_reference_transfer_expression (Vala.ReferenceTransferExpression expr) {
- signature.append ("(", false).append_keyword ("owned", false).append (")", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_check (Vala.TypeCheck expr) {
- expr.expression.accept (this);
- signature.append_keyword ("is");
- write_type (expr.type_reference);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method_call (Vala.MethodCall expr) {
- // symbol-name:
- expr.call.symbol_reference.accept (this);
-
- // parameters:
- signature.append (" (", false);
- bool first = true;
- foreach (Vala.Expression literal in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
-
- literal.accept (this);
- first = false;
- }
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_slice_expression (Vala.SliceExpression expr) {
- expr.container.accept (this);
- signature.append ("[", false);
- expr.start.accept (this);
- signature.append (":", false);
- expr.stop.accept (this);
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_base_access (Vala.BaseAccess expr) {
- signature.append_keyword ("base", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_postfix_expression (Vala.PostfixExpression expr) {
- expr.inner.accept (this);
- if (expr.increment) {
- signature.append ("++", false);
- } else {
- signature.append ("--", false);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_object_creation_expression (Vala.ObjectCreationExpression expr) {
- if (!expr.struct_creation) {
- signature.append_keyword ("new");
- }
-
- signature.append_symbol (resolve (expr.symbol_reference));
-
- signature.append (" (", false);
-
- //TODO: rm conditional space
- bool first = true;
- foreach (Vala.Expression arg in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
- arg.accept (this);
- first = false;
- }
-
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_sizeof_expression (Vala.SizeofExpression expr) {
- signature.append_keyword ("sizeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_typeof_expression (Vala.TypeofExpression expr) {
- signature.append_keyword ("typeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_lambda_expression (Vala.LambdaExpression expr) {
- signature.append ("(", false);
-
- bool first = true;
- foreach (Vala.Parameter param in expr.get_parameters ()) {
- if (!first) {
- signature.append (", ", false);
- }
- signature.append (param.name, false);
- first = false;
- }
-
-
- signature.append (") => {", false);
- signature.append_highlighted (" [...] ", false);
- signature.append ("}", false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_boolean_literal (Vala.BooleanLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_character_literal (Vala.CharacterLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_integer_literal (Vala.IntegerLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_real_literal (Vala.RealLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_regex_literal (Vala.RegexLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_string_literal (Vala.StringLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_null_literal (Vala.NullLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field field) {
- write_node (field);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant constant) {
- write_node (constant);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue ev) {
- write_node (ev);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode ec) {
- write_node (ec);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate d) {
- write_node (d);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal sig) {
- write_node (sig);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class c) {
- write_node (c);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct s) {
- write_node (s);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface i) {
- write_node (i);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum en) {
- write_node (en);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain ed) {
- write_node (ed);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property prop) {
- write_node (prop);
- }
-}
-
diff --git a/src/driver/0.26.x/symbolresolver.vala b/src/driver/0.26.x/symbolresolver.vala
deleted file mode 100644
index 4adc06b1a..000000000
--- a/src/driver/0.26.x/symbolresolver.vala
+++ /dev/null
@@ -1,323 +0,0 @@
-/* symbolresolver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-public class Valadoc.Drivers.SymbolResolver : Visitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private Valadoc.Api.Class glib_error;
- private Api.Tree root;
-
- public SymbolResolver (TreeBuilder builder) {
- this.symbol_map = builder.get_symbol_map ();
- this.glib_error = builder.get_glib_error ();
- }
-
- public Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void resolve_thrown_list (Symbol symbol, Vala.List<Vala.DataType> types) {
- foreach (Vala.DataType type in types) {
- Vala.ErrorDomain vala_edom = (Vala.ErrorDomain) type.data_type;
- Symbol? edom = symbol_map.get (vala_edom);
- symbol.add_child (edom ?? glib_error);
- }
- }
-
- private void resolve_array_type_references (Api.Array ptr) {
- Api.Item data_type = ptr.data_type;
- if (data_type == null) {
- // void
- } else if (data_type is Api.Array) {
- resolve_array_type_references ((Api.Array) data_type);
- } else if (data_type is Pointer) {
- resolve_pointer_type_references ((Api.Pointer) data_type);
- } else {
- resolve_type_reference ((TypeReference) data_type);
- }
- }
-
- private void resolve_pointer_type_references (Pointer ptr) {
- Api.Item type = ptr.data_type;
- if (type == null) {
- // void
- } else if (type is Api.Array) {
- resolve_array_type_references ((Api.Array) type);
- } else if (type is Pointer) {
- resolve_pointer_type_references ((Pointer) type);
- } else {
- resolve_type_reference ((TypeReference) type);
- }
- }
-
- private void resolve_type_reference (TypeReference reference) {
- Vala.DataType vtyperef = (Vala.DataType) reference.data;
- if (vtyperef is Vala.ErrorType) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
- if (verrdom != null) {
- reference.data_type = resolve (verrdom);
- } else {
- reference.data_type = glib_error;
- }
- } else if (vtyperef is Vala.DelegateType) {
- reference.data_type = resolve (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else if (vtyperef is Vala.GenericType) {
- reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
- } else if (vtyperef.data_type != null) {
- reference.data_type = resolve (vtyperef.data_type);
- }
-
- // Type parameters:
- foreach (TypeReference type_param_ref in reference.get_type_arguments ()) {
- resolve_type_reference (type_param_ref);
- }
-
- if (reference.data_type is Pointer) {
- resolve_pointer_type_references ((Pointer)reference.data_type);
- } else if (reference.data_type is Api.Array) {
- resolve_array_type_references ((Api.Array)reference.data_type);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_tree (Api.Tree item) {
- this.root = item;
- item.accept_children (this);
- this.root = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_package (Package item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Namespace item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Interface item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (var type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Class item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (TypeReference type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Struct item) {
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Property item) {
- Vala.Property vala_property = item.data as Vala.Property;
- Vala.Property? base_vala_property = null;
-
- if (vala_property.base_property != null) {
- base_vala_property = vala_property.base_property;
- } else if (vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property == vala_property && vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property != null) {
- item.base_property = (Property?) resolve (base_vala_property);
- }
-
- resolve_type_reference (item.property_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Field item) {
- resolve_type_reference (item.field_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Constant item) {
- resolve_type_reference (item.constant_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Delegate item) {
- Vala.Delegate vala_delegate = item.data as Vala.Delegate;
-
- resolve_type_reference (item.return_type);
-
- resolve_thrown_list (item, vala_delegate.get_error_types ());
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Api.Signal item) {
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Method item) {
- Vala.Method vala_method = item.data as Vala.Method;
- Vala.Method? base_vala_method = null;
- if (vala_method.base_method != null) {
- base_vala_method = vala_method.base_method;
- } else if (vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method == vala_method && vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method != null) {
- item.base_method = (Method?) resolve (base_vala_method);
- }
-
- resolve_thrown_list (item, vala_method.get_error_types ());
-
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (TypeParameter item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (FormalParameter item) {
- if (item.ellipsis) {
- return;
- }
-
- if (((Vala.Parameter) item.data).initializer != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.Parameter) item.data).initializer.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- resolve_type_reference (item.parameter_type);
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (ErrorDomain item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (ErrorCode item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Enum item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Api.EnumValue item) {
-
- if (((Vala.EnumValue) item.data).value != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.EnumValue) item.data).value.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- item.accept_all_children (this, false);
- }
-}
-
-
-
diff --git a/src/driver/0.26.x/treebuilder.vala b/src/driver/0.26.x/treebuilder.vala
deleted file mode 100644
index 53440a180..000000000
--- a/src/driver/0.26.x/treebuilder.vala
+++ /dev/null
@@ -1,1524 +0,0 @@
-/* treebuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-using Gee;
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
- private ArrayList<PackageMetaData> packages = new ArrayList<PackageMetaData> ();
- private PackageMetaData source_package;
-
- private HashMap<Vala.SourceFile, SourceFile> files = new HashMap<Vala.SourceFile, SourceFile> ();
- private HashMap<Vala.Symbol, Symbol> symbol_map = new HashMap<Vala.Symbol, Symbol> ();
-
- private ErrorReporter reporter;
- private Settings settings;
-
- private Api.Node current_node;
- private Api.Tree tree;
-
- private Valadoc.Api.Class glib_error = null;
-
-
- //
- // Accessors
- //
-
- public Api.Class get_glib_error () {
- return glib_error;
- }
-
- public HashMap<Vala.Symbol, Symbol> get_symbol_map () {
- return symbol_map;
- }
-
-
- //
- //
- //
-
- private class PackageMetaData {
- public Package package;
- public HashMap<Vala.Namespace, Namespace> namespaces = new HashMap<Vala.Namespace, Namespace> ();
- public ArrayList<Vala.SourceFile> files = new ArrayList<Vala.SourceFile> ();
-
- public PackageMetaData (Package package) {
- this.package = package;
- }
-
- public Namespace get_namespace (Vala.Namespace vns, SourceFile file) {
- Namespace? ns = namespaces.get (vns);
- if (ns != null) {
- return ns;
- }
-
- // find documentation comment if existing:
- SourceComment? comment = null;
- if (vns.source_reference != null) {
- foreach (Vala.Comment c in vns.get_comments()) {
- if (c.source_reference.file == file.data ||
- (c.source_reference.file.file_type == Vala.SourceFileType.SOURCE
- && ((Vala.SourceFile) file.data).file_type == Vala.SourceFileType.SOURCE)
- ) {
- Vala.SourceReference pos = c.source_reference;
- if (c is Vala.GirComment) {
- comment = new GirSourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- } else {
- comment = new SourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- break;
- }
- }
- }
-
- // find parent if existing
- var parent_vns = vns.parent_symbol;
-
- if (parent_vns == null) {
- ns = new Namespace (package, file, vns.name, comment, vns);
- package.add_child (ns);
- } else {
- Namespace parent_ns = get_namespace ((Vala.Namespace) parent_vns, file);
- ns = new Namespace (parent_ns, file, vns.name, comment, vns);
- parent_ns.add_child (ns);
- }
-
- namespaces.set (vns, ns);
- return ns;
- }
-
- public void register_source_file (Vala.SourceFile file) {
- files.add (file);
- }
-
- public bool is_package_for_file (Vala.SourceFile source_file) {
- if (source_file.file_type == Vala.SourceFileType.SOURCE && !package.is_package) {
- return true;
- }
-
- return files.contains (source_file);
- }
- }
-
-
- //
- // Type constructor translation helpers:
- //
-
- private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
- Pointer ptr = new Pointer (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.base_type;
- if (vntype is Vala.PointerType) {
- ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
- } else if (vntype is Vala.ArrayType) {
- ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
- } else {
- ptr.data_type = create_type_reference (vntype, ptr, caller);
- }
-
- return ptr;
- }
-
- private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
- Api.Array arr = new Api.Array (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.element_type;
- if (vntype is Vala.ArrayType) {
- arr.data_type = create_type_reference (vntype, arr, caller);
- } else {
- arr.data_type = create_type_reference (vntype, arr, caller);
- }
-
- return arr;
- }
-
- private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
- bool is_nullable = vtyperef != null
- && vtyperef.nullable
- && !(vtyperef is Vala.GenericType)
- && !(vtyperef is Vala.PointerType);
- string? signature = (vtyperef != null
- && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
- bool pass_ownership = type_reference_pass_ownership (vtyperef);
- Ownership ownership = get_type_reference_ownership (vtyperef);
- bool is_dynamic = vtyperef != null && vtyperef.is_dynamic;
-
- TypeReference type_ref = new TypeReference (parent,
- ownership,
- pass_ownership,
- is_dynamic,
- is_nullable,
- signature,
- vtyperef);
-
- if (vtyperef is Vala.PointerType) {
- type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef, type_ref, caller);
- } else if (vtyperef is Vala.ArrayType) {
- type_ref.data_type = create_array ((Vala.ArrayType) vtyperef, type_ref, caller);
- //} else if (vtyperef is Vala.GenericType) {
- // type_ref.data_type = new TypeParameter (caller,
- // caller.get_source_file (),
- // ((Vala.GenericType) vtyperef).type_parameter.name,
- // vtyperef);
- }
-
- // type parameters:
- if (vtyperef != null) {
- foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
- var type_param = create_type_reference (vdtype, type_ref, caller);
- type_ref.add_type_argument (type_param);
- }
- }
-
- return type_ref;
- }
-
-
-
- //
- // Translation helpers:
- //
-
- private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
- // attributes without arguments:
- string[] attributes = {
- "ReturnsModifiedPointer",
- "DestroysInstance",
- "GenericAccessors",
- "NoAccessorMethod",
- "NoArrayLength",
- "Experimental",
- "Diagnostics",
- "PrintfFormat",
- "PointerType",
- "ScanfFormat",
- "ThreadLocal",
- "SimpleType",
- "HasEmitter",
- "ModuleInit",
- "NoWrapper",
- "Immutable",
- "ErrorBase",
- "NoReturn",
- "NoThrow",
- "Compact",
- "Assert",
- "Flags"
- };
-
- string? tmp = "";
-
- foreach (Vala.Attribute att in lst) {
- if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- new_attribute.add_boolean ("has_target", false, att);
- parent.add_attribute (new_attribute);
- } else if (att.name == "Deprecated") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
-
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- } else if (att.name in attributes) {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- }
- }
- }
-
- private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
- }
-
- private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
- }
-
- private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
- }
-
- private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
- }
-
- private string? get_finalize_function_name (Vala.Class element) {
- if (!element.is_fundamental ()) {
- return null;
- }
-
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_free_function_name (Vala.Class element) {
- if (!element.is_compact) {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
- }
-
- private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
- }
-
- private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
- }
-
- private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
- }
-
- private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
- }
-
-
- private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
- }
-
- private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
- }
-
- private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
- }
-
- private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
- }
-
- private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
- }
-
- private string? get_nick (Vala.Property prop) {
- return Vala.CCodeBaseModule.get_ccode_nick (prop);
- }
-
- private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
- }
-
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- if (comment is Vala.GirComment) {
- var tmp = new GirSourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- if (((Vala.GirComment) comment).return_content != null) {
- Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
- tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content,
- file,
- return_pos.begin.line,
- return_pos.begin.column,
- return_pos.end.line,
- return_pos.end.column);
- }
-
- Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
- while (it.next ()) {
- Vala.Comment vala_param = it.get_value ();
- Vala.SourceReference param_pos = vala_param.source_reference;
- var param_comment = new SourceComment (vala_param.content,
- file,
- param_pos.begin.line,
- param_pos.begin.column,
- param_pos.end.line,
- param_pos.end.column);
- tmp.add_parameter_content (it.get_key (), param_comment);
- }
- return tmp;
- } else {
- return new SourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- }
-
- return null;
- }
-
- private string get_method_name (Vala.Method element) {
- if (element is Vala.CreationMethod) {
- if (element.name == ".new") {
- return element.parent_symbol.name;
- } else {
- return element.parent_symbol.name + "." + element.name;
- }
- }
-
- return element.name;
- }
-
- private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- }
-
- private string? get_private_cname (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- string? cname = get_cname (element);
- return (cname != null)? cname + "Private" : null;
- }
-
- private string? get_class_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_class_type_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
- return (name != null && name != "")? name : null;
- }
-
- private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
- string? name = get_is_type_macro_name (element);
- return (name != null)? name + "_CLASS" : null;
- }
-
- private string? get_type_function_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_type_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
- }
-
- private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && !((Vala.Class) element).is_compact)
- || element is Vala.Interface)
- {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- } else {
- return null;
- }
- }
-
- private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
- }
-
- private PackageMetaData? get_package_meta_data (Package pkg) {
- foreach (PackageMetaData data in packages) {
- if (data.package == pkg) {
- return data;
- }
- }
-
- return null;
- }
-
- private PackageMetaData register_package (Package package) {
- PackageMetaData meta_data = new PackageMetaData (package);
- tree.add_package (package);
- packages.add (meta_data);
- return meta_data;
- }
-
- private SourceFile register_source_file (PackageMetaData meta_data, Vala.SourceFile source_file) {
- SourceFile file = new SourceFile (meta_data.package,
- source_file.get_relative_filename (),
- source_file.get_csource_filename (),
- source_file);
- files.set (source_file, file);
-
- meta_data.register_source_file (source_file);
- return file;
- }
-
- private SourceFile? get_source_file (Vala.Symbol symbol) {
- Vala.SourceReference source_ref = symbol.source_reference;
- if (source_ref == null) {
- return null;
- }
-
- SourceFile? file = files.get (source_ref.file);
- assert (file != null);
- return file;
- }
-
- private Package? find_package_for_file (Vala.SourceFile source_file) {
- foreach (PackageMetaData pkg in this.packages) {
- if (pkg.is_package_for_file (source_file)) {
- return pkg.package;
- }
- }
-
- return null;
- }
-
-
- private Namespace get_namespace (Package pkg, Vala.Symbol symbol, SourceFile? file) {
- // Find the closest namespace in our vala-tree
- Vala.Symbol namespace_symbol = symbol;
- while (!(namespace_symbol is Vala.Namespace)) {
- namespace_symbol = namespace_symbol.parent_symbol;
- }
-
- PackageMetaData? meta_data = get_package_meta_data (pkg);
- assert (meta_data != null);
-
- return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
- }
-
- private MethodBindingType get_method_binding_type (Vala.Method element) {
- if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.is_abstract) {
- return MethodBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return MethodBindingType.VIRTUAL;
- } else if (element.overrides) {
- return MethodBindingType.OVERRIDE;
- } else if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.binding != Vala.MemberBinding.INSTANCE) {
- return MethodBindingType.STATIC;
- }
- return MethodBindingType.UNMODIFIED;
- }
-
-
- private SymbolAccessibility get_access_modifier(Vala.Symbol symbol) {
- switch (symbol.access) {
- case Vala.SymbolAccessibility.PROTECTED:
- return SymbolAccessibility.PROTECTED;
-
- case Vala.SymbolAccessibility.INTERNAL:
- return SymbolAccessibility.INTERNAL;
-
- case Vala.SymbolAccessibility.PRIVATE:
- return SymbolAccessibility.PRIVATE;
-
- case Vala.SymbolAccessibility.PUBLIC:
- return SymbolAccessibility.PUBLIC;
-
- default:
- error ("Unknown symbol accessibility modifier found");
- }
- }
-
- private PropertyAccessorType get_property_accessor_type (Vala.PropertyAccessor element) {
- if (element.construction) {
- if (element.writable) {
- return (PropertyAccessorType.CONSTRUCT | PropertyAccessorType.SET);
- }
- return PropertyAccessorType.CONSTRUCT;
- } else if (element.writable) {
- return PropertyAccessorType.SET;
- } else if (element.readable) {
- return PropertyAccessorType.GET;
- }
-
- error ("Unknown symbol accessibility type");
- }
-
- private bool type_reference_pass_ownership (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode? node = element.parent_node;
- if (node == null) {
- return false;
- }
- if (node is Vala.Parameter) {
- return (((Vala.Parameter)node).direction == Vala.ParameterDirection.IN &&
- ((Vala.Parameter)node).variable_type.value_owned);
- }
- if (node is Vala.Property) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_unowned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are weak, not unowned
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true)
- {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)
- ? element.is_weak ()
- : false;
- }
-
- private bool is_type_reference_owned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode parent = element.parent_node;
-
- // parameter:
- if (parent is Vala.Parameter) {
- if (((Vala.Parameter)parent).direction != Vala.ParameterDirection.IN) {
- return false;
- }
- return ((Vala.Parameter)parent).variable_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_weak (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are unowned, not weak
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false)
- {
- return false;
- }
-
- // arrays are unowned, not weak
- if (element is Vala.ArrayType) {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)? element.is_weak () : false;
- }
-
- private Ownership get_type_reference_ownership (Vala.DataType? element) {
- if (is_type_reference_owned (element)) {
- return Ownership.OWNED;
- } else if (is_type_reference_weak (element)) {
- return Ownership.WEAK;
- } else if (is_type_reference_unowned (element)) {
- return Ownership.UNOWNED;
- }
-
- return Ownership.DEFAULT;
- }
-
- private Ownership get_property_ownership (Vala.PropertyAccessor element) {
- if (element.value_type.value_owned) {
- return Ownership.OWNED;
- }
-
- // the exact type (weak, unowned) does not matter
- return Ownership.UNOWNED;
- }
-
- private PropertyBindingType get_property_binding_type (Vala.Property element) {
- if (element.is_abstract) {
- return PropertyBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return PropertyBindingType.VIRTUAL;
- } else if (element.overrides) {
- return PropertyBindingType.OVERRIDE;
- }
-
- return PropertyBindingType.UNMODIFIED;
- }
-
- private FormalParameterType get_formal_parameter_type (Vala.Parameter element) {
- if (element.direction == Vala.ParameterDirection.OUT) {
- return FormalParameterType.OUT;
- } else if (element.direction == Vala.ParameterDirection.REF) {
- return FormalParameterType.REF;
- } else if (element.direction == Vala.ParameterDirection.IN) {
- return FormalParameterType.IN;
- }
-
- error ("Unknown formal parameter type");
- }
-
-
- //
- // Vala tree creation:
- //
-
- private string get_package_name (string path) {
- string file_name = Path.get_basename (path);
- return file_name.substring (0, file_name.last_index_of_char ('.'));
- }
-
- private bool add_package (Vala.CodeContext context, string pkg) {
- // ignore multiple occurences of the same package
- if (context.has_package (pkg)) {
- return true;
- }
-
- string vapi_name = pkg + ".vapi";
- string gir_name = pkg + ".gir";
- foreach (string source_file in settings.source_files) {
- string basename = Path.get_basename (source_file);
- if (basename == vapi_name || basename == gir_name) {
- return true;
- }
- }
-
-
- var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
- if (package_path == null) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
- return false;
- }
-
- context.add_package (pkg);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
- context.add_source_file (vfile);
- Package vdpkg = new Package (pkg, true, null);
- register_source_file (register_package (vdpkg), vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)), pkg);
- return true;
- }
-
- private void add_deps (Vala.CodeContext context, string file_path, string pkg_name) {
- if (FileUtils.test (file_path, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (file_path, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep = dep.strip ();
- if (dep != "") {
- if (!add_package (context, dep)) {
- Vala.Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg_name));
- }
- }
- }
- } catch (FileError e) {
- Vala.Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
- }
-
- /**
- * Adds the specified packages to the list of used packages.
- *
- * @param context The code context
- * @param packages a list of package names
- */
- private void add_depencies (Vala.CodeContext context, string[] packages) {
- foreach (string package in packages) {
- if (!add_package (context, package)) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
- }
- }
- }
-
- /**
- * Add the specified source file to the context. Only .vala, .vapi, .gs,
- * and .c files are supported.
- */
- private void add_documented_files (Vala.CodeContext context, string[] sources) {
- if (sources == null) {
- return;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, source_file);
-
- if (context.profile == Vala.Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- context.root.add_using_directive (ns_ref);
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) {
- string file_name = get_package_name (source);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
- context.add_source_file (vfile);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (source), "%s.deps".printf (file_name)), file_name);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- tree.add_external_c_files (rpath);
- } else {
- Vala.Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Vala.Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- private Vala.CodeContext create_valac_tree (Settings settings) {
- // init context:
- var context = new Vala.CodeContext ();
- Vala.CodeContext.push (context);
-
-
- // settings:
- context.experimental = settings.experimental;
- context.experimental_non_null = settings.experimental || settings.experimental_non_null;
- context.vapi_directories = settings.vapi_directories;
- context.report.enable_warnings = settings.verbose;
- context.metadata_directories = settings.metadata_directories;
- context.gir_directories = settings.gir_directories;
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
-
- // add default packages:
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Vala.Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- for (int i = 2; i <= 26; i += 2) {
- context.add_define ("VALA_0_%d".printf (i));
- }
-
- if (context.profile == Vala.Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 12;
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- if (settings.target_glib != null && settings.target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
- Vala.Report.error (null, "Invalid format for --target-glib");
- }
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
-
- // default packages
- if (!this.add_package (context, "glib-2.0")) { //
- Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package (context, "gobject-2.0")) { //
- Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
-
- // add user defined files:
- add_depencies (context, settings.packages);
- if (reporter.errors > 0) {
- return context;
- }
-
- add_documented_files (context, settings.source_files);
- if (reporter.errors > 0) {
- return context;
- }
-
-
- // parse vala-code:
- Vala.Parser parser = new Vala.Parser ();
-
- parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- // parse gir:
- Vala.GirParser gir_parser = new Vala.GirParser ();
-
- gir_parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
-
-
- // check context:
- context.check ();
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- return context;
- }
-
-
-
- //
- // Valadoc tree creation:
- //
-
- private void process_children (Api.Node node, Vala.CodeNode element) {
- Api.Node old_node = current_node;
- current_node = node;
- element.accept_children (this);
- current_node = old_node;
- }
-
- private Api.Node get_parent_node_for (Vala.Symbol element) {
- if (current_node != null) {
- return current_node;
- }
-
- Vala.SourceFile vala_source_file = element.source_reference.file;
- Package package = find_package_for_file (vala_source_file);
- SourceFile? source_file = get_source_file (element);
-
- return get_namespace (package, element, source_file);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Vala.Namespace element) {
- element.accept_children (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_class == null && element.name == "string";
-
- Class node = new Class (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_private_cname (element),
- get_class_macro_name (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_class_type_macro_name (element),
- get_is_class_type_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- get_ccode_type_id (element),
- get_param_spec_function (element),
- get_ref_function (element),
- get_unref_function (element),
- get_free_function_name (element),
- get_finalize_function_name (element),
- get_take_value_function (element),
- get_get_value_function (element),
- get_set_value_function (element),
- element.is_fundamental (),
- element.is_abstract,
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // relations
- foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
- var type_ref = create_type_reference (vala_type_ref, node, node);
-
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else if (vala_type_ref.data_type is Vala.Class) {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
-
- // save GLib.Error
- if (glib_error == null && node.get_full_name () == "GLib.Error") {
- glib_error = node;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Interface node = new Interface (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_interface_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // prerequisites:
- foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
- TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_type == null
- && (element.is_boolean_type ()
- || element.is_floating_type ()
- || element.is_integer_type ());
-
- Struct node = new Struct (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- get_ccode_type_id (element),
- get_dup_function (element),
- get_copy_function (element),
- get_destroy_function (element),
- get_free_function (element),
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // parent type:
- Vala.ValueType? basetype = element.base_type as Vala.ValueType;
- if (basetype != null) {
- node.base_type = create_type_reference (basetype, node, node);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Field node = new Field (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element.binding == Vala.MemberBinding.STATIC,
- element.is_volatile,
- element);
- node.field_type = create_type_reference (element.variable_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Property node = new Property (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_nick (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- get_property_binding_type (element),
- element);
- node.property_type = create_type_reference (element.property_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // Process property type
- if (element.get_accessor != null) {
- var accessor = element.get_accessor;
- node.getter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- if (element.set_accessor != null) {
- var accessor = element.set_accessor;
- node.setter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Api.Signal node = new Api.Signal (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- (element.default_handler != null)? get_cname (element.default_handler) : null,
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- element.is_virtual,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Delegate node = new Delegate (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- !element.has_target,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Enum (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue element) {
- Api.Enum parent = (Enum) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.EnumValue (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Constant node = new Constant (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element);
- node.constant_type = create_type_reference (element.type_reference, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new ErrorDomain (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_quark_macro_name (element),
- get_quark_function_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode element) {
- Api.ErrorDomain parent = (ErrorDomain) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- if (file == null) {
- file = parent.get_source_file ();
- }
-
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.ErrorCode (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (Vala.TypeParameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- Symbol node = new TypeParameter (parent,
- file,
- element.name,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (Vala.Parameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- FormalParameter node = new FormalParameter (parent,
- file,
- element.name,
- get_access_modifier(element),
- get_formal_parameter_type (element),
- element.ellipsis,
- element);
- node.parameter_type = create_type_reference (element.variable_type, node, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
-
- //
- // startpoint:
- //
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.settings = settings;
- this.reporter = reporter;
-
- this.tree = new Api.Tree (reporter, settings);
- var context = create_valac_tree (settings);
- this.tree.data = context;
-
- reporter.warnings_offset = context.report.get_warnings ();
- reporter.errors_offset = context.report.get_errors ();
-
- if (context == null) {
- return null;
- }
-
- // TODO: Register all packages here
- // register packages included by gir-files
- foreach (Vala.SourceFile vfile in context.get_source_files ()) {
- if (vfile.file_type == Vala.SourceFileType.PACKAGE
- && vfile.get_nodes ().size > 0
- && files.has_key (vfile) == false)
- {
- Package vdpkg = new Package (get_package_name (vfile.filename), true, null);
- register_source_file (register_package (vdpkg), vfile);
- }
- }
-
- context.accept(this);
-
- return (reporter.errors == 0)? tree : null;
- }
-}
-
-
diff --git a/src/driver/0.28.x/Makefile.am b/src/driver/0.28.x/Makefile.am
deleted file mode 100644
index 4398045ea..000000000
--- a/src/driver/0.28.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.28 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_28_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.28.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.28 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_28_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.28.x/driver.vala b/src/driver/0.28.x/driver.vala
deleted file mode 100644
index 902d28d4b..000000000
--- a/src/driver/0.28.x/driver.vala
+++ /dev/null
@@ -1,70 +0,0 @@
-/* driver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
- private SymbolResolver resolver;
- private Api.Tree? tree;
-
- public void write_gir (Settings settings, ErrorReporter reporter) {
- var gir_writer = new Drivers.GirWriter (resolver);
-
- // put .gir file in current directory unless -d has been explicitly specified
- string gir_directory = ".";
- if (settings.gir_directory != null) {
- gir_directory = settings.gir_directory;
- }
-
- gir_writer.write_file ((Vala.CodeContext) tree.data,
- gir_directory,
- "%s-%s.gir".printf (settings.gir_namespace, settings.gir_version),
- settings.gir_namespace,
- settings.gir_version,
- settings.pkg_name);
- }
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- TreeBuilder builder = new TreeBuilder ();
- tree = builder.build (settings, reporter);
- if (reporter.errors > 0) {
- return null;
- }
-
- resolver = new SymbolResolver (builder);
- tree.accept (resolver);
-
- return tree;
- }
-}
-
-
-public Type register_plugin (Valadoc.ModuleLoader module_loader) {
- return typeof (Valadoc.Drivers.Driver);
-}
-
diff --git a/src/driver/0.28.x/girwriter.vala b/src/driver/0.28.x/girwriter.vala
deleted file mode 100644
index c250854d6..000000000
--- a/src/driver/0.28.x/girwriter.vala
+++ /dev/null
@@ -1,204 +0,0 @@
-/* girwriter.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-
-
-/**
- * Code visitor generating .gir file for the public interface.
- */
-public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
- private GtkdocRenderer renderer;
- private SymbolResolver resolver;
-
- public GirWriter (SymbolResolver resolver) {
- this.renderer = new GtkdocRenderer ();
- this.resolver = resolver;
- }
-
- private string? translate (Content.Comment? documentation) {
- if (documentation == null) {
- return null;
- }
-
- renderer.render_symbol (documentation);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- private string? translate_taglet (Content.Taglet? taglet) {
- if (taglet == null) {
- return null;
- }
-
- renderer.render_children (taglet);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- protected override string? get_interface_comment (Vala.Interface viface) {
- Interface iface = resolver.resolve (viface) as Interface;
- return translate (iface.documentation);
- }
-
- protected override string? get_struct_comment (Vala.Struct vst) {
- Struct st = resolver.resolve (vst) as Struct;
- return translate (st.documentation);
- }
-
- protected override string? get_enum_comment (Vala.Enum ven) {
- Enum en = resolver.resolve (ven) as Enum;
- return translate (en.documentation);
- }
-
- protected override string? get_class_comment (Vala.Class vc) {
- Class c = resolver.resolve (vc) as Class;
- return translate (c.documentation);
- }
-
- protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
- ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
- return translate (ecode.documentation);
- }
-
- protected override string? get_enum_value_comment (Vala.EnumValue vev) {
- Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
- return translate (ev.documentation);
- }
-
- protected override string? get_constant_comment (Vala.Constant vc) {
- Constant c = resolver.resolve (vc) as Constant;
- return translate (c.documentation);
- }
-
- protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
- ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
- return translate (edomain.documentation);
- }
-
- protected override string? get_field_comment (Vala.Field vf) {
- Field f = resolver.resolve (vf) as Field;
- return translate (f.documentation);
- }
-
- protected override string? get_delegate_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- return translate (cb.documentation);
- }
-
- protected override string? get_method_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- return translate (m.documentation);
- }
-
- protected override string? get_property_comment (Vala.Property vprop) {
- Property prop = resolver.resolve (vprop) as Property;
- return translate (prop.documentation);
- }
-
- protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- if (cb.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = cb.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_return_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- if (sig.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = sig.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_method_return_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- if (m.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = m.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- return translate (sig.documentation);
- }
-
- protected override string? get_parameter_comment (Vala.Parameter param) {
- Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
- if (symbol == null) {
- return null;
- }
-
- Content.Comment? documentation = symbol.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
- foreach (Content.Taglet _taglet in taglets) {
- Taglets.Param taglet = (Taglets.Param) _taglet;
- if (taglet.parameter_name == param.name) {
- return translate_taglet (taglet);
- }
- }
-
- return null;
- }
-}
-
-
diff --git a/src/driver/0.28.x/initializerbuilder.vala b/src/driver/0.28.x/initializerbuilder.vala
deleted file mode 100644
index 7b26ab51f..000000000
--- a/src/driver/0.28.x/initializerbuilder.vala
+++ /dev/null
@@ -1,669 +0,0 @@
-/* initializerbuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Content;
-using Gee;
-
-
-private class Valadoc.Api.InitializerBuilder : Vala.CodeVisitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private SignatureBuilder signature;
-
- private Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void write_node (Vala.Symbol vsymbol) {
- signature.append_symbol (resolve (vsymbol));
- }
-
- private void write_type (Vala.DataType vsymbol) {
- if (vsymbol.data_type != null) {
- write_node (vsymbol.data_type);
- } else {
- signature.append_literal ("null");
- }
-
- var type_args = vsymbol.get_type_arguments ();
- if (type_args.size > 0) {
- signature.append ("<");
- bool first = true;
- foreach (Vala.DataType type_arg in type_args) {
- if (!first) {
- signature.append (",");
- } else {
- first = false;
- }
- if (!type_arg.value_owned) {
- signature.append_keyword ("weak");
- }
- signature.append (type_arg.to_qualified_string (null));
- }
- signature.append (">");
- }
-
- if (vsymbol.nullable) {
- signature.append ("?");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_array_creation_expression (Vala.ArrayCreationExpression expr) {
- signature.append_keyword ("new");
- write_type (expr.element_type);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression size in expr.get_sizes ()) {
- if (!first) {
- signature.append (", ", false);
- }
- size.accept (this);
- first = false;
- }
-
- signature.append ("]", false);
-
- if (expr.initializer_list != null) {
- signature.append (" ", false);
- expr.initializer_list.accept (this);
- }
- }
-
- public InitializerBuilder (SignatureBuilder signature, HashMap<Vala.Symbol, Symbol> symbol_map) {
- this.symbol_map = symbol_map;
- this.signature = signature;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_binary_expression (Vala.BinaryExpression expr) {
- expr.left.accept (this);
-
- switch (expr.operator) {
- case Vala.BinaryOperator.PLUS:
- signature.append ("+ ");
- break;
-
- case Vala.BinaryOperator.MINUS:
- signature.append ("- ");
- break;
-
- case Vala.BinaryOperator.MUL:
- signature.append ("* ");
- break;
-
- case Vala.BinaryOperator.DIV:
- signature.append ("/ ");
- break;
-
- case Vala.BinaryOperator.MOD:
- signature.append ("% ");
- break;
-
- case Vala.BinaryOperator.SHIFT_LEFT:
- signature.append ("<< ");
- break;
-
- case Vala.BinaryOperator.SHIFT_RIGHT:
- signature.append (">> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN:
- signature.append ("< ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN:
- signature.append ("> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN_OR_EQUAL:
- signature.append ("<= ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN_OR_EQUAL:
- signature.append (">= ");
- break;
-
- case Vala.BinaryOperator.EQUALITY:
- signature.append ("== ");
- break;
-
- case Vala.BinaryOperator.INEQUALITY:
- signature.append ("!= ");
- break;
-
- case Vala.BinaryOperator.BITWISE_AND:
- signature.append ("& ");
- break;
-
- case Vala.BinaryOperator.BITWISE_OR:
- signature.append ("| ");
- break;
-
- case Vala.BinaryOperator.BITWISE_XOR:
- signature.append ("^ ");
- break;
-
- case Vala.BinaryOperator.AND:
- signature.append ("&& ");
- break;
-
- case Vala.BinaryOperator.OR:
- signature.append ("|| ");
- break;
-
- case Vala.BinaryOperator.IN:
- signature.append_keyword ("in");
- signature.append (" ");
- break;
-
- case Vala.BinaryOperator.COALESCE:
- signature.append ("?? ");
- break;
-
- default:
- assert_not_reached ();
- }
-
- expr.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_unary_expression (Vala.UnaryExpression expr) {
- switch (expr.operator) {
- case Vala.UnaryOperator.PLUS:
- signature.append ("+");
- break;
-
- case Vala.UnaryOperator.MINUS:
- signature.append ("-");
- break;
-
- case Vala.UnaryOperator.LOGICAL_NEGATION:
- signature.append ("!");
- break;
-
- case Vala.UnaryOperator.BITWISE_COMPLEMENT:
- signature.append ("~");
- break;
-
- case Vala.UnaryOperator.INCREMENT:
- signature.append ("++");
- break;
-
- case Vala.UnaryOperator.DECREMENT:
- signature.append ("--");
- break;
-
- case Vala.UnaryOperator.REF:
- signature.append_keyword ("ref");
- break;
-
- case Vala.UnaryOperator.OUT:
- signature.append_keyword ("out");
- break;
-
- default:
- assert_not_reached ();
- }
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_assignment (Vala.Assignment a) {
- a.left.accept (this);
-
- switch (a.operator) {
- case Vala.AssignmentOperator.SIMPLE:
- signature.append ("=");
- break;
-
- case Vala.AssignmentOperator.BITWISE_OR:
- signature.append ("|");
- break;
-
- case Vala.AssignmentOperator.BITWISE_AND:
- signature.append ("&");
- break;
-
- case Vala.AssignmentOperator.BITWISE_XOR:
- signature.append ("^");
- break;
-
- case Vala.AssignmentOperator.ADD:
- signature.append ("+");
- break;
-
- case Vala.AssignmentOperator.SUB:
- signature.append ("-");
- break;
-
- case Vala.AssignmentOperator.MUL:
- signature.append ("*");
- break;
-
- case Vala.AssignmentOperator.DIV:
- signature.append ("/");
- break;
-
- case Vala.AssignmentOperator.PERCENT:
- signature.append ("%");
- break;
-
- case Vala.AssignmentOperator.SHIFT_LEFT:
- signature.append ("<<");
- break;
-
- case Vala.AssignmentOperator.SHIFT_RIGHT:
- signature.append (">>");
- break;
-
- default:
- assert_not_reached ();
- }
-
- a.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_cast_expression (Vala.CastExpression expr) {
- if (expr.is_non_null_cast) {
- signature.append ("(!)");
- expr.inner.accept (this);
- return;
- }
-
- if (!expr.is_silent_cast) {
- signature.append ("(", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- expr.inner.accept (this);
-
- if (expr.is_silent_cast) {
- signature.append_keyword ("as");
- write_type (expr.type_reference);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_initializer_list (Vala.InitializerList list) {
- signature.append ("{", false);
-
- bool first = true;
- foreach (Vala.Expression initializer in list.get_initializers ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
- initializer.accept (this);
- }
-
- signature.append ("}", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_member_access (Vala.MemberAccess expr) {
- if (expr.symbol_reference != null) {
- expr.symbol_reference.accept (this);
- } else {
- signature.append (expr.member_name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_element_access (Vala.ElementAccess expr) {
- expr.container.accept (this);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression index in expr.get_indices ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
-
- index.accept (this);
- }
-
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_pointer_indirection (Vala.PointerIndirection expr) {
- signature.append ("*", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_addressof_expression (Vala.AddressofExpression expr) {
- signature.append ("&", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_reference_transfer_expression (Vala.ReferenceTransferExpression expr) {
- signature.append ("(", false).append_keyword ("owned", false).append (")", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_check (Vala.TypeCheck expr) {
- expr.expression.accept (this);
- signature.append_keyword ("is");
- write_type (expr.type_reference);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method_call (Vala.MethodCall expr) {
- // symbol-name:
- expr.call.symbol_reference.accept (this);
-
- // parameters:
- signature.append (" (", false);
- bool first = true;
- foreach (Vala.Expression literal in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
-
- literal.accept (this);
- first = false;
- }
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_slice_expression (Vala.SliceExpression expr) {
- expr.container.accept (this);
- signature.append ("[", false);
- expr.start.accept (this);
- signature.append (":", false);
- expr.stop.accept (this);
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_base_access (Vala.BaseAccess expr) {
- signature.append_keyword ("base", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_postfix_expression (Vala.PostfixExpression expr) {
- expr.inner.accept (this);
- if (expr.increment) {
- signature.append ("++", false);
- } else {
- signature.append ("--", false);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_object_creation_expression (Vala.ObjectCreationExpression expr) {
- if (!expr.struct_creation) {
- signature.append_keyword ("new");
- }
-
- signature.append_symbol (resolve (expr.symbol_reference));
-
- signature.append (" (", false);
-
- //TODO: rm conditional space
- bool first = true;
- foreach (Vala.Expression arg in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
- arg.accept (this);
- first = false;
- }
-
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_sizeof_expression (Vala.SizeofExpression expr) {
- signature.append_keyword ("sizeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_typeof_expression (Vala.TypeofExpression expr) {
- signature.append_keyword ("typeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_lambda_expression (Vala.LambdaExpression expr) {
- signature.append ("(", false);
-
- bool first = true;
- foreach (Vala.Parameter param in expr.get_parameters ()) {
- if (!first) {
- signature.append (", ", false);
- }
- signature.append (param.name, false);
- first = false;
- }
-
-
- signature.append (") => {", false);
- signature.append_highlighted (" [...] ", false);
- signature.append ("}", false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_boolean_literal (Vala.BooleanLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_character_literal (Vala.CharacterLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_integer_literal (Vala.IntegerLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_real_literal (Vala.RealLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_regex_literal (Vala.RegexLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_string_literal (Vala.StringLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_null_literal (Vala.NullLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field field) {
- write_node (field);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant constant) {
- write_node (constant);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue ev) {
- write_node (ev);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode ec) {
- write_node (ec);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate d) {
- write_node (d);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal sig) {
- write_node (sig);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class c) {
- write_node (c);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct s) {
- write_node (s);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface i) {
- write_node (i);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum en) {
- write_node (en);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain ed) {
- write_node (ed);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property prop) {
- write_node (prop);
- }
-}
-
diff --git a/src/driver/0.28.x/symbolresolver.vala b/src/driver/0.28.x/symbolresolver.vala
deleted file mode 100644
index 4adc06b1a..000000000
--- a/src/driver/0.28.x/symbolresolver.vala
+++ /dev/null
@@ -1,323 +0,0 @@
-/* symbolresolver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-public class Valadoc.Drivers.SymbolResolver : Visitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private Valadoc.Api.Class glib_error;
- private Api.Tree root;
-
- public SymbolResolver (TreeBuilder builder) {
- this.symbol_map = builder.get_symbol_map ();
- this.glib_error = builder.get_glib_error ();
- }
-
- public Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void resolve_thrown_list (Symbol symbol, Vala.List<Vala.DataType> types) {
- foreach (Vala.DataType type in types) {
- Vala.ErrorDomain vala_edom = (Vala.ErrorDomain) type.data_type;
- Symbol? edom = symbol_map.get (vala_edom);
- symbol.add_child (edom ?? glib_error);
- }
- }
-
- private void resolve_array_type_references (Api.Array ptr) {
- Api.Item data_type = ptr.data_type;
- if (data_type == null) {
- // void
- } else if (data_type is Api.Array) {
- resolve_array_type_references ((Api.Array) data_type);
- } else if (data_type is Pointer) {
- resolve_pointer_type_references ((Api.Pointer) data_type);
- } else {
- resolve_type_reference ((TypeReference) data_type);
- }
- }
-
- private void resolve_pointer_type_references (Pointer ptr) {
- Api.Item type = ptr.data_type;
- if (type == null) {
- // void
- } else if (type is Api.Array) {
- resolve_array_type_references ((Api.Array) type);
- } else if (type is Pointer) {
- resolve_pointer_type_references ((Pointer) type);
- } else {
- resolve_type_reference ((TypeReference) type);
- }
- }
-
- private void resolve_type_reference (TypeReference reference) {
- Vala.DataType vtyperef = (Vala.DataType) reference.data;
- if (vtyperef is Vala.ErrorType) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
- if (verrdom != null) {
- reference.data_type = resolve (verrdom);
- } else {
- reference.data_type = glib_error;
- }
- } else if (vtyperef is Vala.DelegateType) {
- reference.data_type = resolve (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else if (vtyperef is Vala.GenericType) {
- reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
- } else if (vtyperef.data_type != null) {
- reference.data_type = resolve (vtyperef.data_type);
- }
-
- // Type parameters:
- foreach (TypeReference type_param_ref in reference.get_type_arguments ()) {
- resolve_type_reference (type_param_ref);
- }
-
- if (reference.data_type is Pointer) {
- resolve_pointer_type_references ((Pointer)reference.data_type);
- } else if (reference.data_type is Api.Array) {
- resolve_array_type_references ((Api.Array)reference.data_type);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_tree (Api.Tree item) {
- this.root = item;
- item.accept_children (this);
- this.root = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_package (Package item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Namespace item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Interface item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (var type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Class item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (TypeReference type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Struct item) {
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Property item) {
- Vala.Property vala_property = item.data as Vala.Property;
- Vala.Property? base_vala_property = null;
-
- if (vala_property.base_property != null) {
- base_vala_property = vala_property.base_property;
- } else if (vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property == vala_property && vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property != null) {
- item.base_property = (Property?) resolve (base_vala_property);
- }
-
- resolve_type_reference (item.property_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Field item) {
- resolve_type_reference (item.field_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Constant item) {
- resolve_type_reference (item.constant_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Delegate item) {
- Vala.Delegate vala_delegate = item.data as Vala.Delegate;
-
- resolve_type_reference (item.return_type);
-
- resolve_thrown_list (item, vala_delegate.get_error_types ());
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Api.Signal item) {
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Method item) {
- Vala.Method vala_method = item.data as Vala.Method;
- Vala.Method? base_vala_method = null;
- if (vala_method.base_method != null) {
- base_vala_method = vala_method.base_method;
- } else if (vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method == vala_method && vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method != null) {
- item.base_method = (Method?) resolve (base_vala_method);
- }
-
- resolve_thrown_list (item, vala_method.get_error_types ());
-
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (TypeParameter item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (FormalParameter item) {
- if (item.ellipsis) {
- return;
- }
-
- if (((Vala.Parameter) item.data).initializer != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.Parameter) item.data).initializer.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- resolve_type_reference (item.parameter_type);
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (ErrorDomain item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (ErrorCode item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Enum item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Api.EnumValue item) {
-
- if (((Vala.EnumValue) item.data).value != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.EnumValue) item.data).value.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- item.accept_all_children (this, false);
- }
-}
-
-
-
diff --git a/src/driver/0.28.x/treebuilder.vala b/src/driver/0.28.x/treebuilder.vala
deleted file mode 100644
index 4d2865e1e..000000000
--- a/src/driver/0.28.x/treebuilder.vala
+++ /dev/null
@@ -1,1524 +0,0 @@
-/* treebuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-using Gee;
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
- private ArrayList<PackageMetaData> packages = new ArrayList<PackageMetaData> ();
- private PackageMetaData source_package;
-
- private HashMap<Vala.SourceFile, SourceFile> files = new HashMap<Vala.SourceFile, SourceFile> ();
- private HashMap<Vala.Symbol, Symbol> symbol_map = new HashMap<Vala.Symbol, Symbol> ();
-
- private ErrorReporter reporter;
- private Settings settings;
-
- private Api.Node current_node;
- private Api.Tree tree;
-
- private Valadoc.Api.Class glib_error = null;
-
-
- //
- // Accessors
- //
-
- public Api.Class get_glib_error () {
- return glib_error;
- }
-
- public HashMap<Vala.Symbol, Symbol> get_symbol_map () {
- return symbol_map;
- }
-
-
- //
- //
- //
-
- private class PackageMetaData {
- public Package package;
- public HashMap<Vala.Namespace, Namespace> namespaces = new HashMap<Vala.Namespace, Namespace> ();
- public ArrayList<Vala.SourceFile> files = new ArrayList<Vala.SourceFile> ();
-
- public PackageMetaData (Package package) {
- this.package = package;
- }
-
- public Namespace get_namespace (Vala.Namespace vns, SourceFile file) {
- Namespace? ns = namespaces.get (vns);
- if (ns != null) {
- return ns;
- }
-
- // find documentation comment if existing:
- SourceComment? comment = null;
- if (vns.source_reference != null) {
- foreach (Vala.Comment c in vns.get_comments()) {
- if (c.source_reference.file == file.data ||
- (c.source_reference.file.file_type == Vala.SourceFileType.SOURCE
- && ((Vala.SourceFile) file.data).file_type == Vala.SourceFileType.SOURCE)
- ) {
- Vala.SourceReference pos = c.source_reference;
- if (c is Vala.GirComment) {
- comment = new GirSourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- } else {
- comment = new SourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- break;
- }
- }
- }
-
- // find parent if existing
- var parent_vns = vns.parent_symbol;
-
- if (parent_vns == null) {
- ns = new Namespace (package, file, vns.name, comment, vns);
- package.add_child (ns);
- } else {
- Namespace parent_ns = get_namespace ((Vala.Namespace) parent_vns, file);
- ns = new Namespace (parent_ns, file, vns.name, comment, vns);
- parent_ns.add_child (ns);
- }
-
- namespaces.set (vns, ns);
- return ns;
- }
-
- public void register_source_file (Vala.SourceFile file) {
- files.add (file);
- }
-
- public bool is_package_for_file (Vala.SourceFile source_file) {
- if (source_file.file_type == Vala.SourceFileType.SOURCE && !package.is_package) {
- return true;
- }
-
- return files.contains (source_file);
- }
- }
-
-
- //
- // Type constructor translation helpers:
- //
-
- private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
- Pointer ptr = new Pointer (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.base_type;
- if (vntype is Vala.PointerType) {
- ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
- } else if (vntype is Vala.ArrayType) {
- ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
- } else {
- ptr.data_type = create_type_reference (vntype, ptr, caller);
- }
-
- return ptr;
- }
-
- private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
- Api.Array arr = new Api.Array (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.element_type;
- if (vntype is Vala.ArrayType) {
- arr.data_type = create_type_reference (vntype, arr, caller);
- } else {
- arr.data_type = create_type_reference (vntype, arr, caller);
- }
-
- return arr;
- }
-
- private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
- bool is_nullable = vtyperef != null
- && vtyperef.nullable
- && !(vtyperef is Vala.GenericType)
- && !(vtyperef is Vala.PointerType);
- string? signature = (vtyperef != null
- && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
- bool pass_ownership = type_reference_pass_ownership (vtyperef);
- Ownership ownership = get_type_reference_ownership (vtyperef);
- bool is_dynamic = vtyperef != null && vtyperef.is_dynamic;
-
- TypeReference type_ref = new TypeReference (parent,
- ownership,
- pass_ownership,
- is_dynamic,
- is_nullable,
- signature,
- vtyperef);
-
- if (vtyperef is Vala.PointerType) {
- type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef, type_ref, caller);
- } else if (vtyperef is Vala.ArrayType) {
- type_ref.data_type = create_array ((Vala.ArrayType) vtyperef, type_ref, caller);
- //} else if (vtyperef is Vala.GenericType) {
- // type_ref.data_type = new TypeParameter (caller,
- // caller.get_source_file (),
- // ((Vala.GenericType) vtyperef).type_parameter.name,
- // vtyperef);
- }
-
- // type parameters:
- if (vtyperef != null) {
- foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
- var type_param = create_type_reference (vdtype, type_ref, caller);
- type_ref.add_type_argument (type_param);
- }
- }
-
- return type_ref;
- }
-
-
-
- //
- // Translation helpers:
- //
-
- private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
- // attributes without arguments:
- string[] attributes = {
- "ReturnsModifiedPointer",
- "DestroysInstance",
- "GenericAccessors",
- "NoAccessorMethod",
- "NoArrayLength",
- "Experimental",
- "Diagnostics",
- "PrintfFormat",
- "PointerType",
- "ScanfFormat",
- "ThreadLocal",
- "SimpleType",
- "HasEmitter",
- "ModuleInit",
- "NoWrapper",
- "Immutable",
- "ErrorBase",
- "NoReturn",
- "NoThrow",
- "Compact",
- "Assert",
- "Flags"
- };
-
- string? tmp = "";
-
- foreach (Vala.Attribute att in lst) {
- if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- new_attribute.add_boolean ("has_target", false, att);
- parent.add_attribute (new_attribute);
- } else if (att.name == "Deprecated") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
-
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- } else if (att.name in attributes) {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- }
- }
- }
-
- private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
- }
-
- private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
- }
-
- private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
- }
-
- private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
- }
-
- private string? get_finalize_function_name (Vala.Class element) {
- if (!element.is_fundamental ()) {
- return null;
- }
-
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_free_function_name (Vala.Class element) {
- if (!element.is_compact) {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
- }
-
- private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
- }
-
- private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
- }
-
- private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
- }
-
- private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
- }
-
-
- private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
- }
-
- private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
- }
-
- private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
- }
-
- private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
- }
-
- private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
- }
-
- private string? get_nick (Vala.Property prop) {
- return Vala.CCodeBaseModule.get_ccode_nick (prop);
- }
-
- private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
- }
-
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- if (comment is Vala.GirComment) {
- var tmp = new GirSourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- if (((Vala.GirComment) comment).return_content != null) {
- Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
- tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content,
- file,
- return_pos.begin.line,
- return_pos.begin.column,
- return_pos.end.line,
- return_pos.end.column);
- }
-
- Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
- while (it.next ()) {
- Vala.Comment vala_param = it.get_value ();
- Vala.SourceReference param_pos = vala_param.source_reference;
- var param_comment = new SourceComment (vala_param.content,
- file,
- param_pos.begin.line,
- param_pos.begin.column,
- param_pos.end.line,
- param_pos.end.column);
- tmp.add_parameter_content (it.get_key (), param_comment);
- }
- return tmp;
- } else {
- return new SourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- }
-
- return null;
- }
-
- private string get_method_name (Vala.Method element) {
- if (element is Vala.CreationMethod) {
- if (element.name == ".new") {
- return element.parent_symbol.name;
- } else {
- return element.parent_symbol.name + "." + element.name;
- }
- }
-
- return element.name;
- }
-
- private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- }
-
- private string? get_private_cname (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- string? cname = get_cname (element);
- return (cname != null)? cname + "Private" : null;
- }
-
- private string? get_class_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_class_type_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
- return (name != null && name != "")? name : null;
- }
-
- private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
- string? name = get_is_type_macro_name (element);
- return (name != null)? name + "_CLASS" : null;
- }
-
- private string? get_type_function_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_type_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
- }
-
- private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && !((Vala.Class) element).is_compact)
- || element is Vala.Interface)
- {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- } else {
- return null;
- }
- }
-
- private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
- }
-
- private PackageMetaData? get_package_meta_data (Package pkg) {
- foreach (PackageMetaData data in packages) {
- if (data.package == pkg) {
- return data;
- }
- }
-
- return null;
- }
-
- private PackageMetaData register_package (Package package) {
- PackageMetaData meta_data = new PackageMetaData (package);
- tree.add_package (package);
- packages.add (meta_data);
- return meta_data;
- }
-
- private SourceFile register_source_file (PackageMetaData meta_data, Vala.SourceFile source_file) {
- SourceFile file = new SourceFile (meta_data.package,
- source_file.get_relative_filename (),
- source_file.get_csource_filename (),
- source_file);
- files.set (source_file, file);
-
- meta_data.register_source_file (source_file);
- return file;
- }
-
- private SourceFile? get_source_file (Vala.Symbol symbol) {
- Vala.SourceReference source_ref = symbol.source_reference;
- if (source_ref == null) {
- return null;
- }
-
- SourceFile? file = files.get (source_ref.file);
- assert (file != null);
- return file;
- }
-
- private Package? find_package_for_file (Vala.SourceFile source_file) {
- foreach (PackageMetaData pkg in this.packages) {
- if (pkg.is_package_for_file (source_file)) {
- return pkg.package;
- }
- }
-
- return null;
- }
-
-
- private Namespace get_namespace (Package pkg, Vala.Symbol symbol, SourceFile? file) {
- // Find the closest namespace in our vala-tree
- Vala.Symbol namespace_symbol = symbol;
- while (!(namespace_symbol is Vala.Namespace)) {
- namespace_symbol = namespace_symbol.parent_symbol;
- }
-
- PackageMetaData? meta_data = get_package_meta_data (pkg);
- assert (meta_data != null);
-
- return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
- }
-
- private MethodBindingType get_method_binding_type (Vala.Method element) {
- if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.is_abstract) {
- return MethodBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return MethodBindingType.VIRTUAL;
- } else if (element.overrides) {
- return MethodBindingType.OVERRIDE;
- } else if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.binding != Vala.MemberBinding.INSTANCE) {
- return MethodBindingType.STATIC;
- }
- return MethodBindingType.UNMODIFIED;
- }
-
-
- private SymbolAccessibility get_access_modifier(Vala.Symbol symbol) {
- switch (symbol.access) {
- case Vala.SymbolAccessibility.PROTECTED:
- return SymbolAccessibility.PROTECTED;
-
- case Vala.SymbolAccessibility.INTERNAL:
- return SymbolAccessibility.INTERNAL;
-
- case Vala.SymbolAccessibility.PRIVATE:
- return SymbolAccessibility.PRIVATE;
-
- case Vala.SymbolAccessibility.PUBLIC:
- return SymbolAccessibility.PUBLIC;
-
- default:
- error ("Unknown symbol accessibility modifier found");
- }
- }
-
- private PropertyAccessorType get_property_accessor_type (Vala.PropertyAccessor element) {
- if (element.construction) {
- if (element.writable) {
- return (PropertyAccessorType.CONSTRUCT | PropertyAccessorType.SET);
- }
- return PropertyAccessorType.CONSTRUCT;
- } else if (element.writable) {
- return PropertyAccessorType.SET;
- } else if (element.readable) {
- return PropertyAccessorType.GET;
- }
-
- error ("Unknown symbol accessibility type");
- }
-
- private bool type_reference_pass_ownership (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode? node = element.parent_node;
- if (node == null) {
- return false;
- }
- if (node is Vala.Parameter) {
- return (((Vala.Parameter)node).direction == Vala.ParameterDirection.IN &&
- ((Vala.Parameter)node).variable_type.value_owned);
- }
- if (node is Vala.Property) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_unowned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are weak, not unowned
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true)
- {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)
- ? element.is_weak ()
- : false;
- }
-
- private bool is_type_reference_owned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode parent = element.parent_node;
-
- // parameter:
- if (parent is Vala.Parameter) {
- if (((Vala.Parameter)parent).direction != Vala.ParameterDirection.IN) {
- return false;
- }
- return ((Vala.Parameter)parent).variable_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_weak (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are unowned, not weak
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false)
- {
- return false;
- }
-
- // arrays are unowned, not weak
- if (element is Vala.ArrayType) {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)? element.is_weak () : false;
- }
-
- private Ownership get_type_reference_ownership (Vala.DataType? element) {
- if (is_type_reference_owned (element)) {
- return Ownership.OWNED;
- } else if (is_type_reference_weak (element)) {
- return Ownership.WEAK;
- } else if (is_type_reference_unowned (element)) {
- return Ownership.UNOWNED;
- }
-
- return Ownership.DEFAULT;
- }
-
- private Ownership get_property_ownership (Vala.PropertyAccessor element) {
- if (element.value_type.value_owned) {
- return Ownership.OWNED;
- }
-
- // the exact type (weak, unowned) does not matter
- return Ownership.UNOWNED;
- }
-
- private PropertyBindingType get_property_binding_type (Vala.Property element) {
- if (element.is_abstract) {
- return PropertyBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return PropertyBindingType.VIRTUAL;
- } else if (element.overrides) {
- return PropertyBindingType.OVERRIDE;
- }
-
- return PropertyBindingType.UNMODIFIED;
- }
-
- private FormalParameterType get_formal_parameter_type (Vala.Parameter element) {
- if (element.direction == Vala.ParameterDirection.OUT) {
- return FormalParameterType.OUT;
- } else if (element.direction == Vala.ParameterDirection.REF) {
- return FormalParameterType.REF;
- } else if (element.direction == Vala.ParameterDirection.IN) {
- return FormalParameterType.IN;
- }
-
- error ("Unknown formal parameter type");
- }
-
-
- //
- // Vala tree creation:
- //
-
- private string get_package_name (string path) {
- string file_name = Path.get_basename (path);
- return file_name.substring (0, file_name.last_index_of_char ('.'));
- }
-
- private bool add_package (Vala.CodeContext context, string pkg) {
- // ignore multiple occurences of the same package
- if (context.has_package (pkg)) {
- return true;
- }
-
- string vapi_name = pkg + ".vapi";
- string gir_name = pkg + ".gir";
- foreach (string source_file in settings.source_files) {
- string basename = Path.get_basename (source_file);
- if (basename == vapi_name || basename == gir_name) {
- return true;
- }
- }
-
-
- var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
- if (package_path == null) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
- return false;
- }
-
- context.add_package (pkg);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
- context.add_source_file (vfile);
- Package vdpkg = new Package (pkg, true, null);
- register_source_file (register_package (vdpkg), vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)), pkg);
- return true;
- }
-
- private void add_deps (Vala.CodeContext context, string file_path, string pkg_name) {
- if (FileUtils.test (file_path, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (file_path, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep = dep.strip ();
- if (dep != "") {
- if (!add_package (context, dep)) {
- Vala.Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg_name));
- }
- }
- }
- } catch (FileError e) {
- Vala.Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
- }
-
- /**
- * Adds the specified packages to the list of used packages.
- *
- * @param context The code context
- * @param packages a list of package names
- */
- private void add_depencies (Vala.CodeContext context, string[] packages) {
- foreach (string package in packages) {
- if (!add_package (context, package)) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
- }
- }
- }
-
- /**
- * Add the specified source file to the context. Only .vala, .vapi, .gs,
- * and .c files are supported.
- */
- private void add_documented_files (Vala.CodeContext context, string[] sources) {
- if (sources == null) {
- return;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, source_file);
-
- if (context.profile == Vala.Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- context.root.add_using_directive (ns_ref);
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) {
- string file_name = get_package_name (source);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
- context.add_source_file (vfile);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (source), "%s.deps".printf (file_name)), file_name);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- tree.add_external_c_files (rpath);
- } else {
- Vala.Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Vala.Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- private Vala.CodeContext create_valac_tree (Settings settings) {
- // init context:
- var context = new Vala.CodeContext ();
- Vala.CodeContext.push (context);
-
-
- // settings:
- context.experimental = settings.experimental;
- context.experimental_non_null = settings.experimental || settings.experimental_non_null;
- context.vapi_directories = settings.vapi_directories;
- context.report.enable_warnings = settings.verbose;
- context.metadata_directories = settings.metadata_directories;
- context.gir_directories = settings.gir_directories;
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
-
- // add default packages:
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Vala.Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- for (int i = 2; i <= 28; i += 2) {
- context.add_define ("VALA_0_%d".printf (i));
- }
-
- if (context.profile == Vala.Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 24;
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- if (settings.target_glib != null && settings.target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
- Vala.Report.error (null, "Invalid format for --target-glib");
- }
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
-
- // default packages
- if (!this.add_package (context, "glib-2.0")) { //
- Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package (context, "gobject-2.0")) { //
- Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
-
- // add user defined files:
- add_depencies (context, settings.packages);
- if (reporter.errors > 0) {
- return context;
- }
-
- add_documented_files (context, settings.source_files);
- if (reporter.errors > 0) {
- return context;
- }
-
-
- // parse vala-code:
- Vala.Parser parser = new Vala.Parser ();
-
- parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- // parse gir:
- Vala.GirParser gir_parser = new Vala.GirParser ();
-
- gir_parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
-
-
- // check context:
- context.check ();
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- return context;
- }
-
-
-
- //
- // Valadoc tree creation:
- //
-
- private void process_children (Api.Node node, Vala.CodeNode element) {
- Api.Node old_node = current_node;
- current_node = node;
- element.accept_children (this);
- current_node = old_node;
- }
-
- private Api.Node get_parent_node_for (Vala.Symbol element) {
- if (current_node != null) {
- return current_node;
- }
-
- Vala.SourceFile vala_source_file = element.source_reference.file;
- Package package = find_package_for_file (vala_source_file);
- SourceFile? source_file = get_source_file (element);
-
- return get_namespace (package, element, source_file);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Vala.Namespace element) {
- element.accept_children (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_class == null && element.name == "string";
-
- Class node = new Class (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_private_cname (element),
- get_class_macro_name (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_class_type_macro_name (element),
- get_is_class_type_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- get_ccode_type_id (element),
- get_param_spec_function (element),
- get_ref_function (element),
- get_unref_function (element),
- get_free_function_name (element),
- get_finalize_function_name (element),
- get_take_value_function (element),
- get_get_value_function (element),
- get_set_value_function (element),
- element.is_fundamental (),
- element.is_abstract,
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // relations
- foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
- var type_ref = create_type_reference (vala_type_ref, node, node);
-
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else if (vala_type_ref.data_type is Vala.Class) {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
-
- // save GLib.Error
- if (glib_error == null && node.get_full_name () == "GLib.Error") {
- glib_error = node;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Interface node = new Interface (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_interface_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // prerequisites:
- foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
- TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_type == null
- && (element.is_boolean_type ()
- || element.is_floating_type ()
- || element.is_integer_type ());
-
- Struct node = new Struct (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- get_ccode_type_id (element),
- get_dup_function (element),
- get_copy_function (element),
- get_destroy_function (element),
- get_free_function (element),
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // parent type:
- Vala.ValueType? basetype = element.base_type as Vala.ValueType;
- if (basetype != null) {
- node.base_type = create_type_reference (basetype, node, node);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Field node = new Field (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element.binding == Vala.MemberBinding.STATIC,
- element.is_volatile,
- element);
- node.field_type = create_type_reference (element.variable_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Property node = new Property (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_nick (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- get_property_binding_type (element),
- element);
- node.property_type = create_type_reference (element.property_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // Process property type
- if (element.get_accessor != null) {
- var accessor = element.get_accessor;
- node.getter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- if (element.set_accessor != null) {
- var accessor = element.set_accessor;
- node.setter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Api.Signal node = new Api.Signal (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- (element.default_handler != null)? get_cname (element.default_handler) : null,
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- element.is_virtual,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Delegate node = new Delegate (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- !element.has_target,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Enum (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue element) {
- Api.Enum parent = (Enum) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.EnumValue (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Constant node = new Constant (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element);
- node.constant_type = create_type_reference (element.type_reference, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new ErrorDomain (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_quark_macro_name (element),
- get_quark_function_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode element) {
- Api.ErrorDomain parent = (ErrorDomain) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- if (file == null) {
- file = parent.get_source_file ();
- }
-
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.ErrorCode (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (Vala.TypeParameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- Symbol node = new TypeParameter (parent,
- file,
- element.name,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (Vala.Parameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- FormalParameter node = new FormalParameter (parent,
- file,
- element.name,
- get_access_modifier(element),
- get_formal_parameter_type (element),
- element.ellipsis,
- element);
- node.parameter_type = create_type_reference (element.variable_type, node, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
-
- //
- // startpoint:
- //
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.settings = settings;
- this.reporter = reporter;
-
- this.tree = new Api.Tree (reporter, settings);
- var context = create_valac_tree (settings);
- this.tree.data = context;
-
- reporter.warnings_offset = context.report.get_warnings ();
- reporter.errors_offset = context.report.get_errors ();
-
- if (context == null) {
- return null;
- }
-
- // TODO: Register all packages here
- // register packages included by gir-files
- foreach (Vala.SourceFile vfile in context.get_source_files ()) {
- if (vfile.file_type == Vala.SourceFileType.PACKAGE
- && vfile.get_nodes ().size > 0
- && files.has_key (vfile) == false)
- {
- Package vdpkg = new Package (get_package_name (vfile.filename), true, null);
- register_source_file (register_package (vdpkg), vfile);
- }
- }
-
- context.accept(this);
-
- return (reporter.errors == 0)? tree : null;
- }
-}
-
-
diff --git a/src/driver/0.30.x/Makefile.am b/src/driver/0.30.x/Makefile.am
deleted file mode 100644
index fac86d65b..000000000
--- a/src/driver/0.30.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.30 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_30_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.30.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.30 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_30_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.30.x/driver.vala b/src/driver/0.30.x/driver.vala
deleted file mode 100644
index 902d28d4b..000000000
--- a/src/driver/0.30.x/driver.vala
+++ /dev/null
@@ -1,70 +0,0 @@
-/* driver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
- private SymbolResolver resolver;
- private Api.Tree? tree;
-
- public void write_gir (Settings settings, ErrorReporter reporter) {
- var gir_writer = new Drivers.GirWriter (resolver);
-
- // put .gir file in current directory unless -d has been explicitly specified
- string gir_directory = ".";
- if (settings.gir_directory != null) {
- gir_directory = settings.gir_directory;
- }
-
- gir_writer.write_file ((Vala.CodeContext) tree.data,
- gir_directory,
- "%s-%s.gir".printf (settings.gir_namespace, settings.gir_version),
- settings.gir_namespace,
- settings.gir_version,
- settings.pkg_name);
- }
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- TreeBuilder builder = new TreeBuilder ();
- tree = builder.build (settings, reporter);
- if (reporter.errors > 0) {
- return null;
- }
-
- resolver = new SymbolResolver (builder);
- tree.accept (resolver);
-
- return tree;
- }
-}
-
-
-public Type register_plugin (Valadoc.ModuleLoader module_loader) {
- return typeof (Valadoc.Drivers.Driver);
-}
-
diff --git a/src/driver/0.30.x/girwriter.vala b/src/driver/0.30.x/girwriter.vala
deleted file mode 100644
index c250854d6..000000000
--- a/src/driver/0.30.x/girwriter.vala
+++ /dev/null
@@ -1,204 +0,0 @@
-/* girwriter.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-
-
-/**
- * Code visitor generating .gir file for the public interface.
- */
-public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
- private GtkdocRenderer renderer;
- private SymbolResolver resolver;
-
- public GirWriter (SymbolResolver resolver) {
- this.renderer = new GtkdocRenderer ();
- this.resolver = resolver;
- }
-
- private string? translate (Content.Comment? documentation) {
- if (documentation == null) {
- return null;
- }
-
- renderer.render_symbol (documentation);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- private string? translate_taglet (Content.Taglet? taglet) {
- if (taglet == null) {
- return null;
- }
-
- renderer.render_children (taglet);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- protected override string? get_interface_comment (Vala.Interface viface) {
- Interface iface = resolver.resolve (viface) as Interface;
- return translate (iface.documentation);
- }
-
- protected override string? get_struct_comment (Vala.Struct vst) {
- Struct st = resolver.resolve (vst) as Struct;
- return translate (st.documentation);
- }
-
- protected override string? get_enum_comment (Vala.Enum ven) {
- Enum en = resolver.resolve (ven) as Enum;
- return translate (en.documentation);
- }
-
- protected override string? get_class_comment (Vala.Class vc) {
- Class c = resolver.resolve (vc) as Class;
- return translate (c.documentation);
- }
-
- protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
- ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
- return translate (ecode.documentation);
- }
-
- protected override string? get_enum_value_comment (Vala.EnumValue vev) {
- Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
- return translate (ev.documentation);
- }
-
- protected override string? get_constant_comment (Vala.Constant vc) {
- Constant c = resolver.resolve (vc) as Constant;
- return translate (c.documentation);
- }
-
- protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
- ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
- return translate (edomain.documentation);
- }
-
- protected override string? get_field_comment (Vala.Field vf) {
- Field f = resolver.resolve (vf) as Field;
- return translate (f.documentation);
- }
-
- protected override string? get_delegate_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- return translate (cb.documentation);
- }
-
- protected override string? get_method_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- return translate (m.documentation);
- }
-
- protected override string? get_property_comment (Vala.Property vprop) {
- Property prop = resolver.resolve (vprop) as Property;
- return translate (prop.documentation);
- }
-
- protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- if (cb.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = cb.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_return_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- if (sig.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = sig.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_method_return_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- if (m.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = m.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- return translate (sig.documentation);
- }
-
- protected override string? get_parameter_comment (Vala.Parameter param) {
- Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
- if (symbol == null) {
- return null;
- }
-
- Content.Comment? documentation = symbol.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
- foreach (Content.Taglet _taglet in taglets) {
- Taglets.Param taglet = (Taglets.Param) _taglet;
- if (taglet.parameter_name == param.name) {
- return translate_taglet (taglet);
- }
- }
-
- return null;
- }
-}
-
-
diff --git a/src/driver/0.30.x/initializerbuilder.vala b/src/driver/0.30.x/initializerbuilder.vala
deleted file mode 100644
index 7b26ab51f..000000000
--- a/src/driver/0.30.x/initializerbuilder.vala
+++ /dev/null
@@ -1,669 +0,0 @@
-/* initializerbuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Content;
-using Gee;
-
-
-private class Valadoc.Api.InitializerBuilder : Vala.CodeVisitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private SignatureBuilder signature;
-
- private Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void write_node (Vala.Symbol vsymbol) {
- signature.append_symbol (resolve (vsymbol));
- }
-
- private void write_type (Vala.DataType vsymbol) {
- if (vsymbol.data_type != null) {
- write_node (vsymbol.data_type);
- } else {
- signature.append_literal ("null");
- }
-
- var type_args = vsymbol.get_type_arguments ();
- if (type_args.size > 0) {
- signature.append ("<");
- bool first = true;
- foreach (Vala.DataType type_arg in type_args) {
- if (!first) {
- signature.append (",");
- } else {
- first = false;
- }
- if (!type_arg.value_owned) {
- signature.append_keyword ("weak");
- }
- signature.append (type_arg.to_qualified_string (null));
- }
- signature.append (">");
- }
-
- if (vsymbol.nullable) {
- signature.append ("?");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_array_creation_expression (Vala.ArrayCreationExpression expr) {
- signature.append_keyword ("new");
- write_type (expr.element_type);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression size in expr.get_sizes ()) {
- if (!first) {
- signature.append (", ", false);
- }
- size.accept (this);
- first = false;
- }
-
- signature.append ("]", false);
-
- if (expr.initializer_list != null) {
- signature.append (" ", false);
- expr.initializer_list.accept (this);
- }
- }
-
- public InitializerBuilder (SignatureBuilder signature, HashMap<Vala.Symbol, Symbol> symbol_map) {
- this.symbol_map = symbol_map;
- this.signature = signature;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_binary_expression (Vala.BinaryExpression expr) {
- expr.left.accept (this);
-
- switch (expr.operator) {
- case Vala.BinaryOperator.PLUS:
- signature.append ("+ ");
- break;
-
- case Vala.BinaryOperator.MINUS:
- signature.append ("- ");
- break;
-
- case Vala.BinaryOperator.MUL:
- signature.append ("* ");
- break;
-
- case Vala.BinaryOperator.DIV:
- signature.append ("/ ");
- break;
-
- case Vala.BinaryOperator.MOD:
- signature.append ("% ");
- break;
-
- case Vala.BinaryOperator.SHIFT_LEFT:
- signature.append ("<< ");
- break;
-
- case Vala.BinaryOperator.SHIFT_RIGHT:
- signature.append (">> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN:
- signature.append ("< ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN:
- signature.append ("> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN_OR_EQUAL:
- signature.append ("<= ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN_OR_EQUAL:
- signature.append (">= ");
- break;
-
- case Vala.BinaryOperator.EQUALITY:
- signature.append ("== ");
- break;
-
- case Vala.BinaryOperator.INEQUALITY:
- signature.append ("!= ");
- break;
-
- case Vala.BinaryOperator.BITWISE_AND:
- signature.append ("& ");
- break;
-
- case Vala.BinaryOperator.BITWISE_OR:
- signature.append ("| ");
- break;
-
- case Vala.BinaryOperator.BITWISE_XOR:
- signature.append ("^ ");
- break;
-
- case Vala.BinaryOperator.AND:
- signature.append ("&& ");
- break;
-
- case Vala.BinaryOperator.OR:
- signature.append ("|| ");
- break;
-
- case Vala.BinaryOperator.IN:
- signature.append_keyword ("in");
- signature.append (" ");
- break;
-
- case Vala.BinaryOperator.COALESCE:
- signature.append ("?? ");
- break;
-
- default:
- assert_not_reached ();
- }
-
- expr.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_unary_expression (Vala.UnaryExpression expr) {
- switch (expr.operator) {
- case Vala.UnaryOperator.PLUS:
- signature.append ("+");
- break;
-
- case Vala.UnaryOperator.MINUS:
- signature.append ("-");
- break;
-
- case Vala.UnaryOperator.LOGICAL_NEGATION:
- signature.append ("!");
- break;
-
- case Vala.UnaryOperator.BITWISE_COMPLEMENT:
- signature.append ("~");
- break;
-
- case Vala.UnaryOperator.INCREMENT:
- signature.append ("++");
- break;
-
- case Vala.UnaryOperator.DECREMENT:
- signature.append ("--");
- break;
-
- case Vala.UnaryOperator.REF:
- signature.append_keyword ("ref");
- break;
-
- case Vala.UnaryOperator.OUT:
- signature.append_keyword ("out");
- break;
-
- default:
- assert_not_reached ();
- }
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_assignment (Vala.Assignment a) {
- a.left.accept (this);
-
- switch (a.operator) {
- case Vala.AssignmentOperator.SIMPLE:
- signature.append ("=");
- break;
-
- case Vala.AssignmentOperator.BITWISE_OR:
- signature.append ("|");
- break;
-
- case Vala.AssignmentOperator.BITWISE_AND:
- signature.append ("&");
- break;
-
- case Vala.AssignmentOperator.BITWISE_XOR:
- signature.append ("^");
- break;
-
- case Vala.AssignmentOperator.ADD:
- signature.append ("+");
- break;
-
- case Vala.AssignmentOperator.SUB:
- signature.append ("-");
- break;
-
- case Vala.AssignmentOperator.MUL:
- signature.append ("*");
- break;
-
- case Vala.AssignmentOperator.DIV:
- signature.append ("/");
- break;
-
- case Vala.AssignmentOperator.PERCENT:
- signature.append ("%");
- break;
-
- case Vala.AssignmentOperator.SHIFT_LEFT:
- signature.append ("<<");
- break;
-
- case Vala.AssignmentOperator.SHIFT_RIGHT:
- signature.append (">>");
- break;
-
- default:
- assert_not_reached ();
- }
-
- a.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_cast_expression (Vala.CastExpression expr) {
- if (expr.is_non_null_cast) {
- signature.append ("(!)");
- expr.inner.accept (this);
- return;
- }
-
- if (!expr.is_silent_cast) {
- signature.append ("(", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- expr.inner.accept (this);
-
- if (expr.is_silent_cast) {
- signature.append_keyword ("as");
- write_type (expr.type_reference);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_initializer_list (Vala.InitializerList list) {
- signature.append ("{", false);
-
- bool first = true;
- foreach (Vala.Expression initializer in list.get_initializers ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
- initializer.accept (this);
- }
-
- signature.append ("}", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_member_access (Vala.MemberAccess expr) {
- if (expr.symbol_reference != null) {
- expr.symbol_reference.accept (this);
- } else {
- signature.append (expr.member_name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_element_access (Vala.ElementAccess expr) {
- expr.container.accept (this);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression index in expr.get_indices ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
-
- index.accept (this);
- }
-
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_pointer_indirection (Vala.PointerIndirection expr) {
- signature.append ("*", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_addressof_expression (Vala.AddressofExpression expr) {
- signature.append ("&", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_reference_transfer_expression (Vala.ReferenceTransferExpression expr) {
- signature.append ("(", false).append_keyword ("owned", false).append (")", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_check (Vala.TypeCheck expr) {
- expr.expression.accept (this);
- signature.append_keyword ("is");
- write_type (expr.type_reference);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method_call (Vala.MethodCall expr) {
- // symbol-name:
- expr.call.symbol_reference.accept (this);
-
- // parameters:
- signature.append (" (", false);
- bool first = true;
- foreach (Vala.Expression literal in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
-
- literal.accept (this);
- first = false;
- }
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_slice_expression (Vala.SliceExpression expr) {
- expr.container.accept (this);
- signature.append ("[", false);
- expr.start.accept (this);
- signature.append (":", false);
- expr.stop.accept (this);
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_base_access (Vala.BaseAccess expr) {
- signature.append_keyword ("base", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_postfix_expression (Vala.PostfixExpression expr) {
- expr.inner.accept (this);
- if (expr.increment) {
- signature.append ("++", false);
- } else {
- signature.append ("--", false);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_object_creation_expression (Vala.ObjectCreationExpression expr) {
- if (!expr.struct_creation) {
- signature.append_keyword ("new");
- }
-
- signature.append_symbol (resolve (expr.symbol_reference));
-
- signature.append (" (", false);
-
- //TODO: rm conditional space
- bool first = true;
- foreach (Vala.Expression arg in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
- arg.accept (this);
- first = false;
- }
-
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_sizeof_expression (Vala.SizeofExpression expr) {
- signature.append_keyword ("sizeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_typeof_expression (Vala.TypeofExpression expr) {
- signature.append_keyword ("typeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_lambda_expression (Vala.LambdaExpression expr) {
- signature.append ("(", false);
-
- bool first = true;
- foreach (Vala.Parameter param in expr.get_parameters ()) {
- if (!first) {
- signature.append (", ", false);
- }
- signature.append (param.name, false);
- first = false;
- }
-
-
- signature.append (") => {", false);
- signature.append_highlighted (" [...] ", false);
- signature.append ("}", false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_boolean_literal (Vala.BooleanLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_character_literal (Vala.CharacterLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_integer_literal (Vala.IntegerLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_real_literal (Vala.RealLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_regex_literal (Vala.RegexLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_string_literal (Vala.StringLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_null_literal (Vala.NullLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field field) {
- write_node (field);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant constant) {
- write_node (constant);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue ev) {
- write_node (ev);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode ec) {
- write_node (ec);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate d) {
- write_node (d);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal sig) {
- write_node (sig);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class c) {
- write_node (c);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct s) {
- write_node (s);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface i) {
- write_node (i);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum en) {
- write_node (en);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain ed) {
- write_node (ed);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property prop) {
- write_node (prop);
- }
-}
-
diff --git a/src/driver/0.30.x/symbolresolver.vala b/src/driver/0.30.x/symbolresolver.vala
deleted file mode 100644
index 4adc06b1a..000000000
--- a/src/driver/0.30.x/symbolresolver.vala
+++ /dev/null
@@ -1,323 +0,0 @@
-/* symbolresolver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-public class Valadoc.Drivers.SymbolResolver : Visitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private Valadoc.Api.Class glib_error;
- private Api.Tree root;
-
- public SymbolResolver (TreeBuilder builder) {
- this.symbol_map = builder.get_symbol_map ();
- this.glib_error = builder.get_glib_error ();
- }
-
- public Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void resolve_thrown_list (Symbol symbol, Vala.List<Vala.DataType> types) {
- foreach (Vala.DataType type in types) {
- Vala.ErrorDomain vala_edom = (Vala.ErrorDomain) type.data_type;
- Symbol? edom = symbol_map.get (vala_edom);
- symbol.add_child (edom ?? glib_error);
- }
- }
-
- private void resolve_array_type_references (Api.Array ptr) {
- Api.Item data_type = ptr.data_type;
- if (data_type == null) {
- // void
- } else if (data_type is Api.Array) {
- resolve_array_type_references ((Api.Array) data_type);
- } else if (data_type is Pointer) {
- resolve_pointer_type_references ((Api.Pointer) data_type);
- } else {
- resolve_type_reference ((TypeReference) data_type);
- }
- }
-
- private void resolve_pointer_type_references (Pointer ptr) {
- Api.Item type = ptr.data_type;
- if (type == null) {
- // void
- } else if (type is Api.Array) {
- resolve_array_type_references ((Api.Array) type);
- } else if (type is Pointer) {
- resolve_pointer_type_references ((Pointer) type);
- } else {
- resolve_type_reference ((TypeReference) type);
- }
- }
-
- private void resolve_type_reference (TypeReference reference) {
- Vala.DataType vtyperef = (Vala.DataType) reference.data;
- if (vtyperef is Vala.ErrorType) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
- if (verrdom != null) {
- reference.data_type = resolve (verrdom);
- } else {
- reference.data_type = glib_error;
- }
- } else if (vtyperef is Vala.DelegateType) {
- reference.data_type = resolve (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else if (vtyperef is Vala.GenericType) {
- reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
- } else if (vtyperef.data_type != null) {
- reference.data_type = resolve (vtyperef.data_type);
- }
-
- // Type parameters:
- foreach (TypeReference type_param_ref in reference.get_type_arguments ()) {
- resolve_type_reference (type_param_ref);
- }
-
- if (reference.data_type is Pointer) {
- resolve_pointer_type_references ((Pointer)reference.data_type);
- } else if (reference.data_type is Api.Array) {
- resolve_array_type_references ((Api.Array)reference.data_type);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_tree (Api.Tree item) {
- this.root = item;
- item.accept_children (this);
- this.root = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_package (Package item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Namespace item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Interface item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (var type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Class item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (TypeReference type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Struct item) {
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Property item) {
- Vala.Property vala_property = item.data as Vala.Property;
- Vala.Property? base_vala_property = null;
-
- if (vala_property.base_property != null) {
- base_vala_property = vala_property.base_property;
- } else if (vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property == vala_property && vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property != null) {
- item.base_property = (Property?) resolve (base_vala_property);
- }
-
- resolve_type_reference (item.property_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Field item) {
- resolve_type_reference (item.field_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Constant item) {
- resolve_type_reference (item.constant_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Delegate item) {
- Vala.Delegate vala_delegate = item.data as Vala.Delegate;
-
- resolve_type_reference (item.return_type);
-
- resolve_thrown_list (item, vala_delegate.get_error_types ());
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Api.Signal item) {
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Method item) {
- Vala.Method vala_method = item.data as Vala.Method;
- Vala.Method? base_vala_method = null;
- if (vala_method.base_method != null) {
- base_vala_method = vala_method.base_method;
- } else if (vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method == vala_method && vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method != null) {
- item.base_method = (Method?) resolve (base_vala_method);
- }
-
- resolve_thrown_list (item, vala_method.get_error_types ());
-
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (TypeParameter item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (FormalParameter item) {
- if (item.ellipsis) {
- return;
- }
-
- if (((Vala.Parameter) item.data).initializer != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.Parameter) item.data).initializer.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- resolve_type_reference (item.parameter_type);
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (ErrorDomain item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (ErrorCode item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Enum item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Api.EnumValue item) {
-
- if (((Vala.EnumValue) item.data).value != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.EnumValue) item.data).value.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- item.accept_all_children (this, false);
- }
-}
-
-
-
diff --git a/src/driver/0.30.x/treebuilder.vala b/src/driver/0.30.x/treebuilder.vala
deleted file mode 100644
index fbf942942..000000000
--- a/src/driver/0.30.x/treebuilder.vala
+++ /dev/null
@@ -1,1524 +0,0 @@
-/* treebuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-using Gee;
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
- private ArrayList<PackageMetaData> packages = new ArrayList<PackageMetaData> ();
- private PackageMetaData source_package;
-
- private HashMap<Vala.SourceFile, SourceFile> files = new HashMap<Vala.SourceFile, SourceFile> ();
- private HashMap<Vala.Symbol, Symbol> symbol_map = new HashMap<Vala.Symbol, Symbol> ();
-
- private ErrorReporter reporter;
- private Settings settings;
-
- private Api.Node current_node;
- private Api.Tree tree;
-
- private Valadoc.Api.Class glib_error = null;
-
-
- //
- // Accessors
- //
-
- public Api.Class get_glib_error () {
- return glib_error;
- }
-
- public HashMap<Vala.Symbol, Symbol> get_symbol_map () {
- return symbol_map;
- }
-
-
- //
- //
- //
-
- private class PackageMetaData {
- public Package package;
- public HashMap<Vala.Namespace, Namespace> namespaces = new HashMap<Vala.Namespace, Namespace> ();
- public ArrayList<Vala.SourceFile> files = new ArrayList<Vala.SourceFile> ();
-
- public PackageMetaData (Package package) {
- this.package = package;
- }
-
- public Namespace get_namespace (Vala.Namespace vns, SourceFile file) {
- Namespace? ns = namespaces.get (vns);
- if (ns != null) {
- return ns;
- }
-
- // find documentation comment if existing:
- SourceComment? comment = null;
- if (vns.source_reference != null) {
- foreach (Vala.Comment c in vns.get_comments()) {
- if (c.source_reference.file == file.data ||
- (c.source_reference.file.file_type == Vala.SourceFileType.SOURCE
- && ((Vala.SourceFile) file.data).file_type == Vala.SourceFileType.SOURCE)
- ) {
- Vala.SourceReference pos = c.source_reference;
- if (c is Vala.GirComment) {
- comment = new GirSourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- } else {
- comment = new SourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- break;
- }
- }
- }
-
- // find parent if existing
- var parent_vns = vns.parent_symbol;
-
- if (parent_vns == null) {
- ns = new Namespace (package, file, vns.name, comment, vns);
- package.add_child (ns);
- } else {
- Namespace parent_ns = get_namespace ((Vala.Namespace) parent_vns, file);
- ns = new Namespace (parent_ns, file, vns.name, comment, vns);
- parent_ns.add_child (ns);
- }
-
- namespaces.set (vns, ns);
- return ns;
- }
-
- public void register_source_file (Vala.SourceFile file) {
- files.add (file);
- }
-
- public bool is_package_for_file (Vala.SourceFile source_file) {
- if (source_file.file_type == Vala.SourceFileType.SOURCE && !package.is_package) {
- return true;
- }
-
- return files.contains (source_file);
- }
- }
-
-
- //
- // Type constructor translation helpers:
- //
-
- private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
- Pointer ptr = new Pointer (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.base_type;
- if (vntype is Vala.PointerType) {
- ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
- } else if (vntype is Vala.ArrayType) {
- ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
- } else {
- ptr.data_type = create_type_reference (vntype, ptr, caller);
- }
-
- return ptr;
- }
-
- private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
- Api.Array arr = new Api.Array (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.element_type;
- if (vntype is Vala.ArrayType) {
- arr.data_type = create_type_reference (vntype, arr, caller);
- } else {
- arr.data_type = create_type_reference (vntype, arr, caller);
- }
-
- return arr;
- }
-
- private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
- bool is_nullable = vtyperef != null
- && vtyperef.nullable
- && !(vtyperef is Vala.GenericType)
- && !(vtyperef is Vala.PointerType);
- string? signature = (vtyperef != null
- && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
- bool pass_ownership = type_reference_pass_ownership (vtyperef);
- Ownership ownership = get_type_reference_ownership (vtyperef);
- bool is_dynamic = vtyperef != null && vtyperef.is_dynamic;
-
- TypeReference type_ref = new TypeReference (parent,
- ownership,
- pass_ownership,
- is_dynamic,
- is_nullable,
- signature,
- vtyperef);
-
- if (vtyperef is Vala.PointerType) {
- type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef, type_ref, caller);
- } else if (vtyperef is Vala.ArrayType) {
- type_ref.data_type = create_array ((Vala.ArrayType) vtyperef, type_ref, caller);
- //} else if (vtyperef is Vala.GenericType) {
- // type_ref.data_type = new TypeParameter (caller,
- // caller.get_source_file (),
- // ((Vala.GenericType) vtyperef).type_parameter.name,
- // vtyperef);
- }
-
- // type parameters:
- if (vtyperef != null) {
- foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
- var type_param = create_type_reference (vdtype, type_ref, caller);
- type_ref.add_type_argument (type_param);
- }
- }
-
- return type_ref;
- }
-
-
-
- //
- // Translation helpers:
- //
-
- private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
- // attributes without arguments:
- string[] attributes = {
- "ReturnsModifiedPointer",
- "DestroysInstance",
- "GenericAccessors",
- "NoAccessorMethod",
- "NoArrayLength",
- "Experimental",
- "Diagnostics",
- "PrintfFormat",
- "PointerType",
- "ScanfFormat",
- "ThreadLocal",
- "SimpleType",
- "HasEmitter",
- "ModuleInit",
- "NoWrapper",
- "Immutable",
- "ErrorBase",
- "NoReturn",
- "NoThrow",
- "Compact",
- "Assert",
- "Flags"
- };
-
- string? tmp = "";
-
- foreach (Vala.Attribute att in lst) {
- if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- new_attribute.add_boolean ("has_target", false, att);
- parent.add_attribute (new_attribute);
- } else if (att.name == "Deprecated") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
-
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- } else if (att.name in attributes) {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- }
- }
- }
-
- private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
- }
-
- private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
- }
-
- private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
- }
-
- private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
- }
-
- private string? get_finalize_function_name (Vala.Class element) {
- if (!element.is_fundamental ()) {
- return null;
- }
-
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_free_function_name (Vala.Class element) {
- if (!element.is_compact) {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
- }
-
- private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
- }
-
- private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
- }
-
- private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
- }
-
- private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
- }
-
-
- private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
- }
-
- private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
- }
-
- private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
- }
-
- private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
- }
-
- private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
- }
-
- private string? get_nick (Vala.Property prop) {
- return Vala.CCodeBaseModule.get_ccode_nick (prop);
- }
-
- private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
- }
-
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- if (comment is Vala.GirComment) {
- var tmp = new GirSourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- if (((Vala.GirComment) comment).return_content != null) {
- Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
- tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content,
- file,
- return_pos.begin.line,
- return_pos.begin.column,
- return_pos.end.line,
- return_pos.end.column);
- }
-
- Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
- while (it.next ()) {
- Vala.Comment vala_param = it.get_value ();
- Vala.SourceReference param_pos = vala_param.source_reference;
- var param_comment = new SourceComment (vala_param.content,
- file,
- param_pos.begin.line,
- param_pos.begin.column,
- param_pos.end.line,
- param_pos.end.column);
- tmp.add_parameter_content (it.get_key (), param_comment);
- }
- return tmp;
- } else {
- return new SourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- }
-
- return null;
- }
-
- private string get_method_name (Vala.Method element) {
- if (element is Vala.CreationMethod) {
- if (element.name == ".new") {
- return element.parent_symbol.name;
- } else {
- return element.parent_symbol.name + "." + element.name;
- }
- }
-
- return element.name;
- }
-
- private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- }
-
- private string? get_private_cname (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- string? cname = get_cname (element);
- return (cname != null)? cname + "Private" : null;
- }
-
- private string? get_class_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_class_type_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
- return (name != null && name != "")? name : null;
- }
-
- private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
- string? name = get_is_type_macro_name (element);
- return (name != null)? name + "_CLASS" : null;
- }
-
- private string? get_type_function_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_type_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
- }
-
- private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && !((Vala.Class) element).is_compact)
- || element is Vala.Interface)
- {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- } else {
- return null;
- }
- }
-
- private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
- }
-
- private PackageMetaData? get_package_meta_data (Package pkg) {
- foreach (PackageMetaData data in packages) {
- if (data.package == pkg) {
- return data;
- }
- }
-
- return null;
- }
-
- private PackageMetaData register_package (Package package) {
- PackageMetaData meta_data = new PackageMetaData (package);
- tree.add_package (package);
- packages.add (meta_data);
- return meta_data;
- }
-
- private SourceFile register_source_file (PackageMetaData meta_data, Vala.SourceFile source_file) {
- SourceFile file = new SourceFile (meta_data.package,
- source_file.get_relative_filename (),
- source_file.get_csource_filename (),
- source_file);
- files.set (source_file, file);
-
- meta_data.register_source_file (source_file);
- return file;
- }
-
- private SourceFile? get_source_file (Vala.Symbol symbol) {
- Vala.SourceReference source_ref = symbol.source_reference;
- if (source_ref == null) {
- return null;
- }
-
- SourceFile? file = files.get (source_ref.file);
- assert (file != null);
- return file;
- }
-
- private Package? find_package_for_file (Vala.SourceFile source_file) {
- foreach (PackageMetaData pkg in this.packages) {
- if (pkg.is_package_for_file (source_file)) {
- return pkg.package;
- }
- }
-
- return null;
- }
-
-
- private Namespace get_namespace (Package pkg, Vala.Symbol symbol, SourceFile? file) {
- // Find the closest namespace in our vala-tree
- Vala.Symbol namespace_symbol = symbol;
- while (!(namespace_symbol is Vala.Namespace)) {
- namespace_symbol = namespace_symbol.parent_symbol;
- }
-
- PackageMetaData? meta_data = get_package_meta_data (pkg);
- assert (meta_data != null);
-
- return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
- }
-
- private MethodBindingType get_method_binding_type (Vala.Method element) {
- if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.is_abstract) {
- return MethodBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return MethodBindingType.VIRTUAL;
- } else if (element.overrides) {
- return MethodBindingType.OVERRIDE;
- } else if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.binding != Vala.MemberBinding.INSTANCE) {
- return MethodBindingType.STATIC;
- }
- return MethodBindingType.UNMODIFIED;
- }
-
-
- private SymbolAccessibility get_access_modifier(Vala.Symbol symbol) {
- switch (symbol.access) {
- case Vala.SymbolAccessibility.PROTECTED:
- return SymbolAccessibility.PROTECTED;
-
- case Vala.SymbolAccessibility.INTERNAL:
- return SymbolAccessibility.INTERNAL;
-
- case Vala.SymbolAccessibility.PRIVATE:
- return SymbolAccessibility.PRIVATE;
-
- case Vala.SymbolAccessibility.PUBLIC:
- return SymbolAccessibility.PUBLIC;
-
- default:
- error ("Unknown symbol accessibility modifier found");
- }
- }
-
- private PropertyAccessorType get_property_accessor_type (Vala.PropertyAccessor element) {
- if (element.construction) {
- if (element.writable) {
- return (PropertyAccessorType.CONSTRUCT | PropertyAccessorType.SET);
- }
- return PropertyAccessorType.CONSTRUCT;
- } else if (element.writable) {
- return PropertyAccessorType.SET;
- } else if (element.readable) {
- return PropertyAccessorType.GET;
- }
-
- error ("Unknown symbol accessibility type");
- }
-
- private bool type_reference_pass_ownership (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode? node = element.parent_node;
- if (node == null) {
- return false;
- }
- if (node is Vala.Parameter) {
- return (((Vala.Parameter)node).direction == Vala.ParameterDirection.IN &&
- ((Vala.Parameter)node).variable_type.value_owned);
- }
- if (node is Vala.Property) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_unowned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are weak, not unowned
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true)
- {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)
- ? element.is_weak ()
- : false;
- }
-
- private bool is_type_reference_owned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode parent = element.parent_node;
-
- // parameter:
- if (parent is Vala.Parameter) {
- if (((Vala.Parameter)parent).direction != Vala.ParameterDirection.IN) {
- return false;
- }
- return ((Vala.Parameter)parent).variable_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_weak (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are unowned, not weak
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false)
- {
- return false;
- }
-
- // arrays are unowned, not weak
- if (element is Vala.ArrayType) {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)? element.is_weak () : false;
- }
-
- private Ownership get_type_reference_ownership (Vala.DataType? element) {
- if (is_type_reference_owned (element)) {
- return Ownership.OWNED;
- } else if (is_type_reference_weak (element)) {
- return Ownership.WEAK;
- } else if (is_type_reference_unowned (element)) {
- return Ownership.UNOWNED;
- }
-
- return Ownership.DEFAULT;
- }
-
- private Ownership get_property_ownership (Vala.PropertyAccessor element) {
- if (element.value_type.value_owned) {
- return Ownership.OWNED;
- }
-
- // the exact type (weak, unowned) does not matter
- return Ownership.UNOWNED;
- }
-
- private PropertyBindingType get_property_binding_type (Vala.Property element) {
- if (element.is_abstract) {
- return PropertyBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return PropertyBindingType.VIRTUAL;
- } else if (element.overrides) {
- return PropertyBindingType.OVERRIDE;
- }
-
- return PropertyBindingType.UNMODIFIED;
- }
-
- private FormalParameterType get_formal_parameter_type (Vala.Parameter element) {
- if (element.direction == Vala.ParameterDirection.OUT) {
- return FormalParameterType.OUT;
- } else if (element.direction == Vala.ParameterDirection.REF) {
- return FormalParameterType.REF;
- } else if (element.direction == Vala.ParameterDirection.IN) {
- return FormalParameterType.IN;
- }
-
- error ("Unknown formal parameter type");
- }
-
-
- //
- // Vala tree creation:
- //
-
- private string get_package_name (string path) {
- string file_name = Path.get_basename (path);
- return file_name.substring (0, file_name.last_index_of_char ('.'));
- }
-
- private bool add_package (Vala.CodeContext context, string pkg) {
- // ignore multiple occurences of the same package
- if (context.has_package (pkg)) {
- return true;
- }
-
- string vapi_name = pkg + ".vapi";
- string gir_name = pkg + ".gir";
- foreach (string source_file in settings.source_files) {
- string basename = Path.get_basename (source_file);
- if (basename == vapi_name || basename == gir_name) {
- return true;
- }
- }
-
-
- var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
- if (package_path == null) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
- return false;
- }
-
- context.add_package (pkg);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
- context.add_source_file (vfile);
- Package vdpkg = new Package (pkg, true, null);
- register_source_file (register_package (vdpkg), vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)), pkg);
- return true;
- }
-
- private void add_deps (Vala.CodeContext context, string file_path, string pkg_name) {
- if (FileUtils.test (file_path, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (file_path, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep = dep.strip ();
- if (dep != "") {
- if (!add_package (context, dep)) {
- Vala.Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg_name));
- }
- }
- }
- } catch (FileError e) {
- Vala.Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
- }
-
- /**
- * Adds the specified packages to the list of used packages.
- *
- * @param context The code context
- * @param packages a list of package names
- */
- private void add_depencies (Vala.CodeContext context, string[] packages) {
- foreach (string package in packages) {
- if (!add_package (context, package)) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
- }
- }
- }
-
- /**
- * Add the specified source file to the context. Only .vala, .vapi, .gs,
- * and .c files are supported.
- */
- private void add_documented_files (Vala.CodeContext context, string[] sources) {
- if (sources == null) {
- return;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, source_file);
-
- if (context.profile == Vala.Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- context.root.add_using_directive (ns_ref);
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) {
- string file_name = get_package_name (source);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
- context.add_source_file (vfile);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (source), "%s.deps".printf (file_name)), file_name);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- tree.add_external_c_files (rpath);
- } else {
- Vala.Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Vala.Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- private Vala.CodeContext create_valac_tree (Settings settings) {
- // init context:
- var context = new Vala.CodeContext ();
- Vala.CodeContext.push (context);
-
-
- // settings:
- context.experimental = settings.experimental;
- context.experimental_non_null = settings.experimental || settings.experimental_non_null;
- context.vapi_directories = settings.vapi_directories;
- context.report.enable_warnings = settings.verbose;
- context.metadata_directories = settings.metadata_directories;
- context.gir_directories = settings.gir_directories;
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
-
- // add default packages:
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Vala.Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- for (int i = 2; i <= 30; i += 2) {
- context.add_define ("VALA_0_%d".printf (i));
- }
-
- if (context.profile == Vala.Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 24;
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- if (settings.target_glib != null && settings.target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
- Vala.Report.error (null, "Invalid format for --target-glib");
- }
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
-
- // default packages
- if (!this.add_package (context, "glib-2.0")) { //
- Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package (context, "gobject-2.0")) { //
- Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
-
- // add user defined files:
- add_depencies (context, settings.packages);
- if (reporter.errors > 0) {
- return context;
- }
-
- add_documented_files (context, settings.source_files);
- if (reporter.errors > 0) {
- return context;
- }
-
-
- // parse vala-code:
- Vala.Parser parser = new Vala.Parser ();
-
- parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- // parse gir:
- Vala.GirParser gir_parser = new Vala.GirParser ();
-
- gir_parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
-
-
- // check context:
- context.check ();
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- return context;
- }
-
-
-
- //
- // Valadoc tree creation:
- //
-
- private void process_children (Api.Node node, Vala.CodeNode element) {
- Api.Node old_node = current_node;
- current_node = node;
- element.accept_children (this);
- current_node = old_node;
- }
-
- private Api.Node get_parent_node_for (Vala.Symbol element) {
- if (current_node != null) {
- return current_node;
- }
-
- Vala.SourceFile vala_source_file = element.source_reference.file;
- Package package = find_package_for_file (vala_source_file);
- SourceFile? source_file = get_source_file (element);
-
- return get_namespace (package, element, source_file);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Vala.Namespace element) {
- element.accept_children (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_class == null && element.name == "string";
-
- Class node = new Class (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_private_cname (element),
- get_class_macro_name (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_class_type_macro_name (element),
- get_is_class_type_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- get_ccode_type_id (element),
- get_param_spec_function (element),
- get_ref_function (element),
- get_unref_function (element),
- get_free_function_name (element),
- get_finalize_function_name (element),
- get_take_value_function (element),
- get_get_value_function (element),
- get_set_value_function (element),
- element.is_fundamental (),
- element.is_abstract,
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // relations
- foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
- var type_ref = create_type_reference (vala_type_ref, node, node);
-
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else if (vala_type_ref.data_type is Vala.Class) {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
-
- // save GLib.Error
- if (glib_error == null && node.get_full_name () == "GLib.Error") {
- glib_error = node;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Interface node = new Interface (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_interface_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // prerequisites:
- foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
- TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_type == null
- && (element.is_boolean_type ()
- || element.is_floating_type ()
- || element.is_integer_type ());
-
- Struct node = new Struct (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- get_ccode_type_id (element),
- get_dup_function (element),
- get_copy_function (element),
- get_destroy_function (element),
- get_free_function (element),
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // parent type:
- Vala.ValueType? basetype = element.base_type as Vala.ValueType;
- if (basetype != null) {
- node.base_type = create_type_reference (basetype, node, node);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Field node = new Field (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element.binding == Vala.MemberBinding.STATIC,
- element.is_volatile,
- element);
- node.field_type = create_type_reference (element.variable_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Property node = new Property (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_nick (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- get_property_binding_type (element),
- element);
- node.property_type = create_type_reference (element.property_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // Process property type
- if (element.get_accessor != null) {
- var accessor = element.get_accessor;
- node.getter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- if (element.set_accessor != null) {
- var accessor = element.set_accessor;
- node.setter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Api.Signal node = new Api.Signal (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- (element.default_handler != null)? get_cname (element.default_handler) : null,
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- element.is_virtual,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Delegate node = new Delegate (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- !element.has_target,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Enum (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue element) {
- Api.Enum parent = (Enum) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.EnumValue (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Constant node = new Constant (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element);
- node.constant_type = create_type_reference (element.type_reference, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new ErrorDomain (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_quark_macro_name (element),
- get_quark_function_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode element) {
- Api.ErrorDomain parent = (ErrorDomain) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- if (file == null) {
- file = parent.get_source_file ();
- }
-
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.ErrorCode (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (Vala.TypeParameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- Symbol node = new TypeParameter (parent,
- file,
- element.name,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (Vala.Parameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- FormalParameter node = new FormalParameter (parent,
- file,
- element.name,
- get_access_modifier(element),
- get_formal_parameter_type (element),
- element.ellipsis,
- element);
- node.parameter_type = create_type_reference (element.variable_type, node, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
-
- //
- // startpoint:
- //
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.settings = settings;
- this.reporter = reporter;
-
- this.tree = new Api.Tree (reporter, settings);
- var context = create_valac_tree (settings);
- this.tree.data = context;
-
- reporter.warnings_offset = context.report.get_warnings ();
- reporter.errors_offset = context.report.get_errors ();
-
- if (context == null) {
- return null;
- }
-
- // TODO: Register all packages here
- // register packages included by gir-files
- foreach (Vala.SourceFile vfile in context.get_source_files ()) {
- if (vfile.file_type == Vala.SourceFileType.PACKAGE
- && vfile.get_nodes ().size > 0
- && files.has_key (vfile) == false)
- {
- Package vdpkg = new Package (get_package_name (vfile.filename), true, null);
- register_source_file (register_package (vdpkg), vfile);
- }
- }
-
- context.accept(this);
-
- return (reporter.errors == 0)? tree : null;
- }
-}
-
-
diff --git a/src/driver/0.32.x/Makefile.am b/src/driver/0.32.x/Makefile.am
deleted file mode 100644
index 3803a6988..000000000
--- a/src/driver/0.32.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.32 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_32_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.32.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.32 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_32_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.32.x/driver.vala b/src/driver/0.32.x/driver.vala
deleted file mode 100644
index 902d28d4b..000000000
--- a/src/driver/0.32.x/driver.vala
+++ /dev/null
@@ -1,70 +0,0 @@
-/* driver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
- private SymbolResolver resolver;
- private Api.Tree? tree;
-
- public void write_gir (Settings settings, ErrorReporter reporter) {
- var gir_writer = new Drivers.GirWriter (resolver);
-
- // put .gir file in current directory unless -d has been explicitly specified
- string gir_directory = ".";
- if (settings.gir_directory != null) {
- gir_directory = settings.gir_directory;
- }
-
- gir_writer.write_file ((Vala.CodeContext) tree.data,
- gir_directory,
- "%s-%s.gir".printf (settings.gir_namespace, settings.gir_version),
- settings.gir_namespace,
- settings.gir_version,
- settings.pkg_name);
- }
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- TreeBuilder builder = new TreeBuilder ();
- tree = builder.build (settings, reporter);
- if (reporter.errors > 0) {
- return null;
- }
-
- resolver = new SymbolResolver (builder);
- tree.accept (resolver);
-
- return tree;
- }
-}
-
-
-public Type register_plugin (Valadoc.ModuleLoader module_loader) {
- return typeof (Valadoc.Drivers.Driver);
-}
-
diff --git a/src/driver/0.32.x/girwriter.vala b/src/driver/0.32.x/girwriter.vala
deleted file mode 100644
index c250854d6..000000000
--- a/src/driver/0.32.x/girwriter.vala
+++ /dev/null
@@ -1,204 +0,0 @@
-/* girwriter.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-
-
-/**
- * Code visitor generating .gir file for the public interface.
- */
-public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
- private GtkdocRenderer renderer;
- private SymbolResolver resolver;
-
- public GirWriter (SymbolResolver resolver) {
- this.renderer = new GtkdocRenderer ();
- this.resolver = resolver;
- }
-
- private string? translate (Content.Comment? documentation) {
- if (documentation == null) {
- return null;
- }
-
- renderer.render_symbol (documentation);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- private string? translate_taglet (Content.Taglet? taglet) {
- if (taglet == null) {
- return null;
- }
-
- renderer.render_children (taglet);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- protected override string? get_interface_comment (Vala.Interface viface) {
- Interface iface = resolver.resolve (viface) as Interface;
- return translate (iface.documentation);
- }
-
- protected override string? get_struct_comment (Vala.Struct vst) {
- Struct st = resolver.resolve (vst) as Struct;
- return translate (st.documentation);
- }
-
- protected override string? get_enum_comment (Vala.Enum ven) {
- Enum en = resolver.resolve (ven) as Enum;
- return translate (en.documentation);
- }
-
- protected override string? get_class_comment (Vala.Class vc) {
- Class c = resolver.resolve (vc) as Class;
- return translate (c.documentation);
- }
-
- protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
- ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
- return translate (ecode.documentation);
- }
-
- protected override string? get_enum_value_comment (Vala.EnumValue vev) {
- Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
- return translate (ev.documentation);
- }
-
- protected override string? get_constant_comment (Vala.Constant vc) {
- Constant c = resolver.resolve (vc) as Constant;
- return translate (c.documentation);
- }
-
- protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
- ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
- return translate (edomain.documentation);
- }
-
- protected override string? get_field_comment (Vala.Field vf) {
- Field f = resolver.resolve (vf) as Field;
- return translate (f.documentation);
- }
-
- protected override string? get_delegate_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- return translate (cb.documentation);
- }
-
- protected override string? get_method_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- return translate (m.documentation);
- }
-
- protected override string? get_property_comment (Vala.Property vprop) {
- Property prop = resolver.resolve (vprop) as Property;
- return translate (prop.documentation);
- }
-
- protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- if (cb.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = cb.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_return_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- if (sig.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = sig.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_method_return_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- if (m.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = m.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- return translate (sig.documentation);
- }
-
- protected override string? get_parameter_comment (Vala.Parameter param) {
- Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
- if (symbol == null) {
- return null;
- }
-
- Content.Comment? documentation = symbol.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
- foreach (Content.Taglet _taglet in taglets) {
- Taglets.Param taglet = (Taglets.Param) _taglet;
- if (taglet.parameter_name == param.name) {
- return translate_taglet (taglet);
- }
- }
-
- return null;
- }
-}
-
-
diff --git a/src/driver/0.32.x/initializerbuilder.vala b/src/driver/0.32.x/initializerbuilder.vala
deleted file mode 100644
index 7b26ab51f..000000000
--- a/src/driver/0.32.x/initializerbuilder.vala
+++ /dev/null
@@ -1,669 +0,0 @@
-/* initializerbuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Content;
-using Gee;
-
-
-private class Valadoc.Api.InitializerBuilder : Vala.CodeVisitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private SignatureBuilder signature;
-
- private Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void write_node (Vala.Symbol vsymbol) {
- signature.append_symbol (resolve (vsymbol));
- }
-
- private void write_type (Vala.DataType vsymbol) {
- if (vsymbol.data_type != null) {
- write_node (vsymbol.data_type);
- } else {
- signature.append_literal ("null");
- }
-
- var type_args = vsymbol.get_type_arguments ();
- if (type_args.size > 0) {
- signature.append ("<");
- bool first = true;
- foreach (Vala.DataType type_arg in type_args) {
- if (!first) {
- signature.append (",");
- } else {
- first = false;
- }
- if (!type_arg.value_owned) {
- signature.append_keyword ("weak");
- }
- signature.append (type_arg.to_qualified_string (null));
- }
- signature.append (">");
- }
-
- if (vsymbol.nullable) {
- signature.append ("?");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_array_creation_expression (Vala.ArrayCreationExpression expr) {
- signature.append_keyword ("new");
- write_type (expr.element_type);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression size in expr.get_sizes ()) {
- if (!first) {
- signature.append (", ", false);
- }
- size.accept (this);
- first = false;
- }
-
- signature.append ("]", false);
-
- if (expr.initializer_list != null) {
- signature.append (" ", false);
- expr.initializer_list.accept (this);
- }
- }
-
- public InitializerBuilder (SignatureBuilder signature, HashMap<Vala.Symbol, Symbol> symbol_map) {
- this.symbol_map = symbol_map;
- this.signature = signature;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_binary_expression (Vala.BinaryExpression expr) {
- expr.left.accept (this);
-
- switch (expr.operator) {
- case Vala.BinaryOperator.PLUS:
- signature.append ("+ ");
- break;
-
- case Vala.BinaryOperator.MINUS:
- signature.append ("- ");
- break;
-
- case Vala.BinaryOperator.MUL:
- signature.append ("* ");
- break;
-
- case Vala.BinaryOperator.DIV:
- signature.append ("/ ");
- break;
-
- case Vala.BinaryOperator.MOD:
- signature.append ("% ");
- break;
-
- case Vala.BinaryOperator.SHIFT_LEFT:
- signature.append ("<< ");
- break;
-
- case Vala.BinaryOperator.SHIFT_RIGHT:
- signature.append (">> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN:
- signature.append ("< ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN:
- signature.append ("> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN_OR_EQUAL:
- signature.append ("<= ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN_OR_EQUAL:
- signature.append (">= ");
- break;
-
- case Vala.BinaryOperator.EQUALITY:
- signature.append ("== ");
- break;
-
- case Vala.BinaryOperator.INEQUALITY:
- signature.append ("!= ");
- break;
-
- case Vala.BinaryOperator.BITWISE_AND:
- signature.append ("& ");
- break;
-
- case Vala.BinaryOperator.BITWISE_OR:
- signature.append ("| ");
- break;
-
- case Vala.BinaryOperator.BITWISE_XOR:
- signature.append ("^ ");
- break;
-
- case Vala.BinaryOperator.AND:
- signature.append ("&& ");
- break;
-
- case Vala.BinaryOperator.OR:
- signature.append ("|| ");
- break;
-
- case Vala.BinaryOperator.IN:
- signature.append_keyword ("in");
- signature.append (" ");
- break;
-
- case Vala.BinaryOperator.COALESCE:
- signature.append ("?? ");
- break;
-
- default:
- assert_not_reached ();
- }
-
- expr.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_unary_expression (Vala.UnaryExpression expr) {
- switch (expr.operator) {
- case Vala.UnaryOperator.PLUS:
- signature.append ("+");
- break;
-
- case Vala.UnaryOperator.MINUS:
- signature.append ("-");
- break;
-
- case Vala.UnaryOperator.LOGICAL_NEGATION:
- signature.append ("!");
- break;
-
- case Vala.UnaryOperator.BITWISE_COMPLEMENT:
- signature.append ("~");
- break;
-
- case Vala.UnaryOperator.INCREMENT:
- signature.append ("++");
- break;
-
- case Vala.UnaryOperator.DECREMENT:
- signature.append ("--");
- break;
-
- case Vala.UnaryOperator.REF:
- signature.append_keyword ("ref");
- break;
-
- case Vala.UnaryOperator.OUT:
- signature.append_keyword ("out");
- break;
-
- default:
- assert_not_reached ();
- }
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_assignment (Vala.Assignment a) {
- a.left.accept (this);
-
- switch (a.operator) {
- case Vala.AssignmentOperator.SIMPLE:
- signature.append ("=");
- break;
-
- case Vala.AssignmentOperator.BITWISE_OR:
- signature.append ("|");
- break;
-
- case Vala.AssignmentOperator.BITWISE_AND:
- signature.append ("&");
- break;
-
- case Vala.AssignmentOperator.BITWISE_XOR:
- signature.append ("^");
- break;
-
- case Vala.AssignmentOperator.ADD:
- signature.append ("+");
- break;
-
- case Vala.AssignmentOperator.SUB:
- signature.append ("-");
- break;
-
- case Vala.AssignmentOperator.MUL:
- signature.append ("*");
- break;
-
- case Vala.AssignmentOperator.DIV:
- signature.append ("/");
- break;
-
- case Vala.AssignmentOperator.PERCENT:
- signature.append ("%");
- break;
-
- case Vala.AssignmentOperator.SHIFT_LEFT:
- signature.append ("<<");
- break;
-
- case Vala.AssignmentOperator.SHIFT_RIGHT:
- signature.append (">>");
- break;
-
- default:
- assert_not_reached ();
- }
-
- a.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_cast_expression (Vala.CastExpression expr) {
- if (expr.is_non_null_cast) {
- signature.append ("(!)");
- expr.inner.accept (this);
- return;
- }
-
- if (!expr.is_silent_cast) {
- signature.append ("(", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- expr.inner.accept (this);
-
- if (expr.is_silent_cast) {
- signature.append_keyword ("as");
- write_type (expr.type_reference);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_initializer_list (Vala.InitializerList list) {
- signature.append ("{", false);
-
- bool first = true;
- foreach (Vala.Expression initializer in list.get_initializers ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
- initializer.accept (this);
- }
-
- signature.append ("}", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_member_access (Vala.MemberAccess expr) {
- if (expr.symbol_reference != null) {
- expr.symbol_reference.accept (this);
- } else {
- signature.append (expr.member_name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_element_access (Vala.ElementAccess expr) {
- expr.container.accept (this);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression index in expr.get_indices ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
-
- index.accept (this);
- }
-
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_pointer_indirection (Vala.PointerIndirection expr) {
- signature.append ("*", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_addressof_expression (Vala.AddressofExpression expr) {
- signature.append ("&", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_reference_transfer_expression (Vala.ReferenceTransferExpression expr) {
- signature.append ("(", false).append_keyword ("owned", false).append (")", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_check (Vala.TypeCheck expr) {
- expr.expression.accept (this);
- signature.append_keyword ("is");
- write_type (expr.type_reference);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method_call (Vala.MethodCall expr) {
- // symbol-name:
- expr.call.symbol_reference.accept (this);
-
- // parameters:
- signature.append (" (", false);
- bool first = true;
- foreach (Vala.Expression literal in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
-
- literal.accept (this);
- first = false;
- }
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_slice_expression (Vala.SliceExpression expr) {
- expr.container.accept (this);
- signature.append ("[", false);
- expr.start.accept (this);
- signature.append (":", false);
- expr.stop.accept (this);
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_base_access (Vala.BaseAccess expr) {
- signature.append_keyword ("base", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_postfix_expression (Vala.PostfixExpression expr) {
- expr.inner.accept (this);
- if (expr.increment) {
- signature.append ("++", false);
- } else {
- signature.append ("--", false);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_object_creation_expression (Vala.ObjectCreationExpression expr) {
- if (!expr.struct_creation) {
- signature.append_keyword ("new");
- }
-
- signature.append_symbol (resolve (expr.symbol_reference));
-
- signature.append (" (", false);
-
- //TODO: rm conditional space
- bool first = true;
- foreach (Vala.Expression arg in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
- arg.accept (this);
- first = false;
- }
-
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_sizeof_expression (Vala.SizeofExpression expr) {
- signature.append_keyword ("sizeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_typeof_expression (Vala.TypeofExpression expr) {
- signature.append_keyword ("typeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_lambda_expression (Vala.LambdaExpression expr) {
- signature.append ("(", false);
-
- bool first = true;
- foreach (Vala.Parameter param in expr.get_parameters ()) {
- if (!first) {
- signature.append (", ", false);
- }
- signature.append (param.name, false);
- first = false;
- }
-
-
- signature.append (") => {", false);
- signature.append_highlighted (" [...] ", false);
- signature.append ("}", false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_boolean_literal (Vala.BooleanLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_character_literal (Vala.CharacterLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_integer_literal (Vala.IntegerLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_real_literal (Vala.RealLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_regex_literal (Vala.RegexLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_string_literal (Vala.StringLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_null_literal (Vala.NullLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field field) {
- write_node (field);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant constant) {
- write_node (constant);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue ev) {
- write_node (ev);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode ec) {
- write_node (ec);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate d) {
- write_node (d);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal sig) {
- write_node (sig);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class c) {
- write_node (c);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct s) {
- write_node (s);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface i) {
- write_node (i);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum en) {
- write_node (en);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain ed) {
- write_node (ed);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property prop) {
- write_node (prop);
- }
-}
-
diff --git a/src/driver/0.32.x/symbolresolver.vala b/src/driver/0.32.x/symbolresolver.vala
deleted file mode 100644
index 4adc06b1a..000000000
--- a/src/driver/0.32.x/symbolresolver.vala
+++ /dev/null
@@ -1,323 +0,0 @@
-/* symbolresolver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-public class Valadoc.Drivers.SymbolResolver : Visitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private Valadoc.Api.Class glib_error;
- private Api.Tree root;
-
- public SymbolResolver (TreeBuilder builder) {
- this.symbol_map = builder.get_symbol_map ();
- this.glib_error = builder.get_glib_error ();
- }
-
- public Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void resolve_thrown_list (Symbol symbol, Vala.List<Vala.DataType> types) {
- foreach (Vala.DataType type in types) {
- Vala.ErrorDomain vala_edom = (Vala.ErrorDomain) type.data_type;
- Symbol? edom = symbol_map.get (vala_edom);
- symbol.add_child (edom ?? glib_error);
- }
- }
-
- private void resolve_array_type_references (Api.Array ptr) {
- Api.Item data_type = ptr.data_type;
- if (data_type == null) {
- // void
- } else if (data_type is Api.Array) {
- resolve_array_type_references ((Api.Array) data_type);
- } else if (data_type is Pointer) {
- resolve_pointer_type_references ((Api.Pointer) data_type);
- } else {
- resolve_type_reference ((TypeReference) data_type);
- }
- }
-
- private void resolve_pointer_type_references (Pointer ptr) {
- Api.Item type = ptr.data_type;
- if (type == null) {
- // void
- } else if (type is Api.Array) {
- resolve_array_type_references ((Api.Array) type);
- } else if (type is Pointer) {
- resolve_pointer_type_references ((Pointer) type);
- } else {
- resolve_type_reference ((TypeReference) type);
- }
- }
-
- private void resolve_type_reference (TypeReference reference) {
- Vala.DataType vtyperef = (Vala.DataType) reference.data;
- if (vtyperef is Vala.ErrorType) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
- if (verrdom != null) {
- reference.data_type = resolve (verrdom);
- } else {
- reference.data_type = glib_error;
- }
- } else if (vtyperef is Vala.DelegateType) {
- reference.data_type = resolve (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else if (vtyperef is Vala.GenericType) {
- reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
- } else if (vtyperef.data_type != null) {
- reference.data_type = resolve (vtyperef.data_type);
- }
-
- // Type parameters:
- foreach (TypeReference type_param_ref in reference.get_type_arguments ()) {
- resolve_type_reference (type_param_ref);
- }
-
- if (reference.data_type is Pointer) {
- resolve_pointer_type_references ((Pointer)reference.data_type);
- } else if (reference.data_type is Api.Array) {
- resolve_array_type_references ((Api.Array)reference.data_type);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_tree (Api.Tree item) {
- this.root = item;
- item.accept_children (this);
- this.root = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_package (Package item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Namespace item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Interface item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (var type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Class item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (TypeReference type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Struct item) {
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Property item) {
- Vala.Property vala_property = item.data as Vala.Property;
- Vala.Property? base_vala_property = null;
-
- if (vala_property.base_property != null) {
- base_vala_property = vala_property.base_property;
- } else if (vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property == vala_property && vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property != null) {
- item.base_property = (Property?) resolve (base_vala_property);
- }
-
- resolve_type_reference (item.property_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Field item) {
- resolve_type_reference (item.field_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Constant item) {
- resolve_type_reference (item.constant_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Delegate item) {
- Vala.Delegate vala_delegate = item.data as Vala.Delegate;
-
- resolve_type_reference (item.return_type);
-
- resolve_thrown_list (item, vala_delegate.get_error_types ());
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Api.Signal item) {
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Method item) {
- Vala.Method vala_method = item.data as Vala.Method;
- Vala.Method? base_vala_method = null;
- if (vala_method.base_method != null) {
- base_vala_method = vala_method.base_method;
- } else if (vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method == vala_method && vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method != null) {
- item.base_method = (Method?) resolve (base_vala_method);
- }
-
- resolve_thrown_list (item, vala_method.get_error_types ());
-
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (TypeParameter item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (FormalParameter item) {
- if (item.ellipsis) {
- return;
- }
-
- if (((Vala.Parameter) item.data).initializer != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.Parameter) item.data).initializer.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- resolve_type_reference (item.parameter_type);
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (ErrorDomain item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (ErrorCode item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Enum item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Api.EnumValue item) {
-
- if (((Vala.EnumValue) item.data).value != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.EnumValue) item.data).value.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- item.accept_all_children (this, false);
- }
-}
-
-
-
diff --git a/src/driver/0.32.x/treebuilder.vala b/src/driver/0.32.x/treebuilder.vala
deleted file mode 100644
index 5b9c5ea9b..000000000
--- a/src/driver/0.32.x/treebuilder.vala
+++ /dev/null
@@ -1,1541 +0,0 @@
-/* treebuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-using Gee;
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
- private ArrayList<PackageMetaData> packages = new ArrayList<PackageMetaData> ();
- private PackageMetaData source_package;
-
- private HashMap<Vala.SourceFile, SourceFile> files = new HashMap<Vala.SourceFile, SourceFile> ();
- private HashMap<Vala.Symbol, Symbol> symbol_map = new HashMap<Vala.Symbol, Symbol> ();
-
- private ErrorReporter reporter;
- private Settings settings;
-
- private Api.Node current_node;
- private Api.Tree tree;
-
- private Valadoc.Api.Class glib_error = null;
-
-
- //
- // Accessors
- //
-
- public Api.Class get_glib_error () {
- return glib_error;
- }
-
- public HashMap<Vala.Symbol, Symbol> get_symbol_map () {
- return symbol_map;
- }
-
-
- //
- //
- //
-
- private class PackageMetaData {
- public Package package;
- public HashMap<Vala.Namespace, Namespace> namespaces = new HashMap<Vala.Namespace, Namespace> ();
- public ArrayList<Vala.SourceFile> files = new ArrayList<Vala.SourceFile> ();
-
- public PackageMetaData (Package package) {
- this.package = package;
- }
-
- public Namespace get_namespace (Vala.Namespace vns, SourceFile file) {
- Namespace? ns = namespaces.get (vns);
- if (ns != null) {
- return ns;
- }
-
- // find documentation comment if existing:
- SourceComment? comment = null;
- if (vns.source_reference != null) {
- foreach (Vala.Comment c in vns.get_comments()) {
- if (c.source_reference.file == file.data ||
- (c.source_reference.file.file_type == Vala.SourceFileType.SOURCE
- && ((Vala.SourceFile) file.data).file_type == Vala.SourceFileType.SOURCE)
- ) {
- Vala.SourceReference pos = c.source_reference;
- if (c is Vala.GirComment) {
- comment = new GirSourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- } else {
- comment = new SourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- break;
- }
- }
- }
-
- // find parent if existing
- var parent_vns = vns.parent_symbol;
-
- if (parent_vns == null) {
- ns = new Namespace (package, file, vns.name, comment, vns);
- package.add_child (ns);
- } else {
- Namespace parent_ns = get_namespace ((Vala.Namespace) parent_vns, file);
- ns = new Namespace (parent_ns, file, vns.name, comment, vns);
- parent_ns.add_child (ns);
- }
-
- namespaces.set (vns, ns);
- return ns;
- }
-
- public void register_source_file (Vala.SourceFile file) {
- files.add (file);
- }
-
- public bool is_package_for_file (Vala.SourceFile source_file) {
- if (source_file.file_type == Vala.SourceFileType.SOURCE && !package.is_package) {
- return true;
- }
-
- return files.contains (source_file);
- }
- }
-
-
- //
- // Type constructor translation helpers:
- //
-
- private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
- Pointer ptr = new Pointer (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.base_type;
- if (vntype is Vala.PointerType) {
- ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
- } else if (vntype is Vala.ArrayType) {
- ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
- } else {
- ptr.data_type = create_type_reference (vntype, ptr, caller);
- }
-
- return ptr;
- }
-
- private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
- Api.Array arr = new Api.Array (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.element_type;
- if (vntype is Vala.ArrayType) {
- arr.data_type = create_type_reference (vntype, arr, caller);
- } else {
- arr.data_type = create_type_reference (vntype, arr, caller);
- }
-
- return arr;
- }
-
- private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
- bool is_nullable = vtyperef != null
- && vtyperef.nullable
- && !(vtyperef is Vala.GenericType)
- && !(vtyperef is Vala.PointerType);
- string? signature = (vtyperef != null
- && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
- bool pass_ownership = type_reference_pass_ownership (vtyperef);
- Ownership ownership = get_type_reference_ownership (vtyperef);
- bool is_dynamic = vtyperef != null && vtyperef.is_dynamic;
-
- TypeReference type_ref = new TypeReference (parent,
- ownership,
- pass_ownership,
- is_dynamic,
- is_nullable,
- signature,
- vtyperef);
-
- if (vtyperef is Vala.PointerType) {
- type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef, type_ref, caller);
- } else if (vtyperef is Vala.ArrayType) {
- type_ref.data_type = create_array ((Vala.ArrayType) vtyperef, type_ref, caller);
- //} else if (vtyperef is Vala.GenericType) {
- // type_ref.data_type = new TypeParameter (caller,
- // caller.get_source_file (),
- // ((Vala.GenericType) vtyperef).type_parameter.name,
- // vtyperef);
- }
-
- // type parameters:
- if (vtyperef != null) {
- foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
- var type_param = create_type_reference (vdtype, type_ref, caller);
- type_ref.add_type_argument (type_param);
- }
- }
-
- return type_ref;
- }
-
-
-
- //
- // Translation helpers:
- //
-
- private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
- // attributes without arguments:
- string[] attributes = {
- "ReturnsModifiedPointer",
- "DestroysInstance",
- "GenericAccessors",
- "NoAccessorMethod",
- "NoArrayLength",
- "Experimental",
- "Diagnostics",
- "PrintfFormat",
- "PointerType",
- "ScanfFormat",
- "ThreadLocal",
- "SimpleType",
- "HasEmitter",
- "ModuleInit",
- "NoWrapper",
- "Immutable",
- "ErrorBase",
- "NoReturn",
- "NoThrow",
- "Compact",
- "Assert",
- "Flags"
- };
-
- string? tmp = "";
-
- foreach (Vala.Attribute att in lst) {
- if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- new_attribute.add_boolean ("has_target", false, att);
- parent.add_attribute (new_attribute);
- } else if (att.name == "Version") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- if ((tmp = att.args.get ("deprecated")) != null) {
- new_attribute.add_boolean ("deprecated", bool.parse (tmp), att);
- }
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
- if ((tmp = att.args.get ("deprecated_since")) != null) {
- new_attribute.add_string ("deprecated_since", tmp, att);
- if (att.args.get ("deprecated") == null) {
- new_attribute.add_boolean ("deprecated", true, att);
- }
- }
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- parent.add_attribute (new_attribute);
- } else if (att.name == "Deprecated") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- parent.add_attribute (new_attribute);
- } else if (att.name in attributes) {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- }
- }
- }
-
- private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
- }
-
- private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
- }
-
- private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
- }
-
- private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
- }
-
- private string? get_finalize_function_name (Vala.Class element) {
- if (!element.is_fundamental ()) {
- return null;
- }
-
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_free_function_name (Vala.Class element) {
- if (!element.is_compact) {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
- }
-
- private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
- }
-
- private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
- }
-
- private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
- }
-
- private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
- }
-
-
- private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
- }
-
- private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
- }
-
- private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
- }
-
- private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
- }
-
- private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
- }
-
- private string? get_nick (Vala.Property prop) {
- return Vala.CCodeBaseModule.get_ccode_nick (prop);
- }
-
- private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
- }
-
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- if (comment is Vala.GirComment) {
- var tmp = new GirSourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- if (((Vala.GirComment) comment).return_content != null) {
- Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
- tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content,
- file,
- return_pos.begin.line,
- return_pos.begin.column,
- return_pos.end.line,
- return_pos.end.column);
- }
-
- Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
- while (it.next ()) {
- Vala.Comment vala_param = it.get_value ();
- Vala.SourceReference param_pos = vala_param.source_reference;
- var param_comment = new SourceComment (vala_param.content,
- file,
- param_pos.begin.line,
- param_pos.begin.column,
- param_pos.end.line,
- param_pos.end.column);
- tmp.add_parameter_content (it.get_key (), param_comment);
- }
- return tmp;
- } else {
- return new SourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- }
-
- return null;
- }
-
- private string get_method_name (Vala.Method element) {
- if (element is Vala.CreationMethod) {
- if (element.name == ".new") {
- return element.parent_symbol.name;
- } else {
- return element.parent_symbol.name + "." + element.name;
- }
- }
-
- return element.name;
- }
-
- private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- }
-
- private string? get_private_cname (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- string? cname = get_cname (element);
- return (cname != null)? cname + "Private" : null;
- }
-
- private string? get_class_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_class_type_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
- return (name != null && name != "")? name : null;
- }
-
- private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
- string? name = get_is_type_macro_name (element);
- return (name != null)? name + "_CLASS" : null;
- }
-
- private string? get_type_function_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_type_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
- }
-
- private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && !((Vala.Class) element).is_compact)
- || element is Vala.Interface)
- {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- } else {
- return null;
- }
- }
-
- private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
- }
-
- private PackageMetaData? get_package_meta_data (Package pkg) {
- foreach (PackageMetaData data in packages) {
- if (data.package == pkg) {
- return data;
- }
- }
-
- return null;
- }
-
- private PackageMetaData register_package (Package package) {
- PackageMetaData meta_data = new PackageMetaData (package);
- tree.add_package (package);
- packages.add (meta_data);
- return meta_data;
- }
-
- private SourceFile register_source_file (PackageMetaData meta_data, Vala.SourceFile source_file) {
- SourceFile file = new SourceFile (meta_data.package,
- source_file.get_relative_filename (),
- source_file.get_csource_filename (),
- source_file);
- files.set (source_file, file);
-
- meta_data.register_source_file (source_file);
- return file;
- }
-
- private SourceFile? get_source_file (Vala.Symbol symbol) {
- Vala.SourceReference source_ref = symbol.source_reference;
- if (source_ref == null) {
- return null;
- }
-
- SourceFile? file = files.get (source_ref.file);
- assert (file != null);
- return file;
- }
-
- private Package? find_package_for_file (Vala.SourceFile source_file) {
- foreach (PackageMetaData pkg in this.packages) {
- if (pkg.is_package_for_file (source_file)) {
- return pkg.package;
- }
- }
-
- return null;
- }
-
-
- private Namespace get_namespace (Package pkg, Vala.Symbol symbol, SourceFile? file) {
- // Find the closest namespace in our vala-tree
- Vala.Symbol namespace_symbol = symbol;
- while (!(namespace_symbol is Vala.Namespace)) {
- namespace_symbol = namespace_symbol.parent_symbol;
- }
-
- PackageMetaData? meta_data = get_package_meta_data (pkg);
- assert (meta_data != null);
-
- return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
- }
-
- private MethodBindingType get_method_binding_type (Vala.Method element) {
- if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.is_abstract) {
- return MethodBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return MethodBindingType.VIRTUAL;
- } else if (element.overrides) {
- return MethodBindingType.OVERRIDE;
- } else if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.binding != Vala.MemberBinding.INSTANCE) {
- return MethodBindingType.STATIC;
- }
- return MethodBindingType.UNMODIFIED;
- }
-
-
- private SymbolAccessibility get_access_modifier(Vala.Symbol symbol) {
- switch (symbol.access) {
- case Vala.SymbolAccessibility.PROTECTED:
- return SymbolAccessibility.PROTECTED;
-
- case Vala.SymbolAccessibility.INTERNAL:
- return SymbolAccessibility.INTERNAL;
-
- case Vala.SymbolAccessibility.PRIVATE:
- return SymbolAccessibility.PRIVATE;
-
- case Vala.SymbolAccessibility.PUBLIC:
- return SymbolAccessibility.PUBLIC;
-
- default:
- error ("Unknown symbol accessibility modifier found");
- }
- }
-
- private PropertyAccessorType get_property_accessor_type (Vala.PropertyAccessor element) {
- if (element.construction) {
- if (element.writable) {
- return (PropertyAccessorType.CONSTRUCT | PropertyAccessorType.SET);
- }
- return PropertyAccessorType.CONSTRUCT;
- } else if (element.writable) {
- return PropertyAccessorType.SET;
- } else if (element.readable) {
- return PropertyAccessorType.GET;
- }
-
- error ("Unknown symbol accessibility type");
- }
-
- private bool type_reference_pass_ownership (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode? node = element.parent_node;
- if (node == null) {
- return false;
- }
- if (node is Vala.Parameter) {
- return (((Vala.Parameter)node).direction == Vala.ParameterDirection.IN &&
- ((Vala.Parameter)node).variable_type.value_owned);
- }
- if (node is Vala.Property) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_unowned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are weak, not unowned
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true)
- {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)
- ? element.is_weak ()
- : false;
- }
-
- private bool is_type_reference_owned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode parent = element.parent_node;
-
- // parameter:
- if (parent is Vala.Parameter) {
- if (((Vala.Parameter)parent).direction != Vala.ParameterDirection.IN) {
- return false;
- }
- return ((Vala.Parameter)parent).variable_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_weak (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are unowned, not weak
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false)
- {
- return false;
- }
-
- // arrays are unowned, not weak
- if (element is Vala.ArrayType) {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)? element.is_weak () : false;
- }
-
- private Ownership get_type_reference_ownership (Vala.DataType? element) {
- if (is_type_reference_owned (element)) {
- return Ownership.OWNED;
- } else if (is_type_reference_weak (element)) {
- return Ownership.WEAK;
- } else if (is_type_reference_unowned (element)) {
- return Ownership.UNOWNED;
- }
-
- return Ownership.DEFAULT;
- }
-
- private Ownership get_property_ownership (Vala.PropertyAccessor element) {
- if (element.value_type.value_owned) {
- return Ownership.OWNED;
- }
-
- // the exact type (weak, unowned) does not matter
- return Ownership.UNOWNED;
- }
-
- private PropertyBindingType get_property_binding_type (Vala.Property element) {
- if (element.is_abstract) {
- return PropertyBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return PropertyBindingType.VIRTUAL;
- } else if (element.overrides) {
- return PropertyBindingType.OVERRIDE;
- }
-
- return PropertyBindingType.UNMODIFIED;
- }
-
- private FormalParameterType get_formal_parameter_type (Vala.Parameter element) {
- if (element.direction == Vala.ParameterDirection.OUT) {
- return FormalParameterType.OUT;
- } else if (element.direction == Vala.ParameterDirection.REF) {
- return FormalParameterType.REF;
- } else if (element.direction == Vala.ParameterDirection.IN) {
- return FormalParameterType.IN;
- }
-
- error ("Unknown formal parameter type");
- }
-
-
- //
- // Vala tree creation:
- //
-
- private string get_package_name (string path) {
- string file_name = Path.get_basename (path);
- return file_name.substring (0, file_name.last_index_of_char ('.'));
- }
-
- private bool add_package (Vala.CodeContext context, string pkg) {
- // ignore multiple occurences of the same package
- if (context.has_package (pkg)) {
- return true;
- }
-
- string vapi_name = pkg + ".vapi";
- string gir_name = pkg + ".gir";
- foreach (string source_file in settings.source_files) {
- string basename = Path.get_basename (source_file);
- if (basename == vapi_name || basename == gir_name) {
- return true;
- }
- }
-
-
- var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
- if (package_path == null) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
- return false;
- }
-
- context.add_package (pkg);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
- context.add_source_file (vfile);
- Package vdpkg = new Package (pkg, true, null);
- register_source_file (register_package (vdpkg), vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)), pkg);
- return true;
- }
-
- private void add_deps (Vala.CodeContext context, string file_path, string pkg_name) {
- if (FileUtils.test (file_path, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (file_path, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep = dep.strip ();
- if (dep != "") {
- if (!add_package (context, dep)) {
- Vala.Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg_name));
- }
- }
- }
- } catch (FileError e) {
- Vala.Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
- }
-
- /**
- * Adds the specified packages to the list of used packages.
- *
- * @param context The code context
- * @param packages a list of package names
- */
- private void add_depencies (Vala.CodeContext context, string[] packages) {
- foreach (string package in packages) {
- if (!add_package (context, package)) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
- }
- }
- }
-
- /**
- * Add the specified source file to the context. Only .vala, .vapi, .gs,
- * and .c files are supported.
- */
- private void add_documented_files (Vala.CodeContext context, string[] sources) {
- if (sources == null) {
- return;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, source_file);
-
- if (context.profile == Vala.Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- context.root.add_using_directive (ns_ref);
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) {
- string file_name = get_package_name (source);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
- context.add_source_file (vfile);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (source), "%s.deps".printf (file_name)), file_name);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- tree.add_external_c_files (rpath);
- } else {
- Vala.Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Vala.Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- private Vala.CodeContext create_valac_tree (Settings settings) {
- // init context:
- var context = new Vala.CodeContext ();
- Vala.CodeContext.push (context);
-
-
- // settings:
- context.experimental = settings.experimental;
- context.experimental_non_null = settings.experimental || settings.experimental_non_null;
- context.vapi_directories = settings.vapi_directories;
- context.report.enable_warnings = settings.verbose;
- context.metadata_directories = settings.metadata_directories;
- context.gir_directories = settings.gir_directories;
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
-
- // add default packages:
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Vala.Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- for (int i = 2; i <= 32; i += 2) {
- context.add_define ("VALA_0_%d".printf (i));
- }
-
- if (context.profile == Vala.Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 24;
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- if (settings.target_glib != null && settings.target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
- Vala.Report.error (null, "Invalid format for --target-glib");
- }
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
-
- // default packages
- if (!this.add_package (context, "glib-2.0")) { //
- Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package (context, "gobject-2.0")) { //
- Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
-
- // add user defined files:
- add_depencies (context, settings.packages);
- if (reporter.errors > 0) {
- return context;
- }
-
- add_documented_files (context, settings.source_files);
- if (reporter.errors > 0) {
- return context;
- }
-
-
- // parse vala-code:
- Vala.Parser parser = new Vala.Parser ();
-
- parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- // parse gir:
- Vala.GirParser gir_parser = new Vala.GirParser ();
-
- gir_parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
-
-
- // check context:
- context.check ();
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- return context;
- }
-
-
-
- //
- // Valadoc tree creation:
- //
-
- private void process_children (Api.Node node, Vala.CodeNode element) {
- Api.Node old_node = current_node;
- current_node = node;
- element.accept_children (this);
- current_node = old_node;
- }
-
- private Api.Node get_parent_node_for (Vala.Symbol element) {
- if (current_node != null) {
- return current_node;
- }
-
- Vala.SourceFile vala_source_file = element.source_reference.file;
- Package package = find_package_for_file (vala_source_file);
- SourceFile? source_file = get_source_file (element);
-
- return get_namespace (package, element, source_file);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Vala.Namespace element) {
- element.accept_children (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_class == null && element.name == "string";
-
- Class node = new Class (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_private_cname (element),
- get_class_macro_name (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_class_type_macro_name (element),
- get_is_class_type_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- get_ccode_type_id (element),
- get_param_spec_function (element),
- get_ref_function (element),
- get_unref_function (element),
- get_free_function_name (element),
- get_finalize_function_name (element),
- get_take_value_function (element),
- get_get_value_function (element),
- get_set_value_function (element),
- element.is_fundamental (),
- element.is_abstract,
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // relations
- foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
- var type_ref = create_type_reference (vala_type_ref, node, node);
-
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else if (vala_type_ref.data_type is Vala.Class) {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
-
- // save GLib.Error
- if (glib_error == null && node.get_full_name () == "GLib.Error") {
- glib_error = node;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Interface node = new Interface (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_interface_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // prerequisites:
- foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
- TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_type == null
- && (element.is_boolean_type ()
- || element.is_floating_type ()
- || element.is_integer_type ());
-
- Struct node = new Struct (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- get_ccode_type_id (element),
- get_dup_function (element),
- get_copy_function (element),
- get_destroy_function (element),
- get_free_function (element),
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // parent type:
- Vala.ValueType? basetype = element.base_type as Vala.ValueType;
- if (basetype != null) {
- node.base_type = create_type_reference (basetype, node, node);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Field node = new Field (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element.binding == Vala.MemberBinding.STATIC,
- element.is_volatile,
- element);
- node.field_type = create_type_reference (element.variable_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Property node = new Property (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_nick (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- get_property_binding_type (element),
- element);
- node.property_type = create_type_reference (element.property_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // Process property type
- if (element.get_accessor != null) {
- var accessor = element.get_accessor;
- node.getter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- if (element.set_accessor != null) {
- var accessor = element.set_accessor;
- node.setter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Api.Signal node = new Api.Signal (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- (element.default_handler != null)? get_cname (element.default_handler) : null,
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- element.is_virtual,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Delegate node = new Delegate (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- !element.has_target,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Enum (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue element) {
- Api.Enum parent = (Enum) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.EnumValue (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Constant node = new Constant (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element);
- node.constant_type = create_type_reference (element.type_reference, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new ErrorDomain (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_quark_macro_name (element),
- get_quark_function_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode element) {
- Api.ErrorDomain parent = (ErrorDomain) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- if (file == null) {
- file = parent.get_source_file ();
- }
-
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.ErrorCode (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (Vala.TypeParameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- Symbol node = new TypeParameter (parent,
- file,
- element.name,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (Vala.Parameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- FormalParameter node = new FormalParameter (parent,
- file,
- element.name,
- get_access_modifier(element),
- get_formal_parameter_type (element),
- element.ellipsis,
- element);
- node.parameter_type = create_type_reference (element.variable_type, node, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
-
- //
- // startpoint:
- //
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.settings = settings;
- this.reporter = reporter;
-
- this.tree = new Api.Tree (reporter, settings);
- var context = create_valac_tree (settings);
- this.tree.data = context;
-
- reporter.warnings_offset = context.report.get_warnings ();
- reporter.errors_offset = context.report.get_errors ();
-
- if (context == null) {
- return null;
- }
-
- // TODO: Register all packages here
- // register packages included by gir-files
- foreach (Vala.SourceFile vfile in context.get_source_files ()) {
- if (vfile.file_type == Vala.SourceFileType.PACKAGE
- && vfile.get_nodes ().size > 0
- && files.has_key (vfile) == false)
- {
- Package vdpkg = new Package (get_package_name (vfile.filename), true, null);
- register_source_file (register_package (vdpkg), vfile);
- }
- }
-
- context.accept(this);
-
- return (reporter.errors == 0)? tree : null;
- }
-}
-
-
diff --git a/src/driver/0.34.x/Makefile.am b/src/driver/0.34.x/Makefile.am
deleted file mode 100644
index 93626cf03..000000000
--- a/src/driver/0.34.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.34 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_34_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.34.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.34 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_34_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.34.x/driver.vala b/src/driver/0.34.x/driver.vala
deleted file mode 100644
index 902d28d4b..000000000
--- a/src/driver/0.34.x/driver.vala
+++ /dev/null
@@ -1,70 +0,0 @@
-/* driver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
- private SymbolResolver resolver;
- private Api.Tree? tree;
-
- public void write_gir (Settings settings, ErrorReporter reporter) {
- var gir_writer = new Drivers.GirWriter (resolver);
-
- // put .gir file in current directory unless -d has been explicitly specified
- string gir_directory = ".";
- if (settings.gir_directory != null) {
- gir_directory = settings.gir_directory;
- }
-
- gir_writer.write_file ((Vala.CodeContext) tree.data,
- gir_directory,
- "%s-%s.gir".printf (settings.gir_namespace, settings.gir_version),
- settings.gir_namespace,
- settings.gir_version,
- settings.pkg_name);
- }
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- TreeBuilder builder = new TreeBuilder ();
- tree = builder.build (settings, reporter);
- if (reporter.errors > 0) {
- return null;
- }
-
- resolver = new SymbolResolver (builder);
- tree.accept (resolver);
-
- return tree;
- }
-}
-
-
-public Type register_plugin (Valadoc.ModuleLoader module_loader) {
- return typeof (Valadoc.Drivers.Driver);
-}
-
diff --git a/src/driver/0.34.x/girwriter.vala b/src/driver/0.34.x/girwriter.vala
deleted file mode 100644
index c250854d6..000000000
--- a/src/driver/0.34.x/girwriter.vala
+++ /dev/null
@@ -1,204 +0,0 @@
-/* girwriter.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-
-
-/**
- * Code visitor generating .gir file for the public interface.
- */
-public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
- private GtkdocRenderer renderer;
- private SymbolResolver resolver;
-
- public GirWriter (SymbolResolver resolver) {
- this.renderer = new GtkdocRenderer ();
- this.resolver = resolver;
- }
-
- private string? translate (Content.Comment? documentation) {
- if (documentation == null) {
- return null;
- }
-
- renderer.render_symbol (documentation);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- private string? translate_taglet (Content.Taglet? taglet) {
- if (taglet == null) {
- return null;
- }
-
- renderer.render_children (taglet);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- protected override string? get_interface_comment (Vala.Interface viface) {
- Interface iface = resolver.resolve (viface) as Interface;
- return translate (iface.documentation);
- }
-
- protected override string? get_struct_comment (Vala.Struct vst) {
- Struct st = resolver.resolve (vst) as Struct;
- return translate (st.documentation);
- }
-
- protected override string? get_enum_comment (Vala.Enum ven) {
- Enum en = resolver.resolve (ven) as Enum;
- return translate (en.documentation);
- }
-
- protected override string? get_class_comment (Vala.Class vc) {
- Class c = resolver.resolve (vc) as Class;
- return translate (c.documentation);
- }
-
- protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
- ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
- return translate (ecode.documentation);
- }
-
- protected override string? get_enum_value_comment (Vala.EnumValue vev) {
- Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
- return translate (ev.documentation);
- }
-
- protected override string? get_constant_comment (Vala.Constant vc) {
- Constant c = resolver.resolve (vc) as Constant;
- return translate (c.documentation);
- }
-
- protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
- ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
- return translate (edomain.documentation);
- }
-
- protected override string? get_field_comment (Vala.Field vf) {
- Field f = resolver.resolve (vf) as Field;
- return translate (f.documentation);
- }
-
- protected override string? get_delegate_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- return translate (cb.documentation);
- }
-
- protected override string? get_method_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- return translate (m.documentation);
- }
-
- protected override string? get_property_comment (Vala.Property vprop) {
- Property prop = resolver.resolve (vprop) as Property;
- return translate (prop.documentation);
- }
-
- protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- if (cb.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = cb.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_return_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- if (sig.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = sig.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_method_return_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- if (m.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = m.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- return translate (sig.documentation);
- }
-
- protected override string? get_parameter_comment (Vala.Parameter param) {
- Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
- if (symbol == null) {
- return null;
- }
-
- Content.Comment? documentation = symbol.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
- foreach (Content.Taglet _taglet in taglets) {
- Taglets.Param taglet = (Taglets.Param) _taglet;
- if (taglet.parameter_name == param.name) {
- return translate_taglet (taglet);
- }
- }
-
- return null;
- }
-}
-
-
diff --git a/src/driver/0.34.x/initializerbuilder.vala b/src/driver/0.34.x/initializerbuilder.vala
deleted file mode 100644
index 7b26ab51f..000000000
--- a/src/driver/0.34.x/initializerbuilder.vala
+++ /dev/null
@@ -1,669 +0,0 @@
-/* initializerbuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Content;
-using Gee;
-
-
-private class Valadoc.Api.InitializerBuilder : Vala.CodeVisitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private SignatureBuilder signature;
-
- private Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void write_node (Vala.Symbol vsymbol) {
- signature.append_symbol (resolve (vsymbol));
- }
-
- private void write_type (Vala.DataType vsymbol) {
- if (vsymbol.data_type != null) {
- write_node (vsymbol.data_type);
- } else {
- signature.append_literal ("null");
- }
-
- var type_args = vsymbol.get_type_arguments ();
- if (type_args.size > 0) {
- signature.append ("<");
- bool first = true;
- foreach (Vala.DataType type_arg in type_args) {
- if (!first) {
- signature.append (",");
- } else {
- first = false;
- }
- if (!type_arg.value_owned) {
- signature.append_keyword ("weak");
- }
- signature.append (type_arg.to_qualified_string (null));
- }
- signature.append (">");
- }
-
- if (vsymbol.nullable) {
- signature.append ("?");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_array_creation_expression (Vala.ArrayCreationExpression expr) {
- signature.append_keyword ("new");
- write_type (expr.element_type);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression size in expr.get_sizes ()) {
- if (!first) {
- signature.append (", ", false);
- }
- size.accept (this);
- first = false;
- }
-
- signature.append ("]", false);
-
- if (expr.initializer_list != null) {
- signature.append (" ", false);
- expr.initializer_list.accept (this);
- }
- }
-
- public InitializerBuilder (SignatureBuilder signature, HashMap<Vala.Symbol, Symbol> symbol_map) {
- this.symbol_map = symbol_map;
- this.signature = signature;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_binary_expression (Vala.BinaryExpression expr) {
- expr.left.accept (this);
-
- switch (expr.operator) {
- case Vala.BinaryOperator.PLUS:
- signature.append ("+ ");
- break;
-
- case Vala.BinaryOperator.MINUS:
- signature.append ("- ");
- break;
-
- case Vala.BinaryOperator.MUL:
- signature.append ("* ");
- break;
-
- case Vala.BinaryOperator.DIV:
- signature.append ("/ ");
- break;
-
- case Vala.BinaryOperator.MOD:
- signature.append ("% ");
- break;
-
- case Vala.BinaryOperator.SHIFT_LEFT:
- signature.append ("<< ");
- break;
-
- case Vala.BinaryOperator.SHIFT_RIGHT:
- signature.append (">> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN:
- signature.append ("< ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN:
- signature.append ("> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN_OR_EQUAL:
- signature.append ("<= ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN_OR_EQUAL:
- signature.append (">= ");
- break;
-
- case Vala.BinaryOperator.EQUALITY:
- signature.append ("== ");
- break;
-
- case Vala.BinaryOperator.INEQUALITY:
- signature.append ("!= ");
- break;
-
- case Vala.BinaryOperator.BITWISE_AND:
- signature.append ("& ");
- break;
-
- case Vala.BinaryOperator.BITWISE_OR:
- signature.append ("| ");
- break;
-
- case Vala.BinaryOperator.BITWISE_XOR:
- signature.append ("^ ");
- break;
-
- case Vala.BinaryOperator.AND:
- signature.append ("&& ");
- break;
-
- case Vala.BinaryOperator.OR:
- signature.append ("|| ");
- break;
-
- case Vala.BinaryOperator.IN:
- signature.append_keyword ("in");
- signature.append (" ");
- break;
-
- case Vala.BinaryOperator.COALESCE:
- signature.append ("?? ");
- break;
-
- default:
- assert_not_reached ();
- }
-
- expr.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_unary_expression (Vala.UnaryExpression expr) {
- switch (expr.operator) {
- case Vala.UnaryOperator.PLUS:
- signature.append ("+");
- break;
-
- case Vala.UnaryOperator.MINUS:
- signature.append ("-");
- break;
-
- case Vala.UnaryOperator.LOGICAL_NEGATION:
- signature.append ("!");
- break;
-
- case Vala.UnaryOperator.BITWISE_COMPLEMENT:
- signature.append ("~");
- break;
-
- case Vala.UnaryOperator.INCREMENT:
- signature.append ("++");
- break;
-
- case Vala.UnaryOperator.DECREMENT:
- signature.append ("--");
- break;
-
- case Vala.UnaryOperator.REF:
- signature.append_keyword ("ref");
- break;
-
- case Vala.UnaryOperator.OUT:
- signature.append_keyword ("out");
- break;
-
- default:
- assert_not_reached ();
- }
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_assignment (Vala.Assignment a) {
- a.left.accept (this);
-
- switch (a.operator) {
- case Vala.AssignmentOperator.SIMPLE:
- signature.append ("=");
- break;
-
- case Vala.AssignmentOperator.BITWISE_OR:
- signature.append ("|");
- break;
-
- case Vala.AssignmentOperator.BITWISE_AND:
- signature.append ("&");
- break;
-
- case Vala.AssignmentOperator.BITWISE_XOR:
- signature.append ("^");
- break;
-
- case Vala.AssignmentOperator.ADD:
- signature.append ("+");
- break;
-
- case Vala.AssignmentOperator.SUB:
- signature.append ("-");
- break;
-
- case Vala.AssignmentOperator.MUL:
- signature.append ("*");
- break;
-
- case Vala.AssignmentOperator.DIV:
- signature.append ("/");
- break;
-
- case Vala.AssignmentOperator.PERCENT:
- signature.append ("%");
- break;
-
- case Vala.AssignmentOperator.SHIFT_LEFT:
- signature.append ("<<");
- break;
-
- case Vala.AssignmentOperator.SHIFT_RIGHT:
- signature.append (">>");
- break;
-
- default:
- assert_not_reached ();
- }
-
- a.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_cast_expression (Vala.CastExpression expr) {
- if (expr.is_non_null_cast) {
- signature.append ("(!)");
- expr.inner.accept (this);
- return;
- }
-
- if (!expr.is_silent_cast) {
- signature.append ("(", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- expr.inner.accept (this);
-
- if (expr.is_silent_cast) {
- signature.append_keyword ("as");
- write_type (expr.type_reference);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_initializer_list (Vala.InitializerList list) {
- signature.append ("{", false);
-
- bool first = true;
- foreach (Vala.Expression initializer in list.get_initializers ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
- initializer.accept (this);
- }
-
- signature.append ("}", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_member_access (Vala.MemberAccess expr) {
- if (expr.symbol_reference != null) {
- expr.symbol_reference.accept (this);
- } else {
- signature.append (expr.member_name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_element_access (Vala.ElementAccess expr) {
- expr.container.accept (this);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression index in expr.get_indices ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
-
- index.accept (this);
- }
-
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_pointer_indirection (Vala.PointerIndirection expr) {
- signature.append ("*", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_addressof_expression (Vala.AddressofExpression expr) {
- signature.append ("&", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_reference_transfer_expression (Vala.ReferenceTransferExpression expr) {
- signature.append ("(", false).append_keyword ("owned", false).append (")", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_check (Vala.TypeCheck expr) {
- expr.expression.accept (this);
- signature.append_keyword ("is");
- write_type (expr.type_reference);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method_call (Vala.MethodCall expr) {
- // symbol-name:
- expr.call.symbol_reference.accept (this);
-
- // parameters:
- signature.append (" (", false);
- bool first = true;
- foreach (Vala.Expression literal in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
-
- literal.accept (this);
- first = false;
- }
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_slice_expression (Vala.SliceExpression expr) {
- expr.container.accept (this);
- signature.append ("[", false);
- expr.start.accept (this);
- signature.append (":", false);
- expr.stop.accept (this);
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_base_access (Vala.BaseAccess expr) {
- signature.append_keyword ("base", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_postfix_expression (Vala.PostfixExpression expr) {
- expr.inner.accept (this);
- if (expr.increment) {
- signature.append ("++", false);
- } else {
- signature.append ("--", false);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_object_creation_expression (Vala.ObjectCreationExpression expr) {
- if (!expr.struct_creation) {
- signature.append_keyword ("new");
- }
-
- signature.append_symbol (resolve (expr.symbol_reference));
-
- signature.append (" (", false);
-
- //TODO: rm conditional space
- bool first = true;
- foreach (Vala.Expression arg in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
- arg.accept (this);
- first = false;
- }
-
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_sizeof_expression (Vala.SizeofExpression expr) {
- signature.append_keyword ("sizeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_typeof_expression (Vala.TypeofExpression expr) {
- signature.append_keyword ("typeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_lambda_expression (Vala.LambdaExpression expr) {
- signature.append ("(", false);
-
- bool first = true;
- foreach (Vala.Parameter param in expr.get_parameters ()) {
- if (!first) {
- signature.append (", ", false);
- }
- signature.append (param.name, false);
- first = false;
- }
-
-
- signature.append (") => {", false);
- signature.append_highlighted (" [...] ", false);
- signature.append ("}", false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_boolean_literal (Vala.BooleanLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_character_literal (Vala.CharacterLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_integer_literal (Vala.IntegerLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_real_literal (Vala.RealLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_regex_literal (Vala.RegexLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_string_literal (Vala.StringLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_null_literal (Vala.NullLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field field) {
- write_node (field);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant constant) {
- write_node (constant);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue ev) {
- write_node (ev);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode ec) {
- write_node (ec);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate d) {
- write_node (d);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal sig) {
- write_node (sig);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class c) {
- write_node (c);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct s) {
- write_node (s);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface i) {
- write_node (i);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum en) {
- write_node (en);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain ed) {
- write_node (ed);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property prop) {
- write_node (prop);
- }
-}
-
diff --git a/src/driver/0.34.x/symbolresolver.vala b/src/driver/0.34.x/symbolresolver.vala
deleted file mode 100644
index 4adc06b1a..000000000
--- a/src/driver/0.34.x/symbolresolver.vala
+++ /dev/null
@@ -1,323 +0,0 @@
-/* symbolresolver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-public class Valadoc.Drivers.SymbolResolver : Visitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private Valadoc.Api.Class glib_error;
- private Api.Tree root;
-
- public SymbolResolver (TreeBuilder builder) {
- this.symbol_map = builder.get_symbol_map ();
- this.glib_error = builder.get_glib_error ();
- }
-
- public Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void resolve_thrown_list (Symbol symbol, Vala.List<Vala.DataType> types) {
- foreach (Vala.DataType type in types) {
- Vala.ErrorDomain vala_edom = (Vala.ErrorDomain) type.data_type;
- Symbol? edom = symbol_map.get (vala_edom);
- symbol.add_child (edom ?? glib_error);
- }
- }
-
- private void resolve_array_type_references (Api.Array ptr) {
- Api.Item data_type = ptr.data_type;
- if (data_type == null) {
- // void
- } else if (data_type is Api.Array) {
- resolve_array_type_references ((Api.Array) data_type);
- } else if (data_type is Pointer) {
- resolve_pointer_type_references ((Api.Pointer) data_type);
- } else {
- resolve_type_reference ((TypeReference) data_type);
- }
- }
-
- private void resolve_pointer_type_references (Pointer ptr) {
- Api.Item type = ptr.data_type;
- if (type == null) {
- // void
- } else if (type is Api.Array) {
- resolve_array_type_references ((Api.Array) type);
- } else if (type is Pointer) {
- resolve_pointer_type_references ((Pointer) type);
- } else {
- resolve_type_reference ((TypeReference) type);
- }
- }
-
- private void resolve_type_reference (TypeReference reference) {
- Vala.DataType vtyperef = (Vala.DataType) reference.data;
- if (vtyperef is Vala.ErrorType) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
- if (verrdom != null) {
- reference.data_type = resolve (verrdom);
- } else {
- reference.data_type = glib_error;
- }
- } else if (vtyperef is Vala.DelegateType) {
- reference.data_type = resolve (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else if (vtyperef is Vala.GenericType) {
- reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
- } else if (vtyperef.data_type != null) {
- reference.data_type = resolve (vtyperef.data_type);
- }
-
- // Type parameters:
- foreach (TypeReference type_param_ref in reference.get_type_arguments ()) {
- resolve_type_reference (type_param_ref);
- }
-
- if (reference.data_type is Pointer) {
- resolve_pointer_type_references ((Pointer)reference.data_type);
- } else if (reference.data_type is Api.Array) {
- resolve_array_type_references ((Api.Array)reference.data_type);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_tree (Api.Tree item) {
- this.root = item;
- item.accept_children (this);
- this.root = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_package (Package item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Namespace item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Interface item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (var type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Class item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (TypeReference type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Struct item) {
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Property item) {
- Vala.Property vala_property = item.data as Vala.Property;
- Vala.Property? base_vala_property = null;
-
- if (vala_property.base_property != null) {
- base_vala_property = vala_property.base_property;
- } else if (vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property == vala_property && vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property != null) {
- item.base_property = (Property?) resolve (base_vala_property);
- }
-
- resolve_type_reference (item.property_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Field item) {
- resolve_type_reference (item.field_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Constant item) {
- resolve_type_reference (item.constant_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Delegate item) {
- Vala.Delegate vala_delegate = item.data as Vala.Delegate;
-
- resolve_type_reference (item.return_type);
-
- resolve_thrown_list (item, vala_delegate.get_error_types ());
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Api.Signal item) {
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Method item) {
- Vala.Method vala_method = item.data as Vala.Method;
- Vala.Method? base_vala_method = null;
- if (vala_method.base_method != null) {
- base_vala_method = vala_method.base_method;
- } else if (vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method == vala_method && vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method != null) {
- item.base_method = (Method?) resolve (base_vala_method);
- }
-
- resolve_thrown_list (item, vala_method.get_error_types ());
-
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (TypeParameter item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (FormalParameter item) {
- if (item.ellipsis) {
- return;
- }
-
- if (((Vala.Parameter) item.data).initializer != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.Parameter) item.data).initializer.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- resolve_type_reference (item.parameter_type);
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (ErrorDomain item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (ErrorCode item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Enum item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Api.EnumValue item) {
-
- if (((Vala.EnumValue) item.data).value != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.EnumValue) item.data).value.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- item.accept_all_children (this, false);
- }
-}
-
-
-
diff --git a/src/driver/0.34.x/treebuilder.vala b/src/driver/0.34.x/treebuilder.vala
deleted file mode 100644
index 9931efd15..000000000
--- a/src/driver/0.34.x/treebuilder.vala
+++ /dev/null
@@ -1,1541 +0,0 @@
-/* treebuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-using Gee;
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
- private ArrayList<PackageMetaData> packages = new ArrayList<PackageMetaData> ();
- private PackageMetaData source_package;
-
- private HashMap<Vala.SourceFile, SourceFile> files = new HashMap<Vala.SourceFile, SourceFile> ();
- private HashMap<Vala.Symbol, Symbol> symbol_map = new HashMap<Vala.Symbol, Symbol> ();
-
- private ErrorReporter reporter;
- private Settings settings;
-
- private Api.Node current_node;
- private Api.Tree tree;
-
- private Valadoc.Api.Class glib_error = null;
-
-
- //
- // Accessors
- //
-
- public Api.Class get_glib_error () {
- return glib_error;
- }
-
- public HashMap<Vala.Symbol, Symbol> get_symbol_map () {
- return symbol_map;
- }
-
-
- //
- //
- //
-
- private class PackageMetaData {
- public Package package;
- public HashMap<Vala.Namespace, Namespace> namespaces = new HashMap<Vala.Namespace, Namespace> ();
- public ArrayList<Vala.SourceFile> files = new ArrayList<Vala.SourceFile> ();
-
- public PackageMetaData (Package package) {
- this.package = package;
- }
-
- public Namespace get_namespace (Vala.Namespace vns, SourceFile file) {
- Namespace? ns = namespaces.get (vns);
- if (ns != null) {
- return ns;
- }
-
- // find documentation comment if existing:
- SourceComment? comment = null;
- if (vns.source_reference != null) {
- foreach (Vala.Comment c in vns.get_comments()) {
- if (c.source_reference.file == file.data ||
- (c.source_reference.file.file_type == Vala.SourceFileType.SOURCE
- && ((Vala.SourceFile) file.data).file_type == Vala.SourceFileType.SOURCE)
- ) {
- Vala.SourceReference pos = c.source_reference;
- if (c is Vala.GirComment) {
- comment = new GirSourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- } else {
- comment = new SourceComment (c.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- break;
- }
- }
- }
-
- // find parent if existing
- var parent_vns = vns.parent_symbol;
-
- if (parent_vns == null) {
- ns = new Namespace (package, file, vns.name, comment, vns);
- package.add_child (ns);
- } else {
- Namespace parent_ns = get_namespace ((Vala.Namespace) parent_vns, file);
- ns = new Namespace (parent_ns, file, vns.name, comment, vns);
- parent_ns.add_child (ns);
- }
-
- namespaces.set (vns, ns);
- return ns;
- }
-
- public void register_source_file (Vala.SourceFile file) {
- files.add (file);
- }
-
- public bool is_package_for_file (Vala.SourceFile source_file) {
- if (source_file.file_type == Vala.SourceFileType.SOURCE && !package.is_package) {
- return true;
- }
-
- return files.contains (source_file);
- }
- }
-
-
- //
- // Type constructor translation helpers:
- //
-
- private Pointer create_pointer (Vala.PointerType vtyperef, Item parent, Api.Node caller) {
- Pointer ptr = new Pointer (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.base_type;
- if (vntype is Vala.PointerType) {
- ptr.data_type = create_pointer ((Vala.PointerType) vntype, ptr, caller);
- } else if (vntype is Vala.ArrayType) {
- ptr.data_type = create_array ((Vala.ArrayType) vntype, ptr, caller);
- } else {
- ptr.data_type = create_type_reference (vntype, ptr, caller);
- }
-
- return ptr;
- }
-
- private Api.Array create_array (Vala.ArrayType vtyperef, Item parent, Api.Node caller) {
- Api.Array arr = new Api.Array (parent, vtyperef);
-
- Vala.DataType vntype = vtyperef.element_type;
- if (vntype is Vala.ArrayType) {
- arr.data_type = create_type_reference (vntype, arr, caller);
- } else {
- arr.data_type = create_type_reference (vntype, arr, caller);
- }
-
- return arr;
- }
-
- private TypeReference create_type_reference (Vala.DataType? vtyperef, Item parent, Api.Node caller) {
- bool is_nullable = vtyperef != null
- && vtyperef.nullable
- && !(vtyperef is Vala.GenericType)
- && !(vtyperef is Vala.PointerType);
- string? signature = (vtyperef != null
- && vtyperef.data_type != null)? Vala.GVariantModule.get_dbus_signature (vtyperef.data_type) : null;
- bool pass_ownership = type_reference_pass_ownership (vtyperef);
- Ownership ownership = get_type_reference_ownership (vtyperef);
- bool is_dynamic = vtyperef != null && vtyperef.is_dynamic;
-
- TypeReference type_ref = new TypeReference (parent,
- ownership,
- pass_ownership,
- is_dynamic,
- is_nullable,
- signature,
- vtyperef);
-
- if (vtyperef is Vala.PointerType) {
- type_ref.data_type = create_pointer ((Vala.PointerType) vtyperef, type_ref, caller);
- } else if (vtyperef is Vala.ArrayType) {
- type_ref.data_type = create_array ((Vala.ArrayType) vtyperef, type_ref, caller);
- //} else if (vtyperef is Vala.GenericType) {
- // type_ref.data_type = new TypeParameter (caller,
- // caller.get_source_file (),
- // ((Vala.GenericType) vtyperef).type_parameter.name,
- // vtyperef);
- }
-
- // type parameters:
- if (vtyperef != null) {
- foreach (Vala.DataType vdtype in vtyperef.get_type_arguments ()) {
- var type_param = create_type_reference (vdtype, type_ref, caller);
- type_ref.add_type_argument (type_param);
- }
- }
-
- return type_ref;
- }
-
-
-
- //
- // Translation helpers:
- //
-
- private void process_attributes (Api.Symbol parent, GLib.List<Vala.Attribute> lst) {
- // attributes without arguments:
- string[] attributes = {
- "ReturnsModifiedPointer",
- "DestroysInstance",
- "GenericAccessors",
- "NoAccessorMethod",
- "NoArrayLength",
- "Experimental",
- "Diagnostics",
- "PrintfFormat",
- "PointerType",
- "ScanfFormat",
- "ThreadLocal",
- "SimpleType",
- "HasEmitter",
- "ModuleInit",
- "NoWrapper",
- "Immutable",
- "ErrorBase",
- "NoReturn",
- "NoThrow",
- "Compact",
- "Assert",
- "Flags"
- };
-
- string? tmp = "";
-
- foreach (Vala.Attribute att in lst) {
- if (att.name == "CCode" && (tmp = att.args.get ("has_target")) != null && tmp == "false") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- new_attribute.add_boolean ("has_target", false, att);
- parent.add_attribute (new_attribute);
- } else if (att.name == "Version") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- if ((tmp = att.args.get ("deprecated")) != null) {
- new_attribute.add_boolean ("deprecated", bool.parse (tmp), att);
- }
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
- if ((tmp = att.args.get ("deprecated_since")) != null) {
- new_attribute.add_string ("deprecated_since", tmp, att);
- if (att.args.get ("deprecated") == null) {
- new_attribute.add_boolean ("deprecated", true, att);
- }
- }
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- parent.add_attribute (new_attribute);
- } else if (att.name == "Deprecated") {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- if ((tmp = att.args.get ("since")) != null) {
- new_attribute.add_string ("since", tmp, att);
- }
- if ((tmp = att.args.get ("replacement")) != null) {
- new_attribute.add_string ("replacement", tmp, att);
- }
- parent.add_attribute (new_attribute);
- } else if (att.name in attributes) {
- Attribute new_attribute = new Attribute (parent, parent.get_source_file (), att.name, att);
- parent.add_attribute (new_attribute);
- }
- }
- }
-
- private string? get_ccode_type_id (Vala.CodeNode node) {
- return Vala.CCodeBaseModule.get_ccode_type_id (node);
- }
-
- private bool is_reference_counting (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.is_reference_counting (sym);
- }
-
- private string? get_ref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
- }
-
- private string? get_unref_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
- }
-
- private string? get_finalize_function_name (Vala.Class element) {
- if (!element.is_fundamental ()) {
- return null;
- }
-
- return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_free_function_name (Vala.Class element) {
- if (!element.is_compact) {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_free_function (element);
- }
-
- private string? get_finish_name (Vala.Method m) {
- return Vala.CCodeBaseModule.get_ccode_finish_name (m);
- }
-
- private string? get_take_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
- }
-
- private string? get_get_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
- }
-
- private string? get_set_value_function (Vala.Class sym) {
- return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
- }
-
-
- private string? get_param_spec_function (Vala.CodeNode sym) {
- return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
- }
-
- private string? get_dup_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
- }
-
- private string? get_copy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_copy_function (sym);
- }
-
- private string? get_destroy_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_destroy_function (sym);
- }
-
- private string? get_free_function (Vala.TypeSymbol sym) {
- return Vala.CCodeBaseModule.get_ccode_free_function (sym);
- }
-
- private string? get_nick (Vala.Property prop) {
- return Vala.CCodeBaseModule.get_ccode_nick (prop);
- }
-
- private string? get_cname (Vala.Symbol symbol) {
- return Vala.CCodeBaseModule.get_ccode_name (symbol);
- }
-
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- if (comment is Vala.GirComment) {
- var tmp = new GirSourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- if (((Vala.GirComment) comment).return_content != null) {
- Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
- tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content,
- file,
- return_pos.begin.line,
- return_pos.begin.column,
- return_pos.end.line,
- return_pos.end.column);
- }
-
- Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
- while (it.next ()) {
- Vala.Comment vala_param = it.get_value ();
- Vala.SourceReference param_pos = vala_param.source_reference;
- var param_comment = new SourceComment (vala_param.content,
- file,
- param_pos.begin.line,
- param_pos.begin.column,
- param_pos.end.line,
- param_pos.end.column);
- tmp.add_parameter_content (it.get_key (), param_comment);
- }
- return tmp;
- } else {
- return new SourceComment (comment.content,
- file,
- pos.begin.line,
- pos.begin.column,
- pos.end.line,
- pos.end.column);
- }
- }
-
- return null;
- }
-
- private string get_method_name (Vala.Method element) {
- if (element is Vala.CreationMethod) {
- if (element.name == ".new") {
- return element.parent_symbol.name;
- } else {
- return element.parent_symbol.name + "." + element.name;
- }
- }
-
- return element.name;
- }
-
- private string? get_quark_macro_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- }
-
- private string? get_private_cname (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- string? cname = get_cname (element);
- return (cname != null)? cname + "Private" : null;
- }
-
- private string? get_class_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_class_type_macro_name (Vala.Class element) {
- if (element.is_compact) {
- return null;
- }
-
- return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string? get_is_type_macro_name (Vala.TypeSymbol element) {
- string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
- return (name != null && name != "")? name : null;
- }
-
- private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
- string? name = get_is_type_macro_name (element);
- return (name != null)? name + "_CLASS" : null;
- }
-
- private string? get_type_function_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
- }
-
- private string? get_type_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && ((Vala.Class) element).is_compact)
- || element is Vala.ErrorDomain
- || element is Vala.Delegate)
- {
- return null;
- }
-
- return Vala.CCodeBaseModule.get_ccode_type_id (element);
- }
-
- private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
- if ((element is Vala.Class
- && !((Vala.Class) element).is_compact)
- || element is Vala.Interface)
- {
- return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
- } else {
- return null;
- }
- }
-
- private string? get_interface_macro_name (Vala.Interface element) {
- return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
- }
-
- private string get_quark_function_name (Vala.ErrorDomain element) {
- return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
- }
-
- private PackageMetaData? get_package_meta_data (Package pkg) {
- foreach (PackageMetaData data in packages) {
- if (data.package == pkg) {
- return data;
- }
- }
-
- return null;
- }
-
- private PackageMetaData register_package (Package package) {
- PackageMetaData meta_data = new PackageMetaData (package);
- tree.add_package (package);
- packages.add (meta_data);
- return meta_data;
- }
-
- private SourceFile register_source_file (PackageMetaData meta_data, Vala.SourceFile source_file) {
- SourceFile file = new SourceFile (meta_data.package,
- source_file.get_relative_filename (),
- source_file.get_csource_filename (),
- source_file);
- files.set (source_file, file);
-
- meta_data.register_source_file (source_file);
- return file;
- }
-
- private SourceFile? get_source_file (Vala.Symbol symbol) {
- Vala.SourceReference source_ref = symbol.source_reference;
- if (source_ref == null) {
- return null;
- }
-
- SourceFile? file = files.get (source_ref.file);
- assert (file != null);
- return file;
- }
-
- private Package? find_package_for_file (Vala.SourceFile source_file) {
- foreach (PackageMetaData pkg in this.packages) {
- if (pkg.is_package_for_file (source_file)) {
- return pkg.package;
- }
- }
-
- return null;
- }
-
-
- private Namespace get_namespace (Package pkg, Vala.Symbol symbol, SourceFile? file) {
- // Find the closest namespace in our vala-tree
- Vala.Symbol namespace_symbol = symbol;
- while (!(namespace_symbol is Vala.Namespace)) {
- namespace_symbol = namespace_symbol.parent_symbol;
- }
-
- PackageMetaData? meta_data = get_package_meta_data (pkg);
- assert (meta_data != null);
-
- return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
- }
-
- private MethodBindingType get_method_binding_type (Vala.Method element) {
- if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.is_abstract) {
- return MethodBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return MethodBindingType.VIRTUAL;
- } else if (element.overrides) {
- return MethodBindingType.OVERRIDE;
- } else if (element.is_inline) {
- return MethodBindingType.INLINE;
- } else if (element.binding != Vala.MemberBinding.INSTANCE) {
- return MethodBindingType.STATIC;
- }
- return MethodBindingType.UNMODIFIED;
- }
-
-
- private SymbolAccessibility get_access_modifier(Vala.Symbol symbol) {
- switch (symbol.access) {
- case Vala.SymbolAccessibility.PROTECTED:
- return SymbolAccessibility.PROTECTED;
-
- case Vala.SymbolAccessibility.INTERNAL:
- return SymbolAccessibility.INTERNAL;
-
- case Vala.SymbolAccessibility.PRIVATE:
- return SymbolAccessibility.PRIVATE;
-
- case Vala.SymbolAccessibility.PUBLIC:
- return SymbolAccessibility.PUBLIC;
-
- default:
- error ("Unknown symbol accessibility modifier found");
- }
- }
-
- private PropertyAccessorType get_property_accessor_type (Vala.PropertyAccessor element) {
- if (element.construction) {
- if (element.writable) {
- return (PropertyAccessorType.CONSTRUCT | PropertyAccessorType.SET);
- }
- return PropertyAccessorType.CONSTRUCT;
- } else if (element.writable) {
- return PropertyAccessorType.SET;
- } else if (element.readable) {
- return PropertyAccessorType.GET;
- }
-
- error ("Unknown symbol accessibility type");
- }
-
- private bool type_reference_pass_ownership (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode? node = element.parent_node;
- if (node == null) {
- return false;
- }
- if (node is Vala.Parameter) {
- return (((Vala.Parameter)node).direction == Vala.ParameterDirection.IN &&
- ((Vala.Parameter)node).variable_type.value_owned);
- }
- if (node is Vala.Property) {
- return ((Vala.Property)node).property_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_unowned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are weak, not unowned
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true)
- {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)
- ? element.is_weak ()
- : false;
- }
-
- private bool is_type_reference_owned (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- weak Vala.CodeNode parent = element.parent_node;
-
- // parameter:
- if (parent is Vala.Parameter) {
- if (((Vala.Parameter)parent).direction != Vala.ParameterDirection.IN) {
- return false;
- }
- return ((Vala.Parameter)parent).variable_type.value_owned;
- }
-
- return false;
- }
-
- private bool is_type_reference_weak (Vala.DataType? element) {
- if (element == null) {
- return false;
- }
-
- // non ref counted types are unowned, not weak
- if (element.data_type is Vala.TypeSymbol
- && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false)
- {
- return false;
- }
-
- // arrays are unowned, not weak
- if (element is Vala.ArrayType) {
- return false;
- }
-
- // FormalParameters are weak by default
- return (element.parent_node is Vala.Parameter == false)? element.is_weak () : false;
- }
-
- private Ownership get_type_reference_ownership (Vala.DataType? element) {
- if (is_type_reference_owned (element)) {
- return Ownership.OWNED;
- } else if (is_type_reference_weak (element)) {
- return Ownership.WEAK;
- } else if (is_type_reference_unowned (element)) {
- return Ownership.UNOWNED;
- }
-
- return Ownership.DEFAULT;
- }
-
- private Ownership get_property_ownership (Vala.PropertyAccessor element) {
- if (element.value_type.value_owned) {
- return Ownership.OWNED;
- }
-
- // the exact type (weak, unowned) does not matter
- return Ownership.UNOWNED;
- }
-
- private PropertyBindingType get_property_binding_type (Vala.Property element) {
- if (element.is_abstract) {
- return PropertyBindingType.ABSTRACT;
- } else if (element.is_virtual) {
- return PropertyBindingType.VIRTUAL;
- } else if (element.overrides) {
- return PropertyBindingType.OVERRIDE;
- }
-
- return PropertyBindingType.UNMODIFIED;
- }
-
- private FormalParameterType get_formal_parameter_type (Vala.Parameter element) {
- if (element.direction == Vala.ParameterDirection.OUT) {
- return FormalParameterType.OUT;
- } else if (element.direction == Vala.ParameterDirection.REF) {
- return FormalParameterType.REF;
- } else if (element.direction == Vala.ParameterDirection.IN) {
- return FormalParameterType.IN;
- }
-
- error ("Unknown formal parameter type");
- }
-
-
- //
- // Vala tree creation:
- //
-
- private string get_package_name (string path) {
- string file_name = Path.get_basename (path);
- return file_name.substring (0, file_name.last_index_of_char ('.'));
- }
-
- private bool add_package (Vala.CodeContext context, string pkg) {
- // ignore multiple occurences of the same package
- if (context.has_package (pkg)) {
- return true;
- }
-
- string vapi_name = pkg + ".vapi";
- string gir_name = pkg + ".gir";
- foreach (string source_file in settings.source_files) {
- string basename = Path.get_basename (source_file);
- if (basename == vapi_name || basename == gir_name) {
- return true;
- }
- }
-
-
- var package_path = context.get_vapi_path (pkg) ?? context.get_gir_path (pkg);
- if (package_path == null) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (pkg));
- return false;
- }
-
- context.add_package (pkg);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, package_path);
- context.add_source_file (vfile);
- Package vdpkg = new Package (pkg, true, null);
- register_source_file (register_package (vdpkg), vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg)), pkg);
- return true;
- }
-
- private void add_deps (Vala.CodeContext context, string file_path, string pkg_name) {
- if (FileUtils.test (file_path, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (file_path, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- dep = dep.strip ();
- if (dep != "") {
- if (!add_package (context, dep)) {
- Vala.Report.error (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg_name));
- }
- }
- }
- } catch (FileError e) {
- Vala.Report.error (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
- }
-
- /**
- * Adds the specified packages to the list of used packages.
- *
- * @param context The code context
- * @param packages a list of package names
- */
- private void add_depencies (Vala.CodeContext context, string[] packages) {
- foreach (string package in packages) {
- if (!add_package (context, package)) {
- Vala.Report.error (null, "Package `%s' not found in specified Vala API directories or GObject-Introspection GIR directories".printf (package));
- }
- }
- }
-
- /**
- * Add the specified source file to the context. Only .vala, .vapi, .gs,
- * and .c files are supported.
- */
- private void add_documented_files (Vala.CodeContext context, string[] sources) {
- if (sources == null) {
- return;
- }
-
- foreach (string source in sources) {
- if (FileUtils.test (source, FileTest.EXISTS)) {
- var rpath = realpath (source);
- if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
- var source_file = new Vala.SourceFile (context, Vala.SourceFileType.SOURCE, rpath);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, source_file);
-
- if (context.profile == Vala.Profile.GOBJECT) {
- // import the GLib namespace by default (namespace of backend-specific standard library)
- var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
- source_file.add_using_directive (ns_ref);
- context.root.add_using_directive (ns_ref);
- }
-
- context.add_source_file (source_file);
- } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) {
- string file_name = get_package_name (source);
-
- var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
- context.add_source_file (vfile);
-
- if (source_package == null) {
- source_package = register_package (new Package (settings.pkg_name, false, null));
- }
-
- register_source_file (source_package, vfile);
-
- add_deps (context, Path.build_filename (Path.get_dirname (source), "%s.deps".printf (file_name)), file_name);
- } else if (source.has_suffix (".c")) {
- context.add_c_source_file (rpath);
- tree.add_external_c_files (rpath);
- } else {
- Vala.Report.error (null, "%s is not a supported source file type. Only .vala, .vapi, .gs, and .c files are supported.".printf (source));
- }
- } else {
- Vala.Report.error (null, "%s not found".printf (source));
- }
- }
- }
-
- private Vala.CodeContext create_valac_tree (Settings settings) {
- // init context:
- var context = new Vala.CodeContext ();
- Vala.CodeContext.push (context);
-
-
- // settings:
- context.experimental = settings.experimental;
- context.experimental_non_null = settings.experimental || settings.experimental_non_null;
- context.vapi_directories = settings.vapi_directories;
- context.report.enable_warnings = settings.verbose;
- context.metadata_directories = settings.metadata_directories;
- context.gir_directories = settings.gir_directories;
-
- if (settings.basedir == null) {
- context.basedir = realpath (".");
- } else {
- context.basedir = realpath (settings.basedir);
- }
-
- if (settings.directory != null) {
- context.directory = realpath (settings.directory);
- } else {
- context.directory = context.basedir;
- }
-
-
- // add default packages:
- if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
- context.profile = Vala.Profile.GOBJECT;
- context.add_define ("GOBJECT");
- }
-
-
- if (settings.defines != null) {
- foreach (string define in settings.defines) {
- context.add_define (define);
- }
- }
-
- for (int i = 2; i <= 34; i += 2) {
- context.add_define ("VALA_0_%d".printf (i));
- }
-
- if (context.profile == Vala.Profile.GOBJECT) {
- int glib_major = 2;
- int glib_minor = 24;
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- if (settings.target_glib != null && settings.target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
- Vala.Report.error (null, "Invalid format for --target-glib");
- }
-
- context.target_glib_major = glib_major;
- context.target_glib_minor = glib_minor;
- if (context.target_glib_major != 2) {
- Vala.Report.error (null, "This version of valac only supports GLib 2");
- }
-
- for (int i = 16; i <= glib_minor; i += 2) {
- context.add_define ("GLIB_2_%d".printf (i));
- }
-
- // default packages
- if (!this.add_package (context, "glib-2.0")) { //
- Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
- }
-
- if (!this.add_package (context, "gobject-2.0")) { //
- Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
- }
- }
-
- // add user defined files:
- add_depencies (context, settings.packages);
- if (reporter.errors > 0) {
- return context;
- }
-
- add_documented_files (context, settings.source_files);
- if (reporter.errors > 0) {
- return context;
- }
-
-
- // parse vala-code:
- Vala.Parser parser = new Vala.Parser ();
-
- parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- // parse gir:
- Vala.GirParser gir_parser = new Vala.GirParser ();
-
- gir_parser.parse (context);
- if (context.report.get_errors () > 0) {
- return context;
- }
-
-
-
- // check context:
- context.check ();
- if (context.report.get_errors () > 0) {
- return context;
- }
-
- return context;
- }
-
-
-
- //
- // Valadoc tree creation:
- //
-
- private void process_children (Api.Node node, Vala.CodeNode element) {
- Api.Node old_node = current_node;
- current_node = node;
- element.accept_children (this);
- current_node = old_node;
- }
-
- private Api.Node get_parent_node_for (Vala.Symbol element) {
- if (current_node != null) {
- return current_node;
- }
-
- Vala.SourceFile vala_source_file = element.source_reference.file;
- Package package = find_package_for_file (vala_source_file);
- SourceFile? source_file = get_source_file (element);
-
- return get_namespace (package, element, source_file);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Vala.Namespace element) {
- element.accept_children (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_class == null && element.name == "string";
-
- Class node = new Class (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_private_cname (element),
- get_class_macro_name (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_class_type_macro_name (element),
- get_is_class_type_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- get_ccode_type_id (element),
- get_param_spec_function (element),
- get_ref_function (element),
- get_unref_function (element),
- get_free_function_name (element),
- get_finalize_function_name (element),
- get_take_value_function (element),
- get_get_value_function (element),
- get_set_value_function (element),
- element.is_fundamental (),
- element.is_abstract,
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // relations
- foreach (Vala.DataType vala_type_ref in element.get_base_types ()) {
- var type_ref = create_type_reference (vala_type_ref, node, node);
-
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else if (vala_type_ref.data_type is Vala.Class) {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
-
- // save GLib.Error
- if (glib_error == null && node.get_full_name () == "GLib.Error") {
- glib_error = node;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Interface node = new Interface (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_is_type_macro_name (element),
- get_type_cast_macro_name (element),
- get_type_function_name (element),
- get_interface_macro_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // prerequisites:
- foreach (Vala.DataType vala_type_ref in element.get_prerequisites ()) {
- TypeReference type_ref = create_type_reference (vala_type_ref, node, node);
- if (vala_type_ref.data_type is Vala.Interface) {
- node.add_interface (type_ref);
- } else {
- node.base_type = type_ref;
- }
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- bool is_basic_type = element.base_type == null
- && (element.is_boolean_type ()
- || element.is_floating_type ()
- || element.is_integer_type ());
-
- Struct node = new Struct (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- get_ccode_type_id (element),
- get_dup_function (element),
- get_copy_function (element),
- get_destroy_function (element),
- get_free_function (element),
- is_basic_type,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // parent type:
- Vala.ValueType? basetype = element.base_type as Vala.ValueType;
- if (basetype != null) {
- node.base_type = create_type_reference (basetype, node, node);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Field node = new Field (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element.binding == Vala.MemberBinding.STATIC,
- element.is_volatile,
- element);
- node.field_type = create_type_reference (element.variable_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Property node = new Property (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_nick (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- get_property_binding_type (element),
- element);
- node.property_type = create_type_reference (element.property_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- // Process property type
- if (element.get_accessor != null) {
- var accessor = element.get_accessor;
- node.getter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- if (element.set_accessor != null) {
- var accessor = element.set_accessor;
- node.setter = new PropertyAccessor (node,
- file,
- element.name,
- get_access_modifier (accessor),
- get_cname (accessor),
- get_property_accessor_type (accessor),
- get_property_ownership (accessor),
- accessor);
- }
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Method node = new Method (parent,
- file,
- get_method_name (element),
- get_access_modifier (element),
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.dbus_result_name (element),
- (element.coroutine)? get_finish_name (element) : null,
- get_method_binding_type (element),
- element.coroutine,
- Vala.GDBusModule.is_dbus_visible (element),
- element is Vala.CreationMethod,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Api.Signal node = new Api.Signal (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- (element.default_handler != null)? get_cname (element.default_handler) : null,
- Vala.GDBusModule.get_dbus_name_for_member (element),
- Vala.GDBusModule.is_dbus_visible (element),
- element.is_virtual,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Delegate node = new Delegate (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- !element.has_target,
- element);
- node.return_type = create_type_reference (element.return_type, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Enum (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_type_macro_name (element),
- get_type_function_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue element) {
- Api.Enum parent = (Enum) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.EnumValue (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Constant node = new Constant (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- element);
- node.constant_type = create_type_reference (element.type_reference, node, node);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new ErrorDomain (parent,
- file,
- element.name,
- get_access_modifier (element),
- comment,
- get_cname (element),
- get_quark_macro_name (element),
- get_quark_function_name (element),
- Vala.GDBusModule.get_dbus_name (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode element) {
- Api.ErrorDomain parent = (ErrorDomain) get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
- if (file == null) {
- file = parent.get_source_file ();
- }
-
- SourceComment? comment = create_comment (element.comment);
-
- Symbol node = new Api.ErrorCode (parent,
- file,
- element.name,
- comment,
- get_cname (element),
- Vala.GDBusModule.get_dbus_name_for_member (element),
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_attributes (node, element.attributes);
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (Vala.TypeParameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- Symbol node = new TypeParameter (parent,
- file,
- element.name,
- element);
- symbol_map.set (element, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (Vala.Parameter element) {
- Api.Node parent = get_parent_node_for (element);
- SourceFile? file = get_source_file (element);
-
- FormalParameter node = new FormalParameter (parent,
- file,
- element.name,
- get_access_modifier(element),
- get_formal_parameter_type (element),
- element.ellipsis,
- element);
- node.parameter_type = create_type_reference (element.variable_type, node, node);
- parent.add_child (node);
-
- process_children (node, element);
- }
-
-
- //
- // startpoint:
- //
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.settings = settings;
- this.reporter = reporter;
-
- this.tree = new Api.Tree (reporter, settings);
- var context = create_valac_tree (settings);
- this.tree.data = context;
-
- reporter.warnings_offset = context.report.get_warnings ();
- reporter.errors_offset = context.report.get_errors ();
-
- if (context == null) {
- return null;
- }
-
- // TODO: Register all packages here
- // register packages included by gir-files
- foreach (Vala.SourceFile vfile in context.get_source_files ()) {
- if (vfile.file_type == Vala.SourceFileType.PACKAGE
- && vfile.get_nodes ().size > 0
- && files.has_key (vfile) == false)
- {
- Package vdpkg = new Package (get_package_name (vfile.filename), true, null);
- register_source_file (register_package (vdpkg), vfile);
- }
- }
-
- context.accept(this);
-
- return (reporter.errors == 0)? tree : null;
- }
-}
-
-
diff --git a/src/driver/0.36.x/Makefile.am b/src/driver/0.36.x/Makefile.am
deleted file mode 100644
index 4119ee0ff..000000000
--- a/src/driver/0.36.x/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-NULL =
-
-VERSIONED_VAPI_DIR = $(shell pkg-config libvala-0.36 --variable vapidir)
-
-AM_CFLAGS = \
- -DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
- -I $(top_builddir)/src/libvaladoc/ \
- $(GLIB_CFLAGS) \
- $(LIBGEE_CFLAGS) \
- $(LIBGVC_CFLAGS) \
- $(LIBVALA_0_36_X_CFLAGS) \
- -g \
- -w \
- $(NULL)
-
-AM_VALAFLAGS = \
- $(VALAFLAGS) \
- --vapidir $(VERSIONED_VAPI_DIR) \
- --vapidir $(top_srcdir)/src/vapi \
- --vapidir $(top_srcdir)/src/libvaladoc \
- --basedir $(srcdir) \
- --directory $(builddir) \
- -C \
- -g \
- $(NULL)
-
-BUILT_SOURCES = libdriver.vala.stamp
-
-driver_LTLIBRARIES = libdriver.la
-
-driverdir = $(libdir)/valadoc/drivers/0.36.x
-
-libdriver_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libdriver_la_VALASOURCES = \
- initializerbuilder.vala \
- symbolresolver.vala \
- treebuilder.vala \
- girwriter.vala \
- driver.vala \
- $(NULL)
-
-nodist_libdriver_la_SOURCES = \
- $(libdriver_la_VALASOURCES:.vala=.c) \
- $(NULL)
-
-libdriver.vala.stamp: $(libdriver_la_VALASOURCES) Makefile
- $(VALAC) \
- $(AM_VALAFLAGS) \
- --pkg libvala-0.36 \
- --pkg gee-0.8 \
- --pkg valadoc-1.0 \
- $(filter %.vala %.c,$^)
- touch $@
-
-libdriver_la_LIBADD = \
- $(top_builddir)/src/libvaladoc/libvaladoc.la \
- $(GLIB_LIBS) \
- $(LIBVALA_0_36_X_LIBS) \
- $(LIBGEE_LIBS) \
- $(LIBGVC_LIBS) \
- $(NULL)
-
-EXTRA_DIST = \
- $(libdriver_la_VALASOURCES) \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(nodist_libdriver_la_SOURCES) \
- $(NULL)
-
diff --git a/src/driver/0.36.x/driver.vala b/src/driver/0.36.x/driver.vala
deleted file mode 100644
index 902d28d4b..000000000
--- a/src/driver/0.36.x/driver.vala
+++ /dev/null
@@ -1,70 +0,0 @@
-/* driver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-
-/**
- * Creates an simpler, minimized, more abstract AST for valacs AST.
- */
-public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
- private SymbolResolver resolver;
- private Api.Tree? tree;
-
- public void write_gir (Settings settings, ErrorReporter reporter) {
- var gir_writer = new Drivers.GirWriter (resolver);
-
- // put .gir file in current directory unless -d has been explicitly specified
- string gir_directory = ".";
- if (settings.gir_directory != null) {
- gir_directory = settings.gir_directory;
- }
-
- gir_writer.write_file ((Vala.CodeContext) tree.data,
- gir_directory,
- "%s-%s.gir".printf (settings.gir_namespace, settings.gir_version),
- settings.gir_namespace,
- settings.gir_version,
- settings.pkg_name);
- }
-
- public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- TreeBuilder builder = new TreeBuilder ();
- tree = builder.build (settings, reporter);
- if (reporter.errors > 0) {
- return null;
- }
-
- resolver = new SymbolResolver (builder);
- tree.accept (resolver);
-
- return tree;
- }
-}
-
-
-public Type register_plugin (Valadoc.ModuleLoader module_loader) {
- return typeof (Valadoc.Drivers.Driver);
-}
-
diff --git a/src/driver/0.36.x/girwriter.vala b/src/driver/0.36.x/girwriter.vala
deleted file mode 100644
index c250854d6..000000000
--- a/src/driver/0.36.x/girwriter.vala
+++ /dev/null
@@ -1,204 +0,0 @@
-/* girwriter.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Api;
-
-
-/**
- * Code visitor generating .gir file for the public interface.
- */
-public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
- private GtkdocRenderer renderer;
- private SymbolResolver resolver;
-
- public GirWriter (SymbolResolver resolver) {
- this.renderer = new GtkdocRenderer ();
- this.resolver = resolver;
- }
-
- private string? translate (Content.Comment? documentation) {
- if (documentation == null) {
- return null;
- }
-
- renderer.render_symbol (documentation);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- private string? translate_taglet (Content.Taglet? taglet) {
- if (taglet == null) {
- return null;
- }
-
- renderer.render_children (taglet);
-
- return MarkupWriter.escape (renderer.content);
- }
-
- protected override string? get_interface_comment (Vala.Interface viface) {
- Interface iface = resolver.resolve (viface) as Interface;
- return translate (iface.documentation);
- }
-
- protected override string? get_struct_comment (Vala.Struct vst) {
- Struct st = resolver.resolve (vst) as Struct;
- return translate (st.documentation);
- }
-
- protected override string? get_enum_comment (Vala.Enum ven) {
- Enum en = resolver.resolve (ven) as Enum;
- return translate (en.documentation);
- }
-
- protected override string? get_class_comment (Vala.Class vc) {
- Class c = resolver.resolve (vc) as Class;
- return translate (c.documentation);
- }
-
- protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
- ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
- return translate (ecode.documentation);
- }
-
- protected override string? get_enum_value_comment (Vala.EnumValue vev) {
- Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
- return translate (ev.documentation);
- }
-
- protected override string? get_constant_comment (Vala.Constant vc) {
- Constant c = resolver.resolve (vc) as Constant;
- return translate (c.documentation);
- }
-
- protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
- ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
- return translate (edomain.documentation);
- }
-
- protected override string? get_field_comment (Vala.Field vf) {
- Field f = resolver.resolve (vf) as Field;
- return translate (f.documentation);
- }
-
- protected override string? get_delegate_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- return translate (cb.documentation);
- }
-
- protected override string? get_method_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- return translate (m.documentation);
- }
-
- protected override string? get_property_comment (Vala.Property vprop) {
- Property prop = resolver.resolve (vprop) as Property;
- return translate (prop.documentation);
- }
-
- protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
- Delegate cb = resolver.resolve (vcb) as Delegate;
- if (cb.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = cb.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_return_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- if (sig.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = sig.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_method_return_comment (Vala.Method vm) {
- Method m = resolver.resolve (vm) as Method;
- if (m.documentation == null) {
- return null;
- }
-
- Content.Comment? documentation = m.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
- foreach (Content.Taglet taglet in taglets) {
- return translate_taglet (taglet);
- }
-
- return null;
- }
-
- protected override string? get_signal_comment (Vala.Signal vsig) {
- Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
- return translate (sig.documentation);
- }
-
- protected override string? get_parameter_comment (Vala.Parameter param) {
- Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
- if (symbol == null) {
- return null;
- }
-
- Content.Comment? documentation = symbol.documentation;
- if (documentation == null) {
- return null;
- }
-
- Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
- foreach (Content.Taglet _taglet in taglets) {
- Taglets.Param taglet = (Taglets.Param) _taglet;
- if (taglet.parameter_name == param.name) {
- return translate_taglet (taglet);
- }
- }
-
- return null;
- }
-}
-
-
diff --git a/src/driver/0.36.x/initializerbuilder.vala b/src/driver/0.36.x/initializerbuilder.vala
deleted file mode 100644
index 7b26ab51f..000000000
--- a/src/driver/0.36.x/initializerbuilder.vala
+++ /dev/null
@@ -1,669 +0,0 @@
-/* initializerbuilder.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-
-using Valadoc.Content;
-using Gee;
-
-
-private class Valadoc.Api.InitializerBuilder : Vala.CodeVisitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private SignatureBuilder signature;
-
- private Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void write_node (Vala.Symbol vsymbol) {
- signature.append_symbol (resolve (vsymbol));
- }
-
- private void write_type (Vala.DataType vsymbol) {
- if (vsymbol.data_type != null) {
- write_node (vsymbol.data_type);
- } else {
- signature.append_literal ("null");
- }
-
- var type_args = vsymbol.get_type_arguments ();
- if (type_args.size > 0) {
- signature.append ("<");
- bool first = true;
- foreach (Vala.DataType type_arg in type_args) {
- if (!first) {
- signature.append (",");
- } else {
- first = false;
- }
- if (!type_arg.value_owned) {
- signature.append_keyword ("weak");
- }
- signature.append (type_arg.to_qualified_string (null));
- }
- signature.append (">");
- }
-
- if (vsymbol.nullable) {
- signature.append ("?");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_array_creation_expression (Vala.ArrayCreationExpression expr) {
- signature.append_keyword ("new");
- write_type (expr.element_type);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression size in expr.get_sizes ()) {
- if (!first) {
- signature.append (", ", false);
- }
- size.accept (this);
- first = false;
- }
-
- signature.append ("]", false);
-
- if (expr.initializer_list != null) {
- signature.append (" ", false);
- expr.initializer_list.accept (this);
- }
- }
-
- public InitializerBuilder (SignatureBuilder signature, HashMap<Vala.Symbol, Symbol> symbol_map) {
- this.symbol_map = symbol_map;
- this.signature = signature;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_binary_expression (Vala.BinaryExpression expr) {
- expr.left.accept (this);
-
- switch (expr.operator) {
- case Vala.BinaryOperator.PLUS:
- signature.append ("+ ");
- break;
-
- case Vala.BinaryOperator.MINUS:
- signature.append ("- ");
- break;
-
- case Vala.BinaryOperator.MUL:
- signature.append ("* ");
- break;
-
- case Vala.BinaryOperator.DIV:
- signature.append ("/ ");
- break;
-
- case Vala.BinaryOperator.MOD:
- signature.append ("% ");
- break;
-
- case Vala.BinaryOperator.SHIFT_LEFT:
- signature.append ("<< ");
- break;
-
- case Vala.BinaryOperator.SHIFT_RIGHT:
- signature.append (">> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN:
- signature.append ("< ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN:
- signature.append ("> ");
- break;
-
- case Vala.BinaryOperator.LESS_THAN_OR_EQUAL:
- signature.append ("<= ");
- break;
-
- case Vala.BinaryOperator.GREATER_THAN_OR_EQUAL:
- signature.append (">= ");
- break;
-
- case Vala.BinaryOperator.EQUALITY:
- signature.append ("== ");
- break;
-
- case Vala.BinaryOperator.INEQUALITY:
- signature.append ("!= ");
- break;
-
- case Vala.BinaryOperator.BITWISE_AND:
- signature.append ("& ");
- break;
-
- case Vala.BinaryOperator.BITWISE_OR:
- signature.append ("| ");
- break;
-
- case Vala.BinaryOperator.BITWISE_XOR:
- signature.append ("^ ");
- break;
-
- case Vala.BinaryOperator.AND:
- signature.append ("&& ");
- break;
-
- case Vala.BinaryOperator.OR:
- signature.append ("|| ");
- break;
-
- case Vala.BinaryOperator.IN:
- signature.append_keyword ("in");
- signature.append (" ");
- break;
-
- case Vala.BinaryOperator.COALESCE:
- signature.append ("?? ");
- break;
-
- default:
- assert_not_reached ();
- }
-
- expr.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_unary_expression (Vala.UnaryExpression expr) {
- switch (expr.operator) {
- case Vala.UnaryOperator.PLUS:
- signature.append ("+");
- break;
-
- case Vala.UnaryOperator.MINUS:
- signature.append ("-");
- break;
-
- case Vala.UnaryOperator.LOGICAL_NEGATION:
- signature.append ("!");
- break;
-
- case Vala.UnaryOperator.BITWISE_COMPLEMENT:
- signature.append ("~");
- break;
-
- case Vala.UnaryOperator.INCREMENT:
- signature.append ("++");
- break;
-
- case Vala.UnaryOperator.DECREMENT:
- signature.append ("--");
- break;
-
- case Vala.UnaryOperator.REF:
- signature.append_keyword ("ref");
- break;
-
- case Vala.UnaryOperator.OUT:
- signature.append_keyword ("out");
- break;
-
- default:
- assert_not_reached ();
- }
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_assignment (Vala.Assignment a) {
- a.left.accept (this);
-
- switch (a.operator) {
- case Vala.AssignmentOperator.SIMPLE:
- signature.append ("=");
- break;
-
- case Vala.AssignmentOperator.BITWISE_OR:
- signature.append ("|");
- break;
-
- case Vala.AssignmentOperator.BITWISE_AND:
- signature.append ("&");
- break;
-
- case Vala.AssignmentOperator.BITWISE_XOR:
- signature.append ("^");
- break;
-
- case Vala.AssignmentOperator.ADD:
- signature.append ("+");
- break;
-
- case Vala.AssignmentOperator.SUB:
- signature.append ("-");
- break;
-
- case Vala.AssignmentOperator.MUL:
- signature.append ("*");
- break;
-
- case Vala.AssignmentOperator.DIV:
- signature.append ("/");
- break;
-
- case Vala.AssignmentOperator.PERCENT:
- signature.append ("%");
- break;
-
- case Vala.AssignmentOperator.SHIFT_LEFT:
- signature.append ("<<");
- break;
-
- case Vala.AssignmentOperator.SHIFT_RIGHT:
- signature.append (">>");
- break;
-
- default:
- assert_not_reached ();
- }
-
- a.right.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_cast_expression (Vala.CastExpression expr) {
- if (expr.is_non_null_cast) {
- signature.append ("(!)");
- expr.inner.accept (this);
- return;
- }
-
- if (!expr.is_silent_cast) {
- signature.append ("(", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- expr.inner.accept (this);
-
- if (expr.is_silent_cast) {
- signature.append_keyword ("as");
- write_type (expr.type_reference);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_initializer_list (Vala.InitializerList list) {
- signature.append ("{", false);
-
- bool first = true;
- foreach (Vala.Expression initializer in list.get_initializers ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
- initializer.accept (this);
- }
-
- signature.append ("}", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_member_access (Vala.MemberAccess expr) {
- if (expr.symbol_reference != null) {
- expr.symbol_reference.accept (this);
- } else {
- signature.append (expr.member_name);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_element_access (Vala.ElementAccess expr) {
- expr.container.accept (this);
- signature.append ("[", false);
-
- bool first = true;
- foreach (Vala.Expression index in expr.get_indices ()) {
- if (!first) {
- signature.append (", ", false);
- }
- first = false;
-
- index.accept (this);
- }
-
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_pointer_indirection (Vala.PointerIndirection expr) {
- signature.append ("*", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_addressof_expression (Vala.AddressofExpression expr) {
- signature.append ("&", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_reference_transfer_expression (Vala.ReferenceTransferExpression expr) {
- signature.append ("(", false).append_keyword ("owned", false).append (")", false);
- expr.inner.accept (this);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_check (Vala.TypeCheck expr) {
- expr.expression.accept (this);
- signature.append_keyword ("is");
- write_type (expr.type_reference);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method_call (Vala.MethodCall expr) {
- // symbol-name:
- expr.call.symbol_reference.accept (this);
-
- // parameters:
- signature.append (" (", false);
- bool first = true;
- foreach (Vala.Expression literal in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
-
- literal.accept (this);
- first = false;
- }
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_slice_expression (Vala.SliceExpression expr) {
- expr.container.accept (this);
- signature.append ("[", false);
- expr.start.accept (this);
- signature.append (":", false);
- expr.stop.accept (this);
- signature.append ("]", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_base_access (Vala.BaseAccess expr) {
- signature.append_keyword ("base", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_postfix_expression (Vala.PostfixExpression expr) {
- expr.inner.accept (this);
- if (expr.increment) {
- signature.append ("++", false);
- } else {
- signature.append ("--", false);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_object_creation_expression (Vala.ObjectCreationExpression expr) {
- if (!expr.struct_creation) {
- signature.append_keyword ("new");
- }
-
- signature.append_symbol (resolve (expr.symbol_reference));
-
- signature.append (" (", false);
-
- //TODO: rm conditional space
- bool first = true;
- foreach (Vala.Expression arg in expr.get_argument_list ()) {
- if (!first) {
- signature.append (", ", false);
- }
- arg.accept (this);
- first = false;
- }
-
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_sizeof_expression (Vala.SizeofExpression expr) {
- signature.append_keyword ("sizeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_typeof_expression (Vala.TypeofExpression expr) {
- signature.append_keyword ("typeof", false).append (" (", false);
- write_type (expr.type_reference);
- signature.append (")", false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_lambda_expression (Vala.LambdaExpression expr) {
- signature.append ("(", false);
-
- bool first = true;
- foreach (Vala.Parameter param in expr.get_parameters ()) {
- if (!first) {
- signature.append (", ", false);
- }
- signature.append (param.name, false);
- first = false;
- }
-
-
- signature.append (") => {", false);
- signature.append_highlighted (" [...] ", false);
- signature.append ("}", false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_boolean_literal (Vala.BooleanLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_character_literal (Vala.CharacterLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_integer_literal (Vala.IntegerLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_real_literal (Vala.RealLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_regex_literal (Vala.RegexLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_string_literal (Vala.StringLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_null_literal (Vala.NullLiteral lit) {
- signature.append_literal (lit.to_string (), false);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Vala.Field field) {
- write_node (field);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Vala.Constant constant) {
- write_node (constant);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Vala.EnumValue ev) {
- write_node (ev);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (Vala.ErrorCode ec) {
- write_node (ec);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Vala.Delegate d) {
- write_node (d);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Vala.Method m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_creation_method (Vala.CreationMethod m) {
- write_node (m);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Vala.Signal sig) {
- write_node (sig);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Vala.Class c) {
- write_node (c);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Vala.Struct s) {
- write_node (s);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Vala.Interface i) {
- write_node (i);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Vala.Enum en) {
- write_node (en);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (Vala.ErrorDomain ed) {
- write_node (ed);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Vala.Property prop) {
- write_node (prop);
- }
-}
-
diff --git a/src/driver/0.36.x/symbolresolver.vala b/src/driver/0.36.x/symbolresolver.vala
deleted file mode 100644
index 4adc06b1a..000000000
--- a/src/driver/0.36.x/symbolresolver.vala
+++ /dev/null
@@ -1,323 +0,0 @@
-/* symbolresolver.vala
- *
- * Copyright (C) 2011 Florian Brosch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-using Valadoc.Api;
-using Gee;
-
-
-public class Valadoc.Drivers.SymbolResolver : Visitor {
- private HashMap<Vala.Symbol, Symbol> symbol_map;
- private Valadoc.Api.Class glib_error;
- private Api.Tree root;
-
- public SymbolResolver (TreeBuilder builder) {
- this.symbol_map = builder.get_symbol_map ();
- this.glib_error = builder.get_glib_error ();
- }
-
- public Symbol? resolve (Vala.Symbol symbol) {
- return symbol_map.get (symbol);
- }
-
- private void resolve_thrown_list (Symbol symbol, Vala.List<Vala.DataType> types) {
- foreach (Vala.DataType type in types) {
- Vala.ErrorDomain vala_edom = (Vala.ErrorDomain) type.data_type;
- Symbol? edom = symbol_map.get (vala_edom);
- symbol.add_child (edom ?? glib_error);
- }
- }
-
- private void resolve_array_type_references (Api.Array ptr) {
- Api.Item data_type = ptr.data_type;
- if (data_type == null) {
- // void
- } else if (data_type is Api.Array) {
- resolve_array_type_references ((Api.Array) data_type);
- } else if (data_type is Pointer) {
- resolve_pointer_type_references ((Api.Pointer) data_type);
- } else {
- resolve_type_reference ((TypeReference) data_type);
- }
- }
-
- private void resolve_pointer_type_references (Pointer ptr) {
- Api.Item type = ptr.data_type;
- if (type == null) {
- // void
- } else if (type is Api.Array) {
- resolve_array_type_references ((Api.Array) type);
- } else if (type is Pointer) {
- resolve_pointer_type_references ((Pointer) type);
- } else {
- resolve_type_reference ((TypeReference) type);
- }
- }
-
- private void resolve_type_reference (TypeReference reference) {
- Vala.DataType vtyperef = (Vala.DataType) reference.data;
- if (vtyperef is Vala.ErrorType) {
- Vala.ErrorDomain verrdom = ((Vala.ErrorType) vtyperef).error_domain;
- if (verrdom != null) {
- reference.data_type = resolve (verrdom);
- } else {
- reference.data_type = glib_error;
- }
- } else if (vtyperef is Vala.DelegateType) {
- reference.data_type = resolve (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else if (vtyperef is Vala.GenericType) {
- reference.data_type = resolve (((Vala.GenericType) vtyperef).type_parameter);
- } else if (vtyperef.data_type != null) {
- reference.data_type = resolve (vtyperef.data_type);
- }
-
- // Type parameters:
- foreach (TypeReference type_param_ref in reference.get_type_arguments ()) {
- resolve_type_reference (type_param_ref);
- }
-
- if (reference.data_type is Pointer) {
- resolve_pointer_type_references ((Pointer)reference.data_type);
- } else if (reference.data_type is Api.Array) {
- resolve_array_type_references ((Api.Array)reference.data_type);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_tree (Api.Tree item) {
- this.root = item;
- item.accept_children (this);
- this.root = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_package (Package item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_namespace (Namespace item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_interface (Interface item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (var type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_class (Class item) {
- Collection<TypeReference> interfaces = item.get_implemented_interface_list ();
- foreach (TypeReference type_ref in interfaces) {
- resolve_type_reference (type_ref);
- }
-
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_struct (Struct item) {
- if (item.base_type != null) {
- resolve_type_reference (item.base_type);
- }
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_property (Property item) {
- Vala.Property vala_property = item.data as Vala.Property;
- Vala.Property? base_vala_property = null;
-
- if (vala_property.base_property != null) {
- base_vala_property = vala_property.base_property;
- } else if (vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property == vala_property && vala_property.base_interface_property != null) {
- base_vala_property = vala_property.base_interface_property;
- }
- if (base_vala_property != null) {
- item.base_property = (Property?) resolve (base_vala_property);
- }
-
- resolve_type_reference (item.property_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_field (Field item) {
- resolve_type_reference (item.field_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_constant (Constant item) {
- resolve_type_reference (item.constant_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_delegate (Delegate item) {
- Vala.Delegate vala_delegate = item.data as Vala.Delegate;
-
- resolve_type_reference (item.return_type);
-
- resolve_thrown_list (item, vala_delegate.get_error_types ());
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_signal (Api.Signal item) {
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_method (Method item) {
- Vala.Method vala_method = item.data as Vala.Method;
- Vala.Method? base_vala_method = null;
- if (vala_method.base_method != null) {
- base_vala_method = vala_method.base_method;
- } else if (vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method == vala_method && vala_method.base_interface_method != null) {
- base_vala_method = vala_method.base_interface_method;
- }
- if (base_vala_method != null) {
- item.base_method = (Method?) resolve (base_vala_method);
- }
-
- resolve_thrown_list (item, vala_method.get_error_types ());
-
- resolve_type_reference (item.return_type);
-
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_type_parameter (TypeParameter item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_formal_parameter (FormalParameter item) {
- if (item.ellipsis) {
- return;
- }
-
- if (((Vala.Parameter) item.data).initializer != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.Parameter) item.data).initializer.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- resolve_type_reference (item.parameter_type);
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_domain (ErrorDomain item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_error_code (ErrorCode item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum (Enum item) {
- item.accept_all_children (this, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public override void visit_enum_value (Api.EnumValue item) {
-
- if (((Vala.EnumValue) item.data).value != null) {
- SignatureBuilder signature = new SignatureBuilder ();
- InitializerBuilder ibuilder = new InitializerBuilder (signature, symbol_map);
- ((Vala.EnumValue) item.data).value.accept (ibuilder);
- item.default_value = signature.get ();
- }
-
- item.accept_all_children (this, false);
- }
-}
-
-
-
diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am
deleted file mode 100644
index 87d89a6c7..000000000
--- a/src/driver/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-NULL =
-
-if HAVE_LIBVALA_0_20_X
-DRIVER_0_20_X_DIR = 0.20.x
-endif
-
-if HAVE_LIBVALA_0_22_X
-DRIVER_0_22_X_DIR = 0.22.x
-endif
-
-if HAVE_LIBVALA_0_24_X
-DRIVER_0_24_X_DIR = 0.24.x
-endif
-
-if HAVE_LIBVALA_0_26_X
-DRIVER_0_26_X_DIR = 0.26.x
-endif
-
-if HAVE_LIBVALA_0_28_X
-DRIVER_0_28_X_DIR = 0.28.x
-endif
-
-if HAVE_LIBVALA_0_30_X
-DRIVER_0_30_X_DIR = 0.30.x
-endif
-
-if HAVE_LIBVALA_0_32_X
-DRIVER_0_32_X_DIR = 0.32.x
-endif
-
-if HAVE_LIBVALA_0_34_X
-DRIVER_0_34_X_DIR = 0.34.x
-endif
-
-if HAVE_LIBVALA_0_36_X
-DRIVER_0_36_X_DIR = 0.36.x
-endif
-
-
-SUBDIRS = \
- $(DRIVER_0_20_X_DIR) \
- $(DRIVER_0_22_X_DIR) \
- $(DRIVER_0_24_X_DIR) \
- $(DRIVER_0_26_X_DIR) \
- $(DRIVER_0_28_X_DIR) \
- $(DRIVER_0_30_X_DIR) \
- $(DRIVER_0_32_X_DIR) \
- $(DRIVER_0_34_X_DIR) \
- $(DRIVER_0_36_X_DIR) \
- $(NULL)
-
diff --git a/src/vapi/config.vapi b/src/vapi/config.vapi
deleted file mode 100644
index 55fed8674..000000000
--- a/src/vapi/config.vapi
+++ /dev/null
@@ -1,21 +0,0 @@
-/* config.vapi
- *
- * Author:
- * Florian Brosch <flo.brosch@gmail.com>
- */
-
-[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
-namespace Config {
- [CCode (cname = "PACKAGE_VERSION")]
- public const string version;
-
- [CCode (cname = "PACKAGE_DATADIR")]
- public const string plugin_dir;
-
- [CCode (cname = "PACKAGE_VAPIDIR")]
- public const string vapi_dir;
-
- [CCode (cname = "DEFAULT_DRIVER")]
- public const string default_driver;
-}
-
diff --git a/src/vapi/libgvc.vapi b/src/vapi/libgvc.vapi
deleted file mode 100644
index 58219c898..000000000
--- a/src/vapi/libgvc.vapi
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * libgvc.vapi
- *
- * Copyright (C) 2009 Martin Olsson
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Martin Olsson <martin@minimum.se>
- */
-
-[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "graphviz/gvc.h")]
-namespace Gvc {
-
- [CCode (cname = "aginitlib", cheader_filename="gvc.h")]
- public void initlib ( size_t graphinfo, size_t nodeinfo, size_t edgeinfo);
-
- [CCode (cname = "aginit")]
-#if WITH_CGRAPH
- public void init (Graph g, int kind, string rec_name, bool move_to_front);
-#else
- public void init ();
-#endif
-
-
-#if WITH_CGRAPH
- [SimpleType]
- [CCode (cname = "Agdesc_t")]
- public struct Desc {
- }
-
- public Desc Agdirected; // Desc.DIRECTED | Desc.MAINGRAPH;
- public Desc Agstrictdirected; // Desc.DIRECTED | Desc.STRICT | Desc.MAINGRAPH;
- public Desc Agundirected; // Desc.MAINGRAPH;
- public Desc Agstrictundirected; // Desc.STRICT | Desc.MAINGRAPH;
-#else
- [CCode (cprefix = "")]
- public enum GraphKind {
- AGRAPH,
- AGRAPHSTRICT,
- AGDIGRAPH,
- AGDIGRAPHSTRICT,
- AGMETAGRAPH,
- }
-#endif
-
- [CCode (cname = "agerrlevel_t", cheader_filename = "gvc.h", cprefix = "")]
- public enum ErrorLevel {
- AGWARN,
- AGERR,
- AGMAX,
- AGPREV
- }
-
- [Compact]
- [CCode (cname = "GVC_t", free_function = "gvFreeContext")]
- public class Context {
- [CCode (cname = "gvContext")]
- public Context ();
-
- [CCode (cname = "gvParseArgs")]
- public int parse_args ( [CCode (array_length_pos = 0.9)] string[] argv );
-
- [CCode (cname = "gvLayout")]
- public int layout (Graph graph, [CCode (type = "char*")] string layout_engine);
-
- [CCode (cname = "gvFreeLayout")]
- public int free_layout (Graph graph);
-
- [CCode (cname = "gvRender")]
- public int render (Graph graph, [CCode (type = "char*")] string file_type, GLib.FileStream? file);
-
- [CCode (cname = "gvRenderFilename")]
- public int render_filename (Graph graph, [CCode (type = "char*")] string file_type, [CCode (type = "char*")] string filename);
-
- [CCode (cname = "gvLayoutJobs")]
- public int layout_jobs (Graph graph);
-
- [CCode (cname = "gvRenderJobs")]
- public int render_jobs (Graph graph);
-
- [CCode (cname = "gvRenderData")]
- public int render_data (Graph graph, [CCode (type = "char*")] string file_type, [CCode (type = "char**")] out uint8[] output_data);
- }
-
- [Compact]
- [CCode (cname = "Agnode_t", ref_function = "", unref_function = "", free_function = "")]
- public class Node {
- [CCode (cname = "name")]
- public string name;
-
- [CCode (cname = "agget")]
- public unowned string? get ([CCode (type = "char*")] string attribute_name);
-
- [CCode (cname = "agset")]
- public void set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value);
-
- [CCode (cname = "agsafeset")]
- public void safe_set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value, [CCode (type = "char*")] string? default_value);
- }
-
- [Compact]
- [CCode (cname = "Agedge_t", ref_function = "", unref_function = "", free_function = "")]
- public class Edge {
- [CCode (cname = "agget")]
- public unowned string? get ([CCode (type = "char*")] string attribute_name);
-
- [CCode (cname = "agset")]
- public int set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value);
-
- [CCode (cname = "agsafeset")]
- public int safe_set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value, [CCode (type = "char*")] string? default_value);
- }
-
- [Compact]
- [CCode (cname = "Agraph_t", free_function = "agclose")]
- public class Graph {
- [CCode (cname = "agopen")]
-#if WITH_CGRAPH
- public Graph ([CCode (type = "char*")] string graph_name, Desc desc, int disc = 0);
-#else
- public Graph ([CCode (type = "char*")] string graph_name, GraphKind kind);
-#endif
-
- [CCode (cname = "agread")]
- public static Graph read (GLib.FileStream file);
-
- [CCode (cname = "agmemread")]
- public static Graph read_string (string str);
-
- [CCode (cname = "agnode")]
-#if WITH_CGRAPH
- public Node create_node ([CCode (type = "char*")] string node_name, int createflag = 1);
-#else
- public Node create_node ([CCode (type = "char*")] string node_name);
-#endif
-
- [CCode (cname = "agedge")]
-#if WITH_CGRAPH
- public Edge create_edge (Node from, Node to, string? name = null, int createflag = 1);
-#else
- public Edge create_edge (Node from, Node to);
-#endif
-
- [CCode (cname = "agsubg")]
- public unowned Graph create_subgraph ([CCode (type = "char*")] string? name);
-
- [CCode (cname = "agfindsubg")]
- public Graph find_subgraph ([CCode (type = "char*")] string name);
-
- [CCode (cname = "agidsubg")]
- public Graph create_subgraph_id (ulong id);
-
- [CCode (cname = "agfstsubg")]
- public Graph get_first_subgraph ();
-
- [CCode (cname = "agnxtsubg")]
- public Graph get_next_subgraph ();
-
- [CCode (cname = "agparent")]
- public Graph get_parent_graph ();
-
- [CCode (cname = "agdelsubg")]
- public int delete_subgraph (Graph subgraph);
-
- [CCode (cname = "agfindnode")]
- public Node? find_node ([CCode (type = "char*")] string node_name);
-
- [CCode (cname = "agfstnode")]
- public Node? get_first_node ();
-
- [CCode (cname = "agnxtnode")]
- public Node? get_next_node (Node node);
-
- [CCode (cname = "agget")]
- public unowned string? get ([CCode (type = "char*")] string attribute_name);
-
- [CCode (cname = "agset")]
- public int set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value);
-
- [CCode (cname = "agsafeset")]
- public int safe_set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value, [CCode (type = "char*")] string? default_value);
-
- [CCode (cname = "AG_IS_DIRECTED")]
- public bool is_directed ();
-
- [CCode (cname = "AG_IS_STRICT")]
- public bool is_strict ();
-
- }
-
- [CCode (cname = "char", copy_function = "agdupstr_html", free_function = "agstrfree")]
- public class HtmlString : string {
- [CCode (cname = "agstrdup_html")]
- public HtmlString (string markup);
- }
-
- [CCode(cprefix = "ag")]
- namespace Error {
- [CCode (cname = "agerrno")]
- public static ErrorLevel errno;
-
- [CCode (cname = "agerr")]
- [PrintfFormat]
- public static int error (ErrorLevel level, string fmt, ...);
-
- [CCode (cname = "agerrors")]
- public static int errors ();
-
- [CCode (cname = "agseterr")]
- public static void set_error (ErrorLevel err);
-
- [CCode (cname = "aglasterr")]
- public static string? last_error ();
-
- [CCode (cname = "agerrorf")]
- [PrintfFormat]
- public static void errorf (string format, ...);
-
- [CCode (cname = "agwarningf")]
- [PrintfFormat]
- void warningf (string fmt, ...);
- }
-
-}
diff --git a/valadoc.doap b/valadoc.doap
deleted file mode 100644
index 088c94b1a..000000000
--- a/valadoc.doap
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns:foaf="http://xmlns.com/foaf/0.1/"
- xmlns:gnome="http://api.gnome.org/doap-extensions#"
- xmlns="http://usefulinc.com/ns/doap#">
-
- <name xml:lang="en">valadoc</name>
- <shortdesc xml:lang="en">A documentation tool for vala</shortdesc>
- <description>Valadoc is a documentation generator for generating API documentation
-from Vala source code based on libvala.</description>
-
- <homepage rdf:resource="https://wiki.gnome.org/Projects/Valadoc" />
- <download-page rdf:resource="https://wiki.gnome.org/Projects/Valadoc" />
- <bug-database rdf:resource="https://bugzilla.gnome.org/browse.cgi?product=valadoc" />
-
- <category rdf:resource="http://api.gnome.org/doap-extensions#core" />
- <programming-language>Vala</programming-language>
-
- <maintainer>
- <foaf:Person>
- <foaf:name>Florian Brosch</foaf:name>
- <foaf:mbox rdf:resource="mailto:flo.brosch@gmail.com" />
- <gnome:userid>flobrosch</gnome:userid>
- </foaf:Person>
- </maintainer>
- <maintainer>
- <foaf:Person>
- <foaf:name>Rico Tzschichholz</foaf:name>
- <foaf:mbox rdf:resource="mailto:ricotz@ubuntu.com" />
- <gnome:userid>ricotz</gnome:userid>
- </foaf:Person>
- </maintainer>
-
-</Project>
-
diff --git a/src/valadoc/Makefile.am b/valadoc/Makefile.am
index 038b6e20c..038b6e20c 100644
--- a/src/valadoc/Makefile.am
+++ b/valadoc/Makefile.am
diff --git a/THANKS b/valadoc/THANKS
index ecada2bbf..ecada2bbf 100644
--- a/THANKS
+++ b/valadoc/THANKS
diff --git a/src/doclets/Makefile.am b/valadoc/doclets/Makefile.am
index 90cf4b32e..90cf4b32e 100644
--- a/src/doclets/Makefile.am
+++ b/valadoc/doclets/Makefile.am
diff --git a/src/doclets/devhelp/Makefile.am b/valadoc/doclets/devhelp/Makefile.am
index 78cd54954..78cd54954 100644
--- a/src/doclets/devhelp/Makefile.am
+++ b/valadoc/doclets/devhelp/Makefile.am
diff --git a/src/doclets/devhelp/doclet.vala b/valadoc/doclets/devhelp/doclet.vala
index b776f5e37..b776f5e37 100644
--- a/src/doclets/devhelp/doclet.vala
+++ b/valadoc/doclets/devhelp/doclet.vala
diff --git a/src/doclets/gtkdoc/Makefile.am b/valadoc/doclets/gtkdoc/Makefile.am
index f0c4f96e3..f0c4f96e3 100644
--- a/src/doclets/gtkdoc/Makefile.am
+++ b/valadoc/doclets/gtkdoc/Makefile.am
diff --git a/src/doclets/gtkdoc/commentconverter.vala b/valadoc/doclets/gtkdoc/commentconverter.vala
index 450e751ba..450e751ba 100644
--- a/src/doclets/gtkdoc/commentconverter.vala
+++ b/valadoc/doclets/gtkdoc/commentconverter.vala
diff --git a/src/doclets/gtkdoc/dbus.vala b/valadoc/doclets/gtkdoc/dbus.vala
index be6cb5fe7..be6cb5fe7 100644
--- a/src/doclets/gtkdoc/dbus.vala
+++ b/valadoc/doclets/gtkdoc/dbus.vala
diff --git a/src/doclets/gtkdoc/doclet.vala b/valadoc/doclets/gtkdoc/doclet.vala
index 2d000f6eb..2d000f6eb 100644
--- a/src/doclets/gtkdoc/doclet.vala
+++ b/valadoc/doclets/gtkdoc/doclet.vala
diff --git a/src/doclets/gtkdoc/gcomment.vala b/valadoc/doclets/gtkdoc/gcomment.vala
index 623e3c4f6..623e3c4f6 100644
--- a/src/doclets/gtkdoc/gcomment.vala
+++ b/valadoc/doclets/gtkdoc/gcomment.vala
diff --git a/src/doclets/gtkdoc/generator.vala b/valadoc/doclets/gtkdoc/generator.vala
index 6aba0a691..6aba0a691 100644
--- a/src/doclets/gtkdoc/generator.vala
+++ b/valadoc/doclets/gtkdoc/generator.vala
diff --git a/src/doclets/gtkdoc/utils.vala b/valadoc/doclets/gtkdoc/utils.vala
index be5517204..be5517204 100644
--- a/src/doclets/gtkdoc/utils.vala
+++ b/valadoc/doclets/gtkdoc/utils.vala
diff --git a/src/doclets/html/Makefile.am b/valadoc/doclets/html/Makefile.am
index b9fdee338..b9fdee338 100644
--- a/src/doclets/html/Makefile.am
+++ b/valadoc/doclets/html/Makefile.am
diff --git a/src/doclets/html/doclet.vala b/valadoc/doclets/html/doclet.vala
index 7244edd86..7244edd86 100644
--- a/src/doclets/html/doclet.vala
+++ b/valadoc/doclets/html/doclet.vala
diff --git a/src/driver/0.24.x/driver.vala b/valadoc/driver.vala
index 902d28d4b..902d28d4b 100644
--- a/src/driver/0.24.x/driver.vala
+++ b/valadoc/driver.vala
diff --git a/src/driver/0.20.x/girwriter.vala b/valadoc/girwriter.vala
index c250854d6..c250854d6 100644
--- a/src/driver/0.20.x/girwriter.vala
+++ b/valadoc/girwriter.vala
diff --git a/icons/Makefile.am b/valadoc/icons/Makefile.am
index 454bdba7c..454bdba7c 100644
--- a/icons/Makefile.am
+++ b/valadoc/icons/Makefile.am
diff --git a/icons/abstractclass.png b/valadoc/icons/abstractclass.png
index 4aaf9379b..4aaf9379b 100644
--- a/icons/abstractclass.png
+++ b/valadoc/icons/abstractclass.png
Binary files differ
diff --git a/icons/abstractmethod.png b/valadoc/icons/abstractmethod.png
index 93003f7b3..93003f7b3 100644
--- a/icons/abstractmethod.png
+++ b/valadoc/icons/abstractmethod.png
Binary files differ
diff --git a/icons/abstractproperty.png b/valadoc/icons/abstractproperty.png
index ea9e09a80..ea9e09a80 100644
--- a/icons/abstractproperty.png
+++ b/valadoc/icons/abstractproperty.png
Binary files differ
diff --git a/icons/class.png b/valadoc/icons/class.png
index f8e82b556..f8e82b556 100644
--- a/icons/class.png
+++ b/valadoc/icons/class.png
Binary files differ
diff --git a/icons/coll_close.png b/valadoc/icons/coll_close.png
index 948573a65..948573a65 100644
--- a/icons/coll_close.png
+++ b/valadoc/icons/coll_close.png
Binary files differ
diff --git a/icons/coll_open.png b/valadoc/icons/coll_open.png
index d2124a249..d2124a249 100644
--- a/icons/coll_open.png
+++ b/valadoc/icons/coll_open.png
Binary files differ
diff --git a/icons/constant.png b/valadoc/icons/constant.png
index 85e248df4..85e248df4 100644
--- a/icons/constant.png
+++ b/valadoc/icons/constant.png
Binary files differ
diff --git a/icons/constructor.png b/valadoc/icons/constructor.png
index eee173892..eee173892 100644
--- a/icons/constructor.png
+++ b/valadoc/icons/constructor.png
Binary files differ
diff --git a/icons/delegate.png b/valadoc/icons/delegate.png
index 3ad818b4d..3ad818b4d 100644
--- a/icons/delegate.png
+++ b/valadoc/icons/delegate.png
Binary files differ
diff --git a/icons/devhelpstyle.css b/valadoc/icons/devhelpstyle.css
index 1fb803df1..1fb803df1 100644
--- a/icons/devhelpstyle.css
+++ b/valadoc/icons/devhelpstyle.css
diff --git a/icons/enum.png b/valadoc/icons/enum.png
index 9d534b5fe..9d534b5fe 100644
--- a/icons/enum.png
+++ b/valadoc/icons/enum.png
Binary files differ
diff --git a/icons/enumvalue.png b/valadoc/icons/enumvalue.png
index 79aa2718d..79aa2718d 100644
--- a/icons/enumvalue.png
+++ b/valadoc/icons/enumvalue.png
Binary files differ
diff --git a/icons/errorcode.png b/valadoc/icons/errorcode.png
index d61c7e919..d61c7e919 100644
--- a/icons/errorcode.png
+++ b/valadoc/icons/errorcode.png
Binary files differ
diff --git a/icons/errordomain.png b/valadoc/icons/errordomain.png
index e5128279c..e5128279c 100644
--- a/icons/errordomain.png
+++ b/valadoc/icons/errordomain.png
Binary files differ
diff --git a/icons/field.png b/valadoc/icons/field.png
index 5515f7e66..5515f7e66 100644
--- a/icons/field.png
+++ b/valadoc/icons/field.png
Binary files differ
diff --git a/icons/interface.png b/valadoc/icons/interface.png
index 83a958809..83a958809 100644
--- a/icons/interface.png
+++ b/valadoc/icons/interface.png
Binary files differ
diff --git a/icons/method.png b/valadoc/icons/method.png
index 516c2ff2c..516c2ff2c 100644
--- a/icons/method.png
+++ b/valadoc/icons/method.png
Binary files differ
diff --git a/icons/namespace.png b/valadoc/icons/namespace.png
index 759846f72..759846f72 100644
--- a/icons/namespace.png
+++ b/valadoc/icons/namespace.png
Binary files differ
diff --git a/icons/package.png b/valadoc/icons/package.png
index cc6718776..cc6718776 100644
--- a/icons/package.png
+++ b/valadoc/icons/package.png
Binary files differ
diff --git a/icons/packages.png b/valadoc/icons/packages.png
index d99004a28..d99004a28 100644
--- a/icons/packages.png
+++ b/valadoc/icons/packages.png
Binary files differ
diff --git a/icons/property.png b/valadoc/icons/property.png
index 3b9641387..3b9641387 100644
--- a/icons/property.png
+++ b/valadoc/icons/property.png
Binary files differ
diff --git a/icons/scripts.js b/valadoc/icons/scripts.js
index 02629edd9..02629edd9 100644
--- a/icons/scripts.js
+++ b/valadoc/icons/scripts.js
diff --git a/icons/signal.png b/valadoc/icons/signal.png
index 55f19662c..55f19662c 100644
--- a/icons/signal.png
+++ b/valadoc/icons/signal.png
Binary files differ
diff --git a/icons/staticmethod.png b/valadoc/icons/staticmethod.png
index 4e76a248a..4e76a248a 100644
--- a/icons/staticmethod.png
+++ b/valadoc/icons/staticmethod.png
Binary files differ
diff --git a/icons/struct.png b/valadoc/icons/struct.png
index 2acb79ab4..2acb79ab4 100644
--- a/icons/struct.png
+++ b/valadoc/icons/struct.png
Binary files differ
diff --git a/icons/style.css b/valadoc/icons/style.css
index 160cdcba4..160cdcba4 100644
--- a/icons/style.css
+++ b/valadoc/icons/style.css
diff --git a/icons/tip.png b/valadoc/icons/tip.png
index 6ccf512f3..6ccf512f3 100644
--- a/icons/tip.png
+++ b/valadoc/icons/tip.png
Binary files differ
diff --git a/icons/virtualmethod.png b/valadoc/icons/virtualmethod.png
index 5ff14ecf7..5ff14ecf7 100644
--- a/icons/virtualmethod.png
+++ b/valadoc/icons/virtualmethod.png
Binary files differ
diff --git a/icons/virtualproperty.png b/valadoc/icons/virtualproperty.png
index 795374629..795374629 100644
--- a/icons/virtualproperty.png
+++ b/valadoc/icons/virtualproperty.png
Binary files differ
diff --git a/icons/warning.png b/valadoc/icons/warning.png
index ecdc0f924..ecdc0f924 100644
--- a/icons/warning.png
+++ b/valadoc/icons/warning.png
Binary files differ
diff --git a/icons/wikistyle.css b/valadoc/icons/wikistyle.css
index 459f91a32..459f91a32 100644
--- a/icons/wikistyle.css
+++ b/valadoc/icons/wikistyle.css
diff --git a/src/driver/0.20.x/initializerbuilder.vala b/valadoc/initializerbuilder.vala
index 7b26ab51f..7b26ab51f 100644
--- a/src/driver/0.20.x/initializerbuilder.vala
+++ b/valadoc/initializerbuilder.vala
diff --git a/src/driver/0.20.x/symbolresolver.vala b/valadoc/symbolresolver.vala
index 4adc06b1a..4adc06b1a 100644
--- a/src/driver/0.20.x/symbolresolver.vala
+++ b/valadoc/symbolresolver.vala
diff --git a/tests/Makefile.am b/valadoc/tests/Makefile.am
index 7a17a087d..7a17a087d 100644
--- a/tests/Makefile.am
+++ b/valadoc/tests/Makefile.am
diff --git a/tests/drivers/api-test.data.vapi b/valadoc/tests/drivers/api-test.data.vapi
index 3c696f4af..3c696f4af 100644
--- a/tests/drivers/api-test.data.vapi
+++ b/valadoc/tests/drivers/api-test.data.vapi
diff --git a/tests/drivers/driver-0-20.vala b/valadoc/tests/drivers/driver-0-20.vala
index 787cb8553..787cb8553 100644
--- a/tests/drivers/driver-0-20.vala
+++ b/valadoc/tests/drivers/driver-0-20.vala
diff --git a/tests/drivers/driver-0-22.vala b/valadoc/tests/drivers/driver-0-22.vala
index 4f881d7f9..4f881d7f9 100644
--- a/tests/drivers/driver-0-22.vala
+++ b/valadoc/tests/drivers/driver-0-22.vala
diff --git a/tests/drivers/driver-0-24.vala b/valadoc/tests/drivers/driver-0-24.vala
index c31c99217..c31c99217 100644
--- a/tests/drivers/driver-0-24.vala
+++ b/valadoc/tests/drivers/driver-0-24.vala
diff --git a/tests/drivers/driver-0-26.vala b/valadoc/tests/drivers/driver-0-26.vala
index 1a2521725..1a2521725 100644
--- a/tests/drivers/driver-0-26.vala
+++ b/valadoc/tests/drivers/driver-0-26.vala
diff --git a/tests/drivers/driver-0-28.vala b/valadoc/tests/drivers/driver-0-28.vala
index 05819e092..05819e092 100644
--- a/tests/drivers/driver-0-28.vala
+++ b/valadoc/tests/drivers/driver-0-28.vala
diff --git a/tests/drivers/driver-0-30.vala b/valadoc/tests/drivers/driver-0-30.vala
index cec5f0c8a..cec5f0c8a 100644
--- a/tests/drivers/driver-0-30.vala
+++ b/valadoc/tests/drivers/driver-0-30.vala
diff --git a/tests/drivers/driver-0-32.vala b/valadoc/tests/drivers/driver-0-32.vala
index 212573942..212573942 100644
--- a/tests/drivers/driver-0-32.vala
+++ b/valadoc/tests/drivers/driver-0-32.vala
diff --git a/tests/drivers/driver-0-34.vala b/valadoc/tests/drivers/driver-0-34.vala
index 442e80115..442e80115 100644
--- a/tests/drivers/driver-0-34.vala
+++ b/valadoc/tests/drivers/driver-0-34.vala
diff --git a/tests/drivers/driver-0-36.vala b/valadoc/tests/drivers/driver-0-36.vala
index d74d31d4f..d74d31d4f 100644
--- a/tests/drivers/driver-0-36.vala
+++ b/valadoc/tests/drivers/driver-0-36.vala
diff --git a/tests/drivers/generic-api-test.vala b/valadoc/tests/drivers/generic-api-test.vala
index 2c717125d..2c717125d 100644
--- a/tests/drivers/generic-api-test.vala
+++ b/valadoc/tests/drivers/generic-api-test.vala
diff --git a/tests/libvaladoc/errorreporter.vala b/valadoc/tests/libvaladoc/errorreporter.vala
index 59e5e5304..59e5e5304 100644
--- a/tests/libvaladoc/errorreporter.vala
+++ b/valadoc/tests/libvaladoc/errorreporter.vala
diff --git a/tests/libvaladoc/gtkdoc-scanner.vala b/valadoc/tests/libvaladoc/gtkdoc-scanner.vala
index 5144803ca..5144803ca 100644
--- a/tests/libvaladoc/gtkdoc-scanner.vala
+++ b/valadoc/tests/libvaladoc/gtkdoc-scanner.vala
diff --git a/tests/libvaladoc/markupreader.vala b/valadoc/tests/libvaladoc/markupreader.vala
index d38b4d439..d38b4d439 100644
--- a/tests/libvaladoc/markupreader.vala
+++ b/valadoc/tests/libvaladoc/markupreader.vala
diff --git a/tests/libvaladoc/parser/generic-scanner.vala b/valadoc/tests/libvaladoc/parser/generic-scanner.vala
index 183bd5e96..183bd5e96 100644
--- a/tests/libvaladoc/parser/generic-scanner.vala
+++ b/valadoc/tests/libvaladoc/parser/generic-scanner.vala
diff --git a/tests/libvaladoc/parser/manyrule.vala b/valadoc/tests/libvaladoc/parser/manyrule.vala
index 2af76d302..2af76d302 100644
--- a/tests/libvaladoc/parser/manyrule.vala
+++ b/valadoc/tests/libvaladoc/parser/manyrule.vala
diff --git a/tests/libvaladoc/parser/oneofrule.vala b/valadoc/tests/libvaladoc/parser/oneofrule.vala
index 5da75267e..5da75267e 100644
--- a/tests/libvaladoc/parser/oneofrule.vala
+++ b/valadoc/tests/libvaladoc/parser/oneofrule.vala
diff --git a/tests/libvaladoc/parser/optionalrule.vala b/valadoc/tests/libvaladoc/parser/optionalrule.vala
index b7b68eaf7..b7b68eaf7 100644
--- a/tests/libvaladoc/parser/optionalrule.vala
+++ b/valadoc/tests/libvaladoc/parser/optionalrule.vala
diff --git a/tests/libvaladoc/parser/sequencerule.vala b/valadoc/tests/libvaladoc/parser/sequencerule.vala
index 13b4eec44..13b4eec44 100644
--- a/tests/libvaladoc/parser/sequencerule.vala
+++ b/valadoc/tests/libvaladoc/parser/sequencerule.vala
diff --git a/tests/libvaladoc/parser/stubrule.vala b/valadoc/tests/libvaladoc/parser/stubrule.vala
index 6a097fd0b..6a097fd0b 100644
--- a/tests/libvaladoc/parser/stubrule.vala
+++ b/valadoc/tests/libvaladoc/parser/stubrule.vala
diff --git a/tests/testrunner.sh b/valadoc/tests/testrunner.sh
index 79f29788e..79f29788e 100755
--- a/tests/testrunner.sh
+++ b/valadoc/tests/testrunner.sh
diff --git a/src/driver/0.36.x/treebuilder.vala b/valadoc/treebuilder.vala
index aebf2726e..aebf2726e 100644
--- a/src/driver/0.36.x/treebuilder.vala
+++ b/valadoc/treebuilder.vala
diff --git a/src/valadoc/valadoc.vala b/valadoc/valadoc.vala
index a4aa3277f..a4aa3277f 100644
--- a/src/valadoc/valadoc.vala
+++ b/valadoc/valadoc.vala