Commit 03d39ce0 authored by Bruce Momjian's avatar Bruce Momjian

Remove TIOGA files from CVS current; they remain in repositiry.

parent fbb1966c
#include "tioga/Varray.h"
/* Modify the following size macros to suit your need. */
#ifndef Arr_TgString_INITIAL_SIZE
#define Arr_TgString_INITIAL_SIZE 32
#endif
#ifndef Arr_TgElementPtr_INITIAL_SIZE
#define Arr_TgElementPtr_INITIAL_SIZE 32
#endif
#ifndef Arr_TgNodePtr_INITIAL_SIZE
#define Arr_TgNodePtr_INITIAL_SIZE 32
#endif
/***************************************************************/
/* Do not modify anything below this line. */
/***************************************************************/
/* -- Defining types and function for Arr_TgString type -- */
/* -- the following must be supplied by the user:
void copyTgString(TgString* from, TgString* to); - make a copy of TgString.
*/
#ifndef _ARR_TgString_
#define _ARR_TgString_
#ifndef ARR_TgString_INITIAL_SIZE
#define ARR_TgString_INITIAL_SIZE 32 /* change this size to suit your
* need */
#endif /* ARR_TgString_INITIAL_SIZE */
typedef struct Arr_TgString
{
size_t num;
size_t size;
size_t valSize;
TgString *val;
} Arr_TgString;
#define newArr_TgString() \
(Arr_TgString *) NewVarray(ARR_TgString_INITIAL_SIZE, sizeof(TgString))
#define enlargeArr_TgString(A, I) \
( \
(A)->size += (I), \
(A)->val = (TgString *) realloc((A)->val, (A)->valSize * (A)->size) \
)
#define addArr_TgString(A, V) \
AppendVarray((Varray *) (A), (void *) (V), (CopyingFunct) copyTgString)
#define deleteArr_TgString(A) FreeVarray(A)
#endif /* _ARR_TgString_ */
/* -- Defining types and function for Arr_TgElementPtr type -- */
/* -- the following must be supplied by the user:
void copyTgElementPtr(TgElementPtr* from, TgElementPtr* to); - make a copy of TgElementPtr.
*/
#ifndef _ARR_TgElementPtr_
#define _ARR_TgElementPtr_
#ifndef ARR_TgElementPtr_INITIAL_SIZE
#define ARR_TgElementPtr_INITIAL_SIZE 32 /* change this size to
* suit your need */
#endif /* ARR_TgElementPtr_INITIAL_SIZE */
typedef struct Arr_TgElementPtr
{
size_t num;
size_t size;
size_t valSize;
TgElementPtr *val;
} Arr_TgElementPtr;
#define newArr_TgElementPtr() \
(Arr_TgElementPtr *) NewVarray(ARR_TgElementPtr_INITIAL_SIZE, sizeof(TgElementPtr))
#define enlargeArr_TgElementPtr(A, I) \
( \
(A)->size += (I), \
(A)->val = (TgElementPtr *) realloc((A)->val, (A)->valSize * (A)->size) \
)
#define addArr_TgElementPtr(A, V) \
AppendVarray((Varray *) (A), (void *) (V), (CopyingFunct) copyTgElementPtr)
#define deleteArr_TgElementPtr(A) FreeVarray(A)
#endif /* _ARR_TgElementPtr_ */
/* -- Defining types and function for Arr_TgNodePtr type -- */
/* -- the following must be supplied by the user:
void copyTgNodePtr(TgNodePtr* from, TgNodePtr* to); - make a copy of TgNodePtr.
*/
#ifndef _ARR_TgNodePtr_
#define _ARR_TgNodePtr_
#ifndef ARR_TgNodePtr_INITIAL_SIZE
#define ARR_TgNodePtr_INITIAL_SIZE 32 /* change this size to suit your
* need */
#endif /* ARR_TgNodePtr_INITIAL_SIZE */
typedef struct Arr_TgNodePtr
{
size_t num;
size_t size;
size_t valSize;
TgNodePtr *val;
} Arr_TgNodePtr;
#define newArr_TgNodePtr() \
(Arr_TgNodePtr *) NewVarray(ARR_TgNodePtr_INITIAL_SIZE, sizeof(TgNodePtr))
#define enlargeArr_TgNodePtr(A, I) \
( \
(A)->size += (I), \
(A)->val = (TgNodePtr *) realloc((A)->val, (A)->valSize * (A)->size) \
)
#define addArr_TgNodePtr(A, V) \
AppendVarray((Varray *) (A), (void *) (V), (CopyingFunct) copyTgNodePtr)
#define deleteArr_TgNodePtr(A) FreeVarray(A)
#endif /* _ARR_TgNodePtr_ */
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for tioga
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/tioga/Attic/Makefile,v 1.10 2001/02/20 19:20:28 petere Exp $
#
#-------------------------------------------------------------------------
subdir = src/backend/tioga
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS = tgRecipe.o Varray.o
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
all: SUBSYS.o
SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
rm -f SUBSYS.o $(OBJS)
ifeq (depend,$(wildcard depend))
include depend
endif
/* ************************************************************************
*
* Varray.c
*
* routines to provide a generic set of functions to handle variable sized
* arrays. originally by Jiang Wu
* ************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "Varray.h"
Varray *
NewVarray(size_t nobj, size_t size)
/*
* NewVarray -- allocate a Varray to contain an array of val each of which
* is size valSize. Returns the Varray if successful,
* returns NULL otherwise.
*/
{
Varray *result;
if (nobj == 0)
nobj = VARRAY_INITIAL_SIZE;
result = (Varray *) malloc(sizeof(Varray));
result->val = (void *) calloc(nobj, size);
if (result == NULL)
return NULL;
result->size = size;
result->nobj = 0;
result->maxObj = nobj;
return result;
}
int
AppendVarray(Varray * array, void *value, CopyingFunct copy)
/*
* AppendVarray -- append value to the end of array. This function
* returns the size of the array after the addition of
* the new element.
*/
{
copy(value, VARRAY_NTH(array->val, array->size, array->nobj));
array->nobj++;
if (array->nobj >= array->maxObj)
ENLARGE_VARRAY(array, array->maxObj / 2);
return array->nobj;
}
/* ********************************************************************
*
* Varray.h -- header file for varray.c which provides a generic
* set of functions to handle variable sized arrays.
*
* originally by Jiang Wu
* ********************************************************************/
#ifndef _VARRAY_H_
#define _VARRAY_H_
typedef struct _varray
{
size_t nobj; /* number of objects in this array */
size_t maxObj; /* max. number of objects in this array */
size_t size; /* size of each element in the array */
void *val; /* array of elements */
} Varray;
/* type for custom copying function */
typedef void (*CopyingFunct) (void *from, void *to);
#define VARRAY_INITIAL_SIZE 32
#define ENLARGE_VARRAY(ARRAY, INC) \
( \
(ARRAY)->maxObj += (INC), \
(ARRAY)->val = (void *) realloc((ARRAY)->val, \
(ARRAY)->size * (ARRAY)->maxObj) \
)
#define VARRAY_NTH(VAL, SIZE, N) (((char *) (VAL)) + (SIZE) * (N))
#define FreeVarray(ARRAY) \
if ((ARRAY) != NULL) { free((ARRAY)->val); free((ARRAY)); (ARRAY) = NULL ; }
#define ModifyVarray(ARRAY, N, NEW, COPY) \
if ((N) < (ARRAY)->nobj) \
(COPY)(VARRAY_NTH((ARRAY)->val, (ARRAY)->size, (N)), (NEW))
#define GetVarray(ARRAY, N) \
((N) < (ARRAY)->nobj ? VARRAY_NTH((ARRAY)->val, (ARRAY)->size, (N)) \
: NULL)
extern Varray *NewVarray(size_t nobj, size_t size);
extern int AppendVarray(Varray * array, void *value, CopyingFunct copy);
#endif /* _VARRAY_H_ */
This diff is collapsed.
/*-------------------------------------------------------------------------
*
* tgRecipe.h
* Tioga recipe-related definitions and declarations
* these functions can be used in both the frontend and the
* backend
*
* to use this header, you must also include
* "utils/geo-decls.h"
* and "libpq/libpq.h"
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: tgRecipe.h,v 1.23 2002/06/20 20:29:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "libpq/libpq.h"
#ifndef TIOGA_FRONTEND
#include "libpq/libpq-be.h"
#include "utils/geo-decls.h"
#else
#include "libpq-fe.h"
typedef struct
{
double x,
y;
} Point; /* this should match whatever is in
*
*
*
* geo-decls.h */
#endif /* TIOGA_FRONTEND */
typedef enum
{
TG_INGRED,
TG_EYE,
TG_RECIPE
} TgElemType;
typedef enum
{
TG_SQL,
TG_C,
TG_RECIPE_GRAPH,
TG_COMPILED
} TgSrcLangType;
typedef enum
{
TG_INGRED_NODE,
TG_EYE_NODE,
TG_RECIPE_NODE,
TG_TEE_NODE /* tee nodes are not stored in the db we
* create them when we read the recipe
* back */
} TgNodeType;
/* -- type definition for setting up in memory Tioga recipe structure -- */
/* -- see 'recipe-schema.sql' for their corresponding database types -- */
typedef char *TgString;
typedef struct _tgelement *TgElementPtr;
typedef struct _tgnode *TgNodePtr;
typedef struct _tgrecipe *TgRecipePtr;
/* auto-generated header containing Arr_TgString, Arr_TgElementPtr,
and Arr_TgNodePtr */
#include "tioga/Arr_TgRecipe.h"
/* C structure representation of a Tioga Element */
typedef struct _tgelement
{
char *elemName; /* name of function this element represent */
TgElemType elemType; /* type of this element */
Arr_TgString *inPorts; /* names of inputs */
Arr_TgString *inTypes; /* name of input types */
Arr_TgString *outPorts; /* type of output */
Arr_TgString *outTypes; /* name of output types */
char *doc; /* description of this element */
Arr_TgString *keywords; /* keywords used to search for this
* element */
char *icon; /* iconic representation */
char *src; /* source code for this element */
TgSrcLangType srcLang; /* source language */
char *owner; /* owner recipe name */
} TgElement;
/* C structure representation of a Tioga Node */
typedef struct _tgnode
{
char *nodeName; /* name of this node */
TgNodeType nodeType; /* type of this node */
Point loc; /* screen location of the node. */
TgElement *nodeElem; /* the underlying element of this node */
Arr_TgNodePtr *inNodes; /* variable array of in node pointers a
* NULL TgNodePtr indicates a run-time
* parameter */
Arr_TgNodePtr *outNodes; /* variable array of out node pointers. */
} TgNode;
/* C structure representation of a Tioga Recipe */
typedef struct _tgrecipe
{
TgElement elmValue; /* "inherits" TgElement attributes. */
Arr_TgNodePtr *allNodes; /* array of all nodes for this recipe. */
Arr_TgNodePtr *rootNodes; /* array of root nodes for this recipe.
* root nodes are nodes with no parents */
Arr_TgNodePtr *eyes; /* array of pointers for the browser nodes
* recipe, execution of recipe starts by
* traversing the recipe C structure from
* the eye nodes pointed by these
* pointers. */
Arr_TgNodePtr *tees; /* array of pointers of all the tee nodes */
Arr_TgElementPtr *elements; /* array of all the elements in this
* recipe, elements may be shared by
* multiple nodes */
} TgRecipe;
/* functions defined in tgRecipe.c */
extern TgRecipe *retrieveRecipe(char *name);
extern TgElement *findElemInRecipe(TgRecipe * r, char *elemName);
extern TgNode *findNodeInRecipe(TgRecipe * r, char *nodeName);
/* ---- copyXXX functions ---- */
extern void copyTgElementPtr(TgElementPtr *, TgElementPtr *);
extern void copyTgNodePtr(TgNodePtr *, TgNodePtr *);
extern void copyTgRecipePtr(TgRecipePtr *, TgRecipePtr *);
extern void copyTgString(TgString *, TgString *);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment