aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tioga/tgRecipe.h
blob: c6ee78e5068d9f8b289e30a847869da743c35c68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*-------------------------------------------------------------------------
 *
 * 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"
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 * $Id: tgRecipe.h,v 1.1.1.1 1996/07/09 06:22:00 scrappy Exp $
 *
 *-------------------------------------------------------------------------
 */

#include "libpq/libpq.h"
#ifndef TIOGA_FRONTEND
#include "libpq/libpq-be.h"
#include "utils/elog.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 *);