Wednesday 16 June 2004 — This is over 20 years old. Be careful.
I added PostScript support to SilverCity. Now I can show my polyglot code in a new way.
Here’s the code labelled as C code:
/* % Dual program: C or PostScript!
% Ned Batchelder
%
{pop}/,{}/={}/"{}/+{}/;{pop}/-{moveto}/printf{show}/return{showpage}9{def}repeat
( */
# include <stdio.h>
# include <string.h>
/* ) */char count , def = 0 ;
/* */main()
{
char * /* */Courier = " findfont " + 36 , scalefont = 0 ;
char * setfont = "(Hello, world!)" + 0 * 100 + 0 * 100 - 0 ;
printf("%.*s\n", strlen(setfont)-2, setfont+1);
return ;
}
char * exec ;
And here it is labelled as PostScript:
/* % Dual program: C or PostScript!
% Ned Batchelder
%
{pop}/,{}/={}/"{}/+{}/;{pop}/-{moveto}/printf{show}/return{showpage}9{def}repeat
( */
# include <stdio.h>
# include <string.h>
/* ) */char count , def = 0 ;
/* */main()
{
char * /* */Courier = " findfont " + 36 , scalefont = 0 ;
char * setfont = "(Hello, world!)" + 0 * 100 + 0 * 100 - 0 ;
printf("%.*s\n", strlen(setfont)-2, setfont+1);
return ;
}
char * exec ;
OK, now I’ll shut up about the syntax coloring!
Comments
Add a comment: