Diff for /freem/src/symtab_bltin.c between versions 1.8 and 1.14

version 1.8, 2025/04/04 12:46:13 version 1.14, 2025/05/14 12:22:04
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.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
    *   Working towards FreeBSD fix
    *
    *   Revision 1.11  2025/04/13 04:22:43  snw
    *   Fix snprintf calls
    *
    *   Revision 1.10  2025/04/10 01:24:39  snw
    *   Remove C++ style comments
    *
    *   Revision 1.9  2025/04/09 19:52:02  snw
    *   Eliminate as many warnings as possible while building with -Wall
    *
  *   Revision 1.8  2025/04/04 12:46:13  snw   *   Revision 1.8  2025/04/04 12:46:13  snw
  *   Patch Solaris 8 crash and bump version to 0.63.1-rc1   *   Patch Solaris 8 crash and bump version to 0.63.1-rc1
  *   *
Line 56 Line 74
 #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 154  void symtab_init (void) Line 173  void symtab_init (void)
         mbpartition = (char *) shm_alloc ((size_t) PSIZE + 2);          mbpartition = (char *) shm_alloc ((size_t) PSIZE + 2);
         if (mbpartition != NULL) {          if (mbpartition != NULL) {
             shm_config->hdr->use_mb_globals = TRUE;              shm_config->hdr->use_mb_globals = TRUE;
               shm_config->hdr->partition = mbpartition;
         }          }
         else {          else {
             fprintf (stderr, "symtab_init:  falling back to global-backed structured system variables\r\n");              fprintf (stderr, "symtab_init:  falling back to global-backed structured system variables\r\n");
             shm_config->hdr->use_mb_globals = FALSE;              shm_config->hdr->use_mb_globals = FALSE;
         }          }
   
         shm_config->hdr->partition = mbpartition;  
                   
         if (symtab_get_sem ()) {          if (symtab_get_sem ()) {
             for (i = 0; i < 128; i++) shm_config->hdr->alphptr[i] = 0L;              for (i = 0; i < 128; i++) shm_config->hdr->alphptr[i] = 0L;
Line 175  void symtab_init (void) Line 193  void symtab_init (void)
             fprintf (stderr, "symtab_init:  could not attach to symbol table semaphore\r\n");              fprintf (stderr, "symtab_init:  could not attach to symbol table semaphore\r\n");
             exit (1);              exit (1);
         }          }
           
         mbpartition = shm_config->hdr->partition;          if (shm_config->hdr->use_mb_globals == TRUE) {
               mbpartition = SOA(shm_config->hdr->partition);
           }
   
         symtab_release_sem ();          symtab_release_sem ();
     }      }
Line 204  short symtab_get_sem(void) Line 224  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 230  void symtab_shm (short action, char *key Line 250  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 385  void symtab_bltin (short action, char *k Line 408  void symtab_bltin (short action, char *k
     stcnv_m2c (tt_with);      stcnv_m2c (tt_with);
     stcnv_m2c (tt_key);      stcnv_m2c (tt_key);
           
     snprintf (key, 100, "%s%s\201\201", tt_with, tt_key);      sprintf (key, "%s%s\201\201", tt_with, tt_key);
   
           
 no_with:      no_with:    
Line 591  no_with: Line 614  no_with:
             /* OLD get_sym routine */                   /* OLD get_sym routine */     
             if ((i = alphptr[(int) key[0]])) {              if ((i = alphptr[(int) key[0]])) {
   
 //                printf ("alphptr match; writing_mb = %d\r\n", writing_mb);                  /*                printf ("alphptr match; writing_mb = %d\r\n", writing_mb);                */
                                   
                 k = 1;                  k = 1;
                 j = i + 1;                      /* first char always matches! */                  j = i + 1;                      /* first char always matches! */
Line 640  no_with: Line 663  no_with:
                           
             return;              return;
   
   
   
   
   
         case set_sym:                   /* store/create variable */          case set_sym:                   /* store/create variable */
   
   
Line 1841  zinvend: Line 1860  zinvend:
                     *newptr++ = k1;                      *newptr++ = k1;
                     *newptr++ = set_sym;                      *newptr++ = set_sym;
                                           
                     //if (mcmnd != ZNEW) test = FALSE;                      /*if (mcmnd != ZNEW) test = FALSE; */
   
                     return;                      return;
   
Line 1908  zinvend: Line 1927  zinvend:
                                           
                     char esbuf[256];                      char esbuf[256];
   
                     snprintf (esbuf, 255, "%d\201", estack);                      snprintf (esbuf, sizeof (esbuf) - 1, "%d\201", estack);
   
                     j = stcpy (newptr, esbuf);                      j = stcpy (newptr, esbuf);
   

Removed from v.1.8  
changed lines
  Added in v.1.14


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