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

Standardised patches

 [1/9] from: AJMartin::orcon::net::nz at: 24-Dec-2003 22:46


Brett wrote (in another thread):
> Ah good. I'll add it to my patches.r and send it to feedback.
I think it's a good idea to reveal and combine the best patches that people have accumulated so far. I've put my in after my .sig. Let's mutate and evolve them! :) Andrew J Martin Speaking in tongues and performing miracles. ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/ -><- [ Rebol [ Name: 'Patches Title: "Patches" File: %"Patches.r" Author: "A J Martin" Owner: "Aztecnology" Rights: "Copyright 2003 A J Martin, Aztecnology." eMail: [Rebol--orcon--net--nz] Web: http://www.rebol.it/Valley/ Tabs: 4 Purpose: "Various patches to Rebol." Language: 'English Date: 11/August/2003 Version: 1.4.0 ] ; Replacement 'Extract to work with series!, and better initial length. Extract: function [ "Extracts every n-th value from a series." Series [series!] Width [integer!] "Size of each entry (the skip)." /Index "Position to extract from." N [number! logic!] ] [New] [ if not Index [N: 1] New: make Series (length? Series) / Width forskip Series Width [ insert/only tail New pick Series N ] New ] ; Replacement 'Alter. Alter: function [ {If a value is not found in a series, append it; otherwise, remove it.} Series [series! port!] Value [any-type!] ] [Temp] [ either Temp: find/only :Series :Value [ remove Temp ] [ insert/only tail :Series :Value ] :Series ] ; Replacement 'Append. Append: func [ {Appends a value to the tail of a series and returns the series.} Series [series! port!] Value [any-type!] /Only "Appends a block value as a block." ][ head either only [ insert/only tail :Series :Value ] [ insert tail :Series :Value ] :Series ] ; Replacement 'Repend. Repend: func [ {Appends a reduced value to a series and returns the series.} Series [series! port!] Value [any-type!] /Only "Appends a block value as a block." ][ either only [ insert/only tail :Series reduce :Value ] [ insert tail :Series reduce :Value ] :Series ] ; Replacement 'function that adds 'throw-on-error. Function: func [ "Defines a user function with local words." [catch] Spec [block!] {Optional help info followed by arg words (and optional type and string)} Vars [block!] "List of words that are local to the function" Body [block!] "The body block of the function" ] [ throw-on-error [make function! head insert insert tail copy spec /local vars body] ] ; Enhanced 'Charset function to allow 'char! values. Charset: func [ "Makes a bitset of chars for the parse function." Chars [string! block! char!] ][ make bitset! Chars ] ; Needed until very latest versions of Rebol are released. if not value? 'as-pair [ as-pair: func [ "Combine X and Y values into a pair." x [number!] y [number!] ][ to-pair reduce [to-integer x to-integer y] ] ] ; Needed until very latest versions of Rebol are released. decode-cgi: func [ {Converts CGI argument string to a block of set-words and value strings.} args [any-string!] "Starts at first argument word." /local block name value here tmp ][ block: make block! 7 parse/all args [ any [ copy name [to #"=" | to #"&" | to end] skip here: ( if tmp: find name #"&" [ here: skip here (offset? tmp name) - 2 clear tmp ] append block to-set-word name ) :here [ [copy value to #"&" skip | copy value to end] ( append block either none? value [copy ""] [ replace/all dehex replace/all value #"+" #" " crlf newline ] ) ] ] end ] block ] ; Needed until very latest versions of Rebol are released. array: func [ "Makes and initializes a series of a given size." size [integer! block!] "Size or block of sizes for each dimension" /initial "Specify an initial value for all elements" value "Initial value" /local block rest ][ if not initial [value: none] if block? size [ rest: next size if tail? rest [rest: none] size: first size if not integer? size [make error! "Integer size required"] ] block: make block! size either not rest [ either series? value [ loop size [insert/only block copy/deep value] ] [ insert/dup block value size ] ] [ loop size [ if series? value [value: copy/deep value] block: insert/only block array/initial rest value ] ] head block ] ; Needed until very latest versions of Rebol are released. if not value? 'sign? [ sign?: func [ {Returns sign of number as 1, 0, or -1 (to use as multiplier).} number [number! money! time!] ][ either positive? number [1] [either negative? number [-1] [0]] ] ] ; Needed until very latest versions of Rebol are released. if not value? 'attempt [ attempt: func [ {Tries to evaluate and returns result or NONE on error.} value [block!] ][ if not error? set/any 'value try value [get/any 'value] ] ] ; Needed until very latest versions of Rebol are released. if not value? 'build-markup [ build-markup: func [ {Return markup text replacing <%tags%> with their evaluated results.} content [string! file! url!] /quiet "Do not show errors in the output." /local out eval value ][ content: either string? content [copy content] [read content] out: make string! 126 eval: func [val /local tmp] [ either error? set/any 'tmp try [do val] [ if not quiet [ tmp: disarm :tmp append out reform ["***ERROR" tmp/id "in:" val] ] ] [ if not unset? get/any 'tmp [append out :tmp] ] ] parse/all content [ any [ end break | "<%" [copy value to "%>" 2 skip | copy value to end] (eval value) | copy value [to "<%" | to end] (append out value) ] ] out ] ] ; Needed until very latest versions of Rebol are released. if not value? 'component? [ component?: func [ "Returns specific REBOL component info if enabled." name [word!] ][ find system/components name ] ] ]

 [2/9] from: brett:codeconscious at: 12-Nov-2003 23:03


