RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic Goto page Previous  1, 2 
View previous topic - View next topic  
Author Message
tunginobi
Wandering Minstrel


Joined: 13 Dec 2005
Posts: 91

PostPosted: Fri Feb 24, 2006 11:58 am    Post subject: [quote]

I know I'm hardly going to sway you, but FreeBASIC has pointers and access to pointers using offsets.

Pointer intro
Pointers, data types and memory
Using linked lists

C++ is still cool.
Back to top  
cha0s
Egg-Sucking Troll Humper


Joined: 16 Dec 2003
Posts: 37
Location: This cramped little box.

PostPosted: Fri Feb 24, 2006 10:55 pm    Post subject: [quote]

if you want to learn how to do some xml handling, just look at ll source in sf.net CVS

http://sourceforge.net/projects/lynn


Code:
Function parse_xml( p As uByte Ptr, i As Integer = 0 ) As xml_type Ptr

  Dim As Integer c
  Dim As xml_type Ptr this_tag
 
 
  this_tag = CAllocate( Len( xml_type ) )

  this_tag->key = tag_inside( @p[c], c )
 
  c += 1 '' ">"

  Do

    eat_space( @p[c], c )
   
 
    If p[c] = Asc( "<" ) Then
 

      c += 1
      If p[c] = Asc( "/" ) Then
        '' tag end!!

        Scope: Dim As String g_string: g_string = tag_inside( @p[c], c ): End Scope
        c += 1
        '' eat the closing tag
       
        '' increment data ptr location
        i += c
       
        '' return the tag info built until now
        Return this_tag
     
      Else
        '' tag within a tag

        this_tag->list = list_append( this_tag->list, parse_xml( @p[c], c ) )
       
      End If
     
    ElseIf p[c] = Asc( "/" ) Then
      c += 1
      If p[c] = Asc( "/" ) Then
        c += 1
        Scope: Dim As String g_string: g_string = tag_inside( @p[c], c ): End Scope
       
      End If


    Else
     
      '' we got this tags value

      push( @( this_tag->list ), tag_inside( @p[c], c ) )
      this_tag->eol = -1
     
    End If

  Loop 
 

End Function



mmm, recursive parsing. thats right ladies and gentlemen, fb is here to stay.

oh and before someones like 'that won't even compile' i'm not gonna post like 500+ line of functions so you can see how it works, go to the CVS, lol
_________________
Are you guys *sure* I should do this, man?

-Half Baked
Back to top  
Post new topic Reply to topic Page 2 of 2 All times are GMT
Goto page Previous  1, 2 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum