This is nxtcmn.c in view mode; [Download] [Up]
/* support for format statements -- called from cmn0.lisp */ #include <stdio.h> static FILE *fp; int OpenCMNFile (char *fileName) { fp = fopen(fileName,"w"); if (fp == NULL) { printf("Cannot open %s.\n",fileName); fflush(stdout); return 1; } return 0; } CloseCMNFile (void) { if (fp != NULL) fclose(fp); fp = NULL; } PrintCMNFile (char *arr) { fprintf(fp,"%s\n",arr); } LinetoCMNFile (float *arr) { fprintf(fp," %.2f %.2f lineto\n",arr[0],arr[1]); } RLinetoCMNFile (float *arr) { fprintf(fp," %.2f %.2f rlineto\n",arr[0],arr[1]); } MovetoCMNFile (float *arr) { fprintf(fp," %.2f %.2f moveto\n",arr[0],arr[1]); } RMovetoCMNFile (float *arr) { fprintf(fp," %.2f %.2f rmoveto\n",arr[0],arr[1]); } CurvetoCMNFile (float *arr) { fprintf(fp," %.2f %.2f %.2f %.2f %.2f %.2f curveto\n",arr[0],arr[1],arr[2],arr[3],arr[4],arr[5]); } FillinCMNFile (float *arr, char *cmd) { fprintf(fp," %.2f %.2f %.2f %.2f %s\n",arr[0],arr[1],arr[2],arr[3],cmd); } GlyphCMNFile (int glf) { fprintf(fp," (\\%d) show\n",glf); } FontGlyphCMNFile (char *font, int size, int glf) { fprintf(fp," gsave /%s findfont %d scalefont setfont (\\%d) show grestore\n",font,size,glf); } FontTextCMNFile (char *font, int size, char *str) { fprintf(fp," gsave /%s findfont %d scalefont setfont (%s) show grestore\n",font,size,str); } StemCMNFile (float *arr) { fprintf(fp," %.2f setlinewidth %.2f %.2f moveto %.2f %.2f lineto stroke 0 setlinewidth\n",arr[3],arr[0],arr[1],arr[0],arr[2]); } VerticalLineCMNFile (float *arr) { fprintf(fp," %.2f %.2f moveto %.2f %.2f lineto\n",arr[0],arr[1],arr[0],arr[2]); } HorizontalLineCMNFile (float *arr) { fprintf(fp," %.2f %.2f moveto %.2f %.2f lineto\n",arr[0],arr[1],arr[2],arr[1]); } SlantedLineCMNFile (float *arr) { fprintf(fp," %.2f %.2f moveto %.2f %.2f lineto %.2f %.2f lineto %.2f %.2f lineto closepath fill\n", arr[0],arr[1],arr[0],arr[1]+arr[4],arr[2],arr[3]+arr[4],arr[2],arr[3]); }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.