Back to index

tetex-bin  3.0
regis.c
Go to the documentation of this file.
00001 /* Regis terminal window interface for Metafont, joe@rilgp.tamri.com.
00002    screen_rows is 480; screen_cols is 800. */
00003 
00004 #define       EXTERN extern
00005 #include "../mfd.h"
00006 
00007 #ifdef REGISWIN             /* Whole file */
00008 
00009 #define ESCAPE              27
00010 
00011 /* set this up in one of two ways.  if defined, display is white characters
00012 on a black background; undefined is the opposite */
00013 #undef WRITEWHITE
00014 
00015 /* 
00016  *     int init_screen 
00017  *            Put screen in graphics mode:<ESC>Pp
00018  *            Write no or both planes for the background black:S(I0)
00019  *            Write both or no planes for the forground white:W(I3)
00020  *            Erase screen:S(E)
00021  *            Return to alpha mode: <ESC>\ 
00022  *
00023  *            Assuming that the speed limitation is a serial line to the
00024  *            terminal, we want to define macros for the most common
00025  *            character combinations.
00026  *            Define macros for ,+0]P[ (call this "p") and
00027  *            ,+0]V[ (this one is called "v").
00028  *            drawing a line is 4+(2 to 6) characters
00029  *            We always return true.
00030  */
00031 
00032 int mf_regis_initscreen()
00033 {
00034 #ifdef WRITEWHITE
00035        printf("%cPpS(I0)W(I3)S(E)%c",ESCAPE,ESCAPE);
00036 #else
00037        printf("%cPpS(I3)W(I0)S(E)%c",ESCAPE,ESCAPE);
00038 #endif
00039        printf("%cPp@:p,+0]P[@;@:v,+0]V[@;",ESCAPE);
00040        return 1;
00041 }
00042 /*
00043  *     procedure updatescreen;
00044  *
00045  */
00046 void mf_regis_updatescreen()
00047 {
00048 }
00049  /*    void blankrectangle(int left,int right,int top,int bottom);
00050  *
00051  *            Go to graphics mode: <ESC>Pp
00052  *            Move to lower left: P[%d,%d]
00053  *            Write no or both planes: W(I0)
00054  *            Turn on shading: W(S1)
00055  *            Vector to lower right, upper right, upper left, lower left: V's
00056  *            Turn off shading: W(S0)
00057  *            Write both or no planes: W(I3)
00058  *            Return to alpha mode: <ESC>\ 
00059  */
00060 void mf_regis_blankrectangle P4C(screencol, left,
00061                                  screencol, right,
00062                                  screenrow, top,
00063                                  screenrow, bottom)
00064 {
00065        printf(
00066 #ifdef WRITEWHITE
00067        "%cPpP[%d,%d]W(I0)W(S1)V[%d,%d]V[%d,%d]V[%d,%d]V[%d,%d]W(S0)W(I3)%c\\",
00068 #else
00069        "%cPpP[%d,%d]W(I3)W(S1)V[%d,%d]V[%d,%d]V[%d,%d]V[%d,%d]W(S0)W(I0)%c\\",
00070 #endif
00071               ESCAPE,left,bottom,right,bottom,right,top,left,top,
00072               left,bottom,ESCAPE);
00073 }
00074 
00075 /*
00076  *     void paintrow(int row, int init_color, int* transition_vector,
00077  *                                 int vector_size);
00078  *            Paint "row" starting with color "init_color", up to next
00079  *            transition specified by "transition_vector", switch colors,
00080  *            and continue for "vector_size" transitions.
00081  */
00082 void mf_regis_paintrow P4C(screenrow,   row,
00083                            pixelcolor,  init_color,
00084                            transspec,   transition_vector,
00085                            screencol,   vector_size)
00086 {
00087        int i;
00088        if(init_color) {
00089               init_color = 1;
00090        } else {
00091               init_color = 0;
00092        }
00093        printf("%cPpP[0,%d]P[",ESCAPE,row);
00094        for(i=0;i<vector_size;i++) {
00095               if(init_color)
00096               printf("%d@v%d@p",transition_vector[i],
00097                                           transition_vector[i+1]);
00098               init_color = 1-init_color;
00099        }
00100        printf("+0,+0]%c\\",ESCAPE);
00101 }
00102 
00103 #else
00104 int regis_dummy;
00105 #endif /* REGISWIN */