Diff for /freem/src/symtab_bltin.c between versions 1.12 and 1.15

version 1.12, 2025/04/14 19:56:27 version 1.15, 2025/05/18 18:15:38
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.15  2025/05/18 18:15:38  snw
    *   Add ZEDIT command for editing routines
    *
    *   Revision 1.14  2025/05/14 12:22:04  snw
    *   Further work on shared memory
    *
    *   Revision 1.13  2025/04/19 21:52:20  snw
    *   Remove extraneous symbol table debugging message
    *
  *   Revision 1.12  2025/04/14 19:56:27  snw   *   Revision 1.12  2025/04/14 19:56:27  snw
  *   Working towards FreeBSD fix   *   Working towards FreeBSD fix
  *   *
Line 68 Line 77
 #include "merr.h"  #include "merr.h"
 #include "consttbl.h"  #include "consttbl.h"
 #include "shmmgr.h"  #include "shmmgr.h"
   #include "log.h"
   
 /* Turn this on to get tons of lovely debugging messages about  /* Turn this on to get tons of lovely debugging messages about
 symbol-table calls */  symbol-table calls */
Line 134  void symtab_init (void) Line 144  void symtab_init (void)
         shm_config->hdr->argptr = mbpartition;          shm_config->hdr->argptr = mbpartition;
                   
             
         fprintf (stderr, "symtab_init:  initializing memory-backed globals\r\n");                  logprintf (FM_LOG_INFO, "symtab_init:  initializing memory-backed globals");        
   
         semid_symtab = semget (symtab_sk, 1, 0666 | IPC_CREAT);          semid_symtab = semget (symtab_sk, 1, 0666 | IPC_CREAT);
         if (semid_symtab == -1) {          if (semid_symtab == -1) {
             fprintf (stderr, "symtab_init:  failed to create symbol table semaphore\r\n");              logprintf (FM_LOG_FATAL, "symtab_init:  failed to create symbol table semaphore");
             exit (1);  
         }          }
         else {          else {
             fprintf (stderr, "symtab_init:  symbol table semaphore created with semid %d\r\n", semid_symtab);              logprintf (FM_LOG_INFO, "symtab_init:  symbol table semaphore created with semid %d", semid_symtab);
         }          }
   
 #if defined(__sun__)  #if defined(__sun__)
         fprintf (stderr, "symtab_init:  falling back to global-backed structured system variables\r\n");          logprintf (FM_LOG_WARNING, "symtab_init:  falling back to global-backed structured system variables");
         shm_config->hdr->use_mb_globals = FALSE;          shm_config->hdr->use_mb_globals = FALSE;
         return;          return;
 #endif  #endif
Line 154  void symtab_init (void) Line 163  void symtab_init (void)
   
         arg.val = 1;          arg.val = 1;
         if (semctl (semid_symtab, 0, SETVAL, arg) == -1) {          if (semctl (semid_symtab, 0, SETVAL, arg) == -1) {
             fprintf (stderr, "symtab_init:  failed to initialize symbol table semaphore\r\n");              logprintf (FM_LOG_FATAL, "symtab_init:  failed to initialize symbol table semaphore");
             exit (1);  
         }          }
         else {          else {
             fprintf (stderr, "symtab_init:  symbol table semaphore initialized\r\n");              logprintf (FM_LOG_INFO, "symtab_init:  symbol table semaphore initialized");
         }          }
   
         fprintf (stderr, "symtab_init:  allocating partition for memory-backed globals\r\n");          logprintf (FM_LOG_INFO, "symtab_init:  allocating partition for memory-backed globals");
                   
         mbpartition = (char *) shm_alloc ((size_t) PSIZE + 2);          mbpartition = (char *) shm_alloc ((size_t) PSIZE + 2);
         if (mbpartition != NULL) {          if (mbpartition != NULL) {
Line 169  void symtab_init (void) Line 177  void symtab_init (void)
             shm_config->hdr->partition = mbpartition;              shm_config->hdr->partition = mbpartition;
         }          }
         else {          else {
             fprintf (stderr, "symtab_init:  falling back to global-backed structured system variables\r\n");              logprintf (FM_LOG_WARNING, "symtab_init:  falling back to global-backed structured system variables");
             shm_config->hdr->use_mb_globals = FALSE;              shm_config->hdr->use_mb_globals = FALSE;
         }          }
                   
Line 183  void symtab_init (void) Line 191  void symtab_init (void)
   
         semid_symtab = semget (symtab_sk, 1, 0);          semid_symtab = semget (symtab_sk, 1, 0);
         if (semid_symtab == -1) {          if (semid_symtab == -1) {
             fprintf (stderr, "symtab_init:  could not attach to symbol table semaphore\r\n");              logprintf (FM_LOG_FATAL, "symtab_init:  could not attach to symbol table semaphore");
             exit (1);              exit (1);
         }          }
   
         if (shm_config->hdr->use_mb_globals == TRUE) {          if (shm_config->hdr->use_mb_globals == TRUE) {
             mbpartition = shm_config->hdr->partition;              mbpartition = SOA(shm_config->hdr->partition);
         }          }
   
         symtab_release_sem ();          symtab_release_sem ();
Line 217  short symtab_get_sem(void) Line 225  short symtab_get_sem(void)
         sleep (1);          sleep (1);
   
     }      }
     fprintf (stderr, "symtab_get_sem:  fail\r\n");      logprintf (FM_LOG_ERROR, "symtab_get_sem:  fail");
           
     have_symtab_sem = FALSE;      have_symtab_sem = FALSE;
     return FALSE;      return FALSE;
Line 243  void symtab_shm (short action, char *key Line 251  void symtab_shm (short action, char *key
     register int i;      register int i;
     char *old_partition = partition;      char *old_partition = partition;
   
       /*
       global (action, key, data);
       return;
       */
       
     if (shm_config->hdr->use_mb_globals == FALSE) {      if (shm_config->hdr->use_mb_globals == FALSE) {
         symtab_bltin (action, key, data);          symtab_bltin (action, key, data);
         return;          return;
Line 300  void symtab_shm (short action, char *key Line 313  void symtab_shm (short action, char *key
                   
     }      }
     else {      else {
         fprintf (stderr, "symtab_shm:  failed to acquire symbol table sempahore\r\n");          logprintf (FM_LOG_FATAL, "symtab_shm:  failed to acquire symbol table sempahore");
     }      }
   
     writing_mb = FALSE;      writing_mb = FALSE;
Line 647  no_with: Line 660  no_with:
                                   
                 } while (i < PSIZE);                  } while (i < PSIZE);
             }              }
             else {  
                 printf ("alphptr not found\r\n");  
             }  
   
             merr_raise (M6);              merr_raise (M6);
             data[0] = EOL;              data[0] = EOL;
                           
             return;              return;
   
   
   
   
   
         case set_sym:                   /* store/create variable */          case set_sym:                   /* store/create variable */
   
   

Removed from v.1.12  
changed lines
  Added in v.1.15


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