I've been thinking about this recently. I think standardised patches are a good idea. Kept in a simple archive of patch scripts that solve things like FTP protocol bugs etc. They should be held as a collection with each described by a simple comment, a REBOL test to allow someone to quickly determine if the patch is relevent/valid for different REBOL versions etc. Enhancements would be not be part of this - just what is generally considered as bugs should be fixed. All the patches applying to a specific version (and platform if necessary) could be combined into a single script -(eg View.121-patches.r) to allow someone using that version to just grab one file and apply it. This way the community, and especially new users, get increasingly stable REBOLs and therefore confidence. I would think that the REBOL library (rebol.org) would be a natural place to publish these. Perhaps it would be enough for each of us to submit our own patches to the patch-library-inbox, and then for someone or a group(s) maintain the combined version specific scripts (upon those patch gaining appropriate approval by whatever means). Regards, Brett. ----- Original Message ----- From: "A J Martin" Sent: Wednesday, November 12, 2003 3:43 PM Subject: [REBOL] Standardised patches Brett wrote (in another thread):
> Ah good. I'll add it to my patches.r and send it to feedback.
I think it's a good idea to reveal and combine the best patches that people have accumulated so far. I've put my in after my .sig. Let's mutate and evolve them! :)

 [3/9] from: maximo:meteorstudios at: 12-Nov-2003 10:17


I think I've finaly caused a good stir... that's the kind of talk I like :-) taking of problems we can, to let RT concentrate on those which we can't. Is anyone (rebol.org) up to generating a public (open to any project), peer reviewing framework ? -MAx --- You can either be part of the problem or part of the solution, but in the end, being part of the problem is much more fun.

 [4/9] from: greggirwin:mindspring at: 12-Nov-2003 11:26


Max, Brett et all MOA> Is anyone (rebol.org) up to generating a public (open to MOA> any project), peer reviewing framework ? REBOL.org has a tag for patches, and we're looking at a bug database as well. Graham's REP site has a draft prototype for bug entries that could be pressed into service as well. http://www.compkarori.com/vanilla/display/Bug+Reporter -- Gregg

 [5/9] from: brett:codeconscious at: 13-Nov-2003 8:28


Hi Gregg,
> REBOL.org has a tag for patches, and we're looking at a bug database
Ok, I've just joined (BTW nice functionality). I'll start posting my patches there. I guess the "Tested-under" library header can be used to create the version specific compilations I wrote about.
> as well. Graham's REP site has a draft prototype for bug entries that > could be pressed into service as well. > > http://www.compkarori.com/vanilla/display/Bug+Reporter
Great, I'll look at this. Regards, Brett.

 [6/9] from: brett:codeconscious at: 13-Nov-2003 14:21


> Ok, I've just joined (BTW nice functionality). I'll start posting my
patches
> there.
First patch posted - yippee! Regards, Brett.

 [7/9] from: SunandaDH:aol at: 13-Nov-2003 2:07


Brett:
> > Ok, I've just joined (BTW nice functionality). I'll start posting my > patches > > there. > > First patch posted - yippee!
Nice one! If anyone wants to see the patches posted, this is the URL: http://www.rebol.org/cgi-bin/cgiwrap/rebol/search.r?filter=patches There's only one as I write, but I'm sure there are more to come from Brett and others. If you know of a patch, please contribute it Sunanda.

 [8/9] from: AJMartin:orcon at: 24-Dec-2003 22:47


Sunanda wrote:
> If anyone wants to see the patches posted, this is the URL: > > http://www.rebol.org/cgi-bin/cgiwrap/rebol/search.r?filter=patches > > There's only one as I write, but I'm sure there are more to come from
Brett and others. If you know of a patch, please contribute it I've sent in mine direct to Sunanda. That's because I haven't figured out how the Rebol.org accepts submissions yet. :( Andrew J Martin Speaking in tongues and performing miracles. ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/

 [9/9] from: SunandaDH:aol at: 14-Nov-2003 3:09


Thanks Andrew,
> I've sent in mine direct to Sunanda. That's because I haven't figured out > how the Rebol.org accepts submissions yet. :(
The patches database grows!: http://www.rebol.org/cgi-bin/cgiwrap/rebol/search.r?filter=patches Sunanda.