ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* CSV parser fails when header is disabled
@ 2017-12-23 13:32 Wolfgang Schuster
  2017-12-24 11:37 ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2017-12-23 13:32 UTC (permalink / raw)
  To: mailing users

Hi,

the rfc4180splitter function from util-prs.lua returns a empty table
when the option to turn the first line into a header is disabled.


The following example from the source


%%%% begin example
\starttext

\startluacode

local mycsvsplitter = utilities.parsers.rfc4180splitter()

local crap = [[
"first","second","third","fourth"
"1","2","3","4"
"a","b","c","d"
"foo","bar""baz","boogie","xyzzy"
]]

local list, names = mycsvsplitter(crap,true)   inspect(list) inspect(names)
local list, names = mycsvsplitter(crap)        inspect(list) inspect(names)

\stopluacode

\stoptext
%%%% end example


returns these tables:


%%%% begin result
table={
  { "1", "2", "3", "4" },
  { "a", "b", "c", "d" },
  { "foo", "bar\"baz", "boogie", "xyzzy" },
}
table={
  "first",
  "second",
  "third",
  "fourth",
}
table={
}
nil
%%%% end result


Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CSV parser fails when header is disabled
  2017-12-23 13:32 CSV parser fails when header is disabled Wolfgang Schuster
@ 2017-12-24 11:37 ` Hans Hagen
  2017-12-26 20:19   ` Can I use lua 5.3 with external dynamic libraries? Jorge Manuel
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2017-12-24 11:37 UTC (permalink / raw)
  To: ntg-context

On 12/23/2017 2:32 PM, Wolfgang Schuster wrote:

> the rfc4180splitter function from util-prs.lua returns a empty table
> when the option to turn the first line into a header is disabled.
fixed in next beta


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Can I use lua 5.3 with external dynamic libraries?
  2017-12-24 11:37 ` Hans Hagen
@ 2017-12-26 20:19   ` Jorge Manuel
  2017-12-27  9:31     ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Jorge Manuel @ 2017-12-26 20:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Dear Sirs

Recently I moved to High Sierra with lua version 5.3.

I make a dynamic library from GSL and Swig the I call meurandist.so

I do:

swig -lua meurandist.i
gcc -I/usr/include/lua -c meurandist_wrap.c -o meurandist_wrap.o
gcc -c meurandist.c -o meurandist.o
gcc -fpic -bundle -undefined dynamic_lookup -llua -lgsl -lgslcblas -lm -Wall -I/usr/local/include -L/usr/local/lib meurandist_wrap.o meurandist.o -o meurandist.so

In my old machine all I need to do for call this library are  

"sudo cp randist.so /usr/local/lib/lua/5.2”

And then 

\startluacode
require "meurandist"
ARRAY_SIZE=100
arr=meurandist.new_int(ARRAY_SIZE)
meurandist.rpoisson(arr,ARRAY_SIZE,4)
for i=0,ARRAY_SIZE-1 do
        context(" "..meurandist.int_getitem(arr,i)..",")
  end
\stopluacode

Works nicely. 

But now I don’t have lua 5.2 installed. I have copied my dynamic library in the lua5.3 tree and that works fine if I call them from the console, but not works if all call inside a context document.

Did I need to install lua 5.2? Is it mandatary? Is there a another way to call c libraries?

Thanks a lot and have a luck year.

Jorge



___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can I use lua 5.3 with external dynamic libraries?
  2017-12-26 20:19   ` Can I use lua 5.3 with external dynamic libraries? Jorge Manuel
@ 2017-12-27  9:31     ` Hans Hagen
  2017-12-27  9:59       ` Jorge Manuel
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2017-12-27  9:31 UTC (permalink / raw)
  To: ntg-context

On 12/26/2017 9:19 PM, Jorge Manuel wrote:
> 
> Dear Sirs
> 
> Recently I moved to High Sierra with lua version 5.3.
> 
> I make a dynamic library from GSL and Swig the I call meurandist.so
> 
> I do:
> 
> swig -lua meurandist.i
> gcc -I/usr/include/lua -c meurandist_wrap.c -o meurandist_wrap.o
> gcc -c meurandist.c -o meurandist.o
> gcc -fpic -bundle -undefined dynamic_lookup -llua -lgsl -lgslcblas -lm -Wall -I/usr/local/include -L/usr/local/lib meurandist_wrap.o meurandist.o -o meurandist.so
> 
> In my old machine all I need to do for call this library are
> 
> "sudo cp randist.so /usr/local/lib/lua/5.2”
> 
> And then
> 
> \startluacode
> require "meurandist"
> ARRAY_SIZE=100
> arr=meurandist.new_int(ARRAY_SIZE)
> meurandist.rpoisson(arr,ARRAY_SIZE,4)
> for i=0,ARRAY_SIZE-1 do
>          context(" "..meurandist.int_getitem(arr,i)..",")
>    end
> \stopluacode
> 
> Works nicely.
> 
> But now I don’t have lua 5.2 installed. I have copied my dynamic library in the lua5.3 tree and that works fine if I call them from the console, but not works if all call inside a context document.
> 
> Did I need to install lua 5.2? Is it mandatary? Is there a another way to call c libraries?
> 
> Thanks a lot and have a luck year.
lua 5.3 has different 'number' internals so i think that 5.3 libs will 
not work with 5.2

anyway, you can probably best install lua 5.2 (otherwise, you also might 
need to adapt existing lua code to 5.3)

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can I use lua 5.3 with external dynamic libraries?
  2017-12-27  9:31     ` Hans Hagen
