| 1 |
#|{overview}| |
|---|
| 2 |
# |
|---|
| 3 |
# General HLL overview of WoC |
|---|
| 4 |
# |
|---|
| 5 |
# |
|---|
| 6 |
# -- |
|---|
| 7 |
# |
|---|
| 8 |
# To know what a `HLL overview' is, see: |
|---|
| 9 |
# http://idiki.dyne.org/wiki/HLL_overview |
|---|
| 10 |
# |
|---|
| 11 |
|
|---|
| 12 |
The full tag syntax is: |
|---|
| 13 |
|
|---|
| 14 |
RMT/TAG:VICMD"TAGCMD |
|---|
| 15 |
|
|---|
| 16 |
Read {-doc/woc_protocol:"fj-} for more information. |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
If the tag is activated (clicked): |
|---|
| 20 |
|
|---|
| 21 |
* Download tags files (cscope.out, tags, tags.woc, ...) from RMT (the |
|---|
| 22 |
remote host) |
|---|
| 23 |
|
|---|
| 24 |
* Download also index.woc from RMT, loading the options |
|---|
| 25 |
|
|---|
| 26 |
* Execute the TAGCMD on TAG. The result will be the pair [pfile, pline] |
|---|
| 27 |
where |
|---|
| 28 |
pfile = the file where the TAG resides |
|---|
| 29 |
pline = the line where the TAG resides |
|---|
| 30 |
|
|---|
| 31 |
* Download pfile from RMT and open it |
|---|
| 32 |
|
|---|
| 33 |
* Go to line pline |
|---|
| 34 |
|
|---|
| 35 |
* Execute VICMD as a vim command |
|---|
| 36 |
|
|---|
| 37 |
# |
|---|
| 38 |
# Detailed overview |
|---|
| 39 |
# |
|---|
| 40 |
|
|---|
| 41 |
* On file open "/path/file": |
|---|
| 42 |
|
|---|
| 43 |
call {-WOCOpenFile-} { |
|---|
| 44 |
|
|---|
| 45 |
if exists "/path/index.woc", |
|---|
| 46 |
call {-WOCLoadIndex-} { |
|---|
| 47 |
|
|---|
| 48 |
load /path/index.woc |
|---|
| 49 |
load options from index.woc |
|---|
| 50 |
load aliases from options, overwrite current aliases |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
else |
|---|
| 54 |
call {-WOCInitialize-}: |
|---|
| 55 |
|
|---|
| 56 |
load default options |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
# Load the WoC tag files and tell Vim to consider them |
|---|
| 60 |
load /path/tags.woc[.gz] |
|---|
| 61 |
set tagf+=/path/tags.woc |
|---|
| 62 |
load /path/tags.rev.woc[.gz] |
|---|
| 63 |
|
|---|
| 64 |
# If the opened file is located in the woc cache, then the user has |
|---|
| 65 |
# probably jumped on a remote tag. We have to download this file. |
|---|
| 66 |
if "/path/" =~ "~woc/cache/\(\w+\)/" : |
|---|
| 67 |
call {-WOCOpenFile:/wocdownloader-} { |
|---|
| 68 |
|
|---|
| 69 |
# The name of the directories inside the woc cache is the |
|---|
| 70 |
# md5 of their associated URL |
|---|
| 71 |
url_md5=\1 # \1 is the match from the above regexp |
|---|
| 72 |
cd /path |
|---|
| 73 |
|
|---|
| 74 |
# s:woc_cache_url containes the mapping md5 --> URL |
|---|
| 75 |
load RURL from s:woc_cache_url[url_md5] |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
download "file" from RURL |
|---|
| 79 |
open "file" |
|---|
| 80 |
} |
|---|
| 81 |
} |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
* On JumpOnTag, if tag ~= TAG[:VICMD] : |
|---|
| 85 |
# Just a local Tag. Mimic the normal Vim behaviour |
|---|
| 86 |
local jump/cscope on TAG |
|---|
| 87 |
exec VICMD |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
* On JumpOnTag, if tag ~= RMT/TAG:[VICMD"TAGCMD: |
|---|
| 91 |
# A remote tag |
|---|
| 92 |
|
|---|
| 93 |
call {-WOCLoadRemote-} { |
|---|
| 94 |
|
|---|
| 95 |
rurl = expand alias from RMT |
|---|
| 96 |
rdir = ~woc/cache/`md5sum rurl`/ |
|---|
| 97 |
|
|---|
| 98 |
cd rdir |
|---|
| 99 |
call {-wocdownloader:"fj-} { |
|---|
| 100 |
get rurl/index.woc |
|---|
| 101 |
get rurl/tags.woc |
|---|
| 102 |
get rurl/tags.rev.woc |
|---|
| 103 |
get rurl/tags_file |
|---|
| 104 |
} |
|---|
| 105 |
|
|---|
| 106 |
# CDing to rurl/ will cause Vim to consider the downloaded tags files. |
|---|
| 107 |
cd rurl/ |
|---|
| 108 |
} |
|---|
| 109 |
|
|---|
| 110 |
save rurl in {-woc_cache_url-} |
|---|
| 111 |
|
|---|
| 112 |
jump/cscope on TAG |
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
* On vim quit: |
|---|
| 116 |
if g:woc_clear_cache is set: |
|---|
| 117 |
|
|---|
| 118 |
call {-WOCClearCache-} : |
|---|
| 119 |
rm -r ~woc/cache/* |
|---|