aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorjohn haque <j.eh@mchsi.com>2012-02-26 06:57:48 -0600
committerjohn haque <j.eh@mchsi.com>2012-02-26 06:57:48 -0600
commit1c06c5c6f0f6d46f63977dd7407d86ccc2614226 (patch)
tree5763e51d36264e6f84a70e480d063b788c2f47cf /main.c
parentcb17a712ea65f6510e0000374cce4efbf4ffb902 (diff)
downloadegawk-1c06c5c6f0f6d46f63977dd7407d86ccc2614226.tar.gz
egawk-1c06c5c6f0f6d46f63977dd7407d86ccc2614226.tar.bz2
egawk-1c06c5c6f0f6d46f63977dd7407d86ccc2614226.zip
Finish MPFR changes and clean up code.
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/main.c b/main.c
index 00a63d5a..558c91f6 100644
--- a/main.c
+++ b/main.c
@@ -36,7 +36,7 @@
#define DEFAULT_PROFILE "awkprof.out" /* where to put profile */
#define DEFAULT_VARFILE "awkvars.out" /* where to put vars */
#define DEFAULT_PREC 53
-#define DEFAULT_RNDMODE "RNDN"
+#define DEFAULT_RNDMODE "N" /* round to nearest */
static const char *varfile = DEFAULT_VARFILE;
const char *command_file = NULL; /* debugger commands */
@@ -60,7 +60,7 @@ static void init_groupset(void);
static void save_argv(int, char **);
extern int debug_prog(INSTRUCTION *pc); /* debug.c */
-
+extern int init_debug(); /* debug.c */
/* These nodes store all the special variables AWK uses */
NODE *ARGC_node, *ARGIND_node, *ARGV_node, *BINMODE_node, *CONVFMT_node;
@@ -571,7 +571,11 @@ out:
}
#endif
+ if (do_debug) /* Need to register the debugger pre-exec hook before any other */
+ init_debug();
+
#ifdef HAVE_MPFR
+ /* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */
if (do_mpfr)
init_mpfr(DEFAULT_RNDMODE);
#endif
@@ -583,8 +587,8 @@ out:
Nnull_string = make_string("", 0);
#ifdef HAVE_MPFR
if (do_mpfr) {
- mpfr_init(Nnull_string->mpfr_numbr);
- mpfr_set_d(Nnull_string->mpfr_numbr, 0.0, RND_MODE);
+ mpfr_init(Nnull_string->mpg_numbr);
+ mpfr_set_d(Nnull_string->mpg_numbr, 0.0, RND_MODE);
Nnull_string->flags = (MALLOC|STRCUR|STRING|MPFN|NUMCUR|NUMBER);
} else
#endif
@@ -600,8 +604,6 @@ out:
*/
resetup();
- init_interpret();
-
/* Set up the special variables */
init_vars();
@@ -652,6 +654,9 @@ out:
optind++;
}
+ /* Select the interpreter routine */
+ init_interpret();
+
init_args(optind, argc,
do_posix ? argv[0] : myname,
argv);