home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / template.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-30  |  3.9 KB  |  161 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. /* template.c */
  22.  
  23. #include <externs.h>
  24.  
  25. void AVL_MOUNT_TEMPLATE(char *local)
  26. {
  27.     AVL_EDIT_WINDOW_PTR w;
  28.     AVL_LINE_PTR temp, head = NULL;
  29.     AVL_WIN_PTR m1;
  30.     char fname[100];
  31.     int n1, n2, x;
  32.     char msg2[80];
  33.     char *pl;
  34.     pl = getenv("ADAED");
  35.     if (pl == NULL)
  36.         pl=getenv("adaed");
  37.     if (pl != NULL)  
  38.         sprintf(fname,"%s%c%s",pl,'\\',local);
  39.     else  {
  40.         AVL_ERROR("Set the ADAED environment variable first (see readme.gw).");
  41.         return;
  42.         }        
  43.  
  44.     w = &avl_windows[avl_window];
  45.     n1 = w -> txt_col;
  46.     avl_start_pos = AVL_COL() - 1;
  47.     if (avl_start_pos < 0) avl_start_pos = 0;
  48.     w -> txt_col = 0;
  49.     temp = AVL_MAKE_LINE("### DUMMY ###",0);
  50.     AVL_LINE_INSERT(temp,&head);
  51.     x = AVL_LOAD(fname, &head);
  52.     avl_start_pos = 0;
  53.  
  54.     if (!x) {
  55.         sprintf(msg2,"Can't open \'%s\'", fname);
  56.         AVL_ERROR(msg2);
  57.         w -> txt_col = n1;
  58.         }
  59.     else {
  60.         AVL_CLEAR_BLOCK();
  61.         avl_block_first_line = head -> next;
  62.         avl_block_last_line = head -> previous;
  63.         avl_block_first_col = 0;
  64.         avl_block_last_col = strlen(head -> previous -> line) - 1;
  65.         if (avl_block_last_col < 0) avl_block_last_col = 0;
  66.         AVL_EDIT_COPY(1);
  67.         AVL_CLEAR_BLOCK();
  68.         AVL_FIND(1,"$");
  69.         AVL_EDIT_DEL_RIGHT(1);
  70.         }
  71. }
  72.  
  73. void AVL_TEMPLATE_ADA_PGM()
  74. {
  75.     AVL_MOUNT_TEMPLATE("adapgm.tpl");
  76.     strcpy(avl_message,"Enter the program's name");
  77. }
  78.     
  79. void AVL_TEMPLATE_ADA_VECTOR()
  80. {
  81.     AVL_MOUNT_TEMPLATE("adavecto.tpl");
  82.     strcpy(avl_message,"Enter the vector's name (type)");
  83. }
  84.     
  85. void AVL_TEMPLATE_ADA_ACCESS()
  86. {
  87.     AVL_MOUNT_TEMPLATE("adaacces.tpl");
  88.     strcpy(avl_message,"Enter the pointer's name (type)");
  89. }
  90.     
  91. void AVL_TEMPLATE_ADA_RECORD()
  92. {
  93.     AVL_MOUNT_TEMPLATE("adarecor.tpl");
  94.     strcpy(avl_message,"Enter the record's name (type)");
  95. }
  96.     
  97. void AVL_TEMPLATE_ADA_MATRIX()
  98. {
  99.     AVL_MOUNT_TEMPLATE("adamatri.tpl");
  100.     strcpy(avl_message,"Enter the matrix's name (type)");
  101. }
  102.     
  103. void AVL_TEMPLATE_ADA_TASK()
  104. {
  105.     AVL_MOUNT_TEMPLATE("adatask.tpl");
  106.     strcpy(avl_message,"Enter the task's name");
  107. }
  108.     
  109. void AVL_TEMPLATE_ADA_PACKAGE()
  110. {
  111.     AVL_MOUNT_TEMPLATE("adapacka.tpl");
  112.     strcpy(avl_message,"Enter the package's name");
  113. }
  114.     
  115. void AVL_TEMPLATE_ADA_GENERIC()
  116. {
  117.     AVL_MOUNT_TEMPLATE("adagener.tpl");
  118.     strcpy(avl_message,"Enter the stack's name (type)");
  119. }
  120.     
  121. void AVL_TEMPLATE_ADA_SERVER()
  122. {
  123.     AVL_MOUNT_TEMPLATE("adaserve.tpl");
  124.     strcpy(avl_message,"Enter the entry's name (type)");
  125. }
  126.     
  127. void AVL_TEMPLATE_ADA_LOOP()
  128. {
  129.     AVL_MOUNT_TEMPLATE("adaloop.tpl");
  130.     strcpy(avl_message,"Enter the loop's range");
  131. }
  132.     
  133. void AVL_TEMPLATE_ADA_WHILE()
  134. {
  135.     AVL_MOUNT_TEMPLATE("adawhile.tpl");
  136.     strcpy(avl_message,"Enter the while condition");
  137. }
  138.     
  139. void AVL_TEMPLATE_ADA_IF()
  140. {
  141.     AVL_MOUNT_TEMPLATE("adaif.tpl");
  142.     strcpy(avl_message,"Enter the condition");
  143. }
  144.     
  145. void AVL_TEMPLATE_ADA_CASE()
  146. {
  147.     AVL_MOUNT_TEMPLATE("adacase.tpl");
  148.     strcpy(avl_message,"Enter the case's object");
  149. }
  150.     
  151. void AVL_TEMPLATE_ADA_FUNCTION()
  152. {
  153.     AVL_MOUNT_TEMPLATE("adafunct.tpl");
  154.     strcpy(avl_message,"Enter the function's name");
  155. }
  156.     
  157. void AVL_TEMPLATE_ADA_PROCEDURE()
  158. {
  159.     AVL_MOUNT_TEMPLATE("adaproce.tpl");
  160.     strcpy(avl_message,"Enter the procedure's name");
  161. }
  162.