makeprocs.c 899 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Function: make_procs
  2. **
  3. ** This function creates some commonly used PostScript procedures.
  4. **
  5. ** Author: Paul W. Carlson March 1992
  6. */
  7. #include <grass/gis.h>
  8. #include <grass/glocale.h>
  9. #include "ps_info.h"
  10. int make_procs(void)
  11. {
  12. char filename[1024];
  13. FILE *fp;
  14. int level;
  15. /* begin procs */
  16. fprintf(PS.fp, "\n%%%%BeginProlog\n");
  17. /* level 2 is default PostScript level */
  18. level = (PS.level != 1) ? 2 : 1;
  19. fprintf(PS.fp, "/level %d def\n", level);
  20. sprintf(filename, "%s/etc/paint/prolog.ps", G_gisbase());
  21. fp = fopen(filename, "r");
  22. if (!fp)
  23. G_fatal_error(_("Unable to open prolog <%s>"), filename);
  24. for (;;) {
  25. char buff[80];
  26. if (!fgets(buff, sizeof(buff), fp))
  27. break;
  28. fputs(buff, PS.fp);
  29. }
  30. fclose(fp);
  31. /* all procs should be defined above this line */
  32. fprintf(PS.fp, "%%%%EndProlog\n\n");
  33. return 0;
  34. }