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(); }
@Override protected String processSourceCode() throws Exception { final CodeWriter cw = new CodeWriter( "Server Interfaces Descriptor Builder (initialization)"); final String name = typeNameProviderItf.getCTypeName(); final String structName = name + "_exporteds_desc"; cw.append(structName); return cw.toString(); } }
public void enterInterface(final InterfaceDefinition itf) throws Exception { meths_cw = new CodeWriter(); params_cw = new CodeWriter(); args_cw = new CodeWriter(); methCode_cw = new CodeWriter(); execCode_cw = new CodeWriter(); meths_cw.append("typedef enum {"); params_cw.appendln("typedef struct {"); params_cw.appendln(ItfName + "_meths_t Methods;"); params_cw.appendln("union {"); methCode_cw.appendln("int METHOD(Local, Registering) (void* _this)"); methCode_cw.appendln("{"); methCode_cw.appendln(" if (DATA.ParamCount == ARRAY_SIZE-1)"); methCode_cw.appendln("{"); methCode_cw .appendln("WARNING(\"ERROR EvtProxy': Local recording overflow\");"); methCode_cw.appendln("return -1;"); methCode_cw.appendln("}"); methCode_cw .appendln("if (CALL(REQUIRED.reg, RegisterEvent, CBST_SKEL_EE_PRIO, GET_MY_INTERFACE(exec), (void*) DATA.ParamPushIdx) != 0)"); methCode_cw.appendln("return -1;"); methCode_cw.appendln("DATA.ParamCount++;"); methCode_cw .appendln("if (++DATA.ParamPushIdx == ARRAY_SIZE) DATA.ParamPushIdx = 0;"); methCode_cw.appendln("return 0;"); methCode_cw.appendln("}"); methCode_cw.appendln("//1) Receive client(/skeleton) call");
@Override protected String processSourceCode() throws Exception { cw = new CodeWriter(getClass().getName()); visit(itf); return cw.toString(); }
public void enterInterface(final InterfaceDefinition itf) throws Exception { methenum_cw = new CodeWriter(); methcode_cw = new CodeWriter(); ItfName = (itf.getName().replace('.', '_')); methenum_cw.append("typedef enum {"); }
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("}"); } }
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 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(); }
@Override protected String processSourceCode() throws Exception { final CodeWriter cw = new CodeWriter( "Client Interfaces Descriptor Builder (initialization)"); final String name = typeNameProviderItf.getCTypeName(); final String structName = name + "_importeds_desc"; cw.append(structName); return cw.toString(); } }
@Override protected String processSourceCode() throws Exception { final CodeWriter cw = new CodeWriter("Implementation Definition Builder"); final String componentCName = typeNameProviderItf.getCTypeName(); CbstMacroDefinitionVisitor.appendMacros(cw, componentCName); // Print the implementation code. appendImplementationCode(cw); return cw.toString(); } }
public void enterInterface(final InterfaceDefinition itf) throws Exception { methcode_cw = new CodeWriter(); methenum_cw = new CodeWriter(); ItfName = (itf.getName().replace('.', '_')); methenum_cw.append("typedef enum {"); }
public void visitMethod(final Method method) throws Exception { meths_cw.append(method.getName().toString() + "_ID, "); args_cw.append("typedef struct {" + "\n"); // args_t methCode_cw.append('{' + "\n"); methCode_cw .appendln("// Allocate a structure containing functionID and paramaters!"); methCode_cw.appendln(" DATA.Param[DATA.ParamPushIdx].Methods=" + method.getName().toString() + "_ID;"); for (final Parameter p : ((ParameterContainer) method).getParameters()) { methCode_cw.appendln(" DATA.Param[DATA.ParamPushIdx]." + method.getName().toString() + "_args." + p.getName() + "=" + p.getName() + ";"); methCode_cw.appendln("if (CALLMINE(Local, Registering) != 0) {"); for (final Parameter p : ((ParameterContainer) method).getParameters()) { final Type type = getContainedType(p); pointer |= (type instanceof ArrayOf); if (pointer) { methCode_cw.appendln("CALL(REQUIRED.allocator, free, " + p.getName() + ");"); methCode_cw.appendln("if (" + p.getName() + "->size != 0) {"); methCode_cw.appendln("CALL(REQUIRED.allocator, free, " + p.getName() + "->array);"); methCode_cw.appendln("}"); methCode_cw.appendln("CALL(REQUIRED.allocator, free, " + p.getName() + ");");
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); }