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

DSP 0.1 - Beta

 
Post new topic   Reply to topic     Forum Index -> DSP
View previous topic :: View next topic  
Author Message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Sun May 15, 2005 5:41 pm    Post subject: DSP 0.1 - Beta Reply with quote

I'm proud to announce that DSP is finally in an early beta state. The download, dsp-0.1b.zip is the current source-set complete with buildable sources.

What's working:

- Runtime servlet generation and re-generation
- Active caching of servlet dll's
- Baseline DSP tag set (inline and code tags only) based on a new pure-D XML engine
- Fuly XML-configurable testbed mango server

What's not working:

- Documentation
- Implementing the rest of the DSP tags per the specification, which is currently in progress and hence offline.
- Bindings for other servers
- DSP conformance suite (features three servlets for now)
- "Build" support
- Unix/Posix support (this software has not been tested outside windows)
- More flexible configuration options, such as the location of dmd.
- Sandboxed runtime: dsp code sections currently give 100? access to dmd and phobos. You've been warned.

Dependencies:

- To build the testbed server you will need mango and the latest version of "build". Also you'll need DMD v120 or later.
- The testbed server at runtime expects a mango.lib to be in the dmd library path. It also expects "dmd" itself to be on the system path.
- Any given application directory needs the temp and cache subfolders present, as specified in the application config.xml.

How to use:

As this is beta software, the use of the source and test server are somewhat less than ideal. If you have any questions installing this software, please contact me at ericanderton@yahoo.com for assistance.

Download the dsp-0.1b.zip and unpackage in a fresh directory like "/dev/dsp". Run the dspruntime.bat file, to create the needed .obj files in the /runtime directory. Use build to build server.d, and the DSP conformance suite dspconf.d.

Once you complete these steps, you'll need to review the app.xml file and change the 'path' attribute to the absolute path for the /dspconf directory. One such path has already been provided.

After that, run server.exe. The default configuration (server.xml) will listen to "http://localhost:8080". The dspconf application is configured (app.xml) to the "/foo/bar/" path beneath that. Simply try loading "http://localhost:8080/foo/bar/dsp01.dsp" and you'll see the test case run.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Sun May 15, 2005 6:06 pm    Post subject: DSP Code - A Crash Course Reply with quote

DSP Code - A Crash Course

DSP files are flat-text files that have the extension .dsp. The internal strucutre of the file, while not strictly XML, does need to be well-formed markup if any is present. Because of this, all HTML must appear as XHTML in order to pass muster as being XML compatible. Almost all browsers can handle XHTML output, and you'll find that using DSP in this fashion will lead to cleaner servlet scripts as a result.

The basic rule of thumb is: anything not a DSP tag will be passed through to the servlet output, while anything else must be valid D code.

Tags

Beta 1 presently supports the following tags anywhere in a dsp source file:

Code:
<?dsp  code  ?>
<?dsp:in  COW in code  ?>
<?dsp:out  COW out code  ?>
<?dsp:body  COW body code, same as plain 'dsp'  ?>
<?dsp:output  plain text to output  ?>
<?dsp:xml  passed to the client as an <?xml ... ?>  ?>


In order to allow DSP to be fully XML-compliant when authoring, the following tags, while redundant with the earlier set, are provided:

Code:
<dsp:in>  COW in code  </dsp:in>
<dsp:out>  COW out code  </dsp:out >
<dsp:body>  COW body code  </dsp:body>
<dsp:code>  COW body code  </dsp:code>



Using Tags

The only major gotchas with working in dsp is the use of comparison operators that contain the '<' and '>' symbols. In order to avoid problems with parsing, it's a good idea to use either a CDATA section or the standard subsitution entities (&lt; and &gt;).

Code:
<dsp:code><[CDATA[ int a; if(a<4){} ]]></dsp:code>
<dsp:code> int a; if(a &lt; 4){} </dsp:code>



Inline Expressions

DSP also provides a way to generate output for attributes and text-content by way of the '#' operator. Any sequence of characters between a pair of '#' symbols will be treated as code 'x' that will satisfy the expression 'toString(x)'

Code:
<?dsp char[] myclass="header"; ?>
<div class='#myclass#' />


The expression '#myclass#' will be converted to 'toString(myclass)', which should output <div class='header'/> in the client output. Any combination of plain text and escaped text can be used, and will be concatenated into the output. Also, the expression '##' will evaluate to a single '#'.

Code:
<div class='foo_#myclass#bar##'/>

... will yield ...
Code:
<div class='foo_headerbar#' />

.... in the client output.

Exclamation ColdFusion programmers will find this very familiar. The only major difference between this and CF is that the expression must stay completely within the attribute text. Also, one cannot use this syntax to generate tag names or attribute names dynamically (this limitation will be covered in later versions of DSP).


Comments

XML comments are consumed by the DSP runtime and not sent to the client by default. You can use the inline statment operator '#' to begin your comment, and thus force a comment to emit to the client.

Code:
<!-- this won't show -->
<!--# this will -->



Mango

Since the servlet is a mango servlet, the following are at your disposal in any dsp servlet:

ServletResponseresponse;
ServletRequest request;
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
h3r3tic



Joined: 30 Mar 2004
Posts: 261
Location: Torun, Poland

PostPosted: Mon May 16, 2005 12:28 pm    Post subject: Reply with quote

I'm sorry I don't have much time to play around with DSP... Anyways, Great job !!! It compiles and runs fine on my machine Very Happy A few notes though:

