Pod sample: submitting forms

Below is a listing of the pod.c sample code file. For instructions on obtaining the source for this sample POD, see Downloading and working with the PODS sample files.

/* Copyright 2004 iAnywhere Solutions, Inc. All rights reserved. 
 * 
 * This sample source code is provided to aid in 
 * creation of PODS modules for iAnywhere Solutions software. 
 * 
 * pod.c 
 * 
*/

#include "pods.h" 
#include "podsstartup.h" 

#include "pod.h" 
#include "documentsrc.h"
#if 0
/***** getVersion *****/ 

// This function is special, because ANY PODSObject 
// built from a given set of PODS headers must 
// return the version constant from that set of 
// headers. So we can just make one copy of this 
// function and put it into the vtable of any 
// object, including the PODSPod itself, that 
// we create

PODSUInt16  getVersion(PODSPod *self) 
{ 
   return PODS_VERSION; 
} 
#endif

PODSString FormSubmitPodGetPodDescription(PODSPod *pod); 
PODSString FormSubmitPodGetPodDescription(PODSPod *pod) 
{ 
return "FormSubmit Sample Pod"; 
}

PODSString FormSubmitPodGetPodVersion(PODSPod *pod); 
PODSString FormSubmitPodGetPodVersion(PODSPod *pod) 
{ 
   return "v 1.0"; 
}

void FormSubmitPodDestroy(PODSPod *pod); 
void FormSubmitPodDestroy(PODSPod *pod) 
{ 
   FormSubmitPod *self = (FormSubmitPod *)pod;

   free(self->podsPod.vtable); 
   free(self); 
}

/***** PODSPodNew *****/

// This is the only entry point to your pod, which 
// will be called as soon as the pod is loaded (and 
// after M-Business Client is fully initialized). 
// The PODSPod object returned by PODSPodNew is the 
// embodiment of your pod, and its Destroy method 
// will be invoked just before your pod is unloaded 
// (and before any part of M-Business Client is 
// shut down).

PODSPod *PODSPodNew(PODSAvantGo *avantgo) 
{ 
   FormSubmitPod *self = (FormSubmitPod *)malloc(sizeof(FormSubmitPod)); 
   PODSDocumentMgr *docMgr = PODSgetDocumentMgr(avantgo); 
   PODSDocumentSrc *docSrc = (PODSDocumentSrc *)DocumentSrcNew(docMgr);

   self->podsPod.avantgo = avantgo; 
   self->podsPod.vtable = (PODSPodVTable *)calloc(1, sizeof(PODSPodVTable));

#if 0 
   self->podsPod.vtable->m_getVersion = getVersion; 
#endif 
   self->podsPod.vtable->m_getPodDescription = FormSubmitPodGetPodDescription; 
   self->podsPod.vtable->m_getPodVersion = FormSubmitPodGetPodVersion; 
   self->podsPod.vtable->m_destroy = FormSubmitPodDestroy; 

PODSregisterDocumentSrc(docMgr, docSrc); 

return (PODSPod *)self; 
}