iplot.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. /* Plotting functions for v8 and v9 systems */
  10. /* This file is an alternative to plot.h */
  11. /* open the plotting output */
  12. #define openpl() print("o\n")
  13. /* close the plotting output */
  14. #define closepl() print("cl\n")
  15. /* make sure the page or screen is clear */
  16. #define erase() print("e\n")
  17. /* plot a point at _x,_y, which becomes current */
  18. #define point(_x,_y) print("poi %d %d\n", _x,_y)
  19. /* coordinates to be assigned to lower left and upper right
  20. corners of (square) plotting area */
  21. #define range(_x,_y,_X,_Y) print("ra %d %d %d %d\n", _x,_y,_X,_Y)
  22. /* place text, first letter at current point, which does not change */
  23. #define text(_s) {if(*(_s) == ' ')print("t \"%s\"\n",_s); else print("t %s\n", _s); }
  24. /* draw line from current point to _x,_y, which becomes current */
  25. #define vec(_x,_y) print("v %d %d\n", _x,_y)
  26. /* _x,_y becomes current point */
  27. #define move(_x, _y) print("m %d %d\n", _x, _y)
  28. /* specify style for drawing lines */
  29. #define SOLID "solid"
  30. #define DOTTED "dotted"
  31. #define DASHED "dashed"
  32. #define DOTDASH "dotdash"
  33. #define pen(_s) print("pe %s\n", _s)
  34. #define BLACK "z"
  35. #define RED "r"
  36. #define YELLOW "y"
  37. #define GREEN "g"
  38. #define BLUE "b"
  39. #define CYAN "c"
  40. #define MAGENTA "m"
  41. #define WHITE "w"
  42. #define colorcode(_s) ((strcmp(_s,"black")==0)?BLACK:_s)
  43. #define colorx(_s) print("co %s\n", _s); /* funny name is all ken's fault */
  44. #define comment(s,f)