absorb.borg

absorb.borg


{

load("down.borg");

` hardcoded  
coord2: down("coord");
coord2.add("coord", "struct coord makecoord(int , int)", 
  "struct coord { int x; int y; };" + eoln+eoln+
  "struct coord makecoord(int a, int b)"+eoln+
  "{"+eoln+
  "  struct coord c;" +eoln+
  "  c.x=a; c.y=b;" +eoln+
  "  return c;" +eoln+
  "}" +eoln
);
jit(coord2.generate());

coord3: down("getX");
coord3.add("getX", "int getX(struct coord)", "struct coord {int x,y; }; "+eoln+" #define getX(P) P.x");
jit(coord3.generate());

coord4: down("getY");
coord4.add("getY", "int getY(struct coord)", "struct coord {int x,y; }; "+eoln+" #define getY(P) P.y");
jit(coord4.generate())

`c:coord(25,30)
`getX(c)
`getY(c)
}