opensmalltalk-vm icon indicating copy to clipboard operation
opensmalltalk-vm copied to clipboard

Configuration environment variables should be dialect specific yet backward compatible.

Open eliotmiranda opened this issue 7 years ago • 0 comments

In the unix variant (& hence the Mac variant), there are many environment variables that can specify such things as SQUEAK_PLUGINS SQUEAK_ENCODING SQUEAK_PATHENC SQUEAK_TEXTENC SQUEAK_VM First these should be dialect-specific (PHARO_PLUGINS CUIS_PLUGINS NEWSPEAK_PLUGINS etc), and for backward-compatibility the Squeak specific names should remain functional. So all VM environment variable access should be though a routine, somewhat like

if ((ev = getvmenvvar("PLUGINS"))) squeakPlugins = strdup(ev);

where getvmenvvar is something like

char *
getvmenvvar(const char *var)
{
    char varname[64];
    char *value;
#if PHARO_VM
# define VM_VAR_PREFIX "PHARO_"
#elif CUIS_VM
# define VM_VAR_PREFIX "CUIS_"
#elif NEWSPEAK_VM
# define VM_VAR_PREFIX "NEWSPEAK_"
#endif
#if defined(VM_VAR_PREFIX)
    strcpy(varname,VM_VAR_PREFIX);
    strcat(varname,var);
    if ((value = getenv(varname))
        return value;
#endif
    /* now the default prefix */
    strcpy(varname,"SQUEAK_");
    strcat(varname,var);
    return getenv(varname);
}

eliotmiranda avatar Dec 03 '18 17:12 eliotmiranda