@ 2017-12-27  9:59       ` Jorge Manuel
  2017-12-27 10:09         ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Jorge Manuel @ 2017-12-27  9:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2862 bytes --]



> No dia 27/12/2017, às 09:31, Hans Hagen <pragma@wxs.nl> escreveu:
> 
> On 12/26/2017 9:19 PM, Jorge Manuel wrote:
>> Dear Sirs
>> Recently I moved to High Sierra with lua version 5.3.
>> I make a dynamic library from GSL and Swig the I call meurandist.so
>> I do:
>> swig -lua meurandist.i
>> gcc -I/usr/include/lua -c meurandist_wrap.c -o meurandist_wrap.o
>> gcc -c meurandist.c -o meurandist.o
>> gcc -fpic -bundle -undefined dynamic_lookup -llua -lgsl -lgslcblas -lm -Wall -I/usr/local/include -L/usr/local/lib meurandist_wrap.o meurandist.o -o meurandist.so
>> In my old machine all I need to do for call this library are
>> "sudo cp randist.so /usr/local/lib/lua/5.2”
>> And then
>> \startluacode
>> require "meurandist"
>> ARRAY_SIZE=100
>> arr=meurandist.new_int(ARRAY_SIZE)
>> meurandist.rpoisson(arr,ARRAY_SIZE,4)
>> for i=0,ARRAY_SIZE-1 do
>>         context(" "..meurandist.int_getitem(arr,i)..",")
>>   end
>> \stopluacode
>> Works nicely.
>> But now I don’t have lua 5.2 installed. I have copied my dynamic library in the lua5.3 tree and that works fine if I call them from the console, but not works if all call inside a context document.
>> Did I need to install lua 5.2? Is it mandatary? Is there a another way to call c libraries?
>> Thanks a lot and have a luck year.
> lua 5.3 has different 'number' internals so i think that 5.3 libs will not work with 5.2
> 
> anyway, you can probably best install lua 5.2 (otherwise, you also might need to adapt existing lua code to 5.3)
> 
> Hans




My library works fine with lua 5.3, but I don’t know to fix that inside ConTeXT tree. Install lua 5.2 is the best and easy way.





Thanks a lot

Jorge

> 
> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>       tel: 038 477 53 69 | www.pragma-ade.nl <http://www.pragma-ade.nl/> | www.pragma-pod.nl <http://www.pragma-pod.nl/>
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / http://www.ntg.nl/mailman/listinfo/ntg-context <http://www.ntg.nl/mailman/listinfo/ntg-context>
> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / http://context.aanhet.net <http://context.aanhet.net/>
> archive  : https://bitbucket.org/phg/context-mirror/commits/ <https://bitbucket.org/phg/context-mirror/commits/>
> wiki     : http://contextgarden.net <http://contextgarden.net/>
> ___________________________________________________________________________________


[-- Attachment #1.2.1: Type: text/html, Size: 19975 bytes --]

[-- Attachment #1.2.2: Descargas_—_lua_—_108×46.png --]
[-- Type: image/png, Size: 15671 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can I use lua 5.3 with external dynamic libraries?
  2017-12-27  9:59       ` Jorge Manuel
@ 2017-12-27 10:09         ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2017-12-27 10:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jorge Manuel

On 12/27/2017 10:59 AM, Jorge Manuel wrote:

> My library works fine with lua 5.3, but I don’t know to fix that inside 
> ConTeXT tree. Install lua 5.2 is the best and easy way.
beware of subtle differences:

4.0 vs 4

being printed (string.format in lua 5.3 is also more strict with int vs 
float)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-27 10:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-23 13:32 CSV parser fails when header is disabled Wolfgang Schuster
2017-12-24 11:37 ` Hans Hagen
2017-12-26 20:19   ` Can I use lua 5.3 with external dynamic libraries? Jorge Manuel
2017-12-27  9:31     ` Hans Hagen
2017-12-27  9:59       ` Jorge Manuel
2017-12-27 10:09         ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).