View previous topic :: View next topic |
Author |
Message |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Wed Jul 08, 2009 10:59 pm Post subject: TinTin++ 1.99.7 (beta) |
|
|
In this beta I've changed the code to use sorted arrays instead of linked lists. The main advantage of this is that variables and functions can be looked up very quickly using a binary search.
The next thing I'm planning to do is to add support for nested associative arrays.
http://tintin.sourceforge.net/download/tintin-beta.tar.gz
Changes:
Code: |
llist.c Switched from linked lists to sorted arrays.
cursor.c Replaced #cursor echo with 'echo on' and 'echo off'
cursor.c Modifying the input buffer while tabbing will reset the
tab finder.
|
Feel free to give it a whirl and report any bugs. I'm also curious if there's a noticeable difference in performance. |
|
Back to top |
|
 |
reality3k
Joined: 11 Feb 2009 Posts: 48
|
Posted: Thu Jul 09, 2009 9:37 am Post subject: |
|
|
The priority checking for an action seems messed up.
Code: |
#action {test me} {#show caught 2} {10}
#OK. {test me} NOW TRIGGERS {#show caught 2} @ {10}.
#action {test} {#show caught 1}
#OK. {test} NOW TRIGGERS {#show caught 1} @ {5}.
#showme test me
caught 2
test me |
It -seems- like it always does the first one unless the priority is set identical. This behavior is different than 1.99.6. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Thu Jul 09, 2009 4:14 pm Post subject: |
|
|
It was comparing strings rather than integers. Should be fixed in the newly uploaded beta, and thanks for testing!
The new beta allows the following:
#var bla[4] 6
#var bli[$bla[4]] hello
#showme $bli[6]
Not the most useful thing. More to follow. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Sun Jul 12, 2009 1:33 am Post subject: |
|
|
I uploaded a new beta which supports nested variables.
Changes:
1. ${+1} now references the first variable, ${+2} the second, etc. ${-1} can be used to reference the last variable. This is mainly useful for nested variables.
2. Uninitialized nested variables now return 0. This change has backward compatibility issues.
3. Added nested variables with behavior similar to associative arrays. For example: #var $bla[this][that] 1
4. Accessing a variable that contains a nesting will print all indices for that variable. #showme $bla[this] would print: {that}{1}
5. Added basic support for nested variables to the #list command.
6. $var[1] $var[2] support for #list variables no longer works.
Example:
Code: |
#var bla[bli] 1
#var bla[blo] 1
#var bla[blu] 1
#showme $bla
#showme $bla[bli]
#showme $bla[-1]
#var bli[bla][blo] 2
#showme $bli[bla][blo]
#showme $bli[1][1]
|
Last edited by Scandum on Sun Aug 02, 2009 2:10 pm; edited 1 time in total |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Sun Jul 12, 2009 11:58 pm Post subject: |
|
|
Code: |
data.c Sorting numeric variables as integers instead of as strings.
text.c Fixed crash bug in word wrap code.
net.c Fixed double action triggering on prompts in split mode.
|
|
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Mon Jul 13, 2009 10:38 am Post subject: |
|
|
Code: |
math.c Fixed crash bug with #math.
list.c Added list srt and ins support for nested list variables.
|
|
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Tue Jul 14, 2009 11:26 pm Post subject: |
|
|
I added #switch, #case, and #default which work more or less the same as the C equivalent.
Example:
Code: |
#switch {1d4}
{
#case 1 #showme 1;
#case 2 #showme 2;
#default #showme default
}
|
|
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Thu Jul 16, 2009 12:02 am Post subject: |
|
|
Added MAP EXIT ROOM event.
Accessing a nested variables by their index now requires using a + before the index number.
So $bla[+1] would print the first nested variable inside $bla, and $bla[1] would print the variable named 1 inside $bla.
Also fixed a sorting issue. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Thu Jul 16, 2009 1:07 pm Post subject: |
|
|
Fixed a bug with #write not saving aliases and actions.
Added the #while command to the script tokenizer and added #break and #continue to work with it. They work pretty much the same way as in C. Keep in mind that using #break is currently not required when using #switch, this because each #case automatically acts like it has a #break included.
Keep in mind that #break and #continue won't work with #loop or #forall, they will in the future though.
Fixed a bug with #read. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Fri Jul 17, 2009 10:11 am Post subject: |
|
|
Added #loop to the script tokenizer. Due to the peculiar way tintin worked in the past I had to change its behavior however. The new syntax is:
#loop {<min>} {<max>} {<var>} {commands}
For example:
Code: |
#loop 0 4 cnt1
{
#loop 5 9 cnt2
{
#showme The count is $cnt1 and $cnt2
}
}
|
Last edited by Scandum on Fri Jul 24, 2009 7:35 pm; edited 1 time in total |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Fri Jul 17, 2009 11:18 pm Post subject: |
|
|
Added #else and #elseif statements to the script tokenizer.
Example:
Code: |
#debug alias on
#alias {blu}
{
#loop {1 cnt 4}
{
#if {1 == $cnt}
{
#nop 1
};
#elseif {2 == $cnt}
{
#nop 2
};
#elseif {3 == $cnt}
{
#nop 3
};
#else
{
#nop 4
}
}
}
|
Old school else and elseif still work, but this looks nicer. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Sat Jul 18, 2009 11:32 pm Post subject: |
|
|
Using &<variable name> will report the variable's index number.
For example:
Code: |
#var bla[w] 1;
#var bla[x] 3;
#var bla[y] 5;
#showme Test &bla[v] &bla[w] &bla[x] &bla[y] &bla[z]
|
Will print:
Test 0 1 2 3 0
It's now possible to directly assign nested variables:
#var bla {{w}{1}{x}{3}{y}{5}}
Notice variables are assigned as pairs of braces. To see the full nesting you'd use: #showme $bla which would print {{w}{1}{x}{3}{y}{5}}. To only see the first level of nesting you'd use: #showme $bla[] which would print {w}{x}{y}
Also added support for calcalutions within braces:
Code: |
#var bla {{w}{1}{x}{3}{y}{5}}
#showme Test $bla[+1] $bla[+1+1]
|
Will print: Test 1 3
Notice that $bla[1] would return 0 because there is no nested variable with the name 1. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Sun Jul 19, 2009 11:25 pm Post subject: |
|
|
#read and #write now work properly with nested variables.
Updated #list to work with the latest nesting code. Still have to remove old #list support.
#kill now takes an optional second argument, for example: #kill alias bla* which is the same as #unalias bla* |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Mon Jul 20, 2009 12:19 pm Post subject: |
|
|
No longer stripping spaces in verbatim mode.
Fixed up #list support to work fully (and only) with nested variables.
Old #list code may work, though parsing lists is more involved now.
Example:
Code: |
#list test ins -1 a
#list test ins -1 b
#list test ins -1 c
#forall {$test[]}
{
#showme $test[&0]
}
#nop or alternatively:
#loop {1} {&test[]} {cnt}
{
#showme $test[$cnt]
}
#nop or alternatively:
#foreach {$test[]} {temp}
{
#showme $test[$temp]
}
|
Last edited by Scandum on Sun Aug 02, 2009 2:16 pm; edited 2 times in total |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Fri Jul 24, 2009 7:34 pm Post subject: |
|
|
1) For now I've settled on changing the #loop syntax to:
Code: |
#loop {min} {max} {variable} {commands}
|
This seems to be most in line with generic tintin syntax, for example:
Code: |
#loop 1 10 cnt #showme $cnt
|
2) The argument list of #format and #echo are no longer nested, this probably requires many scripts to be updated, but like with loop this is more in line with the generic tintin syntax.
Old syntax:
Code: | #format temp {%+20s %+20s} {{hello} {world}} |
New syntax:
Code: | #format temp {%+20s %+20s} {hello} {world} |
3) Now only showing nested variables that do not exist as 0 so tintin doesn't behave oddly when editing mobprogs. For example:
Code: |
#showme $bla[1]
$bla[1]
#var bla {}
#showme $bla[1]
0
|
|
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Sun Jul 26, 2009 12:09 pm Post subject: |
|
|
1) Added #write support for #loop and #foreach.
2) Added #foreach {list} {variable} {commands}
This is the replacement for #forall and you can use #break and #continue within it. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Mon Jul 27, 2009 8:54 am Post subject: |
|
|
1) Renamed #replacestring to #replace
2) All commands now use tintin regular expressions. Instead of * and ? use %* and %? - for perfect matches uses ^string$.
This change also affects the #regexp and #if commands.
3) #parse syntax is now: #parse {string} {variable} {commands} and can be interupted by the #break #continue and #return command.
These changes should be the last major ones for this beta. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Sat Aug 01, 2009 10:49 pm Post subject: |
|
|
Improved verbatim behavior. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Sun Aug 02, 2009 11:45 pm Post subject: |
|
|
Updated help files and fixed a bug with #elseif parsing and session switching.
Things seem to be fairly stable at the moment. |
|
Back to top |
|
 |
