Advertisement
friedkiwi

Untitled

Jan 14th, 2023
4,480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.23 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <admucina.h>
  3. #include <admucinf.h>
  4. #include <stdlib.h>
  5. #include <unistd.h>
  6.  
  7. /* field type constants */
  8. #define F_PROTECTED   2
  9. #define F_UNPROT      0
  10.  
  11. /* field highlight constants */
  12. #define F_HLT_NONE 0
  13. #define F_HLT_BLINK 1
  14. #define F_HLT_REVERSE 2
  15. #define F_HLT_UNDERSCORE 4
  16.  
  17. /* colours */
  18. #define F_COL_DFT 0
  19. #define F_COL_BLUE 1
  20. #define F_COL_RED 2
  21. #define F_COL_PINK 3
  22. #define F_COL_GREEN 4
  23. #define F_COL_CYAN 5
  24. #define F_COL_YELLOW 6
  25. #define F_COL_WHITE 7
  26.  
  27. int main() {
  28.   int attype,attval,attcount;
  29.   char entered_name??(15??);
  30.  
  31.   /* init text display */
  32.   fsinit();
  33.  
  34.   /* define fields                */
  35.   /*     fnum   y   x  h  w  type */
  36.   asdfld(   1, 24, 70, 1, 9,  F_PROTECTED); /* bottom label */
  37.   asdfld(   2,  3,  3, 1, 20, F_PROTECTED); /* enter name label */
  38.   asdfld(   3,  3, 25, 1, 15, F_UNPROT); /* name input  */
  39.   asdfld(   4, 10, 10, 1, 6,  F_PROTECTED);
  40.   asdfld(   5, 10, 20, 1, 15, F_PROTECTED);
  41.  
  42.   /* set colours         */
  43.   /*     fnum  colour    */
  44.   asfcol(   1, F_COL_BLUE);
  45.   asfcol(   2, F_COL_GREEN);
  46.   asfcol(   3, F_COL_WHITE);
  47.   asfcol(   4, F_COL_GREEN);
  48.   asfcol(   5, F_COL_YELLOW);
  49.  
  50.   /* fill static fields   */
  51.   /*     fnum len  data   */
  52.   ascput(   1,  9, "GDDMDEMO");
  53.   ascput(   2, 20, "Enter your name ===>");
  54.  
  55.   /* put cursor in name input field at (1,1)  */
  56.   /*     fnum   y   x                         */
  57.   asfcur(   3,  1,  1);
  58.  
  59.   /* output screen                    */
  60.   asread(&attype, &attval, &attcount);
  61.  
  62.   /* read name from screen            */
  63.   /*     fnum len  destination        */
  64.   ascget(   3, 15, entered_name);
  65.  
  66.   /* protect input name field since entered */
  67.   /*     fnum  field type                   */
  68.   asftyp(   3, F_PROTECTED);
  69.  
  70.   /* change input field colour to green     */
  71.   /*     fnum  colour                       */
  72.   asfcol(   3, F_COL_GREEN);
  73.  
  74.   /* output name and hello message    */
  75.   /*     fnum len  data               */
  76.   ascput(   4,  6, "Hello,");
  77.   ascput(   5, 15, entered_name);
  78.  
  79.   /* blinky mcblinkface        */
  80.   /*     fnum  highlight type  */
  81.   asfhlt(   5, F_HLT_BLINK);
  82.  
  83.   /* output/read cycle   */
  84.   asread(&attype, &attval, &attcount);
  85.  
  86.   return 0;
  87. }
  88.  
  89. 
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement