Diff for /freem/src/symtab_bltin.c between versions 1.5 and 1.10

version 1.5, 2025/03/24 02:01:41 version 1.10, 2025/04/10 01:24:39
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.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
    *   Patch Solaris 8 crash and bump version to 0.63.1-rc1
    *
    *   Revision 1.7  2025/03/26 15:17:12  snw
    *   Fall back to global-backed SSVNs when memory-backed globals fail in attempt to fix Tru64
    *
    *   Revision 1.6  2025/03/24 04:13:11  snw
    *   Replace action macro dat with fra_dat to avoid symbol conflict on OS/2
    *
  *   Revision 1.5  2025/03/24 02:01:41  snw   *   Revision 1.5  2025/03/24 02:01:41  snw
  *   Work around some OS/2 incompatibilities in symbol table code   *   Work around some OS/2 incompatibilities in symbol table code
  *   *
Line 52 Line 67
 symbol-table calls */  symbol-table calls */
 /* #define DEBUG_SYM  */  /* #define DEBUG_SYM  */
   
   short st_use_shm = FALSE;
 short restoring_consts = FALSE;  short restoring_consts = FALSE;
 int semid_symtab;  int semid_symtab;
   
Line 111  void symtab_init (void) Line 127  void symtab_init (void)
         shm_config->hdr->PSIZE = DEFPSIZE;          shm_config->hdr->PSIZE = DEFPSIZE;
         shm_config->hdr->argptr = mbpartition;          shm_config->hdr->argptr = mbpartition;
                   
        
         fprintf (stderr, "symtab_init:  initializing memory-backed globals\r\n");                  fprintf (stderr, "symtab_init:  initializing memory-backed globals\r\n");        
   
         semid_symtab = semget (symtab_sk, 1, 0666 | IPC_CREAT);          semid_symtab = semget (symtab_sk, 1, 0666 | IPC_CREAT);
Line 122  void symtab_init (void) Line 139  void symtab_init (void)
             fprintf (stderr, "symtab_init:  symbol table semaphore created with semid %d\r\n", semid_symtab);              fprintf (stderr, "symtab_init:  symbol table semaphore created with semid %d\r\n", semid_symtab);
         }          }
   
   #if defined(__sun__)
           fprintf (stderr, "symtab_init:  falling back to global-backed structured system variables\r\n");
           shm_config->hdr->use_mb_globals = FALSE;
           return;
   #endif
   
   
         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");              fprintf (stderr, "symtab_init:  failed to initialize symbol table semaphore\r\n");
Line 134  void symtab_init (void) Line 158  void symtab_init (void)
         fprintf (stderr, "symtab_init:  allocating partition for memory-backed globals\r\n");          fprintf (stderr, "symtab_init:  allocating partition for memory-backed globals\r\n");
                   
         mbpartition = (char *) shm_alloc ((size_t) PSIZE + 2);          mbpartition = (char *) shm_alloc ((size_t) PSIZE + 2);
         NULLPTRCHK(mbpartition,"symtab_init");          if (mbpartition != NULL) {
               shm_config->hdr->use_mb_globals = TRUE;
           }
           else {
               fprintf (stderr, "symtab_init:  falling back to global-backed structured system variables\r\n");
               shm_config->hdr->use_mb_globals = FALSE;
           }
   
         shm_config->hdr->partition = mbpartition;          shm_config->hdr->partition = mbpartition;
                   
Line 154  void symtab_init (void) Line 184  void symtab_init (void)
                   
         mbpartition = shm_config->hdr->partition;          mbpartition = shm_config->hdr->partition;
   
           symtab_release_sem ();
     }      }
         
 }  }
Line 204  void symtab_shm (short action, char *key Line 235  void symtab_shm (short action, char *key
     unsigned long stptrs[128];      unsigned long stptrs[128];
     register int i;      register int i;
     char *old_partition = partition;      char *old_partition = partition;
   
       if (shm_config->hdr->use_mb_globals == FALSE) {
           symtab_bltin (action, key, data);
           return;
       }
     partition = mbpartition;      partition = mbpartition;
   
     writing_mb = TRUE;      writing_mb = TRUE;
Line 561  no_with: Line 597  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 604  no_with: Line 640  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;
Line 946  old0:    /* entry from getinc */ Line 985  old0:    /* entry from getinc */
             /* end of set_sym section */              /* end of set_sym section */
   
                           
             case dat:              case fra_dat:
   
   
                 /* note: we assume EOL<DELIM<ASCII */                  /* note: we assume EOL<DELIM<ASCII */
Line 1811  zinvend: Line 1850  zinvend:
                     *newptr++ = k1;                      *newptr++ = k1;
                     *newptr++ = set_sym;                      *newptr++ = set_sym;
                                           
                     //if (mcmnd != ZNEW) test = FALSE;                      /*if (mcmnd != ZNEW) test = FALSE; */
   
                     return;                      return;
   

Removed from v.1.5  
changed lines
  Added in v.1.10


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