|
@@ -25,10 +25,13 @@
|
|
|
#include <sys/types.h>
|
|
#include <sys/types.h>
|
|
|
#include <sys/wait.h>
|
|
#include <sys/wait.h>
|
|
|
#include <string.h>
|
|
#include <string.h>
|
|
|
|
|
+#include <fcntl.h>
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include <klist.h>
|
|
#include <klist.h>
|
|
|
|
|
+#include <config.h>
|
|
|
|
|
+
|
|
|
#include <tripl/tripl.h>
|
|
#include <tripl/tripl.h>
|
|
|
#include <tripl/limits.h>
|
|
#include <tripl/limits.h>
|
|
|
#include <tripl/arch.h>
|
|
#include <tripl/arch.h>
|
|
@@ -50,7 +53,7 @@ __arch_templ static int declare_object(char *p, struct arch *);
|
|
|
__arch_templ static int interp_in_interp(char *p, struct arch *, long *out);
|
|
__arch_templ static int interp_in_interp(char *p, struct arch *, long *out);
|
|
|
|
|
|
|
|
__arch_templ int cstyle_declare(char *p, struct arch *);
|
|
__arch_templ int cstyle_declare(char *p, struct arch *);
|
|
|
-
|
|
|
|
|
|
|
+__arch_templ union math_expr *parse_math_expr(char *p);
|
|
|
|
|
|
|
|
|
|
|
|
|
__arch_templ int arch_do_keyword(char *p, struct arch *arch_fn) {
|
|
__arch_templ int arch_do_keyword(char *p, struct arch *arch_fn) {
|
|
@@ -236,12 +239,18 @@ static int set_name(char *p, struct arch *arch_fn, long *res) {
|
|
|
|
|
|
|
|
getword(p, &type, &out);
|
|
getword(p, &type, &out);
|
|
|
|
|
|
|
|
- if (type != WORDTYPE_NR)
|
|
|
|
|
|
|
+ if (type == WORDTYPE_KWORD && out == '$') {
|
|
|
|
|
+ out = arch_fn->arch_math_expr(p, name);
|
|
|
|
|
+
|
|
|
|
|
+ goto skip;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ else if (type != WORDTYPE_NR)
|
|
|
out = getrightvalue(p, arch_fn);
|
|
out = getrightvalue(p, arch_fn);
|
|
|
|
|
|
|
|
arch_fn->arch_set_var(name, out, 0);
|
|
arch_fn->arch_set_var(name, out, 0);
|
|
|
|
|
|
|
|
- *res = out;
|
|
|
|
|
|
|
+skip: *res = out;
|
|
|
|
|
|
|
|
free(name);
|
|
free(name);
|
|
|
|
|
|
|
@@ -500,11 +509,19 @@ static int iini_run(char *interp_path, char *code) {
|
|
|
|
|
|
|
|
/* we use the command-line '-c' */
|
|
/* we use the command-line '-c' */
|
|
|
|
|
|
|
|
- printf("\nRun %s as interpreter-in-interpreter: \n", interp_path);
|
|
|
|
|
|
|
+ fprintf(stderr, "\nRun %s as interpreter-in-interpreter: \n", interp_path);
|
|
|
|
|
|
|
|
if (!(pid = fork())) {
|
|
if (!(pid = fork())) {
|
|
|
/* child */
|
|
/* child */
|
|
|
|
|
|
|
|
|
|
+#if CONFIG_NODISPLAY_IINI
|
|
|
|
|
+
|
|
|
|
|
+ int fd = open("/dev/null", O_WRONLY);
|
|
|
|
|
+
|
|
|
|
|
+ dup2(fd, 1);
|
|
|
|
|
+ dup2(fd, 2);
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
execl(interp_path, interp_path, "-c", code, NULL);
|
|
execl(interp_path, interp_path, "-c", code, NULL);
|
|
|
|
|
|
|
|
error("execl: %s\n", strerror(errno));
|
|
error("execl: %s\n", strerror(errno));
|
|
@@ -514,10 +531,8 @@ static int iini_run(char *interp_path, char *code) {
|
|
|
|
|
|
|
|
waitpid(pid, &stat, 0);
|
|
waitpid(pid, &stat, 0);
|
|
|
|
|
|
|
|
- printf("\n");
|
|
|
|
|
-
|
|
|
|
|
if (WIFEXITED(stat))
|
|
if (WIFEXITED(stat))
|
|
|
- printf("%s exited normally with status %d\n", interp_path, WEXITSTATUS(stat));
|
|
|
|
|
|
|
+ fprintf(stderr, "\n%s exited normally with status %d\n", interp_path, WEXITSTATUS(stat));
|
|
|
|
|
|
|
|
else if (WIFSIGNALED(stat)) {
|
|
else if (WIFSIGNALED(stat)) {
|
|
|
error("%s terminated by signal %d%s\n", interp_path, WTERMSIG(stat),
|
|
error("%s terminated by signal %d%s\n", interp_path, WTERMSIG(stat),
|