Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nineties committed Mar 19, 2013
1 parent 83a32b6 commit 6f5204f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
8 changes: 7 additions & 1 deletion rowl1/rowl1-compile.rlc
Expand Up @@ -2,7 +2,7 @@
; rowl - 1st generation
; Copyright (C) 2010 nineties
;
; $Id: rowl1-compile.rlc 2013-03-17 16:46:41 nineties $
; $Id: rowl1-compile.rlc 2013-03-19 17:22:33 nineties $
;

(import "rlvm-compile")
Expand All @@ -23,6 +23,12 @@
(var noguard (to_sym "%noguard"))
(var closed (to_sym "%closed"))

(export fun unwrap_internal (node) (
(if (== (node_head node) Ref)
(return (unwrap_internal (node_arg node 2))))
(return node)
))

; compilers

(extern object current_loc)
Expand Down
8 changes: 5 additions & 3 deletions rowl1/rowl1-pprint.rlc
Expand Up @@ -2,7 +2,7 @@
; rowl - 1st generation
; Copyright (C) 2012 nineties
;
; $Id: rowl1-array.rlc 2013-03-05 07:02:27 nineties $
; $Id: rowl1-array.rlc 2013-03-19 17:26:12 nineties $
;

(import "rlvm-compile")
Expand Down Expand Up @@ -47,9 +47,10 @@
))

(fun pprint_main (ochan obj) (
(= obj (unwrap_internal obj))
(tswitch (node_type obj) (
(@SymbolE . (return (output_symbol ochan obj)))
(@ExprE . (return (pp_expr ochan obj)))
(@ExprE . (return (pp_node ochan obj)))
(@ListE . (return (pp_list ochan obj)))
(@ArrayE . (return (pp_array ochan obj)))
(@TableE . (return (pp_table ochan obj)))
Expand Down Expand Up @@ -130,7 +131,8 @@
(return @C_NIL)
))

(fun pp_expr (ochan node) (
(extern fun unwrap_internal)
(fun pp_node (ochan node) (
(output_symbol ochan (node_head node))
(output_char ochan '{')
(var n (node_size node))
Expand Down
13 changes: 12 additions & 1 deletion rowl1/rowl1-tuple.rlc
Expand Up @@ -2,7 +2,7 @@
; rowl - 1st generation
; Copyright (C) 2010 nineties
;
; $Id: rowl1-list.rlc 2013-02-06 23:09:39 nineties $
; $Id: rowl1-list.rlc 2013-03-19 11:49:08 nineties $
;

(import "rlvm-compile")
Expand Down Expand Up @@ -54,6 +54,15 @@
(return t)
))

(fun tp_new (n) (
(= n (unbox n))
(var t (allocate_tuple n))
(for i 0 n (do
(array_set object t i @C_UNDEF)
))
(return t)
))

(fun tp_length (t) (
(return (box (seq_size t)))
))
Expand Down Expand Up @@ -139,6 +148,8 @@
))

(export fun setup_tuple (std) (
(var mod (create_module std (to_sym "Tuple")))
(add_function1 mod (to_sym "new") intT tp_new 0)
(add_function1 std (to_sym "length") tupleT tp_length 0)
(add_function1 std (to_sym "size") tupleT tp_length 0)
(add_function1 std (to_sym "hash") tupleT tp_hash 0)
Expand Down

0 comments on commit 6f5204f

Please sign in to comment.