beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
aw- has joined #picolisp
aw- has quit [Quit: Leaving.]
aw- has joined #picolisp
kuao has quit [Quit: Connection closed for inactivity]
Hunar has joined #picolisp
<Hunar> Regenaxer, おはよう;)     .. I looked at your example, but I don't want to print each line with pil :(  It would be very complicated for our job, files would run for days we don't want to have mis-typing accidents, we need to (have an input file, copy it to the script directly [now we don't need the original input file, we do everything
<Hunar> here], and replace what we want with the variables, then it create the exact same file with modified inputs) .. I made a bash script that does exactly what I want http://ix.io/3GeK I want to to exactly that but in pil, ignore the last line since it's very easy in pil .. can you replicate that bash script for me :)
<Regenaxer> おはよう Hunar :)
<Regenaxer> Why print each line#
<Regenaxer> ?
<Regenaxer> The example just echo the file, replacing patterns along the line
<Hunar> So I misunderstood:)  let me try
<Regenaxer> Look at (doc 'echo)
<Regenaxer> As 'echo' returns the found pattern, the 'case' can take care of replacements
<Hunar> Ah it worked:)  I'll write my example to see what issues i'll have
<Regenaxer> :)
<Regenaxer> BTW, there is another solution for the varargs calls
<Regenaxer> We can reset the cached ffi struct each time
<Regenaxer> and we must free it
<Regenaxer> http://ix.io/3GeO
<Hunar> Ok, one replacement worked, I tried using multiple replacements but failed, I haven't read (doc 'echo) yet  http://ix.io/3GeP
<Regenaxer> Wait, this is better: http://ix.io/3GeQ
<Regenaxer> hmm, why should multiple calls not work?
<Hunar> I'm sure i'm doing something wrong, it replaces it with nothing
<Regenaxer> It looks all right
<Regenaxer> Ah!
<Regenaxer> The printing is missing
<Regenaxer> (prin (case @
<Regenaxer> Can be any type of printing operation
<Hunar> AAh
<Hunar> That's great :D
<Hunar> The vararg solution is great :)  but i didn't understand this (%@ "free" NIL "printf")  it calls free on printf? I only saw free being used on pointers
<Regenaxer> yes
<Regenaxer> The symbol "printf" has the pointer to a ffi structure
<Hunar> :)  Thanks
<Regenaxer> no, a pointer to code
<Regenaxer> hmm
<Regenaxer> then the free is wrong
<Hunar> :/
<Regenaxer> wait
<Regenaxer> The symbol is set to the return value of (ffiPrep)
<Regenaxer> in src/lib.c
<Regenaxer> ffi *p = malloc(sizeof(ffi) + narg ...
<Regenaxer> and this pointer is returned
<Regenaxer> So we must free it, otherwise we have a memory leak
<Hunar> Was it always a memory leak? or only in this particular example
<Regenaxer> Normally it is not a leak, the structure is allocated and reused each time
<Regenaxer> This was the problem for varargs, as the structure may change
<Regenaxer> Even better would be to allocate a new struct each time it is called with another number of args
<Hunar> I see :)
<Regenaxer> It is a leak if you reload the lib many times
<Regenaxer> i.e. if the symbol "printf" gets out of scope and garbage collected
razzy has joined #picolisp
<Hunar> quick question, how to exit      :(echo) without ctrl-d      when using (in "file" (echo)) it reaches EOF and stops, passing NIL doesn't work .. however It has no uses i think :)
<Regenaxer> Just : (echo) ?
<Hunar> yes
<Regenaxer> This echoes the current input channel
<Regenaxer> Why?
<Hunar> No reason :)
<Regenaxer> The normal way is ^C
<Regenaxer> get a debug break
<Regenaxer> then ^D
<Hunar> Ah, ok :)
<Regenaxer> But just ^D is good
<Hunar> I thought I could pass EOF myself
<Hunar> but it doesn't make sense
<Regenaxer> There is no EOF char in Unix
<Regenaxer> ^D is handled as end of file by some parts
<Regenaxer> eg readline()
<Hunar> Aha, i see now
<Regenaxer> you can define ^D with stty
<Regenaxer> $ stty -a shows it
razzy has quit [Ping timeout: 260 seconds]
razzy has joined #picolisp
Hunar has quit [Quit: Client closed]
clacke has joined #picolisp
razzy has quit [Ping timeout: 245 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 260 seconds]
razzy has joined #picolisp
aw- has quit [Quit: Leaving.]
razzy has quit [Ping timeout: 260 seconds]
razzy has joined #picolisp
<Regenaxer> Hi razzy! I cleaned and updated the Vip article in the Wiki
<Regenaxer> ttps://picolisp.com/wiki?vip
<Regenaxer> I hope I did not forget too many features
razzy has quit [Ping timeout: 240 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 240 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 240 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 260 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 268 seconds]
razzy has joined #picolisp
<razzy> Regenaxer: thank you for notice. I am reading wiki/?vip and i am finding it helfull.
razzy has quit [Ping timeout: 250 seconds]
razzy has joined #picolisp