Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Timothy2.bas
- 'Advanced "Vapor" associative array FreeBASIC source code 0x001
- '
- 'Created December 22nd 2009 - May 6th 2010 by T.R.Keal
- 'Modified June 15th 2013 by T.R.Keal
- 'Released under the Gnu Public License 2.0
- '
- 'Please review the Gnu Public License, Thank you.
- 'The GPL can be located online at http://www.gnu.org/copyleft/gpl.html
- const Vapor_IS_WRITTEN=1
- type Vapor_Node_Type
- written as unsigned long
- address as unsigned long
- end type
- type Vapor_Cell_Type
- leaf as Vapor_Node_Type
- parent as Vapor_Node_Type
- prior as Vapor_Node_Type
- latter as Vapor_Node_Type
- child(0 to 255) as Vapor_Node_Type
- length as unsigned long
- value as string
- end type
- sub Vapor_MkLeaf(byref tree() as Vapor_Cell, byval address as unsigned long, byref label as string, byref value as string, byval label_offset as unsigned integer)
- dim as byte temp=0
- if len(label)=0 then
- if (tree(address).leaf.written and Vapor_IS_WRITTEN)=Vapor_IS_WRITTEN then
- tree(address).value=value
- tree(address).length=len(value)
- elseif (((tree(address).leaf.written) xor Vapor_IS_WRITTEN) and Vapor_IS_WRITTEN)=Vapor_IS_WRITTEN then
- tree(address).leaf.written))=tree(address).leaf.written)) or Vapor_IS_WRITTEN
- tree(address).value=value
- tree(address).length=len(value)
- endif
- else
- temp=asc(left(label,label_offset+1))
- if (tree(address).child(temp).written and Vapor_IS_WRITTEN)=Vapor_IS_WRITTEN then
- Vapor_MkLeaf tree(), address, label, value, label_offset+1
- elseif (((tree(address).child(temp).written) xor Vapor_IS_WRITTEN) and Vapor_IS_WRITTEN)=Vapor_IS_WRITTEN then
- tree(address).child(temp).written=tree(address).child(temp).written or Vapor_IS_WRITTEN
- tree(address).child(temp).address=tree(address).child(temp).address=tree(0).leaf.address+1
- tree(address).child(temp).parent.written=(tree(address).child(temp).parent.written or Vapor_IS_WRITTEN)
- redim preserve tree(0 to tree(0).leaf.address+1)
- tree(address).child(temp).parent=address
- endif
- endif
- end sub
- redim as Vapor_Cell Tree()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement