tgRecipe.h 4.19 KB
Newer Older
1 2
/*-------------------------------------------------------------------------
 *
3
 * tgRecipe.h
4 5 6 7 8 9 10
 *		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"
11
 *
12
 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
Bruce Momjian's avatar
Add:  
Bruce Momjian committed
13
 * Portions Copyright (c) 1994, Regents of the University of California
14
 *
15
 * $Id: tgRecipe.h,v 1.17 2001/03/22 06:16:17 momjian Exp $
16 17 18 19 20 21 22 23 24 25
 *
 *-------------------------------------------------------------------------
 */

#include "libpq/libpq.h"
#ifndef TIOGA_FRONTEND
#include "libpq/libpq-be.h"
#include "utils/geo-decls.h"
#else
#include "libpq-fe.h"
26 27
typedef struct
{
28 29
	double		x,
				y;
30
} Point;						/* this should match whatever is in
31

32
								 *
Bruce Momjian's avatar
Bruce Momjian committed
33
								 *
34
								 *
35
								 *
36 37
								 *
								 *
Bruce Momjian's avatar
Bruce Momjian committed
38
								 *
39
								 *
40
								 *
41 42
								 *
								 *
43
								 *
44
								 *
45 46
								 * geo-decls.h */

47
#endif	 /* TIOGA_FRONTEND */
48 49 50 51 52 53

typedef enum
{
	TG_INGRED,
	TG_EYE,
	TG_RECIPE
54
}			TgElemType;
55 56 57 58 59 60 61

typedef enum
{
	TG_SQL,
	TG_C,
	TG_RECIPE_GRAPH,
	TG_COMPILED
62
}			TgSrcLangType;
63 64 65 66 67 68 69 70 71

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 */
72
}			TgNodeType;
73 74 75 76

/* -- type definition for setting up in memory Tioga recipe structure -- */
/* -- see 'recipe-schema.sql' for their corresponding database types  -- */

77
typedef char *TgString;
78 79

typedef struct _tgelement *TgElementPtr;
80 81
typedef struct _tgnode *TgNodePtr;
typedef struct _tgrecipe *TgRecipePtr;
82 83 84

/* auto-generated header containing Arr_TgString, Arr_TgElementPtr,
   and Arr_TgNodePtr */
85
#include "tioga/Arr_TgRecipe.h"
86 87

/* C structure representation of a Tioga Element */
88 89
typedef struct _tgelement
{
90 91 92 93 94 95 96 97
	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
98
								 * element */
99 100 101 102 103
	char	   *icon;			/* iconic representation */
	char	   *src;			/* source code for this element */
	TgSrcLangType srcLang;		/* source language */
	char	   *owner;			/* owner recipe name */
}			TgElement;
104 105 106


/* C structure representation of a Tioga Node */
107 108
typedef struct _tgnode
{
109 110 111 112 113
	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
114 115
								 * NULL TgNodePtr indicates a run-time
								 * parameter */
116 117
	Arr_TgNodePtr *outNodes;	/* variable array of out node pointers. */
}			TgNode;
118 119

/* C structure representation of a Tioga Recipe */
120 121
typedef struct _tgrecipe
{
122 123
	TgElement	elmValue;		/* "inherits" TgElement attributes. */
	Arr_TgNodePtr *allNodes;	/* array of all nodes for this recipe. */
Bruce Momjian's avatar
Bruce Momjian committed
124
	Arr_TgNodePtr *rootNodes;	/* array of root nodes for this recipe.
125
								 * root nodes are nodes with no parents */
126
	Arr_TgNodePtr *eyes;		/* array of pointers for the browser nodes
127 128 129 130
								 * recipe, execution of recipe starts by
								 * traversing the recipe C structure from
								 * the eye nodes pointed by these
								 * pointers. */
131
	Arr_TgNodePtr *tees;		/* array of pointers of all the tee nodes */
132 133 134 135
	Arr_TgElementPtr *elements; /* array of all the elements in this
								 * recipe, elements may be shared by
								 * multiple nodes */

136
}			TgRecipe;
137 138

/* functions defined in tgRecipe.c */
139 140
extern TgRecipe *retrieveRecipe(char *name);
extern TgElement *findElemInRecipe(TgRecipe * r, char *elemName);
141
extern TgNode *findNodeInRecipe(TgRecipe * r, char *nodeName);
142 143

/* ---- copyXXX functions ---- */
144 145 146 147
extern void copyTgElementPtr(TgElementPtr *, TgElementPtr *);
extern void copyTgNodePtr(TgNodePtr *, TgNodePtr *);
extern void copyTgRecipePtr(TgRecipePtr *, TgRecipePtr *);
extern void copyTgString(TgString *, TgString *);