titeuf
Joined: 29 Jul 2006 Posts: 84
|
Posted: Tue Aug 04, 2009 11:45 am Post subject: |
|
|
This is just a small thing, but list fnd doesn't work with empty lists:
Code: |
#list afflictions clr
#list afflictions fnd test test
#LIST FND: {afflictions} is not a list.
|
Shouldn't it just return 0 then instead? |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Tue Aug 04, 2009 12:27 pm Post subject: |
|
|
Yeah, definitely needs to return 0. Fixed this for both the fnd and get option. Also fixed nested #break handling and an issue with variable handling for #loop #foreach and #parse.
I've updated the beta file, as I try to do with each update post in this topic.
To check if a variable exists use:
#if {&{variable}} {#showme exists}
This will work for both nested and unnested variables. To check if an unnested variable exists you can use: #if {"$variable" == "%.variable"} since "?variable" is no longer valid. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Tue Aug 04, 2009 5:23 pm Post subject: |
|
|
Nested variables defined in the startup session are now inherited by new sessions. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Wed Aug 05, 2009 10:57 am Post subject: |
|
|
Lists in #map get exits {variable}, #script {var} {shell command}, and #format {variable} {%w} {string}, now create proper nested lists.
Triggers that don't contain a %0-%99 argument properly handle paranthesis () within braces(). As in: #act {Bubba {(stands|sits) (on a chair)} here} will assign %3 to 'on a chair'. |
|
Back to top |
|
 |
