freenode/#ecl - IRC Chatlog
Search
14:00:18
d3j
hiyall. I just got my first embed of ECL to work, and now it lives at the root of my program. :-) I'm an experienced C++ programmer, but new to CL. I've read halfway through a lot of books, including CLTL, and done only the most basic experimenting at the REPL, so I'm a newb. I want to learn lisp from inside my own program, but I have a hurdle first
14:06:56
d3j
I'm in windows, however my program uses a custom gui. Currently I have a simple repl in a command window that I use for debugging but my program's gui runs in another window. I'm looking for a way to convert every result printed in the repl to a string representation. This seems like a problem that should be easy to solve in lisp, but as a newb, figuring out the right place to look for a similar example or the right macro
14:11:41
jackdaniel
so if you (format nil "~A" *) you should have its string representation returned
14:20:33
jackdaniel
also if you call eval from c/xx world then you have variant which outputs string I think
14:59:30
onion
d3j: can hijack the repl, but i was doing this myself yesterday, with ocaml and also with C. the builtin ECL toplevel uses "(si:toplevel t)" but i havent found where its defined yet =)
15:46:03
d3j
thanks. I've tried the (format nil "~A" (list 1 2 3)) approach and the string I'm getting out is always a length of 78 in unknown character types. is it maybe a wide char? example here: https://paste.ee/p/o4kAU
15:48:41
d3j
of course not (list 1 2 3) but lisp("(defun last-result-to-string () (format nil \"~A\" *))");
15:58:11
jackdaniel
d3j: you may be interested in this material: https://common-lisp.net/project/ecl/#orgheadline10
16:35:03
d3j
so the to_std_string function outlined in that material is just what I'm looking for, but luckily the most dense line in the function, which I don't really understand, is the one with a non standard call to typeof so I can't just cut and paste
17:29:10
d3j
I've got a commandline parser in my program for a simple internal language displayed with bitmapped fonts. I want to be able to extend what I've got to double as a repl when i use the internal command line to send lisp commands to ECL
17:31:23
onion
i am not sure what i am going to do for this yet, possibly just hook in to emacs all the way, although i need font rendering and text support for my case
17:33:14
d3j
yeah like a text field frame. I'm coming to this all round about, it's only when I realized that my program was a lot like emacs that I got into lisp.
17:34:07
d3j
alternately I was thinking of setting up ECL for swank and then connecting to the embed via slime in emacs, but I'd like to have an integrated solution with what I've already got
17:38:13
onion
there is also swank for javascript in the browser, which is interesting. i wonder if your program could basically "support swank" like slime of emacs, and get some free features and possibilities
17:41:51
d3j
imgui looks pretty nice... i didn't know about it before. what I'm doing is built in sdl2
17:52:18
jackdaniel
heh: "Big thank you to Omar Cornut (ocornut@github) for his imgui library and giving me the inspiration for this library..", yes, I guess it is similar
17:59:36
jackdaniel
I'm afraid to give you advice you will literally execute, because that may not work due to some silly thing
18:00:34
onion
jackdaniel: what are you saying, ECL objects per character? or doing his C bitmap rendering in CL... ?
18:01:50
d3j
I've already got it so if I have a string, I can convert it to a bitmapped rendering of the string
18:02:34
d3j
I want to display the repl in my main gui, and that starts with a c string that I can render
18:33:27
d3j
it almost seems like it would be more straight forward to write to files and then open from the C side
18:37:15
jackdaniel
you may use the very same operations on duplicated descriptors (you may even create FILE* pointers from it)
18:57:37
d3j
I'm having trouble following the ecl_stream documentation. I'll come back to this later. Thanks for all the help so far
19:06:58
d3j
I think in my context if I get what you are suggesting, to redirect the stdout in the C enviornment, then all my debugging that goes stdout will get sent to the repl display
19:07:34
d3j
but when I turn off debug, that wouldn't matter, and it might be helpful in the meantime anyway...