[Gridflow-cvs] [svn] commit: r6172 - in /trunk/src: gridflow.hxx source_filter.rb

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Mon Aug 16 21:13:49 EDT 2010


Author: matju
Date: Mon Aug 16 21:13:49 2010
New Revision: 6172

Log:
add fudge factor to correct the argument count error messages in case of \decl n or of \decl void anything

Modified:
    trunk/src/gridflow.hxx
    trunk/src/source_filter.rb

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Mon Aug 16 21:13:49 2010
@@ -220,9 +220,9 @@
 	for (int q=0; q<n; q++) p += sprintf(p,"%lld ",(long long)ar[q]); \
 	post("%s",foo);}
 
-#define  EXACTARGS(N      ) if (argc!=(N)             ) RAISE("got %d args instead of %d"                     ,argc,(N));
-#define    MINARGS(MIN    ) if (argc<(MIN)            ) RAISE("got %d args instead of at least %d"            ,argc,(MIN));
-#define MINMAXARGS(MIN,MAX) if (argc<(MIN)||argc>(MAX)) RAISE("got %d args instead of at least %d, at most %d",argc,(MIN),(MAX));
+#define  EXACTARGS(FUDGE,N      ) if (argc!=(N)             ) RAISE("got %d args instead of %d"                     ,argc-(FUDGE),(N)-(FUDGE));
+#define    MINARGS(FUDGE,MIN    ) if (argc<(MIN)            ) RAISE("got %d args instead of at least %d"            ,argc-(FUDGE),(MIN)-(FUDGE));
+#define MINMAXARGS(FUDGE,MIN,MAX) if (argc<(MIN)||argc>(MAX)) RAISE("got %d args instead of at least %d, at most %d",argc-(FUDGE),(MIN)-(FUDGE),(MAX)-(FUDGE));
 
 #define CLASSINFO(THISCLASS) \
 	static void THISCLASS##_startup (FClass *fclass); \

Modified: trunk/src/source_filter.rb
==============================================================================
--- trunk/src/source_filter.rb (original)
+++ trunk/src/source_filter.rb Mon Aug 16 21:13:49 2010
@@ -135,9 +135,12 @@
 end
 
 def check_argc(m)
-	if    m.maxargs==m.minargs then Out.print  "EXACTARGS(#{m.minargs})"
-	elsif m.maxargs==-1        then Out.print    "MINARGS(#{m.minargs})"
-	else                            Out.print "MINMAXARGS(#{m.minargs},#{m.maxargs})" end
+	fudge=0
+	fudge=1 if m.inlet==-1
+	fudge=2 if m.selector2=="_0_anything"
+	if    m.maxargs==m.minargs then Out.print  "EXACTARGS(#{fudge},#{m.minargs})"
+	elsif m.maxargs==-1        then Out.print    "MINARGS(#{fudge},#{m.minargs})"
+	else                            Out.print "MINMAXARGS(#{fudge},#{m.minargs},#{m.maxargs})" end
 end
 
 def pass_args(m)



More information about the Gridflow-cvs mailing list