8#include "singular_resourcesconfig.h"
27#define SINGULAR_DEFAULT_DIR PREFIX
46 "%r/share/singular/LIB;"
47 "%b/../share/singular/LIB;"
58 "%r/lib/singular/MOD;"
59 "%r/libexec/singular/MOD;"
65 {
"Singular",
'S',
feResBinary,
"SINGULAR_EXECUTABLE",
"%d/Singular", (
char *)
""},
66 {
"BinDir",
'b',
feResDir,
"SINGULAR_BIN_DIR",
"", (
char *)
""},
68 {
"ProcDir",
'P',
feResPath,
"SINGULAR_PROCS_DIR",
72 "%r/lib/singular/MOD;"
73 "%r/libexec/singular/MOD;"
76 {
"RootDir",
'r',
feResDir,
"SINGULAR_ROOT_DIR",
"%b/..", (
char *)
""},
77 {
"DataDir",
'D',
feResDir,
"SINGULAR_DATA_DIR",
"%b/../share/", (
char *)
""},
79 {
"InfoFile",
'i',
feResFile,
"SINGULAR_INFO_FILE",
"%D/info/singular.info.gz", (
char *)
""},
80 {
"IdxFile",
'x',
feResFile,
"SINGULAR_IDX_FILE",
"%D/singular/singular.idx", (
char *)
""},
82 {
"ManualUrl",
'u',
feResUrl,
"SINGULAR_URL",
"https://www.singular.uni-kl.de/Manual/", (
char *)
""},
83 {
"ExDir",
'm',
feResDir,
"SINGULAR_EXAMPLES_DIR",
"%r/examples", (
char *)
""},
87 {
"emacs",
'E',
feResBinary,
"ESINGULAR_EMACS",
"%b/emacs.exe", (
char *)
""},
88 {
"xemacs",
'A',
feResBinary,
"ESINGULAR_EMACS",
"%b/xemacs.exe", (
char *)
""},
89 {
"SingularEmacs",
'M',
feResBinary,
"ESINGULAR_SINGULAR",
"%b/Singular.exe", (
char *)
""},
91 {
"emacs",
'E',
feResBinary,
"ESINGULAR_EMACS",
"%b/emacs", (
char *)
""},
92 {
"xemacs",
'A',
feResBinary,
"ESINGULAR_EMACS",
"%b/xemacs", (
char *)
""},
93 {
"SingularEmacs",
'M',
feResBinary,
"ESINGULAR_SINGULAR",
"%b/Singular", (
char *)
""},
95 {
"EmacsLoad",
'l',
feResFile,
"ESINGULAR_EMACS_LOAD",
"%e/.emacs-singular", (
char *)
""},
96 {
"EmacsDir",
'e',
feResDir,
"ESINGULAR_EMACS_DIR",
"%D/singular/emacs", (
char *)
""},
97 {
"SingularXterm",
'M',
feResBinary,
"TSINGULAR_SINGULAR",
"%b/Singular", (
char *)
""},
99 {
"rxvt",
'X',
feResBinary,
"RXVT",
"%b/rxvt", (
char *)
""},
101 {
"xterm",
'X',
feResBinary,
"XTERM",
"%b/xterm", (
char *)
""},
103 {
"EmacsDir",
'e',
feResDir,
"SINGULAR_EMACS_DIR",
"%r/emacs", (
char *)
""},
114#define MAXRESOURCELEN 5*MAXPATHLEN
128#if defined(__CYGWIN__) && defined(__GNUC__)
175 printf(
"feInitResources(argv0: '%s'): entering...\n",
feArgv0);
199 printf(
"feInitResources(): entering...\n");
239 if (config->value !=
NULL && *(config->value) !=
'\0')
return config->value;
255 printf(
"feInitResource(config->key: '%s', warn: '%d') : entering ...\n", config->key,
warn);
261 if (config->env !=
NULL)
267 printf(
"feInitResource(config,warn): Found value from env:%s\n",
evalue);
276 printf(
"feInitResource(config,warn): Set value of config (with key: '%s') to '%s'\n", config->key, value);
278 config->value =
strdup(value);
279 return config->value;
286 if (config->id ==
'S')
296 printf(
"value:%s\n", value);
302 else if (config->id ==
'b')
306 printf(
"feInitResource(config,warn): Get '%s' from \"%s\"\n", config->key,
executable);
317 printf(
"value:%s\n", value);
320 if (*value ==
'\0' && config->fmt !=
NULL )
324 else if (config->fmt ==
NULL)
336 printf(
"feInitResource(config,warn): Set value of '%s' to \"%s\"\n", config->key, value);
338 config->value =
strdup(value);
339 return config->value;
350 config->value =
strdup(value);
352 printf(
"feInitResource(config,warn): Set value of '%s' to \"%s\"\n", config->key, config->value);
354 return config->value;
363 printf(
"// ** Could not get '%s'.\n", config->key);
364 printf(
"// ** Either set environment variable '%s' to '%s',\n",
365 config->env, config->key);
367 printf(
"// ** or make sure that '%s' is at \"%s\"\n", config->key, value);
370 printf(
"feInitResource(config,warn): Set value of '%s' to NULL", config->key);
372 config->value =
NULL;
398 printf(
"feGetExpandedExecutable: calling find_exec with \"%s\"\n",
feArgv0);
417 printf(
"feVerifyResourceValue(type: %d, value: \"%s\"): entering\n", (
int)type, value);
446 if (value ==
NULL || *value ==
'\0')
return value;
448 printf(
"Clean value:%s\n", value);
452 printf(
"Clean WINNT value:%s\n", value);
457 if (
l < 4 || (
strcmp(&value[
l-4],
".exe") != 0 &&
458 strcmp(&value[
l-4],
".EXE") != 0))
474 printf(
"feCleanUpFile: entering with =%s=\n",
fname);
491 else if (*(
fn+1) ==
'.')
493 if (*(
fn+2) ==
'.' && (*(
fn + 3) ==
'/' || *(
fn + 3) ==
'\0'))
511 else if (*(
fn+2) ==
'/' || *(
fn+2) ==
'\0')
521 printf(
"feCleanUpFile: leaving with =%s=\n",
fname);
530 printf(
"feCleanUpPath: entering with: =%s=\n",
path);
541 else if (*
path ==
';')
571 printf(
"feCleanUpPath: after CleanUpName: ");
630 printf(
"feCleanUpPath: leaving with path=%s=\n",
opath);
662 if (*fmt ==
'%' && *(fmt + 1) !=
'\0')
677 else if (*fmt ==
'$' && *(fmt + 1) !=
'\0')
681 while (*fmt ==
'_' ||
682 (*fmt >=
'A' && *fmt <=
'Z') ||
683 (*fmt >=
'a' && *fmt <=
'z'))
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
static char * feCleanUpFile(char *fname)
static feResourceConfig feGetResourceConfig(const char id)
static char * feResourceDefault(feResourceConfig config)
static char * feSprintf(char *s, const char *fmt, int warn=-1)
VAR feResourceConfig_s feResourceConfigs[]
static char * feInitResource(feResourceConfig config, int warn)
static char * feCleanUpPath(char *path)
static char * feResource(feResourceConfig config, int warn)
void feInitResources(const char *argv0)
static char * feGetExpandedExecutable()
static char * feCleanResourceValue(feResourceType type, char *value)
static int feVerifyResourceValue(feResourceType type, char *value)
char * feGetResource(const char id, int warn)
#define SINGULAR_DEFAULT_DIR
static void mystrcpy(char *d, char *s)
char * omFindExec(const char *name, char *exec)