Skip to content

Commit

Permalink
We compiled aroopcompiler with codegenplug but failed to link
Browse files Browse the repository at this point in the history
  • Loading branch information
kamanashisroy committed Apr 13, 2015
1 parent 30faa29 commit 3fecc2c
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 77 deletions.
2 changes: 0 additions & 2 deletions Makefile.am
Expand Up @@ -3,7 +3,6 @@ NULL =
SUBDIRS = \
shotodolplug/ \
codegenplug/ \
aroop/codegen \
aroop/compiler \
aroop/vapi \
aroop/core \
Expand All @@ -12,7 +11,6 @@ SUBDIRS = \
DIST_SUBDIRS = \
shotodolplug/ \
codegenplug/ \
aroop/codegen \
aroop/compiler \
aroop/vapi \
aroop/core \
Expand Down
57 changes: 0 additions & 57 deletions aroop/codegen/Makefile.am

This file was deleted.

12 changes: 7 additions & 5 deletions aroop/compiler/Makefile.am
Expand Up @@ -12,7 +12,8 @@ aroopc@PACKAGE_SUFFIX@_LDADD = \
$(GLIB_LIBS) \
$(GEE_LIBS) \
$(VALA_LIBS) \
$(top_srcdir)/aroop/codegen/libaroopcodegen.la \
$(top_srcdir)/shotodolplug/libshotodolplug.la \
$(top_srcdir)/codegenplug/libcodegenplug.la \
$(NULL)

aroopc@PACKAGE_SUFFIX@_CFLAGS = \
Expand All @@ -22,14 +23,15 @@ aroopc@PACKAGE_SUFFIX@_CFLAGS = \
-DVAPI_INSTALL_PREFIX=\"@datadir@/aroop@PACKAGE_SUFFIX@/vapi\" \
-DC_INCLUDE_DIR=\"@includedir@/aroop_core@PACKAGE_SUFFIX@\" \
-DC_LIB_DIR=\"@libdir@\" \
-I$(top_srcdir)/aroop/codegen/ \
-I$(top_srcdir)/shotodolplug/ \
-I$(top_srcdir)/codegenplug/ \
$(NULL)


aroopc@PACKAGE_SUFFIX@_VALAFLAGS = \
--vapidir $(top_srcdir)/aroop/codegen --pkg codegen \
--pkg config \
--pkg gee-1.0 \
--vapidir $(top_srcdir)/shotodolplug --pkg shotodolplug \
--vapidir $(top_srcdir)/codegenplug --pkg codegenplug \
--vapidir $(top_srcdir)/aroop/codegen --pkg config \
--pkg $(VALA_PACKAGE) \
-g \
$(NULL)
Expand Down
11 changes: 10 additions & 1 deletion aroop/compiler/aroopcompiler.vala
Expand Up @@ -161,7 +161,16 @@ class aroop.Compiler {
}
}

ArrayList<shotodolplug.Module> modules = new ArrayList<shotodolplug.Module>();
void loadModules() {
int count = 0;
shotodolplug.Module x = new codegenplug.AroopCodeGeneratorModule();
x.init();
modules[count++] = x;
}

