[REBOL] System Port Trap Example
Here is a short script that uses the REBOL system-port to intercept "shutdown" types of interrupts from various operating systems. Why? For example, you would want to do this if you had a REBOL server process on Linux that has internal state. You may want the chance to write out information to files before quitting. This is the code you need to make it happen. The code below will detect both CTRL-C and REBOL ESCAPE key. enable-system-trap: does [ ; Trap OS interrupts if not system/ports/system [ if none? attempt [system/ports/system: open [scheme: 'system]][ print "NOTE: Missing System Port" exit ] ] if find get-modes system/ports/system 'system-modes 'signal [ set-modes system/ports/system [ signal: intersect get-modes system/ports/system 'signal-names [ sigquit sigterm sigint sighup ] ] ] system/console/break: 'signal append system/ports/wait-list system/ports/system ] check-system-trap: func [port /local msg] [ ; Process OS interrupts if not port? port [return none] if any [port/scheme <> 'system port <> system/ports/system][return port] if not system/ports/system [return none] while [msg: pick system/ports/system 1] [ if find [signal escape] msg/1 [ print ["System Trap:" msg] ; (save files here) quit ] ] none ] print "Starting..." enable-system-trap forever [ wake-port: wait 20 ; timeout period check-system-trap wake-port ] -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Introducing REBOL/Base - FAQ
For those of you who are interested in trying new REBOL kernels... here's something to test out. It's the Alpha release of REBOL/Base. Q: What is REBOL/Base? A: REBOL/Base is a reduction of REBOL/Core trimmed down to the essential native and mezzanine functions and schemes. All protocols, help information, and functions are stripped, but can be added back on an individual basis. Q: Why would REBOL Tech build such a thing? A: REBOL/Base is designed for developers who want to create minimal REBOL environments and precisely control what functions they initialize. For instance, if you only need SMTP or HTTP, why take the time and space to boot all the other protocols? Q: Why are we releasing an Alpha test version? A: The idea of a REBOL subset is new and contrary to our rule that REBOL executables must include everything. We want to see what developers think of this idea. Q: Does REBOL/Base startup faster? A: Yes, because it has fewer mezzanine functions and schemes, it starts faster (good for stuff like CGI, etc.). Q: Does it take less memory? A: Yes, if you RECYCLE after booting, then type STATS you'll see that it takes about 0.578 MB. Most of this space is used by internal buffers, function spec blocks, critical mezz functions, and the word table. The executable file is 235 KB. Q: Does /Base include graphics functions? A: No. But, there will be a similar version of REBOL/View (as of yet unnamed, got any ideas?). Q: How can I see what's in it? A: Open REBOL/Core and type SOURCE WHAT. Cut and paste it into the REBOL/Base console, and type WHAT. Q: Where do I get source code for the missing modules, such as the TCP protocols? A: Currently, you can obtain the source from other versions of REBOL, although that may not be optimal in many cases. Later this Fall (2002) we will be announcing another product to help answer this question. But, that's all we can say right now. Q: Can I create stand alone executables with it? A: No. For that you need to purchase REBOL/Encap that includes /Base. All developers who have purchased Encap within the last 6 months will receive a free upgrade, including several new tools and modules. Q: Does REBOL/Base have any other changes? A: Other changes are related to boot memory usage. In addition, the STATS function now accurately reports REBOL memory in use, and MOLD now has a /FLAT refinement that removes indentation (handy for smaller messaging and encapsulation). Q: Why does it boot with a version of 2.6.0? A: To keep existing scripts that check the version number from stopping. Q: Where can I download REBOL/Base? A: If you agree to abide by the /Core license, you can download the /Base Alpha version from http://www.reboltech.com/downloads/ If you do not agree, then do not download it. Q: Where do I report bugs? A: http://www.rebol.com/feedback.html - please make a note that you are using REBOL/Base. Submit any other questions to http://www.rebol.com/feedback.html. ### -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] List Glitches
We had minor glitch in this list server. Should be fine now, but keep your eyes open. -Carl -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] REBOL FAQ updated
The REBOL Language FAQ is alive again. Check it out at http://www.rebol.com/faq.html. Now that the FAQ is stored in REBOL format, it will get updated more often. -Carl -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: Sort in REBOL
Yes, sorry, I oversimplified it for the email... Normally the data would be such that you would use a /skip/all combination. You are correct. Here's a better example: data: [ abc ["name" 123] def ["fred" 345] ] sort/skip/compare/all data 2 func [a b] [a/2/1 < b/2/1] At 9/8/02 03:05 PM +0200, you wrote: >Hi > > > > 3) The /ALL refinement allows you to sort more complex data, > > > for example, by data fields within blocks: > > > > > >data: [ ["name" 123] ["fred" 345] ] > > >sort/compare/all data func [a b] [a/2 < b/2] > > > > > > Perhaps you already know all this... but, I figured, what the > > > heck... > > > > I did not and yes that's very cool. > >Or there is something i do not understand, or the Carl example is wrong (!). >I do not see here any difference in using ALL. >Like changes doc of Core 2.5 explains, ALL must be used with SKIP: > >"/all Used in combination with the /skip refinement. [NEW] By default only a >single field in a record is used for comparison. If the /all refinement is >used then all fields in a record are used for comparison." > >--- >Ciao >Romano > > > >-- >To unsubscribe from this list, please send an email to >[EMAIL PROTECTED] with "unsubscribe" in the >subject, without the quotes. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] More on PREBOL
More info on REBOL Preprocessor: http://www.rebol.com/docs/prebol.html -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Sort in REBOL
Noticed the thread on SORT, but I don't have time to read it all. A few notes: 1) SORT in recent versions of REBOL is much more reliable. It is also quite fast, but that depends on what you're sorting and the function you use for comparison. We use it all the time. 2) If you want a stable sort, return 1, -1, and 0 from a sort subfunction, rather than true and false. sort/compare data func [a b] [ if a < b [return 1] if a > b [return -1] 0 ] 3) The /ALL refinement allows you to sort more complex data, for example, by data fields within blocks: data: [ ["name" 123] ["fred" 345] ] sort/compare/all data func [a b] [a/2 < b/2] Perhaps you already know all this... but, I figured, what the heck... -Carl -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Re: encap and build.r
Ashley, We have a handy program that we use for building REBOL distributions. It's a sort of REBOL preprocessor. In addition to include files, it also allows you to write macro functions in REBOL. For instance, if you want to auto update your version number, it can do that. I'll take a few minutes out tomorrow to doc it, then post it here. I think we'll also include it in future releases of Encap, because it's a perfect match for that product. We use it all the time. -Carl At 8/30/02 12:21 PM +1000, you wrote: >The following script tries to take the hassle out of building an optimised >encap program. I had several goals / constraints in mind: > >1. My applications typically have a master script that issues a "do >%xxx.r" for each required "module". >2. I don't want to have to edit out these statements when running encap >(otherwise the generated executable will fail trying to find the underlying >source files). >3. I want to encap source that has all non-esential text (eg. comments, >redundant whitespace, etc) removed. >4. While the build script and encap reside in the same directory, the >file (and its modules, if any) probably reside in another directory. > >The following script was largely inspired / based on the work Carl did in >build-pack.r > > > >REBOL [] > >;Obtain files to build > >if none? attempt [build-file: request-file/only/title/filter "Select file to build" >"Open" ["*.r"]] [ > alert "Build file not specified." > quit >] > >path: first split-path build-file >header: first load/header build-file >if none? header/Needs [header/Needs: copy []] >insert tail header/Needs second split-path build-file > >;Merge source code > >code: make string! 128000 > >foreach file header/Needs [ > script: load/all path/:file > insert tail code mold/only skip script 2 ;skip REBOL header >] > >src-size: length? code > >;Generate compressed copy > >system/options/binary-base: 64 >code: compress trim/lines code >src-file: replace copy build-file %.r %.src >save/header src-file compose [do decompress (code)] compose/deep [Encap: [no-network >secure none title (header/Title)]] > >;Encap compressed file > >exe-file: replace copy build-file %.r %.exe >call reform ["rebolve1003.exe" src-file exe-file] >alert reform ["Compressed" src-size "bytes to" length? code "bytes."] > > > >The following scripts outline the practical implementation of this: > > >REBOL [ > Title: "Build Test" > Needs: [%a.r %b.r %c.r] >] > >if not none? attempt [system/script/header/Needs] [ > foreach script system/script/header/Needs [do script] >] > >wait 2 > > > >REBOL [] > >print "A" > > > >REBOL [] > >print "B" > > > >REBOL [] > >print "C" > > >Running build-test.r and build-test.exe should yield the exact same >results. I have successfully used this on a fairly complex 148K app with no >issues to date (all of two days that is ;) ). > >A good approach or not? (I was toying with the idea of further reducing the >source size by tokensing user-defined words, but the cost / benefit didn't >seem justified). > > >Regards, > > Ashley > >*Privacy, Confidentiality & Liability Notice > >This email is intended for the named recipient only. The information >contained in this message may be confidential, or commercially sensitive. >If you are not the intended recipient you must not reproduce or distribute >any part of this email, disclose its contents to any other party, or take >any action in reliance on it. If you have received this email in error, >please contact the sender immediately. Please delete this message from >your computer. > >You must scan this email and any attached files for viruses. > >The company accepts no liability for any loss, damage or consequence, >whether caused by our own negligence or not, resulting directly or >indirectly from the use of any attached files. > >Any views expressed in this Communication are those of the individual >sender, except where the sender specifically states them to be the views of >the Company. > >** > > >-- >To unsubscribe from this list, please send an email to >[EMAIL PROTECTED] with "unsubscribe" in the >subject, without the quotes. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] Core Guide Update - Minor Changes
The REBOL/Core Guide at http://www.rebol.com/docs/core23/rebolcore.html has had some minor changes, including eliminating bad links and adding newer version change docs to the table of contents. Also, Chapter 6 and 11 have been converted and reformatted with makedoc.r. I would very much appreciate it if someone could look over these chapters for formatting errors. It's hard to catch them all. Email me directly if you find something. Thanks. -Carl REBOL Guy PS: Appendix 1 conversion still pending. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] About REBOL OSX...
Regarding REBOL on OSX: Yes! We are very interested in supporting OSX better! Problem is, we need more information from someone who is an OSX developer (with regard to how to upgrade our developer release and tools.) During our office move back in Jan, we lost track of the OSX developer information. If you can help, please contact me directly. Thanks, -Carl REBOL Founder -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] REBOL/Core 2.5.3 Released
A new REBOL/Core has been released for testing purposes. Check out the list of changes and find out where to get it at: http://www.reboltech.com/downloads/changes.html Some of the changes include: MAKE-DIR Rewritten New Bitset Functions: CLEAR, LENGTH?, EMPTY? Changes to SKIP Function ARRAYs Initialized with Block Values Added PARSE BREAK Word Fix to OPEN on Network Ports Fixed Crash on Modified Functions Unset Object Variables (on Exit) Added BUILD-MARKUP Function Revised BUILD-TAG Function Revised DECODE-CGI Function and more... Some of the changes to functions like BUILD-TAG might be worth discussing... because the old function was pretty bad, and the new one is not that compatible with it (if anyone was in fact using the old one.) Let me know what you think. There's more to do, but we didn't want to hold up some of the nicer changes to wait for everything. Newer versions of /View, /Command, /Encap, /Link, and /Serve will be made available soon. -Carl REBOL Guy -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
[REBOL] I've had it with email.
Hello fellow REBOLers, [flame: on] Email has become useless to me. After 24 years of email, I think I'm qualified say that the situation with spam has recently grown totally out of hand. Each month I add ever more email filters to keep my email useful. Currently, there are over 300 filters preprocessing my email. But, as you know from the REBOL web site, we think there are much better ways to communicate. Email reminds me of general delivery postal mail. Anyone can send email to anyone. Plus, it's not reliable, it's not secure, it's easy to spoof, viruses poison attachments, it's limited in power (e.g. compare with X-Internet here), and there's no way to stop the flood of spam. It has become a tedious chore to deal with email (those of you who run web sites or openly post your email address know what I mean). At this rate, I think email will be "dead" in a few years. In fact, let me go on record saying that. A venture capitalist recently commented that this was a bold statement... but just watch. You watch. I'm not saying email will go away permanently. I'm saying that we'll have much better ways to communicate. Those of you who've tried IOS have a good idea what I'm talking about. IOS has been a great learning experience. Now, after more than 18 months of using IOS, the future has become more clear. But, this is not intended to be an ad for IOS... [flame: off] So... my new email address can be found on the contacts page of the REBOL.com web site. And, as always, if you've got something important to say about REBOL or IOS, I'm always interested in hearing it. Contact me. -Carl The REBOL guy. -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.