View previous topic :: View next topic |
Author |
Message |
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Jun 07, 2004 4:45 pm Post subject: Stripping the Implementation from the Interface |
|
|
I just committed some improvements to the strip.d file in the unDig repository. It still doesn't work perfectly, but it shouldn't choke on 'c' character literals or `someString` WYSIWYG strings.
I don't plan on making a .zip with it as the source file is self-contained and in case you just want a binary, I also added an .exe: strip.exe. |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Jun 07, 2004 4:57 pm Post subject: Re: Stripping the Implementation from the Interface |
|
|
jcc7 wrote: | I just committed some improvements to the strip.d file in the unDig repository. It still doesn't work perfectly, but it shouldn't choke on 'c' character literals or `someString` WYSIWYG strings.
I don't plan on making a .zip with it as the source file is self-contained and in case you just want a binary, I also added an .exe: strip.exe. |
I will certainly give strip.exe a whirl. Thanks JCC |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Jun 07, 2004 5:05 pm Post subject: |
|
|
Code: | module
mango.io.Uri;private
import
std.ctype;private
import
mango.io.Utils,mango.io.Buffer,mango.io.Exception,mango.io.DisplayWriter;private
import
mango.io.model.IWriter;extern(C)char*memchr(char*,char,uint);class
Uri:IWritable{const
int
InvalidPort=-1;private
int
port;private
char[]host,path,query,scheme,userinfo,fragment;private
ExtensibleString
decoded;private
static
char
map[256];private
static
short[char[]]genericSchemes;private
static
const
char[]hexDigits="0123456789abcdef";private
static
IOException
error;private
enum{ExcScheme=0x01,ExcAuthority=0x02,ExcPath=0x04,ExcQuery=0x08,IncUser=0x10,IncPath=0x20,IncQuery=0x40,IncScheme=0x80,IncGeneric=IncScheme|IncUser|IncPath|IncQuery};private
struct
SchemePort{char[]name;int
port;}private
static
const
SchemePort[]schemePorts=[{"coffee",80},{"file",InvalidPort},{"ftp",21},{"gopher",70},{"hnews",80},{"http",80},{"http-ng",80},{"https",443},{"imap",143},{"irc",194},{"ldap",389},{"news",119},{"nfs",2049},{"nntp",119},{"pop",110},{"prospero",1525},{"rwhois",4321},{"sip",InvalidPort},{"sips",InvalidPort},{"sipt",InvalidPort},{"sipu",InvalidPort},{"shttp",80},{"smtp",25},{"snews",563},{"telnet",23},{"vemmi",575},{"videotex",516},{"wais",210},{"whois",43},{"whois++",43},];;private
this();this(char[]uri);private
void
parse(char[]uri);private
void
parseAuthority(char[]auth);final
static
int
getDefaultPort(char[]scheme);char[]getScheme();char[]getHost();int
getPort();int
getValidPort();char[]getUserInfo();char[]getPath();char[]getQuery();char[]getFragment();bool
isGeneric();void
write(IWriter
writer);override
char[]toString();private
static
IBuffer
encode(IBuffer
buf,char[]s,int
flags);char[]decode(char[]s);}class
MutableUri:Uri{this();this(char[]uri);this(char[]scheme,char[]host,char[]path,char[]query);static
MutableUri
clone(Uri
uri);void
reset();MutableUri
parse(char[]uri);MutableUri
setScheme(char[]scheme);MutableUri
setHost(char[]host);MutableUri
setPort(int
port);MutableUri
setUserInfo(char[]userinfo);MutableUri
setQuery(char[]query);MutableUri
setPath(char[]path);MutableUri
setFragment(char[]fragment);}private
class
ExtensibleString{private
int
used;private
char[]string;this(int
size);void
reset();char*expand(int
size);char[]slice(int
size);} |
FYI
Looks like the CR is emitted in the wrong place ... also, notepad hates the output cos' it doesn't have CRLF sequences. Note that all the private stuff is output also ~ can that be inhibited?
- Kris |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Jun 07, 2004 5:23 pm Post subject: |
|
|
kris wrote: |
FYI
Looks like the CR is emitted in the wrong place | No one ever said it would be pretty. I think this may have been done on purpose (to save those precious characters), but I'll change it if I can figure out how.
kris wrote: | ... also, notepad hates the output cos' it doesn't have CRLF sequences. | Why are you using notepad? Also, I think it was done intentionally to save characters, but I'd like to change it, too. My first priority has been to get it to work.
Quote: | Note that all the private stuff is output also ~ can that be inhibited?
- Kris | Private stuff is being output? That's disappointing. This sounds like a significant issue, but it could be hard to fix. Does it at least still compile?
Thanks for bringing these issues up. |
|
Back to top |
|
|
Hohums
Joined: 08 Apr 2004 Posts: 71 Location: Western Australia
|
Posted: Mon Jun 07, 2004 7:58 pm Post subject: |
|
|
Just a wild suggestion. Kris, you want to help with fixing the code?
If so we'll get you access to the SVN upload. |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Jun 07, 2004 9:09 pm Post subject: |
|
|
Hohums wrote: | Just a wild suggestion. Kris, you want to help with fixing the code? |
You imagine I have the bandwidth?
I'd like to help, if mango wasn't sucking the leeches from me! Having said that, I vaguely wonder if effort in this arena might ultimately be better spent bringing doxygen up to snuff, and using that to spit out relevant declarations ~ just a though, and in no way detrimental to what you guys are doing with unDig.
Regardless; thanks for the invite ... |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Jun 07, 2004 10:28 pm Post subject: |
|
|
kris wrote: | Having said that, I vaguely wonder if effort in this arena might ultimately be better spent bringing doxygen up to snuff, and using that to spit out relevant declarations ~ just a though, and in no way detrimental to what you guys are doing with unDig. | You might be right. I've wondered what amount of effort it'd take to convert DMD front-end parser to D. Then we'd be playing with power...
I've been thinking about your requests. It might pretty easy to accomplish them (and one of my own goals, too):
Pre-processing
Convert r"someString" into `someString` (this seems like a good idea).
Post-processing
Develop a pretty-print type routine that:
change single LF's or single CR's into CRLF.
ensure there is a CRLF after each statement that ends with a ";". If I don't get side-tracked by something else I might give this a try. (I find easy tasks to be more fun than hard task. Call me lazy.) |
|
Back to top |
|
|
Hohums
Joined: 08 Apr 2004 Posts: 71 Location: Western Australia
|
Posted: Mon Jun 07, 2004 10:47 pm Post subject: |
|
|
kris wrote: | Hohums wrote: | Just a wild suggestion. Kris, you want to help with fixing the code? |
and in no way detrimental to what you guys are doing with unDig.
Regardless; thanks for the invite ... |
Don't worry about it. I don't think any of the undig group are that keen on undig, we are just support it out of necessity. undig is moving at a snales pace. We just add/fix bits and pieces as we need them. Its just that dig covers so many useful areas that we never have time to redo properly and we don't want to reinvent the wheel.
It's kinda like an antique vase that Walter keeps bumping over all the time, and we keep puting it back together again with sticky tape and glue. After all dig must have some heritage value being one of the first full libs written in d. |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Jun 07, 2004 11:11 pm Post subject: |
|
|
jcc7 wrote: | I've wondered what amount of effort it'd take to convert DMD front-end parser to D. Then we'd be playing with power... |
Sure would, and ultimately (one would imagine) the right way to go for filtering source ... |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Mon Jun 07, 2004 11:17 pm Post subject: |
|
|
Hohums wrote: | It's kinda like an antique vase that Walter keeps bumping over all the time, and we keep puting it back together again with sticky tape and glue. |
Pardon the indulgence but, given the relative stages of pre-release development, that's rather poetic. Nice one |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Jun 07, 2004 11:57 pm Post subject: |
|
|
Hohums wrote: | Don't worry about it. I don't think any of the undig group are that keen on undig, ... | Sadly, I think that's accurate. There's a lot of interesting features in dig, but I don't really want to invest the time to really improve the whole thing.
Hohums wrote: | It's kinda like an antique vase that Walter keeps bumping over all the time, and we keep puting it back together again with sticky tape and glue. After all dig must have some heritage value being one of the first full libs written in d. | That's a great description. |
|
Back to top |
|
|
|
|
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
|