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
<beneroth> razzy, type is a list of classes, while class is a single symbol (complying to the structure expected from a class symbol, so not every symbol is a class but every class is a symbol following a certain structure)
<beneroth> order of classes in a type matters. last/most right class is kinda the most significant class, the "base class", while the classes in front/left of it are called "prefix classes", they prefix/decorate the base class
<beneroth> so (rel foo (+String)) is declaring a relation for property 'foo with type (+String)
<beneroth> and in (rel foo (+Ref +String)) the +Ref is a prefix class, altering the behavior so that whenever 'foo gets set with a value, a non-unique index is automatically maintained
<beneroth> and in (rel bar (+List +String)) the +List is a prefix class altering the behavior so you can have multiple +String values stored in the property 'bar
beneroth has quit [Quit: Leaving]
<razzy> Good morning to all!
<razzy> Regenaxer: I want to have search-able number representing "strength" of a +Joint. I do not know good way of doing it. (rel outs (+List +Ref +Number +Joint) ins (+Nr)) was my guess.
<razzy>
aw- has joined #picolisp
<Regenaxer> Good morning!
<Regenaxer> razzy, a +Number relation handles a number, and a +Joint handles a Symbolic value (another external symbol)
<Regenaxer> So you need two separate values (= properties)
<Regenaxer> You can use two separate relations, or a +Bag relation with several values
<Regenaxer> But: A +Joint does not work well in a +Bag (due to its automatisms) and is not recommended
<Regenaxer> +Link is ok in +Bag
<Regenaxer> after all, a +Joint is nothing more than two +Link's
<razzy> Regenaxer: Thank you. I missed +Bag.
Hunar has joined #picolisp
beneroth has joined #picolisp
v_m_v has joined #picolisp
<Hunar> Hello :D   .. Regenaxer, three days ago you said (Normally structures are passed by pointer), so I thought nobody (other than me) will think otherwise .. but it turns out that aloot of math libraries do, when passing vectors and matrices :(  .. BUT I had faith in myself and started trying raylib library using native as an initial step to make a
<Hunar> pil binding for it :) , everything went fine, and with minimal effort I got the simple hello world from their website and it worked :)   https://pastebin.com/dfys4tHM
<Hunar> BUUUT raylib uses a struct of (unsigned char r,g,b,a) for colors, and all the functions that need a color expect a Color struct by value, so the code above creates the window background and the text with random colors each time I run it.. I searched alot yesterday to see how people passed struct by value to a function when using libffi,   here
<Hunar> Most of it went over my head, but I think you can find it useful,  the only thing I understood it that:    I have to create a pointer  (setq P (%@ "malloc" 'P 4)) fill it (struct P NIL 255 255 255 255) dereference the pointer and pass that to native (which I don't know if I can right now) then free the pointer.. to pass the dereferenced pointer
<Hunar> I edited @src/lib.c ,   at line 611 there is   ffi_call(&p->cif, p->fun, &rc, ptr);  I changed ptr to *ptr with an ugly hack that lets me chose when to use one or the other .. It kinda worked, except it only passed 2 items to the function when I tried it with a custom struct that had 4 integers.
<Hunar> I really hope you can help me, or maybe extend pil a little bit to allow passing struct by value, or you have another workaround for this issue, because I DO NOT want the end user to download a custom .so , I want my binding to be a single picolisp file
<Regenaxer> OK, four color bytes bytes can easily be passed as a "structure", it is simply a 32-bit number :)
<Regenaxer> Or do you know of a case where *real* structures are copied?
<Hunar> Unfortunately i'm like 60% familiar with the C langauge :)  how large of a struct is still counted as non*real* structures?
<Regenaxer> The link  https://pastebin.com/dfys4tHM is dead?
v_m_v has quit [Remote host closed the connection]
<Regenaxer> A real structure is allocated in memory
<Regenaxer> (stack or heap)
<Hunar> it's not dead for me, i'll try another website
<Regenaxer> up to 64 bits fit in a number, so it is n worth the pointer
<Regenaxer> I can't access
<Regenaxer> ah, now it works!
<Hunar> too late :)
<Hunar> so what is the workaround for me :D
<Regenaxer> yes, better :)
<Regenaxer> at least faster
<Regenaxer> Let me read your long stuff above
<Regenaxer> too much on a single blow :)
<Regenaxer> Do I have to read all?
<Hunar> I tried reducing the code repetition but had another issue, that would be my next question :)
<Hunar> (native "libraylib.so" "ClearBackground" NIL '(NIL (4 (B . 4)) 245 245 245 255) )
<Hunar> this would be enough
<Regenaxer> I cannot judge unless I know the signatures of the library functions
<Hunar> One second
<Regenaxer> hmm
<Regenaxer> can you give me the "raw" code?
<Hunar> there is a raw button in github, I'll send it right now
<Regenaxer> found it!
<Regenaxer> ok, first is
<Regenaxer> RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
<Regenaxer> seems correct
<Regenaxer> SetTargetFPS also
<Regenaxer> WindowShouldClose does not return a byte
<Regenaxer> I think C functions never return a byte, at least an int
<Regenaxer> but we need bool
<Regenaxer> I think 'I is better than 'A
<Regenaxer> 'B I mean
<Regenaxer> In any case, did (0= in the while loop work?
<Regenaxer> See? it says // Color, 4 components, R8G8B8A8 (32bit)
<Regenaxer> so you need to pass an int
<Regenaxer> With (4 (B . 4)) native creates a struct on the stack and passes a *pointer* to the function
<Hunar> Sorry, some office work interrupted me
<Regenaxer> np
<Regenaxer> so you need to pass (hex "FF00000000") for red
<Hunar> I thought an int is too large for a bool :)   so I chose a byte
<Hunar> (In any case, did (0= in the while loop work?) yes it did work
<Regenaxer> In C a boolean is usually a typedef to 'int'
<Hunar> (hex "FF00000000") that is actually much better
<Hunar> Oh, that's a waste of bytes :|
<Regenaxer> which one?
<Regenaxer> a waste
<Hunar>  typedef to 'int'
<Regenaxer> no, cause the machine uses words anyway
<Hunar> Ah, I see :)
<Regenaxer> when passing to or returning from functions
<Regenaxer> registers
<Regenaxer> If you want arrays of booleans, better use individual bits
<Regenaxer> masking
<Regenaxer> anyway, DrawText has the same Color issue
<Regenaxer> EndDrawing is no problem
<Regenaxer> So the only problems were Color values
<Hunar> yes, because only color had the (passing struct by value) problem.. should I come back everytime I encounter a new (passing struct by value)  problem :)  or there is a general workaround
<Regenaxer> I think you never find such a case
<Regenaxer> It is simply too inefficient for a C programmer
<Hunar> Great :)  thank you very much .. now I have a more mysterious (at least for me) problem
<Regenaxer> Good :)
<Hunar> Let me remember what I wrote at home, I think it was      (de raylib V (apply 'native (cons "libraylib.so" V)))    for shortening (native "libraylib.so" ...) to (raylib ...)  but it didn't work.. I'm sure it's a simple problem
<Regenaxer> '(de raylib V' do you really want a FEXPR ?
<Regenaxer> well, yes, makes sense
<Regenaxer> But I think this is not so useful
<Regenaxer> and apply and cons at runtime
<Regenaxer> better use varargs, to get normal evaluation
<Regenaxer> (de raylib @ (pass native "libraylib.so"))
<Regenaxer> that's all
<Hunar> Oh, I haven't encountered pass before :)  thanks
<Hunar> Final result is     http://ix.io/3Fxf    which is literally translated from this example    https://www.raylib.com/examples/core/loader.html?name=core_basic_window    .. The format of the color was the other way around, to make color RGBA you write (hex "AABBGGRR")
<Regenaxer> This is machine-dependent
<Regenaxer> little-endian on x86
<Hunar> Oh, glad you mentioned it :| so I need to get machine information in my binding, I'll cross that bridge when I at least see the river :D
<Regenaxer> ok :)
razzy has quit [Ping timeout: 268 seconds]
Hunar has quit [Quit: Client closed]
razzy has joined #picolisp
razzy has quit [Ping timeout: 256 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 268 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 256 seconds]
razzy has joined #picolisp
razzy has quit [Quit: leaving]
aw- has quit [Quit: Leaving.]
razzy has joined #picolisp
<Regenaxer> razzy, vip session at today's PilCon?
<razzy> Regenaxer: I am looking foward to it. any other plans?
<Regenaxer> I have a JavaScript problem. Want to see if anyone has an idea
<razzy> Regenaxer: maybe if time allows, I would like to learn your PilSrc workflow. maybe you are using asm debugger like gdb or lldb?
<Regenaxer> workflow ok, but a low-level debugger is quite useless
<Regenaxer> only after a crash, to see with backtrace *where* it happened
<razzy> maybe for you. I have disadvantage, i did not written the PilSrc code. I think i will benefit from seeing it run.
<Regenaxer> yes
<Regenaxer> gdb is meaningless unless you know exactly which register holds which Lisp values
<Regenaxer> Have you tried to understand pil21/src/picolisp.s ?
<Regenaxer> that's needed to do anything in gdb
<razzy> not really, it is for future work.
<Regenaxer> This is definitely no issue for PilCon I think
<Regenaxer> Try it please
<razzy> for record, I was thinking i could pair assembly code with PilSrc via inserted marks
<razzy> Vip is more beneficial now :]
<Regenaxer> T
<Regenaxer> I think gdb is not beneficial at all
<Regenaxer> Unless you really understand the low levels
<Regenaxer> I don't understand them now as llvm is in between
<tankf33der> hi all
<tankf33der> Regenaxer: https://envs.sh/E2E.l
<tankf33der> this is code from li
<tankf33der> this is code from @lib/simul.l
<Regenaxer> tankf33der, we are in PilCon
<tankf33der> why you make private X? And not other symbols?
<tankf33der> AAaa, ok.
<tankf33der> np
<beneroth> talking about vip and using different editors
<Regenaxer> tankf33der, I look later
clacke has quit [Remote host closed the connection]
<Regenaxer> tankf33der: X is private because it might be bound to itself
<Regenaxer> if it is somewhere in 'Lst'
beneroth has quit [Quit: Leaving]
razzy has quit [Ping timeout: 260 seconds]
alexshendi has joined #picolisp
<alexshendi> Good night.
<Regenaxer> Hi alexshendi!
<alexshendi> Hi Regenaxer, how are you? How is life?
<Regenaxer> Thanks! It is all OK so far :)
<alexshendi> Regenaxer: Do you still use a tablet with a custom keyboard for programming?
<Regenaxer> Not tablet, but a normal smartphone
<Regenaxer> since 3 years now
<Regenaxer> I developed all pil21 on that phone
<alexshendi> A phone? But with an external display and keyboard?
<Regenaxer> nope
<Regenaxer> just the phone
<Regenaxer> also this here I'm writing on that phone
<Regenaxer> A OnePlus 6T
<Regenaxer> If you had attende
<Regenaxer> d PilCon, you'd have seen
<alexshendi> I admire that! I have bought a Linux phone, but the display and the virtual keyboard proved too much for my elderly eyes and "Wurstfinger".
<Regenaxer> :)
<Regenaxer> luckily, my eyes are not too bad yet
<Regenaxer> though not as good as in young years
<alexshendi> I'm writing this on an Android phone too, tough....
<Regenaxer> good
<alexshendi> But you use the virtual keyboard of the phone?
<Regenaxer> no, not the normal one
<Regenaxer> this is indeed impossible to use for programming
<Regenaxer> I use PentiKeyboard
<alexshendi> Ah, ok.
<alexshendi> I have bought a Chromebook with an AZERTY (french) keyboard. I can't get used to it....
<Regenaxer> Can you not change the layout?
<alexshendi> Either US or german Keyboard is OK.
<Regenaxer> yes
<Regenaxer> but not possible?
<Regenaxer> in Chromebooks?
<alexshendi> It's a physical keyboard. I could of course tell ChromeOS that the layout is german, but then the labeling of the keys would be wrong. And that's a problem for me.
<Regenaxer> Ah, right!
<Regenaxer> When I still used normal keyboards years ago, I always used US layout no matter what the labls were
<Regenaxer> I typed blindly anyway
<alexshendi> I can't type blindly. I'm a lousy typist.
<Regenaxer> Now with Penti there is no such problem anyway
<Regenaxer> ok :)
<alexshendi> I would like to use pil more, but everything I do seems to require floating point.
<Regenaxer> you can do all with fixpoint I believe
<Regenaxer> needs more care though
<Regenaxer> What kinds of things are these?
<alexshendi> Floating point numbers are just cleverly scaled Integers anyway, simplifying greatly. What matters isst Hard ware support in the CPU.
<Regenaxer> yes, so in pil I call native C libs for such float stuff
<Regenaxer> so it goes into the hardware
<alexshendi> Basically reading stuff from result files from a FEM calculation. And then some calculations with the data. Nothing too complex, just some matrix algebra
<Regenaxer> cool
<alexshendi> The data is large. Matrix size is 150 000 by 150 000 with ca. 180 000 nonzero entries.
<Regenaxer> wow
<alexshendi> The picolisp approach would probably be to write it in C and call it via native...
<Regenaxer> yes, separate the hard-core calculations from the application logic
<alexshendi> Regenaxer: What is your preferred method of doing 2D graphics? I have found 3 alternatives. 1. Web Browser/HTML5 canvas, 2. Tcl/ Tk (photo widget) 3. VT340 terminal emulation 4. Something like gtk-server or etd.
<alexshendi> s/etd/ezd/
<Regenaxer> Currentl I do it in Canvas, and some things in SVG
<Regenaxer> Browser/HTML5 canvas
<Regenaxer> Getting sleepy
<Regenaxer> Good for today I think
<alexshendi> And how do you transfer data between the Browser and pil?
<Regenaxer> was a busy day
<Regenaxer> yes, using plio
<alexshendi> Yes, thank you for the chat. Good night. Sleep well.
<Regenaxer> Thanks!
<Regenaxer> you too! :)
<alexshendi> Tanks.
<alexshendi> Thanks.
<Regenaxer> Let's continue next time
<Regenaxer> :)
<alexshendi> Ok :)
alexshendi has quit [Quit: -a- IRC for Android 2.1.59]
razzy has joined #picolisp
fs has joined #picolisp
fs has quit [Quit: nyaa~]