Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 html like tags
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
r0ssar00




PostPosted: Thu Nov 17, 2005 11:34 am   Post subject: html like tags

im trying to create a library to be able to more easily create human readable config files, and im basing it on xml, hence the name xmllib
im having a problem identifying the names inside the tags (ie <tag> where i need tag)
i created a function to handle this and it returns the name of the tag, but it will return <tag> not tag, heres my code
code:

fcn nameTag (raw : string) : string
    var name : string := raw
    var tag : = ""
    var firstSpace := 0
    for i : 1 .. length (name)
        if name (i) = ">" and firstSpace ~= 0 then
            tag := name (firstSpace + 1 .. i - 1)
        end if
        if name (i) = "<" then
            firstSpace := i
        end if
    end for
    result name
end nameTag

whats going on here? and how can i fix it? plz help, im writing this for a bigger project that really needs xml for easier config
Sponsor
Sponsor
Sponsor
sponsor
beard0




PostPosted: Thu Nov 17, 2005 11:41 am   Post subject: (No subject)

Okay, sorry, what are you trying to accomplish? Can you give an example input oputput pair? For starters though,
code:
var name : string := raw

Is the only line in which you assign anything to name, and you use name as your result, so your function right now is basically just f(x)=x.
Tony




PostPosted: Thu Nov 17, 2005 11:46 am   Post subject: (No subject)

did you also know that tag is a keyword?

if you just need to strip brakets
Turing:

fcn nameTag (raw : string) : string
    result raw (2 .. * -1)
end nameTag

put nameTag ("<test>")
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
r0ssar00




PostPosted: Thu Nov 24, 2005 8:08 am   Post subject: (No subject)

i didnt know that tag was a keyword, my bad
an example would be input: <help>, output: help
but it looks like ive already got a working fcn from Tony, thanks man

does anyone want to help me with this project?
when it is done, it would/could be an invaluable resource for programmers in turing
person




PostPosted: Thu Nov 24, 2005 5:09 pm   Post subject: (No subject)

Quote:
when it is done, it would/could be an invaluable resource for programmers in turing


what exactly are u trying to do??
r0ssar00




PostPosted: Fri Nov 25, 2005 11:42 am   Post subject: (No subject)

i am trying to make a library to use xml, i suggest you google xml to find out more about it you dont know what it is. its invaluable for configuration files.

i am planning to use it in a program of mone, which is a lot bigger than this, and when xmllib is done, ill open a new topic on that. but for now, all you will get on it is that it simplifies one of the more challenging and/or tedious parts of turing. its huge. and i need xml for it, not optional.

so i am asking the compsci community if we can collaborate on an invaluable library that can be used for anything you can think of. Game saves, configuration, dialog display, etc.

im attaching the source onto this post, its probably on the simpler side, but im using what i know, except for the nameTag function, that i got earlier in this thread, kudos to Tony for that. i havent had time to really look at it, but given some time, i could figure it out. the source is probably a little weird in that ive got a million different parameters for the procedures.

ive included some example procedures, and it also executes the procedures on run so you can see it happen, don't forget to change the filename to save to. the output _should_ look like this
code:

<test>
    <first>test string 1</first>
    <second>test string 2</second>
    <third>test string 3</third>
    <middle>
          <number1>testing string 1</number1>
          <number2>testing string 2</number2>
          <number3>testing string 3</number3>
    </middle>
</test>

I'm still having problems with that, the file only has up to </third> in it

If you want to sign on to this project, pm me with your experience level in turing. What have you done with it? What is your best program? Most useful?
pm me with stuff like that, and if you want to show me some of your code, go for it, put that in the pm too. I will use the same people for my next project, which will be bigger. I hope this will be better than the dTeam, was there a cTeam? I might even set up a cvs server, if i get enought replies



xmllib.t
 Description:
read support only, no write yet

Download
 Filename:  xmllib.t
 Filesize:  3.38 KB
 Downloaded:  88 Time(s)


xmllib.t
 Description:
main source file, only has xml write support, nothing can be read from xml yet.

Download
 Filename:  xmllib.t
 Filesize:  3.38 KB
 Downloaded:  80 Time(s)

r0ssar00




PostPosted: Sun Nov 27, 2005 10:38 am   Post subject: (No subject)

it wont let me edit my last post so i have to make a new one so dont get on my ass about it.
now comes the real conent of the post

I thought that we could create a program that would help everybody that programs using turing, i guess I was wrong. Ill just jave to write this on my own, and my big program too. Its gonna take a freaking long time and be hard as hell, but it will be rewarding in the end. I stil havent forgotten my original goal with my big program, it was going to help me with a program i'm writing for someone. It was going to make it so much easier to code certain areas
beard0




PostPosted: Sun Nov 27, 2005 10:53 am   Post subject: (No subject)

Wow, a little bitter.

So you know, no offence intended, the likely reason nobody jumped at the chance to work with you on this, is that if you plan to undertake a project of this magnitude, it's a little worriesome that you couldn't even figure out how to remove the "<>" from a tag. That's some pretty basic string manipulation, and string manipulation is what this project is going to be all about. People are probably worried that they would be carrying you through the project.
Sponsor
Sponsor
Sponsor
sponsor
do_pete




PostPosted: Mon Nov 28, 2005 2:38 pm   Post subject: (No subject)

And some people like me still might not understand what exactly you're doing
r0ssar00




PostPosted: Tue Nov 29, 2005 11:41 am   Post subject: (No subject)

sorry if i was bitter, it wasnt intentional

do you want to see some of my better programs?
i would have to dig them up, but my best one was lost when the school wiped the system over the summer
my other programs have been less about string maniuplation and more about other things, like GUI, paint,animations, and stuff like that.
my final project last year was kickass, and thats the one i lost
i want to learn more, ill take a look at the tut again. this project will be awsome. I already know some, i wrote a program for my dad that edits a script file it uses a lot of string manipulation. its still got some bugs, but it works for him, so im happy. ive had some experience.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: