public void enterInterface(final InterfaceDefinition itf) throws Exception { meths_cw = new CodeWriter(); params_cw = new CodeWriter(); args_cw = new CodeWriter(); switchs_cw = new CodeWriter(); ItfName = (""); ItfName = (itf.getName().replace('.', '_')); meths_cw.appendln("typedef enum {"); params_cw.appendln("typedef struct {"); params_cw.appendln(ItfName + "_meths_t Methods;"); params_cw.appendln("union {"); switchs_cw.appendln("switch (pPr->Methods)"); switchs_cw.appendln("{"); }
public void leaveInterface(final InterfaceDefinition itf) throws Exception { cw.appendln(methCode_cw.toString()); }
public void leaveInterface(final InterfaceDefinition itf) throws Exception { cw.appendln(methCode_cw.toString()); }
/** * Get the source of the deployer * @return C code of the deployer */ public String getDeployerSource() { final CodeWriter cw = new CodeWriter(); cw.appendln("/* This file is auto-generated */").endl(); cw.append(deployerStructs); cw.endl(); cw.appendln("static void *deployableComponents[] = {"); for (final String composite : composites) { cw.append("(void *)&" + composite.replace(".", "_")).appendln(", "); } cw.appendln("0"); cw.appendln("};").endl(); cw.appendln("jint METHOD(lifecycle_controller, getFcState)(void* _this) {"); cw.appendln("return fractal_api_ErrorConst_OPERATION_NOT_SUPPORTED;"); cw.appendln("}").endl(); cw.appendln("jint METHOD(lifecycle_controller, startFc) (void* _this) {"); cw.appendln("DATA.deployableComponents = deployableComponents;"); cw.appendln("return fractal_api_ErrorConst_OK;"); cw.appendln("}").endl(); cw.appendln("jint METHOD(lifecycle_controller, stopFc) (void* _this) {"); cw.appendln("return fractal_api_ErrorConst_OK;"); cw.appendln("}").endl(); return cw.toString(); }
public void leaveInterface(final InterfaceDefinition itf) throws Exception { methenum_cw.appendln("} " + ItfName.toString() + "_meths_t;"); cw = new CodeWriter(); cw.endl(); cw.append("#include <stdio.h>").endl(); cw.appendln("DECLARE_DATA {};"); cw.appendln("#include <cecilia.h>"); cw.endl(); cw.appendln(methenum_cw.toString()).endl(); cw.appendln(methcode_cw.toString()).endl(); cw.appendln(x); }
public void leaveInterface(final InterfaceDefinition itf) throws Exception { methenum_cw.appendln("} " + ItfName.toString() + "_meths_t;"); cw = new CodeWriter(); cw.endl(); cw.append("#include <stdio.h>").endl(); cw.appendln("DECLARE_DATA {};"); cw.appendln("#include <cecilia.h>"); cw.endl(); cw.appendln(methenum_cw.toString()).endl(); cw.appendln(methcode_cw.toString()).endl(); cw.appendln(x); }
public void leaveInterface(final InterfaceDefinition itf) throws Exception { cw.append("default : printf(\"Invalid methodId %d\", ").append(methodId) .append(");").endl(); cw.appendln("}"); cw.appendln("return minus_bare_generic_exportbind_api_Push_E_OK;"); cw.appendln("}"); cw.append("#undef NEWSTYLE_COMPONENT").endl(); }
public void visitMethod(final Method method) throws Exception { methenum_cw.append(method.getName() + "_ID,"); methcode_cw.append(buildMethodDefinition(method, false, "METHOD(input," + method.getName().toString() + ")")); methcode_cw.appendln("{"); // trigger reporter BEGIN(methodeid) methcode_cw.appendln("CALL(REQUIRED.trigger,begin,(void*)" + method.getName() + "_ID" + ");"); // call application method methcode_cw.append("CALL(REQUIRED.output," + method.getName().toString()); for (final Parameter p : ((ParameterContainer) method).getParameters()) { methcode_cw.append("," + "\n"); methcode_cw.append(" " + p.getName()); } methcode_cw.append(");" + "\n"); // trigger report END methcode_cw.appendln("CALL(REQUIRED.trigger,end);"); methcode_cw.appendln("}"); } }
/** * Generate the C code for this structure * * @return the C code */ public String getSource() { final CodeWriter cw = new CodeWriter(); cw.appendln("static primitive_t " + structName + " = {{PRIMITIVE, \"" + instanceName + "\"}, \"" + defName + "\", " + pe + "};"); cw.endl(); return cw.toString(); } }
public void enterInterface(final InterfaceDefinition itf) throws Exception { meths_cw = new CodeWriter(); params_cw = new CodeWriter(); code_cw = new CodeWriter(); args_cw = new CodeWriter(); ItfName = (itf.getName().replace('.', '_')); meths_cw.endl(); meths_cw.append("typedef enum {"); params_cw.appendln("typedef struct {"); params_cw.append(ItfName).append("_meths_t Methods;").endl(); params_cw.appendln("union {"); }
/** * Builds the header part for a given interface definition. * * @param itf the interface definition for which has to be built. * @throws Exception if any error occurs. */ public void enterInterface(final InterfaceDefinition itf) throws Exception { methodId = 0; final String componentCName = typeNameProviderItf.getCTypeName(); cw.appendln("#include \"minus/bare/generic/exportbind/api/serialize.h\""); cw.appendln("#include \"minus/bare/generic/debug/api/debug.h\""); cw.append("#define REQUIRED ((struct ").append(componentCName).append( "_t *)_this)->type.imported ").endl(); cw.append("#define NEWSTYLE_COMPONENT").endl(); cw.append(" struct ").append(componentCName).append("_instancedata {};") .endl(); cw.appendln("#include \"cecilia.h\""); cw.endl(); }
/** * Builds the footer part for a given interface definition. * * @param itf the interface definition for which has to be built. * @throws Exception if any error occurs. */ public void leaveInterface(final InterfaceDefinition itf) throws Exception { cw.append("default : printf(\"Invalid methodId %d\", ").append(methodId) .append(");").endl(); cw.appendln("}"); cw.append("return ").append(replyMsg).append(";").endl(); cw.appendln("}"); cw.append("#undef NEWSTYLE_COMPONENT").endl(); }
public void enterInterface(final InterfaceDefinition itf) throws Exception { methodId = 0; final String componentCName = typeNameProviderItf.getCTypeName(); cw.appendln("#include \"minus/bare/generic/exportbind/api/serialize.h\""); cw.append("#define REQUIRED ((struct ").append(componentCName).append( "_t *)_this)->type.imported ").endl(); cw.append("#define NEWSTYLE_COMPONENT").endl(); cw.append(" struct ").append(componentCName).append("_instancedata {};") .endl(); cw.appendln("#include \"cecilia.h\""); cw.endl(); }
public void leaveInterface(final InterfaceDefinition itf) throws Exception { meths_cw.append("NB_METHS} ").append(ItfName.toString()).append( "_meths_t;").endl(); params_cw.appendln("};"); params_cw.append("} ").append(ItfName.toString()).append("_parms_t, *p") .append(ItfName.toString()).append("_parms_t;").endl(); cw = new CodeWriter(); cw.appendln("DECLARE_DATA {};"); cw.appendln("#include <cecilia.h>"); cw.endl(); cw.append(meths_cw.toString()).endl(); cw.append(args_cw.toString()).endl(); cw.append(params_cw.toString()).endl(); cw.append(code_cw.toString()); }
@Override protected String processSourceCode() throws Exception { final CodeWriter cw = new CodeWriter("Component Definition Builder"); cw.append("#define IN_CECILIA_MECHANISM").endl(); if (interfaceDefinitionsProviderItf != null) cw.appendln(interfaceDefinitionsProviderItf.getSourceCode()).endl(); cw.endl(); return cw.toString(); } }
@Override protected String processSourceCode() throws Exception { final CodeWriter cw = new CodeWriter("Component Definition Builder"); cw.append("#define IN_CECILIA_MECHANISM").endl(); if (interfaceDefinitionsProviderItf != null) cw.appendln(interfaceDefinitionsProviderItf.getSourceCode()).endl(); cw.endl(); return cw.toString(); } }
final String instanceName = instanceNameProviderItf.getCInstanceName(); cw.appendln("// --------------------------------------------------------" + "---------------------"); cw.append("// Declare instance ").append( cw.append("// from type ").append( typeNameProviderItf.getTypeName()).endl(); cw.appendln("// --------------------------------------------------------" + "---------------------"); .appendln("#include \"minus/common/generic/fractal/api/componentDesc.h\""); cw.appendln(ccInstantiationProviderItf.getSourceCode()).endl(); cw.appendln(bcInstantiationProviderItf.getSourceCode()).endl(); .append("sizeof(binding_desc_t), //nbBindings").endl(); cw.append(instanceName).append("_bindings_desc, //bindings").endl(); cw.appendln("};");
@Override protected String processSourceCode() throws Exception { final CodeWriter cw = new CodeWriter("Interfaces Descriptor Builder"); final String name = typeNameProviderItf.getCTypeName(); cw .appendln("#include \"minus/common/generic/fractal/api/componentDesc.h\""); cw.append("#define ").append(name.toUpperCase()).append( "_TYPE_BASE_OFFSET 0").endl(); String exporteds = null; if (serverItfInstancesItf != null) { exporteds = serverItfInstancesItf.getSourceCode(); cw.append("#define ").append(name.toUpperCase()).append( "_EXPORTEDS_BASE_OFFSET ").append(name.toUpperCase()).append( "_TYPE_BASE_OFFSET").endl(); cw.append(exporteds); } if (clientItfInstancesItf != null) { final String importeds = clientItfInstancesItf.getSourceCode(); cw.append("#define ").append(name.toUpperCase()).append( "_IMPORTEDS_BASE_OFFSET (").append(name.toUpperCase()).append( "_TYPE_BASE_OFFSET"); if (exporteds != null) cw.append(" + sizeof(struct ").append(name).append("_exporteds)"); cw.append(")").endl(); cw.append(importeds); } return cw.toString(); } }