/*
* $Id: symtab_dispatch.c,v 1.4 2025/03/27 03:27:35 snw Exp $
* symbol table dispatch module
*
*
* Author: Serena Willis <snw@coherent-logic.com>
* Copyright (C) 1998 MUG Deutschland
* Copyright (C) 2020, 2025 Coherent Logic Development LLC
*
*
* This file is part of FreeM.
*
* FreeM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FreeM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero Public License for more details.
*
* You should have received a copy of the GNU Affero Public License
* along with FreeM. If not, see <https://www.gnu.org/licenses/>.
*
* $Log: symtab_dispatch.c,v $
* Revision 1.4 2025/03/27 03:27:35 snw
* Install init scripts to share/freem/examples/init and fix regression in method dispatch
*
* Revision 1.3 2025/03/09 19:50:47 snw
* Second phase of REUSE compliance and header reformat
*
*
* SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
* SPDX-License-Identifier: AGPL-3.0-or-later
**/
#include <string.h>
#include <ctype.h>
#include "mpsdef.h"
#include "mref.h"
#include "objects.h"
void symtab (short action, char *key, char *data)
{
register int i;
register int j;
char ch;
short res;
char obj_class[255];
char t_rou[255];
char t_cls[255];
freem_ref_t rv;
freem_ref_t *r = &rv;
mref_init (r, MREF_RT_LOCAL, "");
internal_to_mref (r, key);
res = obj_is_object (r->name);
if (res == TRUE) {
res = obj_get_attribute (r->name, "CLASS", obj_class);
stcpy (t_rou, rou_name);
stcnv_m2c (t_rou);
strcpy (t_cls, &(obj_class[1]));
if ((strcmp (t_rou, t_cls) != 0) && (obj_is_field_private (key) == TRUE)) {
merr_raise (OBJFLDACCV);
return;
}
if (r->subscript_count == 0 && action == kill_sym) {
if (destructor_ct < 10) {
snprintf (destructors[destructor_ct++], 50, "DESTROY^%%SYSOOP(\"%s\",.%s)", t_cls, r->name);
}
obj_destroy (key);
}
}
if (action != fra_order && action != fra_query) {
for (i = 0; i < r->subscript_count; i++) {
if (strlen (r->subscripts[i]) < 1) {
merr_raise (SBSCR);
return;
}
}
}
if (rtn_dialect () == D_M77) {
for (i = 0; i < r->subscript_count; i++) {
for (j = 0; j < strlen (r->subscripts[i]); j++) {
ch = r->subscripts[i][j];
if (!isdigit (ch)) {
merr_raise (NOSTAND);
return;
}
}
}
}
symtab_bltin (action, key, data);
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>