(file) Return to lang_enscript.st CVS log (file) (dir) Up to [RizwankCVS] / testProject / share / enscript / hl

  1 rizwank 1.1 
  2             state lang_enscript
  3             {
  4               BEGIN {
  5                 /* RGB -> PostScript color mapper function. */
  6                 sub map_color (r, g, b)
  7                   {
  8             	return sprintf ("%f %f %f", r div 255.0, g div 255.0, b div 255.0);
  9                   }
 10             
 11                 /* No language special characters. */
 12                 LANGUAGE_SPECIALS = 0;
 13             
 14                 sub language_print (str)
 15                   {
 16             	print (str);
 17                   }
 18             
 19                 sub symbol (sym)
 20                   {
 21             	print ("\0font{Symbol", ptsize, ":ps}", sym, "\0font{default}");
 22 rizwank 1.1       }
 23             
 24                 sub language_symbol (sym)
 25                   {
 26             	local result = true;
 27             
 28             	if (strcmp (sym, "rightarrow") == 0)
 29             	  symbol ("\0256");
 30             	else if (strcmp (sym, "le") == 0)
 31             	  symbol ("\0243");
 32             	else if (strcmp (sym, "ge") == 0)
 33             	  symbol ("\0263");
 34             	else if (strcmp (sym, "ne") == 0)
 35             	  symbol ("\0271");
 36             	else if (strcmp (sym, "equiv") == 0)
 37             	  symbol ("\0272");
 38             	else if (strcmp (sym, "land") == 0)
 39             	  symbol ("\0331");
 40             	else if (strcmp (sym, "lor") == 0)
 41             	  symbol ("\0332");
 42             	else if (strcmp (sym, "lnot") == 0)
 43 rizwank 1.1 	  symbol ("\0330");
 44             	else
 45             	  result = false;
 46             
 47             	return result;
 48                   }
 49             
 50                 sub header ()
 51                   {
 52             	/* Nothing here. */
 53                   }
 54             
 55                 sub trailer ()
 56                   {
 57             	/* Nothing here. */
 58                   }
 59             
 60                 sub font (name)
 61                   {
 62             	print ("\0font{", name, "@", ptsize, "}");
 63                   }
 64 rizwank 1.1 
 65                 sub color (name)
 66                   {
 67             	print ("\0color{", name, "}");
 68                   }
 69             
 70                 sub bgcolor (name)
 71                   {
 72             	print ("\0bgcolor{", name, "}");
 73                   }
 74             
 75                 sub face_on (face)
 76                   {
 77             	font (face[fontname]);
 78             	if (face[fg_color] || face[bg_color])
 79             	  {
 80             	    if (face[fg_color])
 81             	      color (face[fg_color]);
 82             	    if (face[bg_color])
 83             	      bgcolor (face[bg_color]);
 84             	  }
 85 rizwank 1.1       }
 86             
 87                 sub face_off (face)
 88                   {
 89             	print ("\0font{default}");
 90             	if (face[fg_color] || face[bg_color])
 91             	  {
 92             	    if (face[fg_color])
 93             	      print ("\0color{default}");
 94             	    if (face[bg_color])
 95             	      {
 96             		print ("\0bgcolor{default}");
 97             	      }
 98             	  }
 99                   }
100             
101                 return;
102               }
103             }
104             
105             
106 rizwank 1.1 /*
107             Local variables:
108             mode: c
109             End:
110             */

Rizwan Kassim
Powered by
ViewCVS 0.9.2