pbs-software / pbs-modelling

R package PBSmodelling - GUI tools made easy: interact with models and explore data
2 stars 1 forks source link

readList fails when importing large files in the PBSmodelling ("P") format #88

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
After loading the attached file and writing it to a text file in the 
PBSmodelling ("P") format, a subsequent call to readList fails:

--
testList <- readList("testList")
Parse error (testList:3) : Maximum string length exceeded
Error: Errors were found in the GUI description file. Unable to continue
--

I have not confirmed whether the file was written correctly by writeList.  
Simply increasing the buffer size does not appear to resolve the problem.

Original issue reported on code.google.com by nmbo...@gmail.com on 20 Jan 2013 at 10:42

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by nmbo...@gmail.com on 5 Feb 2013 at 7:22

haighr commented 1 year ago

The function 'readList' calls an R function '.getParamFromStr', which calls an R function '.convertParamStrToList', which calls a C function called 'strToList'. The latter craps out when a data object's header information is very large (e.g. rownames="1 2 ... 8640" in line 3 of a file created by 'writeList(testList, fname="fornow.txt", format="P")'). This call works if the string is reduced to 'rownames="1 2 ... 1040", but any more row labels beyond 1040 cause the program to issue the cryptic error message: 'Error: attempt to apply non-function', which is basically nonsense. The C function 'strToList' in 'parser.c' declares a maximum string size of 4*1024, which must be insufficient. The function might need dynamic memory allocation; however, NB (or someone who knows C-programming) will have to take a look at 'parser.c' to determine if this is feasible.