mirror of
1
0
Fork 0

add various usefull plugins from vim.org and sourfeforge

This commit is contained in:
hustcalm 2012-10-21 01:04:08 +08:00
parent eb40e8aa1a
commit 90acee7e47
407 changed files with 171529 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,436 @@
# voom_mode_asciidoc.py
# Last Modified: 2012-04-02
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for AsciiDoc document and section titles.
See |voom_mode_asciidoc|, ../../doc/voom.txt#*voom_mode_asciidoc*
"""
### NOTES
#
# When outline operation changes level, it has to deal with two ambiguities:
# a) Level 1-5 headline can use 2-style (underline) or 1-style (=).
# b) 1-style can have or not have closing ='s.
# To determine current preferences: check first headline at level <6 and check
# first headline with =. This must be done in hook_makeOutline().
# (Save in VO, similar to reST mode.) Cannot be done during outline operation,
# that is in hook_doBodyAfterOop().
# Defaults: use underline, use closing ='s.
try:
import vim
if vim.eval('exists("g:voom_asciidoc_do_blanks")')=='1' and vim.eval("g:voom_asciidoc_do_blanks")=='0':
DO_BLANKS = False
else:
DO_BLANKS = True
except ImportError:
DO_BLANKS = True
import re
# regex for 1-style headline, assumes there is no trailing whitespace
HEAD_MATCH = re.compile(r'^(=+)(\s+\S.*?)(\s+\1)?$').match
# underline chars
ADS_LEVELS = {'=':1, '-':2, '~':3, '^':4, '+':5}
LEVELS_ADS = {1:'=', 2:'-', 3:'~', 4:'^', 5:'+'}
# DelimitedBlock chars, headines are ignored inside such blocks
BLOCK_CHARS = {'/':0, '+':0, '-':0, '.':0, '*':0, '_':0, '=':0}
# Combine all signficant chars. Need one of these at start of line for a
# headline or DelimitedBlock to occur.
CHARS = {}
for k in ADS_LEVELS:
CHARS[k] = 0
for k in BLOCK_CHARS:
CHARS[k] = 0
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
ENC = VO.enc
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
# trailing whitespace is always removed with rstrip()
# if headline is precedeed by [AAA] and/or [[AAA]], bnode is set to their lnum
#
# 1-style, overides 2-style
# [[AAA]] L3, blines[i-2]
# [yyy] L2, blines[i-1]
# == head == L1, blines[i] -- current line, closing = are optional
#
# 2-style (underline)
# [[AAA]] L4, blines[i-3]
# [yyy] L3, blines[i-2]
# head L2, blines[i-1] -- title line, many restrictions on the format
# ---- L1, blines[i] -- current line
# Set this the first time a headline with level 1-5 is encountered.
# 0 or 1 -- False, use 2-style (default); 2 -- True, use 1-style
useOne = 0
# Set this the first time headline in 1-style is encountered.
# 0 or 1 -- True, use closing ='s (default); 2 -- False, do not use closing ='s
useOneClose = 0
gotHead = False
inBlock = False # True if inside DelimitedBlock, the value is the char
headI = -2 # idx of the last line that is part of a headline
blockI = -2 # idx of the last line where a DelimitedBlock ended
m = None # match object for 1-style regex
for i in xrange(Z):
L1 = blines[i].rstrip()
if not L1 or not L1[0] in CHARS:
continue
ch = L1[0]
if inBlock:
if inBlock==ch and len(L1)>3 and L1.lstrip(ch)=='':
inBlock = False
blockI = i
continue
# 1-style headline
if ch == '=' and L1.strip('='):
m = HEAD_MATCH(L1)
if m:
gotHead = True
headI_ = headI
headI = i
lev = len(m.group(1))
head = m.group(2).strip()
bnode = i+1
# current line is an underline
# the previous, underlined line (L2) is not a headline if it:
# is not exactly the length of underline +/- 2
# is already part of in the previous headline
# looks like an underline or a delimited block line
# is [[AAA]] or [AAA] (BlockID or Attribute List)
# starts with . (Block Title, they have no level)
# starts with // (comment line)
# starts with tab (don't know why, spaces are ok)
# is only 1 chars (avoids confusion with --, as in Vim syntax, not as in AsciiDoc)
if not gotHead and ch in ADS_LEVELS and L1.lstrip(ch)=='' and i > 0:
L2 = blines[i-1].rstrip()
z2 = len(L2.decode(ENC,'replace'))
z1 = len(L1)
if (L2 and
(-3 < z2 - z1 < 3) and z1 > 1 and z2 > 1 and
headI != i-1 and
not ((L2[0] in CHARS) and L2.lstrip(L2[0])=='') and
not (L2.startswith('[') and L2.endswith(']')) and
not L2.startswith('.') and
not L2.startswith('\t') and
not (L2.startswith('//') and not L2.startswith('///'))
):
gotHead = True
headI_ = headI
headI = i
lev = ADS_LEVELS[ch]
head = L2.strip()
bnode = i # lnum of previous line (L2)
if gotHead and bnode > 1:
# decrement bnode if preceding lines are [[AAA]] or [AAA] lines
# that is set bnode to the topmost [[AAA]] or [AAA] line number
j_ = bnode-2 # idx of line before the title line
L3 = blines[bnode-2].rstrip()
while L3.startswith('[') and L3.endswith(']'):
bnode -= 1
if bnode > 1:
L3 = blines[bnode-2].rstrip()
else:
break
# headline must be preceded by a blank line unless:
# it's line 1 (j == -1)
# headline is preceded by [AAA] or [[AAA]] lines (j != j_)
# previous line is a headline (headI_ == j)
# previous line is the end of a DelimitedBlock (blockI == j)
j = bnode-2
if DO_BLANKS and j==j_ and j > -1:
L3 = blines[j].rstrip()
if L3 and headI_ != j and blockI != j:
# skip over any adjacent comment lines
while L3.startswith('//') and not L3.startswith('///'):
j -= 1
if j > -1:
L3 = blines[j].rstrip()
else:
L3 = ''
if L3 and headI_ != j and blockI != j:
gotHead = False
headI = headI_
# start of DelimitedBlock
if not gotHead and ch in BLOCK_CHARS and len(L1)>3 and L1.lstrip(ch)=='':
inBlock = ch
continue
if gotHead:
gotHead = False
# save style info for first headline and first 1-style headline
if not useOne and lev < 6:
if m:
useOne = 2
else:
useOne = 1
if not useOneClose and m:
if m.group(3):
useOneClose = 1
else:
useOneClose = 2
# make outline
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(bnode)
levels_add(lev)
# don't clobber these when parsing clipboard during Paste
# which is the only time blines is not Body
if blines is VO.Body:
VO.useOne = useOne == 2
VO.useOneClose = useOneClose < 2
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
if level < 6 and not VO.useOne:
bodyLines = [tree_head, LEVELS_ADS[level]*11, '']
else:
lev = '='*level
if VO.useOneClose:
bodyLines = ['%s %s %s' %(lev, tree_head, lev), '']
else:
bodyLines = ['%s %s' %(lev, tree_head), '']
# Add blank line when inserting after non-blank Body line.
if VO.Body[blnum-1].strip():
bodyLines[0:0] = ['']
return (tree_head, bodyLines)
#def hook_changeLevBodyHead(VO, h, levDelta):
# DO NOT CREATE THIS HOOK
def hook_doBodyAfterOop(VO, oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, blnumCut, tlnumCut):
# this is instead of hook_changeLevBodyHead()
# Based on Markdown mode function.
# Inserts blank separator lines if missing.
#print oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, tlnumCut, blnumCut
Body = VO.Body
Z = len(Body)
bnodes, levels = VO.bnodes, VO.levels
ENC = VO.enc
# blnum1 blnum2 is first and last lnums of Body region pasted, inserted
# during up/down, or promoted/demoted.
if blnum1:
assert blnum1 == bnodes[tlnum1-1]
if tlnum2 < len(bnodes):
assert blnum2 == bnodes[tlnum2]-1
else:
assert blnum2 == Z
# blnumCut is Body lnum after which a region was removed during 'cut',
# 'up', 'down'. Need this to check if there is blank line between nodes
# used to be separated by the cut/moved region.
if blnumCut:
if tlnumCut < len(bnodes):
assert blnumCut == bnodes[tlnumCut]-1
else:
assert blnumCut == Z
# Total number of added lines minus number of deleted lines.
b_delta = 0
### After 'cut' or 'up': insert blank line if there is none
# between the nodes used to be separated by the cut/moved region.
if DO_BLANKS and (oop=='cut' or oop=='up') and (0 < blnumCut < Z) and Body[blnumCut-1].strip():
Body[blnumCut:blnumCut] = ['']
update_bnodes(VO, tlnumCut+1 ,1)
b_delta+=1
if oop=='cut':
return
### Make sure there is blank line after the last node in the region:
# insert blank line after blnum2 if blnum2 is not blank, that is insert
# blank line before bnode at tlnum2+1.
if DO_BLANKS and blnum2 < Z and Body[blnum2-1].strip():
Body[blnum2:blnum2] = ['']
update_bnodes(VO, tlnum2+1 ,1)
b_delta+=1
### Change levels and/or formats of headlines in the affected region.
# Always do this after Paste, even if level is unchanged -- format can
# be different when pasting from other outlines.
# Examine each headline, from bottom to top, and change level and/or format.
# To change from 1-style to 2-style:
# strip ='s, strip whitespace;
# insert underline.
# To change from 2-style to 1-style:
# delete underline;
# insert ='s.
# Update bnodes after inserting or deleting a line.
#
# NOTE: bnode can be [[AAA]] or [AAA] line, we check for that and adjust it
# to point to the headline text line
#
# 1-style 2-style
#
# L0 L0 Body[bln-2]
# == head L1 head L1 <--bnode Body[bln-1] (not always the actual bnode)
# L2 ---- L2 Body[bln]
# L3 L3 Body[bln+1]
if levDelta or oop=='paste':
for i in xrange(tlnum2, tlnum1-1, -1):
# required level (VO.levels has been updated)
lev = levels[i-1]
# current level from which to change to lev
lev_ = lev - levDelta
# Body headline (bnode) and the next line
bln = bnodes[i-1]
L1 = Body[bln-1].rstrip()
# bnode can point to the tompost [AAA] or [[AAA]] line
# increment bln until the actual headline (title line) is found
while L1.startswith('[') and L1.endswith(']'):
bln += 1
L1 = Body[bln-1].rstrip()
# the underline line
if bln+1 < len(Body):
L2 = Body[bln].rstrip()
else:
L2 = ''
# get current headline format
hasOne, hasOneClose = False, VO.useOneClose
theHead = L1
if L1.startswith('='):
m = HEAD_MATCH(L1)
if m:
hasOne = True
# headline without ='s but with whitespace around it preserved
theHead = m.group(2)
theclose = m.group(3)
if theclose:
hasOneClose = True
theHead += theclose.rstrip('=')
else:
hasOneClose = False
# get desired headline format
if oop=='paste':
if lev > 5:
useOne = True
else:
useOne = VO.useOne
useOneClose = VO.useOneClose
elif lev < 6 and lev_ < 6:
useOne = hasOne
useOneClose = hasOneClose
elif lev > 5 and lev_ > 5:
useOne = True
useOneClose = hasOneClose
elif lev < 6 and lev_ > 5:
useOne = VO.useOne
useOneClose = VO.useOneClose
elif lev > 5 and lev_ < 6:
useOne = True
useOneClose = hasOneClose
else:
assert False
#print useOne, hasOne, ';', useOneClose, hasOneClose
### change headline level and/or format
# 2-style unchanged, only adjust level of underline
if not useOne and not hasOne:
if not levDelta: continue
Body[bln] = LEVELS_ADS[lev]*len(L2)
# 1-style unchanged, adjust level of ='s and add/remove closing ='s
elif useOne and hasOne:
# no format change, there are closing ='s
if useOneClose and hasOneClose:
if not levDelta: continue
Body[bln-1] = '%s%s%s' %('='*lev, theHead, '='*lev)
# no format change, there are no closing ='s
elif not useOneClose and not hasOneClose:
if not levDelta: continue
Body[bln-1] = '%s%s' %('='*lev, theHead)
# add closing ='s
elif useOneClose and not hasOneClose:
Body[bln-1] = '%s%s %s' %('='*lev, theHead.rstrip(), '='*lev)
# remove closing ='s
elif not useOneClose and hasOneClose:
Body[bln-1] = '%s%s' %('='*lev, theHead.rstrip())
# insert underline, remove ='s
elif not useOne and hasOne:
L1 = theHead.strip()
Body[bln-1] = L1
# insert underline
Body[bln:bln] = [LEVELS_ADS[lev]*len(L1.decode(ENC,'replace'))]
update_bnodes(VO, i+1, 1)
b_delta+=1
# remove underline, insert ='s
elif useOne and not hasOne:
if useOneClose:
Body[bln-1] = '%s %s %s' %('='*lev, theHead.strip(), '='*lev)
else:
Body[bln-1] = '%s %s' %('='*lev, theHead.strip())
# delete underline
Body[bln:bln+1] = []
update_bnodes(VO, i+1, -1)
b_delta-=1
### Make sure first headline is preceded by a blank line.
blnum1 = bnodes[tlnum1-1]
if DO_BLANKS and blnum1 > 1 and Body[blnum1-2].strip():
Body[blnum1-1:blnum1-1] = ['']
update_bnodes(VO, tlnum1 ,1)
b_delta+=1
### After 'down' : insert blank line if there is none
# between the nodes used to be separated by the moved region.
if DO_BLANKS and oop=='down' and (0 < blnumCut < Z) and Body[blnumCut-1].strip():
Body[blnumCut:blnumCut] = ['']
update_bnodes(VO, tlnumCut+1 ,1)
b_delta+=1
assert len(Body) == Z + b_delta
def update_bnodes(VO, tlnum, delta):
"""Update VO.bnodes by adding/substracting delta to each bnode
starting with bnode at tlnum and to the end.
"""
bnodes = VO.bnodes
for i in xrange(tlnum, len(bnodes)+1):
bnodes[i-1] += delta

View File

@ -0,0 +1,72 @@
# voom_mode_cwiki.py
# Last Modified: 2011-10-30
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for cwiki Vim plugin. Contributed by Craig B. Allen.
http://www.vim.org/scripts/script.php?script_id=2176
See |voom_mode_various|, ../../doc/voom.txt#*voom_mode_various*
+++ headline level 1
some text
++++ headline level 2
more text
+++++ headline level 3
++++++ headline level 4
etc.
First + must be at start of line. Whitespace after the last + is optional.
"""
import re
headline_match = re.compile(r'^\+\+(\++)').match
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
for i in xrange(Z):
if not blines[i].startswith('+'):
continue
bline = blines[i]
m = headline_match(bline)
if not m:
continue
lev = len(m.group(1))
head = bline[2+lev:].strip()
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['++%s %s' %('+'*level, tree_head), '']
return (tree_head, bodyLines)
def hook_changeLevBodyHead(VO, h, levDelta):
"""Increase of decrease level number of Body headline by levDelta."""
if levDelta==0: return h
m = headline_match(h)
level = len(m.group(1))
return '++%s%s' %('+'*(level+levDelta), h[m.end(1):])

View File

@ -0,0 +1,18 @@
# voom_mode_fmr1.py
# Last Modified: 2012-02-25
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
This mode changes absolutely nothing, it is identical to the default mode.
See |voom_mode_fmr|, ../../doc/voom.txt#*voom_mode_fmr*
"""
# Define this mode as an 'fmr' mode.
MODE_FMR = True

View File

@ -0,0 +1,63 @@
# voom_mode_fmr1.py
# Last Modified: 2012-02-25
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for start fold markers with levels.
Similar to the default mode, that is the :Voom command.
See |voom_mode_fmr|, ../../doc/voom.txt#*voom_mode_fmr*
headline level 1 {{{1
some text
headline level 2 {{{2
more text
"""
# Define this mode as an 'fmr' mode.
MODE_FMR = True
# voom.makeoutline() without char stripping
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
marker = VO.marker
marker_re_search = VO.marker_re.search
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
#c = VO.rstrip_chars
for i in xrange(Z):
if not marker in blines[i]: continue
bline = blines[i]
m = marker_re_search(bline)
if not m: continue
lev = int(m.group(1))
#head = bline[:m.start()].lstrip().rstrip(c).strip('-=~').strip()
head = bline[:m.start()].strip()
tline = ' %s%s|%s' %(m.group(2) or ' ', '. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
# same as voom.newHeadline() but without ---
def hook_newHeadline(VO, level, blnum, ln):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
#bodyLines = ['---%s--- %s%s' %(tree_head, VO.marker, level), '']
bodyLines = ['%s %s%s' %(tree_head, VO.marker, level), '']
return (tree_head, bodyLines)

View File

@ -0,0 +1,63 @@
# voom_mode_fmr2.py
# Last Modified: 2012-02-04
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode. Headline text is after the start fold marker with level.
See |voom_mode_fmr|, ../../doc/voom.txt#*voom_mode_fmr*
{{{1 headline level 1
some text
{{{2 headline level 2
more text
"""
# Define this mode as an 'fmr' mode.
MODE_FMR = True
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
marker = VO.marker
marker_re_search = VO.marker_re.search
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
#c = VO.rstrip_chars
for i in xrange(Z):
if not marker in blines[i]: continue
bline = blines[i]
m = marker_re_search(bline)
if not m: continue
lev = int(m.group(1))
#head = bline[:m.start()].lstrip().rstrip(c).strip('-=~').strip()
head = bline[m.end():]
# strip special marks o=
if head and head[0]=='o': head = head[1:]
if head and head[0]=='=': head = head[1:]
tline = ' %s%s|%s' %(m.group(2) or ' ', '. '*(lev-1), head.strip())
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, ln):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['%s%s %s' %(VO.marker, level, tree_head), '']
return (tree_head, bodyLines)

View File

@ -0,0 +1,74 @@
# voom_mode_hashes.py
# Last Modified: 2012-05-06
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for headlines marked with #'s (atx-headers, a subset of Markdown format).
See |voom_mode_hashes|, ../../doc/voom.txt#*voom_mode_hashes*
# heading level 1
##heading level 2
### heading level 3
"""
import re
# Marker character can be changed to any ASCII character.
CH = '#'
# Use this if whitespace after marker chars is optional.
headline_match = re.compile(r'^(%s+)' %re.escape(CH)).match
# Use this if a whitespace is required after marker chars (as in org-mode).
#headline_match = re.compile(r'^(%s+)\s' %re.escape(CH)).match
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
for i in xrange(Z):
if not blines[i].startswith(CH):
continue
bline = blines[i]
m = headline_match(bline)
if not m:
continue
lev = len(m.group(1))
head = bline[lev:].strip()
# Do this instead if optional closing markers need to be stripped.
#head = bline[lev:].strip().rstrip(CH).rstrip()
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['%s %s' %(CH * level, tree_head), '']
return (tree_head, bodyLines)
def hook_changeLevBodyHead(VO, h, levDelta):
"""Increase of decrease level number of Body headline by levDelta."""
if levDelta==0: return h
m = headline_match(h)
level = len(m.group(1))
return '%s%s' %(CH * (level+levDelta), h[m.end(1):])

View File

@ -0,0 +1,73 @@
# voom_mode_html.py
# Last Modified: 2011-05-01
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for HTML headings.
See |voom_mode_html|, ../../doc/voom.txt#*voom_mode_html*
<h1>headline level 1</h1>
some text
<h2> headline level 2 </h2>
more text
<H3 ALIGN="CENTER"> headline level 3 </H3>
< h4 > headline level 4 </H4 >
some text <h4> <font color=red> headline 5 </font> </H4> </td></div>
etc.
"""
import re
headline_search = re.compile(r'<\s*h(\d+).*?>(.*?)</h(\1)\s*>', re.IGNORECASE).search
html_tag_sub = re.compile('<.*?>').sub
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
for i in xrange(Z):
bline = blines[i]
if not ('</h' in bline or '</H' in bline):
continue
m = headline_search(bline)
if not m:
continue
lev = int(m.group(1))
head = m.group(2)
# delete all html tags
head = html_tag_sub('',head)
tline = ' %s|%s' %('. '*(lev-1), head.strip())
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['<h%s>%s</h%s>' %(level, tree_head, level), '']
return (tree_head, bodyLines)
def hook_changeLevBodyHead(VO, h, levDelta):
"""Increase of decrease level number of Body headline by levDelta."""
if levDelta==0: return h
m = headline_search(h)
level = int(m.group(1))
lev = level+levDelta
return '%s%s%s%s%s' %(h[:m.start(1)], lev, h[m.end(1):m.start(3)], lev, h[m.end(3):])

View File

@ -0,0 +1,318 @@
# voom_mode_markdown.py
# Last Modified: 2012-04-02
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for Markdown headers.
See |voom_mode_markdown|, ../../doc/voom.txt#*voom_mode_markdown*
"""
### NOTES
# When outline operation changes level, it has to deal with two ambiguities:
# a) Level 1 and 2 headline can use underline-style or hashes-style.
# b) Hashes-style can have or not have closing hashes.
# To determine current preferences: check first headline at level <3 and check
# first headline with hashes. This must be done in hook_makeOutline().
# (Save in VO, similar to reST mode.) Cannot be done during outline operation,
# that is in hook_doBodyAfterOop().
# Defaults: use underline, use closing hashes.
levels_ads = {1:'=', 2:'-'}
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
# trailing whitespace is always removed with rstrip()
#
# hashes-style, overides underline-style
# abcde L2, blines[i-1]
# ## head L1, blines[i] -- current line
#
# underline-style
# head L2, blines[i-1] -- title line, not blank, does not start with #
# ------ L1, blines[i] -- current line, any number of = or - only
L1, L2 = '',''
# Set this once when headline with level 1 or 2 is encountered.
# 0 or 1 -- False, use underline-style (default); 2 -- True, use hashes-style
useHash = 0
# Set this once when headline with hashes is encountered.
# 0 or 1 -- True, use closing hashes (default); 2 -- False, do not use closing hashes
useCloseHash = 0
gotHead = False
for i in xrange(Z):
L2 = L1
L1 = blines[i].rstrip()
if L1.startswith('#'):
gotHead = True
lev = len(L1) - len(L1.lstrip('#'))
bnode = i+1
head = L1.strip('#').strip()
elif L2 and L1.startswith('=') and L1.lstrip('=')=='':
gotHead = True
lev = 1
head = L2.strip()
bnode = i
elif L2 and L1.startswith('-') and L1.lstrip('-')=='':
gotHead = True
lev = 2
head = L2.strip()
bnode = i
else:
continue
if gotHead:
gotHead = False
if not useHash and lev < 3:
if L1.startswith('#'):
useHash = 2
else:
useHash = 1
if not useCloseHash and L1.startswith('#'):
if L1.endswith('#'):
useCloseHash = 1
else:
useCloseHash = 2
L1, L2 = '',''
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(bnode)
levels_add(lev)
# don't clobber these when parsing clipboard during Paste
# which is the only time blines is not Body
if blines is VO.Body:
VO.useHash = useHash == 2
VO.useCloseHash = useCloseHash < 2
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
if level < 3 and not VO.useHash:
bodyLines = [tree_head, levels_ads[level]*11, '']
else:
lev = '#'*level
if VO.useCloseHash:
bodyLines = ['%s %s %s' %(lev, tree_head, lev), '']
else:
bodyLines = ['%s %s' %(lev, tree_head), '']
# Add blank line when inserting after non-blank Body line.
if VO.Body[blnum-1].strip():
bodyLines[0:0] = ['']
return (tree_head, bodyLines)
#def hook_changeLevBodyHead(VO, h, levDelta):
# DO NOT CREATE THIS HOOK
def hook_doBodyAfterOop(VO, oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, blnumCut, tlnumCut):
# this is instead of hook_changeLevBodyHead()
# Based on reST mode function. Insert blank separator lines if missing,
# even though they are not important for Markdown headlines.
#print oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, tlnumCut, blnumCut
Body = VO.Body
Z = len(Body)
bnodes, levels = VO.bnodes, VO.levels
ENC = VO.enc
# blnum1 blnum2 is first and last lnums of Body region pasted, inserted
# during up/down, or promoted/demoted.
if blnum1:
assert blnum1 == bnodes[tlnum1-1]
if tlnum2 < len(bnodes):
assert blnum2 == bnodes[tlnum2]-1
else:
assert blnum2 == Z
# blnumCut is Body lnum after which a region was removed during 'cut',
# 'up', 'down'. Need this to check if there is blank line between nodes
# used to be separated by the cut/moved region.
if blnumCut:
if tlnumCut < len(bnodes):
assert blnumCut == bnodes[tlnumCut]-1
else:
assert blnumCut == Z
# Total number of added lines minus number of deleted lines.
b_delta = 0
### After 'cut' or 'up': insert blank line if there is none
# between the nodes used to be separated by the cut/moved region.
if (oop=='cut' or oop=='up') and (0 < blnumCut < Z) and Body[blnumCut-1].strip():
Body[blnumCut:blnumCut] = ['']
update_bnodes(VO, tlnumCut+1 ,1)
b_delta+=1
if oop=='cut':
return
### Make sure there is blank line after the last node in the region:
# insert blank line after blnum2 if blnum2 is not blank, that is insert
# blank line before bnode at tlnum2+1.
if blnum2 < Z and Body[blnum2-1].strip():
Body[blnum2:blnum2] = ['']
update_bnodes(VO, tlnum2+1 ,1)
b_delta+=1
### Change levels and/or formats of headlines in the affected region.
# Always do this after Paste, even if level is unchanged -- format can
# be different when pasting from other outlines.
# Examine each headline, from bottom to top, and change level and/or format.
# To change from hashes to underline-style:
# strip hashes, strip whitespace;
# insert underline.
# To change from underline to hashes-style:
# delete underline;
# insert hashes.
# Update bnodes after inserting or deleting a line.
# hash-style underline-style
#
# L0 L0 Body[bln-2]
# ## head L1 head L1 <--bnode Body[bln-1]
# L2 ---- L2 Body[bln]
# L3 L3 Body[bln+1]
if levDelta or oop=='paste':
for i in xrange(tlnum2, tlnum1-1, -1):
# required level (VO.levels has been updated)
lev = levels[i-1]
# current level from which to change to lev
lev_ = lev - levDelta
# Body headline (bnode) and next line
bln = bnodes[i-1]
L1 = Body[bln-1].rstrip()
if bln+1 < len(Body):
L2 = Body[bln].rstrip()
else:
L2 = ''
# get current headline format
hasHash, hasCloseHash = False, VO.useCloseHash
if L1.startswith('#'):
hasHash = True
if L1.endswith('#'):
hasCloseHash = True
else:
hasCloseHash = False
# get desired headline format
if oop=='paste':
if lev > 2:
useHash = True
else:
useHash = VO.useHash
useCloseHash = VO.useCloseHash
elif lev < 3 and lev_ < 3:
useHash = hasHash
useCloseHash = hasCloseHash
elif lev > 2 and lev_ > 2:
useHash = True
useCloseHash = hasCloseHash
elif lev < 3 and lev_ > 2:
useHash = VO.useHash
useCloseHash = VO.useCloseHash
elif lev > 2 and lev_ < 3:
useHash = True
useCloseHash = hasCloseHash
else:
assert False
#print useHash, hasHash, ';', useCloseHash, hasCloseHash
# change headline level and/or format
# underline-style unchanged, only adjust level of underline
if not useHash and not hasHash:
if not levDelta: continue
Body[bln] = levels_ads[lev]*len(L2)
# hashes-style unchanged, adjust level of hashes and add/remove closing hashes
elif useHash and hasHash:
# no format change, there are closing hashes
if useCloseHash and hasCloseHash:
if not levDelta: continue
Body[bln-1] = '%s%s%s' %('#'*lev, L1.strip('#'), '#'*lev)
# no format change, there are no closing hashes
elif not useCloseHash and not hasCloseHash:
if not levDelta: continue
Body[bln-1] = '%s%s' %('#'*lev, L1.lstrip('#'))
# add closing hashes
elif useCloseHash and not hasCloseHash:
Body[bln-1] = '%s%s %s' %('#'*lev, L1.strip('#').rstrip(), '#'*lev)
# remove closing hashes
elif not useCloseHash and hasCloseHash:
Body[bln-1] = '%s%s' %('#'*lev, L1.strip('#').rstrip())
# insert underline, remove hashes
elif not useHash and hasHash:
L1 = L1.strip('#').strip()
Body[bln-1] = L1
# insert underline
Body[bln:bln] = [levels_ads[lev]*len(L1.decode(ENC,'replace'))]
update_bnodes(VO, i+1, 1)
b_delta+=1
# remove underline, insert hashes
elif useHash and not hasHash:
if useCloseHash:
Body[bln-1] = '%s %s %s' %('#'*lev, L1.strip('#').strip(), '#'*lev)
else:
Body[bln-1] = '%s %s' %('#'*lev, L1.strip('#').strip())
# delete underline
Body[bln:bln+1] = []
update_bnodes(VO, i+1, -1)
b_delta-=1
### Make sure first headline is preceded by a blank line.
blnum1 = bnodes[tlnum1-1]
if blnum1 > 1 and Body[blnum1-2].strip():
Body[blnum1-1:blnum1-1] = ['']
update_bnodes(VO, tlnum1 ,1)
b_delta+=1
### After 'down' : insert blank line if there is none
# between the nodes used to be separated by the moved region.
if oop=='down' and (0 < blnumCut < Z) and Body[blnumCut-1].strip():
Body[blnumCut:blnumCut] = ['']
update_bnodes(VO, tlnumCut+1 ,1)
b_delta+=1
assert len(Body) == Z + b_delta
def update_bnodes(VO, tlnum, delta):
"""Update VO.bnodes by adding/substracting delta to each bnode
starting with bnode at tlnum and to the end.
"""
bnodes = VO.bnodes
for i in xrange(tlnum, len(bnodes)+1):
bnodes[i-1] += delta

View File

@ -0,0 +1,61 @@
# voom_mode_org.py
# Last Modified: 2011-10-28
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for Emacs Org-mode headline format.
See |voom_mode_org|, ../../doc/voom.txt#*voom_mode_org*
"""
import re
headline_match = re.compile(r'^(\*+)\s').match
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
for i in xrange(Z):
if not blines[i].startswith('*'):
continue
bline = blines[i]
m = headline_match(bline)
if not m:
continue
lev = len(m.group(1))
head = bline[lev:].strip()
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['%s %s' %('*'*level, tree_head), '']
return (tree_head, bodyLines)
def hook_changeLevBodyHead(VO, h, levDelta):
"""Increase of decrease level number of Body headline by levDelta."""
if levDelta==0: return h
m = headline_match(h)
level = len(m.group(1))
return '%s%s' %('*'*(level+levDelta), h[m.end(1):])

View File

@ -0,0 +1,214 @@
# voom_mode_python.py
# Last Modified: 2011-05-01
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for Python code.
See |voom_mode_python|, ../../doc/voom.txt#*voom_mode_python*
"""
import token, tokenize
import traceback
import vim
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
#ignore_lnums, func_lnums = get_lnums_from_tokenize(blines)
try:
ignore_lnums, func_lnums = get_lnums_from_tokenize(blines)
except (IndentationError, tokenize.TokenError):
vim.command("call Voom_ErrorMsg('VOoM: EXCEPTION WHILE PARSING PYTHON OUTLINE')")
# DO NOT print to sys.stderr -- triggers Vim error when default stderr (no PyLog)
#traceback.print_exc() --this goes to sys.stderr
#print traceback.format_exc() --ok but no highlighting
lines = traceback.format_exc().replace("'","''").split('\n')
for l in lines:
vim.command("call Voom_ErrorMsg('%s')" %l)
return (['= |!!!ERROR: OUTLINE IS INVALID'], [1], [1])
gotHead = False # True if current line is a headline
indents = [0,] # indents of previous levels
funcLevels = [] # levels of previous def or class
indent_error = '' # inconsistent indent
for i in xrange(Z):
if i+1 in ignore_lnums: continue
bline = blines[i]
bline_s = bline.strip()
if not bline_s: continue
bline_ls = bline.lstrip()
# compute indent and level
indent = len(bline) - len(bline_ls)
if indent > indents[-1]:
indents.append(indent)
elif indent < indents[-1]:
while indents and (indents[-1] > indent):
indents.pop()
if indents[-1]==indent:
indent_error = ''
else:
indent_error = '!!! '
lev = len(indents)
# first line after the end of a class or def block
if funcLevels and lev <= funcLevels[-1]:
gotHead = True
while funcLevels and funcLevels[-1] >= lev:
funcLevels.pop()
# first line of a class or def block
if i+1 in func_lnums:
gotHead = True
if not funcLevels or (lev > funcLevels[-1]):
funcLevels.append(lev)
# special comment line (unconditional headline) or line with @decorator
elif bline_s.startswith('@') or bline_s.startswith('### ') or bline_s.startswith('#---'):
gotHead = True
if gotHead:
gotHead = False
tline = ' %s|%s%s' %('. '*(lev-1), indent_error, bline_s)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
class BLines:
"""Wrapper around Vim buffer object or list of Body lines to provide
readline() method for use with tokenize.generate_tokens().
"""
def __init__(self, blines):
self.blines = blines
self.size = len(blines)
self.idx = -1
def readline(self):
self.idx += 1
if self.idx == self.size:
return ''
return "%s\n" %self.blines[self.idx]
### toktypes of tokens
STRING = token.STRING
NAME = token.NAME
NEWLINE = token.NEWLINE
def get_lnums_from_tokenize(blines):
"""Return dicts. Keys are Body lnums.
The main purpose is to get list of lnums to ignore: multi-line strings and
expressions.
"""
# lnums to ignore: multi-line strings and expressions other than the first line
ignore_lnums = {}
# lnums of 'class' and 'def' tokens
func_lnums = {}
inName = False
for tok in tokenize.generate_tokens(BLines(blines).readline):
toktype, toktext, (srow, scol), (erow, ecol), line = tok
#print token.tok_name[toktype], tok
if toktype == NAME:
if not inName:
inName = True
srow_name = srow
if toktext in ('def','class'):
func_lnums[srow] = toktext
elif toktype == NEWLINE and inName:
inName = False
if srow_name != erow:
for i in xrange(srow_name+1, erow+1):
ignore_lnums[i] = 0
elif toktype == STRING:
if srow != erow:
for i in xrange(srow+1, erow+1):
ignore_lnums[i] = 0
return (ignore_lnums, func_lnums)
def get_body_indent(body):
"""Return string used for indenting Body lines."""
et = int(vim.eval("getbufvar(%s,'&et')" %body))
if et:
ts = int(vim.eval("getbufvar(%s,'&ts')" %body))
return ' '*ts
else:
return '\t'
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = '### NewHeadline'
indent = get_body_indent(VO.body)
body_head = '%s%s' %(indent*(level-1), tree_head)
return (tree_head, [body_head])
#def hook_changeLevBodyHead(VO, h, levDelta):
#"""Increase of decrease level number of Body headline by levDelta."""
#if levDelta==0: return h
def hook_doBodyAfterOop(VO, oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, blnumCut, tlnumCut):
# this is instead of hook_changeLevBodyHead()
#print oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, tlnumCut, blnumCut
Body = VO.Body
Z = len(Body)
ind = get_body_indent(VO.body)
# levDelta is wrong when pasting because hook_makeOutline() looks at relative indent
# determine level of pasted region from indent of its first line
if oop=='paste':
bline1 = Body[blnum1-1]
lev = (len(bline1) - len(bline1.lstrip())) / len(ind) + 1
levDelta = VO.levels[tlnum1-1] - lev
if not levDelta: return
indent = abs(levDelta) * ind
#--- copied from voom_mode_thevimoutliner.py -----------------------------
if blnum1:
assert blnum1 == VO.bnodes[tlnum1-1]
if tlnum2 < len(VO.bnodes):
assert blnum2 == VO.bnodes[tlnum2]-1
else:
assert blnum2 == Z
# dedent (if possible) or indent every non-blank line in Body region blnum1,blnum2
blines = []
for i in xrange(blnum1-1,blnum2):
line = Body[i]
if not line.strip():
blines.append(line)
continue
if levDelta > 0:
line = '%s%s' %(indent,line)
elif levDelta < 0 and line.startswith(indent):
line = line[len(indent):]
blines.append(line)
# replace Body region
Body[blnum1-1:blnum2] = blines
assert len(Body)==Z

View File

@ -0,0 +1,369 @@
# voom_mode_rest.py
# Last Modified: 2012-04-02
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for reStructuredText.
See |voom_mode_rest|, ../../doc/voom.txt#*voom_mode_rest*
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections
The following are all valid section title adornment characters:
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
Some characters are more suitable than others. The following are recommended:
= - ` : . ' " ~ ^ _ * + #
http://docs.python.org/documenting/rest.html#sections
Python recommended styles: ## ** = - ^ "
"""
# All valid section title adornment characters.
AD_CHARS = """ ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ """
AD_CHARS = AD_CHARS.split()
# List of adornment styles, in order of preference.
# Adornment style (ad) is a char or double char: '=', '==', '-', '--', '*', etc.
# Char is adornment char, double if there is overline.
AD_STYLES = """ == -- = - * " ' ` ~ : ^ + # . _ """
AD_STYLES = AD_STYLES.split()
# add all other possible styles to AD_STYLES
d = {}.fromkeys(AD_STYLES)
for c in AD_CHARS:
if not c*2 in d:
AD_STYLES.append(c*2)
if not c in d:
AD_STYLES.append(c)
assert len(AD_STYLES)==64
# convert AD_CHARS to dict for faster lookups
AD_CHARS = {}.fromkeys(AD_CHARS)
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
ENC = VO.enc
# {adornment style: level, ...}
# Level indicates when the first instance of this style was found.
ads_levels = {}
# diagram of Body lines when a headline is detected
# trailing whitespace always removed with rstrip()
# a b c
# ------ L3, blines[i-2] -- an overline or blank line
# head L2, blines[i-1] -- title line, not blank, <= than underline, can be inset only if overline
# ------ L1, blines[i] -- current line, always underline
# x y z
L1, L2, L3 = '','',''
gotHead = False
for i in xrange(Z):
L2, L3 = L1, L2
L1 = blines[i].rstrip()
# current line must be underline and title line cannot be blank
if not (L1 and L2 and (L1[0] in AD_CHARS) and L1.lstrip(L1[0])==''):
continue
# underline must be as long as headline text
if len(L1) < len(L2.decode(ENC,'replace')):
continue
# there is no overline; L3 must be blank line; L2 must be not inset
if not L3 and len(L2)==len(L2.lstrip()):
#if len(L1) < len(L2.decode(ENC,'replace')): continue
gotHead = True
ad = L1[0]
head = L2.strip()
bnode = i
# there is overline -- bnode is lnum of overline!
elif L3==L1:
#if len(L1) < len(L2.decode(ENC,'replace')): continue
gotHead = True
ad = L1[0]*2
head = L2.strip()
bnode = i-1
if gotHead:
if not ad in ads_levels:
ads_levels[ad] = len(ads_levels)+1
lev = ads_levels[ad]
gotHead = False
L1, L2, L3 = '','',''
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(bnode)
levels_add(lev)
# save ads_levels for outline operations
# don't clobber VO.ads_levels when parsing clipboard during Paste
# which is the only time blines is not Body
if blines is VO.Body:
VO.ads_levels = ads_levels
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
ads_levels = VO.ads_levels
levels_ads = dict([[v,k] for k,v in ads_levels.items()])
if level in levels_ads:
ad = levels_ads[level]
else:
ad = get_new_ad(levels_ads, ads_levels, level)
if len(ad)==1:
bodyLines = [tree_head, ad*11, '']
elif len(ad)==2:
ad = ad[0]
bodyLines = [ad*11, tree_head, ad*11, '']
# Add blank line when inserting after non-blank Body line.
if VO.Body[blnum-1].strip():
bodyLines[0:0] = ['']
return (tree_head, bodyLines)
#def hook_changeLevBodyHead(VO, h, levDelta):
# DO NOT CREATE THIS HOOK
def hook_doBodyAfterOop(VO, oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, blnumCut, tlnumCut):
# this is instead of hook_changeLevBodyHead()
#print oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, tlnumCut, blnumCut
Body = VO.Body
Z = len(Body)
bnodes, levels = VO.bnodes, VO.levels
ENC = VO.enc
# blnum1 blnum2 is first and last lnums of Body region pasted, inserted
# during up/down, or promoted/demoted.
if blnum1:
assert blnum1 == bnodes[tlnum1-1]
if tlnum2 < len(bnodes):
assert blnum2 == bnodes[tlnum2]-1
else:
assert blnum2 == Z
# blnumCut is Body lnum after which a region was removed during 'cut',
# 'up', 'down'. We need to check if there is blank line between nodes
# used to be separated by the cut/moved region to prevent headline loss.
if blnumCut:
if tlnumCut < len(bnodes):
assert blnumCut == bnodes[tlnumCut]-1
else:
assert blnumCut == Z
# Total number of added lines minus number of deleted lines.
b_delta = 0
### After 'cut' or 'up': insert blank line if there is none
# between the nodes used to be separated by the cut/moved region.
if (oop=='cut' or oop=='up') and (0 < blnumCut < Z) and Body[blnumCut-1].strip():
Body[blnumCut:blnumCut] = ['']
update_bnodes(VO, tlnumCut+1 ,1)
b_delta+=1
if oop=='cut':
return
### Prevent loss of headline after last node in the region:
# insert blank line after blnum2 if blnum2 is not blank, that is insert
# blank line before bnode at tlnum2+1.
if blnum2 < Z and Body[blnum2-1].strip():
Body[blnum2:blnum2] = ['']
update_bnodes(VO, tlnum2+1 ,1)
b_delta+=1
### Change levels and/or styles of headlines in the affected region.
# Always do this after Paste, even if level is unchanged -- adornments can
# be different when pasting from other outlines.
# Examine each headline, from bottom to top, and change adornment style.
# To change from underline to overline style:
# insert overline.
# To change from overline to underline style:
# delete overline if there is blank before it;
# otherwise change overline to blank line;
# remove inset from headline text.
# Update bnodes after inserting or deleting a line.
if levDelta or oop=='paste':
ads_levels = VO.ads_levels
levels_ads = dict([[v,k] for k,v in ads_levels.items()])
# Add adornment styles for new levels. Can't do this in the main loop
# because it goes backwards and thus will add styles in reverse order.
for i in xrange(tlnum1, tlnum2+1):
lev = levels[i-1]
if not lev in levels_ads:
ad = get_new_ad(levels_ads, ads_levels, lev)
levels_ads[lev] = ad
ads_levels[ad] = lev
for i in xrange(tlnum2, tlnum1-1, -1):
# required level (VO.levels has been updated)
lev = levels[i-1]
# required adornment style
ad = levels_ads[lev]
# deduce current adornment style
bln = bnodes[i-1]
L1 = Body[bln-1].rstrip()
L2 = Body[bln].rstrip()
if bln+1 < len(Body):
L3 = Body[bln+1].rstrip()
else:
L3 = ''
ad_ = deduce_ad_style(L1,L2,L3,ENC)
# change adornment style
# see deduce_ad_style() for diagram
if ad_==ad:
continue
elif len(ad_)==1 and len(ad)==1:
Body[bln] = ad*len(L2)
elif len(ad_)==2 and len(ad)==2:
Body[bln-1] = ad[0]*len(L1)
Body[bln+1] = ad[0]*len(L3)
elif len(ad_)==1 and len(ad)==2:
# change underline if different
if not ad_ == ad[0]:
Body[bln] = ad[0]*len(L2)
# insert overline; current bnode doesn't change
Body[bln-1:bln-1] = [ad[0]*len(L2)]
update_bnodes(VO, i+1, 1)
b_delta+=1
elif len(ad_)==2 and len(ad)==1:
# change underline if different
if not ad_[0] == ad:
Body[bln+1] = ad*len(L3)
# remove headline inset if any
if not len(L2) == len(L2.lstrip()):
Body[bln] = L2.lstrip()
# check if line before overline is blank
if bln >1:
L0 = Body[bln-2].rstrip()
else:
L0 = ''
# there is blank before overline
# delete overline; current bnode doesn't change
if not L0:
Body[bln-1:bln] = []
update_bnodes(VO, i+1, -1)
b_delta-=1
# there is no blank before overline
# change overline to blank; only current bnode needs updating
else:
Body[bln-1] = ''
bnodes[i-1]+=1
### Prevent loss of first headline: make sure it is preceded by a blank line
blnum1 = bnodes[tlnum1-1]
if blnum1 > 1 and Body[blnum1-2].strip():
Body[blnum1-1:blnum1-1] = ['']
update_bnodes(VO, tlnum1 ,1)
b_delta+=1
### After 'down' : insert blank line if there is none
# between the nodes used to be separated by the moved region.
if oop=='down' and (0 < blnumCut < Z) and Body[blnumCut-1].strip():
Body[blnumCut:blnumCut] = ['']
update_bnodes(VO, tlnumCut+1 ,1)
b_delta+=1
assert len(Body) == Z + b_delta
def update_bnodes(VO, tlnum, delta):
"""Update VO.bnodes by adding/substracting delta to each bnode
starting with bnode at tlnum and to the end.
"""
bnodes = VO.bnodes
for i in xrange(tlnum, len(bnodes)+1):
bnodes[i-1] += delta
def get_new_ad(levels_ads, ads_levels, level):
"""Return adornment style for new level, that is level missing from
levels_ads and ads_levels.
"""
for ad in AD_STYLES:
if not ad in ads_levels:
return ad
# all 64 adornment styles are in use, return style for level 64
assert len(levels_ads)==64
return levels_ads[64]
def deduce_ad_style(L1,L2,L3,ENC):
"""Deduce adornment style given first 3 lines of Body node.
1st line is bnode line. Lines must be rstripped.
"""
# '--' style '-' style
#
# L0 L0 Body[bln-2]
# ---- L1 head L1 <--bnode Body[bln-1]
# head L2 ---- L2 Body[bln]
# ---- L3 text L3 Body[bln+1]
# bnode is overline
if L1==L3 and (L1[0] in AD_CHARS) and L1.lstrip(L1[0])=='' and (len(L1) >= len(L2.decode(ENC,'replace'))):
ad = 2*L1[0]
# bnode is headline text
elif (L2[0] in AD_CHARS) and L2.lstrip(L2[0])=='' and (len(L2) >= len(L1.decode(ENC,'replace'))):
ad = L2[0]
else:
print L1
print L2
print L3
print ENC
assert None
return ad
# wrong if perverse headline like this (correct ad style is '-')
#
# ^^^^^
# -----
# ^^^^^
# text
def deduce_ad_style_test(VO):
""" Test to verify deduce_ad_style(). Execute from Vim
:py voom.VOOMS[1].mModule.deduce_ad_style_test(voom.VOOMS[1])
"""
bnodes, levels, Body = VO.bnodes, VO.levels, VO.Body
ads_levels = VO.ads_levels
levels_ads = dict([[v,k] for k,v in ads_levels.items()])
ENC = VO.enc
for i in xrange(2, len(bnodes)+1):
bln = bnodes[i-1]
L1 = Body[bln-1].rstrip()
L2 = Body[bln].rstrip()
if bln+1 < len(Body):
L3 = Body[bln+1].rstrip()
else:
L3 = ''
ad = deduce_ad_style(L1,L2,L3,ENC)
lev = levels[i-1]
print i, ad, levels_ads[lev]
assert ad == levels_ads[lev]

View File

@ -0,0 +1,97 @@
# voom_mode_thevimoutliner.py
# Last Modified: 2011-05-01
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for The Vim Outliner format.
See |voom_mode_thevimoutliner|, ../../doc/voom.txt#*voom_mode_thevimoutliner*
Headlines and body lines are indented with Tabs. Number of tabs indicates
level. 0 Tabs means level 1.
Headlines are lines with >=0 Tabs followed by any character except '|'.
Blank lines are not headlines.
"""
# Body lines start with these chars
BODY_CHARS = {'|':0,}
# ------ the rest is identical to voom_mode_vimoutliner.py -------------------
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
for i in xrange(Z):
bline = blines[i].rstrip()
if not bline:
continue
head = bline.lstrip('\t')
if head[0] in BODY_CHARS:
continue
lev = len(bline) - len(head) + 1
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['%s%s' %('\t'*(level-1), tree_head),]
return (tree_head, bodyLines)
#def hook_changeLevBodyHead(VO, h, levDelta):
#"""Increase of decrease level number of Body headline by levDelta."""
#if levDelta==0: return h
def hook_doBodyAfterOop(VO, oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, blnumCut, tlnumCut):
# this is instead of hook_changeLevBodyHead()
if not levDelta: return
indent = abs(levDelta) * '\t'
Body = VO.Body
Z = len(Body)
# ---- identical to voom_mode_python.py code ----------------------------
if blnum1:
assert blnum1 == VO.bnodes[tlnum1-1]
if tlnum2 < len(VO.bnodes):
assert blnum2 == VO.bnodes[tlnum2]-1
else:
assert blnum2 == Z
# dedent (if possible) or indent every non-blank line in Body region blnum1,blnum2
blines = []
for i in xrange(blnum1-1,blnum2):
line = Body[i]
if not line.strip():
blines.append(line)
continue
if levDelta > 0:
line = '%s%s' %(indent,line)
elif levDelta < 0 and line.startswith(indent):
line = line[len(indent):]
blines.append(line)
# replace Body region
Body[blnum1-1:blnum2] = blines
assert len(Body)==Z

View File

@ -0,0 +1,105 @@
# voom_mode_txt2tags.py
# Last Modified: 2011-05-01
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for txt2tags titles.
See |voom_mode_txt2tags|, ../../doc/voom.txt#*voom_mode_txt2tags*
"""
import re
# from txt2tags.py
# titskel = r'^ *(?P<id>%s)(?P<txt>%s)\1(\[(?P<label>[\w-]*)\])?\s*$'
# bank[ 'title'] = re.compile(titskel%('[=]{1,5}','[^=](|.*[^=])'))
# bank['numtitle'] = re.compile(titskel%('[+]{1,5}','[^+](|.*[^+])'))
# === headline ===
headline1_match = re.compile(r'^ *(=+)([^=].*[^=]|[^=])(\1)(\[[\w-]*\])?\s*$').match
# +++ headline +++
headline2_match = re.compile(r'^ *(\++)([^+].*[^+]|[^+])(\1)(\[[\w-]*\])?\s*$').match
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
areaVerb,areaRaw,areaTagged = False,False,False
for i in xrange(Z):
bline = blines[i]
# ignore Verbatim/Raw/Tagged Areas
bline_rs = bline.rstrip()
if bline_rs=='```' and not (areaRaw or areaTagged):
areaVerb = not areaVerb; continue
elif bline_rs=='"""' and not (areaVerb or areaTagged):
areaRaw = not areaRaw; continue
elif bline_rs=="'''" and not (areaVerb or areaRaw):
areaTagged = not areaTagged; continue
if areaVerb or areaRaw or areaTagged: continue
# there can be leading spaces but not tabs
bline = bline.lstrip(' ')
if bline.startswith('='):
m = headline1_match(bline)
if not m: continue
plus = ''
elif bline.startswith('+'):
m = headline2_match(bline)
if not m: continue
plus = '+ '
else:
continue
lev = len(m.group(1))
head = '%s%s' %(plus, m.group(2).strip())
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
# choose = or + headline type -- same as previous headline
if tlnum > 1:
prev_head = VO.Body[VO.bnodes[tlnum-1] - 1]
if prev_head.lstrip()[0] == '=':
lev = '='*level
else:
lev = '+'*level
tree_head = '+ NewHeadline'
else:
lev = '='*level
bodyLines = ['%s NewHeadline %s' %(lev, lev), '']
return (tree_head, bodyLines)
def hook_changeLevBodyHead(VO, h, levDelta):
"""Increase of decrease level number of Body headline by levDelta."""
if levDelta==0: return h
hLS = h.lstrip()
if hLS[0] == '=':
m = headline1_match(h)
level = len(m.group(1))
s = '='*(level+levDelta)
elif hLS[0] == '+':
m = headline2_match(h)
level = len(m.group(1))
s = '+'*(level+levDelta)
else: assert False
return '%s%s%s%s%s' %(h[:m.start(1)], s, h[m.end(1):m.start(3)], s, h[m.end(3):])

View File

@ -0,0 +1,91 @@
# voom_mode_viki.py
# Last Modified: 2011-10-28
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for headline markup used by Vim Viki/Deplate plugin.
See |voom_mode_viki|, ../../doc/voom.txt#*voom_mode_viki*
"""
import re
headline_match = re.compile(r'^(\*+)\s').match
# Ignore Regions other than #Region
#
# #Type [OPTIONS] <<EndOfRegion
# .......
# EndOfRegion
#
# syntax/viki.vim:
# syn region vikiRegion matchgroup=vikiMacroDelim
# \ start=/^[[:blank:]]*#\([A-Z]\([a-z][A-Za-z]*\)\?\>\|!!!\)\(\\\n\|.\)\{-}<<\z(.*\)$/
# \ end=/^[[:blank:]]*\z1[[:blank:]]*$/
# \ contains=@vikiText,vikiRegionNames
#
# EndOfRegion can be empty string, leading/trailing white space matters
# Don't know what !!! is for.
#
region_match = re.compile(r'^\s*#([A-Z]([a-z][A-Za-z]*)?)\b.*?<<(.*)').match
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
inRegion = False # EndOfRegion match object when inside a region
for i in xrange(Z):
bline = blines[i]
if inRegion:
if re.match(inRegion, bline):
inRegion = False
continue
if bline.lstrip().startswith('#') and '<<' in bline:
r_m = region_match(bline)
if r_m and r_m.group(1) != 'Region':
inRegion = '^\s*%s\s*$' %re.escape(r_m.group(3) or '')
continue
elif not bline.startswith('*'):
continue
m = headline_match(bline)
if not m:
continue
lev = len(m.group(1))
head = bline[lev:].strip()
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['%s %s' %('*'*level, tree_head), '']
return (tree_head, bodyLines)
def hook_changeLevBodyHead(VO, h, levDelta):
"""Increase of decrease level number of Body headline by levDelta."""
if levDelta==0: return h
m = headline_match(h)
level = len(m.group(1))
return '%s%s' %('*'*(level+levDelta), h[m.end(1):])

View File

@ -0,0 +1,96 @@
# voom_mode_vimoutliner.py
# Last Modified: 2011-05-01
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for VimOutliner format.
See |voom_mode_vimoutliner|, ../../doc/voom.txt#*voom_mode_vimoutliner*
Headlines are lines with >=0 Tabs followed by any character except:
: ; | > <
Otherwise this mode is identical to the "thevimoutliner" mode.
"""
# Body lines start with these chars
BODY_CHARS = {':':0, ';':0, '|':0, '<':0, '>':0,}
#-------------copy/pasted from voom_mode_thevimoutliner.py -------------------
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
for i in xrange(Z):
bline = blines[i].rstrip()
if not bline:
continue
head = bline.lstrip('\t')
if head[0] in BODY_CHARS:
continue
lev = len(bline) - len(head) + 1
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
column is cursor position in new headline in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['%s%s' %('\t'*(level-1), tree_head),]
return (tree_head, bodyLines)
#def hook_changeLevBodyHead(VO, h, levDelta):
#"""Increase of decrease level number of Body headline by levDelta."""
#if levDelta==0: return h
def hook_doBodyAfterOop(VO, oop, levDelta, blnum1, tlnum1, blnum2, tlnum2, blnumCut, tlnumCut):
# this is instead of hook_changeLevBodyHead()
if not levDelta: return
indent = abs(levDelta) * '\t'
Body = VO.Body
Z = len(Body)
# ---- identical to Python mode ----
if blnum1:
assert blnum1 == VO.bnodes[tlnum1-1]
if tlnum2 < len(VO.bnodes):
assert blnum2 == VO.bnodes[tlnum2]-1
else:
assert blnum2 == Z
# dedent (if possible) or indent every non-blank line in Body region blnum1,blnum2
blines = []
for i in xrange(blnum1-1,blnum2):
line = Body[i]
if not line.strip():
blines.append(line)
continue
if levDelta > 0:
line = '%s%s' %(indent,line)
elif levDelta < 0 and line.startswith(indent):
line = line[len(indent):]
blines.append(line)
# replace Body region
Body[blnum1-1:blnum2] = blines
assert len(Body)==Z

View File

@ -0,0 +1,70 @@
# voom_mode_vimwiki.py
# Last Modified: 2011-05-01
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for headline markup used by vimwiki plugin:
http://www.vim.org/scripts/script.php?script_id=2226
See |voom_mode_vimwiki|, ../../doc/voom.txt#*voom_mode_vimwiki*
= headline level 1 =
body text
== headline level 2 ==
body text
=== headline level 3 ===
"""
import re
headline_match = re.compile(r'^\s*(=+).+(\1)\s*$').match
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
for i in xrange(Z):
bline = blines[i].strip()
if not bline.startswith('='):
continue
m = headline_match(bline)
if not m:
continue
lev = len(m.group(1))
bline = bline.strip()
head = bline[lev:-lev].strip()
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['%s %s %s' %('='*level, tree_head, '='*level), '']
return (tree_head, bodyLines)
def hook_changeLevBodyHead(VO, h, levDelta):
"""Increase of decrease level number of Body headline by levDelta."""
if levDelta==0: return h
m = headline_match(h)
level = len(m.group(1))
s = '='*(level+levDelta)
return '%s%s%s%s%s' %(h[:m.start(1)], s, h[m.end(1):m.start(2)], s, h[m.end(2):])

View File

@ -0,0 +1,82 @@
# voom_mode_wiki.py
# Last Modified: 2011-05-01
# VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim version 7.x
# Website: http://www.vim.org/scripts/script.php?script_id=2657
# Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com)
# License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want To
# Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
VOoM markup mode for MediaWiki headline markup.
See |voom_mode_wiki|, ../../doc/voom.txt#*voom_mode_wiki*
= headline level 1 =
some text
== headline level 2 ==
more text
=== headline level 3 === <!--comment-->
==== headline level 4 ====<!--comment-->
"""
# can access main module voom.py, including global outline data
#import sys
#if 'voom' in sys.modules:
#voom = sys.modules['voom']
#VOOMS = voom.VOOMS
import re
comment_tag_sub = re.compile('<!--.*?-->\s*$').sub
headline_match = re.compile(r'^(=+).*(\1)\s*$').match
def hook_makeOutline(VO, blines):
"""Return (tlines, bnodes, levels) for Body lines blines.
blines is either Vim buffer object (Body) or list of buffer lines.
"""
Z = len(blines)
tlines, bnodes, levels = [], [], []
tlines_add, bnodes_add, levels_add = tlines.append, bnodes.append, levels.append
for i in xrange(Z):
if not blines[i].startswith('='):
continue
bline = blines[i]
if '<!--' in bline:
bline = comment_tag_sub('',bline)
bline = bline.strip()
m = headline_match(bline)
if not m:
continue
lev = len(m.group(1))
head = bline[lev:-lev].strip()
tline = ' %s|%s' %('. '*(lev-1), head)
tlines_add(tline)
bnodes_add(i+1)
levels_add(lev)
return (tlines, bnodes, levels)
def hook_newHeadline(VO, level, blnum, tlnum):
"""Return (tree_head, bodyLines).
tree_head is new headline string in Tree buffer (text after |).
bodyLines is list of lines to insert in Body buffer.
"""
tree_head = 'NewHeadline'
bodyLines = ['%s %s %s' %('='*level, tree_head, '='*level), '']
return (tree_head, bodyLines)
def hook_changeLevBodyHead(VO, h, levDelta):
"""Increase of decrease level number of Body headline by levDelta."""
if levDelta==0: return h
hs = h # need to strip trailing comment tags first
if '<!--' in h:
hs = comment_tag_sub('',hs)
m = headline_match(hs)
level = len(m.group(1))
s = '='*(level+levDelta)
return '%s%s%s%s' %(s, h[m.end(1):m.start(2)], s, h[m.end(2):])

View File

@ -0,0 +1,76 @@
" This VOoM add-on shows how to customize Tree headline text for individual
" Body filetypes. It works only when outlining start fold markers with levels,
" doesn't do anything when using a markup mode.
"
" IMPORTANT: This file must be sourced after entire voom.vim has been sourced.
" Use option g:voom_user_command as explained in |voom_addons|.
" EXAMPLE: Move this file to $HOME/.vim/voom_add-ons/ and add the following
" line to .vimrc:
" let g:voom_user_command = "runtime! voom_add-ons/*.vim"
"
" NOTE: DO NOT place this file in Vim plugin folder or its subfolder.
"
" Do not load this script if voom.vim has not been sourced completely.
if !exists('*Voom_Exec')
finish
endif
" g:voom_rstrip_chars_{filetype} can be defined here instead of vimrc.
" Note that Space and Tab must be included.
if 0
let g:voom_rstrip_chars_autohotkey = "; \t"
endif
python << EOF
# Replace default headline construction procedure with a custom function:
# 1. Define a make_head Python function.
# - It returns a string: Tree headline text.
# - It requires two arguments: bline and match.
# - bline is Body line from which we make Tree headline.
# - match is MatchObject produced by re.search() for bline and fold
# marker regex
# - bline[:match.start()] gives part of Body line before the
# matching fold marker. This is what we usually start from.
# 2. Register function in dictionary voom.MAKE_HEAD for filetypes with which
# it should be used.
import re
if 1:
# HTML headline: like default plus delete all html tags
html_tag_sub = re.compile('<.*?>').sub
def voom_make_head_html(bline,match):
s = bline[:match.start()].strip().strip('-=~').strip()
s = html_tag_sub('',s)
if s.endswith('<!'):
return s[:-2].strip()
else:
return s
voom.MAKE_HEAD['html'] = voom_make_head_html
if 0:
# Python headline: like default plus remove "def "
def voom_make_head_python(bline,match):
s = bline[:match.start()].lstrip().rstrip('# \t').strip('-=~').strip()
if s.startswith('def ') or s.startswith('def\t'):
return s[3:].lstrip()
else:
return s
voom.MAKE_HEAD['python'] = voom_make_head_python
#voom.MAKE_HEAD['ruby'] = voom_make_head_python
if 0:
# Vim headline: like default plus remove leading "fu ", "fun ", ..., "function ".
vim_func_sub = re.compile(r"^fu(n|nc|nct|ncti|nctio|nction)?!?\s+").sub
def voom_make_head_vim(bline,match):
s = bline[:match.start()].lstrip().rstrip('" \t').strip('-=~').strip()
s = vim_func_sub('',s)
return s
voom.MAKE_HEAD['vim'] = voom_make_head_vim
EOF

View File

@ -0,0 +1,76 @@
" This is a sample VOoM add-on.
" It creates global command :VoomInfo which prints various outline information
" about the current buffer if it's a VOoM buffer (Tree or Body)
" This file can be sourced at any time like a regular Vim script. E.g., it can
" be dropped in folder ~/.vim/plugin/ . Of course, VOoM has to be installed for
" the command :VoomInfo to work.
" This works because the name of command function starts with 'Voom_'
com! VoomInfo call Voom_Info()
func! Voom_Info()
""""""" standard code for every VOoM add-on command
" Determine if the current buffer is a VOoM Tree buffer, Body buffer, or neither.
let [bufType,body,tree] = Voom_GetBufInfo()
" Error, outline is not available (Body is unloaded, outline update failed).
if body==-1 | return | endif
""" Do different things depending on the type of the current buffer.
" Current buffer is not a VOoM buffer (neither Tree nor Body).
" The error message is printed automatically. It can be suppressed by
" providing an optional argument: Voom_GetBufInfo(1)
if bufType==#'None'
"call Voom_ErrorMsg("VOoM: current buffer is not a VOoM buffer")
return
" Current buffer is a VOoM Body. Outline is updated automatically if needed.
elseif bufType==#'Body'
call Voom_WarningMsg("in VOoM Body buffer")
" Current buffer is a VOoM Tree.
elseif bufType==#'Tree'
call Voom_WarningMsg("in VOoM Tree buffer")
endif
" Get Vim-side outline data. NOTE: Do not modify these dictionaries!
let [voom_bodies, voom_trees] = Voom_GetData()
""""""" script-specific code
" Get Python-side data. This creates Vim local variables.
py voom_Info()
echo 'VOoM version:' Voom_GetVar('s:voom_did_quickload')
echo '__PyLog__ buffer number:' Voom_GetVar('s:voom_logbnr')
" print outline information
echo 'VOoM outline for:' getbufline(tree,1)[0][1:]
echo 'Current buffer is:' bufType
echo 'Body buffer number:' body
echo 'Tree buffer number:' tree
echo 'number of nodes:' l:nodesNumber
echo 'nodes with/without children:' l:nodesWithChildren '/' l:nodesWithoutChildren
echo 'max level:' l:maxLevel
echo 'selected node number:' voom_bodies[body].snLn
echo 'selected node headline text:' l:selectedHeadline
echo 'selected node level:' l:selectedNodeLevel
endfunc
python << EOF
def voom_Info():
body, tree = int(vim.eval('l:body')), int(vim.eval('l:tree'))
VO = voom.VOOMS[body]
bnodes, levels = VO.bnodes, VO.levels
vim.command("let l:maxLevel=%s" %(max(levels)))
vim.command("let l:nodesNumber=%s" %(len(bnodes)))
nodesWithChildren = len([i for i in xrange(1,len(bnodes)+1) if voom.nodeHasChildren(VO,i)])
vim.command("let l:nodesWithChildren=%s" %nodesWithChildren)
nodesWithoutChildren = len([i for i in xrange(1,len(bnodes)+1) if not voom.nodeHasChildren(VO,i)])
vim.command("let l:nodesWithoutChildren=%s" %nodesWithoutChildren)
snLn = VO.snLn
treeline = VO.Tree[snLn-1]
if snLn>1:
selectedHeadline = treeline[treeline.find('|')+1:]
else:
selectedHeadline = "top-of-buffer"
vim.command("let [l:selectedNode,l:selectedHeadline]=[%s,'%s']" %(snLn, selectedHeadline.replace("'","''")))
vim.command("let l:selectedNodeLevel=%s" %levels[snLn-1])
EOF

View File

@ -0,0 +1,127 @@
vim:fdm=marker
vim:foldtext=getline(v\:foldstart).'\ \ \ /'.v\:foldlevel.'...'.(v\:foldend-v\:foldstart)
foldtext=getline(v\:foldstart).'...'.(v\:foldend-v\:foldstart)
Vim folding seems to be limited to 20 levels.
--- 1 ---{{{1
1
--- 2 ---{{{2
2
--- 3 ---{{{3
3
--- 4 ---{{{4
4
--- 5 ---{{{5
5
--- 6 ---{{{6
6
--- 7 ---{{{7
7
--- 8 ---{{{8
8
--- 9 ---{{{9
9
--- 10 ---{{{10
10
--- 11 ---{{{11
11
--- 12 ---{{{12
12
--- 13 ---{{{13
13
--- 14 ---{{{14
14
--- 15 ---{{{15
15
--- 16 ---{{{16
16
--- 17 ---{{{17
17
--- 18 ---{{{18
18
--- 19 ---{{{19
19
--- 20 ---{{{20
20
--- 21 ---{{{21
21
--- 22 ---{{{22
22
--- 23 ---{{{23
23
--- 24 ---{{{24
24
--- 25 ---{{{25
25
--- 26 ---{{{26
26
--- 27 ---{{{27
27
--- 28 ---{{{28
28
--- 29 ---{{{29
29
--- 30 ---{{{30
30
--- 31 ---{{{31
31
--- 32 ---{{{32
32
--- 33 ---{{{33
33
--- 34 ---{{{34
34
--- 35 ---{{{35
35
--- 36 ---{{{36
36
--- 37 ---{{{37
37
--- 38 ---{{{38
38
--- 39 ---{{{39
39
--- 40 ---{{{40
40
~~~ ~~~ THE END ~~~ ~~~{{{1

View File

@ -0,0 +1,355 @@
// :Voom asciidoc
// Tests for VOoM asciidoc mode. This file is in utf-8 encoding.
// vim: ft=asciidoc list fdm=manual
// Two-line style, levels 1 to 5 only
Level 1
=======
Level 2
-------
Level 3
~~~~~~~
Level 4
^^^^^^^
Level 5
+++++++
// One-line style
= Level 1 =
== Level 2 ==
=== Level 3 ===
==== Level 4 ====
===== Level 5 =====
====== Level 6 ======
======= Level 7 =======
// Closing ='s are optional
= Level 1
== Level 2
=== Level 3
==== Level 4
===== Level 5
====== Level 6
======= Level 7
There must be a whitespace between headline text and ='s. The number of closing
='s must match the number of opening ='s.
//One-line style overrides two-line style:
===== Level 5
-------------
listing
-------------
UNDERLINE SIZE
==============
The underline must be of the same size as the title line +/- 2 chars.
Both the underline and the title line must be at least 2 chars long.
Trailing whitespace is always ignored and is not counted.
not headlines
-------------
headline
~~~~~
headline
~~~~~~~~~~~
заголовок
~~~~~~
заголовок
~~~~~~~~~~~~
A
---
headlines, 5 of each
--------------------
headline
~~~~~~
headline
~~~~~~~
headline
~~~~~~~~
headline
~~~~~~~~~
headline
~~~~~~~~~~
заголовок
~~~~~~~
заголовок
~~~~~~~~
заголовок
~~~~~~~~~
заголовок
~~~~~~~~~~
заголовок
~~~~~~~~~~~
BLOCKID, ATTRIBUTELIST
======================
[[AAA]]
== headline 1 ==
[AAA]
== headline 2 ==
[[AAA]]
[AAA]
== headline 3 ==
[AAA]
[[AAA]]
== headline 4 ==
[AAA]
[[AAA]]
[AAA]
== headline 5 ==
text
[AAA]
== headline 6 ==
DELIMITED BLOCKS
================
////
== not headline ==
not headline
------------
////
++++
== not headline ==
not headline
------------
++++
----
== not headline ==
not headline
------------
....
== not headline ==
not headline
------------
....
****
== not headline ==
not headline
------------
****
____
== not headline ==
not headline
------------
____
====
== not headline ==
not headline
------------
====
// ambiguious cases
headline
--------
--------
listing, not headline
---------------------
DISALLOWED UNDERLINED HEADLINES
===============================
No headlines here. The underline starts Delimited Block.
//BlockID
[[AAA]]
-------
== not headline
-------
//Attribute List
[AAA]
-----
== not headline
-----
//Comment line (exactly two // at start)
//AAA
-----
== not headline
-----
//Block Title, one dot is enough
.AAA
----
== not headline
-----
//Tab at start of title line is also not allowed, don't know why
not headline
------------
== not headline
-----
//An underlined headline cannot be just one character. They can in AsciiDoc.
A
--
B
---
//An underlined title cannot look like an underline or a Delimited Block line,
//that is a line of only =,-,+, etc.
===
---
===
+++
===
^^^
+++
++
==
^^
~~
BLANK LINES
===========
A blank separator line is required in front of most headlines.
But preceding [[]] and/or [] lines are treated as part of the headline.
// Wrong:
== headline ==
text
== not headline ==
[[X1]]
[blah]
== not headline ==
// Correct:
== headline 1 ==
text
== headline 2 ==
[[X1]]
[blah]
== headline 3 ==
// The second underline starts Delimited Block
headline
--------
text
not headline
------------
not headline
------------
// Comment lines before the headline are ignored
== headline 1 ==
text
// comment
== not headline ==
// comment
== headline 2 ==
text
// comment
// comment
[blah]
== headline 3 ==
// Blank line is NOT required between adjacent headlines
== headline 1 ==
== headline 2 ==
// comment
== headline 3 ==
headline 4
----------
[blah]
headline 5
----------
// after the end of a Delimited Block
== headline 1 ==
----------------------------
listing
----------------------------
== headline 2 ==
GOTCHAS
=======
There must be a blank line between a macro, an :atrrbute:, etc. and the
following headline.
The underline can be mistaken for a DelimitedBlock, which will kill subsequent
headlines.
== headline
:numbered:
== not headline
ifdef::something[]
not headline
------------
== not headline
---------------
== headline

View File

@ -0,0 +1,433 @@
:Voom asciidoc
This is VOoM markup mode test file. Converted from **test_outline.txt**.
findme findme2
h 1
===
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
[[X2]]
h 1.1
-----
1.1 body
[[X2]]
h 1.2
-----
1.2 body
h 2
===
2 body
h 3
===
3 body
[[X2]]
h 3.1
-----
3.1 body
[[X2]]
h 3.2
-----
3.2 body
[[X3]]
[ATTR]
h 3.2.1
~~~~~~~
3.2.1 body
h 3.2.1.1
^^^^^^^^^
3.2.1.1 body
xxxx findme findme
[[X3]]
[ATTR]
h 3.2.2
~~~~~~~
3.2.2 body
h 3.2.2.1
^^^^^^^^^
3.2.2.1 body
h 3.2.2.1.1
+++++++++++
3.2.2.1.1 body
====== h 3.2.2.1.2.1 ======
3.2.2.1.2.1 body
======= h 3.2.2.1.2.1.1 =======
3.2.2.1.2.1.1 body
[[X2]]
h 3.3
-----
3.3 body
h 4
===
4 body
[[X2]]
h 4.1
-----
4.1 body findme
h 5
===
5 body
[[X2]]
h 5.1
-----
5.1 body
[[X2]]
h 5.2
-----
5.2 body
[[X3]]
[ATTR]
h 5.2.1
~~~~~~~
5.2.1 body
[[X3]]
[ATTR]
h 5.2.2
~~~~~~~
5.2.2 body
h 5.2.2.1
^^^^^^^^^
5.2.2.1 body
h 5.2.2.1.1
+++++++++++
5.2.2.1.1 body
h 5.2.2.1.2
+++++++++++
5.2.2.1.2 body
[[X3]]
[ATTR]
h 5.2.3
~~~~~~~
5.2.3 body
[[X2]]
h AA
----
a a a a
[[X3]]
[ATTR]
h AA.1
~~~~~~
a1 a1 a1 a1
[[X2]]
h BB
----
b b b b
[[X3]]
[ATTR]
h BB.1
~~~~~~
b1 b1 b1 b1 b1
[[X2]]
h 5.3
-----
5.3 body
findme
h tests
=======
[[X2]]
h syntax tests
--------------
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
[[X3]]
[ATTR]
h //---TODO comment--- //
~~~~~~~~~~~~~~~~~~~~~~~~~
[[X3]]
[ATTR]
h "---comment--- "
~~~~~~~~~~~~~~~~~~
echo 'vim ok'
[[X3]]
[ATTR]
h #---comment--- #
~~~~~~~~~~~~~~~~~~
print 'py ok'
[[X3]]
[ATTR]
h %---comment--- %
~~~~~~~~~~~~~~~~~~
[[X3]]
[ATTR]
h /*---comment--- /*
~~~~~~~~~~~~~~~~~~~~
[[X3]]
[ATTR]
h <!-- Comment
~~~~~~~~~~~~~~
ft=html,xml
[[X3]]
[ATTR]
h html head <!
~~~~~~~~~~~~~~
[[X3]]
[ATTR]
h /organizer node/
~~~~~~~~~~~~~~~~~~
[[X3]]
[ATTR]
h !warning mark
~~~~~~~~~~~~~~~
[[X2]]
h Voomgrep tests
----------------
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
[[X3]]
[ATTR]
h n44 breakfast
~~~~~~~~~~~~~~~
eggs
bacon
[[X3]]
[ATTR]
h n45 lunch
~~~~~~~~~~~
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
[[X3]]
[ATTR]
h n46 dinner
~~~~~~~~~~~~
eggs
Spam
ham
[[X3]]
[ATTR]
h n47 snack
~~~~~~~~~~~
bacon
spam
HAM
beef
[[X2]]
h sort tests
------------
[[X3]]
[ATTR]
h node 2
~~~~~~~~
h dddd
^^^^^^
d1
h eeee
^^^^^^
h dddd
^^^^^^
d2
h bbbb
^^^^^^
b
h b_yyy
+++++++
h b_xxx
+++++++
h cccc
^^^^^^
c
h aaaa
^^^^^^
a
h a_nnn
+++++++
h a_mmm
+++++++
[[X3]]
[ATTR]
h node 22
~~~~~~~~~
[[X3]]
[ATTR]
h ñ
~~~
[[X3]]
[ATTR]
h Ñ
~~~
unicode tests
h э
^^^
1
h Я
^^^
2
h ю
^^^
3
h Э
^^^
4
h я
^^^
5
h Ю
^^^
6
[[X3]]
[ATTR]
h node 1
~~~~~~~~
h bbbb
^^^^^^
b
h dddd
^^^^^^
d1
h DDDD
^^^^^^
ingorecase test
h aaaa
^^^^^^
a
h dddd
^^^^^^
d2
h cccc
^^^^^^
c
[[X3]]
[ATTR]
h z
~~~
[[X2]]
h special chars tests
---------------------
[[X3]]
[ATTR]
h '" /\\/
~~~~~~~~~
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
[[X3]]
[ATTR]
h Брожу ли я
~~~~~~~~~~~~
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,249 @@
:Voom hashes
This is VOoM markup mode test file. Converted from **test_outline.txt**.
findme findme2
# 1
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
## 1.1
1.1 body
## 1.2
1.2 body
# 2
2 body
# 3
3 body
## 3.1
3.1 body
## 3.2
3.2 body
### 3.2.1
3.2.1 body
#### 3.2.1.1
3.2.1.1 body
xxxx findme findme
### 3.2.2
3.2.2 body
#### 3.2.2.1
3.2.2.1 body
##### 3.2.2.1.1
3.2.2.1.1 body
###### 3.2.2.1.2.1
3.2.2.1.2.1 body
####### 3.2.2.1.2.1.1
3.2.2.1.2.1.1 body
## 3.3
3.3 body
# 4
4 body
## 4.1
4.1 body findme
# 5
5 body
## 5.1
5.1 body
## 5.2
5.2 body
### 5.2.1
5.2.1 body
### 5.2.2
5.2.2 body
#### 5.2.2.1
5.2.2.1 body
##### 5.2.2.1.1
5.2.2.1.1 body
##### 5.2.2.1.2
5.2.2.1.2 body
### 5.2.3
5.2.3 body
## AA
a a a a
### AA.1
a1 a1 a1 a1
## BB
b b b b
### BB.1
b1 b1 b1 b1 b1
## 5.3
5.3 body
findme
# tests
## syntax tests
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
### //---TODO comment--- //
### "---comment--- "
echo 'vim ok'
### #---comment--- #
print 'py ok'
### %---comment--- %
### /*---comment--- /*
### <!-- Comment
ft=html,xml
### html head <!
### /organizer node/
### !warning mark
## Voomgrep tests
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
### n44 breakfast
eggs
bacon
### n45 lunch
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
### n46 dinner
eggs
Spam
ham
### n47 snack
bacon
spam
HAM
beef
## sort tests
### node 2
#### dddd
d1
#### eeee
#### dddd
d2
#### bbbb
b
##### b_yyy
##### b_xxx
#### cccc
c
#### aaaa
a
##### a_nnn
##### a_mmm
### node 22
### ñ
### Ñ
unicode tests
#### э
1
#### Я
2
#### ю
3
#### Э
4
#### я
5
#### Ю
6
### node 1
#### bbbb
b
#### dddd
d1
#### DDDD
ingorecase test
#### aaaa
a
#### dddd
d2
#### cccc
c
### z
## special chars tests
### '" /\\/
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
### Брожу ли я
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,249 @@
:Voom html
This is VOoM markup mode test file. Converted from **test_outline.txt**.
findme findme2
<h1>1</h1> <!--{{{1-->
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
<h2>1.1</h2> <!--{{{2-->
1.1 body
<h2>1.2</h2> <!--{{{2-->
1.2 body
<h1>2</h1> <!--{{{1-->
2 body
<h1>3</h1> <!--{{{1o=-->
3 body
<h2>3.1</h2> <!--{{{2x-->
3.1 body
<h2>3.2</h2> <!--{{{2x-->
3.2 body
<h3>3.2.1</h3> <!--{{{3-->
3.2.1 body
<h4>3.2.1.1</h4> <!--{{{4-->
3.2.1.1 body
xxxx findme findme
<h3>3.2.2</h3> <!--{{{3-->
3.2.2 body
<h4>3.2.2.1</h4> <!--{{{4x-->
3.2.2.1 body
<h5>3.2.2.1.1</h5> <!--{{{5x-->
3.2.2.1.1 body
<h6>3.2.2.1.2.1</h6> <!--{{{6-->
3.2.2.1.2.1 body
<h7>3.2.2.1.2.1.1</h7> <!--{{{7x-->
3.2.2.1.2.1.1 body
<h2>3.3</h2> <!--{{{2-->
3.3 body
<h1>4</h1> <!--{{{1-->
4 body
<h2>4.1</h2> <!--{{{2-->
4.1 body findme
<h1>5</h1> <!--{{{1o-->
5 body
<h2>5.1</h2> <!--{{{2-->
5.1 body
<h2>5.2</h2> <!--{{{2o-->
5.2 body
<h3>5.2.1</h3> <!--{{{3-->
5.2.1 body
<h3>5.2.2</h3> <!--{{{3-->
5.2.2 body
<h4>5.2.2.1</h4> <!--{{{4o-->
5.2.2.1 body
<h5>5.2.2.1.1</h5> <!--{{{5-->
5.2.2.1.1 body
<h5>5.2.2.1.2</h5> <!--{{{5-->
5.2.2.1.2 body
<h3>5.2.3</h3> <!--{{{3-->
5.2.3 body
<h2>AA</h2> <!--{{{2-->
a a a a
<h3>AA.1</h3> <!--{{{3-->
a1 a1 a1 a1
<h2>BB</h2> <!--{{{2-->
b b b b
<h3>BB.1</h3> <!--{{{3-->
b1 b1 b1 b1 b1
<h2>5.3</h2> <!--{{{2-->
5.3 body
findme
<h1>tests</h1> <!--{{{1o-->
<h2>syntax tests</h2> <!--{{{2-->
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
<h3>//---TODO comment--- //</h3> <!--{{{3-->
<h3>"---comment--- "</h3> <!--{{{3-->
echo 'vim ok'
<h3>#---comment--- #</h3> <!--{{{3-->
print 'py ok'
<h3>%---comment--- %</h3> <!--{{{3-->
<h3>/*---comment--- /*</h3> <!--{{{3*/-->
<h3>&lt;!-- Comment</h3> <!--{{{3 --&gt;-->
ft=html,xml
<h3>html head &lt;!</h3> <!--{{{3--&gt;-->
<h3>/organizer node/</h3> <!--{{{3-->
<h3>!warning mark</h3> <!--{{{3-->
<h2>Voomgrep tests</h2> <!--{{{2-->
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
<h3>n44 breakfast</h3> <!--{{{3-->
eggs
bacon
<h3>n45 lunch</h3> <!--{{{3-->
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
<h3>n46 dinner</h3> <!--{{{3-->
eggs
Spam
ham
<h3>n47 snack</h3> <!--{{{3-->
bacon
spam
HAM
beef
<h2>sort tests</h2> <!--{{{2-->
<h3>node 2</h3> <!--{{{3-->
<h4>dddd</h4> <!--{{{4x-->
d1
<h4>eeee</h4> <!--{{{4-->
<h4>dddd</h4> <!--{{{4-->
d2
<h4>bbbb</h4> <!--{{{4o-->
b
<h5>b_yyy</h5> <!--{{{5-->
<h5>b_xxx</h5> <!--{{{5-->
<h4>cccc</h4> <!--{{{4-->
c
<h4>aaaa</h4> <!--{{{4-->
a
<h5>a_nnn</h5> <!--{{{5-->
<h5>a_mmm</h5> <!--{{{5-->
<h3>node 22</h3> <!--{{{3-->
<h3>ñ</h3> <!--{{{3-->
<h3>Ñ</h3> <!--{{{3-->
unicode tests
<h4>э</h4> <!--{{{4-->
1
<h4>Я</h4> <!--{{{4-->
2
<h4>ю</h4> <!--{{{4-->
3
<h4>Э</h4> <!--{{{4-->
4
<h4>я</h4> <!--{{{4-->
5
<h4>Ю</h4> <!--{{{4-->
6
<h3>node 1</h3> <!--{{{3-->
<h4>bbbb</h4> <!--{{{4-->
b
<h4>dddd</h4> <!--{{{4-->
d1
<h4>DDDD</h4> <!--{{{4-->
ingorecase test
<h4>aaaa</h4> <!--{{{4-->
a
<h4>dddd</h4> <!--{{{4-->
d2
<h4>cccc</h4> <!--{{{4-->
c
<h3>z</h3> <!--{{{3-->
<h2>special chars tests</h2> <!--{{{2-->
<h3>'" /\\/</h3> <!--{{{3 '" /\\/-->
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
<h3>Брожу ли я</h3> <!--{{{3 вдоль улиц шумных? (utf-8)-->
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,270 @@
:Voom markdown
This is VOoM markup mode test file. Converted from **test_outline.txt**.
findme findme2
h1
==
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
h1.1
----
1.1 body
h1.2
----
1.2 body
h2
==
2 body
h3
==
3 body
h3.1
----
3.1 body
h3.2
----
3.2 body
### h3.2.1 ###
3.2.1 body
#### h3.2.1.1 ####
3.2.1.1 body
xxxx findme findme
### h3.2.2 ###
3.2.2 body
#### h3.2.2.1 ####
3.2.2.1 body
##### h3.2.2.1.1 #####
3.2.2.1.1 body
###### h3.2.2.1.2.1 ######
3.2.2.1.2.1 body
####### h3.2.2.1.2.1.1 #######
3.2.2.1.2.1.1 body
h3.3
----
3.3 body
h4
==
4 body
h4.1
----
4.1 body findme
h5
==
5 body
h5.1
----
5.1 body
h5.2
----
5.2 body
### h5.2.1 ###
5.2.1 body
### h5.2.2 ###
5.2.2 body
#### h5.2.2.1 ####
5.2.2.1 body
##### h5.2.2.1.1 #####
5.2.2.1.1 body
##### h5.2.2.1.2 #####
5.2.2.1.2 body
### h5.2.3 ###
5.2.3 body
hAA
---
a a a a
### hAA.1 ###
a1 a1 a1 a1
hBB
---
b b b b
### hBB.1 ###
b1 b1 b1 b1 b1
h5.3
----
5.3 body
findme
htests
======
hsyntax tests
-------------
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
### h//---TODO comment--- // ###
### h"---comment--- " ###
echo 'vim ok'
### h#---comment--- # ###
print 'py ok'
### h%---comment--- % ###
### h/*---comment--- /* ###
### h&lt;!-- Comment ###
ft=html,xml
### hhtml head &lt;! ###
### h/organizer node/ ###
### h!warning mark ###
hVoomgrep tests
---------------
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
### hn44 breakfast ###
eggs
bacon
### hn45 lunch ###
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
### hn46 dinner ###
eggs
Spam
ham
### hn47 snack ###
bacon
spam
HAM
beef
hsort tests
-----------
### hnode 2 ###
#### hdddd ####
d1
#### heeee ####
#### hdddd ####
d2
#### hbbbb ####
b
##### hb_yyy #####
##### hb_xxx #####
#### hcccc ####
c
#### haaaa ####
a
##### ha_nnn #####
##### ha_mmm #####
### hnode 22 ###
### hñ ###
### hÑ ###
unicode tests
#### hэ ####
1
#### hЯ ####
2
#### hю ####
3
#### hЭ ####
4
#### hя ####
5
#### hЮ ####
6
### hnode 1 ###
#### hbbbb ####
b
#### hdddd ####
d1
#### hDDDD ####
ingorecase test
#### haaaa ####
a
#### hdddd ####
d2
#### hcccc ####
c
### hz ###
hspecial chars tests
--------------------
### h'" /\\/ ###
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
### hБрожу ли я ###
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,249 @@
:Voom org
This is VOoM markup mode test file. Converted from **test_outline.txt**.
findme findme2
* 1
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
** 1.1
1.1 body
** 1.2
1.2 body
* 2
2 body
* 3
3 body
** 3.1
3.1 body
** 3.2
3.2 body
*** 3.2.1
3.2.1 body
**** 3.2.1.1
3.2.1.1 body
xxxx findme findme
*** 3.2.2
3.2.2 body
**** 3.2.2.1
3.2.2.1 body
***** 3.2.2.1.1
3.2.2.1.1 body
****** 3.2.2.1.2.1
3.2.2.1.2.1 body
******* 3.2.2.1.2.1.1
3.2.2.1.2.1.1 body
** 3.3
3.3 body
* 4
4 body
** 4.1
4.1 body findme
* 5
5 body
** 5.1
5.1 body
** 5.2
5.2 body
*** 5.2.1
5.2.1 body
*** 5.2.2
5.2.2 body
**** 5.2.2.1
5.2.2.1 body
***** 5.2.2.1.1
5.2.2.1.1 body
***** 5.2.2.1.2
5.2.2.1.2 body
*** 5.2.3
5.2.3 body
** AA
a a a a
*** AA.1
a1 a1 a1 a1
** BB
b b b b
*** BB.1
b1 b1 b1 b1 b1
** 5.3
5.3 body
findme
* tests
** syntax tests
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
*** //---TODO comment--- //
*** "---comment--- "
echo 'vim ok'
*** #---comment--- #
print 'py ok'
*** %---comment--- %
*** /*---comment--- /*
*** <!-- Comment
ft=html,xml
*** html head <!
*** /organizer node/
*** !warning mark
** Voomgrep tests
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
*** n44 breakfast
eggs
bacon
*** n45 lunch
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
*** n46 dinner
eggs
Spam
ham
*** n47 snack
bacon
spam
HAM
beef
** sort tests
*** node 2
**** dddd
d1
**** eeee
**** dddd
d2
**** bbbb
b
***** b_yyy
***** b_xxx
**** cccc
c
**** aaaa
a
***** a_nnn
***** a_mmm
*** node 22
*** ñ
*** Ñ
unicode tests
**** э
1
**** Я
2
**** ю
3
**** Э
4
**** я
5
**** Ю
6
*** node 1
**** bbbb
b
**** dddd
d1
**** DDDD
ingorecase test
**** aaaa
a
**** dddd
d2
**** cccc
c
*** z
** special chars tests
*** '" /\\/
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
*** Брожу ли я
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,249 @@
| :Voom thevimoutliner
| This is VOoM markup mode test file. Converted from **test_outline.txt**.
| findme findme2
1
| 1 body
| NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
| VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
1.1
| 1.1 body
1.2
| 1.2 body
2
| 2 body
3
| 3 body
3.1
| 3.1 body
3.2
| 3.2 body
3.2.1
| 3.2.1 body
3.2.1.1
| 3.2.1.1 body
| xxxx findme findme
3.2.2
| 3.2.2 body
3.2.2.1
| 3.2.2.1 body
3.2.2.1.1
| 3.2.2.1.1 body
3.2.2.1.2.1
| 3.2.2.1.2.1 body
3.2.2.1.2.1.1
| 3.2.2.1.2.1.1 body
3.3
| 3.3 body
4
| 4 body
4.1
| 4.1 body findme
5
| 5 body
5.1
| 5.1 body
5.2
| 5.2 body
5.2.1
| 5.2.1 body
5.2.2
| 5.2.2 body
5.2.2.1
| 5.2.2.1 body
5.2.2.1.1
| 5.2.2.1.1 body
5.2.2.1.2
| 5.2.2.1.2 body
5.2.3
| 5.2.3 body
AA
| a a a a
AA.1
| a1 a1 a1 a1
BB
| b b b b
BB.1
| b1 b1 b1 b1 b1
5.3
| 5.3 body
| findme
tests
syntax tests
| Since v2.1 comment chars before foldmarker are stripped according to filetype.
| Some Body filetypes have their own Tree syntax hi.
//---TODO comment--- //
"---comment--- "
| echo 'vim ok'
#---comment--- #
| print 'py ok'
%---comment--- %
/*---comment--- /*
\<!-- Comment
| ft=html,xml
html head \<!
/organizer node/
!warning mark
Voomgrep tests
| :Voomg Spam and ham not bacon
| :Voomg Spam and\ ham not\ bacon
| :Voomg Spam and\\ ham not\\ bacon
| \Spam// ' "
n44 breakfast
| eggs
| bacon
n45 lunch
| Spam Spam Spam Spam Spam Spam Spam Spam Spam
| Spam Spam Spam Spam Spam Spam Spam Spam Spam
| Spam Spam Spam Spam Spam Spam Spam Spam Spam
| ham
n46 dinner
| eggs
| Spam
| ham
n47 snack
| bacon
| spam
| HAM
| beef
sort tests
node 2
dddd
| d1
eeee
dddd
| d2
bbbb
| b
b_yyy
b_xxx
cccc
| c
aaaa
| a
a_nnn
a_mmm
node 22
ñ
Ñ
| unicode tests
э
| 1
Я
| 2
ю
| 3
Э
| 4
я
| 5
Ю
| 6
node 1
bbbb
| b
dddd
| d1
DDDD
| ingorecase test
aaaa
| a
dddd
| d2
cccc
| c
z
special chars tests
'" /\\/
| " "" """
| ' '' """
| \ \\ \\\
| / // ///
| \//\
Брожу ли я
| Брожу. Чего ж не побродить.
| Чебурашка CHeburashka
| u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
| utf-8
| '\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,97 @@
# :Voom python
# VOoM test file for Python outlining mode
# no gotchas--oultine operations do not kill or create headlines
# vim: et ts=4 sw=4 sts=4 fdm=manual
"""
docstring
def func_in_docstring():
pass
# not COMMENT
after func_in_docstring
"""
a = [1, # COMMENT, headline
# COMMENT, not headline
2]
# line continuation
s = "oosp\
class Fake\
pass \
"
s2 = """
xx
yy
closing " " " must not be mistaken for start of docstring
"""
### if 1
# NEXT LINE IS FOR TEST SUITE -- DO NOT MOVE OR EDIT
# VO.levels=[1, 1, 2, 3, 3, 1, 1, 1, 2, 3, 3, 3, 2, 2, 1, 1, 1, 2, 3, 3, 1, 1, 1, 1, 1]
if 1:
### if 1
if 1:
def func1(a,
b,
c):
"""
docstring
"""
pass
#--- headline 1
def func_with_string(a, b, c=False, d="NoName",
e=None, f=0, g='Oopsy'):
"""
text text text text
"""
#---- headline before Class1
class Class1:
b = []
def func2():
### headline 2
a = 'a'
def func3():
pass
#----- headline 3
#----headline 4
def func4(): pass
#----- headline 5
# not headline
def func4(f):
'''
badly indented docstring
'''
pass
class Class2:
u" perversely formatted docstring \
perversely formatted docstring"
b = []
def func5():
pass
def func6():
pass
#--- headline 6
#---- headline 7
# not a headline
def func7(func):
a = \
"perverted continuation"
pass
@func7
def func8(): # <-- headline
a = 1
b = [1,
2, # <-- false headline
3]
c = 4
### if __name__=='__main__':
if __name__=='__main__':
print Class2.__doc__

View File

@ -0,0 +1,408 @@
:Voom rest
This is VOoM markup mode test file. Converted from **test_outline.txt**.
NOTE: no gotchas, suitable for test suite
findme findme2
=
1
=
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
---
1.1
---
1.1 body
---
1.2
---
1.2 body
=
2
=
2 body
=
3
=
3 body
---
3.1
---
3.1 body
---
3.2
---
3.2 body
3.2.1
=====
3.2.1 body
3.2.1.1
-------
3.2.1.1 body
xxxx findme findme
3.2.2
=====
3.2.2 body
3.2.2.1
-------
3.2.2.1 body
3.2.2.1.1
*********
3.2.2.1.1 body
3.2.2.1.2.1
"""""""""""
3.2.2.1.2.1 body
3.2.2.1.2.1.1
'''''''''''''
3.2.2.1.2.1.1 body
---
3.3
---
3.3 body
=
4
=
4 body
---
4.1
---
4.1 body findme
=
5
=
5 body
---
5.1
---
5.1 body
---
5.2
---
5.2 body
5.2.1
=====
5.2.1 body
5.2.2
=====
5.2.2 body
5.2.2.1
-------
5.2.2.1 body
5.2.2.1.1
*********
5.2.2.1.1 body
5.2.2.1.2
*********
5.2.2.1.2 body
5.2.3
=====
5.2.3 body
--
AA
--
a a a a
AA.1
====
a1 a1 a1 a1
--
BB
--
b b b b
BB.1
====
b1 b1 b1 b1 b1
---
5.3
---
5.3 body
findme
=====
tests
=====
------------
syntax tests
------------
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
//---TODO comment--- //
=======================
"---comment--- "
================
echo 'vim ok'
#---comment--- #
================
print 'py ok'
%---comment--- %
================
/*---comment--- /*
==================
<!-- Comment
============
ft=html,xml
html head <!
============
/organizer node/
================
!warning mark
=============
--------------
Voomgrep tests
--------------
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
n44 breakfast
=============
eggs
bacon
n45 lunch
=========
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
n46 dinner
==========
eggs
Spam
ham
n47 snack
=========
bacon
spam
HAM
beef
----------
sort tests
----------
node 2
======
dddd
----
d1
eeee
----
dddd
----
d2
bbbb
----
b
b_yyy
*****
b_xxx
*****
cccc
----
c
aaaa
----
a
a_nnn
*****
a_mmm
*****
node 22
=======
ñ
=
Ñ
=
unicode tests
э
-
1
Я
-
2
ю
-
3
Э
-
4
я
-
5
Ю
-
6
node 1
======
bbbb
----
b
dddd
----
d1
DDDD
----
ingorecase test
aaaa
----
a
dddd
----
d2
cccc
----
c
z
=
-------------------
special chars tests
-------------------
'" /\\/
=======
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
Брожу ли я
==========
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,249 @@
:Voom txt2tags
This is VOoM markup mode test file. Converted from **test_outline.txt**.
findme findme2
= 1 =[ref]
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
== 1.1 ==[ref]
1.1 body
== 1.2 ==[ref]
1.2 body
= 2 =[ref]
2 body
= 3 =[ref]
3 body
== 3.1 ==[ref]
3.1 body
== 3.2 ==[ref]
3.2 body
+++ 3.2.1 +++[ref]
3.2.1 body
++++ 3.2.1.1 ++++[ref]
3.2.1.1 body
xxxx findme findme
+++ 3.2.2 +++[ref]
3.2.2 body
++++ 3.2.2.1 ++++[ref]
3.2.2.1 body
+++++ 3.2.2.1.1 +++++[ref]
3.2.2.1.1 body
++++++ 3.2.2.1.2.1 ++++++[ref]
3.2.2.1.2.1 body
+++++++ 3.2.2.1.2.1.1 +++++++[ref]
3.2.2.1.2.1.1 body
== 3.3 ==[ref]
3.3 body
= 4 =[ref]
4 body
== 4.1 ==[ref]
4.1 body findme
= 5 =[ref]
5 body
== 5.1 ==[ref]
5.1 body
== 5.2 ==[ref]
5.2 body
+++ 5.2.1 +++[ref]
5.2.1 body
+++ 5.2.2 +++[ref]
5.2.2 body
++++ 5.2.2.1 ++++[ref]
5.2.2.1 body
+++++ 5.2.2.1.1 +++++[ref]
5.2.2.1.1 body
+++++ 5.2.2.1.2 +++++[ref]
5.2.2.1.2 body
+++ 5.2.3 +++[ref]
5.2.3 body
== AA ==[ref]
a a a a
+++ AA.1 +++[ref]
a1 a1 a1 a1
== BB ==[ref]
b b b b
+++ BB.1 +++[ref]
b1 b1 b1 b1 b1
== 5.3 ==[ref]
5.3 body
findme
= tests =[ref]
== syntax tests ==[ref]
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
+++ //---TODO comment--- // +++[ref]
+++ "---comment--- " +++[ref]
echo 'vim ok'
+++ #---comment--- # +++[ref]
print 'py ok'
+++ %---comment--- % +++[ref]
+++ /*---comment--- /* +++[ref]
+++ <!-- Comment +++[ref]
ft=html,xml
+++ html head <! +++[ref]
+++ /organizer node/ +++[ref]
+++ !warning mark +++[ref]
== Voomgrep tests ==[ref]
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
+++ n44 breakfast +++[ref]
eggs
bacon
+++ n45 lunch +++[ref]
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
+++ n46 dinner +++[ref]
eggs
Spam
ham
+++ n47 snack +++[ref]
bacon
spam
HAM
beef
== sort tests ==[ref]
+++ node 2 +++[ref]
++++ dddd ++++[ref]
d1
++++ eeee ++++[ref]
++++ dddd ++++[ref]
d2
++++ bbbb ++++[ref]
b
+++++ b_yyy +++++[ref]
+++++ b_xxx +++++[ref]
++++ cccc ++++[ref]
c
++++ aaaa ++++[ref]
a
+++++ a_nnn +++++[ref]
+++++ a_mmm +++++[ref]
+++ node 22 +++[ref]
+++ ñ +++[ref]
+++ Ñ +++[ref]
unicode tests
++++ э ++++[ref]
1
++++ Я ++++[ref]
2
++++ ю ++++[ref]
3
++++ Э ++++[ref]
4
++++ я ++++[ref]
5
++++ Ю ++++[ref]
6
+++ node 1 +++[ref]
++++ bbbb ++++[ref]
b
++++ dddd ++++[ref]
d1
++++ DDDD ++++[ref]
ingorecase test
++++ aaaa ++++[ref]
a
++++ dddd ++++[ref]
d2
++++ cccc ++++[ref]
c
+++ z +++[ref]
== special chars tests ==[ref]
+++ '" /\\/ +++[ref]
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
+++ Брожу ли я +++[ref]
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,249 @@
vim:fdm=marker:
vim:foldtext=getline(v\:foldstart).'...'.(v\:foldend-v\:foldstart):
findme findme2
---1--- {{{1
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
---1.1--- {{{2
1.1 body
---1.2--- {{{2
1.2 body
---2--- {{{1
2 body
---3--- {{{1o=
3 body
---3.1--- {{{2x
3.1 body
---3.2--- {{{2x
3.2 body
---3.2.1--- {{{3
3.2.1 body
---3.2.1.1--- {{{4
3.2.1.1 body
xxxx findme findme
---3.2.2--- {{{3
3.2.2 body
---3.2.2.1--- {{{4x
3.2.2.1 body
---3.2.2.1.1--- {{{5x
3.2.2.1.1 body
---3.2.2.1.2.1--- {{{6
3.2.2.1.2.1 body
---3.2.2.1.2.1.1--- {{{7x
3.2.2.1.2.1.1 body
---3.3--- {{{2
3.3 body
---4--- {{{1
4 body
---4.1--- {{{2
4.1 body findme
---5--- {{{1o
5 body
---5.1--- {{{2
5.1 body
---5.2--- {{{2o
5.2 body
---5.2.1--- {{{3
5.2.1 body
---5.2.2--- {{{3
5.2.2 body
---5.2.2.1--- {{{4o
5.2.2.1 body
---5.2.2.1.1--- {{{5
5.2.2.1.1 body
---5.2.2.1.2--- {{{5
5.2.2.1.2 body
---5.2.3--- {{{3
5.2.3 body
--- AA --- {{{2
a a a a
--- AA.1 --- {{{3
a1 a1 a1 a1
--- BB --- {{{2
b b b b
--- BB.1 --- {{{3
b1 b1 b1 b1 b1
---5.3--- {{{2
5.3 body
findme
---tests--- {{{1o
--- syntax tests --- {{{2
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
//---TODO comment--- //{{{3
"---comment--- "{{{3
echo 'vim ok'
#---comment--- #{{{3
print 'py ok'
%---comment--- %{{{3
/*---comment--- /*{{{3*/
<!-- Comment {{{3 -->
ft=html,xml
html head <!--{{{3-->
--- /organizer node/ --- {{{3
--- !warning mark --- {{{3
--- Voomgrep tests--- {{{2
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
--- n44 breakfast --- {{{3
eggs
bacon
--- n45 lunch --- {{{3
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
--- n46 dinner --- {{{3
eggs
Spam
ham
--- n47 snack --- {{{3
bacon
spam
HAM
beef
--- sort tests --- {{{2
--- node 2 --- {{{3
--- dddd --- {{{4x
d1
--- eeee --- {{{4
--- dddd --- {{{4
d2
--- bbbb --- {{{4o
b
--- b_yyy --- {{{5
--- b_xxx --- {{{5
--- cccc --- {{{4
c
--- aaaa --- {{{4
a
--- a_nnn --- {{{5
--- a_mmm --- {{{5
--- node 22 --- {{{3
--- ñ --- {{{3
--- Ñ --- {{{3
unicode tests
--- э --- {{{4
1
--- Я --- {{{4
2
--- ю --- {{{4
3
--- Э --- {{{4
4
--- я --- {{{4
5
--- Ю --- {{{4
6
--- node 1 --- {{{3
--- bbbb --- {{{4
b
--- dddd --- {{{4
d1
--- DDDD --- {{{4
ingorecase test
--- aaaa --- {{{4
a
--- dddd --- {{{4
d2
--- cccc --- {{{4
c
--- z --- {{{3
--- special chars tests --- {{{2
--- '" /\\/ --- {{{3 '" /\\/
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
--- Брожу ли я {{{3 вдоль улиц шумных? (utf-8)
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,249 @@
:Voom vimwiki
This is VOoM markup mode test file. Converted from **test_outline.txt**.
findme findme2
= 1 =
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
== 1.1 ==
1.1 body
== 1.2 ==
1.2 body
= 2 =
2 body
= 3 =
3 body
== 3.1 ==
3.1 body
== 3.2 ==
3.2 body
=== 3.2.1 ===
3.2.1 body
==== 3.2.1.1 ====
3.2.1.1 body
xxxx findme findme
=== 3.2.2 ===
3.2.2 body
==== 3.2.2.1 ====
3.2.2.1 body
===== 3.2.2.1.1 =====
3.2.2.1.1 body
====== 3.2.2.1.2.1 ======
3.2.2.1.2.1 body
======= 3.2.2.1.2.1.1 =======
3.2.2.1.2.1.1 body
== 3.3 ==
3.3 body
= 4 =
4 body
== 4.1 ==
4.1 body findme
= 5 =
5 body
== 5.1 ==
5.1 body
== 5.2 ==
5.2 body
=== 5.2.1 ===
5.2.1 body
=== 5.2.2 ===
5.2.2 body
==== 5.2.2.1 ====
5.2.2.1 body
===== 5.2.2.1.1 =====
5.2.2.1.1 body
===== 5.2.2.1.2 =====
5.2.2.1.2 body
=== 5.2.3 ===
5.2.3 body
== AA ==
a a a a
=== AA.1 ===
a1 a1 a1 a1
== BB ==
b b b b
=== BB.1 ===
b1 b1 b1 b1 b1
== 5.3 ==
5.3 body
findme
= tests =
== syntax tests ==
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
=== //---TODO comment--- // ===
=== "---comment--- " ===
echo 'vim ok'
=== #---comment--- # ===
print 'py ok'
=== %---comment--- % ===
=== /*---comment--- /* ===
=== <!-- Comment ===
ft=html,xml
=== html head <! ===
=== /organizer node/ ===
=== !warning mark ===
== Voomgrep tests ==
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
=== n44 breakfast ===
eggs
bacon
=== n45 lunch ===
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
=== n46 dinner ===
eggs
Spam
ham
=== n47 snack ===
bacon
spam
HAM
beef
== sort tests ==
=== node 2 ===
==== dddd ====
d1
==== eeee ====
==== dddd ====
d2
==== bbbb ====
b
===== b_yyy =====
===== b_xxx =====
==== cccc ====
c
==== aaaa ====
a
===== a_nnn =====
===== a_mmm =====
=== node 22 ===
=== ñ ===
=== Ñ ===
unicode tests
==== э ====
1
==== Я ====
2
==== ю ====
3
==== Э ====
4
==== я ====
5
==== Ю ====
6
=== node 1 ===
==== bbbb ====
b
==== dddd ====
d1
==== DDDD ====
ingorecase test
==== aaaa ====
a
==== dddd ====
d2
==== cccc ====
c
=== z ===
== special chars tests ==
=== '" /\\/ ===
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
=== Брожу ли я ===
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,250 @@
:Voom wiki
This is VOoM markup mode test file. Converted from **test_outline.txt**.
NOTE: MediaWiki format, with fold markers
findme findme2
= 1 = <!--{{{1-->
1 body
NEXT LINE IS FOR TESTS -- DO NOT MOVE OR EDIT
VO.levels=[1, 1, 2, 2, 1, 1, 2, 2, 3, 4, 3, 4, 5, 6, 7, 2, 1, 2, 1, 2, 2, 3, 3, 4, 5, 5, 3, 2, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 4, 4, 4, 4, 5, 5, 4, 4, 5, 5, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 2, 3, 3]
== 1.1 == <!--{{{2-->
1.1 body
== 1.2 == <!--{{{2-->
1.2 body
= 2 = <!--{{{1-->
2 body
= 3 = <!--{{{1o=-->
3 body
== 3.1 == <!--{{{2x-->
3.1 body
== 3.2 == <!--{{{2x-->
3.2 body
=== 3.2.1 === <!--{{{3-->
3.2.1 body
==== 3.2.1.1 ==== <!--{{{4-->
3.2.1.1 body
xxxx findme findme
=== 3.2.2 === <!--{{{3-->
3.2.2 body
==== 3.2.2.1 ==== <!--{{{4x-->
3.2.2.1 body
===== 3.2.2.1.1 ===== <!--{{{5x-->
3.2.2.1.1 body
====== 3.2.2.1.2.1 ====== <!--{{{6-->
3.2.2.1.2.1 body
======= 3.2.2.1.2.1.1 ======= <!--{{{7x-->
3.2.2.1.2.1.1 body
== 3.3 == <!--{{{2-->
3.3 body
= 4 = <!--{{{1-->
4 body
== 4.1 == <!--{{{2-->
4.1 body findme
= 5 = <!--{{{1o-->
5 body
== 5.1 == <!--{{{2-->
5.1 body
== 5.2 == <!--{{{2o-->
5.2 body
=== 5.2.1 === <!--{{{3-->
5.2.1 body
=== 5.2.2 === <!--{{{3-->
5.2.2 body
==== 5.2.2.1 ==== <!--{{{4o-->
5.2.2.1 body
===== 5.2.2.1.1 ===== <!--{{{5-->
5.2.2.1.1 body
===== 5.2.2.1.2 ===== <!--{{{5-->
5.2.2.1.2 body
=== 5.2.3 === <!--{{{3-->
5.2.3 body
== AA == <!--{{{2-->
a a a a
=== AA.1 === <!--{{{3-->
a1 a1 a1 a1
== BB == <!--{{{2-->
b b b b
=== BB.1 === <!--{{{3-->
b1 b1 b1 b1 b1
== 5.3 == <!--{{{2-->
5.3 body
findme
= tests = <!--{{{1o-->
== syntax tests == <!--{{{2-->
Since v2.1 comment chars before foldmarker are stripped according to filetype.
Some Body filetypes have their own Tree syntax hi.
=== //---TODO comment--- // === <!--{{{3-->
=== "---comment--- " === <!--{{{3-->
echo 'vim ok'
=== #---comment--- # === <!--{{{3-->
print 'py ok'
=== %---comment--- % === <!--{{{3-->
=== /*---comment--- /* === <!--{{{3*/-->
=== &lt;!-- Comment === <!--{{{3 --&gt;-->
ft=html,xml
=== html head &lt;! === <!--{{{3--&gt;-->
=== /organizer node/ === <!--{{{3-->
=== !warning mark === <!--{{{3-->
== Voomgrep tests == <!--{{{2-->
:Voomg Spam and ham not bacon
:Voomg Spam and\ ham not\ bacon
:Voomg Spam and\\ ham not\\ bacon
\Spam// ' "
=== n44 breakfast === <!--{{{3-->
eggs
bacon
=== n45 lunch === <!--{{{3-->
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
Spam Spam Spam Spam Spam Spam Spam Spam Spam
ham
=== n46 dinner === <!--{{{3-->
eggs
Spam
ham
=== n47 snack === <!--{{{3-->
bacon
spam
HAM
beef
== sort tests == <!--{{{2-->
=== node 2 === <!--{{{3-->
==== dddd ==== <!--{{{4x-->
d1
==== eeee ==== <!--{{{4-->
==== dddd ==== <!--{{{4-->
d2
==== bbbb ==== <!--{{{4o-->
b
===== b_yyy ===== <!--{{{5-->
===== b_xxx ===== <!--{{{5-->
==== cccc ==== <!--{{{4-->
c
==== aaaa ==== <!--{{{4-->
a
===== a_nnn ===== <!--{{{5-->
===== a_mmm ===== <!--{{{5-->
=== node 22 === <!--{{{3-->
=== ñ === <!--{{{3-->
=== Ñ === <!--{{{3-->
unicode tests
==== э ==== <!--{{{4-->
1
==== Я ==== <!--{{{4-->
2
==== ю ==== <!--{{{4-->
3
==== Э ==== <!--{{{4-->
4
==== я ==== <!--{{{4-->
5
==== Ю ==== <!--{{{4-->
6
=== node 1 === <!--{{{3-->
==== bbbb ==== <!--{{{4-->
b
==== dddd ==== <!--{{{4-->
d1
==== DDDD ==== <!--{{{4-->
ingorecase test
==== aaaa ==== <!--{{{4-->
a
==== dddd ==== <!--{{{4-->
d2
==== cccc ==== <!--{{{4-->
c
=== z === <!--{{{3-->
== special chars tests == <!--{{{2-->
=== '" /\\/ === <!--{{{3 '" /\\/-->
" "" """
' '' """
\ \\ \\\
/ // ///
\//\
=== Брожу ли я === <!--{{{3 вдоль улиц шумных? (utf-8)-->
Брожу. Чего ж не побродить.
Чебурашка CHeburashka
u'\u0427\u0435\u0431\u0443\u0440\u0430\u0448\u043a\u0430'
utf-8
'\xd0\xa7\xd0\xb5\xd0\xb1\xd1\x83\xd1\x80\xd0\xb0\xd1\x88\xd0\xba\xd0\xb0'

View File

@ -0,0 +1,82 @@
Installation instructions for VimOrganizer v. 0.30, November 2011
=================================================================
1. Install VimOrganizer files as you would any other ftplugin, with downloaded
files going in their respective directories under your .vim (Linux/Mac)
or vimfiles (Windows) directory.
2. Run helptags on the help file in the /doc directory, vimorg.txt,
so hep items can be accessed using the Vim help system.
3. Make sure your vimrc has these lines:
-------------------------------------
filetype plugin indent on
[...and then somewhere below that:]
au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
au BufEnter *.org call org#SetOrgFileType()
------------------------------------
If you use VimOrganizer much you will also want to configure variables
and/or functions in your vimrc. A sample vimrc has been included
in the download.
ALSO, you will want to install the plugins listed below. VimOrganizer
will work without them, but some functionality will be unavailable:
4. Make sure you have Calendar.vim installed.
(Calendar.vim comes included in the /plugin/ directory as part of
the Vim runtime in some Vim installs, otherwise available at:
http://www.vim.org/scripts/script.php?script_id=52)
Second, here are two plugins that you will want to download to
take advantage of Org-mode-like narrowing and link features that have been built
into VimOrganizer:
5. Christian Brabandt's NarrowRegion plugin. Find and install it from here:
http://www.vim.org/scripts/script.php?script_id=3075
6. The Utl "Universal Text Linking" plugin. Find and install it from here:
http://www.vim.org/scripts/script.php?script_id=293
If you are running on Windows another plugin will be useful:
7. If you're running on Windows then you may want to get Peter Rodding's
shell.vim plugin. It's not necessary, but if you have installed
it VimOrganizer will use it to ensure that you don't see
the annoying Windows command prompt window pop up when VimOrganizer
calls out to Emacs/Org-mode.
http://www.vim.org/scripts/script.php?script_id=3123
8. FINALLY, install Emacs. Not necessary for basic outlining, agenda
searches, and other basic stuff, but it is necessary to do exports
to html and PDF (which you will definitely want) as well as other
advanced stuff. Don't be afraid, install is simply and configuration
is not hard. Find Emacs here:
http://www.gnu.org/software/emacs/
Vimorg uses a variable, g:org_command_for_emacsclient, to hold the
command that will start the emacsclient on your system. If you are
not on Linux or OSX you will need to set this explicitly in your
vimrc file.
Also, please note that emacsclient works slightly differently on
Windows and Linux/OSX systems. You must manually start
Emacs on Linux/OSX or calls to emacsclient will not work. Please see
:h vimorg-emacs-setup
For Emacs you should also install a hook function in the .emacs file,
which will automatically make minor conversions when you export and/or
open a VimOrganizer .org file in Emacs. You can find the text for that
function in the VimOrganizer help file:
:h vimorg-orgmode-conversion
If you're scared of Emacs, don't worry. You don't ever need to edit
a document using Emacs. The most you will need to do is open up
the .emacs configuration file (in Vim) to make some configuration
changes, and that is required only if you're doing more advanced stuff.
Having said, that, if there are problems it can sometimes be easiest to
open Emacs and diagnose an issue there. Still, you don't ever need
to edit a document in Emacs, just think of Emacs as your "application
server".

View File

@ -0,0 +1,113 @@
* VimOrganizer CheatSheet
** Outline Navigation
TAB cycle visibilty of single headline/subtree
Shift-TAB cycle visibility of entire outline
,1 show level 1 heads only
,2 show up to level 2 headings
...
,,3 show up to level 3 heads for current heading only
,,5 show up to level 5 heads for current heading only
. . .
** Basic Outline Editing
Name your file with a '.org' extension and then just start adding
headings with asterisk to indicate heading level. NOTE: asterisks must
be in the leftmost column and must be separate from heading text by a
space. This document is an example showing headings, subheadings,
and text underneath each.
*** Adding new headlines
**** Enter, shift+Enter
add another headline of same level
<enter> works only in normal mode
**** Ctrl+Enter
add another headline of lower-level
**** Ctrl+Shift+Enter
add another headline of higher-level
** Time Stamps/Date-time prompt
The following commands may be issued anywhere within a headline and will
enter or edit the corresponding date for the headline. One date of
each type may be defined per headline (i.e, 'deadline', 'scheduled',
'closed', and 'regular'. You can enter more dates anywhere you want, but
this editing mechanism is currently restricted to dealing with only these
"primary" dates.
enter DEADLINE date for headline ,dd
enter SCHEDULED date for headline ,ds
enter CLOSED date for headline ,dc
enter regular date TIMESTAMP (i.e., no indicator) for headline
,dt
enter timestamp into text ,dg
The command-line prompt and calendar that appear when you enter a ,d<x>
command operate nearly the same as the date-time prompt in Emacs'
Org-mode. A few options are not yet implemented (e.g., the 'w'eek
options), but most should work just the same. For excellent documentation
on Org-mode's date-time prompt see:
:http://orgmode.org/manual/The-date_002ftime-prompt.html#The-date_002ftime-prompt
** Agenda Dashboard
Type ,ag to bring up the Agenda Dashboard, which allows you to launch
some searches.
** Set Agenda Files
Agenda files are held in a list: g:agenda_files. You can enter values for
g:agenda_files in your vimrc, e.g.,
:let g:agenda_files = ['myfile.org','c:/path/myfile.org']
You can also use Vimscript to assign multiple files at a time to
g:agenda_files. For example, putting the line below in your vimrc would
put all .org files in the org_files directory into g:agenda_files:
:let g:agenda_files = split(glob("~\desktop\org_files\*.org"),"\n")
User Interface for runtime editing of g:agenda_files:
There is a also a bare-bones agenda-editing mechanism that works like this:
(1) Put your .org working directories in list g:agenda_dirs. Mine is in my
vimrc and looks like this:
:let g:agenda_dirs=["c:/users/herbert/documents/my\ dropbox","c:/users/herbert/desktop/org_Files"]
(2) Then to edit your agenda files issue this command
:call EditAgendaFiles()
This will open a new tab and show your current agenda files along with a list
of all org files in your agenda dirs. Simply copy or move lines from the
agenda dirs list to the top and when done press :W (that's a capital 'W').
Order of agenda files is sometimes important, e.g., it is used when ordering
some agenda results.
** Tags
Tags for a file are defined using the SetupTags(<tag-setup-string>) function. There is an
example in the project's vimrc file. General structure of the
tag-setup-string is: (1) tags followed by the single-key access in parens,
(2) brackets (i.e., {} ) around sets of tags that are mutually exclusive.
For now you must place the single-key-access parens with character after the
tag, no letter is automatically assigned. The tags set up by SetupTags() are
used in the menu accessed by ,et .
edit tags -- ,et
view items with tag in agenda -- double-click tag,
(Note: The 'RunSearch' searches below can all be entered now
by accessing Agenda Dashboard (,ag) and pressing 'm')
view entries having both tag1 and tag2:
:call RunSearch('+tag1+tag2')
view entries having tag1 but not tag2:
:call RunSearch('+tag1-tag2')
view entries having tag1 or tag2:
:call RunSearch('+tag1|tag2')
view entries having tag1 that are also TODO:
:call RunSearch('+TODO+tag1')
view entries having tag1 that are also DONE:
:call RunSearch('+DONE+tag1')
view entries having tag1 that have any todo:
:call RunSearch('+ANY_TODO+tag1')

View File

@ -0,0 +1,175 @@
" This is an example vimrc that should work for testing purposes.
" Integrate the VimOrganizer specific sections into your own
" vimrc if you wish to use VimOrganizer on a regular basis. . .
"===================================================================
" THE NECESSARY STUFF"
" THe three lines below are necessary for VimOrganizer to work right
" =================================================================
filetype plugin indent on
" and then put these lines in vimrc somewhere after the line above
au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
au BufEnter *.org call org#SetOrgFileType()
"==============================================================
" THE UNNECESSARY STUFF"
"=============================================================
" Everything below here is a customization. None are needed.
"============================================================
" vars below are used to define default Todo list and
" default Tag list. Both of these can also be defined
" on a document-specific basis by config lines in a file.
" See :h vimorg-todo-metadata and/or :h vimorg-tag-metadata
" 'TODO | DONE' is the default,so not really necessary to define it at all
let g:org_todo_setup='TODO | DONE'
" OR, e.g.,:
"let g:org_todo_setup='TODO NEXT STARTED | DONE CANCELED'
" include a tags setup string if you want:
let g:org_tags_alist='{@home(h) @work(w) @tennisclub(t)} {easy(e) hard(d)} {computer(c) phone(p)}'
"
" g:org_agenda_dirs specify directories that, along with
" their subtrees, are searched for list of .org files when
" accessing EditAgendaFiles(). Specify your own here, otherwise
" default will be for g:org_agenda_dirs to hold single
" directory which is directory of the first .org file opened
" in current Vim instance:
" Below is line I use in my Windows install:
" NOTE: case sensitive even on windows.
let g:org_agenda_select_dirs=["~/desktop/org_files"]
let g:agenda_files = split(glob("~/desktop/org_files/org-mod*.org"),"\n")
" ---------------------
" Emacs setup
" --------------------
" To use Emacs you will need to define the client. On
" Linux/OSX this is typically simple, just:
"let g:org_command_for_emacsclient = 'emacsclient'
"
"On Windows it is more complicated, and probably involves creating
" a 'soft link' to the emacsclient executable (which is 'emacsclientw')
" See :h vimorg-emacs-setup
"let g:org_command_for_emacsclient = 'c:\users\herbert\emacsclientw.exe'
" ---------------------
" Custom Agenda Searches
" --------------------
" the assignment to g:org_custom_searches below defines searches that a
" a user can then easily access from the Org menu or the Agenda Dashboard.
" (Still need to add help on how to define them, assignment below
" is hopefully illustrative for now. . . . )
let g:org_custom_searches = [
\ { 'name':"Next week's agenda", 'type':'agenda',
\ 'agenda_date':'+1w','agenda_duration':'w'}
\, { 'name':"Next week's TODOS", 'type':'agenda',
\ 'agenda_date':'+1w','agenda_duration':'w','spec':'+UNFINISHED_TODOS'}
\, { 'name':'Home tags', 'type':'heading_list', 'spec':'+HOME'}
\, { 'name':'Home tags', 'type':'sparse_tree', 'spec':'+HOME'}
\ ]
" --------------------------------
" Custom colors
" --------------------------------"
" OrgCustomColors() allows a user to set highlighting for particular items
function! OrgCustomColors()
" various text item "highlightings" are below
" these are the defaults. Uncomment and change a line if you
" want different highlighting for the element
"
" below are defaults for any TODOS you define. TODOS that
" come before the | in a definition will use 'NOTDONETODO'
" and those that come after are DONETODO
"hi! DONETODO guifg=green ctermfg=green
"hi! NOTDONETODO guifg=red ctermfg=lightred
" heading level highlighting is done in pairs, one for the
" heading when unfoled and one for folded. Default is to make
" them the same except for the folded version being bold:
" assign OL1 pair for level 1, OL2 pair for level 2, etc.
"hi! OL1 guifg=somecolor guibg=somecolor
"hi! OL1Folded guifg=somecolor guibg=somecolor gui=bold
" tags are lines below headings that have :colon:separated:tags:
"hi! Org_Tag guifg=lightgreen ctermfg=blue
" lines that begin with '#+' in column 0 are config lines
"hi! Org_Config_Line guifg=darkgray ctermfg=magenta
"drawers are :PROPERTIES: and :LOGBOOK: lines and their associated
" :END: lines
"hi! Org_Drawer guifg=pink ctermfg=magenta
"hi! Org_Drawer_Folded guifg=pink ctermfg=magenta gui=bold cterm=bold
" this applies to value names in :PROPERTIES: blocks
"hi! Org_Property_Value guifg=pink ctermfg=magenta
" three lines below apply to different kinds of blocks
"hi! Org_Block guifg=#555555 ctermfg=magenta
"hi! Org_Src_Block guifg=#555555 ctermfg=magenta
"hi! Org_Table guifg=#888888 guibg=#333333 ctermfg=magenta
" dates are date specs between angle brackets (<>) or square brackets ([])
"hi! Org_Date guifg=magenta ctermfg=magenta gui=underline cterm=underline
" Org_Star is used to "hide" initial asterisks in a heading
"hi! Org_Star guifg=#444444 ctermfg=darkgray
"hi! Props guifg=#ffa0a0 ctermfg=gray
" bold, itals, underline, and code are highlights applied
" to character formatting
"hi! Org_Code guifg=darkgray gui=bold ctermfg=14
"hi! Org_Itals gui=italic guifg=#aaaaaa ctermfg=lightgray
"hi! Org_Bold gui=bold guifg=#aaaaaa ctermfg=lightgray
"hi! Org_Underline gui=underline guifg=#aaaaaa ctermfg=lightgray
"hi! Org_Lnumber guifg=#999999 ctermfg=gray
" these lines apply to links: [[link]], and [[link][link desc]]
"if has("conceal")
" hi! default linkends guifg=blue ctermfg=blue
"endif
"hi! Org_Full_Link guifg=cyan gui=underline ctermfg=lightblue cterm=underline
"hi! Org_Half_Link guifg=cyan gui=underline ctermfg=lightblue cterm=underline
" applies to the Heading line that can be displayed in column view
"highlight OrgColumnHeadings guibg=#444444 guifg=#aaaaaa gui=underline
" Use g:org_todo_custom_highlights to set up highlighting for individual
" TODO items. Without this all todos that designate an uninished state
" will be highlighted using NOTDONETODO highlight (see above)
" and all todos that designate a finished state will be highlighted using
" the DONETODO highlight (see above).
let g:org_todo_custom_highlights =
\ { 'NEXT': { 'guifg':'#888888', 'guibg':'#222222',
\ 'ctermfg':'gray', 'ctermbg':'darkgray'},
\ 'WAITING': { 'guifg':'#aa3388',
\ 'ctermfg':'red' } }
endfunction
" below are two examples of Org-mode "hook" functions
" These present opportunities for end-user customization
" of how VimOrganizer works. For more info see the
" documentation for hooks in Emacs' Org-mode documentation:
" http://orgmode.org/worg/org-configs/org-hooks.php#sec-1_40
"
" These two hooks are currently the only ones enabled in
" the VimOrganizer codebase, but they are easy to add so if
" there's a particular hook you want go ahead and request it
" or look for where these hooks are implemented in
" /ftplugin/org.vim and use them as example for placing your
" own hooks in VimOrganizer:
function! Org_property_changed_functions(line,key, val)
"call confirm("prop changed: ".a:line."--key:".a:key." val:".a:val)
endfunction
function! Org_after_todo_state_change_hook(line,state1, state2)
"call confirm("changed: ".a:line."--key:".a:state1." val:".a:state2)
"call OrgConfirmDrawer("LOGBOOK")
"let str = ": - State: " . org#Pad(a:state2,10) . " from: " . Pad(a:state1,10) .
" \ ' [' . org#Timestamp() . ']'
"call append(line("."), repeat(' ',len(matchstr(getline(line(".")),'^\s*'))) . str)
endfunction

View File

@ -0,0 +1,172 @@
" calutil.vim: some calendar utilities
" Author: Charles E. Campbell, Jr.
" with modifications by Herbert Sitz for VimOrganizer
" Date: Oct 08, 2008
" Version: 3b ASTRO-ONLY
" ---------------------------------------------------------------------
if exists("loaded_calutil")
finish
endif
let g:loaded_calutil= "v3b"
if v:version < 700
echohl WarningMsg
echo "***warning*** this version of calutil needs vim 7.0"
echohl Normal
finish
endif
function! calutil#dayname(date)
return calutil#DayOfWeek(split(a:date,'-')[0],split(a:date,'-')[1],split(a:date,'-')[2],2)
endfunction
function! calutil#dow(date)
return calutil#DayOfWeek(split(a:date,'-')[0],split(a:date,'-')[1],split(a:date,'-')[2],1)
endfunction
function! calutil#jul(date)
return calutil#Cal2Jul(split(a:date,'-')[0],split(a:date,'-')[1],split(a:date,'-')[2])
endfunction
function! calutil#cal(julian)
return calutil#Jul2Cal(a:julian)
endfunction
" ---------------------------------------------------------------------
" DayOfWeek: {{{1
" Usage : call calutil#DayOfWeek(y,m,d,[0|1|2])
" g:CalUtilDayOfWeek: if 0-> integer (default)
" 1-> 3-letter English abbreviation for name of day
" 2-> English name of day
" Returns
" g:CalUtilDayOfWeek
" ---------
" 1 : 0 1 2 3 4 5 6
" 2 : Mon Tue Wed Thu Fri Sat Sun
" 3 : Monday Tuesday Wednesday Thursday Friday Saturday Sunday
fun! calutil#DayOfWeek(y,m,d,...)
if a:0 > 0
let g:CalUtilDayOfWeek= a:1
endif
let z = calutil#Cal2Jul(a:y,a:m,a:d)
if z >= 0
let z= z%7
else
let z= 7 - (-z%7)
endif
if exists("g:CalUtilDayOfWeek")
if g:CalUtilDayOfWeek == 2
let dow0="Mon"
let dow1="Tue"
let dow2="Wed"
let dow3="Thu"
let dow4="Fri"
let dow5="Sat"
let dow6="Sun"
return dow{z}
elseif g:CalUtilDayOfWeek == 3
let dow0="Monday"
let dow1="Tuesday"
let dow2="Wednesday"
let dow3="Thursday"
let dow4="Friday"
let dow5="Saturday"
let dow6="Sunday"
return dow{z}
endif
endif
return z
endfun
" ---------------------------------------------------------------------
" calutil#Cal2Jul: convert a (after 9/14/1752) Gregorian calendar date to Julian day {{{1
" (on,before " ) Julian calendar date to Julian day
" (proleptic)
fun! calutil#Cal2Jul(y,m,d)
let year = a:y
let month= a:m
let day = a:d
" there is no year zero
if year == 0
let year= -1
elseif year < 0
let year= year + 1
endif
let julday= day - 32075 +
\ 1461*(year + 4800 + (month - 14)/12)/4 +
\ 367*(month - 2 - ((month - 14)/12)*12)/12 -
\ 3*((year + 4900 + (month - 14)/12)/100)/4
" 2361221 == Sep 2, 1752, which was followed immediately by
" Sep 14, 1752 (in England). Various countries
" adopted the Gregorian calendar at different times.
if julday <= 2361221
let a = (14-month)/12
let y = year + 4800 - a
let m = month + 12*a - 3
let julday = day + (153*m + 2)/5 + y*365 + y/4 - 32083
endif
return julday
endfun
" ---------------------------------------------------------------------
" calutil#Jul2Cal: convert a Julian day to a date: {{{1
" Default year/month/day
" julday,1 julday,"ymd" year/month/day
" julday,2 julday,"mdy" month/day/year
" julday,3 julday,"dmy" day/month/year
fun! calutil#Jul2Cal(julday,...)
let julday= a:julday
if julday <= 2361221
" Proleptic Julian Calendar:
" 2361210 == Sep 2, 1752, which was followed immediately by Sep 14, 1752
" in England
let c = julday + 32082
let d = (4*c + 3)/1461
let e = c - (1461*d)/4
let m = (5*e + 2)/153
let day = e - (153*m + 2)/5 + 1
let month = m + 3 - 12*(m/10)
let year = d - 4800 + m/10
if year <= 0
" proleptic Julian Calendar: there *is* no year 0!
let year= year - 1
endif
else
" Gregorian calendar
let t1 = julday + 68569
let t2 = 4*t1/146097
let t1 = t1 - (146097*t2 + 3)/4
let yr = 4000*(t1 + 1)/1461001
let t1 = t1 - (1461*yr/4 - 31)
let mo = 80*t1/2447
let day = (t1 - 2447*mo/80)
let t1 = mo/11
let month = (mo + 2 - 12*t1)
let year = (100*(t2 - 49) + yr + t1)
endif
let month = (month<10) ? '0' . month : month
let day = (day < 10) ? '0' . day : day
if a:0 > 0
if a:1 == 1 || a:1 =~ "ymd"
return year."-".month."/".day
elseif a:1 == 2 || a:1 =~ "mdy"
return month."-".day."/".year
elseif a:1 == 3 || a:1 =~ "dmy"
return day."-".month."/".year
else
return year."-".month."/".day
endif
else
return year."-".month."-".day
endif
endfun
" ---------------------------------------------------------------------
" vim: ts=4 fdm=marker

View File

@ -0,0 +1,77 @@
" org.vim - VimOrganizer plugin for Vim
" -------------------------------------------------------------
" Version: 0.30
" Maintainer: Herbert Sitz <hesitz@gmail.com>
" Last Change: 2011 Nov 02
"
" Script: http://www.vim.org/scripts/script.php?script_id=3342
" Github page: http://github.com/hsitz/VimOrganizer
" Copyright: (c) 2010, 2011 by Herbert Sitz
" The VIM LICENSE applies to all files in the
" VimOrganizer plugin.
" (See the Vim copyright except read "VimOrganizer"
" in places where that copyright refers to "Vim".)
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
" No warranty, express or implied.
" *** *** Use At-Your-Own-Risk *** ***
if exists("g:org_autoload_funcs")
finish
endif
let g:org_autoload_funcs=1
function! org#SetOrgFileType()
"if expand("%:e") == 'org'
if &filetype != 'org'
execute "set filetype=org"
" if !exists('g:org_todo_setup')
" let g:org_todo_setup = 'TODO | DONE'
" endif
" if !exists('g:org_tag_setup')
" let g:org_tag_setup = '{home(h) work(w)}'
" endif
"
" call OrgProcessConfigLines()
" exec "syntax match DONETODO '" . b:v.todoDoneMatch . "' containedin=OL1,OL2,OL3,OL4,OL5,OL6"
" exec "syntax match NOTDONETODO '" . b:v.todoNotDoneMatch . "' containedin=OL1,OL2,OL3,OL4,OL5,OL6"
endif
"endif
endfunction
function! org#Pad(s,amt)
return a:s . repeat(' ',a:amt - len(a:s))
endfunction
function! org#Timestamp()
return strftime("%Y-%m-%d %a %H:%M")
endfunction
function! org#GetGroupHighlight(group)
" this code was copied and modified from code posted on StackOverflow
" http://stackoverflow.com/questions/1331213/how-to-modify-existing-highlight-group-in-vim
" Redirect the output of the "hi" command into a variable
" and find the highlighting
redir => GroupDetails
exe "silent hi " . a:group
redir END
" Resolve linked groups to find the root highlighting scheme
while GroupDetails =~ "links to"
let index = stridx(GroupDetails, "links to") + len("links to")
let LinkedGroup = strpart(GroupDetails, index + 1)
redir => GroupDetails
exe "silent hi " . LinkedGroup
redir END
endwhile
" Extract the highlighting details (the bit after "xxx")
let MatchGroups = matchlist(GroupDetails, '\<xxx\>\s\+\(.*\)')
let ExistingHighlight = MatchGroups[1]
return ExistingHighlight
endfunction

View File

@ -0,0 +1,525 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file
" Desc: Tables
" | Easily | manageable | text | tables | ! |
" |--------+------------+-------+--------+---------|
" | Have | fun! | Drink | tea | Period. |
"
" Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/
" Load only once {{{
if exists("g:loaded_vimwiki_tbl_auto") || &cp
finish
endif
let g:loaded_vimwiki_tbl_auto = 1
"}}}
let s:textwidth = &tw
" Misc functions {{{
function! s:wide_len(str) "{{{
" vim73 has new function that gives correct string width.
if exists("*strdisplaywidth")
return strdisplaywidth(a:str)
endif
" get str display width in vim ver < 7.2
if !g:vimwiki_CJK_length
let ret = strlen(substitute(a:str, '.', 'x', 'g'))
else
let savemodified = &modified
let save_cursor = getpos('.')
exe "norm! o\<esc>"
call setline(line("."), a:str)
let ret = virtcol("$") - 1
d
call setpos('.', save_cursor)
let &modified = savemodified
endif
return ret
endfunction "}}}
function! s:is_table(line) "{{{
return a:line =~ '^\s*\%(|[^|]\+\)\+|\s*$' || s:is_separator(a:line)
endfunction "}}}
function! s:is_separator(line) "{{{
return a:line =~ '^\s*[|+]\s*--[-|+]\+'
endfunction "}}}
function! s:is_last_column(lnum, cnum) "{{{
return strpart(getline(a:lnum), a:cnum - 1) =~ '^[^|]*|\s*$'
endfunction "}}}
function! s:is_first_column(lnum, cnum) "{{{
let line = strpart(getline(a:lnum), 0, a:cnum - 1)
return line =~ '^\s*|[^|]*$' || line =~ '^\s*$'
endfunction "}}}
function! s:count_separators_up(lnum) "{{{
let lnum = a:lnum - 1
while lnum > 1
if !s:is_separator(getline(lnum))
break
endif
let lnum -= 1
endwhile
return (a:lnum-lnum)
endfunction "}}}
function! s:count_separators_down(lnum) "{{{
let lnum = a:lnum + 1
while lnum < line('$')
if !s:is_separator(getline(lnum))
break
endif
let lnum += 1
endwhile
return (lnum-a:lnum)
endfunction "}}}
function! s:create_empty_row(cols) "{{{
let first_cell = "| |"
let cell = " |"
let row = first_cell
for c in range(a:cols - 1)
let row .= cell
endfor
return row
endfunction "}}}
function! s:create_row_sep(cols) "{{{
let first_cell = "|---+"
let cell = "---+"
let last_cell = "---|"
if a:cols < 2
return "|---|"
endif
let row = first_cell
for c in range(a:cols - 2)
let row .= cell
endfor
let row .= last_cell
return row
endfunction "}}}
function! s:get_values(line) "{{{
return split(a:line, '\s*|\s*', 1)[1:-2]
endfunction "}}}
function! s:col_count(lnum) "{{{
let line = getline(a:lnum)
if !s:is_separator(line)
return len(split(line, '\s*|\s*', 1)[1:-2])
else
return len(split(line, '-+-', 1))
endif
endfunction "}}}
function! s:get_indent(lnum) "{{{
if !s:is_table(getline(a:lnum))
return
endif
let indent = 0
let lnum = a:lnum - 1
while lnum > 1
let line = getline(lnum)
if !s:is_table(line)
let indent = indent(lnum+1)
break
endif
let lnum -= 1
endwhile
return indent
endfunction " }}}
function! s:get_rows(lnum) "{{{
if !s:is_table(getline(a:lnum))
return
endif
let upper_rows = []
let lower_rows = []
let lnum = a:lnum - 1
while lnum > 1
let line = getline(lnum)
if s:is_table(line)
call add(upper_rows, [lnum, line])
else
break
endif
let lnum -= 1
endwhile
call reverse(upper_rows)
let lnum = a:lnum
while lnum <= line('$')
let line = getline(lnum)
if s:is_table(line)
call add(lower_rows, [lnum, line])
else
break
endif
let lnum += 1
endwhile
return upper_rows + lower_rows
endfunction "}}}
function! s:get_cell_max_lens(lnum) "{{{
let max_lens = {}
for [lnum, row] in s:get_rows(a:lnum)
if s:is_separator(row)
continue
endif
let cells = s:get_values(row)
for idx in range(len(cells))
let value = cells[idx]
if has_key(max_lens, idx)
let max_lens[idx] = max([s:wide_len(value), max_lens[idx]])
else
let max_lens[idx] = s:wide_len(value)
endif
endfor
endfor
return max_lens
endfunction "}}}
function! s:get_aligned_rows(lnum, col1, col2) "{{{
let max_lens = s:get_cell_max_lens(a:lnum)
let rows = []
for [lnum, row] in s:get_rows(a:lnum)
if s:is_separator(row)
let new_row = s:fmt_sep(max_lens, a:col1, a:col2)
else
let new_row = s:fmt_row(row, max_lens, a:col1, a:col2)
endif
call add(rows, [lnum, new_row])
endfor
return rows
endfunction "}}}
" Number of the current column. Starts from 0.
function! s:cur_column() "{{{
let line = getline('.')
if !s:is_table(line)
return -1
endif
if s:is_separator(line)
let sep = '[+|]'
else
let sep = '|'
endif
let curs_pos = col('.')
let mpos = match(line, '|', 0)
let col = -1
while mpos < curs_pos && mpos != -1
let mpos = match(line, sep, mpos+1)
if mpos != -1
let col += 1
endif
endwhile
return col
endfunction "}}}
" }}}
" Format functions {{{
function! s:fmt_cell(cell, max_len) "{{{
let cell = ' '.a:cell.' '
let diff = a:max_len - s:wide_len(a:cell)
if diff == 0 && empty(a:cell)
let diff = 1
endif
let cell .= repeat(' ', diff)
return cell
endfunction "}}}
function! s:fmt_row(line, max_lens, col1, col2) "{{{
let new_line = '|'
let cells = s:get_values(a:line)
for idx in range(len(cells))
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
let value = cells[idx]
let new_line .= s:fmt_cell(value, a:max_lens[idx]).'|'
endfor
let idx = len(cells)
while idx < len(a:max_lens)
let new_line .= s:fmt_cell('', a:max_lens[idx]).'|'
let idx += 1
endwhile
return new_line
endfunction "}}}
function! s:fmt_cell_sep(max_len) "{{{
if a:max_len == 0
return repeat('-', 3)
else
return repeat('-', a:max_len+2)
endif
endfunction "}}}
function! s:fmt_sep(max_lens, col1, col2) "{{{
let sep = '|'
for idx in range(len(a:max_lens))
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
let sep .= s:fmt_cell_sep(a:max_lens[idx]).'+'
endfor
let sep = substitute(sep, '+$', '|', '')
return sep
endfunction "}}}
"}}}
" Keyboard functions "{{{
function! s:kbd_create_new_row(cols, goto_first) "{{{
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
let cmd .= "\<ESC>:call org#tbl#format(line('.'))\<CR>"
if a:goto_first
let cmd .= "\<ESC>0:call search('|', 'c', line('.'))\<CR>la"
else
let cmd .= "0".(col('.')-1)."lT|a"
endif
return cmd
endfunction "}}}
function! s:kbd_goto_next_row() "{{{
let cmd = "\<ESC>jt|T|a"
return cmd
endfunction "}}}
function! s:kbd_goto_prev_row() "{{{
let cmd = "\<ESC>jt|T|a"
return cmd
endfunction "}}}
function! org#tbl#next_col(last)
return s:kbd_goto_next_col(a:last)
endfunction
function! s:kbd_goto_next_col(last) "{{{
if a:last
let seps = s:count_separators_down(line('.'))
if mode() == 'n'
let cmd = seps . "j0:call search('|', 'c', line('.'))\<CR>l"
else
let cmd = "\<ESC>".seps."j0:call search('|', 'c', line('.'))\<CR>la"
endif
else
if mode() == 'n'
let cmd = ":call search('|', 'c', line('.'))\<CR>l"
else
let cmd = "\<ESC>:call search('|', 'c', line('.'))\<CR>la"
endif
endif
return cmd
endfunction "}}}
function! org#tbl#prev_col(first)
return s:kbd_goto_prev_col(a:first)
endfunction
function! s:kbd_goto_prev_col(first) "{{{
if a:first
let seps = s:count_separators_up(line('.'))
let cmd = "\<ESC>".seps."k$:call search('|', 'b', line('.'))\<CR>la"
else
let cmd = "\<ESC>2F|la"
endif
return cmd
endfunction "}}}
"}}}
" Global functions {{{
function! org#tbl#kbd_cr() "{{{
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<CR>"
endif
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
let cols = len(s:get_values(getline(lnum)))
return s:kbd_create_new_row(cols, 0)
else
return s:kbd_goto_next_row()
endif
endfunction "}}}
function! org#tbl#kbd_tab() "{{{
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<Tab>"
endif
let last = s:is_last_column(lnum, col('.'))
if last && !s:is_table(getline(lnum+1))
let cols = len(s:get_values(getline(lnum)))
return s:kbd_create_new_row(cols, 1)
endif
return s:kbd_goto_next_col(last)
endfunction "}}}
function! org#tbl#kbd_shift_tab() "{{{
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<S-Tab>"
endif
let first = s:is_first_column(lnum, col('.'))
if first && !s:is_table(getline(lnum-1))
return ""
endif
return s:kbd_goto_prev_col(first)
endfunction "}}}
function! org#tbl#format(lnum, ...) "{{{
let line = getline(a:lnum)
if !s:is_table(line)
return
endif
if a:0 == 2
let col1 = a:1
let col2 = a:2
else
let col1 = 0
let col2 = 0
endif
let indent = s:get_indent(a:lnum)
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2)
let row = repeat(' ', indent).row
call setline(lnum, row)
endfor
let &tw = s:textwidth
endfunction "}}}
function! org#tbl#create(...) "{{{
if a:0 > 1
let cols = a:1
let rows = a:2
elseif a:0 == 1
let cols = a:1
let rows = 2
elseif a:0 == 0
let cols = 5
let rows = 2
endif
if cols < 1
let cols = 5
endif
if rows < 1
let rows = 2
endif
let lines = []
let row = s:create_empty_row(cols)
call add(lines, row)
if rows > 1
call add(lines, s:create_row_sep(cols))
endif
for r in range(rows - 1)
call add(lines, row)
endfor
call append(line('.'), lines)
endfunction "}}}
function! org#tbl#align_or_cmd(cmd) "{{{
if s:is_table(getline('.'))
call org#tbl#format(line('.'))
else
exe 'normal! '.a:cmd
endif
endfunction "}}}
function! org#tbl#reset_tw(lnum) "{{{
let line = getline(a:lnum)
if !s:is_table(line)
return
endif
let s:textwidth = &tw
let &tw = 0
endfunction "}}}
" TODO: move_column_left and move_column_right are good candidates to be
" refactored.
function! org#tbl#move_column_left() "{{{
if !s:is_table(getline('.'))
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col > 0
call org#tbl#format(line('.'), cur_col-1, cur_col)
call cursor(line('.'), 1)
if !s:is_separator(getline('.'))
call search('\%(|[^|]\+\)\{'.(cur_col-1).'}| .', 'eW')
else
call search('|\%([^+]\++\)\{'.(cur_col-1).'}--', 'eW')
endif
endif
endfunction "}}}
function! org#tbl#move_column_right() "{{{
if !s:is_table(getline('.'))
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col < s:col_count(line('.'))-1
call org#tbl#format(line('.'), cur_col, cur_col+1)
call cursor(line('.'), 1)
if !s:is_separator(getline('.'))
call search('\%(|[^|]\+\)\{'.(cur_col+1).'}| .', 'eW')
else
call search('|\%([^+]\++\)\{'.(cur_col+1).'}--', 'eW')
endif
endif
endfunction "}}}
function! org#tbl#get_rows(lnum) "{{{
return s:get_rows(a:lnum)
endfunction "}}}
"}}}

View File

@ -0,0 +1,15 @@
The vim73 patch in this directory does two things:
1. Enables level-dependent fold highlighting in Vim73.
2. Enables separate TODO highlighting in folded headings
in VimOrganizer, so TODO's stand out even when a
heading is folded.
The vim72 patch is old and only does (1) above.
If someone is using a version of Windows and wants to avoid
recompiling process you can contact me and I will send you an
executable you should be able to use on your system.
Herbert Sitz
hesitz@gmail.com

View File

@ -0,0 +1,79 @@
=== (+2,-1) src/eval.c ===
@@ -355,6 +355,7 @@
{VV_NAME("operator", VAR_STRING), VV_RO},
{VV_NAME("searchforward", VAR_NUMBER), 0},
{VV_NAME("oldfiles", VAR_LIST), 0},
+ {VV_NAME("foldhighlight", VAR_NUMBER), 0},
};
/* shorthand */
=== (+18,-9) src/screen.c ===
@@ -2179,9 +2179,17 @@
# define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \
ScreenAttrs[off + (p) + ri] = v
#endif
+ /*
+ * 4. Compose the folded-line string with 'foldtext', if set.
+ */
+ text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
+
+ txtcol = col; /* remember where text starts */
/* Set all attributes of the 'number' column and the text */
- RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
+ //RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
+ RL_MEMSET(col, hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)), W_WIDTH(wp) - col);
+
#ifdef FEAT_SIGNS
/* If signs are being displayed, add two spaces. */
@@ -2196,10 +2204,11 @@
if (wp->w_p_rl)
/* the line number isn't reversed */
copy_text_attr(off + W_WIDTH(wp) - len - col,
- (char_u *)" ", len, hl_attr(HLF_FL));
+ (char_u *)" ", len, hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
+
else
# endif
- copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL));
+ copy_text_attr(off + col, (char_u *)" ", len, hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
col += len;
}
}
@@ -2222,10 +2231,10 @@
if (wp->w_p_rl)
/* the line number isn't reversed */
copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
- hl_attr(HLF_FL));
+ hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
else
#endif
- copy_text_attr(off + col, buf, len, hl_attr(HLF_FL));
+ copy_text_attr(off + col, buf, len, hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
col += len;
}
}
@@ -2233,9 +2242,9 @@
/*
* 4. Compose the folded-line string with 'foldtext', if set.
*/
- text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
-
- txtcol = col; /* remember where text starts */
+ //text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
+// moved up above to heappen earlier h.s.
+ // txtcol = col; /* remember where text starts */
/*
* 5. move the text to current_ScreenLine. Fill up with "fill_fold".
=== (+3,-2) src/vim.h ===
@@ -1767,7 +1767,8 @@
#define VV_OP 52
#define VV_SEARCHFORWARD 53
#define VV_OLDFILES 54
-#define VV_LEN 55 /* number of v: vars */
+#define VV_FOLDHIGHLIGHT 55
+#define VV_LEN 56 /* number of v: vars */
#ifdef FEAT_CLIPBOARD

View File

@ -0,0 +1,113 @@
diff -u ./src/eval.c ./patched_src/eval.c
--- ./src/eval.c 2010-08-09 13:12:14.000000000 -0700
+++ ./patched_src/eval.c 2011-08-24 12:45:30.990183200 -0700
@@ -362,6 +362,8 @@
{VV_NAME("operator", VAR_STRING), VV_RO},
{VV_NAME("searchforward", VAR_NUMBER), 0},
{VV_NAME("oldfiles", VAR_LIST), 0},
+ {VV_NAME("foldhighlight", VAR_NUMBER), 0},
+ {VV_NAME("todohighlight", VAR_NUMBER), 0},
};
/* shorthand */
diff -u ./src/screen.c ./patched_src/screen.c
--- ./src/screen.c 2010-08-13 06:21:27.000000000 -0700
+++ ./patched_src/screen.c 2011-10-15 04:01:17.947926300 -0700
@@ -2214,6 +2214,8 @@
* 4. Compose the text
* 5. Add the text
* 6. set highlighting for the Visual area an other text
+ * NOTE: in patch for VimOrganizer step 4, composing text
+ * is moved up to happen as part of step 2.
*/
col = 0;
@@ -2271,10 +2273,16 @@
# define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \
ScreenAttrs[off + (p) + ri] = v
#endif
+ /*
+ * 4. Compose the folded-line string with 'foldtext', if set.
+ */
+ text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
+
+ txtcol = col; /* remember where text starts */
+
+ /* Set all attributes of the 'number' column and the text */
+ RL_MEMSET(col, syn_id2attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)), W_WIDTH(wp) - col);
- /* Set all attributes of the 'number' or 'relativenumber' column and the
- * text */
- RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
#ifdef FEAT_SIGNS
/* If signs are being displayed, add two spaces. */
@@ -2289,10 +2297,11 @@
if (wp->w_p_rl)
/* the line number isn't reversed */
copy_text_attr(off + W_WIDTH(wp) - len - col,
- (char_u *)" ", len, hl_attr(HLF_FL));
+ (char_u *)" ", len, hl_attr(HLF_SC));
else
# endif
- copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL));
+ copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_SC));
+
col += len;
}
}
@@ -2324,20 +2333,35 @@
if (wp->w_p_rl)
/* the line number isn't reversed */
copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
- hl_attr(HLF_FL));
+ hl_attr(HLF_N));
+ //syn_id2attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
+
else
#endif
- copy_text_attr(off + col, buf, len, hl_attr(HLF_FL));
+ copy_text_attr(off + col, buf, len, hl_attr(HLF_N));
+ //copy_text_attr(off + col, buf, len, syn_id2attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
+
col += len;
}
}
+ /* now set attributes for vimorganizer todo word in headline, if any */
+ /* v:todohighlight is set in user's OrgFoldText() function. . . */
+ if (get_vim_var_nr(VV_TODOHIGHLIGHT) > 0 )
+ {
+ int start=0, end;
+
+ while( *(text + start) == ' ' )
+ start++;
+ end = start;
+ while( *(text + end) != ' ' )
+ end++;
+ RL_MEMSET(start+col, syn_id2attr(get_vim_var_nr(VV_TODOHIGHLIGHT)), end - start);
+ }
/*
* 4. Compose the folded-line string with 'foldtext', if set.
*/
- text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
-
- txtcol = col; /* remember where text starts */
+ // moved up above to happen earlier h.s.
/*
* 5. move the text to current_ScreenLine. Fill up with "fill_fold".
diff -u ./src/vim.h ./patched_src/vim.h
--- ./src/vim.h 2010-07-29 11:46:39.000000000 -0700
+++ ./patched_src/vim.h 2011-08-11 14:22:52.525545700 -0700
@@ -1842,7 +1842,9 @@
#define VV_OP 52
#define VV_SEARCHFORWARD 53
#define VV_OLDFILES 54
-#define VV_LEN 55 /* number of v: vars */
+#define VV_FOLDHIGHLIGHT 55
+#define VV_TODOHIGHLIGHT 56
+#define VV_LEN 57 /* number of v: vars */
#ifdef FEAT_CLIPBOARD

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
" org.vim - VimOrganizer plugin for Vim
" -------------------------------------------------------------
" Version: 0.30
" Maintainer: Herbert Sitz <hesitz@gmail.com>
" Last Change: 2011 Nov 02
"
" Script: http://www.vim.org/scripts/script.php?script_id=3342
" Github page: http://github.com/hsitz/VimOrganizer
" Copyright: (c) 2010, 2011 by Herbert Sitz
" The VIM LICENSE applies to all files in the
" VimOrganizer plugin.
" (See the Vim copyright except read "VimOrganizer"
" in places where that copyright refers to "Vim".)
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
" No warranty, express or implied.
" *** *** Use At-Your-Own-Risk *** ***
nnoremap <silent> <buffer> <localleader>ag :call OrgAgendaDashboard()<cr>
nnoremap <silent> <buffer> <localleader>et :call OrgTagsEdit()<cr>
nnoremap <silent> <buffer> <localleader>ci :call OrgClockIn()<cr>
nnoremap <silent> <buffer> <localleader>co :call OrgClockOut()<cr>
nnoremap <silent> <buffer> <localleader>d :call OrgDateDashboard()<cr>
nnoremap <silent> <buffer> <localleader>t :call OrgTodoDashboard()<cr>
"nnoremap <silent> <buffer> q :sign unplace * | quit<cr>
nnoremap <silent> <buffer> q :call OrgQuitAgenda()<cr>
function! OrgQuitAgenda()
sign unplace *
bw
call clearmatches()
let b:v.chosen_agenda_heading = 0
if bufnr('ColHeadBuffer') > -1
"main window has column headings window that
"is now showing a blank buffer line, push back up . . .
resize 100
endif
"quit
endfunction
nnoremap <silent> <buffer> <c-tab> :wincmd k<cr>

View File

@ -0,0 +1,176 @@
" org.vim - VimOrganizer plugin for Vim
" -------------------------------------------------------------
" Version: 0.30
" Maintainer: Herbert Sitz <hesitz@gmail.com>
" Last Change: 2011 Nov 02
"
" Script: http://www.vim.org/scripts/script.php?script_id=3342
" Github page: http://github.com/hsitz/VimOrganizer
" Copyright: (c) 2010, 2011 by Herbert Sitz
" The VIM LICENSE applies to all files in the
" VimOrganizer plugin.
" (See the Vim copyright except read "VimOrganizer"
" in places where that copyright refers to "Vim".)
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
" No warranty, express or implied.
" *** *** Use At-Your-Own-Risk *** ***
"
"Section Mappings and Endstuff
" below block of 10 or 15 maps are ones collected
" from body of doc that weren't getting assigned for docs
" oepened after initial org filetype doc
nnoremap <silent> <buffer> <tab> :call OrgCycle()<cr>
nnoremap <silent> <buffer> <s-tab> :call OrgGlobalCycle()<cr>
nnoremap <silent> <buffer> <localleader>ci :call OrgClockIn(line("."))<cr>
nnoremap <silent> <buffer> <localleader>co :call OrgClockOut()<cr>
"cnoremap <space> <C-\>e(<SID>OrgDateEdit())<CR>
" dl is for the date on the current line
noremap <buffer> <localleader>x :call OrgExportDashboard()<cr>
noremap <buffer> <localleader>d :call OrgDateDashboard()<cr>
noremap <buffer> <localleader>b :call OrgTableDashboard()<cr>
"noremap <silent> <buffer> <localleader>dg :call OrgGenericDateEdit()<cr>
"noremap <silent> <buffer> <localleader>dt :call OrgDateEdit('TIMESTAMP')<cr>
"noremap <silent> <buffer> <localleader>dd :call OrgDateEdit('DEADLINE')<cr>
"noremap <silent> <buffer> <localleader>dc :call OrgDateEdit('CLOSED')<cr>
"noremap <silent> <buffer> <localleader>ds :call OrgDateEdit('SCHEDULED')<cr>
noremap <silent> <buffer> <localleader>a* :call OrgRunAgenda(strftime("%Y-%m-%d"),'w,'')<cr>
noremap <silent> <buffer> <localleader>aa :call OrgRunAgenda(strftime("%Y-%m-%d"),'w,'+ANY_TODO')<cr>
noremap <silent> <buffer> <localleader>at :call OrgRunAgenda(strftime("%Y-%m-%d"),'w,'+UNFINISHED_TODOS')<cr>
noremap <silent> <buffer> <localleader>ad :call OrgRunAgenda(strftime("%Y-%m-%d"),'w,'+FINISHED_TODOS')<cr>
noremap <silent> <buffer> <localleader>ag :call OrgAgendaDashboard()<cr>
noremap <silent> <buffer> <localleader>ac :call OrgCustomSearchMenu()<cr>
"command! -nargs=0 Agenda :call OrgAgendaDashboard()
nnoremap <silent> <buffer> <s-up> :call OrgDateInc(1)<CR>
nnoremap <silent> <buffer> <s-down> :call OrgDateInc(-1)<CR>
nnoremap <silent> <buffer> <2-LeftMouse> :call OrgMouseDate()<CR>
nnoremap <localleader>pl :call s:MyPopup()<cr>
inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>"
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
"map <silent> <localleader>b :call ShowBottomCal()<cr>
nnoremap <silent> <buffer> <localleader>et :call OrgTagsEdit()<cr>
" clear search matching
nnoremap <silent> <buffer> <localleader>cs :let @/=''<cr>
noremap <buffer> <localleader>r :call OrgRefileDashboard()<cr>
"noremap <silent> <buffer> <localleader>rh :call OrgRefile(line('.'))<cr>
"noremap <silent> <buffer> <localleader>rj :call OrgJumpToRefilePoint()<cr>
"noremap <silent> <buffer> <localleader>rx :call OrgJumpToRefilePointPersistent()<cr>
"noremap <silent> <buffer> <localleader>rs :call OrgSetRefilePoint()<cr>
"noremap <silent> <buffer> <localleader>rp :call OrgRefileToPermPoint(line('.'))<cr>
noremap <silent> <buffer> <localleader>v :silent call OrgEval()<cr>
noremap <buffer> <C-K> <C-]>
noremap <buffer> <C-N> <C-T>
noremap <silent> <buffer> <localleader>0 :call OrgExpandWithoutText(99999)<CR>
noremap <silent> <buffer> <localleader>9 :call OrgExpandWithoutText(9)<CR>
noremap <silent> <buffer> <localleader>8 :call OrgExpandWithoutText(8)<CR>
noremap <silent> <buffer> <localleader>7 :call OrgExpandWithoutText(7)<CR>
noremap <silent> <buffer> <localleader>6 :call OrgExpandWithoutText(6)<CR>
noremap <silent> <buffer> <localleader>5 :call OrgExpandWithoutText(5)<CR>
noremap <silent> <buffer> <localleader>4 :call OrgExpandWithoutText(4)<CR>
noremap <silent> <buffer> <localleader>3 :call OrgExpandWithoutText(3)<CR>
noremap <silent> <buffer> <localleader>2 :call OrgExpandWithoutText(2)<CR>
noremap <silent> <buffer> <localleader>1 :call OrgExpandWithoutText(1)<CR>
noremap <silent> <buffer> <localleader><space> :call OrgExpandWithoutText(1)<CR>
"noremap <silent> <buffer> <localleader>/ :let @/='exec call OrgExpandWithoutText(1)<CR>
"noremap <silent> <buffer> <localleader>/ :let @a='/^\*\{1,' . &foldlevel . '\} .*'|call LevSearch()<cr>
nnoremap <buffer> <expr> <localleader>/ '/^\*\{1,' . &foldlevel . '\} .*'
nnoremap <buffer> <expr> <localleader>? '?^\*\{1,' . &foldlevel . '\} .*'
" set reasonable max limit of 12 for '0' command below, because it iterates
" each for each level, just assume 12 is max. . .
noremap <silent> <buffer> <localleader>,0 :call OrgShowSubs(12,0)<CR>
noremap <silent> <buffer> <localleader>,9 :call OrgShowSubs(9,0)<CR>
noremap <silent> <buffer> <localleader>,8 :call OrgShowSubs(8,0)<CR>
noremap <silent> <buffer> <localleader>,7 :call OrgShowSubs(7,0)<CR>
noremap <silent> <buffer> <localleader>,6 :call OrgShowSubs(6,0)<CR>
noremap <silent> <buffer> <localleader>,5 :call OrgShowSubs(5,0)<CR>
noremap <silent> <buffer> <localleader>,4 :call OrgShowSubs(4,0)<CR>
noremap <silent> <buffer> <localleader>,3 :call OrgShowSubs(3,0)<CR>
noremap <silent> <buffer> <localleader>,2 :call OrgShowSubs(2,0)<CR>
noremap <silent> <buffer> <localleader>,1 :call OrgShowSubs(1,0)<CR>
noremap <silent> <buffer> <localleader>,; :call OrgShowSubs(1,0)<CR>
"nnoremap <silent> <buffer> <localleader>no :call NarrowOutline(line('.'))<cr>
"nnoremap <silent> <buffer> <localleader>ns :call NarrowOutline(line('.'))<cr>
"nnoremap <silent> <buffer> <localleader>nc :call NarrowCodeBlock(line('.'))<cr>
nnoremap <silent> <buffer> <localleader>na :call NarrowCodeBlock(line('.'))<cr>
nnoremap <silent> <buffer> <localleader>m :call OrgColumnsDashboard()<cr>
" ----------------------------------------
" table commands
au InsertEnter *.org :call org#tbl#reset_tw(line("."))
au InsertLeave *.org :call org#tbl#format(line("."))
command! -buffer -nargs=* OrgTable call org#tbl#create(<f-args>)
"nnoremap <silent> <buffer> <localleader>bc :call org#tbl#create()<cr>
command! -buffer OrgTableAlignQ call org#tbl#align_or_cmd('gqq')
command! -buffer OrgTableAlignW call org#tbl#align_or_cmd('gww')
command! -buffer OrgTableMoveColumnLeft call org#tbl#move_column_left()
"nnoremap <silent> <buffer> <localleader>bl :call org#tbl#move_column_left()<cr>
command! -buffer OrgTableMoveColumnRight call org#tbl#move_column_right()
"nnoremap <silent> <buffer> <localleader>br :call org#tbl#move_column_right()<cr>
" table function mappings
inoremap <buffer> <expr> <CR> org#tbl#kbd_cr()
inoremap <expr> <buffer> <Tab> org#tbl#kbd_tab()
inoremap <expr> <buffer> <S-Tab> org#tbl#kbd_shift_tab()
nnoremap <buffer> gqq :OrgTableAlignQ<CR>
nnoremap <buffer> gww :OrgTableAlignW<CR>
"nnoremap <silent><buffer> <A-Left> <Plug>OrgTableMoveColumnLeft
nnoremap <silent><script><buffer>
\ <Plug>OrgTableMoveColumnLeft :OrgTableMoveColumnLeft<CR>
"nnoremap <silent><buffer> <A-Right> <Plug>OrgTableMoveColumnRight
nnoremap <silent><script><buffer>
\ <Plug>OrgTableMoveColumnRight :OrgTableMoveColumnRight<CR>
" -------------------------------------
imap <silent> <buffer> <s-c-CR> <c-r>=OrgNewHead('levelup',1)<CR>
imap <silent> <buffer> <c-CR> <c-r>=OrgNewHead('leveldown',1)<CR>
imap <silent> <buffer> <s-CR> <c-r>=OrgNewHead('same',1)<CR>
nnoremap <silent> <buffer> <s-c-CR> :call OrgNewHead('levelup')<CR>
nnoremap <silent> <buffer> <c-CR> :call OrgNewHead('leveldown')<CR>
nnoremap <silent> <buffer> <CR> :call OrgEnterFunc()<CR>
nnoremap <silent> <buffer> <c-left> :call OrgShowLess(line("."))<CR>
nnoremap <silent> <buffer> <c-right> :call OrgShowMore(line("."))<CR>
nnoremap <silent> <buffer> <c-a-left> :call OrgMoveLevel(line("."),'left')<CR>
nnoremap <silent> <buffer> <c-a-right> :call OrgMoveLevel(line("."),'right')<CR>
nnoremap <silent> <buffer> <c-a-up> :<C-U>call OrgMoveLevel(line("."),'up',v:count1)<CR>
nnoremap <silent> <buffer> <c-a-down> :<C-U>call OrgMoveLevel(line("."),'down',v:count1)<CR>
nnoremap <silent> <buffer> <a-end> :call OrgNavigateLevels("end")<CR>
nnoremap <silent> <buffer> <a-home> :call OrgNavigateLevels("home")<CR>
nnoremap <silent> <buffer> <a-up> :call OrgNavigateLevels("up")<CR>
nnoremap <silent> <buffer> <a-down> :call OrgNavigateLevels("down")<CR>
nnoremap <silent> <buffer> <a-left> :call OrgNavigateLevels("left")<CR>
nnoremap <silent> <buffer> <a-right> :call OrgNavigateLevels("right")<CR>
nnoremap <silent> <buffer> <localleader>le :call EditLink()<cr>
nnoremap <silent> <buffer> <localleader>lf :call FollowLink(OrgGetLink())<cr>
nnoremap <silent> <buffer> <localleader>ln :/]]<cr>
nnoremap <silent> <buffer> <localleader>lp :?]]<cr>
nnoremap <silent> <buffer> <localleader>lc :set conceallevel=3\|set concealcursor=nc<cr>
nnoremap <silent> <buffer> <localleader>la :set conceallevel=3\|set concealcursor=c<cr>
nnoremap <silent> <buffer> <localleader>lx :set conceallevel=0<cr>
"nnoremap <silent> <buffer> <localleader>,e :call OrgSingleHeadingText("expand")<CR>
"nnoremap <silent> <buffer> <localleader>,E :call OrgBodyTextOperation(1,line("$"),"expand")<CR>
"nnoremap <silent> <buffer> <localleader>,C :call OrgBodyTextOperation(1,line("$"),"collapse")<CR>
"nnoremap <silent> <buffer> <localleader>,c :call OrgSingleHeadingText("collapse")<CR>
nnoremap <silent> <buffer> zc :call OrgDoSingleFold(line("."))<CR>
" below are alternate mappings for terminals, which
" don't support some of the above key combinations
nnoremap <silent> <buffer> ,<tab> :call OrgGlobalCycle()<cr>
nnoremap <silent> <buffer> <localleader>zu :call OrgNavigateLevels("up")<CR>
nnoremap <silent> <buffer> <localleader>zd :call OrgNavigateLevels("down")<CR>
nnoremap <silent> <buffer> <localleader>zl :call OrgNavigateLevels("left")<CR>
nnoremap <silent> <buffer> <localleader>zr :call OrgNavigateLevels("right")<CR>
nnoremap <silent> <buffer> <localleader>zL :call OrgMoveLevel(line("."),'left')<CR>
nnoremap <silent> <buffer> <localleader>zR :call OrgMoveLevel(line("."),'right')<CR>
nnoremap <silent> <buffer> <localleader>k :<c-u>call OrgMoveLevel(line("."),'up',v:count1)<CR>
nnoremap <silent> <buffer> <localleader>j :<c-u>call OrgMoveLevel(line("."),'down',v:count1)<CR>
nnoremap <silent> <buffer> <localleader>np :call OrgNewHead('levelup')<CR>
nnoremap <silent> <buffer> <localleader>ns :call OrgNewHead('leveldown')<CR>

View File

@ -0,0 +1,262 @@
" org.vim - VimOrganizer plugin for Vim
" -------------------------------------------------------------
" Version: 0.30
" Maintainer: Herbert Sitz <hesitz@gmail.com>
" Last Change: 2011 Nov 02
"
" Script: http://www.vim.org/scripts/script.php?script_id=3342
" Github page: http://github.com/hsitz/VimOrganizer
" Copyright: (c) 2010, 2011 by Herbert Sitz
" The VIM LICENSE applies to all files in the
" VimOrganizer plugin.
" (See the Vim copyright except read "VimOrganizer"
" in places where that copyright refers to "Vim".)
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
" No warranty, express or implied.
" *** *** Use At-Your-Own-Risk *** ***
" set indent of text lines beyond heading's left column
" 0 -- have text lines flush with their heading's left col
if !exists("g:org_indent_from_head")
let g:org_indent_from_head = 0
endif
if exists("b:did_indent") | finish
endif
let b:did_indent = 1
setlocal indentexpr=GetOrgIndent()
setlocal nolisp
setlocal nosmartindent
setlocal autoindent
"setlocal indentkeys+=},=\\item,=\\bibitem
" Only define the function once
"if exists("GetOrgIndent") | finish
"endif
function! GetOrgIndent(...)
" Find a non-blank line above the current line.
"let lnum = prevnonblank(v:lnum - 1)
let lnum = PrevNonBlank(v:lnum - 1)
" At the start of the file use zero indent.
if lnum == 0 | return 0
endif
let curline = getline(v:lnum) " current line
"let lminusone = getline(v:lnum-1)
"if b:v.last_lnum > 0) && (curline !~ '^\s*$')
" let lnum = b:v.last_lnum
" let b:v.last_lnum = 0
" endif
let ind = indent(lnum)
if b:v.suppress_list_indent == 1
let prevline = getline(lnum) " previous line
else
let prevline = getline(prevnonblank(v:lnum-1))
endif
if (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
let b:v.suppress_list_indent = 0
let b:v.org_list_offset=0
endif
if (curline =~ '^\*\+ ')
let ind = 0
" below lines are failsafes, hopefully redundant
let b:v.suppress_list_indent=0
let b:v.suppress_indent=0
elseif curline =~ '#+begin_'
let b:v.suppress_indent=1
let ind = 0
elseif curline =~ '#+end_'
let b:v.suppress_indent=0
let ind = 0
elseif curline =~ '^#+'
let ind = 0
"elseif (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
" \ && (len(synstack(v:lnum-1,1))>0)
" \ && (synIDattr(synstack(v:lnum-1,1)[0],'name') == 'orgList')
" let b:v.suppress_list_indent = 0
elseif b:v.suppress_indent == 1
return indent(curline)
elseif b:v.suppress_list_indent == 1
return len(matchstr(curline,'^\s*')) + b:v.org_list_offset
elseif (curline =~ '^\s*\(\d\+[.):]\|[-+] \)')
let before_ind = len(matchstr(curline,'^\s*'))
"let ind= ind
let b:v.org_list_offset = ind - before_ind
let b:v.suppress_list_indent = 1
elseif (curline =~'^\s*\d\+[).:]\s\+\S') || (curline =~'^\s*[-+\*]\s\+\S')
" if len(curline)>0
let ind = indent(curline)
" endif
elseif prevline =~ '^\*\+ '
let ind = len(matchstr(prevline,'^\*\+ ')) + g:org_indent_from_head
elseif prevline =~ '^\s*\d\+[).\]:]\s\+\S'
let ind = ind + len(matchstr(prevline,'^\s*\zs\d\+[).\]:]\s\+\ze\S'))
elseif prevline =~ '^\s*[-+\*]\s\+\S'
let ind = ind + len(matchstr(prevline,'^\s*\zs[-+\*]\s\+\ze\S'))
elseif (len(synstack(v:lnum,1))>0) && (synIDattr(synstack(v:lnum,1)[0],'name') == 'orgList')
let ind = len(matchstr(getline(v:lnum-1),'^\s*'))
endif
return ind
endfunction
function! PrevNonBlank(line)
let line = prevnonblank(a:line)
if (len(synstack(line,1))>0) && (synIDattr(synstack(line,1)[0],'name') == 'orgLisp')
execute line + 1
let line = search('^#+begin_src','nb')-1
elseif (len(synstack(line-1,1))>0) && (synIDattr(synstack(line-1,1)[0],'name') == 'orgList')
execute line - 1
let line = search('^\s*$','nb')-1
endif
return prevnonblank(line)
endfunction
function! GetTestIndent2(lnum)
" Find a non-blank line above the current line.
"let lnum = prevnonblank(a:lnum - 1)
let lnum = PrevNonBlank(a:lnum - 1)
" At the start of the file use zero indent.
if lnum == 0 | return 0
endif
let curline = getline(a:lnum) " current line
"let lminusone = getline(a:lnum-1)
"if b:v.last_lnum > 0) && (curline !~ '^\s*$')
" let lnum = b:v.last_lnum
" let b:v.last_lnum = 0
" endif
let ind = indent(lnum)
if b:v.suppress_list_indent == 1
let prevline = getline(lnum) " previous line
else
let prevline = getline(prevnonblank(a:lnum-1))
endif
if (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
let b:v.suppress_list_indent = 0
let b:v.org_list_offset=0
endif
if (curline =~ '^\*\+ ')
let ind = 0
" below lines are failsafes, hopefully redundant
let b:v.suppress_list_indent=0
let b:v.suppress_indent=0
elseif curline =~ '#+begin_'
let b:v.suppress_indent=1
let ind = 0
elseif curline =~ '#+end_'
let b:v.suppress_indent=0
let ind = 0
"elseif (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
" \ && (len(synstack(a:lnum-1,1))>0)
" \ && (synIDattr(synstack(a:lnum-1,1)[0],'name') == 'orgList')
" let b:v.suppress_list_indent = 0
elseif b:v.suppress_indent == 1
return indent(curline)
elseif b:v.suppress_list_indent == 1
return len(matchstr(curline,'^\s*')) + b:v.org_list_offset
elseif (curline =~ '^\s*\(\d\+[.):]\|[-+] \)')
let before_ind = len(matchstr(curline,'^\s*'))
"let ind= ind
let b:v.org_list_offset = ind - before_ind
let b:v.suppress_list_indent = 1
elseif (curline =~'^\s*\d\+[).:]\s\+\S') || (curline =~'^\s*[-+\*]\s\+\S')
" if len(curline)>0
let ind = indent(curline)
" endif
elseif prevline =~ '^\*\+ '
let ind = len(matchstr(prevline,'^\*\+ ')) + g:org_indent_from_head
elseif prevline =~ '^\s*\d\+[).\]:]\s\+\S'
let ind = ind + len(matchstr(prevline,'^\s*\zs\d\+[).\]:]\s\+\ze\S'))
elseif prevline =~ '^\s*[-+\*]\s\+\S'
let ind = ind + len(matchstr(prevline,'^\s*\zs[-+\*]\s\+\ze\S'))
elseif (len(synstack(a:lnum,1))>0) && (synIDattr(synstack(a:lnum,1)[0],'name') == 'orgList')
let ind = len(matchstr(getline(a:lnum-1),'^\s*'))
endif
return ind
endfunction
function! GetTestIndent(lnum)
" Find a non-blank line above the current line.
"let lnum = prevnonblank(a:lnum - 1)
let lnum = PrevNonBlank(a:lnum - 1)
" At the start of the file use zero indent.
if lnum == 0 | return 0
endif
let curline = getline(a:lnum) " current line
"let lminusone = getline(a:lnum-1)
"if b:v.last_lnum > 0) && (curline !~ '^\s*$')
" let lnum = b:v.last_lnum
" let b:v.last_lnum = 0
" endif
let ind = indent(lnum)
if b:v.suppress_list_indent == 1
let prevline = getline(lnum) " previous line
else
let prevline = getline(prevnonblank(v:lnum-1))
endif
if (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
let b:v.suppress_list_indent = 0
let b:v.org_list_offset=0
endif
if (curline =~ '^\*\+ ')
let ind = 0
" below lines are failsafes, hopefully redundant
let b:v.suppress_list_indent=0
let b:v.suppress_indent=0
elseif curline =~ '#+begin_'
let b:v.suppress_indent=1
let ind = 0
elseif curline =~ '#+end_'
let b:v.suppress_indent=0
let ind = 0
"elseif (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
" \ && (len(synstack(a:lnum-1,1))>0)
" \ && (synIDattr(synstack(a:lnum-1,1)[0],'name') == 'orgList')
" let b:v.suppress_list_indent = 0
elseif b:v.suppress_indent == 1
return indent(curline)
elseif b:v.suppress_list_indent == 1
return len(matchstr(curline,'^\s*')) + b:v.org_list_offset
elseif (curline =~ '^\s*\(\d\+[.):]\|[-+] \)')
let before_ind = len(matchstr(curline,'^\s*'))
"let ind= ind
let b:v.org_list_offset = ind - before_ind
let b:v.suppress_list_indent = 1
elseif (curline =~'^\s*\d\+[).:]\s\+\S') || (curline =~'^\s*[-+\*]\s\+\S')
" if len(curline)>0
let ind = indent(curline)
" endif
elseif prevline =~ '^\*\+ '
let ind = len(matchstr(prevline,'^\*\+ ')) + g:org_indent_from_head
elseif prevline =~ '^\s*\d\+[).\]:]\s\+\S'
let ind = ind + len(matchstr(prevline,'^\s*\zs\d\+[).\]:]\s\+\ze\S'))
elseif prevline =~ '^\s*[-+\*]\s\+\S'
let ind = ind + len(matchstr(prevline,'^\s*\zs[-+\*]\s\+\ze\S'))
endif
return ind
endfunction

View File

@ -0,0 +1,130 @@
VimOrganizer version 0.30, November 2, 2011. Requires Vim version that
is compiled with support for folding and tabs. Conceal will
be taken advantage of if working with Vim73 supporting conceal.
(Also, I STRONGLY suggest that you apply a patch to Vim so that
folded headings can have level-dependent highlighting,
patch for Vim73 is in contrib directory of the download. If you're on
Windows contact me and I should be able to provide you with an
executable. If I hadn't been able to make Vim do this I would have
bitten the bullet and moved to Emacs, as much as I hate editing in Emacs.)
VimOrganizer is a Vim filetype plugin that attempts to clone Emacs' Org-mode.
It is currently (November 2011) in an alpha-stage, both in terms of (1) the
breadth and depth of Org-mode features it clones and (2) the stability of its
operation. It is nevertheless very usable.
Some of the ADDITIONS AND IMPROVEMENTS since previous (December 2010) version:
-- Adjusts to any colorscheme
-- Org menu in gvim.
-- "Dashboards" to assist with Date entry, Columns, Tables,
Agenda searches, and exporting.
-- VimOrganizer help file to install in Vim.
-- Better compatibility with Org-mode files. Open, edit, and save same
files in Org-mode and/or VimOrganizer with (some) of the functionality and
configuration-specific options of Org-mode supported in VimOrganizer.
-- Support for Org-mode style links (as well as use of 'Conceal' in Vim73
to hide link brackets and
descriptions)
-- Easy to use Org-like column mode, including column headings,
inherited columns, support for Org column blocks, and ability to
specify a list of custom column specs to apply in any buffer.
-- Org-like narrowing of code blocks and subtrees
-- Support for Org-like specifications of TODOS, tags, dates,
including support for Org-compatible config lines in a file.
-- Support for Org-like CATEGORIES, both in specification and in
their inherited behavior.
-- Search specification in Agenda searches is now nearly identical
to specification of searches in Org-mode.
-- User can specify list of commonly used custom agenda searches.
-- Clockin, clockout, and (when a running Emacs server is available,
clocktable block creation and updates.
-- Org-like "refiling"
-- Easy creation and editing of tables, as well as (when a running Emacs
server is available) manipulation and evaluation of tables, including
all spreadsheet functionality in Org-mode.
-- "Live" block evaluation (when a running Emacs server is available)
-- Support for nearly all the export types and export options
available in Org-mode (when running Emacs server is available)
-- Call out to an Emacs server to do "tangling" (literate programming).
-- Many bug fixes and small improvements
Org-mode, and thus VimOrganizer, is a text-editor plugin/application that can
be used for (1) keeping notes, (2) maintaining TODO lists, (3) planning
projects, and/or (4) authoring and publishing documents, including support for
literate programming and "reproducible research". Like Org-mode, VimOrganizer
does this by implementing a flexible plain-text system with a lightly
structured document format. Org-mode has been in constant development for
seven or eight years, and continues to be developed. Work on VimOrganizer is
likewise ongoing, but VimOrganizer is at present a smaller and less ambitious
project than Org-mode.
File formats and basic workflows for VimOrganizer and Org-mode are very
similar (files auto-convert as part of loading process) and VimOrganizer
actually calls out to an Emacs' Org-mode server to
implement important features, e.g., exporting to pdf format for printing.
Thus, to make full use of VimOrganizer you will want to have an Emacs'
server running alongside. In most cases this requires little knowledge of
Emacs other than how to start it up and add a few lines to the '.emacs' file,
Emacs' counterpart to Vim's '.vimrc'. (You can even edit the .emacs file in
Vim.) VimOrganizer is focused on leveraging Org-mode by accessing it via
an Emacs server, and re-implementing in Vim only what is necessary and makes
sense.
VimOrganizer also lets Vim users access Org-babel, a subproject of
Org-mode that allows execution of source-code blocks in org-format
documents. Uses for Org-babel range from writing technical research papers to
simply using a VimOrganizer document as a "language-scratchpad". Over
twenty languages are supported, including C, R, Lisp, Python, Perl, Ruby,
and others. VimOrganizer calls out to a running Emacs server for Org-babel
processing; functionality and speed are essentially the same as
when editing with Org-mode in Emacs.
VimOrganizer has a first draft of a Vim help file, but the best first step in
learning about VimOrganizer is to learn about Emacs' Org-mode. VimOrganizer
uses the same basic concepts but implements them within the context of Vim
(and with a reduced feature set). Org-mode's main documentation and
support newsgroup are found here:
Org-mode Main Manual: http://orgmode.org/manual/index.html
Org-mode Compact Guide: http://orgmode.org/guide/index.html
Org-mode support: http://news.gmane.org/gmane.emacs.orgmode
Org-babel information: http://orgmode.org/worg/org-contrib/babel/
VimOrganizer help can be found here:
https://github.com/hsitz/VimOrganizer/blob/master/doc/vimorg.txt
==========================
INSTALLATION INSTRUCTIONS
===========================
https://github.com/hsitz/VimOrganizer/blob/master/INSTALL.txt
QUESTIONS, COMMENTS, SUGGESTIONS
================================
Questions, comments, and suggestions regarding VimOrganizer are always
appreciated. The preferred place for those is in the VimOrganizer newsgroup
here:
http://groups.google.com/group/vimorganizer/topics
VimOrganizer project files are maintained at github and the version
there may be more recent than the files at vim.org:
https://github.com/hsitz/VimOrganizer
----------------------------------------------------------------
NOTE: some code from other Vim plugins has been incorporated into the
VimOrganizer script files. Do NOT download these plugins to use them
with VimOrganizer; since VimOrganizer does not call out to them in any way:
1. Charles Campbell's great calendar utilities
2. Table editing routines from Maxim Kim's excellent vimwiki plugin.
These are really quite nice (seem to be inspired by Org-mode's
own table-editing stuff) and deserve to be offered as a separate
plugin of their own, not dependent on any larger project. (If
VimOrganizer is not quite the sort of plugin you're looking for then
vimwiki may be.)
----------------------------------------------------------------
VimOrganizer page at vim.org:
http://www.vim.org/scripts/script.php?script_id=3342

View File

@ -0,0 +1,102 @@
" org.vim - VimOrganizer plugin for Vim
" -------------------------------------------------------------
" Version: 0.30
" Maintainer: Herbert Sitz <hesitz@gmail.com>
" Last Change: 2011 Nov 02
"
" Script: http://www.vim.org/scripts/script.php?script_id=3342
" Github page: http://github.com/hsitz/VimOrganizer
" Copyright: (c) 2010, 2011 by Herbert Sitz
" The VIM LICENSE applies to all files in the
" VimOrganizer plugin.
" (See the Vim copyright except read "VimOrganizer"
" in places where that copyright refers to "Vim".)
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
" No warranty, express or implied.
" *** *** Use At-Your-Own-Risk *** ***
" THIS FUNC is only for variable stars per level, currently
" not exposed to users
function! s:SynStars(perlevel)
let b:levelstars = a:perlevel
exe 'syntax match OL1 +^\(*\)\{1}\s.*+ contains=stars'
exe 'syntax match OL2 +^\(*\)\{'.( 1 + 1*a:perlevel).'}\s.*+ contains=stars'
exe 'syntax match OL3 +^\(*\)\{'.(1 + 2*a:perlevel).'}\s.*+ contains=stars'
exe 'syntax match OL4 +^\(*\)\{'.(1 + 3*a:perlevel).'}\s.*+ contains=stars'
exe 'syntax match OL5 +^\(*\)\{'.(1 + 4*a:perlevel).'}\s.*+ contains=stars'
exe 'syntax match OL6 +^\(*\)\{'.(1 + 5*a:perlevel).'}\s.*+ contains=stars'
exe 'syntax match OL7 +^\(*\)\{'.(1 + 6*a:perlevel).'}\s.*+ contains=stars'
exe 'syntax match OL8 +^\(*\)\{'.(1 + 7*a:perlevel).'}\s.*+ contains=stars'
exe 'syntax match OL9 +^\(*\)\{'.(1 + 8*a:perlevel).'}\s.*+ contains=stars'
endfunction
command! ChangeSyn call <SID>SynStars(b:levelstars)
syntax match Org_Property_Value +^\s*:\S*:\ze.*+
syntax match Org_Tag +\s*:\S*:$+
syntax match Org_Drawer +^\s*:\(PROPERTIES\|LOGBOOK\|END\):\ze.*+
syntax match Org_Date +[<[]\d\d\d\d-\d\d-\d\d.\{-1,}[\]>]+
syntax match Org_Star +\*\+\*+me=e-1 contained
syntax match Org_Table +^\s*|.\+|\s*$+
"syntax match NEXT '\* \zsNEXT' containedin=OL1,OL2,OL3,OL4,OL5,OL6
"syntax match CANCELED '\* \zsCANCELED' containedin=OL1,OL2,OL3,OL4,OL5,OL6
"syntax match TODO '\* \zsTODO' containedin=OL1,OL2,OL3,OL4,OL5,OL6
"syntax match STARTED '\* \zsSTARTED' containedin=OL1,OL2,OL3,OL4,OL5,OL6
"syntax match DONE '\* \zsDONE' containedin=OL1,OL2,OL3,OL4,OL5,OL6
syntax match Org_Config_Line '^#+.*' containedin=Org_Block,Org_Src_Block
syntax region Org_Block start='\c^#+begin.*$' end='\c^#+end.*' keepend contains=Org_Config_Line
syntax region Org_Src_Block start='\c^#+begin_src.*$' end='\c^#+end.*' keepend contains=Org_Config_Line
syntax match OL1 +^\(*\)\{1}\s.*+ contains=stars
syntax match OL2 +^\(*\)\{2}\s.*+ contains=stars
syntax match OL3 +^\(*\)\{3}\s.*+ contains=stars
syntax match OL4 +^\(*\)\{4}\s.*+ contains=stars
syntax match OL5 +^\(*\)\{5}\s.*+ contains=stars
syntax match OL6 +^\(*\)\{6}\s.*+ contains=stars
syntax match OL7 +^\(*\)\{7}\s.*+ contains=stars
syntax match OL8 +^\(*\)\{8}\s.*+ contains=stars
syntax match OL9 +^\(*\)\{9}\s.*+ contains=stars
" character highlights
syn match Org_Code '=\S.\{-}\S='
syn match Org_Itals '\(\_^\|\W\)/\zs\S[^/]\{-}\S\ze/\_W'
syn match Org_Bold '\(\_^\|\W\)\*\zs\S[^*]\{-}\S\ze\*\_W'
syn match Org_Underline '\(\_^\|\W\)_\zs\S[^_]\{-}\S\ze_\_W'
syn match Org_Lnumber '^\t*\(\d\.\)*\s\s' contained
if has("conceal")
syn region Org_Half_Link concealends matchgroup=linkends start='\[\[' end=']]' contains=FullLink
syn region Org_Full_Link concealends matchgroup=linkends start='\[\[\(.\{-1,}\)]\[' end=']]'
endif
"exec "syntax match DONETODO '" . b:v.todoDoneMatch . "' containedin=OL1,OL2,OL3,OL4,OL5,OL6"
"exec "syntax match NOTDONETODO '" . b:v.todoNotDoneMatch . "' containedin=OL1,OL2,OL3,OL4,OL5,OL6"
" ***********************************************
" section below is example for having subregions
" of code in an .org file that use syntax highlighting
" for the language in the code block itself
" not regular Org syntax highlighting.
" See Emacs' Org documentation for some details:
" http://orgmode.org/manual/Working-With-Source-Code.html#Working-With-Source-Code
" Notice that much of the functionality of
" source code blocks is for when they are exported or 'tangled'.
" VimOrganizer calls out to an Emacs server for exports (and,
" -- soon to come -- for tangling) so the functionality described
" in the Emacs Org-mode docs already exists for VimOrganizer.
"
" The example below is for Lisp, other languages could be added
" using same priciple. In addition to using context-sensitive
" syntax highlighting for code blocks, VimOrganizer will
" eventually use context-sensitive language indent-rules. . .
" ************************************************"
let b:current_syntax=''
unlet b:current_syntax
syntax include @Lispcode $VIMRUNTIME/syntax/lisp.vim
syntax region orgLisp start='^#+begin_src/semacs-lisp' end='^#+end_src$' contains=@Lispcode
let b:current_syntax = 'combined'
hi orgLisp gui=bold
" vim600: set foldmethod=marker foldlevel=0:

840
vim_plugins_src/a.vim Normal file
View File

@ -0,0 +1,840 @@
" Copyright (c) 1998-2006
" Michael Sharpe <feline@irendi.com>
"
" We grant permission to use, copy modify, distribute, and sell this
" software for any purpose without fee, provided that the above copyright
" notice and this text are not removed. We make no guarantee about the
" suitability of this software for any purpose and we are not liable
" for any damages resulting from its use. Further, we are under no
" obligation to maintain or extend this software. It is provided on an
" "as is" basis without any expressed or implied warranty.
" Directory & regex enhancements added by Bindu Wavell who is well known on
" vim.sf.net
"
" Patch for spaces in files/directories from Nathan Stien (also reported by
" Soeren Sonnenburg)
" Do not load a.vim if is has already been loaded.
if exists("loaded_alternateFile")
finish
endif
if (v:progname == "ex")
finish
endif
let loaded_alternateFile = 1
let alternateExtensionsDict = {}
" setup the default set of alternate extensions. The user can override in thier
" .vimrc if the defaults are not suitable. To override in a .vimrc simply set a
" g:alternateExtensions_<EXT> variable to a comma separated list of alternates,
" where <EXT> is the extension to map.
" E.g. let g:alternateExtensions_CPP = "inc,h,H,HPP,hpp"
" let g:alternateExtensions_{'aspx.cs'} = "aspx"
" This variable will be increased when an extension with greater number of dots
" is added by the AddAlternateExtensionMapping call.
let s:maxDotsInExtension = 1
" Function : AddAlternateExtensionMapping (PRIVATE)
" Purpose : simple helper function to add the default alternate extension
" mappings.
" Args : extension -- the extension to map
" alternates -- comma separated list of alternates extensions
" Returns : nothing
" Author : Michael Sharpe <feline@irendi.com>
function! <SID>AddAlternateExtensionMapping(extension, alternates)
" This code does not actually work for variables like foo{'a.b.c.d.e'}
"let varName = "g:alternateExtensions_" . a:extension
"if (!exists(varName))
" let g:alternateExtensions_{a:extension} = a:alternates
"endif
" This code handles extensions which contains a dot. exists() fails with
" such names.
"let v:errmsg = ""
" FIXME this line causes ex to return 1 instead of 0 for some reason??
"silent! echo g:alternateExtensions_{a:extension}
"if (v:errmsg != "")
"let g:alternateExtensions_{a:extension} = a:alternates
"endif
let g:alternateExtensionsDict[a:extension] = a:alternates
let dotsNumber = strlen(substitute(a:extension, "[^.]", "", "g"))
if s:maxDotsInExtension < dotsNumber
let s:maxDotsInExtension = dotsNumber
endif
endfunction
" Add all the default extensions
" Mappings for C and C++
call <SID>AddAlternateExtensionMapping('h',"c,cpp,cxx,cc,CC")
call <SID>AddAlternateExtensionMapping('H',"C,CPP,CXX,CC")
call <SID>AddAlternateExtensionMapping('hpp',"cpp,c")
call <SID>AddAlternateExtensionMapping('HPP',"CPP,C")
call <SID>AddAlternateExtensionMapping('c',"h")
call <SID>AddAlternateExtensionMapping('C',"H")
call <SID>AddAlternateExtensionMapping('cpp',"h,hpp")
call <SID>AddAlternateExtensionMapping('CPP',"H,HPP")
call <SID>AddAlternateExtensionMapping('cc',"h")
call <SID>AddAlternateExtensionMapping('CC',"H,h")
call <SID>AddAlternateExtensionMapping('cxx',"h")
call <SID>AddAlternateExtensionMapping('CXX',"H")
" Mappings for PSL7
call <SID>AddAlternateExtensionMapping('psl',"ph")
call <SID>AddAlternateExtensionMapping('ph',"psl")
" Mappings for ADA
call <SID>AddAlternateExtensionMapping('adb',"ads")
call <SID>AddAlternateExtensionMapping('ads',"adb")
" Mappings for lex and yacc files
call <SID>AddAlternateExtensionMapping('l',"y,yacc,ypp")
call <SID>AddAlternateExtensionMapping('lex',"yacc,y,ypp")
call <SID>AddAlternateExtensionMapping('lpp',"ypp,y,yacc")
call <SID>AddAlternateExtensionMapping('y',"l,lex,lpp")
call <SID>AddAlternateExtensionMapping('yacc',"lex,l,lpp")
call <SID>AddAlternateExtensionMapping('ypp',"lpp,l,lex")
" Mappings for OCaml
call <SID>AddAlternateExtensionMapping('ml',"mli")
call <SID>AddAlternateExtensionMapping('mli',"ml")
" ASP stuff
call <SID>AddAlternateExtensionMapping('aspx.cs', 'aspx')
call <SID>AddAlternateExtensionMapping('aspx.vb', 'aspx')
call <SID>AddAlternateExtensionMapping('aspx', 'aspx.cs,aspx.vb')
" Setup default search path, unless the user has specified
" a path in their [._]vimrc.
if (!exists('g:alternateSearchPath'))
let g:alternateSearchPath = 'sfr:../source,sfr:../src,sfr:../include,sfr:../inc'
endif
" If this variable is true then a.vim will not alternate to a file/buffer which
" does not exist. E.g while editing a.c and the :A will not swtich to a.h
" unless it exists.
if (!exists('g:alternateNoDefaultAlternate'))
" by default a.vim will alternate to a file which does not exist
let g:alternateNoDefaultAlternate = 0
endif
" If this variable is true then a.vim will convert the alternate filename to a
" filename relative to the current working directory.
" Feature by Nathan Huizinga
if (!exists('g:alternateRelativeFiles'))
" by default a.vim will not convert the filename to one relative to the
" current working directory
let g:alternateRelativeFiles = 0
endif
" Function : GetNthItemFromList (PRIVATE)
" Purpose : Support reading items from a comma seperated list
" Used to iterate all the extensions in an extension spec
" Used to iterate all path prefixes
" Args : list -- the list (extension spec, file paths) to iterate
" n -- the extension to get
" Returns : the nth item (extension, path) from the list (extension
" spec), or "" for failure
" Author : Michael Sharpe <feline@irendi.com>
" History : Renamed from GetNthExtensionFromSpec to GetNthItemFromList
" to reflect a more generic use of this function. -- Bindu
function! <SID>GetNthItemFromList(list, n)
let itemStart = 0
let itemEnd = -1
let pos = 0
let item = ""
let i = 0
while (i != a:n)
let itemStart = itemEnd + 1
let itemEnd = match(a:list, ",", itemStart)
let i = i + 1
if (itemEnd == -1)
if (i == a:n)
let itemEnd = strlen(a:list)
endif
break
endif
endwhile
if (itemEnd != -1)
let item = strpart(a:list, itemStart, itemEnd - itemStart)
endif
return item
endfunction
" Function : ExpandAlternatePath (PRIVATE)
" Purpose : Expand path info. A path with a prefix of "wdr:" will be
" treated as relative to the working directory (i.e. the
" directory where vim was started.) A path prefix of "abs:" will
" be treated as absolute. No prefix or "sfr:" will result in the
" path being treated as relative to the source file (see sfPath
" argument).
"
" A prefix of "reg:" will treat the pathSpec as a regular
" expression substitution that is applied to the source file
" path. The format is:
"
" reg:<sep><pattern><sep><subst><sep><flag><sep>
"
" <sep> seperator character, we often use one of [/|%#]
" <pattern> is what you are looking for
" <subst> is the output pattern
" <flag> can be g for global replace or empty
"
" EXAMPLE: 'reg:/inc/src/g/' will replace every instance
" of 'inc' with 'src' in the source file path. It is possible
" to use match variables so you could do something like:
" 'reg:|src/\([^/]*\)|inc/\1||' (see 'help :substitute',
" 'help pattern' and 'help sub-replace-special' for more details
"
" NOTE: a.vim uses ',' (comma) internally so DON'T use it
" in your regular expressions or other pathSpecs unless you update
" the rest of the a.vim code to use some other seperator.
"
" Args : pathSpec -- path component (or substitution patterns)
" sfPath -- source file path
" Returns : a path that can be used by AlternateFile()
" Author : Bindu Wavell <bindu@wavell.net>
function! <SID>ExpandAlternatePath(pathSpec, sfPath)
let prfx = strpart(a:pathSpec, 0, 4)
if (prfx == "wdr:" || prfx == "abs:")
let path = strpart(a:pathSpec, 4)
elseif (prfx == "reg:")
let re = strpart(a:pathSpec, 4)
let sep = strpart(re, 0, 1)
let patend = match(re, sep, 1)
let pat = strpart(re, 1, patend - 1)
let subend = match(re, sep, patend + 1)
let sub = strpart(re, patend+1, subend - patend - 1)
let flag = strpart(re, strlen(re) - 2)
if (flag == sep)
let flag = ''
endif
let path = substitute(a:sfPath, pat, sub, flag)
"call confirm('PAT: [' . pat . '] SUB: [' . sub . ']')
"call confirm(a:sfPath . ' => ' . path)
else
let path = a:pathSpec
if (prfx == "sfr:")
let path = strpart(path, 4)
endif
let path = a:sfPath . "/" . path
endif
return path
endfunction
" Function : FindFileInSearchPath (PRIVATE)
" Purpose : Searches for a file in the search path list
" Args : filename -- name of the file to search for
" pathList -- the path list to search
" relPathBase -- the path which relative paths are expanded from
" Returns : An expanded filename if found, the empty string otherwise
" Author : Michael Sharpe (feline@irendi.com)
" History : inline code written by Bindu Wavell originally
function! <SID>FindFileInSearchPath(fileName, pathList, relPathBase)
let filepath = ""
let m = 1
let pathListLen = strlen(a:pathList)
if (pathListLen > 0)
while (1)
let pathSpec = <SID>GetNthItemFromList(a:pathList, m)
if (pathSpec != "")
let path = <SID>ExpandAlternatePath(pathSpec, a:relPathBase)
let fullname = path . "/" . a:fileName
let foundMatch = <SID>BufferOrFileExists(fullname)
if (foundMatch)
let filepath = fullname
break
endif
else
break
endif
let m = m + 1
endwhile
endif
return filepath
endfunction
" Function : FindFileInSearchPathEx (PRIVATE)
" Purpose : Searches for a file in the search path list
" Args : filename -- name of the file to search for
" pathList -- the path list to search
" relPathBase -- the path which relative paths are expanded from
" count -- find the count'th occurence of the file on the path
" Returns : An expanded filename if found, the empty string otherwise
" Author : Michael Sharpe (feline@irendi.com)
" History : Based on <SID>FindFileInSearchPath() but with extensions
function! <SID>FindFileInSearchPathEx(fileName, pathList, relPathBase, count)
let filepath = ""
let m = 1
let spath = ""
let pathListLen = strlen(a:pathList)
if (pathListLen > 0)
while (1)
let pathSpec = <SID>GetNthItemFromList(a:pathList, m)
if (pathSpec != "")
let path = <SID>ExpandAlternatePath(pathSpec, a:relPathBase)
if (spath != "")
let spath = spath . ','
endif
let spath = spath . path
else
break
endif
let m = m + 1
endwhile
endif
if (&path != "")
if (spath != "")
let spath = spath . ','
endif
let spath = spath . &path
endif
let filepath = findfile(a:fileName, spath, a:count)
return filepath
endfunction
" Function : EnumerateFilesByExtension (PRIVATE)
" Purpose : enumerates all files by a particular list of alternate extensions.
" Args : path -- path of a file (not including the file)
" baseName -- base name of the file to be expanded
" extension -- extension whose alternates are to be enumerated
" Returns : comma separated list of files with extensions
" Author : Michael Sharpe <feline@irendi.com>
function! EnumerateFilesByExtension(path, baseName, extension)
let enumeration = ""
let extSpec = ""
let v:errmsg = ""
silent! echo g:alternateExtensions_{a:extension}
if (v:errmsg == "")
let extSpec = g:alternateExtensions_{a:extension}
endif
if (extSpec == "")
if (has_key(g:alternateExtensionsDict, a:extension))
let extSpec = g:alternateExtensionsDict[a:extension]
endif
endif
if (extSpec != "")
let n = 1
let done = 0
while (!done)
let ext = <SID>GetNthItemFromList(extSpec, n)
if (ext != "")
if (a:path != "")
let newFilename = a:path . "/" . a:baseName . "." . ext
else
let newFilename = a:baseName . "." . ext
endif
if (enumeration == "")
let enumeration = newFilename
else
let enumeration = enumeration . "," . newFilename
endif
else
let done = 1
endif
let n = n + 1
endwhile
endif
return enumeration
endfunction
" Function : EnumerateFilesByExtensionInPath (PRIVATE)
" Purpose : enumerates all files by expanding the path list and the extension
" list.
" Args : baseName -- base name of the file
" extension -- extension whose alternates are to be enumerated
" pathList -- the list of paths to enumerate
" relPath -- the path of the current file for expansion of relative
" paths in the path list.
" Returns : A comma separated list of paths with extensions
" Author : Michael Sharpe <feline@irendi.com>
function! EnumerateFilesByExtensionInPath(baseName, extension, pathList, relPathBase)
let enumeration = ""
let filepath = ""
let m = 1
let pathListLen = strlen(a:pathList)
if (pathListLen > 0)
while (1)
let pathSpec = <SID>GetNthItemFromList(a:pathList, m)
if (pathSpec != "")
let path = <SID>ExpandAlternatePath(pathSpec, a:relPathBase)
let pe = EnumerateFilesByExtension(path, a:baseName, a:extension)
if (enumeration == "")
let enumeration = pe
else
let enumeration = enumeration . "," . pe
endif
else
break
endif
let m = m + 1
endwhile
endif
return enumeration
endfunction
" Function : DetermineExtension (PRIVATE)
" Purpose : Determines the extension of a filename based on the register
" alternate extension. This allow extension which contain dots to
" be considered. E.g. foo.aspx.cs to foo.aspx where an alternate
" exists for the aspx.cs extension. Note that this will only accept
" extensions which contain less than 5 dots. This is only
" implemented in this manner for simplicity...it is doubtful that
" this will be a restriction in non-contrived situations.
" Args : The path to the file to find the extension in
" Returns : The matched extension if any
" Author : Michael Sharpe (feline@irendi.com)
" History : idea from Tom-Erik Duestad
" Notes : there is some magic occuring here. The exists() function does not
" work well when the curly brace variable has dots in it. And why
" should it, dots are not valid in variable names. But the exists
" function is wierd too. Lets say foo_c does exist. Then
" exists("foo_c.e.f") will be true...even though the variable does
" not exist. However the curly brace variables do work when the
" variable has dots in it. E.g foo_{'c'} is different from
" foo_{'c.d.e'}...and foo_{'c'} is identical to foo_c and
" foo_{'c.d.e'} is identical to foo_c.d.e right? Yes in the current
" implementation of vim. To trick vim to test for existence of such
" variables echo the curly brace variable and look for an error
" message.
function! DetermineExtension(path)
let mods = ":t"
let i = 0
while i <= s:maxDotsInExtension
let mods = mods . ":e"
let extension = fnamemodify(a:path, mods)
if (has_key(g:alternateExtensionsDict, extension))
return extension
endif
let v:errmsg = ""
silent! echo g:alternateExtensions_{extension}
if (v:errmsg == "")
return extension
endif
let i = i + 1
endwhile
return ""
endfunction
" Function : AlternateFile (PUBLIC)
" Purpose : Opens a new buffer by looking at the extension of the current
" buffer and finding the corresponding file. E.g. foo.c <--> foo.h
" Args : accepts one argument. If present it used the argument as the new
" extension.
" Returns : nothing
" Author : Michael Sharpe <feline@irendi.com>
" History : + When an alternate can't be found in the same directory as the
" source file, a search path will be traversed looking for the
" alternates.
" + Moved some code into a separate function, minor optimization
" + rework to favor files in memory based on complete enumeration of
" all files extensions and paths
function! AlternateFile(splitWindow, ...)
let extension = DetermineExtension(expand("%:p"))
let baseName = substitute(expand("%:t"), "\." . extension . '$', "", "")
let currentPath = expand("%:p:h")
if (a:0 != 0)
let newFullname = currentPath . "/" . baseName . "." . a:1
call <SID>FindOrCreateBuffer(newFullname, a:splitWindow, 0)
else
let allfiles = ""
if (extension != "")
let allfiles1 = EnumerateFilesByExtension(currentPath, baseName, extension)
let allfiles2 = EnumerateFilesByExtensionInPath(baseName, extension, g:alternateSearchPath, currentPath)
if (allfiles1 != "")
if (allfiles2 != "")
let allfiles = allfiles1 . ',' . allfiles2
else
let allfiles = allfiles1
endif
else
let allfiles = allfiles2
endif
endif
if (allfiles != "")
let bestFile = ""
let bestScore = 0
let score = 0
let n = 1
let onefile = <SID>GetNthItemFromList(allfiles, n)
let bestFile = onefile
while (onefile != "" && score < 2)
let score = <SID>BufferOrFileExists(onefile)
if (score > bestScore)
let bestScore = score
let bestFile = onefile
endif
let n = n + 1
let onefile = <SID>GetNthItemFromList(allfiles, n)
endwhile
if (bestScore == 0 && g:alternateNoDefaultAlternate == 1)
echo "No existing alternate available"
else
call <SID>FindOrCreateBuffer(bestFile, a:splitWindow, 1)
let b:AlternateAllFiles = allfiles
endif
else
echo "No alternate file/buffer available"
endif
endif
endfunction
" Function : AlternateOpenFileUnderCursor (PUBLIC)
" Purpose : Opens file under the cursor
" Args : splitWindow -- indicates how to open the file
" Returns : Nothing
" Author : Michael Sharpe (feline@irendi.com) www.irendi.com
function! AlternateOpenFileUnderCursor(splitWindow,...)
let cursorFile = (a:0 > 0) ? a:1 : expand("<cfile>")
let currentPath = expand("%:p:h")
let openCount = 1
let fileName = <SID>FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, openCount)
if (fileName != "")
call <SID>FindOrCreateBuffer(fileName, a:splitWindow, 1)
let b:openCount = openCount
let b:cursorFile = cursorFile
let b:currentPath = currentPath
else
echo "Can't find file"
endif
endfunction
" Function : AlternateOpenNextFile (PUBLIC)
" Purpose : Opens the next file corresponding to the search which found the
" current file
" Args : bang -- indicates what to do if the current file has not been
" saved
" Returns : nothing
" Author : Michael Sharpe (feline@irendi.com) www.irendi.com
function! AlternateOpenNextFile(bang)
let cursorFile = ""
if (exists("b:cursorFile"))
let cursorFile = b:cursorFile
endif
let currentPath = ""
if (exists("b:currentPath"))
let currentPath = b:currentPath
endif
let openCount = 0
if (exists("b:openCount"))
let openCount = b:openCount + 1
endif
if (cursorFile != "" && currentPath != "" && openCount != 0)
let fileName = <SID>FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, openCount)
if (fileName != "")
call <SID>FindOrCreateBuffer(fileName, "n".a:bang, 0)
let b:openCount = openCount
let b:cursorFile = cursorFile
let b:currentPath = currentPath
else
let fileName = <SID>FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, 1)
if (fileName != "")
call <SID>FindOrCreateBuffer(fileName, "n".a:bang, 0)
let b:openCount = 1
let b:cursorFile = cursorFile
let b:currentPath = currentPath
else
echo "Can't find next file"
endif
endif
endif
endfunction
comm! -nargs=? -bang IH call AlternateOpenFileUnderCursor("n<bang>", <f-args>)
comm! -nargs=? -bang IHS call AlternateOpenFileUnderCursor("h<bang>", <f-args>)
comm! -nargs=? -bang IHV call AlternateOpenFileUnderCursor("v<bang>", <f-args>)
comm! -nargs=? -bang IHT call AlternateOpenFileUnderCursor("t<bang>", <f-args>)
comm! -nargs=? -bang IHN call AlternateOpenNextFile("<bang>")
imap <Leader>ih <ESC>:IHS<CR>
nmap <Leader>ih :IHS<CR>
imap <Leader>is <ESC>:IHS<CR>:A<CR>
nmap <Leader>is :IHS<CR>:A<CR>
imap <Leader>ihn <ESC>:IHN<CR>
nmap <Leader>ihn :IHN<CR>
"function! <SID>PrintList(theList)
" let n = 1
" let oneFile = <SID>GetNthItemFromList(a:theList, n)
" while (oneFile != "")
" let n = n + 1
" let oneFile = <SID>GetNthItemFromList(a:theList, n)
" endwhile
"endfunction
" Function : NextAlternate (PUBLIC)
" Purpose : Used to cycle through any other alternate file which existed on
" the search path.
" Args : bang (IN) - used to implement the AN vs AN! functionality
" Returns : nothing
" Author : Michael Sharpe <feline@irendi.com>
function! NextAlternate(bang)
if (exists('b:AlternateAllFiles'))
let currentFile = expand("%")
let n = 1
let onefile = <SID>GetNthItemFromList(b:AlternateAllFiles, n)
while (onefile != "" && !<SID>EqualFilePaths(fnamemodify(onefile,":p"), fnamemodify(currentFile,":p")))
let n = n + 1
let onefile = <SID>GetNthItemFromList(b:AlternateAllFiles, n)
endwhile
if (onefile != "")
let stop = n
let n = n + 1
let foundAlternate = 0
let nextAlternate = ""
while (n != stop)
let nextAlternate = <SID>GetNthItemFromList(b:AlternateAllFiles, n)
if (nextAlternate == "")
let n = 1
continue
endif
let n = n + 1
if (<SID>EqualFilePaths(fnamemodify(nextAlternate, ":p"), fnamemodify(currentFile, ":p")))
continue
endif
if (filereadable(nextAlternate))
" on cygwin filereadable("foo.H") returns true if "foo.h" exists
if (has("unix") && $WINDIR != "" && fnamemodify(nextAlternate, ":p") ==? fnamemodify(currentFile, ":p"))
continue
endif
let foundAlternate = 1
break
endif
endwhile
if (foundAlternate == 1)
let s:AlternateAllFiles = b:AlternateAllFiles
"silent! execute ":e".a:bang." " . nextAlternate
call <SID>FindOrCreateBuffer(nextAlternate, "n".a:bang, 0)
let b:AlternateAllFiles = s:AlternateAllFiles
else
echo "Only this alternate file exists"
endif
else
echo "Could not find current file in alternates list"
endif
else
echo "No other alternate files exist"
endif
endfunction
comm! -nargs=? -bang A call AlternateFile("n<bang>", <f-args>)
comm! -nargs=? -bang AS call AlternateFile("h<bang>", <f-args>)
comm! -nargs=? -bang AV call AlternateFile("v<bang>", <f-args>)
comm! -nargs=? -bang AT call AlternateFile("t<bang>", <f-args>)
comm! -nargs=? -bang AN call NextAlternate("<bang>")
" Function : BufferOrFileExists (PRIVATE)
" Purpose : determines if a buffer or a readable file exists
" Args : fileName (IN) - name of the file to check
" Returns : 2 if it exists in memory, 1 if it exists, 0 otherwise
" Author : Michael Sharpe <feline@irendi.com>
" History : Updated code to handle buffernames using just the
" filename and not the path.
function! <SID>BufferOrFileExists(fileName)
let result = 0
let lastBuffer = bufnr("$")
let i = 1
while i <= lastBuffer
if <SID>EqualFilePaths(expand("#".i.":p"), a:fileName)
let result = 2
break
endif
let i = i + 1
endwhile
if (!result)
let bufName = fnamemodify(a:fileName,":t")
let memBufName = bufname(bufName)
if (memBufName != "")
let memBufBasename = fnamemodify(memBufName, ":t")
if (bufName == memBufBasename)
let result = 2
endif
endif
if (!result)
let result = bufexists(bufName) || bufexists(a:fileName) || filereadable(a:fileName)
endif
endif
if (!result)
let result = filereadable(a:fileName)
endif
return result
endfunction
" Function : FindOrCreateBuffer (PRIVATE)
" Purpose : searches the buffer list (:ls) for the specified filename. If
" found, checks the window list for the buffer. If the buffer is in
" an already open window, it switches to the window. If the buffer
" was not in a window, it switches to that buffer. If the buffer did
" not exist, it creates it.
" Args : filename (IN) -- the name of the file
" doSplit (IN) -- indicates whether the window should be split
" ("v", "h", "n", "v!", "h!", "n!", "t", "t!")
" findSimilar (IN) -- indicate weather existing buffers should be
" prefered
" Returns : nothing
" Author : Michael Sharpe <feline@irendi.com>
" History : + bufname() was not working very well with the possibly strange
" paths that can abound with the search path so updated this
" slightly. -- Bindu
" + updated window switching code to make it more efficient -- Bindu
" Allow ! to be applied to buffer/split/editing commands for more
" vim/vi like consistency
" + implemented fix from Matt Perry
function! <SID>FindOrCreateBuffer(fileName, doSplit, findSimilar)
" Check to see if the buffer is already open before re-opening it.
let FILENAME = escape(a:fileName, ' ')
let bufNr = -1
let lastBuffer = bufnr("$")
let i = 1
if (a:findSimilar)
while i <= lastBuffer
if <SID>EqualFilePaths(expand("#".i.":p"), a:fileName)
let bufNr = i
break
endif
let i = i + 1
endwhile
if (bufNr == -1)
let bufName = bufname(a:fileName)
let bufFilename = fnamemodify(a:fileName,":t")
if (bufName == "")
let bufName = bufname(bufFilename)
endif
if (bufName != "")
let tail = fnamemodify(bufName, ":t")
if (tail != bufFilename)
let bufName = ""
endif
endif
if (bufName != "")
let bufNr = bufnr(bufName)
let FILENAME = bufName
endif
endif
endif
if (g:alternateRelativeFiles == 1)
let FILENAME = fnamemodify(FILENAME, ":p:.")
endif
let splitType = a:doSplit[0]
let bang = a:doSplit[1]
if (bufNr == -1)
" Buffer did not exist....create it
let v:errmsg=""
if (splitType == "h")
silent! execute ":split".bang." " . FILENAME
elseif (splitType == "v")
silent! execute ":vsplit".bang." " . FILENAME
elseif (splitType == "t")
silent! execute ":tab split".bang." " . FILENAME
else
silent! execute ":e".bang." " . FILENAME
endif
if (v:errmsg != "")
echo v:errmsg
endif
else
" Find the correct tab corresponding to the existing buffer
let tabNr = -1
" iterate tab pages
for i in range(tabpagenr('$'))
" get the list of buffers in the tab
let tabList = tabpagebuflist(i + 1)
let idx = 0
" iterate each buffer in the list
while idx < len(tabList)
" if it matches the buffer we are looking for...
if (tabList[idx] == bufNr)
" ... save the number
let tabNr = i + 1
break
endif
let idx = idx + 1
endwhile
if (tabNr != -1)
break
endif
endfor
" switch the the tab containing the buffer
if (tabNr != -1)
execute "tabn ".tabNr
endif
" Buffer was already open......check to see if it is in a window
let bufWindow = bufwinnr(bufNr)
if (bufWindow == -1)
" Buffer was not in a window so open one
let v:errmsg=""
if (splitType == "h")
silent! execute ":sbuffer".bang." " . FILENAME
elseif (splitType == "v")
silent! execute ":vert sbuffer " . FILENAME
elseif (splitType == "t")
silent! execute ":tab sbuffer " . FILENAME
else
silent! execute ":buffer".bang." " . FILENAME
endif
if (v:errmsg != "")
echo v:errmsg
endif
else
" Buffer is already in a window so switch to the window
execute bufWindow."wincmd w"
if (bufWindow != winnr())
" something wierd happened...open the buffer
let v:errmsg=""
if (splitType == "h")
silent! execute ":split".bang." " . FILENAME
elseif (splitType == "v")
silent! execute ":vsplit".bang." " . FILENAME
elseif (splitType == "t")
silent! execute ":tab split".bang." " . FILENAME
else
silent! execute ":e".bang." " . FILENAME
endif
if (v:errmsg != "")
echo v:errmsg
endif
endif
endif
endif
endfunction
" Function : EqualFilePaths (PRIVATE)
" Purpose : Compares two paths. Do simple string comparison anywhere but on
" Windows. On Windows take into account that file paths could differ
" in usage of separators and the fact that case does not matter.
" "c:\WINDOWS" is the same path as "c:/windows". has("win32unix") Vim
" version does not count as one having Windows path rules.
" Args : path1 (IN) -- first path
" path2 (IN) -- second path
" Returns : 1 if path1 is equal to path2, 0 otherwise.
" Author : Ilya Bobir <ilya@po4ta.com>
function! <SID>EqualFilePaths(path1, path2)
if has("win16") || has("win32") || has("win64") || has("win95")
return substitute(a:path1, "\/", "\\", "g") ==? substitute(a:path2, "\/", "\\", "g")
else
return a:path1 == a:path2
endif
endfunction

View File

@ -0,0 +1,513 @@
*bufexplorer.txt* Buffer Explorer Last Change: 22 Oct 2010
Buffer Explorer *buffer-explorer* *bufexplorer*
Version 7.2.8
Plugin for easily exploring (or browsing) Vim |:buffers|.
|bufexplorer-installation| Installation
|bufexplorer-usage| Usage
|bufexplorer-windowlayout| Window Layout
|bufexplorer-customization| Customization
|bufexplorer-changelog| Change Log
|bufexplorer-todo| Todo
|bufexplorer-credits| Credits
For Vim version 7.0 and above.
This plugin is only available if 'compatible' is not set.
{Vi does not have any of this}
==============================================================================
INSTALLATION *bufexplorer-installation*
To install:
- Download the bufexplorer.zip.
- Extract the zip archive into your runtime directory.
The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt.
- Start Vim or goto an existing instance of Vim.
- Execute the following command:
>
:helptag <your runtime directory>/doc
<
This will generate all the help tags for any file located in the doc
directory.
==============================================================================
USAGE *bufexplorer-usage*
To start exploring in the current window, use: >
\be or :BufExplorer
To start exploring in a newly split horizontal window, use: >
\bs or :BufExplorerHorizontalSplit
To start exploring in a newly split vertical window, use: >
\bv or :BufExplorerVerticalSplit
If you would like to use something other than '\', you may simply change the
leader (see |mapleader|).
Note: If the current buffer is modified when bufexplorer started, the current
window is always split and the new bufexplorer is displayed in that new
window.
Commands to use once exploring:
<F1> Toggle help information.
<enter> Opens the buffer that is under the cursor into the current
window.
<leftmouse> Opens the buffer that is under the cursor into the current
window.
<shift-enter> Opens the buffer that is under the cursor in another tab.
d |:delete|the buffer under the cursor from the list. The
buffer's 'buflisted' is cleared. This allows for the buffer to
be displayed again using the 'show unlisted' command.
R Toggles relative path/absolute path.
T Toggles to show only buffers for this tab or not.
D |:wipeout|the buffer under the cursor from the list. When a
buffers is wiped, it will not be shown when unlisted buffer are
displayed.
f Toggles whether you are taken to the active window when
selecting a buffer or not.
o Opens the buffer that is under the cursor into the current
window.
p Toggles the showing of a split filename/pathname.
q Quit exploring.
r Reverses the order the buffers are listed in.
s Selects the order the buffers are listed in. Either by buffer
number, file name, file extension, most recently used (MRU), or
full path.
t Opens the buffer that is under the cursor in another tab.
u Toggles the showing of "unlisted" buffers.
Once invoked, Buffer Explorer displays a sorted list (MRU is the default
sort method) of all the buffers that are currently opened. You are then
able to move the cursor to the line containing the buffer's name you are
wanting to act upon. Once you have selected the buffer you would like,
you can then either open it, close it(delete), resort the list, reverse
the sort, quit exploring and so on...
===============================================================================
WINDOW LAYOUT *bufexplorer-windowlayout*
-------------------------------------------------------------------------------
" Press <F1> for Help
" Sorted by mru | Locate buffer | Absolute Split path
"=
01 %a bufexplorer.txt C:\Vim\vimfiles\doc line 87
02 # bufexplorer.vim c:\Vim\vimfiles\plugin line 1
-------------------------------------------------------------------------------
| | | | |
| | | | +-- Current Line #.
| | | +-- Relative/Full Path
| | +-- Buffer Name.
| +-- Buffer Attributes. See|:buffers|for more information.
+-- Buffer Number. See|:buffers|for more information.
===============================================================================
CUSTOMIZATION *bufexplorer-customization*
*g:bufExplorerChgWin*
If set, bufexplorer will bring up the selected buffer in the window specified
by g:bufExplorerChgWin.
*g:bufExplorerDefaultHelp*
To control whether the default help is displayed or not, use: >
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerDefaultHelp=1 " Show default help.
The default is to show the default help.
*g:bufExplorerDetailedHelp*
To control whether detailed help is display by, use: >
let g:bufExplorerDetailedHelp=0 " Do not show detailed help.
let g:bufExplorerDetailedHelp=1 " Show detailed help.
The default is NOT to show detailed help.
*g:bufExplorerFindActive*
To control whether you are taken to the active window when selecting a buffer,
use: >
let g:bufExplorerFindActive=0 " Do not go to active window.
let g:bufExplorerFindActive=1 " Go to active window.
The default is to be taken to the active window.
*g:bufExplorerFuncRef*
When a buffer is selected, the functions specified either singly or as a list
will be called.
*g:bufExplorerReverseSort*
To control whether to sort the buffer in reverse order or not, use: >
let g:bufExplorerReverseSort=0 " Do not sort in reverse order.
let g:bufExplorerReverseSort=1 " Sort in reverse order.
The default is NOT to sort in reverse order.
*g:bufExplorerShowDirectories*
Directories usually show up in the list from using a command like ":e .".
To control whether to show directories in the buffer list or not, use: >
let g:bufExplorerShowDirectories=1 " Show directories.
let g:bufExplorerShowDirectories=0 " Don't show directories.
The default is to show directories.
*g:bufExplorerShowRelativePath*
To control whether to show absolute paths or relative to the current
directory, use: >
let g:bufExplorerShowRelativePath=0 " Show absolute paths.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
The default is to show absolute paths.
*g:bufExplorerShowTabBuffer*
To control weither or not to show buffers on for the specific tab or not, use: >
let g:bufExplorerShowTabBuffer=0 " No.
let g:bufExplorerShowTabBuffer=1 " Yes.
The default is not to show.
*g:bufExplorerShowUnlisted*
To control whether to show unlisted buffer or not, use: >
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
The default is to NOT show unlisted buffers.
*g:bufExplorerSortBy*
To control what field the buffers are sorted by, use: >
let g:bufExplorerSortBy='extension' " Sort by file extension.
let g:bufExplorerSortBy='fullpath' " Sort by full file path name.
let g:bufExplorerSortBy='mru' " Sort by most recently used.
let g:bufExplorerSortBy='name' " Sort by the buffer's name.
let g:bufExplorerSortBy='number' " Sort by the buffer's number.
The default is to sort by mru.
*g:bufExplorerSplitBelow*
To control where the new split window will be placed above or below the
current window, use: >
let g:bufExplorerSplitBelow=1 " Split new window below current.
let g:bufExplorerSplitBelow=0 " Split new window above current.
The default is to use what ever is set by the global &splitbelow
variable.
*g:bufExplorerSplitOutPathName*
To control whether to split out the path and file name or not, use: >
let g:bufExplorerSplitOutPathName=1 " Split the path and file name.
let g:bufExplorerSplitOutPathName=0 " Don't split the path and file
" name.
The default is to split the path and file name.
*g:bufExplorerSplitRight*
To control where the new vsplit window will be placed to the left or right of
current window, use: >
let g:bufExplorerSplitRight=0 " Split left.
let g:bufExplorerSplitRight=1 " Split right.
The default is to use the global &splitright.
===============================================================================
CHANGE LOG *bufexplorer-changelog*
7.2.8 - Enhancements:
* Thanks to Charles Campbell for integrating bufexplorer with GDBMGR.
http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR
7.2.7 - Fix:
* My 1st attempt to fix the "cache" issue where buffers information
has changed but the cache/display does not reflect those changes.
More work still needs to be done.
7.2.6 - Fix:
* Thanks to Michael Henry for pointing out that I totally forgot to
update the inline help to reflect the previous change to the 'd'
and 'D' keys. Opps!
7.2.5 - Fix:
* Philip Morant suggested switching the command (bwipe) associated
with the 'd' key with the command (bdelete) associated with the 'D'
key. This made sense since the 'd' key is more likely to be used
compared to the 'D' key.
7.2.4 - Fix:
* I did not implement the patch provided by Godefroid Chapelle
correctly. I missed one line which happened to be the most
important one :)
7.2.3 - Enhancements:
* Thanks to David Fishburn for helping me out with a much needed
code overhaul as well as some awesome performance enhancements.
He also reworked the handling of tabs.
* Thanks to Vladimir Dobriakov for making the suggestions on
enhancing the documentation to include a better explaination of
what is contained in the main bufexplorer window.
* Thanks to Yuriy Ershov for added code that when the bufexplorer
window is opened, the cursor is now positioned at the line with the
active buffer (useful in non-MRU sort modes).
* Yuriy also added the abiltiy to cycle through the sort fields in
reverse order.
Fixes:
* Thanks to Michael Henry for supplying a patch that allows
bufexplorer to be opened even when there is one buffer or less.
* Thanks to Godefroid Chapelle for supplying a patch that fixed
MRU sort order after loading a session.
7.2.2 - Fixes:
* Thanks to David L. Dight for spotting and fixing an issue when
using ctrl^. bufexplorer would incorrectly handle the previous
buffer so that when ctrl^ was pressed the incorrect file was opened.
7.2.1 - Fixes:
* Thanks to Dimitar for spotting and fixing a feature that was
inadvertently left out of the previous version. The feature was
when bufexplorer was used together with WinManager, you could use
the tab key to open a buffer in a split window.
7.2.0 - Enhancements:
* For all those missing the \bs and \bv commands, these have now
returned. Thanks to Phil O'Connell for asking for the return of
these missing features and helping test out this version.
Fixes:
* Fixed problem with the bufExplorerFindActive code not working
correctly.
* Fixed an incompatibility between bufexplorer and netrw that caused
buffers to be incorrectly removed from the MRU list.
7.1.7 - Fixes:
* TaCahiroy fixed several issues related to opening a buffer in a
tab.
7.1.6 - Fixes:
* Removed ff=unix from modeline in bufexplorer.txt. Found by Bill
McCarthy.
7.1.5 - Fixes:
* Could not open unnamed buffers. Fixed by TaCahiroy.
7.1.4 - Fixes:
* Sometimes when a file's path has 'white space' in it, extra buffers
would be created containing each piece of the path. i.e:
opening c:\document and settings\test.txt would create a buffer
named "and" and a buffer named "Documents". This was reported and
fixed by TaCa Yoss.
7.1.3 - Fixes:
* Added code to allow only one instance of the plugin to run at a
time. Thanks Dennis Hostetler.
7.1.2 - Fixes:
* Fixed a jumplist issue spotted by JiangJun. I overlooked the
'jumplist' and with a couple calls to 'keepjumps', everything is
fine again.
* Went back to just having a plugin file, no autoload file. By having
the autoload, WinManager was no longer working and without really
digging into the cause, it was easier to go back to using just a
plugin file.
7.1.1 - Fixes:
* A problem spotted by Thomas Arendsen Hein.
When running Vim (7.1.94), error E493 was being thrown.
Enhancements:
* Added 'D' for 'delete' buffer as the 'd' command was a 'wipe'
buffer.
7.1.0 - Another 'major' update, some by Dave Larson, some by me.
* Making use of 'autoload' now to make the plugin load quicker.
* Removed '\bs' and '\bv'. These are now controlled by the user. The
user can issue a ':sp' or ':vs' to create a horizontal or vertical
split window and then issue a '\be'
* Added handling of tabs.
7.0.17 - Fixed issue with 'drop' command.
Various enhancements and improvements.
7.0.16 - Fixed issue reported by Liu Jiaping on non Windows systems, which was
...
Open file1, open file2, modify file1, open bufexplorer, you get the
following error:
--------8<--------
Error detected while processing function
<SNR>14_StartBufExplorer..<SNR>14_SplitOpen:
line 4:
E37: No write since last change (add ! to override)
But the worse thing is, when I want to save the current buffer and
type ':w', I get another error message:
E382: Cannot write, 'buftype' option is set
--------8<--------
7.0.15 - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle
the ':args' command.
7.0.14 - Thanks to Randall Hansen for removing the requirement of terminal
versions to be recompiled with 'gui' support so the 'drop' command
would work. The 'drop' command is really not needed in terminal
versions.
7.0.13 - Fixed integration with WinManager.
Thanks to Dave Eggum for another update.
- Fix: The detailed help didn't display the mapping for toggling
the split type, even though the split type is displayed.
- Fixed incorrect description in the detailed help for toggling
relative or full paths.
- Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same
thing.
- Created a s:Set() function that sets a variable only if it hasn't
already been defined. It's useful for initializing all those
default settings.
- Removed checks for repetitive command definitions. They were
unnecessary.
- Made the help highlighting a little more fancy.
- Minor reverse compatibility issue: Changed ambiguous setting
names to be more descriptive of what they do (also makes the code
easier to follow):
Changed bufExplorerSortDirection to bufExplorerReverseSort
Changed bufExplorerSplitType to bufExplorerSplitVertical
Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow
- When the BufExplorer window closes, all the file-local marks are
now deleted. This may have the benefit of cleaning up some of the
jumplist.
- Changed the name of the parameter for StartBufExplorer from
"split" to "open". The parameter is a string which specifies how
the buffer will be open, not if it is split or not.
- Deprecated DoAnyMoreBuffersExist() - it is a one line function
only used in one spot.
- Created four functions (SplitOpen(), RebuildBufferList(),
UpdateHelpStatus() and ReSortListing()) all with one purpose - to
reduce repeated code.
- Changed the name of AddHeader() to CreateHelp() to be more
descriptive of what it does. It now returns an array instead of
updating the window directly. This has the benefit of making the
code more efficient since the text the function returns is used a
little differently in the two places the function is called.
- Other minor simplifications.
7.0.12 - MAJOR Update.
This version will ONLY run with Vim version 7.0 or greater.
Dave Eggum has made some 'significant' updates to this latest
version:
- Added BufExplorerGetAltBuf() global function to be used in the
users rulerformat.
- Added g:bufExplorerSplitRight option.
- Added g:bufExplorerShowRelativePath option with mapping.
- Added current line highlighting.
- The split type can now be changed whether bufexplorer is opened
in split mode or not.
- Various major and minor bug fixes and speed improvements.
- Sort by extension.
Other improvements/changes:
- Changed the help key from '?' to <F1> to be more 'standard'.
- Fixed splitting of vertical bufexplorer window.
Hopefully I have not forgot something :)
7.0.11 - Fixed a couple of highlighting bugs, reported by David Eggum. He also
changed passive voice to active on a couple of warning messages.
7.0.10 - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set,
the slash character used when displaying the path was incorrect.
7.0.9 - Martin Grenfell found and eliminated an annoying bug in the
bufexplorer/winmanager integration. The bug was were an
annoying message would be displayed when a window was split or
a new file was opened in a new window. Thanks Martin!
7.0.8 - Thanks to Mike Li for catching a bug in the WinManager integration.
The bug was related to the incorrect displaying of the buffer
explorer's window title.
7.0.7 - Thanks to Jeremy Cowgar for adding a new enhancement. This
enhancement allows the user to press 'S', that is capital S, which
will open the buffer under the cursor in a newly created split
window.
7.0.6 - Thanks to Larry Zhang for finding a bug in the "split" buffer code.
If you force set g:bufExplorerSplitType='v' in your vimrc, and if you
tried to do a \bs to split the bufexplorer window, it would always
split horizontal, not vertical. He also found that I had a typeo in
that the variable g:bufExplorerSplitVertSize was all lower case in
the documentation which was incorrect.
7.0.5 - Thanks to Mun Johl for pointing out a bug that if a buffer was
modified, the '+' was not showing up correctly.
7.0.4 - Fixed a problem discovered first by Xiangjiang Ma. Well since I've
been using vim 7.0 and not 6.3, I started using a function (getftype)
that is not in 6.3. So for backward compatibility, I conditionaly use
this function now. Thus, the g:bufExplorerShowDirectories feature is
only available when using vim 7.0 and above.
7.0.3 - Thanks to Erwin Waterlander for finding a problem when the last
buffer was deleted. This issue got me to rewrite the buffer display
logic (which I've wanted to do for sometime now).
Also great thanks to Dave Eggum for coming up with idea for
g:bufExplorerShowDirectories. Read the above information about this
feature.
7.0.2 - Thanks to Thomas Arendsen Hein for finding a problem when a user
has the default help turned off and then brought up the explorer. An
E493 would be displayed.
7.0.1 - Thanks to Erwin Waterlander for finding a couple problems.
The first problem allowed a modified buffer to be deleted. Opps! The
second problem occurred when several files were opened, BufExplorer
was started, the current buffer was deleted using the 'd' option, and
then BufExplorer was exited. The deleted buffer was still visible
while it is not in the buffers list. Opps again!
7.0.0 - Thanks to Shankar R. for suggesting to add the ability to set
the fixed width (g:bufExplorerSplitVertSize) of a new window
when opening bufexplorer vertically and fixed height
(g:bufExplorerSplitHorzSize) of a new window when opening
bufexplorer horizontally. By default, the windows are normally
split to use half the existing width or height.
6.3.0 - Added keepjumps so that the jumps list would not get cluttered with
bufexplorer related stuff.
6.2.3 - Thanks to Jay Logan for finding a bug in the vertical split position
of the code. When selecting that the window was to be split
vertically by doing a '\bv', from then on, all splits, i.e. '\bs',
were split vertically, even though g:bufExplorerSplitType was not set
to 'v'.
6.2.2 - Thanks to Patrik Modesto for adding a small improvement. For some
reason his bufexplorer window was always showing up folded. He added
'setlocal nofoldenable' and it was fixed.
6.2.1 - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting
logic and option.
6.2.0 - Thanks goes out to Simon Johann-Ganter for spotting and fixing a
problem in that the last search pattern is overridden by the search
pattern for blank lines.
6.1.6 - Thanks to Artem Chuprina for finding a pesky bug that has been around
for sometime now. The <esc> key mapping was causing the buffer
explored to close prematurely when vim was run in an xterm. The <esc>
key mapping is now removed.
6.1.5 - Thanks to Khorev Sergey. Added option to show default help or not.
6.1.4 - Thanks goes out to Valery Kondakoff for suggesting the addition of
setlocal nonumber and foldcolumn=0. This allows for line numbering
and folding to be turned off temporarily while in the explorer.
6.1.3 - Added folding. Did some code cleanup. Added the ability to force the
newly split window to be temporarily vertical, which was suggested by
Thomas Glanzmann.
6.1.2 - Now pressing the <esc> key will quit, just like 'q'.
Added folds to hide winmanager configuration.
If anyone had the 'C' option in their cpoptions they would receive
a E10 error on startup of BufExplorer. cpo is now saved, updated and
restored. Thanks to Charles E Campbell, Jr.
Attempted to make sure there can only be one BufExplorer window open
at a time.
6.1.1 - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This
way buffers sorted by name will be in the correct order regardless of
case.
6.0.16 - Thanks to Andre Pang for the original patch/idea to get bufexplorer
to work in insertmode/modeless mode (evim). Added Initialize
and Cleanup autocommands to handle commands that need to be
performed when starting or leaving bufexplorer.
6.0.15 - Srinath Avadhanulax added a patch for winmanager.vim.
6.0.14 - Fix a few more bug that I thought I already had fixed. Thanks
to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added
vertical splitting.
6.0.13 - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing
typos that I had in the documentation. I guess I need to run
the spell checker more :o)
6.0.12 - Thanks to Madoka Machitani, for the tip on adding the augroup command
around the MRUList autocommands.
6.0.11 - Fixed bug report by Xiangjiang Ma. '"=' was being added to the
search history which messed up hlsearch.
6.0.10 - Added the necessary hooks so that the Srinath Avadhanula's
winmanager.vim script could more easily integrate with this script.
Tried to improve performance.
6.0.9 - Added MRU (Most Recently Used) sort ordering.
6.0.8 - Was not resetting the showcmd command correctly.
Added nifty help file.
6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added,
some are not, yet. Added highlighting of current and alternate
filenames. Added splitting of path/filename toggle. Reworked
ShowBuffers().
Changed my email address.
6.0.6 - Copyright notice added. Needed this so that it could be distributed
with Debian Linux. Fixed problem with the SortListing() function
failing when there was only one buffer to display.
6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to
hit 'd' on a buffer that belonged to a files that no longer existed
and that the 'yank' buffer was being overridden by the help text when
the bufexplorer was opened.
6.0.4 - Thanks to Charles Campbell, Jr. for making this plugin more plugin
*compliant*, adding default keymappings of <Leader>be and <Leader>bs
as well as fixing the 'w:sortDirLabel not being defined' bug.
6.0.3 - Added sorting capabilities. Sort taken from explorer.vim.
6.0.2 - Can't remember. (2001-07-25)
6.0.1 - Initial release.
===============================================================================
TODO *bufexplorer-todo*
- Nothing as of now, buf if you have any suggestions, drop me an email.
===============================================================================
CREDITS *bufexplorer-credits*
Author: Jeff Lanzarotta <delux256-vim at yahoo dot com>
Credit must go out to Bram Moolenaar and all the Vim developers for
making the world's best editor (IMHO). I also want to thank everyone who
helped and gave me suggestions. I wouldn't want to leave anyone out so I
won't list names.
===============================================================================
vim:tw=78:noet:wrap:ts=8:ft=help:norl:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,114 @@
"*****************************************************************************
"** Name: help.vim - extend standard syntax highlighting for help **
"** **
"** Type: syntax file **
"** **
"** Author: Christian Habermann **
"** christian (at) habermann-net (point) de **
"** **
"** Copyright: (c) 2002-2004 by Christian Habermann **
"** **
"** License: GNU General Public License 2 (GPL 2) or later **
"** **
"** This program is free software; you can redistribute it **
"** and/or modify it under the terms of the GNU General Public **
"** License as published by the Free Software Foundation; either **
"** version 2 of the License, or (at your option) any later **
"** version. **
"** **
"** This program is distributed in the hope that it will be **
"** useful, but WITHOUT ANY WARRANTY; without even the implied **
"** warrenty of MERCHANTABILITY or FITNESS FOR A PARTICULAR **
"** PURPOSE. **
"** See the GNU General Public License for more details. **
"** **
"** Version: 1.0.1 **
"** tested under Linux and Win32, VIM and GVIM 6.2 **
"** **
"** History: 0.1.0 12. Dec. 2002 - 21. Feb. 2003 **
"** initial version, not released **
"** 1.0.0 6. Apr. 2003 **
"** no changes, first release **
"** 1.0.1 3. Mar. 2004 **
"** marker changed from 0xa7 to $ in order to avoid problems **
"** with fonts that use codes > 0x7f as multibyte characters **
"** (e.g. Chinese, Korean, Japanese... fonts) **
"** **
"** **
"*****************************************************************************
"** Description: **
"** This syntax file extends the standard syntax highlighting for help **
"** files. This is needed in order to view the C-reference manual **
"** of the project CRefVim correctly. **
"** This syntax file is only active for the help file named **
"** "crefvim.txt". For other help files no extention on syntax **
"** highlighting is applied. **
"** **
"** For futher information see crefvimdoc.txt or do :help crefvimdoc **
"** **
"** Happy viming... **
"*****************************************************************************
" extend syntax-highlighting for "crefvim.txt" only (not case-sensitive)
if tolower(expand("%:t"))=="crefvim.txt"
syn match helpCRVSubStatement "statement[0-9Ns]*" contained
syn match helpCRVSubCondition "condition[0-9]*" contained
syn match helpCRVSubExpression "expression[0-9]*" contained
syn match helpCRVSubExpr "expr[0-9N]" contained
syn match helpCRVSubType "type-name" contained
syn match helpCRVSubIdent "identifier" contained
syn match helpCRVSubIdentList "identifier-list" contained
syn match helpCRVSubOperand "operand[0-9]*" contained
syn match helpCRVSubConstExpr "constant-expression[1-9Ns]*" contained
syn match helpCRVSubClassSpec "storage-class-specifier" contained
syn match helpCRVSubTypeSpec "type-specifier" contained
syn match helpCRVSubEnumList "enumerator-list" contained
syn match helpCRVSubDecl "declarator" contained
syn match helpCRVSubRetType "return-type" contained
syn match helpCRVSubFuncName "function-name" contained
syn match helpCRVSubParamList "parameter-list" contained
syn match helpCRVSubReplList "replacement-list" contained
syn match helpCRVSubNewLine "newline" contained
syn match helpCRVSubMessage "message" contained
syn match helpCRVSubFilename "filename" contained
syn match helpCRVSubDigitSeq "digit-sequence" contained
syn match helpCRVSubMacroNames "macro-name[s]*" contained
syn match helpCRVSubDirective "directive" contained
syn match helpCRVignore "\$[a-zA-Z0-9\\\*/\._=()\-+%<>&\^|!~\?:,\[\];{}#\'\" ]\+\$" contains=helpCRVstate
syn match helpCRVstate "[a-zA-Z0-9\\\*/\._=()\-+%<>&\^|!~\?:,\[\];{}#\'\" ]\+" contained contains=helpCRVSub.*
hi helpCRVitalic term=italic cterm=italic gui=italic
hi def link helpCRVstate Comment
hi def link helpCRVSubStatement helpCRVitalic
hi def link helpCRVSubCondition helpCRVitalic
hi def link helpCRVSubExpression helpCRVitalic
hi def link helpCRVSubExpr helpCRVitalic
hi def link helpCRVSubOperand helpCRVitalic
hi def link helpCRVSubType helpCRVitalic
hi def link helpCRVSubIdent helpCRVitalic
hi def link helpCRVSubIdentList helpCRVitalic
hi def link helpCRVSubConstExpr helpCRVitalic
hi def link helpCRVSubClassSpec helpCRVitalic
hi def link helpCRVSubTypeSpec helpCRVitalic
hi def link helpCRVSubEnumList helpCRVitalic
hi def link helpCRVSubDecl helpCRVitalic
hi def link helpCRVSubRetType helpCRVitalic
hi def link helpCRVSubFuncName helpCRVitalic
hi def link helpCRVSubParamList helpCRVitalic
hi def link helpCRVSubReplList helpCRVitalic
hi def link helpCRVSubNewLine helpCRVitalic
hi def link helpCRVSubMessage helpCRVitalic
hi def link helpCRVSubFilename helpCRVitalic
hi def link helpCRVSubDigitSeq helpCRVitalic
hi def link helpCRVSubMacroNames helpCRVitalic
hi def link helpCRVSubDirective helpCRVitalic
hi def link helpCRVignore Ignore
endif
" vim: ts=8 sw=2

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,356 @@
"*****************************************************************************
"** Name: crefvim.vim - a C-Reference for Vim **
"** **
"** Type: global VIM plugin **
"** **
"** Author: Christian Habermann **
"** christian(at)habermann-net(point)de **
"** **
"** Copyright: (c) 2002, 2003 by Christian Habermann **
"** **
"** License: GNU General Public License 2 (GPL 2) or later **
"** **
"** This program is free software; you can redistribute it **
"** and/or modify it under the terms of the GNU General Public **
"** License as published by the Free Software Foundation; either **
"** version 2 of the License, or (at your option) any later **
"** version. **
"** **
"** This program is distributed in the hope that it will be **
"** useful, but WITHOUT ANY WARRANTY; without even the implied **
"** warrenty of MERCHANTABILITY or FITNESS FOR A PARTICULAR **
"** PURPOSE. **
"** See the GNU General Public License for more details. **
"** **
"** Version: 1.0.0 **
"** tested under Linux (vim, gvim 6.1) and Win32 (gvim 6.1) **
"** **
"** History: 0.1.0 12. Dec. 2002 - 23. Feb. 2003 **
"** initial version, not released **
"** 1.0.0 6. Apr. 2003 **
"** no changes, first release **
"** **
"** **
"*****************************************************************************
"** Description: **
"** This script's intention is to provide a C-reference manual that can **
"** be accessed from within Vim. **
"** **
"** For futher information see crefvim.txt or do :help crefvim **
"** **
"** **
"** Happy viming... **
"*****************************************************************************
" allow user to avoid loading this plugin and prevent loading twice
if exists ("loaded_crefvim")
finish
endif
let loaded_crefvim = 1
"*****************************************************************************
"************************** C O N F I G U R A T I O N ************************
"*****************************************************************************
" the mappings:
if !hasmapto('<Plug>CRV_CRefVimVisual')
vmap <silent> <unique> <Leader>cr <Plug>CRV_CRefVimVisual
endif
if !hasmapto('<Plug>CRV_CRefVimNormal')
nmap <silent> <unique> <Leader>cr <Plug>CRV_CRefVimNormal
endif
if !hasmapto('<Plug>CRV_CRefVimAsk')
map <silent> <unique> <Leader>cw <Plug>CRV_CRefVimAsk
endif
if !hasmapto('<Plug>CRV_CRefVimInvoke')
map <silent> <unique> <Leader>cc <Plug>CRV_CRefVimInvoke
endif
vmap <silent> <unique> <script> <Plug>CRV_CRefVimVisual y:call <SID>CRV_CRefVimWord('<c-r>"')<CR>
nmap <silent> <unique> <script> <Plug>CRV_CRefVimNormal :call <SID>CRV_CRefVimWord(expand("<cword>"))<CR>
map <silent> <unique> <script> <Plug>CRV_CRefVimAsk :call <SID>CRV_CRefVimAskForWord()<CR>
map <silent> <unique> <script> <Plug>CRV_CRefVimInvoke :call <SID>CRV_CRefVimShowContents()<CR>
"*****************************************************************************
"************************* I N I T I A L I S A T I O N ***********************
"*****************************************************************************
"*****************************************************************************
"****************** I N T E R F A C E T O C O R E **************************
"*****************************************************************************
"*****************************************************************************
"** this function separates plugin-core-function from user **
"*****************************************************************************
function <SID>CRV_CRefVimWord(str)
call s:CRefVim(a:str)
endfunction
"*****************************************************************************
"** this function separates plugin-core-function from user **
"*****************************************************************************
function <SID>CRV_CRefVimAskForWord()
call s:CRefVimAskForWord()
endfunction
"*****************************************************************************
"** this function separates plugin-core-function from user **
"*****************************************************************************
function <SID>CRV_CRefVimShowContents()
" show contents of C-reference manual
call s:LookUp("")
endfunction
"*****************************************************************************
"************************ C O R E F U N C T I O N S *************************
"*****************************************************************************
"*****************************************************************************
"** ask for a word/phrase and lookup **
"*****************************************************************************
function s:CRefVimAskForWord()
let l:strng = input("What to lookup: ")
call s:LookUp(l:strng)
endfunction
"*****************************************************************************
"** input: "str" **
"** output: empty string: "str" is not an operator **
"** else: name of tag to go to **
"** **
"*****************************************************************************
"** remarks: **
"** This function tests whether or not "str" is an operator. **
"** If so, the tag to go to is returned. **
"** **
"*****************************************************************************
function s:IsItAnOperator(str)
" get first character
let l:firstChr = strpart(a:str, 0, 1)
" is the first character of the help-string an operator?
if stridx("!&+-*/%,.:<=>?^|~(){}[]", l:firstChr) >= 0
return "crv-operators"
else
return ""
endif
endfunction
"*****************************************************************************
"** input: "str" **
"** output: empty string: "str" is not an escape-sequence **
"** else: name of tag to go to **
"** **
"*****************************************************************************
"** remarks: **
"** This function tests whether or not "str" is an escape-sequence. **
"** If so, the tag to go to is returned. **
"** Note: currently \' does not work (="\\\'") **
"** **
"*****************************************************************************
function s:IsItAnEscSequence(str)
if (a:str == "\\") || (a:str == "\\\\") || (a:str == "\\0") || (a:str == "\\x") ||
\(a:str == "\\a") || (a:str == "\\b") || (a:str == "\\f") || (a:str == "\\n") ||
\(a:str == "\\r") || (a:str == "\\t") || (a:str == "\\v") || (a:str == "\\?") ||
\(a:str == "\\\'") || (a:str == "\\\"")
return "crv-lngEscSeq"
else
return ""
endif
endfunction
"*****************************************************************************
"** input: "str" **
"** output: empty string: "str" is not a comment **
"** else: name of tag to go to **
"** **
"*****************************************************************************
"** remarks: **
"** This function tests whether or not "str" is a comment. **
"** If so, the tag to go to is returned. **
"** **
"*****************************************************************************
function s:IsItAComment(str)
if (a:str == "//") || (a:str == "/*") || (a:str == "*/")
return "crv-lngComment"
else
return ""
endif
endfunction
"*****************************************************************************
"** input: "str" **
"** output: empty string: "str" is not a preprocessor **
"** else: name of tag to go to **
"** **
"*****************************************************************************
"** remarks: **
"** This function tests whether or not "str" is a preprocessor command **
"** or a preprocessor operator. **
"** If so, the tag to go to is returned. **
"** **
"** Nothing is done if the help-string is equal to "if" or "else" **
"** because these are statements too. For "if" and "else" it's assumed **
"** that the statements are meant. But "#if" and "#else" are treated **
"** as preprocessor commands. **
"** **
"*****************************************************************************
function s:IsItAPreprocessor(str)
" get first character
let l:firstChr = strpart(a:str, 0, 1)
" if first character of the help-string is a #, we have the command/operator
" string in an appropriate form, so append this help-string to "crv-"
if l:firstChr == "#"
return "crv-" . a:str
else
" no # in front of the help string, so evaluate which command/operator
" is meant
if (a:str == "defined")
return "crv-defined"
else
if (a:str == "define") ||
\(a:str == "undef") ||
\(a:str == "ifdef") ||
\(a:str == "ifndef") ||
\(a:str == "elif") ||
\(a:str == "endif") ||
\(a:str == "include") ||
\(a:str == "line") ||
\(a:str == "error") ||
\(a:str == "pragma")
return "\#" . a:str
endif
endif
endif
endfunction
"*****************************************************************************
"** input: "str" to lookup in C-reference manual **
"** output: none **
"*****************************************************************************
"** remarks: **
"** Lookup string "str". **
"** Generally this function calls :help crv-"str" where "str" is the **
"** word for which the user wants some help. **
"** **
"** But before activating VIM's help-system some tests and/or **
"** modifications are done on "str": **
"** - if help-string is a comment (//, /* or */), go to section **
"** describing comments **
"** - if help-string is an escape-sequence, go to section describing **
"** escape-sequences **
"** - if help-string is an operator, go to section dealing with operators **
"** - if help-string is a preprocessor command/operator, go to section **
"** that describes that command/operator **
"** - else call :help crv-"str" **
"** **
"** If the help-string is empty, go to contents of C-reference manual. **
"** **
"*****************************************************************************
function s:LookUp(str)
if a:str != ""
let l:helpTag = s:IsItAComment(a:str)
if l:helpTag == ""
let l:helpTag = s:IsItAnEscSequence(a:str)
if l:helpTag == ""
let l:helpTag = s:IsItAnOperator(a:str)
if l:helpTag == ""
let l:helpTag = s:IsItAPreprocessor(a:str)
if l:helpTag == ""
let l:helpTag = "crv-" . a:str
endif
endif
endif
endif
" reset error message
let v:errmsg = ""
" activate help-system looking for the appropriate topic
" suppress error messages
silent! execute ":help " . l:helpTag
" if there was an error, print message
if v:errmsg != ""
echo " No help found for \"" .a:str . "\""
endif
else
" help string is empty, so show contents of manual
execute ":help crefvim"
endif
endfunction
"*****************************************************************************
"** input: "str" to lookup in C-reference manual **
"** output: none **
"*****************************************************************************
"** remarks: **
"** lookup string "str". **
"** If there is no string, ask for word/phrase. **
"** **
"*****************************************************************************
function s:CRefVim(str)
let s:strng = a:str
if s:strng == "" " is there a string to search for?
call s:CRefVimAskForWord()
else
call s:LookUp(s:strng)
endif
endfunction
"*** EOF ***

View File

@ -0,0 +1,34 @@
Joe Steffen - Creator of Cscope
Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> - Maintainer
Petr Sorfa <petr@users.sourceforge.net> - Initial OpenSource Maintainer
Simon Cozens - autoconf setup
garp@digi.com - .cc .hh support
jens persson <cscope@persson.cx> - new man page
Edgar Toernig - cscope stability
Martin Kraemer - various improvments
Joshua Uziel <uzi@linuxcare.com> - code clean up, -h and -k options, and lots more (including autoconf)
Mike Hopkirk <hops@sco.com> - osr5 build, ocs
Darrylo Okahata <darrylo@users.sourceforge.net> - code quality improvements
Brent Verner <brent@rcfile.org> - -R option to recurse sub directories
Thomas Klausner - NetBSD support
Andrew Sharpe - progress bar, tab between line selection and prompts and more
Carl Mascott - FreeBSD support
Rich Salz - Allow -i accept stdio as input as "-"
Stephane Fritsch - BeOS support
Andy Newman <atrn> - FreeBSD support patch
Sascha Blank - FreeBSD support
Bruce Frost - Stability
Chuck Marco and Wilfredo Sanchez - Darwin support
Jason Duell - CSCOPE_EDITOR and CSCOPE_LINEFLAG*, invname database
Tom Hull - Similar work to CSCOPE_EDITOR and friends
Donald Slutz - Various fixes
OGAWA Hirofumi - line mode fixes
Garret Hade - Various ocs fixes
Nick Dixon - Improvement in key handling
Triet H. Lai <thlai@mail.usyd.edu.au> - GNU Emacs fixes for xcscope.el
Steven Elliott <selliott4@austin.rr.com> - Fuzzy pattern matching for xcscope.el
Ragho Mahalingam <ragho@mahalingam.com> - webcscope
Dmitry Obukhov - Hilight code in webcscope
David Cohrs - LEX and SUNOS scanner fix
Valentin Podlovchenko - Overflow prevention and link recursion fix patch
Neil Horman <nhorman@gmail.com> - Various Bug Fixes

View File

@ -0,0 +1,29 @@
Copyright (c) 1998-2000, The Santa Cruz Operation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
*Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
*Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
*Neither name of The Santa Cruz Operation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

View File

@ -0,0 +1,636 @@
2009-04-10 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* src/snprintf.c: Replacement implementation for missing snprintf
and vsprintf, from www.jhweiss.de.
* acinclude: New macros to optionally activate a replacement for
missing snprintf and vsprintf, from www.jhweiss.de.
* configure.in: Call new macros for snprintf and vsprintf. Drop
AC_FUNC_LSTAT in turn, since it would have required a replacement
implementation for lstat().
* src/Makefile.am (cscope_LDADD): Added LIBOBJS to automatically
include snprintf.o in the build if and only if needed.
* configure, config.h.in, aclocal.m4, Makefile.in,
contrib/Makefile.in, doc/Makefile.in, src/Makefile.in:
Regenerated.
* src/global.h: Add prototypes for replacement snprintf and
vsnprintf.
* src/*.c: Replace all calls of sprintf by snprintf to avoid
possible buffer overflows.
2008-06-30 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* aclocal.m4, configure, config.h.in, Makefile.in,
src/Makefile.in, doc/Makefile.in, contrib/Makefile.in: Regenerated
by recent autotools.
* compile, config.guess, config.sub, depcomp, install-sh, missing,
mkinstalldirs, ylwrap: Updated to version provided by recent
autotools.
* INSTALL.gnu: GNU installation instructions.
* src/global.h (tempstring): Fix mismatch of declaration with
definition.
2008-04-11 Neil Horman <nhorman@tuxdriver.com>
* src/main.c, src/exec.c : configure ncurses to operate in raw
mode so that ctrl-c (toggle case sensitivity) isn't swallowed by
the terminal driver
2008-03-12 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* src/build.c (samelist): Previous fix broke handling of blanks in
directory names.
(build): Apply the same fix to other occurence of the same code.
2008-03-10 Neil Horman <nhorman@tuxdriver.com>
* src/build.c: Fix Samelist to properly absorb newlines so that
inverted indicies aren't always rebuilt
2008-02-14 Neil Horman <nhorman@tuxdriver.com>
* src/dir.c: Fix up issrcfile to identify hpp/hxx files as
standard c++ source files
* src/main.c: Add myexit as a handler for SIGTERM, to clean up
temp files on TERM
2007-12-03 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* doc/cscope.1: Grammar corrections [SF patch #1843711] and troff
syntax fixes [from ESR].
2007-03-10 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* src/scanner.l (comment_input): Translate EOF to LEXEOF in this
case, too.
(input, noncommentinput): Spell out LEXEOF instead of a magic
number 0.
2007-02-09 Neil Horman <nhorman@tuxdriver.com>
* doc/xcscope.1: Added man page for xcscope utility in contrib
2007-01-07 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* src/fscanner.l: Avoid a -Wunused warning by disabling the
yy_topstate() function.
* README: Add a warning about the intended user audience not
including superusers or anonymous ones.
* contrib/webcscope/cscope: Find perl in /usr/bin, which should be
more likely as its installation position these days. Put a big
red reminder to the top of the generated HTML page warning about
the security issues involved with webcscope. Thanks to V-Li and
the Gentoo folks for the patch.
2006-10-23 Neil Horman <nhorman@tuxdriver.com>
* src/main.c: Update sigwinch_handler to only register if linemode
is not specified (SF bug 1574354)
2006-10-15 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* src/dir.c (accessible_file): New function to test for file
readability more strictly than just access().
(inviewpath): Use it to avoid unreadable files (directories, in
particular) getting into the srcfilelist, and thus hopefully fix
SF bug #1173768.
2006-10-10 Neil Horman <nhorman@tuxdriver.com>
* src/main.c: Updated sigwinch_handler to not run in the event
that curses is not running to avoid crash (SF bug 1574354)
2006-09-30 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/fscanner.l (wsnl): Expand set of allowed characters to make
scanner more tolerant of non-Unix linebreaks (should fix SF Bug
#1563459)
* src/Makefile.am (CLEANFILES, dist-hook): Commented out, to
reduce number of user reports from people without lex.
* configure.in: Change from AC_PROG_LEX to AM_PROG_LEX.
* src/Makefile.am (cscope_SOURCES): Added alloc.h. Reindented.
* src/invlib.c (invnewterm): Correct loop test to account for
maxback being unsigned (should fix SF bug #1559495).
* src/Makefile.am (AM_CPPFLAGS): Renamed from INCLUDES, to quench
an automake warning.
* configure.in: Modernized via autoupdate. Fixed several
'underquoted' warnings from aclocal. Use a more telling source
file name in AC_CONFIG_SRCDIR.
* configure, aclocal.m4, Makefile.in, contrib/Makefile.in,
doc/Makefile.in, src/Makefile.in: Regenerated.
2006-08-20 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/find.c (findsymbol): Missed one place where s_len had to be
initialized.
* src/main.c (tempstring): Parametrize length by new macro
TEMPSTRING_LEN.
(main): Check against too long -f file name.
(main): Put explicit %s field widths into fscanf() call.
(main): Replace some fscanf() calls by fgets().
* src/input.c (shellpath): Limit size of strings copied from
environment.
* src/edit.c (editref, editall): Put explicit %s field widths into
fscanf() calls.
* src/display.c (display): Put explicit %s field widths into
fscanf() call.
* src/dir.c (makefilelist): Put explicit %s field width into
sscanf() call.
* src/constants.h (TEMPSTRING_LEN): New macro, needed to
parametrize a fscanf() call.
(STRINGIZE): New macro used to build the following.
(PATLEN_STR, PATHLEN_STR, NUMLEN_STR, TEMPSTRING_LEN_STR): Buffer
lengths (minus 1) expressed as a string literal, to be used in as
field widths in {f,s}scanf() calls.
* src/command.c (changestring): Put explicit %s field widths into
fscanf() call.
* src/build.c (samelist, build): fgets() replaces fscanf().
(build): Put explicit %s field widths into fscanf() call.
2006-07-23 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* src/global.h: Rename putstring() to fetch_string_from_dbase(),
add a parameter.
* src/find.c: Add #include <assert.h>
(fetch_string_from_dbase): Renamed from misleading name
putstring(). Add new parameter, and use it to avoid overflowing
the output buffer.
(findsymbol): New local: s_len. Rename calls to putstring(). Add
new argument, some of them from s_len.
(finddef, findallfcns, findcalling, findinclude, match,
findcalledby, putpostingref): Rename calls to putstring(). Add new
argument.
* src/constants.h (MSGLEN): Add safety parentheses.
* src/library.h: Remove prototypes of alloc.c functions.
* src/alloc.h: New file. Moved prototypes of alloc.c functions in
here, out of library.h.
* src/alloc.c: Include new header file from here.
(my_strdup): Changed name from misleading stralloc(). Remove
incorrect cast.
* src/build.c: Add #include "alloc.h".
(fetch_include_from_dbase): Renamed from misleading name
putinclude(). Add length of target string as an argument.
(setup_build_filenames): Rename calls of stralloc().
(getoldfile, copyinverted): Rename calls of putstring(). Add new
argument.
(copydata, coypinverted): Rename calls of putinclude(). Add new
argument.
* src/vpinit.c: Add #include "alloc.h"
(vpinit): Rename calls of stralloc().
* src/main.c: Add #include "alloc.h".
(main): Rename calls of stralloc().
* src/history.c: Add #include "alloc.h".
(addcmd): Rename call of stralloc().
* src/fscanner.l: Add #include "alloc.h".
* src/display.c: Add #include "alloc.h".
* src/dir.c: Add #include "alloc.h". Move project includes above
system headers.
(sourcedir, addsrcdir, includedir, addincdir, addsrcfile): Rename
calls to stralloc().
* src/crossref.c: Add #include "alloc.h"
* src/command.c: Add #include "alloc.h".
2006-05-06 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* src/fscanner.l: Accept numeric literals inside fcn definitions
and calls.
2006-04-21 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
Make source clean under -Wsign-compare.
* src/main.c (fileargc): Make counter unsigned.
(main): Make local counter unsigned.
(main): Fixed two sprintf() excess arguments.
* src/lookup.c (initsymtab): Make local counters unsigned.
* src/invlib.c (LINEMAX): Removed.
(invmake): Change length of local variable "line" to TERMMAX.
(numpost, numlogblk, amtused, nextpost, lastinblk, numinvitems):
Make counters unsigned.
(invnewterm): Make local counters unsigned.
* src/input.c (mygetline): Make local counters unsigned.
* src/find.c (findregexp, findfile): Make local counters unsigned.
* src/egrep.y (line, left, right, parent): Make unsigned.
(enter, cclenter): Return unsigned.
(follow): Make argument unsigned.
(cclenter, cfoll, cgotofn, member, add, follow): Make local
counters unsigned.
(cgotofn, member): Cast char to unsigned char, not unsigned int,
for use as an index.
* src/display.c (disprefs, mdisprefs, nextline, topline,
totallines): Make unsigned.
(search): Removed unused locals.
(seekline): Make argument unsigned.
* src/dir.c (nincdirs, nsrcdirs, nsrcfiles, msrcfiles, mincdirs,
msrcdirs, nvpsrcdirs): Make unsigned long.
(sourcedir, includedir, makefilelist, incfile, inviewpath): Make
local counters unsigned.
* src/crossref.c (symbols, msymbols): Make unsigned long.
(struct symbol): Make elements first, last, length and fcn_level
unsigned.
(crossref, putcrossref): Make local counters unsigned.
* src/command.c (curdispline): Make unsigned.
(mark): Make argument and local counter unsigned.
(command): Make KEY_LL conditional on KEY_LL, not KEY_HOME.
(changestring): Made local counter unsigned.
* src/build.c (build): Change several local ints to unsigned
longs.
* src/global.h: Updated lots of declarations to match the above.
* src/alloc.c (mymalloc, mycalloc, myrealloc): Make size arguments
size_t. Remove pointless casts in several of their callers.
* src/library.h (mymalloc, mycalloc, myrealloc): Updated
prototoypes.
2006-04-20 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
* src/input.c (askforreturn): If curses is handling the display,
redraw the screen before returning, to keep error messages from
permanently scrambling the display.
* configure.in: Add test for <io.h>.
* configure, config.h.in: Regenerated.
* src/mypopen.c [HAVE_IO_H]: #include <io.h> it, for the setmode()
declaration.
2006-04-19 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de>
General change: indentation width of touched areas changed to 4
spaces, open braces not on lines of their own, single-line "else
if", get rid of (void) casts of unused function return values.
* src/global.h (select_large): Removed declaration.
* src/main.c (select_large, main): Removed long unused global.
* src/dir.c (scan_dir): Get rid of d_ino check --- this field is
not reliably present in struct dirent, and doesn't achieve enough
to be worth autoconf-ing around. Works around problems compiling on
Cygwin release 1.5.19.
* Makefile.in, aclocal.m4, configure, contrib/Makefile.in,
doc/Makefile.in, src/Makefile.in: Regenerated with current auto
tools (autoconf-2.59, automake 1.9.6).
2006-02-21 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/vpinit.c (vpinit): Fix handling of slightly malformed VPATH
environment variable contents.
2005-11-22 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/dir.c (issrcfile): Finally added auto-searching for
three-letter C++ file extensions *.tcc, *.cpp, *.cxx. Test all
matches to be regular files, not just those with two- and
three-character extensions.
* src/invlib.c: Some cleanup. Replace 0 third argument to fseek
by proper SEEK_SET. Got rid of (void) result casts and some
function argument casts.
(invmake): Fix one sizeof(long)==4 assumption.
2005-08-16 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/main.c: Uncluttered by removing nitpicky (void) casts.
(longusage): Reworked for source legibility even on 80-column
displays.
(main): If in verbose linemode, print number of references found,
first off. Patch from Elad Lahav, for Kscope
2005-07-08 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/build.c (invname_buf, invpost_buf, reffile_buf): Make
modifiable copies of the default file names.
(invname, invpost, reffile): Initialize pointers to modifiable
copies, rather than to string literals.
* packages/MSDOS/djmake.bat: Adapt to modern position of ylwrap
script.
* src/command.c (command) [KEY_RESIZE]: Protect by
!defined(__DJGPP__). That platform doesn't have sigaction() and
associated machinery, nor does it really support terminal size
changes to begin with.
* src/main.c (sigwinch_handler): Likewise.
(main): Likewise.
2005-04-29 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/command.c (command): Additional hotkey mapping of Ctrl-A to
same function as Ctrl-Y, like AT&T cscope, to evade Ctrl-Y
occupied as the DSUSP signal key on BSD'ish platforms.
* src/help.c (help): Document additonal hotkey ^A. Mention
possible unavailability of some Ctrl keys because of terminal
settings.
2005-03-14 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/input.c (getline): Removed. Was just a minimally simplified
copy of mygetline() anyway, and it threatened to collide with a
like-named routine in libc.
* src/global.h (getline): Removed prototype.
* src/command.c (command): Changed all calls of getline() to
mygetline() with an empty string as the first argument.
* src/egrep.y (memset): Changed #if condition around fallback
implementation to match that of the prototype in global.h. Should
fix SF bug #1163104 (build failure on FreeBSD).
2005-02-16 Neil Horman <nhorman@gmail.com>
* src/command.c (command): Added ifdef KEY_RESIZE around
KEY_RESIZE case in switch statement to allow curses
libraries which don't support resize events to build
* src/main.c (main): Added ifdef KEY_RESIZE around
SIGWINCH handler and signal registration logic to
remove resize code from cscope when building with
curses libraries that don't support resize events
2005-02-04 Neil Horman <nhorman@gmail.com>
* src/command.c (command): Added KEY_RESIZE event case to
command switch to handle window re-drawing when a resize
event was received.
* src/input.c (mygetch): Added error checking of return code
to restart call to getch in the event it returned early due
to a signal being delivered.
* src/main.c (main): Registered a signal handler for the
SIGWINCH handler which is delivered when a terminal is
resized. Handler pushes a KEY_RESIZE event onto the head
of the command input queue.
2005-02-01 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/build.c (build): Keep interactive mode on, even if on a
terminal, if verbose mode (-v) was turned on.
2005-01-31 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/scanner.h: Declare yytext signed on AIX (without stating a
version number, for now).
2005-01-30 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/mypopen.c (mypopen): Make closing argument to execlp() a
manifest null pointer, not just a zero.
2004-12-08 Neil Horman <nhorman@gmail.com>
* src/dir.c: Fix to dissallow unreadable files from
srcfiles list (sourceforge bug number 1040690)
2004-12-06 Neil Horman <nhorman@gmail.com>
* src/main.c: Fix for temp file security bug (sourceforge
bug number 1062807 / CAN-2004-0970)
2004-11-22 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* doc/cscope.1: Make ESR happy: change man page summary section to
avoid [0-9] syntax.
2004-10-27 Hans-Bernhard Broeker <broeker@accip02.physik.rwth-aachen.de>
* src/display.c (search): Replace duplicated code by a call to
countrefs(). Duplicate lacked adjustment of column widths in case
of very long function/file names. Thanks to Darlene Wong for
spotting this.
* src/global.h (countrefs): Prototype added.
* src/command.c (countrefs): Made globally available.
2004-06-23 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/dir.c (makefilelist): Fix broken movement of point_in_line
when parsing quoted names. Simplify structure by moving default
handling upward.
2004-06-21 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* contrib/ocs (SYSDIR): Only set to /usr/local/lib/cs if not
already set in outside environment. Check that $(SYSDIR) exists
before proceeding. From SF patch #976788 by Neil Horman.
2004-04-30 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/vpinit.c (vpinit): Renamed argument currentdir to
current_dir to avoid name clash with same-named global.
* src/command.c (Pattern): Renamed from "pattern", to avoid
multitute of compiler warnings about shadowing by locally defined
variables of the same name. Changed all usages of this variable,
too.
(command): Test for individual KEY_* macros instead of TERMINFO
whenever one of the KEY_* macros is referenced. This should
reduce the TERMINFO mess a little.
* src/find.c (read_block): Renamed from "readblock", to avoid name
clash with QNX system function of that name. Calls changed
accordingly, all over the place.
* src/display.c: Fix fall-back definition of sigjmp_buf.
* src/constants.h: Activate TERMINFO for FreeBSD.
* src/input.c (mygetline): New function. Poor-man's readline
imitation. From SF Patch #937310.
* src/global.h (mygetline): Prototype added.
* src/command.c (command): Use mygetline() instead of letting
ncsurses doing it all. Make Ctrl-B/F special hotkeys that are
handled here instead of in mygetline(), to preserve their meaning.
* packages/cscope.spec: Updated by SF patch #920586 to be more
compatible with current expectations.
2004-02-24 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* configure.in (AC_CHECK_HEADERS): Added check for NSK-Tandem
special magic header file <floss.h>.
* src/global.h [HAVE_FLOSS_H]: Added #include <floss.h> if it
exists.
2004-02-14 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/command.c (countrefs): Fix off-by-one length specification
of %s format. Thanks to <anil@recoil.org> for spotting it.
2004-02-12 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
Fix SF bug #892731: Ctrl-C interruption of search works only once
per session.
* configure.in (sigsetjmp): Added test for presence of this
function.
* src/display.c (sigsetjmp) [!HAVE_SIGSETJMP]: Provide fallback
definitions for functions sigsetjmp, siglongjmp and type
sigjmp_buf.
(search): Move call to signal() above that to setjmp(). Call
sigsetjmp() instead of setjmp().
* configure, config.h.in: Regenerated.
* Makefile.in, src/Makefile.in, contrib/Makefile.in,
doc/Makefile.in, aclocal.m4: Rebuilt by automake-1.7.9.
2004-02-11 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* configure.in (signal.h) Check added.
(sighandler_t): Check for this type. Should be defined on POSIX
platforms, but is treated as a GNU extension sometimes.
* src/global.h (sighandler_t) [!HAVE_SIGHANDLER_T]: Provide
fallback definition of function pointer typedef for signal
handlers if <signal.h> doesn't provide it. Simplifies cscope's
work when working on its own source code --- function pointers
confuse it quite badly, so it's best to minimize their visibility.
* src/input.c (mygetch): Type of local variable savesig written
using sighandler_t.
* src/display.c (search): Type of local variable savesig written
using sighandler_t.
* src/exec.c (oldsigtstp): Renamed, from oldsigstp.
(oldsigtstp,oldsighup,oldsigquit): Changed from function pointer
type to new typedef name sighandler_t.
2004-02-05 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/global.h (tolower) [BSD]: Fix stupid typo in overrides for
toupper and tolower.
2004-01-08 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/display.c (clearmsg): New function. Does essentially the
same thing previously achieved by a rather more cryptic
postmsg("").
(postfatal): New function to printout a fatal error message and
terminate the program. Works like posterr(), but exits curses
first, so the message should end up visible after the program
exits. Using this instead of posterr()+myexit() fixes SF bug
#419510.
(dispinit): Use postfatal:().
(postmsg): Use clearmsg().
(postmsg2): Call curses refresh() after change.
* src/global.h: Add prototypes for new functions clearmsg() and
postfatal().
* src/find.c (putsource): Use postfatal().
* src/main.c (main, skiplist): Use postfatal() and clearmsg().
* src/command.c (command): Use clearmsg().
* src/build.c (build, seek_to_trailer, movefile): Use postfatal().
* src/alloc.c (alloctest): Use postfatal().
* src/display.c (jumpback): Re-instate signal handler, in an
attempt to fix problems reported with the general behaviour of
signal handlers in cscope.
* src/scanner.l (ws, wsnl): Two new predefined patterns to catch
not only blanks and tabs, but all generally allowed white-space
characters in source files: form feeds, vertical tabs, carriage
returns. Replaced most occurence of [ \t] and [ \t\n] by these.
This is a back-port from fscanner.l. Should fix SF bug #508060.
Wed Oct 15 16:05:46 2003 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/dir.c (scan_dir): Don't reduce path to basename before
calling issrcfile.
(issrcfile): Use either basename or full path, as necessary for
the individual tests. Reorganized to reduce nesting.
Mon Sep 15 12:34:46 2003 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/egrep.y (yylex, member, egrep, cgotofn): Reindented. Fixed
implicit int declarations and casts.
* src/global.h (tolower, tolower) [BSD]: Fix override definitions
for these so they don't mung non-alphabetic input.
Fri Sep 12 09:33:19 2003 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
* src/vp.h: Add #include of <sys/types.h> to fix problem on
Solaris.
Fri Sep 12 09:33:19 2003 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>
I'm finally starting a new, GNU-format ChangeLog file. The format
of the previous was too terse to be really useful. This begins
with the first changes after release 15.5.
* ChangeLog.old: New file. Renamed copy of old-format ChangeLog
file.
* ChangeLog: Started from scratch.

View File

@ -0,0 +1,60 @@
***** BUILDING:
This program's build procedure is fairly standard. Try:
./configure
make
make install
Options to the configure script are up to you. For details, run:
./configure --help
Please report build problems at:
http://sourceforge.net/bugs/?func=addbug&group_id=4664
(yes, even non-Linux problems).
***** TIPS AND PROBLEMS:
- Try to use flex as the lexical analyzer. The lex scanner is now
separated from the flex version to allow the flex scanner to be
optimized. It's also a lot harder to diagnose and debug problems
without having full access to the particular platform and its version of
lex being used. flex is available everywhere --- AT&T lex is not.
- On Solaris, the native lex fails to catch our redefinition of YYLMAX
early enough, which leads to possible buffer overflows.
- On Linux systems (and possibly others) configure may fail if lex is
a synomyn for flex. To fix, do the following:
make distclean
./configure --with-flex
make
- On HP-UX several problems exist when using configure. Try the following
to solve this:
CFLAGS='-Ae -DYYCHAR_ARRAY' CURSES_LIBS=-lHcurses ./configure
- On Tru64, formerly known as Digital Unix, formerly known as DEC OSF/1,
the system-supplied libcurses causes cscope to terminate itself
immediately as it comes back to foreground after being suspended by
the user (Ctrl-Z). Using GNU Ncurses instead of OSF1 curses works
around the problem. According to the lynx and ncurses people, this
is a design problem of curses vs. signal handling, at the heart of it.
- Solaris 2.8 on Intel hardware may not work using the vendor's curses
implementation. Using the free NCurses should help.
- Some ancient Unix filesytems supported only 14 characters in
filenames. cscope no longer cares for that by default. If you want
to run it on such a system, #define the macro SHORT_NAMES_ONLY manually
(there's a definition in global.h you can uncomment).
Browse to http://cscope.sourceforge.net for more current information,
like reported bugs whose solutions haven't been put into this source
distribution yet.

View File

@ -0,0 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = doc src contrib
EXTRA_DIST = packages

View File

@ -0,0 +1,610 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
LIBOBJDIR =
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
TODO compile config.guess config.sub depcomp install-sh \
missing mkinstalldirs ylwrap
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@
CURSES_LIBS = @CURSES_LIBS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GNOME_LINUX_FALSE = @GNOME_LINUX_FALSE@
GNOME_LINUX_TRUE = @GNOME_LINUX_TRUE@
GREP = @GREP@
HAS_CURSES_FALSE = @HAS_CURSES_FALSE@
HAS_CURSES_TRUE = @HAS_CURSES_TRUE@
HAS_GNOME_FALSE = @HAS_GNOME_FALSE@
HAS_GNOME_TRUE = @HAS_GNOME_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USING_GNOME2_FALSE = @USING_GNOME2_FALSE@
USING_GNOME2_TRUE = @USING_GNOME2_TRUE@
USING_LEX_FALSE = @USING_LEX_FALSE@
USING_LEX_TRUE = @USING_LEX_TRUE@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
ac_ct_CC = @ac_ct_CC@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
gnome1 = @gnome1@
gnome2 = @gnome2@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = doc src contrib
EXTRA_DIST = packages
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-generic clean-recursive ctags \
ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
dist-tarZ dist-zip distcheck distclean distclean-generic \
distclean-hdr distclean-recursive distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,4 @@
2003/09/04 - Release of version 15.5.
2002/08/15 - Release of version 15.4.
2001/07/02 - Release of version 15.3.
2000/04/18 - Release of Version 13.0 into Open Source. Initial Linux port

View File

@ -0,0 +1,31 @@
Cscope is a text screen based source browsing tool. Although it is
primarily designed to search C code (including lex and yacc files), it
can also be used for C++ code.
Using cscope, you can easily search for where symbols are used and
defined. Cscope is designed to answer questions like:
Where is this variable used?
What is the value of this preprocessor symbol?
Where is this function in the source files?
What functions call this function?
What functions are called by this function?
Where does the message "out of space" come from?
Where is this source file in the directory structure?
What files include this header file?
It has been released by The Santa Cruz Operation, Inc as Open Source
under the BSD license. Please look at COPYING for a detailed
description of the license.
For instructions on how to build and install cscope, see the file,
"INSTALL".
One thing to be pointed out is that this is ancient Unix software
predating much of today's security concerns. While we do try to
address safety issues as we learn about them, it must be said that
this is in no way hardened or secure software. It's designed to be
used by developers, not administrators or anonymous users.
Browse to http://cscope.sourceforge.net for more current information

View File

@ -0,0 +1,24 @@
Open
+ Display the current case mode (^C) onscreen
+ emacs like key bindings
^S for searching (^Y)
Up/dwn Arrow support Next/Prev field. ??
Inline editing on Input fields ( ??^B/^F )
^X^C to quit ( ^Q ??)
Pagdwn/PageUp/+/-
+ Same capabilities as interactive in non interactive (one shot) mode
+ Provide some how-do-I-use-this-thing doc.
+ Replace invlib.[ch] by real database. Failing that, at least sanitize it.
Possible changes:
? Change to full screen target display and use bottom line for command,
control or fn keys for operations (cf pine)
? Apply added capability from osr5 codebase

View File

@ -0,0 +1,230 @@
# $Id: acinclude.m4,v 1.1 2009/04/10 13:39:22 broeker Exp $
# Copyright (c) 2008 Holger Weiss <holger@jhweiss.de>.
#
# This code may freely be used, modified and/or redistributed for any purpose.
# It would be nice if additions and fixes to this file (including trivial code
# cleanups) would be sent back in order to let me include them in the version
# available at <http://www.jhweiss.de/software/snprintf.html>. However, this is
# not a requirement for using or redistributing (possibly modified) versions of
# this file, nor is leaving this notice intact mandatory.
# HW_HEADER_STDARG_H
# ------------------
# Define HAVE_STDARG_H to 1 if <stdarg.h> is available.
AC_DEFUN([HW_HEADER_STDARG_H],
[
AC_PREREQ([2.60])dnl Older releases should work if AC_CHECK_HEADERS is used.
AC_CHECK_HEADERS_ONCE([stdarg.h])
])# HW_HEADER_STDARG_H
# HW_HEADER_VARARGS_H
# -------------------
# Define HAVE_VARARGS_H to 1 if <varargs.h> is available.
AC_DEFUN([HW_HEADER_VARARGS_H],
[
AC_PREREQ([2.60])dnl Older releases should work if AC_CHECK_HEADERS is used.
AC_CHECK_HEADERS_ONCE([varargs.h])
])# HW_HEADER_VARARGS_H
# HW_FUNC_VA_COPY
# ---------------
# Set $hw_cv_func_va_copy to "yes" or "no". Define HAVE_VA_COPY to 1 if
# $hw_cv_func_va_copy is set to "yes". Note that it's "unspecified whether
# va_copy and va_end are macros or identifiers declared with external linkage."
# (C99: 7.15.1, 1) Therefore, the presence of va_copy(3) cannot simply "be
# tested with #ifdef", as suggested by the Autoconf manual (5.5.1).
AC_DEFUN([HW_FUNC_VA_COPY],
[
AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H.
AC_REQUIRE([HW_HEADER_VARARGS_H])dnl Our check evaluates HAVE_VARARGS_H.
AC_CACHE_CHECK([for va_copy],
[hw_cv_func_va_copy],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#if HAVE_STDARG_H
#include <stdarg.h>
#elif HAVE_VARARGS_H
#include <varargs.h>
#endif]],
[[va_list ap, aq; va_copy(aq, ap);]])],
[hw_cv_func_va_copy=yes],
[hw_cv_func_va_copy=no],
[hw_cv_func_va_copy=no])])
AS_IF([test "$hw_cv_func_va_copy" = yes],
[AC_DEFINE([HAVE_VA_COPY], [1],
[Define to 1 if you have the `va_copy' function or macro.])])
])# HW_FUNC_VA_COPY
# HW_FUNC___VA_COPY
# -----------------
# Set $hw_cv_func___va_copy to "yes" or "no". Define HAVE___VA_COPY to 1 if
# $hw_cv_func___va_copy is set to "yes".
AC_DEFUN([HW_FUNC___VA_COPY],
[
AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H.
AC_REQUIRE([HW_HEADER_VARARGS_H])dnl Our check evaluates HAVE_VARARGS_H.
AC_CACHE_CHECK([for __va_copy],
[hw_cv_func___va_copy],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#if HAVE_STDARG_H
#include <stdarg.h>
#elif HAVE_VARARGS_H
#include <varargs.h>
#endif]],
[[va_list ap, aq; __va_copy(aq, ap);]])],
[hw_cv_func___va_copy=yes],
[hw_cv_func___va_copy=no],
[hw_cv_func___va_copy=no])])
AS_IF([test "$hw_cv_func___va_copy" = yes],
[AC_DEFINE([HAVE___VA_COPY], [1],
[Define to 1 if you have the `__va_copy' function or macro.])])
])# HW_FUNC___VA_COPY
# HW_FUNC_VSNPRINTF
# -----------------
# Set $hw_cv_func_vsnprintf and $hw_cv_func_vsnprintf_c99 to "yes" or "no",
# respectively. Define HAVE_VSNPRINTF to 1 only if $hw_cv_func_vsnprintf_c99
# is set to "yes". Otherwise, define vsnprintf to rpl_vsnprintf and make sure
# the replacement function will be built.
AC_DEFUN([HW_FUNC_VSNPRINTF],
[
AC_PREREQ([2.60])dnl 2.59 should work if some AC_TYPE_* macros are replaced.
AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H.
AC_CHECK_FUNC([vsnprintf],
[hw_cv_func_vsnprintf=yes],
[hw_cv_func_vsnprintf=no])
AS_IF([test "$hw_cv_func_vsnprintf" = yes],
[AC_CACHE_CHECK([whether vsnprintf is C99 compliant],
[hw_cv_func_vsnprintf_c99],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#if HAVE_STDARG_H
#include <stdarg.h>
#endif
#include <stdio.h>
static int testprintf(char *buf, size_t size, const char *format, ...)
{
int result;
va_list ap;
va_start(ap, format);
result = vsnprintf(buf, size, format, ap);
va_end(ap);
return result;
}]],
[[char buf[43];
if (testprintf(buf, 4, "The answer is %27.2g.", 42.0) != 42 ||
testprintf(buf, 0, "No, it's %32zu.", (size_t)42) != 42 ||
buf[0] != 'T' || buf[3] != '\0')
return 1;]])],
[hw_cv_func_vsnprintf_c99=yes],
[hw_cv_func_vsnprintf_c99=no],
[hw_cv_func_vsnprintf_c99=no])])],
[hw_cv_func_snprintf_c99=no])
AS_IF([test "$hw_cv_func_vsnprintf_c99" = yes],
[AC_DEFINE([HAVE_VSNPRINTF], [1],
[Define to 1 if you have a C99 compliant `vsnprintf' function.])],
[AC_DEFINE([vsnprintf], [rpl_vsnprintf],
[Define to rpl_vsnprintf if the replacement function should be used.])
AC_CHECK_HEADERS([inttypes.h locale.h stddef.h stdint.h])
AC_CHECK_MEMBERS([struct lconv.decimal_point, struct lconv.thousands_sep],
[], [], [#include <locale.h>])
AC_TYPE_LONG_DOUBLE
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_TYPE_SIZE_T
AC_TYPE_INTMAX_T
AC_TYPE_UINTMAX_T
AC_TYPE_UINTPTR_T
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_FUNCS([localeconv])
_HW_FUNC_XPRINTF_REPLACE])
])# HW_FUNC_VSNPRINTF
# HW_FUNC_SNPRINTF
# ----------------
# Set $hw_cv_func_snprintf and $hw_cv_func_snprintf_c99 to "yes" or "no",
# respectively. Define HAVE_SNPRINTF to 1 only if $hw_cv_func_snprintf_c99
# is set to "yes". Otherwise, define snprintf to rpl_snprintf and make sure
# the replacement function will be built.
AC_DEFUN([HW_FUNC_SNPRINTF],
[
AC_REQUIRE([HW_FUNC_VSNPRINTF])dnl Our snprintf(3) calls vsnprintf(3).
AC_CHECK_FUNC([snprintf],
[hw_cv_func_snprintf=yes],
[hw_cv_func_snprintf=no])
AS_IF([test "$hw_cv_func_snprintf" = yes],
[AC_CACHE_CHECK([whether snprintf is C99 compliant],
[hw_cv_func_snprintf_c99],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[#include <stdio.h>]],
[[char buf[43];
if (snprintf(buf, 4, "The answer is %27.2g.", 42.0) != 42 ||
snprintf(buf, 0, "No, it's %32zu.", (size_t)42) != 42 ||
buf[0] != 'T' || buf[3] != '\0')
return 1;]])],
[hw_cv_func_snprintf_c99=yes],
[hw_cv_func_snprintf_c99=no],
[hw_cv_func_snprintf_c99=no])])],
[hw_cv_func_snprintf_c99=no])
AS_IF([test "$hw_cv_func_snprintf_c99" = yes],
[AC_DEFINE([HAVE_SNPRINTF], [1],
[Define to 1 if you have a C99 compliant `snprintf' function.])],
[AC_DEFINE([snprintf], [rpl_snprintf],
[Define to rpl_snprintf if the replacement function should be used.])
_HW_FUNC_XPRINTF_REPLACE])
])# HW_FUNC_SNPRINTF
# HW_FUNC_VASPRINTF
# -----------------
# Set $hw_cv_func_vasprintf to "yes" or "no". Define HAVE_VASPRINTF to 1 if
# $hw_cv_func_vasprintf is set to "yes". Otherwise, define vasprintf to
# rpl_vasprintf and make sure the replacement function will be built.
AC_DEFUN([HW_FUNC_VASPRINTF],
[
AC_REQUIRE([HW_FUNC_VSNPRINTF])dnl Our vasprintf(3) calls vsnprintf(3).
AC_CHECK_FUNCS([vasprintf],
[hw_cv_func_vasprintf=yes],
[hw_cv_func_vasprintf=no])
AS_IF([test "$hw_cv_func_vasprintf" = no],
[AC_DEFINE([vasprintf], [rpl_vasprintf],
[Define to rpl_vasprintf if the replacement function should be used.])
AC_CHECK_HEADERS([stdlib.h])
HW_FUNC_VA_COPY
AS_IF([test "$hw_cv_func_va_copy" = no],
[HW_FUNC___VA_COPY])
_HW_FUNC_XPRINTF_REPLACE])
])# HW_FUNC_VASPRINTF
# HW_FUNC_ASPRINTF
# ----------------
# Set $hw_cv_func_asprintf to "yes" or "no". Define HAVE_ASPRINTF to 1 if
# $hw_cv_func_asprintf is set to "yes". Otherwise, define asprintf to
# rpl_asprintf and make sure the replacement function will be built.
AC_DEFUN([HW_FUNC_ASPRINTF],
[
AC_REQUIRE([HW_FUNC_VASPRINTF])dnl Our asprintf(3) calls vasprintf(3).
AC_CHECK_FUNCS([asprintf],
[hw_cv_func_asprintf=yes],
[hw_cv_func_asprintf=no])
AS_IF([test "$hw_cv_func_asprintf" = no],
[AC_DEFINE([asprintf], [rpl_asprintf],
[Define to rpl_asprintf if the replacement function should be used.])
_HW_FUNC_XPRINTF_REPLACE])
])# HW_FUNC_ASPRINTF
# _HW_FUNC_XPRINTF_REPLACE
# ------------------------
# Arrange for building snprintf.c. Must be called if one or more of the
# functions provided by snprintf.c are needed.
AC_DEFUN([_HW_FUNC_XPRINTF_REPLACE],
[
AS_IF([test "x$_hw_cv_func_xprintf_replace_done" != xyes],
[AC_C_CONST
HW_HEADER_STDARG_H
AC_LIBOBJ([snprintf])
_hw_cv_func_xprintf_replace_done=yes])
])# _HW_FUNC_XPRINTF_REPLACE
dnl vim: set joinspaces textwidth=80:

872
vim_plugins_src/cscope-15.7a/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,872 @@
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.6])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.58])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_PROG_LEX
# -----------
# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a
# "missing" invocation, for better error output.
AC_DEFUN([AM_PROG_LEX],
[AC_PREREQ(2.50)dnl
AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
AC_REQUIRE([AC_PROG_LEX])dnl
if test "$LEX" = :; then
LEX=${am_missing_run}flex
fi])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
# This was a mistake. There are at least two reasons why we must not
# use `-m 0755':
# - it causes special bits like SGID to be ignored,
# - it may be too restrictive (some setups expect 775 directories).
#
# Do not use -m 0755 and let people choose whatever they expect by
# setting umask.
#
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
# Some implementations (such as Solaris 8's) are not thread-safe: if a
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
# concurrently, both version can detect that a/ is missing, but only
# one can create it and the other will error out. Consequently we
# restrict ourselves to GNU make (using the --version option ensures
# this.)
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
AC_SUBST([mkdir_p])])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([acinclude.m4])

View File

@ -0,0 +1,142 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

1463
vim_plugins_src/cscope-15.7a/config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,258 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* We're using a BSD-flavoured Unix */
#undef BSD
/* Found some version of curses that we're going to use */
#undef HAS_CURSES
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fixkeypad' function. */
#undef HAVE_FIXKEYPAD
/* Define to 1 if you have the <floss.h> header file. */
#undef HAVE_FLOSS_H
/* Define to 1 if you have the `getcwd' function. */
#undef HAVE_GETCWD
/* Define to 1 if the system has the type `intmax_t'. */
#undef HAVE_INTMAX_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define to 1 if you have the `regex' library (-lregex). */
#undef HAVE_LIBREGEX
/* Define to 1 if you have the `localeconv' function. */
#undef HAVE_LOCALECONV
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if the system has the type `long double'. */
#undef HAVE_LONG_DOUBLE
/* Define to 1 if the system has the type `long long int'. */
#undef HAVE_LONG_LONG_INT
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if the system has the type `ptrdiff_t'. */
#undef HAVE_PTRDIFF_T
/* Define to 1 if you have the `regcmp' function. */
#undef HAVE_REGCMP
/* Define to 1 if you have the `regcomp' function. */
#undef HAVE_REGCOMP
/* Define to 1 if you have the `setmode' function. */
#undef HAVE_SETMODE
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define if we have sigsetjmp(). */
#undef HAVE_SIGSETJMP
/* Define to 1 if you have a C99 compliant `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if `decimal_point' is member of `struct lconv'. */
#undef HAVE_STRUCT_LCONV_DECIMAL_POINT
/* Define to 1 if `thousands_sep' is member of `struct lconv'. */
#undef HAVE_STRUCT_LCONV_THOUSANDS_SEP
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/termios.h> header file. */
#undef HAVE_SYS_TERMIOS_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/window.h> header file. */
#undef HAVE_SYS_WINDOW_H
/* Define to 1 if the system has the type `uintmax_t'. */
#undef HAVE_UINTMAX_T
/* Define to 1 if the system has the type `uintptr_t'. */
#undef HAVE_UINTPTR_T
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if the system has the type `unsigned long long int'. */
#undef HAVE_UNSIGNED_LONG_LONG_INT
/* Define to 1 if you have the <varargs.h> header file. */
#undef HAVE_VARARGS_H
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* Define to 1 if you have the `va_copy' function or macro. */
#undef HAVE_VA_COPY
/* Define to 1 if you have a C99 compliant `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the `_setmode' function. */
#undef HAVE__SETMODE
/* Define to 1 if you have the `__va_copy' function or macro. */
#undef HAVE___VA_COPY
/* We're using some variant of Linux */
#undef Linux
/* Set to reflect version of ncurses: 0 = version 1.* 1 = version 1.9.9g 2 =
version 4.0/4.1 */
#undef NCURSES_970530
/* If your Curses does not have color define this one */
#undef NO_COLOR_CURSES
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* Define if you want to turn on SCO-specific code */
#undef SCO_FLAVOR
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Use Ncurses? */
#undef USE_NCURSES
/* Use SunOS SysV curses? */
#undef USE_SUNOS_CURSES
/* Use SystemV curses? */
#undef USE_SYSV_CURSES
/* Define this if the scanner is run through lex, not flex */
#undef USING_LEX
/* Version number of package */
#undef VERSION
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER
/* Define to rpl_asprintf if the replacement function should be used. */
#undef asprintf
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
not define. */
#undef intmax_t
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to rpl_snprintf if the replacement function should be used. */
#undef snprintf
/* Define to the widest unsigned integer type if <stdint.h> and <inttypes.h>
do not define. */
#undef uintmax_t
/* Define to the type of an unsigned integer type wide enough to hold a
pointer, if such a type exists, and if the system does not define it. */
#undef uintptr_t
/* Define to rpl_vasprintf if the replacement function should be used. */
#undef vasprintf
/* Define to rpl_vsnprintf if the replacement function should be used. */
#undef vsnprintf

1579
vim_plugins_src/cscope-15.7a/config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

12492
vim_plugins_src/cscope-15.7a/configure vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,421 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([src/crossref.c])
AM_INIT_AUTOMAKE(cscope, 15.7a)
AC_CONFIG_HEADERS([config.h:config.h.in])
AC_PREREQ(2.59)
AC_CANONICAL_HOST
dnl User specification of lexer
dnl AC_CHECK_LEXER
dnl User specification of yacc
dnl AC_CHECK_YACC
dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_CC
AC_EXEEXT
AM_PROG_LEX
AM_CONDITIONAL(USING_LEX, test "x$LEX" = "xlex")
if test "x$LEX" = "xlex" ; then AC_DEFINE(USING_LEX, 1,
[Define this if the scanner is run through lex, not flex])
fi
AC_PROG_YACC
dnl === BEGIN CURSES CHECK
dnl Curses detection: Munged from Midnight Commander's configure.in
dnl
dnl What it does:
dnl =============
dnl
dnl - Determine which version of curses is installed on your system
dnl and set the -I/-L/-l compiler entries and add a few preprocessor
dnl symbols
dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
dnl Makefile.in's
dnl - Modify the following configure variables (these are the only
dnl curses.m4 variables you can access from within configure.in)
dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
dnl an ncurses.h that's been renamed to curses.h
dnl is found.
dnl CURSES_LIBS - sets -L and -l's appropriately
dnl CFLAGS - if --with-sco, add -D_SVID3
dnl has_curses - exports result of tests to rest of configure
dnl
dnl Usage:
dnl ======
dnl 1) Add lines indicated below to acconfig.h
dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
dnl 3) Instead of #include <curses.h> you should use the following to
dnl properly locate ncurses or curses header file
dnl
dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
dnl #include <ncurses.h>
dnl #else
dnl #include <curses.h>
dnl #endif
dnl
dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
dnl
dnl Notes with automake:
dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
dnl configure.in
dnl - your Makefile.am can look something like this
dnl -----------------------------------------------
dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
dnl if HAS_CURSES
dnl CURSES_TARGETS=name_of_curses_prog
dnl endif
dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
dnl other_programs_SOURCES = blah blah blah
dnl name_of_curses_prog_SOURCES = blah blah blah
dnl other_programs_LDADD = blah
dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
dnl -----------------------------------------------
dnl
dnl
dnl The following lines should be added to acconfig.h:
dnl ==================================================
dnl
dnl /*=== Curses version detection defines ===*/
dnl /* Found some version of curses that we're going to use */
dnl #undef HAS_CURSES
dnl
dnl /* Use SunOS SysV curses? */
dnl #undef USE_SUNOS_CURSES
dnl
dnl /* Use old BSD curses - not used right now */
dnl #undef USE_BSD_CURSES
dnl
dnl /* Use SystemV curses? */
dnl #undef USE_SYSV_CURSES
dnl
dnl /* Use Ncurses? */
dnl #undef USE_NCURSES
dnl
dnl /* If you Curses does not have color define this one */
dnl #undef NO_COLOR_CURSES
dnl
dnl /* Define if you want to turn on SCO-specific code */
dnl #undef SCO_FLAVOR
dnl
dnl /* Set to reflect version of ncurses *
dnl * 0 = version 1.*
dnl * 1 = version 1.9.9g
dnl * 2 = version 4.0/4.1 */
dnl #undef NCURSES_970530
dnl
dnl /*=== End new stuff for acconfig.h ===*/
dnl
AC_DEFUN([AC_CHECK_CURSES],[
search_ncurses=true
screen_manager=""
has_curses=false
CFLAGS=${CFLAGS--O}
AC_SUBST(CURSES_LIBS)
AC_SUBST(CURSES_INCLUDEDIR)
AC_ARG_WITH(sco,
[ --with-sco Use this to turn on SCO-specific code],[
if test x$withval = xyes; then
AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
CFLAGS="$CFLAGS -D_SVID3"
fi
])
AC_ARG_WITH(sunos-curses,
[ --with-sunos-curses Used to force SunOS 4.x curses],[
if test x$withval = xyes; then
AC_USE_SUNOS_CURSES
fi
])
AC_ARG_WITH(osf1-curses,
[ --with-osf1-curses Used to force OSF/1 curses],[
if test x$withval = xyes; then
AC_USE_OSF1_CURSES
fi
])
AC_ARG_WITH(vcurses,
[ --with-vcurses[=incdir] Used to force SysV curses],
if test x$withval != xyes; then
CURSES_INCLUDEDIR="-I$withval"
fi
AC_USE_SYSV_CURSES
)
AC_ARG_WITH(ncurses,
[ --with-ncurses[=dir] Compile with ncurses/locate base dir],
if test x$withval = xno ; then
search_ncurses=false
elif test x$withval != xyes ; then
CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
CURSES_INCLUDEDIR="-I$withval/include"
search_ncurses=false
screen_manager="ncurses"
AC_DEFINE(USE_NCURSES, 1, [Use Ncurses?])
AC_DEFINE(HAS_CURSES, 1, [Found some version of curses that we're going to use])
has_curses=true
fi
)
if $search_ncurses
then
AC_SEARCH_NCURSES()
fi
])
AC_DEFUN([AC_USE_SUNOS_CURSES], [
search_ncurses=false
screen_manager="SunOS 4.x /usr/5include curses"
AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
AC_DEFINE(USE_SUNOS_CURSES, 1, [Use SunOS SysV curses?])
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(NO_COLOR_CURSES, 1, [If your Curses does not have color define this one])
AC_DEFINE(USE_SYSV_CURSES, 1, [Use SystemV curses?])
CURSES_INCLUDEDIR="-I/usr/5include"
CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
AC_MSG_RESULT(Please note that some screen refreshs may fail)
])
AC_DEFUN([AC_USE_OSF1_CURSES], [
AC_MSG_RESULT(Using OSF1 curses)
search_ncurses=false
screen_manager="OSF1 curses"
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(NO_COLOR_CURSES)
AC_DEFINE(USE_SYSV_CURSES)
CURSES_LIBS="-lcurses"
])
AC_DEFUN([AC_USE_SYSV_CURSES], [
AC_MSG_RESULT(Using SysV curses)
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_SYSV_CURSES)
search_ncurses=false
screen_manager="SysV/curses"
CURSES_LIBS="-lcurses"
])
dnl AC_ARG_WITH(bsd-curses,
dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
dnl search_ncurses=false
dnl screen_manager="Ultrix/cursesX"
dnl if test $system = ULTRIX
dnl then
dnl THIS_CURSES=cursesX
dnl else
dnl THIS_CURSES=curses
dnl fi
dnl
dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
dnl AC_DEFINE(HAS_CURSES)
dnl has_curses=true
dnl AC_DEFINE(USE_BSD_CURSES)
dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
dnl AC_MSG_WARN([Use of the bsdcurses extension has some])
dnl AC_MSG_WARN([display/input problems.])
dnl AC_MSG_WARN([Reconsider using xcurses])
dnl)
dnl
dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
dnl
AC_DEFUN([AC_NCURSES], [
if $search_ncurses
then
if test -f $1/$2
then
AC_MSG_RESULT(Found ncurses on $1/$2)
CURSES_LIBS="$3"
CURSES_INCLUDEDIR="$4"
search_ncurses=false
screen_manager=$5
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_NCURSES)
fi
fi
])
AC_DEFUN([AC_SEARCH_NCURSES], [
AS_MESSAGE(checking "location of ncurses.h file"...)
AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
dnl
dnl We couldn't find ncurses, try SysV curses
dnl
if $search_ncurses
then
AC_EGREP_HEADER(init_color, curses.h,
AC_USE_SYSV_CURSES)
AC_EGREP_CPP(USE_NCURSES,[
#include <curses.h>
#ifdef __NCURSES_H
#undef USE_NCURSES
USE_NCURSES
#endif
],[
CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_NCURSES)
search_ncurses=false
screen_manager="ncurses installed as curses"
])
fi
dnl
dnl Try SunOS 4.x /usr/5{lib,include} ncurses
dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
dnl should be replaced by a more fine grained selection routine
dnl
if $search_ncurses
then
if test -f /usr/5include/curses.h
then
AC_USE_SUNOS_CURSES
fi
else
# check for ncurses version, to properly ifdef mouse-fix
AC_MSG_CHECKING(for ncurses version)
ncurses_version=unknown
cat > conftest.$ac_ext <<EOF
[#]line __oline__ "configure"
#include "confdefs.h"
#ifdef RENAMED_NCURSES
#include <curses.h>
#else
#include <ncurses.h>
#endif
#undef VERSION
VERSION:NCURSES_VERSION
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD() |
egrep "VERSION:" >conftest.out 2>&1; then
changequote(,)dnl
ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
changequote([,])dnl
fi
rm -rf conftest*
AC_MSG_RESULT($ncurses_version)
case "$ncurses_version" in
changequote(,)dnl
4.[01])
changequote([,])dnl
AC_DEFINE(NCURSES_970530,2,
[Set to reflect version of ncurses:
0 = version 1.*
1 = version 1.9.9g
2 = version 4.0/4.1])
;;
1.9.9g)
AC_DEFINE(NCURSES_970530,1)
;;
1*)
AC_DEFINE(NCURSES_970530,0)
;;
esac
fi
])
dnl === END CURSES CHECK
AC_CHECK_CURSES
AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true)
dnl Checks for libraries.
dnl Replace `main' with a function in -lcurses:
dnl AC_CHECK_LIB(curses, main)
AC_CHECK_HEADER(regex.h, [], [
AC_MSG_ERROR([necessary header <regex.h> not found])
])
dnl Cygwin is a bit peculiar: it has the regcomp() functions, but in a
dnl separate library, so we have to check for that:
AC_CHECK_LIB(regex, regcomp)
dnl Check for a GNOME installation
AC_DEFUN([AC_CHECK_GNOME],[
has_gnome=false
AC_CHECK_PROG(gnome1, gnome-config, true)
AC_CHECK_PROG(gnome2, pkg-config, true)
if test x$gnome1 = xtrue; then
has_gnome=true
fi
if test x$gnome2 = xtrue; then
has_gnome=true
fi
AM_CONDITIONAL(USING_GNOME2, pkg-config --exists gtk+-2.0)
AM_CONDITIONAL(HAS_GNOME, test "$has_gnome" = true)
AM_CONDITIONAL(GNOME_LINUX, test "$host_os" = Linux)
])
AC_CHECK_GNOME
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/window.h sys/termios.h unistd.h signal.h floss.h io.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPE(sighandler_t,[],[],[
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif])
dnl This test was ripped from gnuplot's configure.in:
AC_MSG_CHECKING(for sigsetjmp)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <setjmp.h>]], [[jmp_buf env; sigsetjmp(env, 1);]])],[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SIGSETJMP,1,
[ Define if we have sigsetjmp(). ])],[AC_MSG_RESULT(no)])
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(strchr memcpy memset setmode _setmode)
AC_CHECK_FUNCS(getcwd regcmp regcomp strerror lstat)
AC_CHECK_FUNCS(fixkeypad)
HW_FUNC_SNPRINTF
HW_FUNC_VSNPRINTF
HW_FUNC_ASPRINTF
HW_FUNC_VASPRINTF
case "$host_os" in
linux*)
AC_DEFINE(Linux, 1, [We're using some variant of Linux])
;;
netbsd*|freebsd*|darwin*)
AC_DEFINE(BSD, 1, [We're using a BSD-flavoured Unix])
;;
esac
AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile])
AC_OUTPUT

View File

@ -0,0 +1,6 @@
## Process this file with automake to produce Makefile.in
bin_SCRIPTS = ocs
EXTRA_DIST = ocs README xcscope webcscope

View File

@ -0,0 +1,338 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
LIBOBJDIR =
subdir = contrib
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
SCRIPTS = $(bin_SCRIPTS)
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@
CURSES_LIBS = @CURSES_LIBS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GNOME_LINUX_FALSE = @GNOME_LINUX_FALSE@
GNOME_LINUX_TRUE = @GNOME_LINUX_TRUE@
GREP = @GREP@
HAS_CURSES_FALSE = @HAS_CURSES_FALSE@
HAS_CURSES_TRUE = @HAS_CURSES_TRUE@
HAS_GNOME_FALSE = @HAS_GNOME_FALSE@
HAS_GNOME_TRUE = @HAS_GNOME_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USING_GNOME2_FALSE = @USING_GNOME2_FALSE@
USING_GNOME2_TRUE = @USING_GNOME2_TRUE@
USING_LEX_FALSE = @USING_LEX_FALSE@
USING_LEX_TRUE = @USING_LEX_TRUE@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
ac_ct_CC = @ac_ct_CC@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
gnome1 = @gnome1@
gnome2 = @gnome2@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
bin_SCRIPTS = ocs
EXTRA_DIST = ocs README xcscope webcscope
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu contrib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@list='$(bin_SCRIPTS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f $$d$$p; then \
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \
else :; fi; \
done
uninstall-binSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(bin_SCRIPTS)'; for p in $$list; do \
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
uninstall-info-am:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(SCRIPTS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am: install-binSCRIPTS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binSCRIPTS uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-binSCRIPTS install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am uninstall uninstall-am uninstall-binSCRIPTS \
uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,11 @@
Contributed addons and wrappers for cscope
$Id: README,v 1.3 2001/07/02 20:57:45 petr Exp $
ocs - wrapper for cscope providing database generation through recursive
directory set (among other things) - docced in script itself.
contributed from SCO osr5.
webcscope - a web cgi interface to cscope. Contributed by Ragho Mahalingam,
using code from Dmitry Obukhovi and Steven E. Brenner.
xcscope - An (X)Emacs interface to cscope.

View File

@ -0,0 +1,308 @@
#!/bin/sh
# $Id: ocs,v 1.4 2004/06/21 18:13:21 broeker Exp $
# This utility maintains the database for cscope on a recursive dir set
# Author: donwo Tue Jun 25 15:36:39 PDT 1996
# Modified: hops Jan 2000 chg defaults to not update if files exist and force
#
# These comments ARE the manual. What more do you really need?
# if using unadorned cscope with this use cscope -d so not trash db
# cscope -L -0 <ptn> - to display ptn matches on stdout
#
# The lists of files are kept in two forms:
# TMP cscope.tmplst
# The list generated by this program
# This list will be updated each time this program
# is executed.
#
# LST cscope.lst
# The fixed list generated by some other process
# This list will be used, if found, rather than
# the TMP form generated here.
#
# CSD cscope.csd
# The fixed list generated by some other process
# This list will be used, if found, rather than
# the LST or TMP forms. CSD differs from LST in
# that the CSD list is used where the source files
# change only seldom. Cscope is requested not to
# check for changed files. This can be
# significantly faster on large source trees.
#
# INC cscope.inc
# This is a list of additional directories
# in which to search for include files.
#
# Three hierarchies of libraries are supported:
# Local In the current directory ./
# This is most useful for transient projects or
# where the information is of no use to others on
# the system. This type is NOT usable on source
# directories that are read-only.
# Home In users home directory $HOME/lib/cs/`pwd`
# This is good for items that seldom change but are
# of use only the the current user. This type is
# usable on source directories that are read-only.
# System In a global system directory $SYSDIR/`pwd`
# This is for items that are of interest to all accounts.
# This option is not available unless the system directory
# is writable by the current user. This type is usable
# on source directories that are read-only.
#
# If a shell script named ./cscope.rc is found and is
# executable, the execution of it will be included within this
# script after defaults_set/cmdline_parse and locating the
# database.
#
# Command line options:
# -x set shell debugging
# -f force
# o Do not ask about regenerating TMP. Just do it.
# o Allow cscope to regenerate libraries for CSD lists.
# -q Tell cscope to build an inverted index for quick
# symbol searching. There is a SIGNIFICANT
# increase in speed with this option however the
# disk space used is doubled. Once the quick
# database is generated, cs will detect the files
# and continue to use them.
# -d Do not regenerate. Intended for cscope sub-tasks.
# -u Update/regenerate.
#
# Here is where we put things
CSCOPE=cscope
HOMEDIR=${HOME}/lib/cs
#set the default value for SYSDIR
if [ -z "${SYSDIR}" ]; then
SYSDIR=/usr/local/lib/cs
echo setting default sysdir
fi
#check that SYSDIR exists
if [ ! -d ${SYSDIR} ]; then
echo -n $SYSDIR does not exist.
echo Please create the directory and set SYSDIR appropriately
exit
fi
# Check that cscope is in PATH
type cscope 1>/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "ERROR: cscope is not in \$PATH" >&2
echo " Please set \$PATH correctly or make sure cscope is installed" >&2
exit 1
fi
# popup editor
#XCS_EDITOR=${HOME}/bin/x_cscope_editor
XCS_EDITOR=${HOME}/bin/xme
if [ -n "$DISPLAY" -a -x ${XCS_EDITOR} ]
then
EDITOR=${XCS_EDITOR}
export EDITOR
fi
unset XCS_EDITOR
#
# Misc defaults
#FORCE=N
#NOUPDATE=
FORCE=Y # hops - default to force rather than query
NOUPDATE=-d # hops - default to no update if files already exist
QUICK=
SPECDEST= # hops - query for files
#
# Parse the command line
set -- `getopt xfqdu $*`
if [ $? -ne 0 ]
then
echo "Use: cs [-x] [-f] [-q] [-u]" >&2
echo " -x debug on " >&2
echo " -q quick Index - faster search but larger index" >&2
echo " -f ask about about regeneration" >&2
echo " -d don't update database (default)" >&2
echo " -u update database" >&2
echo " -s specify where files go" >&2
exit 1
fi
for arg
do
case $arg in
-x ) set -x; shift ;;
-f ) FORCE=N; NOUPDATE=; shift;;
-q ) QUICK=-q; shift ;;
-d ) NOUPDATE=-d; shift ;;
-u ) NOUPDATE=; shift ;;
-s ) SPECDEST=Y; shift ;;
esac
done
#
# Here is the security hole. Execute whatever is needed for
# this project. A per-project setup script may be available.
[ -x ./cscope.rc ] && {
. ./cscope.rc
}
#
# We look hard for appropriate files to scope. We ignore items
# containing "SCCS" assuming that these are directories of
# source code control data.
create_list()
{
LIST=$1
if [ -f ${LIST} ]
then
[ -n "${NOUPDATE}" ] && return
if [ "${FORCE}" != "Y" ]
then
echo "\n${LIST}"
echo "Update the library? <(Y)es, (N)o, (Q)uit> [n] \c"
read x y
case $x in
[Yy]* ) ;;
[Qq]* ) exit 1 ;;
*) return ;;
esac
fi
echo "Updating library:\n ${LIST} \c"
else
echo "Creating library:\n ${LIST} \c"
fi
(
find . -follow -type f \( -name \*.[sScChHlyG] -o \
-name \*.asm -o \
-name \*.cc -o \
-name \*.cxx -o \
-name \*.ccP -o \
-name \*.hP -o \
-name \*.inc -o \
-name \*.ed -o \
-name vuifile -o \
-name Gensymvals -o \
-name \[mM\]ake\* \) \
-print
) | grep -v SCCS | sort -u > ${LIST}
echo "\n`cat ${LIST} | wc -l` files listed"
}
#
# Expand the include file list into command line arguments
exp_inc()
{
theInc=$1
if [ -s "${theInc}" ]
then
for i in `cat ${theInc}`
do
echo "-I $i \c"
done
fi
}
#
# This routine does not return to the caller
do_cscope()
{
LIST=$1
CSLIB=$2
INC=$3
shift;shift;shift
ARGS="$*"
INCARGS=`exp_inc ${INC}`
echo "exec cscope"
exec $CSCOPE ${ARGS} -p 2 ${INCARGS} -i ${LIST} -f ${CSLIB}
echo "exec of $CSCOPE failed" >&2
exit 1
}
#
# If we have existing libraries, we should use them.
std_libs()
{
DIR=$1
OUT=${DIR}/cscope.out
LST=${DIR}/cscope.lst
CSD=${DIR}/cscope.csd
TMP=${DIR}/cscope.tmplst
INC=${DIR}/cscope.inc
QCK=${DIR}/cscope.out.po
[ -s ${QCK} ] && QUICK=-q
[ -f ${CSD} ] && {
if [ "${FORCE}" = "Y" ]
then
do_cscope ${CSD} ${OUT} ${INC} ${QUICK}
else
do_cscope ${CSD} ${OUT} ${INC} ${QUICK} -d
fi
}
[ -f ${LST} ] && do_cscope ${LST} ${OUT} ${INC} ${QUICK} ${NOUPDATE}
[ -f ${TMP} ] && {
create_list ${TMP}
do_cscope ${TMP} ${OUT} ${INC} ${QUICK} ${NOUPDATE}
}
}
#
# ######## main() #######
umask 0
PWD=`pwd`
umask 02
#
# Check for existing libraries
std_libs $PWD
std_libs ${HOMEDIR}$PWD
std_libs ${SYSDIR}$PWD
#
# We may need to create one for this area
DIR=$PWD
if [ ! -n "${NOUPDATE}" -o -n "${SPECDEST}" ] ; then
echo "Create new library? <(L)ocal, (H)ome, (S)ystem, (Q)uit> [q] \c"
read x y
case $x in
[Ll]* ) DIR=$PWD ;;
[Hh]* ) DIR=${HOMEDIR}$PWD ;;
[Ss]* ) DIR=${SYSDIR}$PWD ;;
*) exit 1 ;;
esac
fi
[ -d $DIR ] || {
mkdir -p $DIR || exit $?
}
OUT=${DIR}/cscope.out
TMP=${DIR}/cscope.tmplst
INC=${DIR}/cscope.inc
create_list ${TMP}
do_cscope ${TMP} ${OUT} ${INC} ${QUICK}

View File

@ -0,0 +1,7 @@
/INSTALL/1.1/Fri Jun 29 14:20:16 2001//
/LICENSE/1.1/Fri Jun 29 14:20:16 2001//
/TODO/1.1/Fri Jun 29 14:20:16 2001//
/cgi-lib.pl/1.1/Fri Jun 29 14:20:16 2001//
/hilite.c/1.1/Fri Jun 29 14:20:16 2001//
D/icons////
/cscope/1.2/Sun Jan 7 12:34:02 2007//

View File

@ -0,0 +1,7 @@
/INSTALL////
/LICENSE////
/TODO////
/cgi-lib.pl////
/hilite.c////
D/icons////
/cscope////

View File

@ -0,0 +1,7 @@
/INSTALL////
/LICENSE////
/TODO////
/cgi-lib.pl////
/cscope////
/hilite.c////
D/icons////

View File

@ -0,0 +1,7 @@
/INSTALL/1.1/Fri Jun 29 14:20:16 2001//
/LICENSE/1.1/Fri Jun 29 14:20:16 2001//
/TODO/1.1/Fri Jun 29 14:20:16 2001//
/cgi-lib.pl/1.1/Fri Jun 29 14:20:16 2001//
/cscope/1.1/Fri Jun 29 14:20:16 2001//
/hilite.c/1.1/Fri Jun 29 14:20:16 2001//
D/icons////

View File

@ -0,0 +1 @@
cscope/contrib/webcscope

View File

@ -0,0 +1 @@
:ssh;username=broeker;hostname=cscope.cvs.sourceforge.net:/cvsroot/cscope

View File

@ -0,0 +1,31 @@
WebCScope Installation
Quick Install
0. Create a directory called cscope under your /cgi-bin (virtual) directory.
Copy all the files in the distribution to this directory.
1. Edit the 'cscope' file and change the following items:
- Location to the perl interpreter
- Location of the cscope database and other modifiable parameters
- Feedback name and email
- Location of the syntax highlighter, if you wish to use it
2. Syntax highlighter
- The syntax highlighter must be built if you decide to use it. If you
do not want syntax highlighting, you can ignore this step and set the
highlighter to /bin/cat.
- Compile 'hilite.c' using 'gcc -o hilite hilite.c'
3. Icons
- Copy the images from the icons directory into the /icons (virtual)
directory on the web server. You can also replace these images with
whatever you choose.
4. Organizing your CScope databases
- WebCScope supports multiple databases in $cscopedir
- Create a directory for each project or sub-source in $cscopedir and,
generate your cscope database using the following commands.
- find /some/source/dir -name '*.[chyls]' -print > cscope.files
- cscope -b -q
- Repeat the above step for each database you wish to create

View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -0,0 +1,5 @@
- Better error checking and the like
- Add a more robust cookie mechanism
- More efficient way of searching 'all' databases
- Fix bugs

View File

@ -0,0 +1,471 @@
# Perl Routines to Manipulate CGI input
# cgi-lib@pobox.com
# $Id: cgi-lib.pl,v 1.1 2001/06/29 14:20:16 petr Exp $
#
# Copyright (c) 1993-1999 Steven E. Brenner
# Unpublished work.
# Permission granted to use and modify this library so long as the
# copyright above is maintained, modifications are documented, and
# credit is given for any use of the library.
#
# Thanks are due to many people for reporting bugs and suggestions
# For more information, see:
# http://cgi-lib.stanford.edu/cgi-lib/
$cgi_lib'version = sprintf("%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/);
# Parameters affecting cgi-lib behavior
# User-configurable parameters affecting file upload.
$cgi_lib'maxdata = 131072; # maximum bytes to accept via POST - 2^17
$cgi_lib'writefiles = 0; # directory to which to write files, or
# 0 if files should not be written
$cgi_lib'filepre = "cgi-lib"; # Prefix of file names, in directory above
# Do not change the following parameters unless you have special reasons
$cgi_lib'bufsize = 8192; # default buffer size when reading multipart
$cgi_lib'maxbound = 100; # maximum boundary length to be encounterd
$cgi_lib'headerout = 0; # indicates whether the header has been printed
# ReadParse
# Reads in GET or POST data, converts it to unescaped text, and puts
# key/value pairs in %in, using "\0" to separate multiple selections
# Returns >0 if there was input, 0 if there was no input
# undef indicates some failure.
# Now that cgi scripts can be put in the normal file space, it is useful
# to combine both the form and the script in one place. If no parameters
# are given (i.e., ReadParse returns FALSE), then a form could be output.
# If a reference to a hash is given, then the data will be stored in that
# hash, but the data from $in and @in will become inaccessable.
# If a variable-glob (e.g., *cgi_input) is the first parameter to ReadParse,
# information is stored there, rather than in $in, @in, and %in.
# Second, third, and fourth parameters fill associative arrays analagous to
# %in with data relevant to file uploads.
# If no method is given, the script will process both command-line arguments
# of the form: name=value and any text that is in $ENV{'QUERY_STRING'}
# This is intended to aid debugging and may be changed in future releases
sub ReadParse {
# Disable warnings as this code deliberately uses local and environment
# variables which are preset to undef (i.e., not explicitly initialized)
local ($perlwarn);
$perlwarn = $^W;
$^W = 0;
local (*in) = shift if @_; # CGI input
local (*incfn, # Client's filename (may not be provided)
*inct, # Client's content-type (may not be provided)
*insfn) = @_; # Server's filename (for spooled files)
local ($len, $type, $meth, $errflag, $cmdflag, $got, $name);
binmode(STDIN); # we need these for DOS-based systems
binmode(STDOUT); # and they shouldn't hurt anything else
binmode(STDERR);
# Get several useful env variables
$type = $ENV{'CONTENT_TYPE'};
$len = $ENV{'CONTENT_LENGTH'};
$meth = $ENV{'REQUEST_METHOD'};
if ($len > $cgi_lib'maxdata) { #'
&CgiDie("cgi-lib.pl: Request to receive too much data: $len bytes\n");
}
if (!defined $meth || $meth eq '' || $meth eq 'GET' ||
$meth eq 'HEAD' ||
$type eq 'application/x-www-form-urlencoded') {
local ($key, $val, $i);
# Read in text
if (!defined $meth || $meth eq '') {
$in = $ENV{'QUERY_STRING'};
$cmdflag = 1; # also use command-line options
} elsif($meth eq 'GET' || $meth eq 'HEAD') {
$in = $ENV{'QUERY_STRING'};
} elsif ($meth eq 'POST') {
if (($got = read(STDIN, $in, $len) != $len))
{$errflag="Short Read: wanted $len, got $got\n";};
} else {
&CgiDie("cgi-lib.pl: Unknown request method: $meth\n");
}
@in = split(/[&;]/,$in);
push(@in, @ARGV) if $cmdflag; # add command-line parameters
foreach $i (0 .. $#in) {
# Convert plus to space
$in[$i] =~ s/\+/ /g;
# Split into key and value.
($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
# Convert %XX from hex numbers to alphanumeric
$key =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
$val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
# Associate key and value
$in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator
$in{$key} .= $val;
}
} elsif ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) {
# for efficiency, compile multipart code only if needed
$errflag = !(eval <<'END_MULTIPART');
local ($buf, $boundary, $head, @heads, $cd, $ct, $fname, $ctype, $blen);
local ($bpos, $lpos, $left, $amt, $fn, $ser);
local ($bufsize, $maxbound, $writefiles) =
($cgi_lib'bufsize, $cgi_lib'maxbound, $cgi_lib'writefiles);
# The following lines exist solely to eliminate spurious warning messages
$buf = '';
($boundary) = $type =~ /boundary="([^"]+)"/; #"; # find boundary
($boundary) = $type =~ /boundary=(\S+)/ unless $boundary;
&CgiDie ("Boundary not provided: probably a bug in your server")
unless $boundary;
$boundary = "--" . $boundary;
$blen = length ($boundary);
if ($ENV{'REQUEST_METHOD'} ne 'POST') {
&CgiDie("Invalid request method for multipart/form-data: $meth\n");
}
if ($writefiles) {
local($me);
stat ($writefiles);
$writefiles = "/tmp" unless -d _ && -w _;
# ($me) = $0 =~ m#([^/]*)$#;
$writefiles .= "/$cgi_lib'filepre";
}
# read in the data and split into parts:
# put headers in @in and data in %in
# General algorithm:
# There are two dividers: the border and the '\r\n\r\n' between
# header and body. Iterate between searching for these
# Retain a buffer of size(bufsize+maxbound); the latter part is
# to ensure that dividers don't get lost by wrapping between two bufs
# Look for a divider in the current batch. If not found, then
# save all of bufsize, move the maxbound extra buffer to the front of
# the buffer, and read in a new bufsize bytes. If a divider is found,
# save everything up to the divider. Then empty the buffer of everything
# up to the end of the divider. Refill buffer to bufsize+maxbound
# Note slightly odd organization. Code before BODY: really goes with
# code following HEAD:, but is put first to 'pre-fill' buffers. BODY:
# is placed before HEAD: because we first need to discard any 'preface,'
# which would be analagous to a body without a preceeding head.
$left = $len;
PART: # find each part of the multi-part while reading data
while (1) {
die $@ if $errflag;
$amt = ($left > $bufsize+$maxbound-length($buf)
? $bufsize+$maxbound-length($buf): $left);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
$in{$name} .= "\0" if defined $in{$name};
$in{$name} .= $fn if $fn;
$name=~/([-\w]+)/; # This allows $insfn{$name} to be untainted
if (defined $1) {
$insfn{$1} .= "\0" if defined $insfn{$1};
$insfn{$1} .= $fn if $fn;
}
BODY:
while (($bpos = index($buf, $boundary)) == -1) {
if ($left == 0 && $buf eq '') {
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
&CgiDie("cgi-lib.pl: reached end of input while seeking boundary " .
"of multipart. Format of CGI input is wrong.\n");
}
die $@ if $errflag;
if ($name) { # if no $name, then it's the prologue -- discard
if ($fn) { print FILE substr($buf, 0, $bufsize); }
else { $in{$name} .= substr($buf, 0, $bufsize); }
}
$buf = substr($buf, $bufsize);
$amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
}
if (defined $name) { # if no $name, then it's the prologue -- discard
if ($fn) { print FILE substr($buf, 0, $bpos-2); }
else { $in {$name} .= substr($buf, 0, $bpos-2); } # kill last \r\n
}
close (FILE);
last PART if substr($buf, $bpos + $blen, 2) eq "--";
substr($buf, 0, $bpos+$blen+2) = '';
$amt = ($left > $bufsize+$maxbound-length($buf)
? $bufsize+$maxbound-length($buf) : $left);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
undef $head; undef $fn;
HEAD:
while (($lpos = index($buf, "\r\n\r\n")) == -1) {
if ($left == 0 && $buf eq '') {
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
&CgiDie("cgi-lib: reached end of input while seeking end of " .
"headers. Format of CGI input is wrong.\n$buf");
}
die $@ if $errflag;
$head .= substr($buf, 0, $bufsize);
$buf = substr($buf, $bufsize);
$amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
}
$head .= substr($buf, 0, $lpos+2);
push (@in, $head);
@heads = split("\r\n", $head);
($cd) = grep (/^\s*Content-Disposition:/i, @heads);
($ct) = grep (/^\s*Content-Type:/i, @heads);
($name) = $cd =~ /\bname="([^"]+)"/i; #";
($name) = $cd =~ /\bname=([^\s:;]+)/i unless defined $name;
($fname) = $cd =~ /\bfilename="([^"]*)"/i; #"; # filename can be null-str
($fname) = $cd =~ /\bfilename=([^\s:;]+)/i unless defined $fname;
$incfn{$name} .= (defined $in{$name} ? "\0" : "") .
(defined $fname ? $fname : "");
($ctype) = $ct =~ /^\s*Content-type:\s*"([^"]+)"/i; #";
($ctype) = $ct =~ /^\s*Content-Type:\s*([^\s:;]+)/i unless defined $ctype;
$inct{$name} .= (defined $in{$name} ? "\0" : "") . $ctype;
if ($writefiles && defined $fname) {
$ser++;
$fn = $writefiles . ".$$.$ser";
open (FILE, ">$fn") || &CgiDie("Couldn't open $fn\n");
binmode (FILE); # write files accurately
}
substr($buf, 0, $lpos+4) = '';
undef $fname;
undef $ctype;
}
1;
END_MULTIPART
if ($errflag) {
local ($errmsg, $value);
$errmsg = $@ || $errflag;
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
&CgiDie($errmsg);
} else {
# everything's ok.
}
} else {
&CgiDie("cgi-lib.pl: Unknown Content-type: $ENV{'CONTENT_TYPE'}\n");
}
# no-ops to avoid warnings
$insfn = $insfn;
$incfn = $incfn;
$inct = $inct;
$^W = $perlwarn;
return ($errflag ? undef : scalar(@in));
}
# PrintHeader
# Returns the magic line which tells WWW that we're an HTML document
sub PrintHeader {
return "Content-type: text/html\n\n";
}
# HtmlTop
# Returns the <head> of a document and the beginning of the body
# with the title and a body <h1> header as specified by the parameter
sub HtmlTop
{
local ($title) = @_;
return <<END_OF_TEXT;
<html>
<head>
<title>$title</title>
</head>
<body>
<h1>$title</h1>
END_OF_TEXT
}
# HtmlBot
# Returns the </body>, </html> codes for the bottom of every HTML page
sub HtmlBot
{
return "</body>\n</html>\n";
}
# SplitParam
# Splits a multi-valued parameter into a list of the constituent parameters
sub SplitParam
{
local ($param) = @_;
local (@params) = split ("\0", $param);
return (wantarray ? @params : $params[0]);
}
# MethGet
# Return true if this cgi call was using the GET request, false otherwise
sub MethGet {
return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "GET");
}
# MethPost
# Return true if this cgi call was using the POST request, false otherwise
sub MethPost {
return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "POST");
}
# MyBaseUrl
# Returns the base URL to the script (i.e., no extra path or query string)
sub MyBaseUrl {
local ($ret, $perlwarn);
$perlwarn = $^W; $^W = 0;
$ret = 'http://' . $ENV{'SERVER_NAME'} .
($ENV{'SERVER_PORT'} != 80 ? ":$ENV{'SERVER_PORT'}" : '') .
$ENV{'SCRIPT_NAME'};
$^W = $perlwarn;
return $ret;
}
# MyFullUrl
# Returns the full URL to the script (i.e., with extra path or query string)
sub MyFullUrl {
local ($ret, $perlwarn);
$perlwarn = $^W; $^W = 0;
$ret = 'http://' . $ENV{'SERVER_NAME'} .
($ENV{'SERVER_PORT'} != 80 ? ":$ENV{'SERVER_PORT'}" : '') .
$ENV{'SCRIPT_NAME'} . $ENV{'PATH_INFO'} .
(length ($ENV{'QUERY_STRING'}) ? "?$ENV{'QUERY_STRING'}" : '');
$^W = $perlwarn;
return $ret;
}
# MyURL
# Returns the base URL to the script (i.e., no extra path or query string)
# This is obsolete and will be removed in later versions
sub MyURL {
return &MyBaseUrl;
}
# CgiError
# Prints out an error message which which containes appropriate headers,
# markup, etcetera.
# Parameters:
# If no parameters, gives a generic error message
# Otherwise, the first parameter will be the title and the rest will
# be given as different paragraphs of the body
sub CgiError {
local (@msg) = @_;
local ($i,$name);
if (!@msg) {
$name = &MyFullUrl;
@msg = ("Error: script $name encountered fatal error\n");
};
if (!$cgi_lib'headerout) { #')
print &PrintHeader;
print "<html>\n<head>\n<title>$msg[0]</title>\n</head>\n<body>\n";
}
print "<h1>$msg[0]</h1>\n";
foreach $i (1 .. $#msg) {
print "<p>$msg[$i]</p>\n";
}
$cgi_lib'headerout++;
}
# CgiDie
# Identical to CgiError, but also quits with the passed error message.
sub CgiDie {
local (@msg) = @_;
&CgiError (@msg);
die @msg;
}
# PrintVariables
# Nicely formats variables. Three calling options:
# A non-null associative array - prints the items in that array
# A type-glob - prints the items in the associated assoc array
# nothing - defaults to use %in
# Typical use: &PrintVariables()
sub PrintVariables {
local (*in) = @_ if @_ == 1;
local (%in) = @_ if @_ > 1;
local ($out, $key, $output);
$output = "\n<dl compact>\n";
foreach $key (sort keys(%in)) {
foreach (split("\0", $in{$key})) {
($out = $_) =~ s/\n/<br>\n/g;
$output .= "<dt><b>$key</b>\n <dd>:<i>$out</i>:<br>\n";
}
}
$output .= "</dl>\n";
return $output;
}
# PrintEnv
# Nicely formats all environment variables and returns HTML string
sub PrintEnv {
&PrintVariables(*ENV);
}
# The following lines exist only to avoid warning messages
$cgi_lib'writefiles = $cgi_lib'writefiles;
$cgi_lib'bufsize = $cgi_lib'bufsize ;
$cgi_lib'maxbound = $cgi_lib'maxbound;
$cgi_lib'version = $cgi_lib'version;
$cgi_lib'filepre = $cgi_lib'filepre;
1; #return true

View File

@ -0,0 +1,450 @@
#!/usr/bin/perl
# $Id: cscope,v 1.2 2007/01/07 12:34:01 broeker Exp $
#
# WebCscope: A web interface to the cscope application
# Copyright (C) 2001, Ragho Mahalingam <ragho@mahalingam.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Change History:
#
# $Log: cscope,v $
# Revision 1.2 2007/01/07 12:34:01 broeker
# Direct attention to security issues with webcscope.
#
# Revision 1.1 2001/06/29 14:20:16 petr
# Added webcscope to contribs.
#
# Revision 1.3.4.1 2001/02/05 15:14:34 rmahalin
# initial release with some bug fixes
#
# Revision 1.3.3.1 2001/01/22 22:21:23 rmahalin
# added multi-database support
# fixed cookie support for trivial functions; removed global trivials
# added syntax highlighting for files displayed on browser
#
# Revision 1.3.1.1 2001/01/11 22:17:30 rmahalin
# added direct download with mime-type 'text/c-source' and made cosmetic changes
#
# Revision 1.3 2001/01/11 21:36:39 rmahalin
# *** empty log message ***
#
# Revision 1.2 2001/01/11 21:34:13 rmahalin
# incorporated draft feedback changes
#
# Revision 1.1 2001/01/11 21:19:32 rmahalin
# Initial revision
#
require "cgi-lib.pl";
# current code version being used
$version = "iSOS 2.5/int16";
# full path to the cscope binary
$cscopecmd = "/usr/global/bin/cscope";
# cscope working directory, where all the in/out and db files are stored
$cscopedir = "/usr/local/cscope";
# trivial functions not to display, one per line in the trivs file
$trivs = "/usr/local/htdocs/cscope/trivials";
# temporary storage directory
$tmpdir = "/tmp";
$tmpinfile = $tmpdir . "/cscopein.$$";
$tmpoutfile = $tmpdir . "/cscopeout.$$";
$showfile = $tmpdir . "/showfile.$$";
# C syntax highlighting application or uncomment the line beneath to just cat
#$hiliter = "/bin/cat";
$hiliter = "/usr/local/cgi-bin/cscope/hilite";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time+1000000);
$cookie_exp = sprintf("%s %02d-%s-%s %02d:%02d:%02d GMT", $wday, $mday, $mon, $year, $hour, $min, $sec);
# standard images, from the apache distribution
$img{openfile} = "/icons/folder.gif";
$img{downloadfile} = "/icons/folder.open.gif";
$img{csymbol} = "/icons/c.gif";
$img{upfunc} = "/icons/up.gif";
$img{downfunc} = "/icons/down.gif";
$img{globalfunc} = "/icons/world2.gif";
$img{trashfunc} = "/icons/bomb.gif";
$img{untrashfunc} = "/icons/back.gif";
$img{back} = "/icons/left.gif";
# feedback details
$comment{name} = "Ragho Mahalingam";
$comment{email} = "ragho\@mahalingam.com";
# operations allowed
@oper = ( "Find this C symbol",
"Find this global symbol",
"Find functions called by",
"Find functions calling",
"Find this text string",
"---------------------",
"Find this egrep pattern",
"Find this file",
"Find files #including this file" );
# -- removed global trivial function list in favor of customized trivials
#open(TRIVIAL_FUNC, $trivs);
#@trivial = <TRIVIAL_FUNC>;
#close(TRIVIAL_FUNC);
@trivial = ();
MAIN:
{
$starttime = time;
if (&ReadParse(*input)) {
&ProcessCookie;
&ProcessForm;
} else {
&PrintForm;
}
}
sub ProcessCookie {
if ( defined $ENV{HTTP_COOKIE} ) {
($var, $val) = split('=',$ENV{HTTP_COOKIE});
$Cookie{$var} = $val;
if ( defined $Cookie{'cs-trivf'} ) {
# do nothing, else initialize it to null
} else {
$Cookie{'cs-trivf'} = "defined";
}
@loc_trivial = split(',', $Cookie{'cs-trivf'});
@trivial = ( @loc_trivial );
}
}
sub ProcessTrashForm {
if ( defined $input{'trash'} ) {
@trivial = (@trivial, $input{'func'});
} else {
@tmptriv = ();
for ($i=0; $i <= $#trivial; $i++) {
$fhash = unpack('H*', $input{'func'});
$thash = unpack('H*', $trivial[$i]);
if ( $fhash != $thash ) {
@tmptriv = ( @tmptriv, $trivial[$i] );
}
}
@trivial = @tmptriv;
}
$Cookie{'cs-trivf'} = join(',',@trivial);
print "Content-type: text/html\n";
print "Set-Cookie: cs-trivf=$Cookie{'cs-trivf'}; path=$ENV{SCRIPT_NAME}; expires $cookie_exp\n\n";
print &HtmlTop("Your WebCScope Trivial Functions");
print "<ul>";
for ($i=0; $i <= $#trivial; $i++) {
print "<li><a href=\"$ENV{SCRIPT_NAME}?untrash=&func=$trivial[$i]\"><img src=$img{untrashfunc} border=0></a>&nbsp; $trivial[$i]";
}
print "</ul><hr>\n";
print "Click <a href=\"#\" onClick=\"history.back();\"><img src=$img{back} border=0></a> to go back.\n";
print &HtmlBot;
}
sub ProcessForm {
chdir $cscopedir;
opendir(DIRLIST,$cscopedir);
@dirlist = readdir(DIRLIST);
closedir(DIRLIST);
if ( $input{'db'} eq "all" ) {
@csdirs = ();
for ($i=0; $i <= $#dirlist; $i++ ) {
if ( ($dirlist[$i] ne ".") && ($dirlist[$i] ne "..") && ( -d $dirlist[$i] ) ) {
@csdirs = ( @csdirs, $dirlist[$i] );
}
}
} else {
@csdirs = ( $input{'db'} );
}
$op = $input{'op'};
$arg = $input{'arg'};
$shtriv = $input{'triv'};
$db = $input{'db'};
if ( defined $input{'fshow'} ) { &ShowFileForm; exit; }
if ( defined $input{'load'} ) { &DownloadFileForm; exit; }
if ( (defined $input{'trash'}) || (defined $input{'untrash'}) ) {
&ProcessTrashForm; exit; }
print &PrintHeader;
print &HtmlTop ("WebCscope");
print <<ENDOFHDR;
<h3>Instructions</h3><p>
<ul>
<li><img src=$img{csymbol}> will find a symbol with this name<br>
<li><img src=$img{upfunc}> will find functions <i>calling</i> this function<br>
<li><img src=$img{downfunc}> will find functions <i>called</i> by this
function<br>
<li><img src=$img{globalfunc}> will locate a global definition of this name<br>
<li><img src=$img{openfile}> will display this file and highlight
the fragment line<br>
<li><img src=$img{downloadfile}> will download this file with mimetype "text/c-source"<br>
<li><img src=$img{trashfunc}> will add this symbol/function to your trivial list<br>
</ul>
<p><hr>
ENDOFHDR
foreach $index ( 0 .. $#csdirs ) {
unlink $tmpinfile, $tmpoutfile;
open(CSCOPEIN, ">$tmpinfile");
print CSCOPEIN "$op$arg\n";
print CSCOPEIN "exit\n";
close(CSCOPEIN);
$dbdir = $cscopedir . "/" . $csdirs[$index];
chdir($dbdir);
$syscmd = "cd $dbdir; $cscopecmd -d -l < $tmpinfile > $tmpoutfile;";
system($syscmd);
$count = 1;
open(CSCOPEIN, "$tmpoutfile");
$line = <CSCOPEIN>;
@temp = split(' ',$line);
$numresult = $temp[2];
print <<ENDOFHDRs;
<h2>Search Results from <b>$csdirs[$index]</b></h2>
<font size=+1>$oper[$op]: <b>$arg</b></font><br>
Matches: $numresult<p>
<table border=1 cellpadding=2 cellspacing=2>
<tr><td><b>Num</b></td><td><b>File</b></td><td><b>Function</b></td>
<td><b>Line</b></td><td><b>Fragment</b></td></tr>
ENDOFHDRs
$trivs_rm = 0;
for ($i=0; $i < $numresult; $i++ ) {
$line = <CSCOPEIN>;
@fields = split(' ',$line);
$file = shift @fields;
$fshowfile = $file;
$func = shift @fields;
$lnum = shift @fields;
@filef = split('/',$file);
$file = $filef[$#filef];
$frag = join(' ',@fields);
if ( ! $shtriv ) {
for ( $j=0; $j <= $#trivial; $j++ )
{
$fhash = unpack('H*', $func);
$thash = unpack('H*', $trivial[$j]);
if ( $fhash == $thash ) { $trivs_rm++; goto done; }
}
}
if ( $func ne "<global>" && $func ne "<unknown>" ) {
print <<ENDOFBODY1;
<tr><td>$count</td>
<td><a href="$ENV{SCRIPT_NAME}?fshow=1&fshowfile=$fshowfile&line=$lnum&db=$db">
<img src=$img{openfile} border=0></a> $file
<a href="$ENV{SCRIPT_NAME}?load=1&file=$fshowfile&db=$db">
<img src=$img{downloadfile} border=0></a>
</td>
<td><a href="$ENV{SCRIPT_NAME}?op=0&triv=$shtriv&arg=$func&db=$db">
<img src=$img{csymbol} border=0></a>
<a href="$ENV{SCRIPT_NAME}?op=3&triv=$shtriv&arg=$func&db=$db">
<img src=$img{upfunc} border=0></a>
$func
<a href="$ENV{SCRIPT_NAME}?op=2&triv=$shtriv&arg=$func&db=$db">
<img src=$img{downfunc} border=0></a>
<a href="$ENV{SCRIPT_NAME}?op=1&triv=$shtriv&arg=$func&db=$db">
<img src=$img{globalfunc} border=0></a>
<a href="$ENV{SCRIPT_NAME}?trash=&func=$func&db=$db">
<img src=$img{trashfunc} border=0></a>
</td>
<td>$lnum</td>
<td>$frag</td></tr>
ENDOFBODY1
} else {
$func =~ tr/<>/[]/;
print <<ENDOFBODY2;
<tr><td>$count</td>
<td><a href="$ENV{SCRIPT_NAME}?fshow=1&fshowfile=$fshowfile&line=$lnum&db=$db">
<img src=$img{openfile} border=0></a> $file
<a href="$ENV{SCRIPT_NAME}?load=1&file=$fshowfile&db=$db">
<img src=$img{downloadfile} border=0></a>
</td>
<td>$func</td>
<td>$lnum</td>
<td><$frag</td></tr>
ENDOFBODY2
}
$count++;
done:
}
close(CSCOPEIN);
print "</table>\n";
print "<br>Eliminated $trivs_rm line item(s) as trivial functions<p><hr>\n";
unlink $tmpinfile, $tmpoutfile;
}
print &OperationTime;
print &Feedback;
print &HtmlBot;
}
sub DownloadFileForm {
$file = $input{'file'};
print "Content-type: text/c-source\n\n";
open(SHOWFILE, $file);
while (<SHOWFILE>) { print; }
close(SHOWFILE);
}
sub ShowFileForm {
$file = $input{'fshowfile'};
$lnum = $input{'line'};
print &PrintHeader;
print &HtmlTop ("WebCscope");
print "<b>Note</b>: Click <a href=#ref><img src=$img{downfunc} border=0></a> to go to the reference line<p><hr>\n";
print "<hr>";
unlink $showfile;
system("$hiliter $file > $showfile");
open(SHOWFILE, $showfile);
$curline = 1;
while ( <SHOWFILE> ) {
$line = $_;
if ( $curline == $lnum ) {
print "<a name=ref><blink>$line</blink>";
} else {
print $line;
}
$curline++;
}
close (SHOWFILE);
print &OperationTime;
print &Feedback;
print &HtmlBot;
}
sub PrintForm {
chdir $cscopedir;
opendir(DIRLIST,$cscopedir);
@dirlist = readdir(DIRLIST);
closedir(DIRLIST);
@csdirs = ();
for ($i=0; $i <= $#dirlist; $i++ ) {
if ( ($dirlist[$i] ne ".") && ($dirlist[$i] ne "..") && ( -d $dirlist[$i] ) ) {
@csdirs = ( @csdirs, $dirlist[$i] );
}
}
print &PrintHeader;
print &HtmlTop ("Web-CScope");
print <<ENDOFTEXTA;
<p style="color:red">Be aware that this webfrontend is insecure and allows viewing ALL apache readable files, including your configuration!</p>
Select an operation below and enter a symbol, function or text to search in
the database. The active version is $version. Input is case-sensitive,
so if your search returns no results, check the case and the symbol name.<hr>
<form method="get" action="$ENV{SCRIPT_NAME}">
<table border=0 cellpadding=2 cellspacing=2>
<tr>
<td>Operation:</td>
<td>
<select name="op">
ENDOFTEXTA
foreach $opi ( 0 .. $#oper ) {
print "<option value=$opi>$oper[$opi]";
}
print <<ENDOFTEXTB;
</select>
</td>
</tr>
<tr>
<td>CScope Database:</td>
<td>
<select name="db">
<option selected value="all">All Databases
ENDOFTEXTB
for ($i=0; $i <= $#csdirs; $i++) {
print " <option value=\"$csdirs[$i]\">$csdirs[$i]\n";
}
print <<ENDOFTEXT2;
</select>
<tr>
<td>Symbol, function or text:</td>
<td><input name="arg" size=30></td>
</tr>
<tr>
<td></td>
<td halign=center>Show trivial functions:
<input type=radio name="triv" value=1>Yes
<input type=radio name="triv" value=0 checked>No
<br><br>
<input type="submit" value="Scope It!"></td>
</tr>
</table>
<hr>
</form>
ENDOFTEXT2
print &Feedback;
print &HtmlBot;
}
sub Feedback {
$feedback = "<font size=-1>";
$feedback .= '$Id: cscope,v 1.2 2007/01/07 12:34:01 broeker Exp $<br>';
$feedback .= "$comment{name}<i>&lt;";
$feedback .= "<a href=\"mailto:$comment{email}\">";
$feedback .= "$comment{email}</a>&gt;</i></font>";
return $feedback;
}
sub OperationTime {
$deltime = time - $starttime;
return "Operation took $deltime second(s)<br>";
}

View File

@ -0,0 +1,360 @@
/*
CopyRight (C) 1999, Dmitry Obukhov, dso@usa.net
mailto: dso@usa.net
http://www.EmbeddedStuff.com
----------------------------------------------
Last modified 6 Apr 97
----------------------------------------------
Converts C (C++) source to HTML code fragment
with syntax highlighting.
Since program written for personal purpose
the <TABLE> tags generated. This is optional
page format specific thing.
Usage: CTHM <input_file>. All output is done
to STDOUTPUT, error messages to STDERR.
For HTML fragment generation:
CHTM file.c > file.htm
- Some input convertion required to use this
code as CGI module. Will be done soon.
- Optimization required for blocks of EOL
comments
*/
#include <stdio.h>
// ------------------- Decoding status values
#define START 0
#define INLINE 1
#define DEFINE 2
// ------------------- Decoding Remark
#define REM1 20
#define REM2 21
#define REM_END 22
#define REM_STAR 23
#define REM_STAR_1 24
#define STRING 25 // String is "like" remark
// ------------------- HTML TAG Generation
#define ON 1
#define OFF 0
// ------------------- HTML TAG type
#define MODE_KEYWORD 0
#define MODE_REMARK 2
#define MODE_REMARK_EOL 4
#define MODE_DEFINE 6
#define MODE_STRING 8
int is_delimeter(char c)
{
int ii=0;
char dlms[] =
"\t\r\n (){}[]+-*/%\"'&|^~:;<>.,";
//--------------------------------
while (dlms[ii])
{
if (c==dlms[ii++]) return 1;
}
return 0;
}
int is_keyword(char * str)
{
char * kwords[] =
{
"asm", "auto",
"break", "case",
"cdecl", "char",
"class", "const",
"continue", "default",
"delete", "do",
"double", "else",
"enum", "extern",
"far", "float",
"for", "friend",
"goto", "huge",
"if", "inline",
"int", "interrupt",
"long", "near",
"new", "operator",
"pascal", "private",
"protected", "public",
"register", "return",
"short", "signed",
"sizeof", "static",
"struct", "switch",
"template", "this",
"typedef", "union",
"unsigned", "virtual",
"void", "volatile",
"while", NULL
};
int ii=0;
int jj;
int check;
while (kwords[ii])
{
jj = 0;
check = 1;
while (kwords[ii][jj] && check)
{
if (str[jj] != kwords[ii][jj])
{
check = 0;
}
jj++;
}
if (check) return 1;
ii++;
}
return 0;
}
void set_mode(int on_off, int mode)
{
char * tags[] =
{
//-------------------- KEYWORD
"<strong>",
"</strong>",
//-------------------- Classic remarks
"<font color=\"#336600\">",
"</font>",
//-------------------- EOL Remarks
"<font color=\"#336600\">",
"</font>",
//-------------------- #DEFINE
"<font color=\"#663300\"><strong>",
"</strong></font>",
//-------------------- "string"
"<font color=\"#0000CC\">",
"</font>",
NULL, NULL
};
fprintf(stdout,tags[mode + 1 - on_off]);
}
void print_char_html(char c)
{
switch (c)
{
case '<':
fprintf(stdout,"&lt;");
break;
case '>':
fprintf(stdout,"&gt;");
break;
case '"':
fprintf(stdout,"&quot;");
break;
case '&':
fprintf(stdout,"&amp;");
break;
case '|':
fprintf(stdout,"&brvbar;");
break;
default:
fprintf(stdout,"%c",c);
}
}
int main(int _argc, char** _argv)
{
FILE *in, *out;
char c;
int mode;
char buf[80];
int bufidx = 0;
int progress = 1;
int echo;
int saved_mode;
int kw;
char tmpc;
char prevc;
if (_argc < 2)
{
fprintf(stderr,
"USAGE: c2html <file>\n");
return 1;
}
if ((in = fopen(_argv[1], "rt")) == NULL)
{
fprintf(stderr,
"Cannot open input file.\n");
return 1;
}
fprintf(stdout, "<pre>");
mode = START;
while (!feof(in) && progress)
{
echo = 1;
prevc = c;
c = fgetc(in);
if (c=='/' && (mode < REM1))
{
saved_mode = mode;
mode = REM1;
}
switch (mode)
{
case REM1:
echo = 0;
mode = REM2;
break;
case REM2:
if (c=='/')
{
if (saved_mode == DEFINE)
{
set_mode(OFF, MODE_DEFINE);
}
mode = REM_END;
set_mode(ON, MODE_REMARK_EOL);
}
else if (c=='*')
{
if (saved_mode == DEFINE)
{
set_mode(OFF, MODE_DEFINE);
}
mode = REM_STAR;
set_mode(ON, MODE_REMARK);
}
else
{
mode = saved_mode;
}
printf("/");
break;
case REM_END:
if (c=='\n')
{
set_mode(OFF, MODE_REMARK_EOL);
}
break;
case REM_STAR:
if (c=='*')
{
mode = REM_STAR_1;
}
break;
case REM_STAR_1:
if (c=='/')
{
mode = INLINE;
fprintf(stdout,"/");
echo = 0;
set_mode(OFF, MODE_REMARK);
}
else mode = REM_STAR;
break;
case START:
if (c=='#')
{
mode = DEFINE;
set_mode(ON, MODE_DEFINE);
break;
}
else if (c==' ') break;
mode = INLINE;
// and continue in next case
case INLINE:
if (c=='"' && //
prevc != 0x27 && //
prevc != '\\') //
{
set_mode(ON, MODE_STRING);
mode = STRING;
}
break;
case STRING:
if (c=='"' && prevc != '\\')
{
print_char_html('"');
set_mode(OFF, MODE_STRING);
echo = 0;
mode = INLINE;
}
break;
case DEFINE:
if (c=='\n')
{
set_mode(OFF, MODE_DEFINE);
}
break;
}
if (echo && //
(mode == INLINE || //
(mode!=INLINE && //
bufidx))) //
{
buf[bufidx++] = c;
buf[bufidx] = 0;
if (is_delimeter(c))
{
kw = 0;
if (bufidx>2)
{
kw = is_keyword(buf);
}
if (kw)
{
set_mode(ON, MODE_KEYWORD);
}
tmpc = buf[bufidx-1];
buf[bufidx-1] = 0;
fprintf(stdout,"%s",buf);
if (kw)
{
set_mode(OFF, MODE_KEYWORD);
}
print_char_html(tmpc);
bufidx = 0;
buf[0] = 0;
}
}
else if (echo) print_char_html(c);
if (c=='\n' && mode != REM_STAR)
{
mode = START;
}
}
fclose(in);
fprintf(stdout,"</pre>\n");
fprintf(stdout,
"<!-- == Generated by CHTM convertor -->\n");
fprintf(stdout,
"<!-- == CopyRight (C) 1999, Dmitry Obukhov, dso@usa.net -->\n");
return 0;
}

View File

@ -0,0 +1,10 @@
/back.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
/bomb.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
/c.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
/down.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
/folder.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
/folder.open.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
/left.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
/up.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
/world2.gif/1.3/Fri Jun 29 15:58:08 2001/-kb/
D

View File

@ -0,0 +1,9 @@
/back.gif////
/bomb.gif////
/c.gif////
/down.gif////
/folder.gif////
/folder.open.gif////
/left.gif////
/up.gif////
/world2.gif////

View File

@ -0,0 +1 @@
cscope/contrib/webcscope/icons

View File

@ -0,0 +1 @@
:ssh;username=broeker;hostname=cscope.cvs.sourceforge.net:/cvsroot/cscope

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Some files were not shown because too many files have changed in this diff Show More