1. Neither app.xml nor server.xml are in the archive, I had to grab 'em from SVN

2. On my system, DSP compiles only with DMD.120, it complains a bit with later versions.

3. Can't <[CDATA[ ... ]]> be implicit ? When I write:

for (int x = 0; x < 20; ++x)

DSP complains about:
(2,454) - unexpected token (expected '=' not '+')

When I replace < with &lt; DMD complains:

c:\h3\dsp\_temp\dsp01.d(92): found 'lt' when expecting ';' following 'for condition' c:\h3\dsp\_temp\dsp01.d(92): found ';' when expecting ')' c:\h3\dsp\_temp\dsp01.d(92): found ')' when expecting ';' following 'statement'

With CDATA, it's just perfect Smile Can something be done so that CDATA is default/implicit ?

Keep up the great work ! I'd just love to use DSP in my future web projects, even if I'm not posting anything on this forum, I'm closely watching the progress you're making Smile

Now I just need VIM to highlight DSP Wink
Back to top
View user's profile Send private message MSN Messenger
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Mon May 16, 2005 1:31 pm    Post subject: Reply with quote

h3r3tic wrote:
I'm sorry I don't have much time to play around with DSP... Anyways, Great job !!! It compiles and runs fine on my machine Very Happy A few notes though:

1. Neither app.xml nor server.xml are in the archive, I had to grab 'em from SVN

Embarassed - I'll fix this soon.

Quote:

2. On my system, DSP compiles only with DMD.120, it complains a bit with later versions.


Embarassed - An artifiact of my current setup, I'll check things against the latest DMD.

Quote:

3. Can't <[CDATA[ ... ]]> be implicit ? When I write:

for (int x = 0; x < 20; ++x)

DSP complains about:
(2,454) - unexpected token (expected '=' not '+')

When I replace < with &lt; DMD complains:

c:\h3\dsp\_temp\dsp01.d(92): found 'lt' when expecting ';' following 'for condition' c:\h3\dsp\_temp\dsp01.d(92): found ';' when expecting ')' c:\h3\dsp\_temp\dsp01.d(92): found ')' when expecting ';' following 'statement'

With CDATA, it's just perfect Smile Can something be done so that CDATA is default/implicit ?


As for CDATA not being implicit - this is an artifact of backing an XML parser. In effect, DSP code *is* XML code. There are other limitations as well, such as tag names and attributes being invalid for inline expressions.

Earlier renditions of DSP weren't XML based, but suffered from various flaws. I've learned a great deal about parser construction since then, so I may come around to using a non-XML parser again. The problem is: every time I muck with the parser, all hell breaks loose as its the heart of the entire application.

For now, I'd like to consider the current set of warts "good enough" until I work the remaining kinks out of the servlet generator and complete the core tag library. A better parser is really back-burner at this point. Sad


Now, the fact that &lt; and &gt; are not allowed is an outright bug; the default XML consumer operation is to replace XML entities with... themselves. This will be fixed shortly.

Quote:

Keep up the great work ! I'd just love to use DSP in my future web projects, even if I'm not posting anything on this forum, I'm closely watching the progress you're making Smile


Thank you for the compliments. And I understand where you're coming from: I want to use it on my projects too!

Quote:
Now I just need VIM to highlight DSP Wink


Hrm, I didn't think about user-editing. I guess I'll have to publish a cheat-sheet for this.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
antonio



Joined: 23 Aug 2005
Posts: 10

PostPosted: Tue Aug 23, 2005 3:34 pm    Post subject: Re: DSP 0.1 - Beta Reply with quote

Only one question:

Why a dsp document must be XML compliant?


ex: in PHP you can write somethink like
Code:

<html>
  <body>
    <p<?php echo ">this is "?>a paragraph</p>
  </body>
</html>


HTTP protocol is not HTML: in fact, HTTP can transfer images and other non XML based things... and this things must be producing with dsp too.

in fact, the "things" that are out of the <?dsp ... ?> are "something" with not real structure.

really: I think you don't need a XML parser for dsp code... it is introducing an erroneous, restrictive and inneficient constraint.

what you think?
Antonio
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Wed Aug 24, 2005 7:37 am    Post subject: Re: DSP 0.1 - Beta Reply with quote

Antonio, thank you for taking the time to provide feedback on my project. Smile

antonio wrote:

really: I think you don't need a XML parser for dsp code... it is introducing an erroneous, restrictive and inneficient constraint.

what you think?
Antonio


I agree.

Intially, I wanted something that would be less restrictive, but I found my earlier forays into parser design to yield less than desireable results. I took a tangent into XML parsing, as I've had some success with using EXPAT/PHP to host a DSP-like language. So I back-ported my experience to DSP.

Using an XML parser accelerated development of the current beta; but as you (and others) have pointed out, that's a rather arbitrary gain. It has irritated me to no end that something as simple as the 'selected' attribute of a <option> tag would be difficult to implement because of XML's constraints. Others have also brought up problems with needing to use <[CDATA[..]]> to write code, which is equally bad.

Ultimately, I will rewrite the parser to be less restrictive, and more accepting to non XML-compliant code. However, I still want to keep in place constructs and rules that ensure that DSP can be rendered as valid XML, if the developer desires it.

Also, with respect to emitting things non HTML, I've kept that in scope. You can use a single <dsp:code>...</dsp:code> to work with the response object to emit an image or binary file. As DSP matures, I hope to have in place a framework library that will make such chores a little easier to accomplish.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DSP 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