1 //
2 // Copyright (c) 2006, Brian Frank and Andy Frank
3 // Licensed under the Academic Free License version 3.0
4 //
5 // History:
6 // 26 Dec 05 Brian Frank Creation
7 // 19 Aug 06 Brian Frank Ported from Java to Fan
8 //
9
10 **
11 ** FSlot is the read/write fcode representation of sys::Slot.
12 **
13 abstract class FSlot : CSlot, FConst
14 {
15
16 //////////////////////////////////////////////////////////////////////////
17 // Constructor
18 //////////////////////////////////////////////////////////////////////////
19
20 new make(FType fparent)
21 {
22 this.fparent = fparent
23 }
24
25 //////////////////////////////////////////////////////////////////////////
26 // CSlot
27 //////////////////////////////////////////////////////////////////////////
28
29 FPod pod() { return fparent.pod }
30 override CType parent() { return fparent }
31 override Str name() { return fparent.fpod.n(nameIndex) }
32 override Str qname() { return fparent.qname + "." + name }
33 override Str toStr() { return qname }
34
35 //////////////////////////////////////////////////////////////////////////
36 // IO
37 //////////////////////////////////////////////////////////////////////////
38
39 protected Void writeCommon(OutStream out)
40 {
41 out.writeI2(nameIndex)
42 out.writeI4(flags & FlagsMask)
43 }
44
45 protected Void readCommon(InStream in)
46 {
47 nameIndex = in.readU2
48 flags = in.readU4
49 }
50
51 protected Void writeAttrs(OutStream out)
52 {
53 if (fattrs == null)
54 {
55 out.writeI2(0)
56 }
57 else
58 {
59 out.writeI2(fattrs.size)
60 fattrs.each |FAttr a| { a.write(out) }
61 }
62 }
63
64 protected Void readAttrs(InStream in)
65 {
66 fattrs = FAttr[,]
67 size := in.readU2
68 if (size !== 0)
69 {
70 fattrs.capacity = size
71 size.times |,| { fattrs.add(FAttr.make.read(in)) }
72 }
73 }
74
75 //////////////////////////////////////////////////////////////////////////
76 // Fields
77 //////////////////////////////////////////////////////////////////////////
78
79 readonly FType fparent // parent type
80 override Int flags // bitmask
81 Int nameIndex // name index
82 FAttr[] fattrs // meta-data attributes
83
84 }
2 // Copyright (c) 2006, Brian Frank and Andy Frank
3 // Licensed under the Academic Free License version 3.0
4 //
5 // History:
6 // 26 Dec 05 Brian Frank Creation
7 // 19 Aug 06 Brian Frank Ported from Java to Fan
8 //
9
10 **
11 ** FSlot is the read/write fcode representation of sys::Slot.
12 **
13 abstract class FSlot : CSlot, FConst
14 {
15
16 //////////////////////////////////////////////////////////////////////////
17 // Constructor
18 //////////////////////////////////////////////////////////////////////////
19
20 new make(FType fparent)
21 {
22 this.fparent = fparent
23 }
24
25 //////////////////////////////////////////////////////////////////////////
26 // CSlot
27 //////////////////////////////////////////////////////////////////////////
28
29 FPod pod() { return fparent.pod }
30 override CType parent() { return fparent }
31 override Str name() { return fparent.fpod.n(nameIndex) }
32 override Str qname() { return fparent.qname + "." + name }
33 override Str toStr() { return qname }
34
35 //////////////////////////////////////////////////////////////////////////
36 // IO
37 //////////////////////////////////////////////////////////////////////////
38
39 protected Void writeCommon(OutStream out)
40 {
41 out.writeI2(nameIndex)
42 out.writeI4(flags & FlagsMask)
43 }
44
45 protected Void readCommon(InStream in)
46 {
47 nameIndex = in.readU2
48 flags = in.readU4
49 }
50
51 protected Void writeAttrs(OutStream out)
52 {
53 if (fattrs == null)
54 {
55 out.writeI2(0)
56 }
57 else
58 {
59 out.writeI2(fattrs.size)
60 fattrs.each |FAttr a| { a.write(out) }
61 }
62 }
63
64 protected Void readAttrs(InStream in)
65 {
66 fattrs = FAttr[,]
67 size := in.readU2
68 if (size !== 0)
69 {
70 fattrs.capacity = size
71 size.times |,| { fattrs.add(FAttr.make.read(in)) }
72 }
73 }
74
75 //////////////////////////////////////////////////////////////////////////
76 // Fields
77 //////////////////////////////////////////////////////////////////////////
78
79 readonly FType fparent // parent type
80 override Int flags // bitmask
81 Int nameIndex // name index
82 FAttr[] fattrs // meta-data attributes
83
84 }