Hex Artifact Content
Not logged in

Artifact 23328ed13ee10cfbae2b71cf7627e54fc935047b:


0000: 5c 20 6e 65 74 32 6f 20 74 65 6d 70 6c 61 74 65  \ net2o template
0010: 20 66 6f 72 20 6e 65 77 20 66 69 6c 65 73 0a 0a   for new files..
0020: 5c 20 43 6f 70 79 72 69 67 68 74 20 28 43 29 20  \ Copyright (C) 
0030: 32 30 31 35 20 20 20 42 65 72 6e 64 20 50 61 79  2015   Bernd Pay
0040: 73 61 6e 0a 0a 5c 20 54 68 69 73 20 70 72 6f 67  san..\ This prog
0050: 72 61 6d 20 69 73 20 66 72 65 65 20 73 6f 66 74  ram is free soft
0060: 77 61 72 65 3a 20 79 6f 75 20 63 61 6e 20 72 65  ware: you can re
0070: 64 69 73 74 72 69 62 75 74 65 20 69 74 20 61 6e  distribute it an
0080: 64 2f 6f 72 20 6d 6f 64 69 66 79 0a 5c 20 69 74  d/or modify.\ it
0090: 20 75 6e 64 65 72 20 74 68 65 20 74 65 72 6d 73   under the terms
00a0: 20 6f 66 20 74 68 65 20 47 4e 55 20 41 66 66 65   of the GNU Affe
00b0: 72 6f 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69  ro General Publi
00c0: 63 20 4c 69 63 65 6e 73 65 20 61 73 20 70 75 62  c License as pub
00d0: 6c 69 73 68 65 64 20 62 79 0a 5c 20 74 68 65 20  lished by.\ the 
00e0: 46 72 65 65 20 53 6f 66 74 77 61 72 65 20 46 6f  Free Software Fo
00f0: 75 6e 64 61 74 69 6f 6e 2c 20 65 69 74 68 65 72  undation, either
0100: 20 76 65 72 73 69 6f 6e 20 33 20 6f 66 20 74 68   version 3 of th
0110: 65 20 4c 69 63 65 6e 73 65 2c 20 6f 72 0a 5c 20  e License, or.\ 
0120: 28 61 74 20 79 6f 75 72 20 6f 70 74 69 6f 6e 29  (at your option)
0130: 20 61 6e 79 20 6c 61 74 65 72 20 76 65 72 73 69   any later versi
0140: 6f 6e 2e 0a 0a 5c 20 54 68 69 73 20 70 72 6f 67  on...\ This prog
0150: 72 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74  ram is distribut
0160: 65 64 20 69 6e 20 74 68 65 20 68 6f 70 65 20 74  ed in the hope t
0170: 68 61 74 20 69 74 20 77 69 6c 6c 20 62 65 20 75  hat it will be u
0180: 73 65 66 75 6c 2c 0a 5c 20 62 75 74 20 57 49 54  seful,.\ but WIT
0190: 48 4f 55 54 20 41 4e 59 20 57 41 52 52 41 4e 54  HOUT ANY WARRANT
01a0: 59 3b 20 77 69 74 68 6f 75 74 20 65 76 65 6e 20  Y; without even 
01b0: 74 68 65 20 69 6d 70 6c 69 65 64 20 77 61 72 72  the implied warr
01c0: 61 6e 74 79 20 6f 66 0a 5c 20 4d 45 52 43 48 41  anty of.\ MERCHA
01d0: 4e 54 41 42 49 4c 49 54 59 20 6f 72 20 46 49 54  NTABILITY or FIT
01e0: 4e 45 53 53 20 46 4f 52 20 41 20 50 41 52 54 49  NESS FOR A PARTI
01f0: 43 55 4c 41 52 20 50 55 52 50 4f 53 45 2e 20 20  CULAR PURPOSE.  
0200: 53 65 65 20 74 68 65 0a 5c 20 47 4e 55 20 41 66  See the.\ GNU Af
0210: 66 65 72 6f 20 47 65 6e 65 72 61 6c 20 50 75 62  fero General Pub
0220: 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f 72 20  lic License for 
0230: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5c  more details...\
0240: 20 59 6f 75 20 73 68 6f 75 6c 64 20 68 61 76 65   You should have
0250: 20 72 65 63 65 69 76 65 64 20 61 20 63 6f 70 79   received a copy
0260: 20 6f 66 20 74 68 65 20 47 4e 55 20 41 66 66 65   of the GNU Affe
0270: 72 6f 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69  ro General Publi
0280: 63 20 4c 69 63 65 6e 73 65 0a 5c 20 61 6c 6f 6e  c License.\ alon
0290: 67 20 77 69 74 68 20 74 68 69 73 20 70 72 6f 67  g with this prog
02a0: 72 61 6d 2e 20 20 49 66 20 6e 6f 74 2c 20 73 65  ram.  If not, se
02b0: 65 20 3c 68 74 74 70 3a 2f 2f 77 77 77 2e 67 6e  e <http://www.gn
02c0: 75 2e 6f 72 67 2f 6c 69 63 65 6e 73 65 73 2f 3e  u.org/licenses/>
02d0: 2e 0a 0a 5c 20 6e 6f 74 69 66 69 63 61 74 69 6f  ...\ notificatio
02e0: 6e 73 20 28 6f 6e 20 61 6e 64 72 6f 69 64 20 6f  ns (on android o
02f0: 6e 6c 79 20 6e 6f 77 29 0a 0a 36 34 23 30 20 36  nly now)..64#0 6
0300: 34 56 61 6c 75 65 20 6c 61 73 74 2d 6e 6f 74 69  4Value last-noti
0310: 66 79 0a 36 34 23 30 20 36 34 56 61 6c 75 65 20  fy.64#0 64Value 
0320: 6c 61 74 65 73 74 2d 6e 6f 74 69 66 79 0a 36 30  latest-notify.60
0330: 2e 30 30 30 30 30 30 30 30 30 20 64 3e 36 34 20  .000000000 d>64 
0340: 36 34 56 61 6c 75 65 20 64 65 6c 74 61 2d 6e 6f  64Value delta-no
0350: 74 69 66 79 20 5c 20 6f 6e 65 20 6e 6f 74 69 66  tify \ one notif
0360: 69 63 61 74 69 6f 6e 20 70 65 72 20 6d 69 6e 75  ication per minu
0370: 74 65 20 69 73 20 65 6e 6f 75 67 68 0a 33 20 56  te is enough.3 V
0380: 61 6c 75 65 20 6e 6f 74 69 66 79 2d 6d 6f 64 65  alue notify-mode
0390: 0a 24 46 46 46 46 30 30 20 56 61 6c 75 65 20 6e  .$FFFF00 Value n
03a0: 6f 74 69 66 79 2d 72 67 62 0a 35 30 30 20 56 61  otify-rgb.500 Va
03b0: 6c 75 65 20 6e 6f 74 69 66 79 2d 6f 6e 0a 34 35  lue notify-on.45
03c0: 30 30 20 56 61 6c 75 65 20 6e 6f 74 69 66 79 2d  00 Value notify-
03d0: 6f 66 66 0a 74 72 75 65 20 56 61 6c 75 65 20 6e  off.true Value n
03e0: 6f 74 69 66 79 2d 74 65 78 74 0a 0a 3a 20 74 69  otify-text..: ti
03f0: 63 6b 2d 6e 6f 74 69 66 79 3f 20 28 20 2d 2d 20  ck-notify? ( -- 
0400: 66 6c 61 67 20 29 0a 20 20 20 20 74 69 63 6b 73  flag ).    ticks
0410: 20 6c 61 73 74 2d 6e 6f 74 69 66 79 20 36 34 2d   last-notify 64-
0420: 20 64 65 6c 74 61 2d 6e 6f 74 69 66 79 20 36 34   delta-notify 64
0430: 3c 20 3b 0a 0a 56 61 72 69 61 62 6c 65 20 6e 6f  < ;..Variable no
0440: 74 69 66 79 3f 20 2d 32 20 6e 6f 74 69 66 79 3f  tify? -2 notify?
0450: 20 21 20 5c 20 64 65 66 61 75 6c 74 3a 20 6e 6f   ! \ default: no
0460: 20 6e 6f 74 69 66 69 63 61 74 69 6f 6e 20 77 68   notification wh
0470: 65 6e 20 61 63 74 69 76 65 0a 56 61 72 69 61 62  en active.Variab
0480: 6c 65 20 6e 6f 74 69 66 79 24 0a 56 61 72 69 61  le notify$.Varia
0490: 62 6c 65 20 70 65 6e 64 69 6e 67 2d 6e 6f 74 69  ble pending-noti
04a0: 66 69 63 61 74 69 6f 6e 73 0a 0a 3a 20 6e 6f 74  fications..: not
04b0: 69 66 79 2d 20 28 20 2d 2d 20 29 0a 20 20 20 20  ify- ( -- ).    
04c0: 70 65 6e 64 69 6e 67 2d 6e 6f 74 69 66 69 63 61  pending-notifica
04d0: 74 69 6f 6e 73 20 6f 66 66 0a 20 20 20 20 36 34  tions off.    64
04e0: 23 30 20 74 6f 20 6c 61 73 74 2d 6e 6f 74 69 66  #0 to last-notif
04f0: 79 20 3b 0a 0a 53 65 6d 61 20 6e 6f 74 69 66 79  y ;..Sema notify
0500: 2d 73 65 6d 61 0a 3a 20 6e 6f 74 69 66 79 3b 20  -sema.: notify; 
0510: 6e 69 70 20 28 3b 5d 29 20 5d 5d 20 6e 6f 74 69  nip (;]) ]] noti
0520: 66 79 2d 73 65 6d 61 20 63 2d 73 65 63 74 69 6f  fy-sema c-sectio
0530: 6e 20 3b 20 5b 5b 20 3b 0a 3a 20 6e 6f 74 69 66  n ; [[ ;.: notif
0540: 79 3e 20 63 6f 6d 70 2d 5b 3a 20 5b 27 5d 20 6e  y> comp-[: ['] n
0550: 6f 74 69 66 79 3b 20 63 6f 6c 6f 6e 2d 73 79 73  otify; colon-sys
0560: 2d 78 74 2d 6f 66 66 73 65 74 20 73 74 69 63 6b  -xt-offset stick
0570: 20 3b 20 69 6d 6d 65 64 69 61 74 65 0a 0a 3a 20   ; immediate..: 
0580: 6e 6f 74 69 66 79 2d 74 69 74 6c 65 20 28 20 2d  notify-title ( -
0590: 2d 20 29 0a 20 20 20 20 2e 22 20 6e 65 74 32 6f  - ).    ." net2o
05a0: 3a 20 22 20 70 65 6e 64 69 6e 67 2d 6e 6f 74 69  : " pending-noti
05b0: 66 69 63 61 74 69 6f 6e 73 20 40 20 64 75 70 20  fications @ dup 
05c0: 2e 0a 20 20 20 20 2e 22 20 4d 65 73 73 61 67 65  ..    ." Message
05d0: 22 20 31 20 3e 20 49 46 20 2e 22 20 73 22 20 20  " 1 > IF ." s"  
05e0: 54 48 45 4e 20 3b 0a 0a 5b 49 46 44 45 46 5d 20  THEN ;..[IFDEF] 
05f0: 61 6e 64 72 6f 69 64 0a 20 20 20 20 61 6c 73 6f  android.    also
0600: 20 61 6e 64 72 6f 69 64 20 61 6c 73 6f 20 6a 6e   android also jn
0610: 69 0a 0a 20 20 20 20 30 78 30 31 30 38 30 30 37  i..    0x0108007
0620: 37 20 56 61 6c 75 65 20 6e 65 74 32 6f 2d 69 63  7 Value net2o-ic
0630: 6f 6e 23 20 5c 20 64 65 66 61 75 6c 74 0a 20 20  on# \ default.  
0640: 20 20 3a 20 67 65 74 2d 6e 65 74 32 6f 2d 69 63    : get-net2o-ic
0650: 6f 6e 23 20 22 67 6e 75 2e 67 66 6f 72 74 68 3a  on# "gnu.gforth:
0660: 64 72 61 77 61 62 6c 65 2f 6e 65 74 32 6f 5f 6e  drawable/net2o_n
0670: 6f 74 69 66 79 22 20 52 2e 69 64 20 3b 0a 20 20  otify" R.id ;.  
0680: 20 20 67 65 74 2d 6e 65 74 32 6f 2d 69 63 6f 6e    get-net2o-icon
0690: 23 20 74 6f 20 6e 65 74 32 6f 2d 69 63 6f 6e 23  # to net2o-icon#
06a0: 0a 20 20 20 20 6a 76 61 6c 75 65 20 6e 62 0a 20  .    jvalue nb. 
06b0: 20 20 20 6a 76 61 6c 75 65 20 6e 69 0a 20 20 20     jvalue ni.   
06c0: 20 6a 76 61 6c 75 65 20 6e 66 0a 20 20 20 20 6a   jvalue nf.    j
06d0: 76 61 6c 75 65 20 6e 6f 74 69 66 69 63 61 74 69  value notificati
06e0: 6f 6e 2d 6d 61 6e 61 67 65 72 0a 20 20 20 20 3a  on-manager.    :
06f0: 20 6e 6f 74 69 66 79 2b 20 28 20 61 64 64 72 20   notify+ ( addr 
0700: 75 20 2d 2d 20 29 20 20 6e 6f 74 69 66 79 3e 20  u -- )  notify> 
0710: 6e 6f 74 69 66 79 24 20 24 2b 21 20 3b 0a 20 20  notify$ $+! ;.  
0720: 20 20 3a 20 6e 6f 74 69 66 79 21 20 28 20 61 64    : notify! ( ad
0730: 64 72 20 75 20 2d 2d 20 29 20 20 6e 6f 74 69 66  dr u -- )  notif
0740: 79 3e 20 6e 6f 74 69 66 79 24 20 24 21 20 3b 0a  y> notify$ $! ;.
0750: 20 20 20 20 3a 20 6e 6f 74 69 66 79 40 20 28 20      : notify@ ( 
0760: 2d 2d 20 61 64 64 72 20 75 20 29 0a 09 6e 6f 74  -- addr u )..not
0770: 69 66 79 2d 74 65 78 74 20 49 46 20 20 6e 6f 74  ify-text IF  not
0780: 69 66 79 24 20 24 40 0a 09 45 4c 53 45 20 20 22  ify$ $@..ELSE  "
0790: 68 69 64 64 65 6e 20 63 72 79 70 74 69 63 20 74  hidden cryptic t
07a0: 65 78 74 22 20 20 54 48 45 4e 20 3b 0a 0a 20 20  ext"  THEN ;..  
07b0: 20 20 3a 20 3f 6e 6d 20 28 20 2d 2d 20 29 0a 09    : ?nm ( -- )..
07c0: 6e 6f 74 69 66 69 63 61 74 69 6f 6e 2d 6d 61 6e  notification-man
07d0: 61 67 65 72 20 30 3d 20 49 46 0a 09 20 20 20 20  ager 0= IF..    
07e0: 4e 4f 54 49 46 49 43 41 54 49 4f 4e 5f 53 45 52  NOTIFICATION_SER
07f0: 56 49 43 45 20 63 6c 61 7a 7a 20 2e 67 65 74 53  VICE clazz .getS
0800: 79 73 74 65 6d 53 65 72 76 69 63 65 0a 09 20 20  ystemService..  
0810: 20 20 74 6f 20 6e 6f 74 69 66 69 63 61 74 69 6f    to notificatio
0820: 6e 2d 6d 61 6e 61 67 65 72 0a 09 54 48 45 4e 20  n-manager..THEN 
0830: 3b 0a 20 20 20 20 3a 20 3f 6e 69 20 28 20 2d 2d  ;.    : ?ni ( --
0840: 20 29 0a 09 6e 69 20 30 3d 20 49 46 20 20 63 6c   )..ni 0= IF  cl
0850: 61 7a 7a 20 2e 67 66 6f 72 74 68 69 6e 74 65 6e  azz .gforthinten
0860: 74 20 74 6f 20 6e 69 20 20 54 48 45 4e 20 3b 0a  t to ni  THEN ;.
0870: 20 20 20 20 3a 20 6d 73 67 2d 62 75 69 6c 64 65      : msg-builde
0880: 72 20 28 20 2d 2d 20 29 20 3f 6e 6d 20 3f 6e 69  r ( -- ) ?nm ?ni
0890: 0a 09 63 6c 61 7a 7a 20 6e 65 77 4e 6f 74 69 66  ..clazz newNotif
08a0: 69 63 61 74 69 6f 6e 2e 42 75 69 6c 64 65 72 20  ication.Builder 
08b0: 74 6f 20 6e 62 0a 09 6e 6f 74 69 66 79 2d 72 67  to nb..notify-rg
08c0: 62 20 6e 6f 74 69 66 79 2d 6f 6e 20 6e 6f 74 69  b notify-on noti
08d0: 66 79 2d 6f 66 66 20 6e 62 20 2e 73 65 74 4c 69  fy-off nb .setLi
08e0: 67 68 74 73 20 74 6f 20 6e 62 0a 09 6e 6f 74 69  ghts to nb..noti
08f0: 66 79 2d 6d 6f 64 65 20 6e 62 20 2e 73 65 74 44  fy-mode nb .setD
0900: 65 66 61 75 6c 74 73 20 74 6f 20 6e 62 0a 09 6e  efaults to nb..n
0910: 69 20 6e 62 20 2e 73 65 74 43 6f 6e 74 65 6e 74  i nb .setContent
0920: 49 6e 74 65 6e 74 20 74 6f 20 6e 62 0a 09 6e 65  Intent to nb..ne
0930: 74 32 6f 2d 69 63 6f 6e 23 20 6e 62 20 2e 73 65  t2o-icon# nb .se
0940: 74 53 6d 61 6c 6c 49 63 6f 6e 20 74 6f 20 6e 62  tSmallIcon to nb
0950: 0a 09 31 20 6e 62 20 2e 73 65 74 41 75 74 6f 43  ..1 nb .setAutoC
0960: 61 6e 63 65 6c 20 74 6f 20 6e 62 20 3b 0a 20 20  ancel to nb ;.  
0970: 20 20 6d 73 67 2d 62 75 69 6c 64 65 72 0a 20 20    msg-builder.  
0980: 20 20 3a 20 62 75 69 6c 64 2d 6e 6f 74 69 66 69    : build-notifi
0990: 63 61 74 69 6f 6e 20 28 20 2d 2d 20 29 0a 09 31  cation ( -- )..1
09a0: 30 30 30 20 63 6c 61 7a 7a 20 2e 73 63 72 65 65  000 clazz .scree
09b0: 6e 5f 6f 6e 0a 09 31 20 70 65 6e 64 69 6e 67 2d  n_on..1 pending-
09c0: 6e 6f 74 69 66 69 63 61 74 69 6f 6e 73 20 2b 21  notifications +!
09d0: 0a 09 5b 27 5d 20 6e 6f 74 69 66 79 2d 74 69 74  ..['] notify-tit
09e0: 6c 65 20 24 74 6d 70 20 6d 61 6b 65 2d 6a 73 74  le $tmp make-jst
09f0: 72 69 6e 67 20 6e 62 20 2e 73 65 74 43 6f 6e 74  ring nb .setCont
0a00: 65 6e 74 54 69 74 6c 65 20 74 6f 20 6e 62 0a 09  entTitle to nb..
0a10: 6e 6f 74 69 66 79 40 20 6d 61 6b 65 2d 6a 73 74  notify@ make-jst
0a20: 72 69 6e 67 20 6e 62 20 2e 73 65 74 43 6f 6e 74  ring nb .setCont
0a30: 65 6e 74 54 65 78 74 20 74 6f 20 6e 62 0a 09 6e  entText to nb..n
0a40: 6f 74 69 66 79 40 20 6d 61 6b 65 2d 6a 73 74 72  otify@ make-jstr
0a50: 69 6e 67 20 6e 62 20 2e 73 65 74 54 69 63 6b 65  ing nb .setTicke
0a60: 72 20 74 6f 20 6e 62 0a 09 6e 62 20 2e 62 75 69  r to nb..nb .bui
0a70: 6c 64 20 74 6f 20 6e 66 20 3b 0a 20 20 20 20 3a  ld to nf ;.    :
0a80: 20 73 68 6f 77 2d 6e 6f 74 69 66 69 63 61 74 69   show-notificati
0a90: 6f 6e 20 28 20 2d 2d 20 29 0a 09 31 20 6e 66 20  on ( -- )..1 nf 
0aa0: 6e 6f 74 69 66 69 63 61 74 69 6f 6e 2d 6d 61 6e  notification-man
0ab0: 61 67 65 72 20 2e 6e 6f 74 69 66 79 20 3b 0a 0a  ager .notify ;..
0ac0: 20 20 20 20 3a 6e 6f 6e 61 6d 65 20 64 65 66 65      :noname defe
0ad0: 72 73 20 61 6e 64 72 6f 69 64 2d 61 63 74 69 76  rs android-activ
0ae0: 65 20 72 65 6e 64 65 72 69 6e 67 20 40 20 49 46  e rendering @ IF
0af0: 20 20 6e 6f 74 69 66 79 2d 20 20 54 48 45 4e 20    notify-  THEN 
0b00: 3b 0a 20 20 20 20 69 73 20 61 6e 64 72 6f 69 64  ;.    is android
0b10: 2d 61 63 74 69 76 65 0a 5b 45 4c 53 45 5d 0a 20  -active.[ELSE]. 
0b20: 20 20 20 3a 20 65 73 63 61 70 65 2d 3c 26 3e 20     : escape-<&> 
0b30: 28 20 61 64 64 72 20 75 20 2d 2d 20 29 0a 09 62  ( addr u -- )..b
0b40: 6f 75 6e 64 73 20 3f 44 4f 20 20 63 61 73 65 20  ounds ?DO  case 
0b50: 69 20 63 40 0a 09 09 27 3c 27 20 6f 66 20 20 2e  i c@...'<' of  .
0b60: 22 20 26 6c 74 3b 22 20 20 65 6e 64 6f 66 0a 09  " &lt;"  endof..
0b70: 09 27 3e 27 20 6f 66 20 20 2e 22 20 26 67 74 3b  .'>' of  ." &gt;
0b80: 22 20 20 65 6e 64 6f 66 0a 09 09 27 26 27 20 6f  "  endof...'&' o
0b90: 66 20 20 2e 22 20 26 61 6d 70 3b 22 20 65 6e 64  f  ." &amp;" end
0ba0: 6f 66 0a 09 09 64 65 66 61 75 6c 74 3a 20 65 6d  of...default: em
0bb0: 69 74 20 20 65 6e 64 63 61 73 65 20 20 4c 4f 4f  it  endcase  LOO
0bc0: 50 20 3b 0a 20 20 20 20 0a 20 20 20 20 3a 20 6e  P ;.    .    : n
0bd0: 6f 74 69 66 79 2b 20 6e 6f 74 69 66 79 3e 20 6e  otify+ notify> n
0be0: 6f 74 69 66 79 24 20 24 2b 21 20 3b 0a 20 20 20  otify$ $+! ;.   
0bf0: 20 3a 20 6e 6f 74 69 66 79 21 20 6e 6f 74 69 66   : notify! notif
0c00: 79 3e 20 6e 6f 74 69 66 79 24 20 24 21 20 3b 0a  y> notify$ $! ;.
0c10: 20 20 20 20 3a 20 62 75 69 6c 64 2d 6e 6f 74 69      : build-noti
0c20: 66 69 63 61 74 69 6f 6e 20 28 20 2d 2d 20 29 20  fication ( -- ) 
0c30: 3b 0a 20 20 20 20 3a 20 6e 6f 74 69 66 79 40 20  ;.    : notify@ 
0c40: 28 20 2d 2d 20 61 64 64 72 20 75 20 29 0a 09 6e  ( -- addr u )..n
0c50: 6f 74 69 66 79 2d 74 65 78 74 20 49 46 20 20 6e  otify-text IF  n
0c60: 6f 74 69 66 79 24 20 24 40 20 5b 27 5d 20 65 73  otify$ $@ ['] es
0c70: 63 61 70 65 2d 3c 26 3e 20 24 74 6d 70 0a 09 45  cape-<&> $tmp..E
0c80: 4c 53 45 20 20 22 3c 69 3e 68 69 64 64 65 6e 20  LSE  "<i>hidden 
0c90: 63 72 79 70 74 69 63 20 74 65 78 74 3c 2f 69 3e  cryptic text</i>
0ca0: 22 20 20 54 48 45 4e 20 3b 0a 0a 20 20 20 20 5b  "  THEN ;..    [
0cb0: 49 46 44 45 46 5d 20 6c 69 6e 75 78 0a 09 5b 49  IFDEF] linux..[I
0cc0: 46 44 45 46 5d 20 66 6f 72 6b 2b 65 78 65 63 0a  FDEF] fork+exec.
0cd0: 09 20 20 20 20 56 61 72 69 61 62 6c 65 20 6e 6f  .    Variable no
0ce0: 74 69 66 79 2d 73 65 6e 64 20 20 24 31 30 30 30  tify-send  $1000
0cf0: 20 6e 6f 74 69 66 79 2d 73 65 6e 64 20 24 21 6c   notify-send $!l
0d00: 65 6e 0a 09 20 20 20 20 73 22 20 77 68 69 63 68  en..    s" which
0d10: 20 6e 6f 74 69 66 79 2d 73 65 6e 64 22 20 72 2f   notify-send" r/
0d20: 6f 20 6f 70 65 6e 2d 70 69 70 65 20 74 68 72 6f  o open-pipe thro
0d30: 77 0a 09 20 20 20 20 3e 72 20 6e 6f 74 69 66 79  w..    >r notify
0d40: 2d 73 65 6e 64 20 24 40 20 72 40 20 72 65 61 64  -send $@ r@ read
0d50: 2d 66 69 6c 65 20 74 68 72 6f 77 20 72 3e 20 63  -file throw r> c
0d60: 6c 6f 73 65 2d 66 69 6c 65 20 74 68 72 6f 77 0a  lose-file throw.
0d70: 09 20 20 20 20 6e 6f 74 69 66 79 2d 73 65 6e 64  .    notify-send
0d80: 20 24 40 20 72 6f 74 20 75 6d 69 6e 20 23 6c 66   $@ rot umin #lf
0d90: 20 2d 73 6b 69 70 20 6e 6f 74 69 66 79 2d 73 65   -skip notify-se
0da0: 6e 64 20 24 21 6c 65 6e 20 20 64 72 6f 70 0a 09  nd $!len  drop..
0db0: 20 20 20 20 0a 09 20 20 20 20 56 61 72 69 61 62      ..    Variab
0dc0: 6c 65 20 6e 65 74 32 6f 2d 6c 6f 67 6f 0a 09 20  le net2o-logo.. 
0dd0: 20 20 20 73 22 20 64 6f 63 2f 6e 65 74 32 6f 2d     s" doc/net2o-
0de0: 6c 6f 67 6f 2e 70 6e 67 22 20 6f 70 65 6e 2d 66  logo.png" open-f
0df0: 70 61 74 68 2d 66 69 6c 65 20 30 3d 20 5b 49 46  path-file 0= [IF
0e00: 5d 0a 09 09 72 6f 74 20 63 6c 6f 73 65 2d 66 69  ]...rot close-fi
0e10: 6c 65 20 74 68 72 6f 77 0a 09 09 6f 76 65 72 20  le throw...over 
0e20: 63 40 20 27 2f 27 20 3c 3e 20 5b 49 46 5d 0a 09  c@ '/' <> [IF]..
0e30: 09 20 20 20 20 70 61 64 20 24 32 30 30 20 67 65  .    pad $200 ge
0e40: 74 2d 64 69 72 20 6e 65 74 32 6f 2d 6c 6f 67 6f  t-dir net2o-logo
0e50: 20 24 21 20 27 2f 27 20 6e 65 74 32 6f 2d 6c 6f   $! '/' net2o-lo
0e60: 67 6f 20 63 24 2b 21 0a 09 09 5b 54 48 45 4e 5d  go c$+!...[THEN]
0e70: 0a 09 09 6e 65 74 32 6f 2d 6c 6f 67 6f 20 24 2b  ...net2o-logo $+
0e80: 21 0a 09 20 20 20 20 5b 54 48 45 4e 5d 0a 09 20  !..    [THEN].. 
0e90: 20 20 20 0a 09 20 20 20 20 3a 20 30 73 74 72 69     ..    : 0stri
0ea0: 6e 67 20 28 20 61 64 64 72 20 75 20 2d 2d 20 63  ng ( addr u -- c
0eb0: 73 74 72 20 29 0a 09 09 31 2b 20 73 61 76 65 2d  str )...1+ save-
0ec0: 6d 65 6d 20 6f 76 65 72 20 2b 20 31 2d 20 30 20  mem over + 1- 0 
0ed0: 73 77 61 70 20 63 21 20 3b 0a 09 20 20 20 20 0a  swap c! ;..    .
0ee0: 09 20 20 20 20 43 72 65 61 74 65 20 6e 6f 74 69  .    Create noti
0ef0: 66 79 2d 61 72 67 73 0a 09 20 20 20 20 22 6e 6f  fy-args..    "no
0f00: 74 69 66 79 2d 73 65 6e 64 5c 30 22 20 64 72 6f  tify-send\0" dro
0f10: 70 20 2c 0a 09 20 20 20 20 22 2d 61 5c 30 22 20  p ,..    "-a\0" 
0f20: 64 72 6f 70 20 2c 0a 09 20 20 20 20 22 6e 65 74  drop ,..    "net
0f30: 32 6f 5c 30 22 20 64 72 6f 70 20 2c 0a 09 20 20  2o\0" drop ,..  
0f40: 20 20 22 2d 63 5c 30 22 20 64 72 6f 70 20 2c 0a    "-c\0" drop ,.
0f50: 09 20 20 20 20 22 69 6d 2e 72 65 63 65 69 76 65  .    "im.receive
0f60: 64 5c 30 22 20 64 72 6f 70 20 2c 0a 09 20 20 20  d\0" drop ,..   
0f70: 20 6e 65 74 32 6f 2d 6c 6f 67 6f 20 24 40 6c 65   net2o-logo $@le
0f80: 6e 20 5b 49 46 5d 0a 09 09 22 2d 69 5c 30 22 20  n [IF]..."-i\0" 
0f90: 64 72 6f 70 20 2c 0a 09 09 6e 65 74 32 6f 2d 6c  drop ,...net2o-l
0fa0: 6f 67 6f 20 24 40 20 30 73 74 72 69 6e 67 20 2c  ogo $@ 0string ,
0fb0: 0a 09 20 20 20 20 5b 54 48 45 4e 5d 0a 09 20 20  ..    [THEN]..  
0fc0: 20 20 68 65 72 65 20 30 20 2c 0a 09 20 20 20 20    here 0 ,..    
0fd0: 68 65 72 65 20 30 20 2c 0a 09 20 20 20 20 30 20  here 0 ,..    0 
0fe0: 2c 20 5c 20 6d 75 73 74 20 62 65 20 74 65 72 6d  , \ must be term
0ff0: 69 6e 61 74 65 64 20 62 79 20 6e 75 6c 6c 20 70  inated by null p
1000: 6f 69 6e 74 65 72 0a 09 20 20 20 20 43 6f 6e 73  ointer..    Cons
1010: 74 61 6e 74 20 63 6f 6e 74 65 6e 74 2d 73 74 72  tant content-str
1020: 69 6e 67 0a 09 20 20 20 20 43 6f 6e 73 74 61 6e  ing..    Constan
1030: 74 20 74 69 74 6c 65 2d 73 74 72 69 6e 67 0a 09  t title-string..
1040: 20 20 20 20 0a 09 20 20 20 20 3a 20 6c 69 6e 75      ..    : linu
1050: 78 2d 6e 6f 74 69 66 69 63 61 74 69 6f 6e 20 28  x-notification (
1060: 20 2d 2d 20 29 20 20 6e 6f 74 69 66 79 2d 73 65   -- )  notify-se
1070: 6e 64 20 24 40 6c 65 6e 20 30 3d 20 3f 45 58 49  nd $@len 0= ?EXI
1080: 54 0a 09 09 74 69 74 6c 65 2d 73 74 72 69 6e 67  T...title-string
1090: 20 30 20 3f 66 72 65 65 20 20 63 6f 6e 74 65 6e   0 ?free  conten
10a0: 74 2d 73 74 72 69 6e 67 20 30 20 3f 66 72 65 65  t-string 0 ?free
10b0: 0a 09 09 5b 27 5d 20 6e 6f 74 69 66 79 2d 74 69  ...['] notify-ti
10c0: 74 6c 65 20 24 74 6d 70 20 30 73 74 72 69 6e 67  tle $tmp 0string
10d0: 20 74 69 74 6c 65 2d 73 74 72 69 6e 67 20 21 0a   title-string !.
10e0: 09 09 6e 6f 74 69 66 79 40 20 30 73 74 72 69 6e  ..notify@ 0strin
10f0: 67 20 63 6f 6e 74 65 6e 74 2d 73 74 72 69 6e 67  g content-string
1100: 20 21 0a 09 09 6e 6f 74 69 66 79 2d 73 65 6e 64   !...notify-send
1110: 20 24 40 20 6e 6f 74 69 66 79 2d 61 72 67 73 20   $@ notify-args 
1120: 66 6f 72 6b 2b 65 78 65 63 20 3b 0a 09 5b 45 4c  fork+exec ;..[EL
1130: 53 45 5d 0a 09 20 20 20 20 3a 20 6c 69 6e 75 78  SE]..    : linux
1140: 2d 6e 6f 74 69 66 69 63 61 74 69 6f 6e 20 28 20  -notification ( 
1150: 2d 2d 20 29 20 5c 20 73 68 65 6c 6c 20 73 63 72  -- ) \ shell scr
1160: 69 70 74 20 62 61 73 65 64 0a 09 09 5b 20 73 22  ipt based...[ s"
1170: 20 77 68 69 63 68 20 6e 6f 74 69 66 79 2d 73 65   which notify-se
1180: 6e 64 20 3e 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e  nd >/dev/null 2>
1190: 2f 64 65 76 2f 6e 75 6c 6c 22 20 73 79 73 74 65  /dev/null" syste
11a0: 6d 0a 09 09 24 3f 20 30 3d 20 5d 20 5b 49 46 5d  m...$? 0= ] [IF]
11b0: 0a 09 09 20 20 20 20 5b 3a 20 2e 5c 22 20 6e 6f  ...    [: .\" no
11c0: 74 69 66 79 2d 73 65 6e 64 20 2d 61 20 6e 65 74  tify-send -a net
11d0: 32 6f 20 2d 63 20 69 6d 2e 72 65 63 65 69 76 65  2o -c im.receive
11e0: 64 20 22 0a 09 09 09 5b 20 73 22 20 64 6f 63 2f  d "....[ s" doc/
11f0: 6e 65 74 32 6f 2d 6c 6f 67 6f 2e 70 6e 67 22 20  net2o-logo.png" 
1200: 6f 70 65 6e 2d 66 70 61 74 68 2d 66 69 6c 65 20  open-fpath-file 
1210: 30 3d 20 5d 20 5b 49 46 5d 0a 09 09 09 20 20 20  0= ] [IF]....   
1220: 20 2e 22 20 2d 69 20 22 20 5b 20 6f 76 65 72 20   ." -i " [ over 
1230: 63 40 20 27 2f 27 20 3c 3e 20 5b 49 46 5d 0a 09  c@ '/' <> [IF]..
1240: 09 09 09 70 61 64 20 24 32 30 30 20 67 65 74 2d  ...pad $200 get-
1250: 64 69 72 20 5d 20 73 6c 69 74 65 72 61 6c 20 74  dir ] sliteral t
1260: 79 70 65 20 2e 22 20 2f 22 20 5b 0a 09 09 09 20  ype ." /" [.... 
1270: 20 20 20 5b 54 48 45 4e 5d 0a 09 09 09 20 20 20     [THEN]....   
1280: 20 5d 20 73 6c 69 74 65 72 61 6c 20 27 74 79 70   ] sliteral 'typ
1290: 65 27 20 5b 20 63 6c 6f 73 65 2d 66 69 6c 65 20  e' [ close-file 
12a0: 74 68 72 6f 77 20 5d 0a 09 09 09 5b 54 48 45 4e  throw ]....[THEN
12b0: 5d 0a 09 09 09 2e 22 20 20 27 22 20 6e 6f 74 69  ]....."  '" noti
12c0: 66 79 2d 74 69 74 6c 65 20 2e 22 20 27 20 22 20  fy-title ." ' " 
12d0: 0a 09 09 09 6e 6f 74 69 66 79 40 20 27 74 79 70  ....notify@ 'typ
12e0: 65 27 20 3b 5d 20 24 74 6d 70 20 73 79 73 74 65  e' ;] $tmp syste
12f0: 6d 0a 09 09 5b 54 48 45 4e 5d 20 3b 0a 09 5b 54  m...[THEN] ;..[T
1300: 48 45 4e 5d 0a 20 20 20 20 5b 54 48 45 4e 5d 0a  HEN].    [THEN].
1310: 09 0a 20 20 20 20 3a 20 73 68 6f 77 2d 6e 6f 74  ..    : show-not
1320: 69 66 69 63 61 74 69 6f 6e 20 28 20 2d 2d 20 29  ification ( -- )
1330: 0a 09 31 20 70 65 6e 64 69 6e 67 2d 6e 6f 74 69  ..1 pending-noti
1340: 66 69 63 61 74 69 6f 6e 73 20 2b 21 0a 09 5b 49  fications +!..[I
1350: 46 44 45 46 5d 20 6c 69 6e 75 78 2d 6e 6f 74 69  FDEF] linux-noti
1360: 66 69 63 61 74 69 6f 6e 0a 09 20 20 20 20 6c 69  fication..    li
1370: 6e 75 78 2d 6e 6f 74 69 66 69 63 61 74 69 6f 6e  nux-notification
1380: 0a 09 5b 54 48 45 4e 5d 20 3b 0a 20 20 20 20 3a  ..[THEN] ;.    :
1390: 20 6d 73 67 2d 62 75 69 6c 64 65 72 20 3b 0a 20   msg-builder ;. 
13a0: 20 20 20 5b 49 46 55 4e 44 45 46 5d 20 72 65 6e     [IFUNDEF] ren
13b0: 64 65 72 69 6e 67 0a 09 56 61 72 69 61 62 6c 65  dering..Variable
13c0: 20 72 65 6e 64 65 72 69 6e 67 20 20 2d 31 20 72   rendering  -1 r
13d0: 65 6e 64 65 72 69 6e 67 20 21 0a 20 20 20 20 5b  endering !.    [
13e0: 54 48 45 4e 5d 0a 20 20 20 20 61 6c 73 6f 20 61  THEN].    also a
13f0: 6c 73 6f 0a 5b 54 48 45 4e 5d 0a 0a 3a 20 6d 73  lso.[THEN]..: ms
1400: 67 2d 6e 6f 74 69 66 79 20 28 20 2d 2d 20 29 20  g-notify ( -- ) 
1410: 6e 6f 74 69 66 79 3e 0a 20 20 20 20 74 69 63 6b  notify>.    tick
1420: 73 20 74 6f 20 6c 61 74 65 73 74 2d 6e 6f 74 69  s to latest-noti
1430: 66 79 0a 20 20 20 20 72 65 6e 64 65 72 69 6e 67  fy.    rendering
1440: 20 40 20 6e 6f 74 69 66 79 3f 20 40 20 3c 3d 20   @ notify? @ <= 
1450: 64 75 70 20 49 46 0a 09 6e 6f 74 69 66 79 2d 0a  dup IF..notify-.
1460: 20 20 20 20 54 48 45 4e 0a 20 20 20 20 74 69 63      THEN.    tic
1470: 6b 2d 6e 6f 74 69 66 79 3f 20 6f 72 20 30 3d 20  k-notify? or 0= 
1480: 49 46 0a 09 62 75 69 6c 64 2d 6e 6f 74 69 66 69  IF..build-notifi
1490: 63 61 74 69 6f 6e 20 73 68 6f 77 2d 6e 6f 74 69  cation show-noti
14a0: 66 69 63 61 74 69 6f 6e 0a 09 74 69 63 6b 73 20  fication..ticks 
14b0: 74 6f 20 6c 61 73 74 2d 6e 6f 74 69 66 79 0a 20  to last-notify. 
14c0: 20 20 20 54 48 45 4e 20 20 6e 6f 74 69 66 79 24     THEN  notify$
14d0: 20 24 6f 66 66 20 3b 0a 0a 70 72 65 76 69 6f 75   $off ;..previou
14e0: 73 20 70 72 65 76 69 6f 75 73 0a 0a 30 20 5b 49  s previous..0 [I
14f0: 46 5d 0a 4c 6f 63 61 6c 20 56 61 72 69 61 62 6c  F].Local Variabl
1500: 65 73 3a 0a 66 6f 72 74 68 2d 6c 6f 63 61 6c 2d  es:.forth-local-
1510: 77 6f 72 64 73 3a 0a 20 20 20 20 28 0a 20 20 20  words:.    (.   
1520: 20 20 28 28 22 6e 65 74 32 6f 3a 22 20 22 2b 6e    (("net2o:" "+n
1530: 65 74 32 6f 3a 22 29 20 64 65 66 69 6e 69 74 69  et2o:") definiti
1540: 6f 6e 2d 73 74 61 72 74 65 72 20 28 66 6f 6e 74  on-starter (font
1550: 2d 6c 6f 63 6b 2d 6b 65 79 77 6f 72 64 2d 66 61  -lock-keyword-fa
1560: 63 65 20 2e 20 31 29 0a 20 20 20 20 20 20 22 5b  ce . 1).      "[
1570: 20 5c 74 5c 6e 5d 22 20 74 20 6e 61 6d 65 20 28   \t\n]" t name (
1580: 66 6f 6e 74 2d 6c 6f 63 6b 2d 66 75 6e 63 74 69  font-lock-functi
1590: 6f 6e 2d 6e 61 6d 65 2d 66 61 63 65 20 2e 20 33  on-name-face . 3
15a0: 29 29 0a 20 20 20 20 20 28 22 5b 61 2d 7a 30 2d  )).     ("[a-z0-
15b0: 39 5d 2b 28 22 20 69 6d 6d 65 64 69 61 74 65 20  9]+(" immediate 
15c0: 28 66 6f 6e 74 2d 6c 6f 63 6b 2d 63 6f 6d 6d 65  (font-lock-comme
15d0: 6e 74 2d 66 61 63 65 20 2e 20 31 29 0a 20 20 20  nt-face . 1).   
15e0: 20 20 20 22 29 22 20 6e 69 6c 20 63 6f 6d 6d 65     ")" nil comme
15f0: 6e 74 20 28 66 6f 6e 74 2d 6c 6f 63 6b 2d 63 6f  nt (font-lock-co
1600: 6d 6d 65 6e 74 2d 66 61 63 65 20 2e 20 31 29 29  mment-face . 1))
1610: 0a 20 20 20 20 29 0a 66 6f 72 74 68 2d 6c 6f 63  .    ).forth-loc
1620: 61 6c 2d 69 6e 64 65 6e 74 2d 77 6f 72 64 73 3a  al-indent-words:
1630: 0a 20 20 20 20 28 0a 20 20 20 20 20 28 28 22 6e  .    (.     (("n
1640: 65 74 32 6f 3a 22 20 22 2b 6e 65 74 32 6f 3a 22  et2o:" "+net2o:"
1650: 29 20 28 30 20 2e 20 32 29 20 28 30 20 2e 20 32  ) (0 . 2) (0 . 2
1660: 29 20 6e 6f 6e 2d 69 6d 6d 65 64 69 61 74 65 29  ) non-immediate)
1670: 0a 20 20 20 20 29 0a 45 6e 64 3a 0a 5b 54 48 45  .    ).End:.[THE
1680: 4e 5d                                            N]