ID:1981868
 
Version 509 is on track for a stable release. The most recent beta went out yesterday, so I think the next build will see only a few minor fixes and will become the new stable release. Hooray!

This clears the path for 510. I've talked about some of the graphical improvements I want to put in. What I haven't mentioned yet is that I think this is a great time for some long-overdue text handling updates. These are procs I want to add in 510, and by "want to add" I mean "already wrote some untested code for":

  • findlasttext(haystack,needle,start,end): Find the last match in a string
  • findlasttextEx(haystack,needle,start,end): Same, but case-sensitive
  • spantext(str, chars): Find the longest span of characters from chars in str (equivalent to strspn)
  • nonspantext(str, chars): Find the longest span of characters not from chars in str (equivalent to strcspn)
  • splittext(str, delim, start, end, include): Split text into a list based on a set of delimiters, and optionally include the delimiters found too
  • jointext(list, joiner) OR list.Join(joiner): Join the elements of a list into a single string
These may help a lot of games that do a ton of text processing. Apparently this becomes a big issue for some of the huge games, like SS13, especially when they deal with admin stuff and logs.

I don't want to make any promises on this, but I also think the time has come to implement regular expressions. I can't say how full-featured this would be or even if it will truly go in at all, but I'd like it to. I haven't decided on all the specifics, but I did find a small, outdated regex library that I think I can adapt to be pretty useful.

(Why not adapt the library I already soft-coded in DM? First, I'm amazed I ever wrote the thing. Second, I no longer understand it because I was not so big on comments back in the day. Third, I suspect altering someone else's tried-and-true code will be much more fruitful.)

The logins for the webclient need a little love, and I need to do some web work soon to make the webclient grab more attention. Developers, if you're not testing with the webclient already, you should definitely start!

My birthday's coming up this week! If you want to join in the celebration, becoming a Member or donating to BYOND always works. (Sorry I won't have enough cake to go around. I only have three bits and I'm not expecting a rush.)

Don't forget, this is a great time of year to work on new projects or dust off old ones, so you have an excuse to get away from your relatives on Thanksgiving.
Whoo, keep it up Lummy!
Nice! Happy Early Birthday, hope you have a good one. Keep up the good work on BYOND!

Also, if I may ask, why not use C++11's std::regex? Is there any issue that would make it not easy to implement in BYOND? (Other than the compiler you're using doesn't yet support it)
Lummox JR wrote:
I don't want to make any promises on this, but I also think the time has come to implement regular expressions.

You can use this library and save yourself a lot of work?

http://www.byond.com/developer/Kuraudo/libregex

All you'd have to do is expose the functionality BYOND as official procs.

Or are DLL/SO's still isolated from the process somehow? Because from what I've read they have a lot of things in common.
omgomgomgomgomg :OOO
oh lawd.
splittext() has me feeling all warm and fuzzy inside. <3
In response to Kats
Kats wrote:
splittext() has me feeling all warm and fuzzy inside. <3

All of em make happeh q.q
I guess I'll have to learn regular expressions now.

And SQLite, and error handling, and color matrices, ...
Happy early birthday btw :D
"Three bits and wasn't expecting a rush"

Nice meme bro.
Lummox, just a protip, I might be doing some gentle nagging on some of the performance tweaks that have been brought up over the past year for you to work into 510 once 509 hits stable
Happy birthday, Lummox, whenever your birthday is!
As the owner of a text-based game that is heavily reliant on text processing, splittext() sounds like it will be a tremendous performance improvement over the existing libraries

I dont understand, however, the purpose of spantext(). What's that for?
It returns how many letters are in the string until it gets to a character in chars
Strange that it doesn't have a start/end arg though.
In response to Mista-mage123
Mista-mage123 wrote:
As the owner of a text-based game that is heavily reliant on text processing, splittext() sounds like it will be a tremendous performance improvement over the existing libraries

I dont understand, however, the purpose of spantext(). What's that for?

basically the same as strspn() in C and C++; it's useful when you're looking to see if a set of characters in a string match any of the characters in another string.
These guys at stackoverflow might be able to explain better:
http://stackoverflow.com/questions/372105/ whats-the-point-of-strspn
The most common use is to feed it text and numbers to find the longest grouping of numbers in a bit of text

var/i = spantext("aj082ha8h8902hn89qahq98q298h", "1234567890")


You can combine it with nonspantext to extract the longest number in a bit of text

proc/findnumber(var/text)
var/nums = "1234567890"
. = copytext(text, spantext(text, nums))
. = copytext(., 1, nonspantext(., nums))


(you could then add a loop and extract all numbers from a string without having to generate a lot of intermediate strings)

lum is mainly trying to implement standard C library strings operations that would trigger a lot of string table lookups to do otherwise.

This won't have too much benefit to most games, but those that could use it will be glad they have it compared to doing it otherwise.


And odds are it was 5 or 10 lines of code to add, since it most likely uses strspn internally.
Of note, text replacing would probably take the cake with the most string table pollution
In response to NullQuery
NullQuery wrote:
http://www.byond.com/developer/Kuraudo/libregex

Wow! That's a blast from the past. :) I was going to write about updating it from using Boost or TR1 of C++11, but after looking back at the code I guess I accounted for that already? Wonder if all of those preprocessor directives even work as they were intended? :)

Pokemonred200 wrote:
Also, if I may ask, why not use C++11's std::regex?

Seconded. It's been standard for 4 years, and I don't see any reason BYOND should limit itself to, I assume, C++98 for all of eternity. Are we trying to maintain backwards-compatibility with Windows 98? Otherwise I can't imagine any specific reason providing an interface between this standard library and DM should be a huge undertaking. I think modernizing the BYOND tools en masse is a vital strategy to BYOND's continued survival.
In response to Kuraudo
Kuraudo wrote:
NullQuery wrote:
http://www.byond.com/developer/Kuraudo/libregex

Wow! That's a blast from the past. :) I was going to write about updating it from using Boost or TR1 of C++11, but after looking back at the code I guess I accounted for that already? Wonder if all of those preprocessor directives even work as they were intended? :)

Pokemonred200 wrote:
Also, if I may ask, why not use C++11's std::regex?

Seconded. It's been standard for 4 years, and I don't see any reason BYOND should limit itself to, I assume, C++98 for all of eternity. Are we trying to maintain backwards-compatibility with Windows 98? Otherwise I can't imagine any specific reason providing an interface between this standard library and DM should be a huge undertaking. I think modernizing the BYOND tools en masse is a vital strategy to BYOND's continued survival.

Windows 98 isn't even supported anymore, considering they've updated the compiler quite some time ago. Now the earliest version they support, IIRC, is Windows XP.
Page: 1 2