Stefano,
Thanks for you feedback, (especially from a power user). If any of the
tests you are developing would be appropriate for including in the PEBL
test battery, please let me know and I'll see about trying to include
them.
For the file-name issue, you are in luck. I had the same concern, and for
0.14 I gave file streams a property called 'filename' that let's you
access the actual file name. so, for example,
Print("Opening tmp.dat for writing")
xFile <- FileOpenWrite("tmp.dat")
PrintProperties(xfile)
xfile2 <- FileOpenWrite("tmp.dat")
PrintProperties(xfile2)
Print(xfile.filename)
Print(xfile2.filename)
The output should look something like this:
Opening tmp.dat for writing
Non-fatal Warning in line 7 of file ./files.pbl:
File [tmp.dat] already exists. Using [tmp0.dat] instead
----------
[DIRECTION]: WRITE
[FILENAME]: tmp0.dat
....
You should be able to access the filename with xfile2.filename. I'm not
sure if this feature made it into the documentation though, so I'll put
that on my list of things to do.
In addition to this, you can always use FileOpenOverwrite(), which uses
exactly the filename you specify (i.e., if it is for temporary files or
something), and there is a new all-in-one function called GetNewDataFile()
that I use in all the test battery tests. It handles headers, file types,
re-use of subject codes and files for multiple sessions, separate
subdirectories for each subject data file, and re-asks if you try to
overwrite. This may handle some of your problems as well.
Now, for the Lookup function, I have used this throughout the test battery
for doing data recoding, and it is meant particularly for cases where you
know the cue is one of the looked-up items. For example, if you want to
recode '<lshift>' or '<rshift>' to "left" and "right". Even if it would
make sense to do, I'm reluctant to change how it works as I think it might
break things that would be hard to track down, especially if someone wants
to upgrade to a new version of PEBL but use the same .pbl scripts they
have before. But you can easily write a wrapper that does exactly what you
want, and below I have an example that I use in the launcher:
## a robust version of lookup:
define GetConfig(key, keys, database,empty)
{
line <- Lookup(key,keys,database)
if(Length(line)==0)
{
ret <- empty
}else{
ret <- Second(line)
}
return ret
}
If it is empty, it will return whatever you pass into the 'empty'
argument. If it is not empty, it returns the value of a paired list (you
might need to adapt this). I'm not sure what happens if it matches
multiple keys. I use this for setting default values in a parameter
lookup. You may be able to use this directly or adapt it a bit for your
needs.
Shane
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Pebl-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebl-list