Hello, Here's the main utility word:
monitor-file ( file quot -- ) 'quot' is called when 'file' is changed. 'quot' is passed a "file system change descriptor". The monitoring happens in a separate thread. If 'quot' throws an error, monitoring continues because 'quot' is run via 'try'. The 'quot' is run for any kind of change. Here's a word which only runs the quot when the file is modified: on-modify ( file quot -- ) Now I can make this word: file-variable ( file var -- ) Whenever the 'file' is modified, the file contents are evaluated and the resulting value is stored in the variable 'var'. If there are multiple expressions in the file, the result of evaluating the last one is used as the value. Parsing errors are handled; the old variable value is preserved. Here's an example: "/tmp/tbl" tbl file-variable Set the contents to: 20 tbl get . 20 Set the contents to: { An error appears in the listener. The old value is retained: tbl get . 20 Set the contents to: { 10 20 30 } tbl get . { 10 20 30 } Implementation is at: http://paste.factorcode.org/responder/pastebin/show-paste?n=36 Ed ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk