FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Patch for XML, space in attributes

 
Post new topic   Reply to topic     Forum Index -> ArcLib
View previous topic :: View next topic  
Author Message
Brix



Joined: 28 Oct 2006
Posts: 21
Location: EU, Denmark, Lyngby.

PostPosted: Wed Feb 07, 2007 9:47 am    Post subject: Patch for XML, space in attributes Reply with quote

Hey
I've made a simple patch to the XML subsystem, so it is possible to use spaces in attributes.

The patch is somewhat hacky, but atleast not anymore than the code it complements. Wink

http://brix-verden.dk/d/xmlwhitespace.patch

- Brix
Back to top
View user's profile Send private message MSN Messenger
ChristianK



Joined: 26 Sep 2006
Posts: 159
Location: Berlin, Germany

PostPosted: Wed Feb 07, 2007 1:36 pm    Post subject: Reply with quote

Thanks for the patch! I'm not involved in arc's xml subsystem and tied up elsewhere at the moment, so I can't actually comment on it: I'm sure Clay will take a look at it once he's some time.

So, you're actively using Arc? Or just its XML components? Its always interesting to hear about these things!
Back to top
View user's profile Send private message
Brix



Joined: 28 Oct 2006
Posts: 21
Location: EU, Denmark, Lyngby.

PostPosted: Wed Feb 07, 2007 4:42 pm    Post subject: Reply with quote

I'm currently porting some of my projects (mostly games) and libraries from C++ with
ClanLib to D and ArcLib.

I chose Arc as it seemed like the game library that was put the most work in. Smile

The library i'm currently porting/rewritting is a simple GUI system, designed for fullscreen menus. Using XML for defining the menu, like this:
Code:

<image path="data/menu.jpg">
<area name="New Game" x="520" y="273" w="190" h="25" mouseover="data/menu-mo-newgame.jpg" clicked="data/menu-mo-newgame.jpg" />
<area name="Quit Game" x="520" y="357" w="190" h="25" mouseover="data/menu-mo-quitgame.jpg" clicked="data/menu-mo-quitgame.jpg" />
<keyinput name="Get name" x="76" y="505" w="195" h="25" textfont="data/kabel.ttf" textsize="16" textcolor="0,255,0" background="true" />
</image>

Right now, the library is able to do about the same as the C++ version, and the code is about half the size. Cool

- Brix
Back to top
View user's profile Send private message MSN Messenger
ChristianK



Joined: 26 Sep 2006
Posts: 159
Location: Berlin, Germany

PostPosted: Fri Feb 09, 2007 3:34 pm    Post subject: Reply with quote

Great to hear!

Are your game projects uploaded somewhere? I expect you're using Arc 0.1?
Back to top
View user's profile Send private message
Brix



Joined: 28 Oct 2006
Posts: 21
Location: EU, Denmark, Lyngby.

PostPosted: Fri Feb 09, 2007 4:02 pm    Post subject: Reply with quote

Some of my older projects is at my website http://brix-verden.dk (danish website).

The ones I'm currently porting hasn't been released yet.

I'm actually using trunk, as it seemed the easiest thing to do, I don't believe the Arc 0.1 release was D1.0 compatible.

- Brix
Back to top
View user's profile Send private message MSN Messenger
ChristianK



Joined: 26 Sep 2006
Posts: 159
Location: Berlin, Germany

PostPosted: Sat Feb 10, 2007 3:35 am    Post subject: Reply with quote

Quote:
I'm actually using trunk, as it seemed the easiest thing to do, I don't believe the Arc 0.1 release was D1.0 compatible.


Interesting! Are you using anything from arc.sprite? The code in arc.scenegraph is still a little rough around the edges, but I hope it'll eventually replace the sprite module. Still need to improve the ease-of-use though.

Just as a warning: while writing arc.examples.asteroids I've come across some shortcomings of arc.input and will do some cleaning and improving soonish: that'll possibly alter the public interface.

Also, I'm fixing and improving the physics system quite often; you don't use that yet, do you?
Back to top
View user's profile Send private message
Brix



Joined: 28 Oct 2006
Posts: 21
Location: EU, Denmark, Lyngby.

PostPosted: Sat Feb 10, 2007 6:16 am    Post subject: Reply with quote

Quote:
Interesting! Are you using anything from arc.sprite? The code in arc.scenegraph is still a little rough around the edges, but I hope it'll eventually replace the sprite module. Still need to improve the ease-of-use though.


Yes I'm using Sprite quite a few places. I haven't looked into scenegraph yet.

Quote:
Just as a warning: while writing arc.examples.asteroids I've come across some shortcomings of arc.input and will do some cleaning and improving soonish: that'll possibly alter the public interface.


Sure, no problem.

Quote:
Also, I'm fixing and improving the physics system quite often; you don't use that yet, do you?


Nope, and I don't have a real use for it in the games I'm porting, except maybe for particles.

- Brix
Back to top
View user's profile Send private message MSN Messenger
ChristianK



Joined: 26 Sep 2006
Posts: 159
Location: Berlin, Germany

PostPosted: Tue Feb 13, 2007 5:22 am    Post subject: Reply with quote

Back to the patch:

I only got a basic understanding of XML, but wouldn't it have sufficed to remove the \s from the attribute splitting regular expression, i.e. changing \"|=\"|\s to \"|=\"?

Would this work? Or does XML allow arbitrary spacing between attribute name and =?
Back to top
View user's profile Send private message
Brix



Joined: 28 Oct 2006
Posts: 21
Location: EU, Denmark, Lyngby.

PostPosted: Tue Feb 13, 2007 6:17 am    Post subject: Reply with quote

Quote:
I only got a basic understanding of XML, but wouldn't it have sufficed to remove the \s from the attribute splitting regular expression, i.e. changing \"|=\"|\s to \"|=\"?


I've just tried and it works well, at least with my test XML.

Quote:
Or does XML allow arbitrary spacing between attribute name and =?

I'm not sure. It just seemed right to patch up around the "cheap hack" instead. Wink

- Brix
Back to top
View user's profile Send private message MSN Messenger
ChristianK



Joined: 26 Sep 2006
Posts: 159
Location: Berlin, Germany

PostPosted: Tue Feb 13, 2007 6:34 am    Post subject: Reply with quote

Yeah, it just wasn't obvious to me why 'length > 4' would be the right thing to check for. I've looked at the XML specification and committed the change to _attribSplitRe.
Back to top
View user's profile Send private message
Brix



Joined: 28 Oct 2006
Posts: 21
Location: EU, Denmark, Lyngby.

PostPosted: Tue Feb 13, 2007 6:58 am    Post subject: Reply with quote

Okay, very good. Smile

- Brix
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> ArcLib All times are GMT - 6 Hours
Page 1 of 1

 
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


Powered by phpBB © 2001, 2005 phpBB Group