titeuf
Joined: 29 Jul 2006 Posts: 84
|
Posted: Wed Aug 05, 2009 12:30 pm Post subject: |
|
|
Code: | $wget "http://tintin.sourceforge.net/download/tintin-beta.tar.gz"
--2009-08-05 19:29:00-- http://tintin.sourceforge.net/download/tintin-beta.tar.gz
Resolving tintin.sourceforge.net... 216.34.181.96
Connecting to tintin.sourceforge.net|216.34.181.96|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2009-08-05 19:29:01 ERROR 403: Forbidden.
|
Latest upload messed it up? Or just a temporary sourceforge problem? |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Wed Aug 05, 2009 12:51 pm Post subject: |
|
|
My mistake, should be downloadable now. |
|
Back to top |
|
 |
Shaiith
Joined: 11 Jul 2009 Posts: 64
|
Posted: Thu Aug 13, 2009 7:48 pm Post subject: |
|
|
Quick question, is 1.99.7 beta more advanced than 1.99.6b2 ? I'm assuming the latter is a stepping stone to this codebase. |
|
Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3844
|
Posted: Thu Aug 13, 2009 8:11 pm Post subject: |
|
|
The file at http://tintin.sourceforge.net/download/tintin-beta.tar.gz is generally the most advanced version when there's active beta testing, and it's what I typically refer to as the 1.99.7 beta.
1.99.6b2 is an official beta release of the 1.99.7 beta. |
|
Back to top |
|
 |
|