home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / charsets / isodemo2.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  2KB  |  75 lines

  1. /* A short program to display MS Kermit VT320 emulation character sets */
  2. /* Writes output to stdout, so best redirect it to a file for replaying */
  3. /* From Joe Doupnik, 27 June 1989 */
  4.  
  5. #include <stdio.h>
  6. #define SO 14
  7. #define SI 15
  8. #define ESC 27
  9.  
  10. /*        Nat  ASCII Latin Su G   Sp G  UPSS  Tech  Alt-Rom */
  11. char *set[] =  {" ", ")B", "-A", ")%5", ")0", ")<", ")>", ")1"};
  12.  
  13. main()
  14. {
  15.     int i, j;
  16.     void showtable(), at();
  17.  
  18.     fputc(ESC, stdout); fputc('c', stdout);    /* master reset */
  19.     at(1,2);
  20.     fputs("\n    National  ASCII    Latin-1  Sup Gr   Spc Gr", stdout);
  21.     fputs("    UPSS     Tech    Alt-Rom", stdout);
  22.     fputs("\n                B        A        %5       0   ", stdout);
  23.     fputs("     <        >        1", stdout);
  24.  
  25.     fputs("\n     ", stdout);
  26.     for(i = 0; i < 8; i++)                /* label columns */
  27.         {
  28.         for (j = 2; j < 8; j++)
  29.             printf("%#1d", j);
  30.         fputs("   ", stdout);
  31.         }
  32.     for (i = 0; i < 16; i++)            /* label rows */
  33.         {
  34.         at(2, 6 + i);
  35.         printf("%#2d: ", i);
  36.         }
  37.  
  38.     fputc(ESC, stdout); fputs("[?42h", stdout); /* National Repl Chars */
  39.     showtable(6, 6);
  40.     fputc(ESC, stdout); fputs("[?42l", stdout); /* Disable NRCs */
  41.  
  42.     for (i = 1; i < 8; i++)            /* do the other char sets */
  43.         {
  44.         fputc(ESC, stdout); fputs(set[i], stdout);
  45.         showtable(6+i*9, 6);
  46.         }
  47.     at(1, 23);                /* nail down cursor */
  48. }
  49.  
  50. void
  51. showtable(c, r)
  52. int c, r;        /* display 96 characters in column format */
  53. {
  54.     int column, row;
  55.  
  56.     fputc(ESC, stdout); fputc('7', stdout);        /* save cursor */
  57.     fputc(SO, stdout);                /* GL to G1 */
  58.     for (column = 2; column < 8; column++)        /* cols 2..7 */
  59.         for (row = 0; row < 16; row++)        /* rows 0..15 */
  60.             {
  61.             at(c+column-2, r+row);        /* position cursor */
  62.             fputc(row + column * 16, stdout); /* show GL char */
  63.             }
  64.     fputc(SI, stdout);                /* GL to G0 */
  65.     fputc(ESC, stdout); fputc('8', stdout);        /* restore cursor */
  66. }
  67. void
  68. at(col, row)
  69. int col, row;            /* position cursor at row, column */
  70. {
  71.     fputc(ESC, stdout);
  72.     printf("[%d;%dH", row, col);        /* move to row, col */ 
  73. }
  74. /* the end */
  75.