openapicp, closeapicp - Metamorph API control parameters interface


#include <stdio.h>
#include "api3.h"

APICP * openapicp(void)

APICP * closeapicp(cp)
APICP * cp;

Openapicp returns a pointer to a structure that contains all of the default parameters needed by the Metamorph API. Each of the members of the structure are initialized in a manner that will allow for simple modification of its contents by the calling program. Closeapicp frees all the memory allocated by openapicp and returns an APICP *)NULL.

The following describes how to modify each of the variable types within the APICP structure:

(byte)    : Direct assignment
            eg:  cp->suffixproc=(byte)1;

(int)     : Direct assignment
            eg: cp->minwordlen=2;

(byte *)  : Free original pointer and assign new allocated pointer
            eg: free(cp->sdexp);
                cp->sdexp=(byte *)malloc(strlen("string")+1);

(byte **) : Free original pointers and assign new allocated pointers
            eg: #define MYLISTSZ 3
                static char *mylist[MYLISTSZ]={"new","list",""};
                int i;
                free(cp->noise[i]);     /* free empty string at end */
                free(cp->noise);          /* free the array pointer */
                cp->noise=(byte **)calloc(MYLISTSZ,sizeof(byte *));
                      cp->noise[i]=(byte *)malloc(strlen(mylist[i])+1);

int (*)() : Direct assignment
            eg:   cp->eqedit=myeditfunction;

WARNING: The closeapicp() will free all variable pointers. Do not assign static data pointers or attempt to free any pointers placed in the APICP structure.

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.