Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Multi-threaded console apps

Name: Anonymous 2008-04-19 17:57

What's the best way to do something like an IRC client where there's messages coming from the network you'll want to display without interrupting the user's input.

I'm using a toy language (MzScheme), so I don't have easy access to some curses library or ptys or anything like that...

Any ideas, or should I just give up and write a curses wrapper?  Can GNU Readline do anything like this?

Name: Anonymous 2008-04-19 17:58

sage this shit

Name: Anonymous 2008-04-19 17:58

sage

Name: Anonymous 2008-04-19 17:58

Fuck you.

Name: Anonymous 2008-04-19 17:58

back to /b/, please

Name: Anonymous 2008-04-19 17:59

Name: Anonymous 2008-04-19 17:59

>>5
Forgot your sage.

Name: Anonymous 2008-04-19 18:02

Oh, I haven't read SICP, and I won't do it because I don't read programming books.

The reason I'm using Scheme... well, I started the app off with C, and wanted GNU Guile scripting but had some problems with threading, and thought I might just write it in Scheme instead :/

Name: Anonymous 2008-04-19 18:03

>>8
No. You are not welcome here. Gtfo.

Name: Anonymous 2008-04-19 18:04

>>8
No. You are not welcome here. Gtfo.

Name: Anonymous 2008-04-19 18:07

>>10
Hi, been a long time lurker on this board.. but I feel I have to speak out at this moment.

Never on The 4Chan Programming board have I seen someone be so horrible and with no provocation, utterly appalling.

that was uncalled for and just plain rude.

Name: Anonymous 2008-04-19 18:09

Name: Anonymous 2008-04-19 18:10

Funny you saged this thread so much while you all still reply to even worse threads without a sage.

Name: Anonymous 2008-04-19 18:11

>>12
I was considering Haskell, but I'd really like REPL during execution for this project.  Also, Haskell isn't very fun when it comes to bits and shit.  (Scheme isn't much better.)

Name: Anonymous 2008-04-19 18:12

>>11
Visit us on #sicp at EFnet and we can discuss your problem together. These heartless morons are useless.

Name: Anonymous 2008-04-19 18:15

>>2-7,9-11
A thread actually about programming, and you respond with sages and irrelevant memes. I don't care if I've been trolled, beet tolled or bean rolled, you suck.

Name: Anonymous 2008-04-19 18:20

>>16
Sage for whining

Name: Anonymous 2008-04-19 18:22

>>14
bits and shit
What is that?

I wrote a simple multithreaded IRC server in Haskell: http://monkeyboy.td.org.uit.no/~cin/code/hircd/

You can use hsplugins for a REPL. Or you could link to the greasespot Javascript library and script your IRC client with Javascript.

But, if you really want to use Scheme, threading and networking is easy, I've also written an IRCd in Scheme, too. Finding an ncurses wrapper would be your biggest issue. If you can't find one, you can probably write a simple ncurses wrapper library in C and control it from Scheme in a more high-level fashion.

Name: Anonymous 2008-04-19 18:23

you could have two threads per irc connection: one for reading
the input and one for reading the output

mzscheme is a decent scheme interpreter, i wouldn't give up on
it just yet (it has a great helpdesk, mred might be relevant).
you could easily build a very extensible IRC client with
it. i'm dreaming of something like this right now:

ENTERPRISE SCHEME IRC CLIENT

/join #prog
/(eval-command (lookup "join") (list "#prog"))

hello
/(privmsg "#prog" "hello")
/(raw "PRIVMSG #prog :hello")

/(add-handler 'on-privmsg (lambda (source target msg) ...)

/(map (lambda (x)
        (if (not (eq? x (me)))
          (kick "#thread" x "GTFO")
          '()))
      (inhabitants "#thread"))


i admit it would be more [i]l33t[i] to run
it through a terminal, but this would involve a lot more work.
you can do this later, i'd start off with a small gui in mred
(especially if you don't have any experience with scheme).

Name: Anonymous 2008-04-19 18:23

>>17
rage for saging

Name: Anonymous 2008-04-19 18:24

Sage this shit. Why are you replying to this shit thread?

Name: Anonymous 2008-04-19 18:25

>>18
Or just use Python, which would give you a REPL, too.

Or use Chicken Scheme:

http://chicken.wiki.br/ncurses

http://chicken.wiki.br/irc

Name: Anonymous 2008-04-19 18:25

>>21
Seconded

Name: Anonymous 2008-04-19 18:26

Sage

Name: Anonymous 2008-04-19 18:27

>>21,23
Go away. You should be able to ignore it if it bothers you, being so busy making interesting and stimulating discussions elsewhere.

Name: Anonymous 2008-04-19 18:28

>>18
bits and shit
What is that?
Well, first I have to decompress the Huffman-compressed packets I receive, then I have to find the correct bytes in the packets and flip the byte order (but not in all cases).

As for the input issue... it seems readline can do this somehow, but it'll require some hacking, at least creating a custom output port I think.

http://tiswww.case.edu/php/chet/readline/readline.html#SEC35

Name: Anonymous 2008-04-19 18:29

>>19
You could do that purely from a REPL inside DrScheme.

Name: Anonymous 2008-04-19 18:32

>>26
You should use STM. Is the REPL that important? Haskell's HsPlugins could provide that. Using STM would do the operations atomically, meaning you could use one input port after all.

Name: Anonymous 2008-04-19 18:47

>>28
Not only do I want a REPL for easy hacking, I also want easy scripting.  Haskell isn't Desktop-ready yet.

Name: Anonymous 2008-04-19 18:50

you don't have to multithread an irc client, everything sent from the irc-server is line for line, even stuff in other channels, you just put it in the correct channel buffer by looking at which channel it belongs to PRIVMSG #channel

Name: Anonymous 2008-04-19 18:55

>>30
multiple servers

Name: Anonymous 2008-04-19 18:57

>>31
man select

Name: Anonymous 2008-04-19 19:34

>>32
maybe I don't want to use select. maybe I like threads

Name: Anonymous 2008-04-19 19:38

>>33
Now you have two problems

Name: Anonymous 2008-04-19 19:44

>>34
Now you  have     to  follow this   with    your     mouse to REVEAL my answer: _    __________I HAVE BEEN TROLLING YOU AND THE SUSSMAN ALL ALONG

Name: Anonymous 2008-04-19 19:57

>>35
No I don't. All your spoilers are revealed for I use w3m.

Name: Anonymous 2008-04-19 20:03

>>36
YOU ARE A BARE-FACED LIAR and I am using a pocket calculator that I made into a LISP Machinetm.

Name: Anonymous 2008-04-19 20:20

>>35
All I have to do is highlight the text and it's revealed. Alternatively, since I'm using the Opera browser (www.opera.com) I can disable stylesheets and I can see your text.

www.opera.com

Name: Anonymous 2008-04-19 20:23

>>38
All I have to do is highlight the text and it's revealed.
THANKS FER THE TIP I NEVER REALIZZARD ~IT PROBABLY DUSNT WORK IN MY BROWSER OR ANYTHING1

1 www.getfirefox.com

Name: Anonymous 2008-04-19 20:25

>>39
I regret to inform you but you are using an inferior browser.

www.opera.com

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List