Ticket #1644: pasmserializer_test.pir

File pasmserializer_test.pir, 0.7 KB (added by plobsing, 4 years ago)

demonstration of serializer functionality

Line 
1# Copyright (C) 2006-2009, Parrot Foundation.
2# $Id$
3
4.sub 'main' :main
5    $P0 = new ['FixedIntegerArray']
6    $P0 = 5
7    $P0[0] = 1
8    $P0[1] = 2
9    $P0[2] = 3
10    $P0[3] = 4
11    $P0[4] = 5
12
13    $P1 = new ['PASMSerializer']
14    setref $P1, $P0
15    $S0 = $P1
16    say "FIA Serialization:"
17    say $S0
18    say ""
19
20    $P0 = new ['ResizablePMCArray']
21    $P0[0] = $P0
22    $P1 = box 42
23    $P2 = new ['Hash']
24    $P2['Hello World'] = $P1
25    $P2['Circular Ref'] = $P0
26    $P0[1] = $P1
27    $P0[2] = $P2
28
29    $P1 = new ['PASMSerializer']
30    setref $P1, $P0
31    $S0 = $P1
32    say "RPA Serialization:"
33    say $S0
34    say ""
35.end
36
37# Local Variables:
38#   mode: pir
39#   fill-column: 100
40# End:
41# vim: expandtab shiftwidth=4 ft=pir:
42