home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / ME494-3.ZIP / FORTRAN.SRC < prev    next >
Encoding:
Text File  |  1990-01-31  |  4.3 KB  |  138 lines

  1. $Macro_file Fortran;
  2. {****************************************************************************}
  3. {                ---  Mult-Edit macros for FORTRAN --                        }
  4. {****************************************************************************}
  5.  
  6. {******************************************************************************}
  7. {                                MULTI-EDIT MACRO                              }
  8. {                                                                              }
  9. {Name:   For_ind                                                               }
  10. {                                                                              }
  11. {Description:  This macro will perform a smart indent when the <ENTER> key is  }
  12. {                          pressed.  This macro is called by the macro CR.                 }
  13. {                        If checks for the keywords:                                     }
  14. {                                     IF DO & ELSE                                            }
  15. {                                                                              }
  16. {               (C) Copyright 1988 by American Cybernetics, Inc.               }
  17. {******************************************************************************}
  18. $Macro For_Ind;
  19.   Def_str(c_str);
  20.   def_int(t_col, T_col2);
  21.  
  22.   T_col2 := c_col;
  23.   First_word;
  24.   T_col := c_col;
  25.   if (t_col2 < t_col) then
  26.     t_col := t_col2;
  27.     goto_col(T_Col);
  28.   end;
  29.  
  30.   if (Cur_char <> '|0') then
  31.     set_indent_level;
  32.   end;
  33.   t_col := c_col;
  34.  
  35.   c_str := remove_space(Get_word(' (123456789'));
  36.   Goto_col(T_col2);
  37.   Cr;
  38.  
  39.   if (T_col <> T_col2) and (Length(C_str) <> 0) and (pos(caps(c_str),'IF DO ELSE') <> 0) then
  40.     Indent;
  41.   end;
  42.  
  43. end_macro;
  44.  
  45.  
  46. {******************************************************************************}
  47. {                                MULTI-EDIT MACRO                              }
  48. {                                                                              }
  49. {Name:        Fortemp                                                          }
  50. {                                                                              }
  51. {Description: Creates Fortran language constructs based on a single character  }
  52. {                          to the left of the current cursor position.                      }
  53. {             These include:                                                   }
  54. {                                                                                             }
  55. {             if () then         do = ,           SUBROUTINE ()                }
  56. {                                                                                                                                                           }
  57. {                          endif                             continue         END;                         }
  58. {                                                                              }
  59. {               (C) Copyright 1988 by American Cybernetics, Inc.               }
  60. {******************************************************************************}
  61. $MACRO ForTemp;
  62.  
  63.   Def_int(T_col, T_col2,jx);
  64.   T_col2 := C_col;
  65.   left;
  66.   T_col := C_col;
  67.   First_word;
  68.   if (T_col = C_col) then
  69.     Set_indent_level;
  70.     if (cur_char = 'I') then
  71.       right;
  72.       text('F () THEN');
  73.       cr;
  74.       cr;
  75.       text('ENDIF');
  76.       up;
  77.       home;
  78.       indent;
  79.       jx := search_bwd(')',0);
  80.     else
  81.       if (cur_char = 'i') then
  82.         right;
  83.         text('f () then');
  84.         cr;
  85.         cr;
  86.         text('endif');
  87.         up;
  88.         home;
  89.         indent;
  90.         jx := search_bwd(')',0);
  91.       else
  92.         if (cur_char = 'D') then
  93.           right;
  94.           text('O  =  ,');
  95.           cr;
  96.           cr;
  97.           text('CONTINUE');
  98.           up;
  99.           home;
  100.           indent;
  101.           jx := search_bwd('  =',0);
  102.         else
  103.           if (cur_char = 'd') then
  104.             right;
  105.             text('o  =  ,');
  106.             cr;
  107.             cr;
  108.             text('continue');
  109.             up;
  110.             home;
  111.             indent;
  112.             jx := search_bwd('  =',0);
  113.           else
  114.             if (cur_char = 'S') then
  115.               right;
  116.               text('UBROUTINE  ()');
  117.               cr;
  118.               cr;
  119.               text('RETURN');
  120.               cr;
  121.               text('END');
  122.               up; up;
  123.               home;
  124.               indent;
  125.               jx := search_bwd('  (',0);
  126.             end;
  127.           end;
  128.         end;
  129.       end;
  130.     end;
  131.   end;
  132.  
  133. END_MACRO;
  134.  
  135.  
  136. $macro Formtch;
  137.  
  138. end_macro;