[REBOL] Re: Rebol Product Suggestion.
From: g:santilli:tiscalinet:it at: 24-Jun-2001 12:09
Hello Joel!
On 23-Giu-01, you wrote:
JN> Your remarks are inspiring, as usual! (Of course there's
JN> a fine line between inspiration and madness. ;-)
;-)
JN> Unless RT adds a primitive that's the equivalent of
JN> do decrypt somestring
JN> somestring: ""
JN> (per a discussion at least a year ago on this list).
Yes, but then again with proper reverse engeneering one could get
to the source anyway. A "lossy" conversion, instead, guarantees
that noone can get to the original source in any way.
JN> propercase: func [
JN> {capitalize first letter only of a string}
JN> s [string!] {original string - unchanged}
JN> ][
JN> head change lowercase copy s uppercase copy/part s 1
JN> ]
what about:
propercase: func [s] [head lowercase next uppercase/part copy s 1]
JN> result: copy nextsep: ""
BTW, in these cases I usually write:
result: clear ""
; ...
copy result
because that will probably require less memory allocations. After
calling the function a couple times, indeed, the result buffer
will automatically end up being as large as needed and no more
memory allocations and copying will be needed in future calls,
except for the explicit final copy. (Well, I couldn't resist
giving my $0.02. :)
JN> And apply rules such as:
JN> - Remove comments.
;-comments will be removed by load. String comments could be
removed automatically in places such as function definitions etc.,
but maybe it would be better if is the programmer to manually
remove them.
JN> - Never allow meaningful names
This can be done by changing non-system words and by aliasing
system words. Human intervention may be necessary in some cases.
JN> - Use names hard to distinguish
I'd say completely random. :)
JN> - Replace simple constants/expressions with more obscure
JN> expressions
Mainly for strings, so that they are not easyly readable by the
intruder
.
JN> 8<--------------------------------------------------------
JN> capitalize: func [ I1l1I [string!] /local O0Ol0 IIOOO ] [
JN> O0Ol0: func [ OO01O [series!] O00I0 [string! char!] /local
JN> OOOIO O0010 ] [ OOOIO: copy O0010: copy tail mold 17 foreach
JN> O0OIO OO01O [ repend OOOIO [O0010 O0OIO] O0010: O00I0 ]
JN> OOOIO ] IIOOO: func [ IIOOI [block! hash! string!] IIOO1
JN> [any-function!] /IIO0I /local II000 III0l ] [ II000: make
JN> type? IIOOI length? IIOOI foreach II1Ol IIOOI [ if any [
JN> found? III0l: IIOO1 II1Ol IIO0I ] [ append/only II000 III0l
JN> ] ] II000 ] O0Ol0 IIOOO parse I1l1I none func [ lOOO1
JN> [string!] ] [ head change lowercase copy lOOO1 uppercase
JN> copy/part lOOO1 index? head lOOO1 ] to-string to-char 32 ]
JN> 8<--------------------------------------------------------
This is a very good example of what I intended. Thanks Joel!
JN> yet know how to program the required knowledge. I'll be
JN> fascinated to see any progress you might make! Good luck!
I'll need luck, I know! :-) But I think it can be done to some
extent, as long as either the programmer helps the tool doing the
conversion or (s)he writes the source code in a format that can be
easyly automatically processed (giving hints to the processor,
that is).
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/