summaryrefslogtreecommitdiff
path: root/host/commands/emugen/tests/t.001
diff options
context:
space:
mode:
Diffstat (limited to 'host/commands/emugen/tests/t.001')
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_dec.cpp119
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_dec.h20
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_opcodes.h14
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.cpp20
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.h22
-rw-r--r--host/commands/emugen/tests/t.001/expected/decoder/foo_server_proc.h19
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.cpp20
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.h27
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_client_proc.h19
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_enc.cpp154
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_enc.h23
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_entry.cpp53
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_ftable.h20
-rw-r--r--host/commands/emugen/tests/t.001/expected/encoder/foo_opcodes.h14
-rw-r--r--host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp20
-rw-r--r--host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h25
-rw-r--r--host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp52
-rw-r--r--host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h19
-rw-r--r--host/commands/emugen/tests/t.001/input/foo.attrib15
-rw-r--r--host/commands/emugen/tests/t.001/input/foo.in5
-rw-r--r--host/commands/emugen/tests/t.001/input/foo.types10
21 files changed, 690 insertions, 0 deletions
diff --git a/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.cpp b/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.cpp
new file mode 100644
index 000000000..2fae4c06e
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.cpp
@@ -0,0 +1,119 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+
+
+#include <string.h>
+#include "foo_opcodes.h"
+
+#include "foo_dec.h"
+
+
+#include "ProtocolUtils.h"
+
+#include "ChecksumCalculatorThreadInfo.h"
+
+#include <stdio.h>
+
+typedef unsigned int tsize_t; // Target "size_t", which is 32-bit for now. It may or may not be the same as host's size_t when emugen is compiled.
+
+#ifdef OPENGL_DEBUG_PRINTOUT
+# define DEBUG(...) do { if (emugl_cxt_logger) { emugl_cxt_logger(__VA_ARGS__); } } while(0)
+#else
+# define DEBUG(...) ((void)0)
+#endif
+
+#ifdef CHECK_GLERROR
+# define SET_LASTCALL(name) sprintf(lastCall, #name)
+#else
+# define SET_LASTCALL(name) ((void)0)
+#endif
+
+using namespace emugl;
+
+size_t foo_decoder_context_t::decode(void *buf, size_t len, IOStream *stream, ChecksumCalculator* checksumCalc) {
+ if (len < 8) return 0;
+#ifdef CHECK_GL_ERROR
+ char lastCall[256] = {0};
+#endif
+ unsigned char *ptr = (unsigned char *)buf;
+ const unsigned char* const end = (const unsigned char*)buf + len;
+ const size_t checksumSize = checksumCalc->checksumByteSize();
+ const bool useChecksum = checksumSize > 0;
+ while (end - ptr >= 8) {
+ uint32_t opcode = *(uint32_t *)ptr;
+ int32_t packetLen = *(int32_t *)(ptr + 4);
+ if (end - ptr < packetLen) return ptr - (unsigned char*)buf;
+ switch(opcode) {
+ case OP_fooAlphaFunc: {
+ FooInt var_func = Unpack<FooInt,uint32_t>(ptr + 8);
+ FooFloat var_ref = Unpack<FooFloat,uint32_t>(ptr + 8 + 4);
+ if (useChecksum) {
+ ChecksumCalculatorThreadInfo::validOrDie(checksumCalc, ptr, 8 + 4 + 4, ptr + 8 + 4 + 4, checksumSize,
+ "foo_decoder_context_t::decode, OP_fooAlphaFunc: GL checksumCalculator failure\n");
+ }
+ DEBUG("foo(%p): fooAlphaFunc(%d %f )\n", stream, var_func, var_ref);
+ this->fooAlphaFunc(var_func, var_ref);
+ SET_LASTCALL("fooAlphaFunc");
+ break;
+ }
+ case OP_fooIsBuffer: {
+ uint32_t size_stuff __attribute__((unused)) = Unpack<uint32_t,uint32_t>(ptr + 8);
+ InputBuffer inptr_stuff(ptr + 8 + 4, size_stuff);
+ if (useChecksum) {
+ ChecksumCalculatorThreadInfo::validOrDie(checksumCalc, ptr, 8 + 4 + size_stuff, ptr + 8 + 4 + size_stuff, checksumSize,
+ "foo_decoder_context_t::decode, OP_fooIsBuffer: GL checksumCalculator failure\n");
+ }
+ size_t totalTmpSize = sizeof(FooBoolean);
+ totalTmpSize += checksumSize;
+ unsigned char *tmpBuf = stream->alloc(totalTmpSize);
+ DEBUG("foo(%p): fooIsBuffer(%p(%u) )\n", stream, (void*)(inptr_stuff.get()), size_stuff);
+ *(FooBoolean *)(&tmpBuf[0]) = this->fooIsBuffer((void*)(inptr_stuff.get()));
+ if (useChecksum) {
+ ChecksumCalculatorThreadInfo::writeChecksum(checksumCalc, &tmpBuf[0], totalTmpSize - checksumSize, &tmpBuf[totalTmpSize - checksumSize], checksumSize);
+ }
+ stream->flush();
+ SET_LASTCALL("fooIsBuffer");
+ break;
+ }
+ case OP_fooUnsupported: {
+ uint32_t size_params __attribute__((unused)) = Unpack<uint32_t,uint32_t>(ptr + 8);
+ InputBuffer inptr_params(ptr + 8 + 4, size_params);
+ if (useChecksum) {
+ ChecksumCalculatorThreadInfo::validOrDie(checksumCalc, ptr, 8 + 4 + size_params, ptr + 8 + 4 + size_params, checksumSize,
+ "foo_decoder_context_t::decode, OP_fooUnsupported: GL checksumCalculator failure\n");
+ }
+ DEBUG("foo(%p): fooUnsupported(%p(%u) )\n", stream, (void*)(inptr_params.get()), size_params);
+ this->fooUnsupported((void*)(inptr_params.get()));
+ SET_LASTCALL("fooUnsupported");
+ break;
+ }
+ case OP_fooDoEncoderFlush: {
+ FooInt var_param = Unpack<FooInt,uint32_t>(ptr + 8);
+ if (useChecksum) {
+ ChecksumCalculatorThreadInfo::validOrDie(checksumCalc, ptr, 8 + 4, ptr + 8 + 4, checksumSize,
+ "foo_decoder_context_t::decode, OP_fooDoEncoderFlush: GL checksumCalculator failure\n");
+ }
+ DEBUG("foo(%p): fooDoEncoderFlush(%d )\n", stream, var_param);
+ this->fooDoEncoderFlush(var_param);
+ SET_LASTCALL("fooDoEncoderFlush");
+ break;
+ }
+ case OP_fooTakeConstVoidPtrConstPtr: {
+ uint32_t size_param __attribute__((unused)) = Unpack<uint32_t,uint32_t>(ptr + 8);
+ InputBuffer inptr_param(ptr + 8 + 4, size_param);
+ if (useChecksum) {
+ ChecksumCalculatorThreadInfo::validOrDie(checksumCalc, ptr, 8 + 4 + size_param, ptr + 8 + 4 + size_param, checksumSize,
+ "foo_decoder_context_t::decode, OP_fooTakeConstVoidPtrConstPtr: GL checksumCalculator failure\n");
+ }
+ DEBUG("foo(%p): fooTakeConstVoidPtrConstPtr(%p(%u) )\n", stream, (const void* const*)(inptr_param.get()), size_param);
+ this->fooTakeConstVoidPtrConstPtr((const void* const*)(inptr_param.get()));
+ SET_LASTCALL("fooTakeConstVoidPtrConstPtr");
+ break;
+ }
+ default:
+ return ptr - (unsigned char*)buf;
+ } //switch
+ ptr += packetLen;
+ } // while
+ return ptr - (unsigned char*)buf;
+}
diff --git a/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.h b/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.h
new file mode 100644
index 000000000..d02509070
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_dec.h
@@ -0,0 +1,20 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+
+#ifndef GUARD_foo_decoder_context_t
+#define GUARD_foo_decoder_context_t
+
+#include "OpenglRender/IOStream.h"
+#include "ChecksumCalculator.h"
+#include "foo_server_context.h"
+
+
+#include "emugl/common/logging.h"
+
+struct foo_decoder_context_t : public foo_server_context_t {
+
+ size_t decode(void *buf, size_t bufsize, IOStream *stream, ChecksumCalculator* checksumCalc);
+
+};
+
+#endif // GUARD_foo_decoder_context_t
diff --git a/host/commands/emugen/tests/t.001/expected/decoder/foo_opcodes.h b/host/commands/emugen/tests/t.001/expected/decoder/foo_opcodes.h
new file mode 100644
index 000000000..7219caaf1
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_opcodes.h
@@ -0,0 +1,14 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __GUARD_foo_opcodes_h_
+#define __GUARD_foo_opcodes_h_
+
+#define OP_fooAlphaFunc 200
+#define OP_fooIsBuffer 201
+#define OP_fooUnsupported 202
+#define OP_fooDoEncoderFlush 203
+#define OP_fooTakeConstVoidPtrConstPtr 204
+#define OP_last 205
+
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.cpp b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.cpp
new file mode 100644
index 000000000..22ff47f9d
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.cpp
@@ -0,0 +1,20 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+
+
+#include <string.h>
+#include "foo_server_context.h"
+
+
+#include <stdio.h>
+
+int foo_server_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
+{
+ fooAlphaFunc = (fooAlphaFunc_server_proc_t) getProc("fooAlphaFunc", userData);
+ fooIsBuffer = (fooIsBuffer_server_proc_t) getProc("fooIsBuffer", userData);
+ fooUnsupported = (fooUnsupported_server_proc_t) getProc("fooUnsupported", userData);
+ fooDoEncoderFlush = (fooDoEncoderFlush_server_proc_t) getProc("fooDoEncoderFlush", userData);
+ fooTakeConstVoidPtrConstPtr = (fooTakeConstVoidPtrConstPtr_server_proc_t) getProc("fooTakeConstVoidPtrConstPtr", userData);
+ return 0;
+}
+
diff --git a/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.h b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.h
new file mode 100644
index 000000000..713ff5fe3
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_context.h
@@ -0,0 +1,22 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __foo_server_context_t_h
+#define __foo_server_context_t_h
+
+#include "foo_server_proc.h"
+
+#include "foo_types.h"
+
+
+struct foo_server_context_t {
+
+ fooAlphaFunc_server_proc_t fooAlphaFunc;
+ fooIsBuffer_server_proc_t fooIsBuffer;
+ fooUnsupported_server_proc_t fooUnsupported;
+ fooDoEncoderFlush_server_proc_t fooDoEncoderFlush;
+ fooTakeConstVoidPtrConstPtr_server_proc_t fooTakeConstVoidPtrConstPtr;
+ virtual ~foo_server_context_t() {}
+ int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
+};
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/expected/decoder/foo_server_proc.h b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_proc.h
new file mode 100644
index 000000000..da104a13b
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/decoder/foo_server_proc.h
@@ -0,0 +1,19 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __foo_server_proc_t_h
+#define __foo_server_proc_t_h
+
+
+
+#include "foo_types.h"
+#ifndef foo_APIENTRY
+#define foo_APIENTRY
+#endif
+typedef void (foo_APIENTRY *fooAlphaFunc_server_proc_t) (FooInt, FooFloat);
+typedef FooBoolean (foo_APIENTRY *fooIsBuffer_server_proc_t) (void*);
+typedef void (foo_APIENTRY *fooUnsupported_server_proc_t) (void*);
+typedef void (foo_APIENTRY *fooDoEncoderFlush_server_proc_t) (FooInt);
+typedef void (foo_APIENTRY *fooTakeConstVoidPtrConstPtr_server_proc_t) (const void* const*);
+
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.cpp b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.cpp
new file mode 100644
index 000000000..f09e8811c
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.cpp
@@ -0,0 +1,20 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+
+
+#include <string.h>
+#include "foo_client_context.h"
+
+
+#include <stdio.h>
+
+int foo_client_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
+{
+ fooAlphaFunc = (fooAlphaFunc_client_proc_t) getProc("fooAlphaFunc", userData);
+ fooIsBuffer = (fooIsBuffer_client_proc_t) getProc("fooIsBuffer", userData);
+ fooUnsupported = (fooUnsupported_client_proc_t) getProc("fooUnsupported", userData);
+ fooDoEncoderFlush = (fooDoEncoderFlush_client_proc_t) getProc("fooDoEncoderFlush", userData);
+ fooTakeConstVoidPtrConstPtr = (fooTakeConstVoidPtrConstPtr_client_proc_t) getProc("fooTakeConstVoidPtrConstPtr", userData);
+ return 0;
+}
+
diff --git a/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.h
new file mode 100644
index 000000000..ce60329c5
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_context.h
@@ -0,0 +1,27 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __foo_client_context_t_h
+#define __foo_client_context_t_h
+
+#include "foo_client_proc.h"
+
+#include "foo_types.h"
+
+
+struct foo_client_context_t {
+
+ fooAlphaFunc_client_proc_t fooAlphaFunc;
+ fooIsBuffer_client_proc_t fooIsBuffer;
+ fooUnsupported_client_proc_t fooUnsupported;
+ fooDoEncoderFlush_client_proc_t fooDoEncoderFlush;
+ fooTakeConstVoidPtrConstPtr_client_proc_t fooTakeConstVoidPtrConstPtr;
+ virtual ~foo_client_context_t() {}
+
+ typedef foo_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
+ static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f);
+ int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
+ virtual void setError(unsigned int error){ (void)error; };
+ virtual unsigned int getError(){ return 0; };
+};
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/expected/encoder/foo_client_proc.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_proc.h
new file mode 100644
index 000000000..6fc27f060
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_client_proc.h
@@ -0,0 +1,19 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __foo_client_proc_t_h
+#define __foo_client_proc_t_h
+
+
+
+#include "foo_types.h"
+#ifndef foo_APIENTRY
+#define foo_APIENTRY
+#endif
+typedef void (foo_APIENTRY *fooAlphaFunc_client_proc_t) (void * ctx, FooInt, FooFloat);
+typedef FooBoolean (foo_APIENTRY *fooIsBuffer_client_proc_t) (void * ctx, void*);
+typedef void (foo_APIENTRY *fooUnsupported_client_proc_t) (void * ctx, void*);
+typedef void (foo_APIENTRY *fooDoEncoderFlush_client_proc_t) (void * ctx, FooInt);
+typedef void (foo_APIENTRY *fooTakeConstVoidPtrConstPtr_client_proc_t) (void * ctx, const void* const*);
+
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.cpp b/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.cpp
new file mode 100644
index 000000000..c922783e4
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.cpp
@@ -0,0 +1,154 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+
+
+#include <string.h>
+#include "foo_opcodes.h"
+
+#include "foo_enc.h"
+
+
+#include <stdio.h>
+
+namespace {
+
+void enc_unsupported()
+{
+ ALOGE("Function is unsupported\n");
+}
+
+void fooAlphaFunc_enc(void *self , FooInt func, FooFloat ref)
+{
+
+ foo_encoder_context_t *ctx = (foo_encoder_context_t *)self;
+ IOStream *stream = ctx->m_stream;
+ ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+ bool useChecksum = checksumCalculator->getVersion() > 0;
+
+ unsigned char *ptr;
+ unsigned char *buf;
+ const size_t sizeWithoutChecksum = 8 + 4 + 4;
+ const size_t checksumSize = checksumCalculator->checksumByteSize();
+ const size_t totalSize = sizeWithoutChecksum + checksumSize;
+ buf = stream->alloc(totalSize);
+ ptr = buf;
+ int tmp = OP_fooAlphaFunc;memcpy(ptr, &tmp, 4); ptr += 4;
+ memcpy(ptr, &totalSize, 4); ptr += 4;
+
+ memcpy(ptr, &func, 4); ptr += 4;
+ memcpy(ptr, &ref, 4); ptr += 4;
+
+ if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+ if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+}
+
+FooBoolean fooIsBuffer_enc(void *self , void* stuff)
+{
+
+ foo_encoder_context_t *ctx = (foo_encoder_context_t *)self;
+ IOStream *stream = ctx->m_stream;
+ ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+ bool useChecksum = checksumCalculator->getVersion() > 0;
+
+ const unsigned int __size_stuff = (4 * sizeof(float));
+ unsigned char *ptr;
+ unsigned char *buf;
+ const size_t sizeWithoutChecksum = 8 + __size_stuff + 1*4;
+ const size_t checksumSize = checksumCalculator->checksumByteSize();
+ const size_t totalSize = sizeWithoutChecksum + checksumSize;
+ buf = stream->alloc(totalSize);
+ ptr = buf;
+ int tmp = OP_fooIsBuffer;memcpy(ptr, &tmp, 4); ptr += 4;
+ memcpy(ptr, &totalSize, 4); ptr += 4;
+
+ *(unsigned int *)(ptr) = __size_stuff; ptr += 4;
+ memcpy(ptr, stuff, __size_stuff);ptr += __size_stuff;
+
+ if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+ if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+
+ FooBoolean retval;
+ stream->readback(&retval, 1);
+ if (useChecksum) checksumCalculator->addBuffer(&retval, 1);
+ if (useChecksum) {
+ unsigned char *checksumBufPtr = NULL;
+ unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
+ if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
+ stream->readback(checksumBufPtr, checksumSize);
+ if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
+ ALOGE("fooIsBuffer: GL communication error, please report this issue to b.android.com.\n");
+ abort();
+ }
+ }
+ return retval;
+}
+
+void fooDoEncoderFlush_enc(void *self , FooInt param)
+{
+
+ foo_encoder_context_t *ctx = (foo_encoder_context_t *)self;
+ IOStream *stream = ctx->m_stream;
+ ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+ bool useChecksum = checksumCalculator->getVersion() > 0;
+
+ unsigned char *ptr;
+ unsigned char *buf;
+ const size_t sizeWithoutChecksum = 8 + 4;
+ const size_t checksumSize = checksumCalculator->checksumByteSize();
+ const size_t totalSize = sizeWithoutChecksum + checksumSize;
+ buf = stream->alloc(totalSize);
+ ptr = buf;
+ int tmp = OP_fooDoEncoderFlush;memcpy(ptr, &tmp, 4); ptr += 4;
+ memcpy(ptr, &totalSize, 4); ptr += 4;
+
+ memcpy(ptr, &param, 4); ptr += 4;
+
+ if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+ if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+ stream->flush();
+}
+
+void fooTakeConstVoidPtrConstPtr_enc(void *self , const void* const* param)
+{
+
+ foo_encoder_context_t *ctx = (foo_encoder_context_t *)self;
+ IOStream *stream = ctx->m_stream;
+ ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+ bool useChecksum = checksumCalculator->getVersion() > 0;
+
+ const unsigned int __size_param = ;
+ unsigned char *ptr;
+ unsigned char *buf;
+ const size_t sizeWithoutChecksum = 8 + __size_param + 1*4;
+ const size_t checksumSize = checksumCalculator->checksumByteSize();
+ const size_t totalSize = sizeWithoutChecksum + checksumSize;
+ buf = stream->alloc(totalSize);
+ ptr = buf;
+ int tmp = OP_fooTakeConstVoidPtrConstPtr;memcpy(ptr, &tmp, 4); ptr += 4;
+ memcpy(ptr, &totalSize, 4); ptr += 4;
+
+ *(unsigned int *)(ptr) = __size_param; ptr += 4;
+ memcpy(ptr, param, __size_param);ptr += __size_param;
+
+ if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+ if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+}
+
+} // namespace
+
+foo_encoder_context_t::foo_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
+{
+ m_stream = stream;
+ m_checksumCalculator = checksumCalculator;
+
+ this->fooAlphaFunc = &fooAlphaFunc_enc;
+ this->fooIsBuffer = &fooIsBuffer_enc;
+ this->fooUnsupported = (fooUnsupported_client_proc_t) &enc_unsupported;
+ this->fooDoEncoderFlush = &fooDoEncoderFlush_enc;
+ this->fooTakeConstVoidPtrConstPtr = &fooTakeConstVoidPtrConstPtr_enc;
+}
+
diff --git a/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.h
new file mode 100644
index 000000000..8325831cf
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_enc.h
@@ -0,0 +1,23 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+
+#ifndef GUARD_foo_encoder_context_t
+#define GUARD_foo_encoder_context_t
+
+#include "IOStream.h"
+#include "ChecksumCalculator.h"
+#include "foo_client_context.h"
+
+
+#include "fooUtils.h"
+#include "fooBase.h"
+
+struct foo_encoder_context_t : public foo_client_context_t {
+
+ IOStream *m_stream;
+ ChecksumCalculator *m_checksumCalculator;
+
+ foo_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator);
+};
+
+#endif // GUARD_foo_encoder_context_t \ No newline at end of file
diff --git a/host/commands/emugen/tests/t.001/expected/encoder/foo_entry.cpp b/host/commands/emugen/tests/t.001/expected/encoder/foo_entry.cpp
new file mode 100644
index 000000000..b91129c03
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_entry.cpp
@@ -0,0 +1,53 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#include <stdio.h>
+#include <stdlib.h>
+#include "foo_client_context.h"
+
+#ifndef GL_TRUE
+extern "C" {
+ void fooAlphaFunc(FooInt func, FooFloat ref);
+ FooBoolean fooIsBuffer(void* stuff);
+ void fooUnsupported(void* params);
+ void fooDoEncoderFlush(FooInt param);
+ void fooTakeConstVoidPtrConstPtr(const void* const* param);
+};
+
+#endif
+#ifndef GET_CONTEXT
+static foo_client_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL;
+void foo_client_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; }
+#define GET_CONTEXT foo_client_context_t * ctx = getCurrentContext()
+#endif
+
+void fooAlphaFunc(FooInt func, FooFloat ref)
+{
+ GET_CONTEXT;
+ ctx->fooAlphaFunc(ctx, func, ref);
+}
+
+FooBoolean fooIsBuffer(void* stuff)
+{
+ GET_CONTEXT;
+ if (n == NULL) { LOG(ERROR) << "NULL stuff"; return; }
+ return ctx->fooIsBuffer(ctx, stuff);
+}
+
+void fooUnsupported(void* params)
+{
+ GET_CONTEXT;
+ ctx->fooUnsupported(ctx, params);
+}
+
+void fooDoEncoderFlush(FooInt param)
+{
+ GET_CONTEXT;
+ ctx->fooDoEncoderFlush(ctx, param);
+}
+
+void fooTakeConstVoidPtrConstPtr(const void* const* param)
+{
+ GET_CONTEXT;
+ ctx->fooTakeConstVoidPtrConstPtr(ctx, param);
+}
+
diff --git a/host/commands/emugen/tests/t.001/expected/encoder/foo_ftable.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_ftable.h
new file mode 100644
index 000000000..e397e50e2
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_ftable.h
@@ -0,0 +1,20 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __foo_client_ftable_t_h
+#define __foo_client_ftable_t_h
+
+
+static const struct _foo_funcs_by_name {
+ const char *name;
+ void *proc;
+} foo_funcs_by_name[] = {
+ {"fooAlphaFunc", (void*)fooAlphaFunc},
+ {"fooIsBuffer", (void*)fooIsBuffer},
+ {"fooUnsupported", (void*)fooUnsupported},
+ {"fooDoEncoderFlush", (void*)fooDoEncoderFlush},
+ {"fooTakeConstVoidPtrConstPtr", (void*)fooTakeConstVoidPtrConstPtr},
+};
+static const int foo_num_funcs = sizeof(foo_funcs_by_name) / sizeof(struct _foo_funcs_by_name);
+
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/expected/encoder/foo_opcodes.h b/host/commands/emugen/tests/t.001/expected/encoder/foo_opcodes.h
new file mode 100644
index 000000000..7219caaf1
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/encoder/foo_opcodes.h
@@ -0,0 +1,14 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __GUARD_foo_opcodes_h_
+#define __GUARD_foo_opcodes_h_
+
+#define OP_fooAlphaFunc 200
+#define OP_fooIsBuffer 201
+#define OP_fooUnsupported 202
+#define OP_fooDoEncoderFlush 203
+#define OP_fooTakeConstVoidPtrConstPtr 204
+#define OP_last 205
+
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp
new file mode 100644
index 000000000..6e132b104
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.cpp
@@ -0,0 +1,20 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+
+
+#include <string.h>
+#include "foo_wrapper_context.h"
+
+
+#include <stdio.h>
+
+int foo_wrapper_context_t::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)
+{
+ fooAlphaFunc = (fooAlphaFunc_wrapper_proc_t) getProc("fooAlphaFunc", userData);
+ fooIsBuffer = (fooIsBuffer_wrapper_proc_t) getProc("fooIsBuffer", userData);
+ fooUnsupported = (fooUnsupported_wrapper_proc_t) getProc("fooUnsupported", userData);
+ fooDoEncoderFlush = (fooDoEncoderFlush_wrapper_proc_t) getProc("fooDoEncoderFlush", userData);
+ fooTakeConstVoidPtrConstPtr = (fooTakeConstVoidPtrConstPtr_wrapper_proc_t) getProc("fooTakeConstVoidPtrConstPtr", userData);
+ return 0;
+}
+
diff --git a/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h
new file mode 100644
index 000000000..52db4b6fb
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_context.h
@@ -0,0 +1,25 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __foo_wrapper_context_t_h
+#define __foo_wrapper_context_t_h
+
+#include "foo_server_proc.h"
+
+#include "foo_types.h"
+
+
+struct foo_wrapper_context_t {
+
+ fooAlphaFunc_wrapper_proc_t fooAlphaFunc;
+ fooIsBuffer_wrapper_proc_t fooIsBuffer;
+ fooUnsupported_wrapper_proc_t fooUnsupported;
+ fooDoEncoderFlush_wrapper_proc_t fooDoEncoderFlush;
+ fooTakeConstVoidPtrConstPtr_wrapper_proc_t fooTakeConstVoidPtrConstPtr;
+ virtual ~foo_wrapper_context_t() {}
+
+ typedef foo_wrapper_context_t *CONTEXT_ACCESSOR_TYPE(void);
+ static void setContextAccessor(CONTEXT_ACCESSOR_TYPE *f);
+ int initDispatchByName( void *(*getProc)(const char *name, void *userData), void *userData);
+};
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp
new file mode 100644
index 000000000..7591393c1
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_entry.cpp
@@ -0,0 +1,52 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#include <stdio.h>
+#include <stdlib.h>
+#include "foo_wrapper_context.h"
+
+#ifndef GL_TRUE
+extern "C" {
+ void fooAlphaFunc(FooInt func, FooFloat ref);
+ FooBoolean fooIsBuffer(void* stuff);
+ void fooUnsupported(void* params);
+ void fooDoEncoderFlush(FooInt param);
+ void fooTakeConstVoidPtrConstPtr(const void* const* param);
+};
+
+#endif
+#ifndef GET_CONTEXT
+static foo_wrapper_context_t::CONTEXT_ACCESSOR_TYPE *getCurrentContext = NULL;
+void foo_wrapper_context_t::setContextAccessor(CONTEXT_ACCESSOR_TYPE *f) { getCurrentContext = f; }
+#define GET_CONTEXT foo_wrapper_context_t * ctx = getCurrentContext()
+#endif
+
+void fooAlphaFunc(FooInt func, FooFloat ref)
+{
+ GET_CONTEXT;
+ ctx->fooAlphaFunc( func, ref);
+}
+
+FooBoolean fooIsBuffer(void* stuff)
+{
+ GET_CONTEXT;
+ return ctx->fooIsBuffer( stuff);
+}
+
+void fooUnsupported(void* params)
+{
+ GET_CONTEXT;
+ ctx->fooUnsupported( params);
+}
+
+void fooDoEncoderFlush(FooInt param)
+{
+ GET_CONTEXT;
+ ctx->fooDoEncoderFlush( param);
+}
+
+void fooTakeConstVoidPtrConstPtr(const void* const* param)
+{
+ GET_CONTEXT;
+ ctx->fooTakeConstVoidPtrConstPtr( param);
+}
+
diff --git a/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h
new file mode 100644
index 000000000..294b9587d
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/expected/wrapper/foo_wrapper_proc.h
@@ -0,0 +1,19 @@
+// Generated Code - DO NOT EDIT !!
+// generated by 'emugen'
+#ifndef __foo_wrapper_proc_t_h
+#define __foo_wrapper_proc_t_h
+
+
+
+#include "foo_types.h"
+#ifndef foo_APIENTRY
+#define foo_APIENTRY
+#endif
+typedef void (foo_APIENTRY *fooAlphaFunc_wrapper_proc_t) (FooInt, FooFloat);
+typedef FooBoolean (foo_APIENTRY *fooIsBuffer_wrapper_proc_t) (void*);
+typedef void (foo_APIENTRY *fooUnsupported_wrapper_proc_t) (void*);
+typedef void (foo_APIENTRY *fooDoEncoderFlush_wrapper_proc_t) (FooInt);
+typedef void (foo_APIENTRY *fooTakeConstVoidPtrConstPtr_wrapper_proc_t) (const void* const*);
+
+
+#endif
diff --git a/host/commands/emugen/tests/t.001/input/foo.attrib b/host/commands/emugen/tests/t.001/input/foo.attrib
new file mode 100644
index 000000000..80644d8bb
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/input/foo.attrib
@@ -0,0 +1,15 @@
+GLOBAL
+ base_opcode 200
+ encoder_headers "fooUtils.h" "fooBase.h"
+
+fooIsBuffer
+ dir stuff in
+ len stuff (4 * sizeof(float))
+ param_check stuff if (n == NULL) { LOG(ERROR) << "NULL stuff"; return; }
+
+fooUnsupported
+ dir params in
+ flag unsupported
+
+fooDoEncoderFlush
+ flag flushOnEncode
diff --git a/host/commands/emugen/tests/t.001/input/foo.in b/host/commands/emugen/tests/t.001/input/foo.in
new file mode 100644
index 000000000..4e98f88b6
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/input/foo.in
@@ -0,0 +1,5 @@
+FOO_ENTRY(void, fooAlphaFunc, FooInt func, FooFloat ref)
+FOO_ENTRY(FooBoolean, fooIsBuffer, void* stuff)
+FOO_ENTRY(void, fooUnsupported, void* params)
+FOO_ENTRY(void, fooDoEncoderFlush, FooInt param)
+FOO_ENTRY(void, fooTakeConstVoidPtrConstPtr, const void* const* param)
diff --git a/host/commands/emugen/tests/t.001/input/foo.types b/host/commands/emugen/tests/t.001/input/foo.types
new file mode 100644
index 000000000..05d72fbe2
--- /dev/null
+++ b/host/commands/emugen/tests/t.001/input/foo.types
@@ -0,0 +1,10 @@
+FooBoolean 8 %d
+FooInt 32 %d
+FooShort 16 %d
+FooFloat 32 %f
+FooEnum 32 %08x
+FooVoid 0 %x
+FooChar 8 %d
+FooChar* 32 0x%08x
+void* 32 0x%08x
+void*const* 32 0x%08x