02-12-2015, 04:33 AM
(02-12-2015 02:50 AM)mendesp Wrote: [ -> ]Thank you Nigel for your answer. I understand your reasons. With all respect to your code and Bit's work, do you think I could "easily" modify it so the SIG display could be used like I wish ?
Could you then point me the code lines I would have to modify ?
Please see the patch below, it seems to do what you asked for but I only tested it for a few seconds.
Code:
diff -ur wp34s_r3748/keys.c wp34s_sig_arg_1_r3748_20150211/keys.c
--- wp34s_r3748/keys.c 2015-02-07 13:09:17.000000000 -0500
+++ wp34s_sig_arg_1_r3748_20150211/keys.c 2015-02-11 23:22:24.032343895 -0500
@@ -1252,6 +1252,7 @@
const unsigned int val = State2.digval * 10 + n;
const int is_reg = argcmds[base].reg || State2.ind;
int lim;
+ int arg_shift = 0;
if (State2.local) {
// Handle local registers and flags
@@ -1272,6 +1273,14 @@
lim = (int) argcmds[base].lim; // any other command
if (lim >= RARG_IND && argcmds[base].indirectokay)
lim = RARG_IND - 1;
+#ifdef INCLUDE_SIGFIG_MODE
+ if (base >= RARG_SIG && base <= RARG_SIG0) {
+ if (n == 0)
+ return STATE_UNFINISHED;
+ lim++;
+ arg_shift = 1;
+ }
+#endif
}
if ((int) val > lim)
return STATE_UNFINISHED;
@@ -1279,7 +1288,7 @@
State2.digval = val;
++State2.numdigit;
if ((int) val * 10 > lim || State2.numdigit >= num_arg_digits(base)) {
- int result = arg_eval(val);
+ int result = arg_eval(val - arg_shift);
if ( result == STATE_UNFINISHED ) {
--State2.numdigit;
State2.digval /= 10;
@@ -1399,6 +1408,8 @@
break;
}
CmdBase = base;
+ if (base != RARG_FIX && !State2.ind && State2.digval == 0)
+ State2.numdigit = 0;
}
#endif
/*
You'll need to instruct your patch utility to ignore whitespaces, otherwise it'll probably complain about tabs. On the command line, it's usually the -l (lower case L) option.
Edit: The above code changes the UI but not how programs are interpreted or displayed, nor how values taken from registers are used... that's left as an exercise for the reader.