compile.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*************************************************************************
  2. * Copyright (c) 2011 AT&T Intellectual Property
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: Details at https://graphviz.org
  9. *************************************************************************/
  10. #pragma once
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #include <sfio/sfio.h>
  15. #include <parse.h>
  16. #include <gprstate.h>
  17. #include <expr/expr.h>
  18. #include <stdbool.h>
  19. #include <stddef.h>
  20. #include <stdio.h>
  21. typedef struct {
  22. Exnode_t *guard;
  23. Exnode_t *action;
  24. } case_stmt;
  25. #define UDATA "userval"
  26. typedef struct {
  27. Agrec_t h;
  28. Extype_t iu;
  29. Agedge_t* ine;
  30. } nval_t;
  31. typedef struct {
  32. bool locked: 1; ///< is the lock currently taken?
  33. bool zombie: 1; ///< was a deletion request recorded while locked?
  34. } lock_t;
  35. typedef struct {
  36. Agrec_t h;
  37. lock_t lock;
  38. } gval_t;
  39. typedef struct {
  40. Agrec_t h;
  41. } edata;
  42. #define OBJ(p) ((Agobj_t*)p)
  43. typedef nval_t ndata;
  44. typedef gval_t gdata;
  45. #define nData(n) ((ndata*)(aggetrec(n,UDATA,0)))
  46. #define gData(g) ((gdata*)(aggetrec(g,UDATA,0)))
  47. typedef struct {
  48. bool srcout: 1;
  49. bool induce: 1;
  50. bool clone: 1;
  51. } compflags_t;
  52. typedef struct {
  53. Exnode_t *begg_stmt;
  54. bool does_walk_graph; ///< does this block have a node or edge statement?
  55. size_t n_nstmts;
  56. size_t n_estmts;
  57. case_stmt *node_stmts;
  58. case_stmt *edge_stmts;
  59. } comp_block;
  60. typedef struct {
  61. bool uses_graph; ///< does this program use the input graph?
  62. Expr_t *prog;
  63. Exnode_t *begin_stmt;
  64. size_t n_blocks;
  65. comp_block *blocks;
  66. Exnode_t *endg_stmt;
  67. Exnode_t *end_stmt;
  68. } comp_prog;
  69. comp_prog *compileProg(parse_prog *, Gpr_t *, compflags_t);
  70. extern void freeCompileProg (comp_prog *p);
  71. extern Agraph_t *readG(FILE *fp);
  72. extern Agraph_t *openG(char *name, Agdesc_t);
  73. extern Agraph_t *openSubg(Agraph_t * g, char *name);
  74. extern Agnode_t *openNode(Agraph_t * g, char *name);
  75. extern Agedge_t *openEdge(Agraph_t* g, Agnode_t * t, Agnode_t * h, char *key);
  76. #ifdef __cplusplus
  77. }
  78. #endif