Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Embedding in C

From: koopmans::itr::ing::nl at: 17-Sep-2001 12:59

Hi, See below a recipe for being able to call Rebol from C. I thought I'd forward it. Using libwww from it should be easily done. Any C hackers out there willing to do it? --Maarten ---------- Forwarded Message ---------- Hi Karl, Integrating it with C should not be that hard if you use no security: This is the rebol how-to for the Rugby message format, you can easily translate it into C. There are two flavors, one TCP, one HTTP; First, here is TCP: - You create a message: mold compress mold reduce [checksum/secure mold do mold msg msg] - You determine the length of the message, at most 99.999.999 bytes, filled with zeros (8byte fixed, i.e. 00023456) - You send the length, you send the message, and then at least one extra byte. The extra byte is to keep the server I/O engine running. The tricky parts here may be C equivalents of compress and checksum/secure. If you have a C lib to create HTTP requests using POST (and from the top of my head, they are available on, you are better of doing that. If you look at tunnel.r in the distribution you see how the http requests are created in 10 lines of Rebol code. This is what happens: - create a http post with two fields: 1) rugby-rq , you actual request, and 2) xtra-info , a fixed 18-byte field string. Corresponds to the extra byte when using TCP. - Field 1, rugby-rq , should have a content in the following format: [***[your-request-here]***] it is block wrapped in [*** and ***]. - Field 2, xtra-info may be filled with whatever you like, as long as it is at least 18 bytes. The built-in HTTP proxy knows how to parse these requests. As these requests are more easy to construct, you should be able to do this easily in C (this is in fact why the HTTP post format is kept "REBOL free"). If you do, please send me the code! It may be very useful for others as well.