This is an example of filter use.
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
static char *btrieveFileName = (char *)"squaresAndSquareRoots.btr";
#ifndef __GNUC__
#define snprintf _snprintf
#endif
#define MIN_X 0
#define MAX_X 255
#pragma pack(1)
typedef struct {
uint8_t x;
uint16_t xSquared;
double xSquareRoot;
char text[128];
} record_t;
#pragma pack()
{
{
goto leave;
}
{
goto leave;
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
int i;
int recordCount;
record_t record;
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
else
{
}
{
goto leave;
}
for (i = 1; i <= recordCount; i++)
{
if (btrieveBulkRetrieveResult.
GetRecord(i, (
char *)&record,
sizeof(record)) !=
sizeof(record))
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
printf("record: (%u, %u, %g, %s)\n", record.x, record.xSquared, record.xSquareRoot, record.text);
}
leave:
return status;
}
{
int i;
record_t record;
for (i = MIN_X; i <= MAX_X; i++)
{
record.x = (uint8_t)i;
record.xSquared = (uint16_t)(i * i);
record.xSquareRoot = sqrt((double)i);
if ((i % 2) == 0)
{
snprintf(record.text, sizeof(record.text), "The square of %03d is %05d and its square root is %f.", record.x, record.xSquared, record.xSquareRoot);
}
else
{
snprintf(record.text, sizeof(record.text), "The SQUARE of %03d is %05d and its square root is %f.", record.x, record.xSquared, record.xSquareRoot);
}
record.text[sizeof(record.text) - 1] = '\0';
{
goto leave;
}
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
{
goto leave;
}
leave:
return status;
}
{
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
leave:
return status;
}
int
main(int argc, char *argv[])
{
static const char *usage = "Usage: %s <digit>\n";
char key;
if (argc != 2)
{
printf(usage, argv[0]);
goto leave;
}
if ((isdigit(argv[1][0]) == 0) || (argv[1][1] != '\0'))
{
printf(usage, argv[0]);
goto leave;
}
key = (char)argv[1][0];
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
{
goto leave;
}
leave:
return 0;
return 1;
}