Diff for /freem/src/routine.c between versions 1.7 and 1.9

version 1.7, 2025/04/30 14:41:03 version 1.9, 2025/04/30 20:03:09
Line 24 Line 24
  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.   *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
  *   *
  *   $Log$   *   $Log$
    *   Revision 1.9  2025/04/30 20:03:09  snw
    *   Work on entryref parser
    *
    *   Revision 1.8  2025/04/30 17:19:16  snw
    *   Improve backtraces in debugger
    *
  *   Revision 1.7  2025/04/30 14:41:03  snw   *   Revision 1.7  2025/04/30 14:41:03  snw
  *   Further debugger work   *   Further debugger work
  *   *
Line 1148  void lineref (char **adrr) Line 1154  void lineref (char **adrr)
     return;      return;
 }                                       /* end of lineref() */  }                                       /* end of lineref() */
   
 #if 0  char *m_text(char *lref, char *buf)
 char *routine_get_line(char *lref, char *buf)  {
       char *old_codptr;
       char old_code[STRLEN];
       
       old_codptr = codptr;
       stcpy (old_code, code);
       
       sprintf (code, "$TEXT(%s)\201", lref);
       codptr = code;
       
       expr (STRING);
   
       if (merr () != OK) {
           stcpy (code, old_code);
           codptr = old_codptr;
           return (char *) NULL;
       }
   
       stcpy (buf, argptr);
       stcpy (code, old_code);
       codptr = old_codptr;
   
       return buf;
   }
       
   
   
   /* routine_get_line()
    *  char *entryref:  [cstr/in] M entryref
    *  char *buf:   [cstr/out] buffer to contain resulting line
    *
    *  returns a pointer to buf [cstr] on success; otherwise NULL */
   char *routine_get_line(char *entryref, char *buf)
 {  {
     char tmp[STRLEN];      char tmp[STRLEN];
     char a[STRLEN];      char a[STRLEN];
     long l1, rouoldc;      long l1, rouoldc;
     short reload = FALSE;      short reload = FALSE;
     int f = 3;      char f;
   
     register int i;      register int i;
     register int j;      register int j;
       
     i = 0;  
                           
     if (f > 1) {  
         stcpy (tmp, lref[arg + 1]);  
         i = intexpr (tmp);  
     }  
   
     if (a[0] == EOL) {  
   
         if (i < 0) {  
             return (char *) NULL;  
         }  
   
         /* $T(+0) returns routine name */      char *routine_p;
         if (i == 0) {      char *label_p;
       char *offset_p;
   
       short have_label = FALSE;
       short have_offset = FALSE;
       
       char r[256];
       char l[256];
       char o[256];
       int os;
       
       /*
        * entryref can be:
        *  +0 (returns rou_name)
        *  label
        *  ^routine
        *  +offset
        *  +offset^routine
        *  label^routine
        *  label+offset^routine
        */
   
             if (f != 3) {      /* handle +0 */
                 stcpy (a, rou_name);      if (strcmp (entryref, "+0") == 0) {
             }           stcpy (buf, rou_name);
             else {          stcnv_m2c (buf);
                 stcpy (a, argstck[arg + 2]);          return buf;
             }                                      }
   
             goto nxt_operator;      if ((routine_p = strchr (entryref, '^')) != NULL) {
           /* have a routine */
           stcpy (r, routine_p);
           printf ("routine = %s\r\n", r);
       }
       else {
           /* no routine implies current routine */
           stcpy (r, rou_name);        
       }
   
         }      if ((offset_p = strchr (entryref, '+')) != NULL) {
           stcpy (o, offset_p + 1);
           os = atoi (o);
           sprintf (o, "%d\201\0", os);
           printf ("offset = %s\r\n", o);
           have_offset = TRUE;
       }
       else {
           have_offset = FALSE;
       }
   
       return NULL;
       i = 0;
                           
       if (f > 1) {
           stcpy (tmp, entryref);
           i = intexpr (tmp);
       }
       
       if (i < 0) return (char *) NULL;    
       
       /* $T(+0) returns routine name */
       if (i == 0) {
           stcpy (buf, rou_name);
     }      }
   
     if (f == 3) {      if (f == 3) {
Line 1210  char *routine_get_line(char *lref, char Line 1286  char *routine_get_line(char *lref, char
                 ierr -= NOPGM; /* smw 15 nov 2023 TODO HUH?? */                  ierr -= NOPGM; /* smw 15 nov 2023 TODO HUH?? */
                 *a = EOL;                  *a = EOL;
   
                 goto nxt_operator;                  /*goto nxt_operator;*/
             }              }
   
             return;              return NULL;
   
         }          }
   
Line 1312  t_end: Line 1388  t_end:
   
   
 }  }
 #endif  

Removed from v.1.7  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>