home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / SCREDIT2.ZIP / SKELETON.C < prev    next >
Encoding:
Text File  |  1989-02-28  |  4.1 KB  |  171 lines

  1. /*-------------------------------------------------------------------------
  2.                         Turbo ScrEdit Skeleton v.1.0
  3.  
  4.                             for Turbo C 1.5, 2.0
  5.  
  6. Refer to SKELETON.DOC for a complete discussion on the contents and usage
  7. of this file.
  8. -------------------------------------------------------------------------*/
  9.  
  10.  
  11. /*--**Version**-*/
  12.  
  13.  
  14. /*--**Buffers**-*/
  15.  
  16.  
  17. /*--**User Variables**-*/
  18.  
  19. int Demo_Screen_Pointer;
  20. int Demo_Current_Screen;
  21. int Demo_Load_Screen;
  22. int Demo_Mode;
  23.  
  24. /*--** Example of loading and displaying screens**-*/
  25.  
  26. void Load_Screen()
  27. {
  28. S_Num = -1;
  29.  
  30. while (S_Num == -1)
  31.     {
  32.     Demo_Screen_Pointer++;
  33.     switch (Demo_Screen_Pointer)
  34.        {
  35.  
  36. /*--**Screens**-*/
  37.  
  38.        }
  39.     if (S_Num == -1) Demo_Screen_Pointer = 0;
  40.     }
  41. }
  42.  
  43.  
  44.  
  45.  
  46. void Skeleton_Init()
  47. {
  48. /*--**ScreenFileName**-*/
  49.  
  50. /*--**InitRoutines**-*/
  51.  
  52.  
  53. /*--**System Switches**-*/
  54.  
  55. S_Msg[0]     = 0;
  56. S_Sound      = 1;
  57. S_Freq       = 300;
  58. S_Dur        = 100;
  59. S_ShowStatus = 1;
  60. S_Cursor     = S_NORMAL;
  61. S_Point      = -1;
  62.  
  63. /*--** 1st Example Code **-*/
  64.  
  65. Demo_Current_Screen = -1;
  66. Demo_Mode    = 1;
  67.  
  68. Load_Screen();
  69. }
  70.  
  71. void Process_Current_Screen()
  72. {
  73. /*--** Demo mode 2 **-*/
  74.  
  75. if (Demo_Mode == 2)
  76.    {
  77.    if (s_indx->A.s_compiledind[S_Num] < 3)
  78.       S_ReadKey();
  79.    else
  80.        do
  81.          {
  82.          if  (S_Point > s_indx->A.s_count[S_Num]) S_Point = -1;
  83.          while ((S_Point==-1)||(s_field->C.s_type[S_Point]>9))
  84.              if (++S_Point >= s_indx->A.s_count[S_Num]) S_Point = -1;
  85.          if  (S_Msg[0]!=0)
  86.              {
  87.              itoa(S_Point,S_NewStr,10);
  88.              strcpy(S_Msg,"Field <");
  89.              strcat(S_Msg,S_NewStr);
  90.              strcat(S_Msg,">");
  91.              }
  92.          S_ReadField();
  93.          if  ((S_Enter)||(S_Tab))
  94.              S_Point++;
  95.          }
  96.       while ((!S_Alt)&&(!S_Ctrl) && (!S_Fkey) && (!S_Enter));
  97.    }
  98.  
  99.  
  100.  
  101. /*--** Demo mode 0 or 1 **-*/
  102.  
  103. if (Demo_Mode != 2)
  104.    S_ReadScreen();
  105.  
  106.  
  107. /*--** Example code for demonstration mode **-*/
  108.  
  109. if  ((S_F1) &&
  110.     (Demo_Mode>0))
  111.     {
  112.     strcpy(S_Msg,"Press any key to load the next screen");
  113.     S_ReadKey();
  114.     Load_Screen();
  115.     }
  116. /*--**Special Key Testing**-*/
  117.  
  118. if  (!S_Ins)
  119.     {
  120.     strcpy(S_Msg,"< >");
  121.     if  (S_Ch > 31)
  122.         S_Msg[1]=S_Ch;
  123.  
  124.     if  (S_RightShift)  strcat(S_Msg,"<Right Shift>");
  125.     if  (S_LeftShift)   strcat(S_Msg,"<Left Shift>");
  126.     if  (S_Ctrl)        strcat(S_Msg,"<Control key>");
  127.     if  (S_Alt)         strcat(S_Msg,"<Alt key>");
  128.     if  (S_ScrollLock)  strcat(S_Msg,"<Scroll Lock>");
  129.     if  (S_NumLock)     strcat(S_Msg,"<Num Lock>");
  130.     if  (S_Caps)        strcat(S_Msg,"<Caps>");
  131.     if  (S_InsertMode)  strcat(S_Msg,"<Insert Mode>");
  132.     if  (S_F1)          strcat(S_Msg,"<F1>");
  133.     if  (S_F2)          strcat(S_Msg,"<F2>");
  134.     if  (S_F3)          strcat(S_Msg,"<F3>");
  135.     if  (S_F4)          strcat(S_Msg,"<F4>");
  136.     if  (S_F5)          strcat(S_Msg,"<F5>");
  137.     if  (S_F6)          strcat(S_Msg,"<F6>");
  138.     if  (S_F7)          strcat(S_Msg,"<F7>");
  139.     if  (S_F8)          strcat(S_Msg,"<F8>");
  140.     if  (S_F9)          strcat(S_Msg,"<F9>");
  141.     if  (S_F10)         strcat(S_Msg,"<F10>");
  142.     if  (S_F11)         strcat(S_Msg,"<F11>");
  143.     if  (S_F12)         strcat(S_Msg,"<F12>");
  144.     if  (S_Home)        strcat(S_Msg,"<Home>");
  145.     if  (S_End)         strcat(S_Msg,"<End>");
  146.     if  (S_PgUp)        strcat(S_Msg,"<PgUp>");
  147.     if  (S_PgDn)        strcat(S_Msg,"<PgDn>");
  148.     if  (S_Left)        strcat(S_Msg,"<Left>");
  149.     if  (S_Right)       strcat(S_Msg,"<Right>");
  150.     if  (S_Up)          strcat(S_Msg,"<Up>");
  151.     if  (S_Down)        strcat(S_Msg,"<Down>");
  152.     if  (S_Del)         strcat(S_Msg,"<Delete>");
  153.     if  (S_Tab)         strcat(S_Msg,"<Tab>");
  154.     if  (S_BkSp)        strcat(S_Msg,"<Back Space>");
  155.     if  (S_Esc)         strcat(S_Msg,"<Escape>");
  156.     if  (S_Enter)       strcat(S_Msg,"<Enter>");
  157.     }
  158. }
  159.  
  160.  
  161. main()
  162. {
  163. Skeleton_Init();
  164. while (!S_Esc)
  165.     {
  166.     Process_Current_Screen();
  167.     }
  168. /*--** Closing The screen file **--*/
  169. S_CloseScreenFile();
  170. }
  171.