Check-in [db02f71016]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add diff/patch commands to show delta operation
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: db02f7101672b90904809828f4acb0bd586aaf4c
User & Date: bernd 2016-06-16 14:23:38
Context
2016-06-16
16:33
Bump version number check-in: 0e2fe581cf user: bernd tags: trunk, 0.1.6-20160616
14:23
Add diff/patch commands to show delta operation check-in: db02f71016 user: bernd tags: trunk
14:12
Small changes to bdelta.fs check-in: 2a7532abf9 user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bdelta.fs.

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131





: bdelta ( addr1 u1 addr2 u2 -- addr3 u3 ) bslurp
    ['] bdelta$2 bdelta$ $exec bdelta$ $@ ;

: bpatch$2 ( a$ diff$ -- )
    0 { fp }
    $@ bounds U+DO
	I p@+ >r 64>n r> swap 2dup <info> type +
	dup I' < IF
	    ps@+ >r 64>n fp + to fp
	    dup $@ fp safe/string
	    r> p@+ >r 64>n dup fp + to fp umin <warn> type r>
	THEN
    I - +LOOP <default> drop ;

: bpatch ( addr1 u1 addr2 u2 -- addr3 u3 )
    bslurp ['] bpatch$2 bdelta$ $exec
    bdelta$ $@ ;











|



|






>
>
>
>
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

: bdelta ( addr1 u1 addr2 u2 -- addr3 u3 ) bslurp
    ['] bdelta$2 bdelta$ $exec bdelta$ $@ ;

: bpatch$2 ( a$ diff$ -- )
    0 { fp }
    $@ bounds U+DO
	I p@+ >r 64>n r> swap 2dup type +
	dup I' < IF
	    ps@+ >r 64>n fp + to fp
	    dup $@ fp safe/string
	    r> p@+ >r 64>n dup fp + to fp umin type r>
	THEN
    I - +LOOP <default> drop ;

: bpatch ( addr1 u1 addr2 u2 -- addr3 u3 )
    bslurp ['] bpatch$2 bdelta$ $exec
    bdelta$ $@ ;

: spit-file ( addr1 u1 fileaddr2 u2 -- )
    r/w create-file throw >r r@ write-file
    r> close-file throw throw ;

Changes to n2o.fs.

385
386
387
388
389
390
391
392


















393


394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
    ?@nextarg IF
	$A $E nick-connect ." connected" cr !time
	net2o-code expect-reply
	$10 blocksize! $A blockalign!
	[: 2dup basename n2o:copy ;] arg-loop
	n2o:done end-code| n2o:close-all
	c:disconnect  THEN ;



















: bye ( -- )


    subme bye ;

: -bw ( -- )
    \U -bw <cmd>
    \G -bw: disable color codes
    ['] drop is attr!  next-cmd ;

: -date ( -- )
    \U -date n <cmd>
    \G -date: set date precision to n
    \G -date: 0 is least, 7 is highest
    ?nextarg 0= IF help ELSE
	s>number drop config:date# !
	next-cmd THEN ;

: -backtrace ( -- )
    \U -backtrace <cmd>
    \G -backtrace: Provide full error reporting ;
    [ what's DoError ]l is DoError next-cmd ;

: version ( -- )
    \U version








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>







<
<
<
<
<
<
<
<







385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420








421
422
423
424
425
426
427
    ?@nextarg IF
	$A $E nick-connect ." connected" cr !time
	net2o-code expect-reply
	$10 blocksize! $A blockalign!
	[: 2dup basename n2o:copy ;] arg-loop
	n2o:done end-code| n2o:close-all
	c:disconnect  THEN ;

\ diff and patch

: diff ( -- )
    \U diff file1 file2 patchfile
    \G diff: compute diff between two files, and write patch-file
    ?nextarg IF  ?nextarg IF  bdelta
	    ?nextarg IF  spit-file  b$off  EXIT  THEN THEN  THEN
    ." diff needs three arguments!" cr b$off ;

: patch ( -- )
    \U patch file1 patchfile file2
    \G patch: take a patchfile for file1 and produce file2
    ?nextarg IF  ?nextarg IF  bpatch
	    ?nextarg IF  spit-file b$off  EXIT  THEN THEN THEN
    ." patch needs three arguments!" cr b$off ;

\ others

: bye ( -- )
    \U bye
    \G bye: quit command mode and terminate program
    subme bye ;

: -bw ( -- )
    \U -bw <cmd>
    \G -bw: disable color codes
    ['] drop is attr!  next-cmd ;









: -backtrace ( -- )
    \U -backtrace <cmd>
    \G -backtrace: Provide full error reporting ;
    [ what's DoError ]l is DoError next-cmd ;

: version ( -- )
    \U version

Changes to net2o-msg.fs.

812
813
814
815
816
817
818
819
forth-local-indent-words:
    (
     (("net2o:" "+net2o:") (0 . 2) (0 . 2) non-immediate)
     (("[:") (0 . 1) (0 . 1) immediate)
     ((";]") (-1 . 0) (0 . -1) immediate)
    )
End:
[THEN]







|
812
813
814
815
816
817
818
819
forth-local-indent-words:
    (
     (("net2o:" "+net2o:") (0 . 2) (0 . 2) non-immediate)
     (("[:") (0 . 1) (0 . 1) immediate)
     ((";]") (-1 . 0) (0 . -1) immediate)
    )
End:
[THEN]

Changes to net2o.fs.

37
38
39
40
41
42
43

44
45
46
47
48
49
50
require keccak.fs
require threefish.fs
\ require wurstkessel.fs \ self-developped crypto for early development
keccak-o crypto-o !
require rng.fs
require ed25519-donna.fs
require hash-table.fs


\ crypto selection

Create crypt-modes ' keccak-t , ' threefish-t ,
here crypt-modes - cell/ Constant crypts#

: >crypt ( n -- )







>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require keccak.fs
require threefish.fs
\ require wurstkessel.fs \ self-developped crypto for early development
keccak-o crypto-o !
require rng.fs
require ed25519-donna.fs
require hash-table.fs
require bdelta.fs

\ crypto selection

Create crypt-modes ' keccak-t , ' threefish-t ,
here crypt-modes - cell/ Constant crypts#

: >crypt ( n -- )