text: 1.1 pazsan 1: \ VI tags support for GNU Forth. 2: 1.3 ! anton 3: \ Copyright (C) 1995,1998,2002 Free Software Foundation, Inc. 1.1 pazsan: 1.2 anton 21: \ usage: gforth tags.fs your_files.fs ... 22: \ then: vi -t word_name 1.1 pazsan 23: 24: \ This does not work like etags; instead, the TAGS file is updated 25: \ during the normal Forth interpretation/compilation process. 26: 27: \ The present version has several shortcomings: It always overwrites 28: \ the TAGS file instead of just the parts corresponding to the loaded 29: \ files, but you can have several tag tables in emacs. Every load 30: \ creates a new etags file and the user has to confirm that she wants 31: \ to use it. 32: 33: \ Communication of interactive programs like emacs and Forth over 34: \ files is clumsy. There should be better cooperation between them 35: \ (e.g. via shared memory) 36: 37: \ This is ANS Forth with the following serious environmental 38: \ dependences: the variable LAST must contain a pointer to the last 39: \ header, NAME>STRING must convert that pointer to a string, and 40: \ HEADER must be a deferred word that is called to create the name. 41: 42: \ Changes by David: Removed the blanks before and after the explicit 43: \ tag name, since that conflicts with Emacs' auto-completition. In 44: \ fact those blanks are not necessary, since search is performed on 45: \ the tag-text, rather than the tag name. 46: 1.2 anton 47: \ Changes by Erik Rossen: Reversed the order of the tagname and tagfile 48: \ and got rid of the trailing "$" in the address regexp. I also needed 49: \ to comment out search.fs since it sets the search order destructively 50: \ on my system. Added a bit more explanation on how to use tags.fs. 51: 52: \ require search.fs 1.1 pazsan 53: require extend.fs 54: 55: : tags-file-name ( -- c-addr u ) 56: \ for now I use just tags; this may become more flexible in the 57: \ future 58: s" tags" ; 59: 60: variable tags-file 0 tags-file ! 61: 62: create tags-line 128 chars allot 63: 64: : skip-tags ( file-id -- ) 65: \ reads in file until it finds the end or the loadfilename 66: drop ; 67: 68: : tags-file-id ( -- file-id ) 69: tags-file @ 0= if: last @ 0<> and \ not an anonymous (i.e. noname) header 95: if 96: tags-file-id >r 97: last @ name>string r@ write-file throw 98: #tab r@ emit-file throw 1.2 anton 99: r@ put-load-file-name 1.1 pazsan 100: s" /^" r@ write-file throw 101: source drop >in @ r@ write-file throw 1.2 anton 102: s" /" r@ write-line throw 1.1 pazsan 103: rdrop 104: endif ; 105: 106: : (tags-header) ( -- ) 107: defers header 108: put-tags-entry ; 109: 110: ' (tags-header) IS header