private int run () {
loadModules();
context = CodeCompilerContext();
CodeContext.push (context.ccode);

Expand Down Expand Up @@ -268,7 +277,7 @@ class aroop.Compiler {
return quit ();
}

context.ccode.codegen = new AroopCCodegenImpl ();
context.ccode.codegen = (CodeGenerator)shotodolplug.PluginManager.swarmObject("compiler/c/codegen", null); //new AroopCCodegenImpl ();

bool has_c_files = false;

Expand Down
3 changes: 2 additions & 1 deletion codegenplug/Makefile.am
Expand Up @@ -30,9 +30,10 @@ libcodegenplug_la_VALAFLAGS = \

libcodegenplug_la_SOURCES = \
valaccodebasemodule.vala \
valaccodecompiler.vala \
generator/aroopcodegenerator.vala \
tempvariablemodule.vala \
compilermodule.vala \
sourcemodule.vala \
generator/csymbolresolve.vala \
symbols/structmodule.vala \
symbols/elementmodule.vala \
Expand Down
8 changes: 6 additions & 2 deletions codegenplug/generator/aroopcodegenerator.vala
Expand Up @@ -6,18 +6,22 @@ using codegenplug;
public class codegenplug.AroopCodeGeneratorModule : shotodolplug.Module {
AroopCodeGenerator cgen;
public AroopCodeGeneratorModule() {
base("Codevisitor", "0.0");
base("CodeGenerator", "0.0");
cgen = new AroopCodeGenerator();
}

public override int init() {
PluginManager.register("compiler/c/codegen", new InterfaceExtension((Object)cgen, this));
PluginManager.register("compiler/c/codegen", new HookExtension((Hook)getInstance, this));
return 0;
}

public override int deinit() {
return 0;
}

Object getInstance(Object?param) {
return (Object)cgen;
}
}

internal class codegenplug.AroopCodeGenerator : CodeGenerator {
Expand Down
2 changes: 1 addition & 1 deletion codegenplug/generator/csymbolresolve.vala
Expand Up @@ -8,7 +8,7 @@ public class codegenplug.CSymbolResolve : shotodolplug.Module {
Set<string> reserved_identifiers;
public string self_instance = "self_data";
public Map<string,string> variable_name_map = new HashMap<string,string> (str_hash, str_equal);
CompilerModule compiler;
SourceModule compiler;
CodeGenerator cgen;
public CSymbolResolve() {
base("C Symbol Resolver", "0.0");
Expand Down
Expand Up @@ -3,7 +3,7 @@ using Vala;
using shotodolplug;
using codegenplug;

public class codegenplug.CompilerModule : shotodolplug.Module {
public class codegenplug.SourceModule : shotodolplug.Module {

public EmitContext emit_context = new EmitContext ();
public CCodeFunction ccode { get { return emit_context.ccode; } }
Expand Down Expand Up @@ -75,8 +75,8 @@ public class codegenplug.CompilerModule : shotodolplug.Module {

public CCodeFile header_file;
public CCodeFile cfile;
public CompilerModule() {
base("Compiler", "0.0");
public SourceModule() {
base("Source", "0.0");

}

Expand Down
2 changes: 1 addition & 1 deletion codegenplug/symbols/elementmodule.vala
Expand Up @@ -5,7 +5,7 @@ using codegenplug;

public class ccodegenplug.ElementModule : shotodolplug.Module {
CSymbolResolve resolve;
CompilerModule compiler;
SourceModule compiler;
CodeGenerator cgen;
AroopCodeGeneratorAdapter cgenAdapter;
public ElementModule() {
Expand Down
2 changes: 1 addition & 1 deletion codegenplug/symbols/objectmodule.vala
Expand Up @@ -4,7 +4,7 @@ using shotodolplug;
using codegenplug;

public class codegenplug.ObjectModule : shotodolplug.Module {
CompilerModule compiler;
SourceModule compiler;
CSymbolResolve resolve;
CodeGenerator cgen;
AroopCodeGeneratorAdapter cgenAdapter;
Expand Down
2 changes: 1 addition & 1 deletion codegenplug/symbols/structmodule.vala
Expand Up @@ -4,7 +4,7 @@ using shotodolplug;
using codegenplug;

public class ccodegenplug.StructModule : shotodolplug.Module {
CompilerModule compiler;
SourceModule compiler;
CSymbolResolve resolve;
CodeGenerator cgen;
AroopCodeGeneratorAdapter cgenAdapter;
Expand Down
2 changes: 1 addition & 1 deletion codegenplug/tempvariablemodule.vala
Expand Up @@ -5,7 +5,7 @@ using codegenplug;

public class codegenplug.TempVariableModule : shotodolplug.Module {
CSymbolResolve resolve;
CompilerModule compiler;
SourceModule compiler;
CodeGenerator cgen;
public TempVariableModule() {
base("TempVariableModule", "0.0");
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion configure.ac
Expand Up @@ -77,7 +77,6 @@ AC_CONFIG_FILES([Makefile
libaroop.pc
shotodolplug/Makefile
codegenplug/Makefile
aroop/codegen/Makefile
aroop/compiler/Makefile
aroop/core/Makefile
aroop/core/aroop_core.pc
Expand Down

0 comments on commit 3fecc2c

Please sign in to comment.