diff --git a/Configure.nqp b/Configure.nqp index 09de72a..6713af7 100644 --- a/Configure.nqp +++ b/Configure.nqp @@ -15,7 +15,7 @@ sub MAIN () { say("to figure out how to build matrixy.\n"); # Load Parrot config and glue functions - load_bytecode('aux/config-helpers.pir'); + load_bytecode('build/config-helpers.pir'); # Check for linalg_group Q:PIR { @@ -28,7 +28,7 @@ sub MAIN () { say "http://www.github.com/Whiteknight/parrot-linear-algebra" exit 1 linalg_group_loaded: - } + }; # Slurp in the unconfigured Makefile text my $unconfigured := slurp(@ARGS[0] || 'config/makefiles/root.in'); diff --git a/src/builtins/abs.pir b/src/builtins/abs.pir index e58bacb..844c5d9 100644 --- a/src/builtins/abs.pir +++ b/src/builtins/abs.pir @@ -4,7 +4,7 @@ .param int nargout .param int nargin .param pmc matrix - .const Sub helper = '!_abs_helper' + .const "Sub" helper = '!_abs_helper' $P0 = clone matrix $P0.'iterate_function_inplace'(helper) diff --git a/src/builtins/arrayfun.pir b/src/builtins/arrayfun.pir index a4052ce..7cb9dfc 100644 --- a/src/builtins/arrayfun.pir +++ b/src/builtins/arrayfun.pir @@ -12,7 +12,7 @@ Apply a function 'func' to each element of an array 'A'. .param pmc f .param pmc A .param pmc O :slurpy - .const Sub helper = "!_arrayfun_helper" + .const "Sub" helper = "!_arrayfun_helper" $S0 = typeof f if $S0 == 'Sub' goto main diff --git a/src/builtins/ceil.pir b/src/builtins/ceil.pir index 608a702..65e0cf1 100644 --- a/src/builtins/ceil.pir +++ b/src/builtins/ceil.pir @@ -4,7 +4,7 @@ .param int nargout .param int nargin .param pmc matrix - .const Sub helper = "!_ceil_helper" + .const "Sub" helper = "!_ceil_helper" $P0 = clone matrix $P0.'iterate_function_inplace'(helper) diff --git a/src/builtins/columns.pir b/src/builtins/columns.pir index 093fb2d..ff9810f 100644 --- a/src/builtins/columns.pir +++ b/src/builtins/columns.pir @@ -3,11 +3,14 @@ .sub 'columns' .param int nargout .param int nargin - .param pmc x - $S0 = typeof x + .param pmc matrix + + $P0 = matrix + $S0 = typeof $P0 if $S0 == 'NumMatrix2D' goto _its_an_array .return(1) _its_an_array: - $I0 = getattribute "X" + $P1 = getattribute $P0, "X" + $I0 = $P1 .return($I0) -.end \ No newline at end of file +.end diff --git a/src/builtins/floor.pir b/src/builtins/floor.pir index 9a23c27..fd54b42 100644 --- a/src/builtins/floor.pir +++ b/src/builtins/floor.pir @@ -4,7 +4,7 @@ .param int nargout .param int nargin .param pmc matrix - .const Sub helper = "!_floor_helper" + .const "Sub" helper = "!_floor_helper" $P0 = clone matrix $P0.'iterate_function_inplace'(helper) @@ -13,7 +13,7 @@ .sub '!_floor_helper' :anon .param pmc matrix - .param num matrix + .param num value .param int x .param int y $N0 = matrix diff --git a/src/builtins/round.pir b/src/builtins/round.pir index 985f2fa..845248b 100644 --- a/src/builtins/round.pir +++ b/src/builtins/round.pir @@ -4,11 +4,11 @@ .param int nargout .param int nargin .param pmc matrix - .const Sub helper = "__round_helper" + .const "Sub" helper = "__round_helper" - $S0 = typeof x + $S0 = typeof matrix if $S0 == 'NumMatrix2D' goto _have_matrix - .return(x) + .return(matrix) _have_matrix: .local pmc new_matrix diff --git a/src/builtins/rows.pir b/src/builtins/rows.pir index 6ecfae7..0ed23db 100644 --- a/src/builtins/rows.pir +++ b/src/builtins/rows.pir @@ -10,8 +10,8 @@ .return(1) _its_an_array: - .local pmc y - y = getattribute "Y" - .return(y) + $P0 = getattribute matrix, "Y" + $I0 = $P0 + .return($I0) .end diff --git a/src/builtins/size.pir b/src/builtins/size.pir index dad58af..8db721a 100644 --- a/src/builtins/size.pir +++ b/src/builtins/size.pir @@ -14,11 +14,9 @@ .return(result) _its_an_array: - .local int x - x = get_attr "X" - .local int y - y = get_attr "Y" - result[0;0] = x - result[0;1] = y + $P0 = getattribute matrix, "X" + $P1 = getattribute matrix, "Y" + result[0;0] = $P0 + result[0;1] = $P1 .return(result) .end diff --git a/src/internals/matrix.pir b/src/internals/matrix.pir index e41841e..a816508 100644 --- a/src/internals/matrix.pir +++ b/src/internals/matrix.pir @@ -311,7 +311,7 @@ Can only dispatch over an internal function, not a builtin or a library routine. .param pmc a .param pmc b .param pmc sub - .const Sub handler = '!distribute_op_handler' + .const "Sub" handler = '!distribute_op_handler' $P0 = a.'iterate_function_external'(handler, b, sub) .return($P0) .end