diff --git a/src/snc/gen_ss_code.c b/src/snc/gen_ss_code.c index 1392f93ddd6b0db902f1ac5c8722324ac63682a4..eaba2db38126c17d665a777f12a0f39285e46bf9 100644 --- a/src/snc/gen_ss_code.c +++ b/src/snc/gen_ss_code.c @@ -660,7 +660,6 @@ static void gen_pv_func( uint num_extra_parms = 0; ap = ep->func_args; - /* first parameter is always */ if (ap == 0) { error_at_expr(ep, @@ -671,6 +670,16 @@ static void gen_pv_func( if (ap->type == E_VAR) { vp = ap->extra.e_var; + if (vp->assign == M_MULTI && !global_options.newpv) + { + error_at_expr(ap, + "1st argument '%s' to function '%s' must not be a multi-PV array\n", + vp->name, func_name); + report_at_expr(ap, "Perhaps you meant %s[0]?\n", vp->name); + report_at_expr(ap, "Use option +p to allow this but then " + "pv functions operate on all contained PVs\n"); + return; + } } else if (ap->type == E_SUBSCR) { diff --git a/src/snc/main.c b/src/snc/main.c index e5cdb1210dd34affbdf4f597d890d7710af86f9b..154c120db437e7a36a70cf6a589b9fa5ffbc80a9 100644 --- a/src/snc/main.c +++ b/src/snc/main.c @@ -182,6 +182,9 @@ static void parse_option(char *s) case 'm': options.main = opt_val; break; + case 'p': + options.newpv = opt_val; + break; case 's': options.safe = opt_val; break; diff --git a/src/snc/types.h b/src/snc/types.h index ed86ddbed1cc5432cfae43a23dab12e422ad980d..4ccf94279d6a5c55cbca964f2e9c3cd2301233e4 100644 --- a/src/snc/types.h +++ b/src/snc/types.h @@ -70,9 +70,10 @@ struct options uint line:1; /* generate line markers */ uint warn:1; /* compiler warnings */ uint xwarn:1; /* extra compiler warnings */ + uint newpv:1; /* multi pv mode for builtin functions */ }; -#define DEFAULT_OPTIONS {0,1,0,0,0,1,0,1,1,0} +#define DEFAULT_OPTIONS {0,1,0,0,0,1,0,1,1,0,0} struct state_options /* run-time state options */ {