setmacro c-struct 0 ((struct {) cr (} /* struct */) up up col -7)
setmacro c-proc 2 (freeline first (\$arg1) cr (\$arg2 ()) cr ({) cr (} /* \$arg2 */) adjustline last cr goto -3 last left)
#setmacro c-proc 0 (freeline first (\$type) cr (\$name()) cr ({) cr (} /* \$name */) adjustline last cr goto -3 last left)
# with that macro it is possible to surround a block with
# one of the 2-line c-constructs
# the only things, that are bugs/not supported is that after that call
# the ranges of the block are not set right any more and
# that the block is not tabbed and that we had to insert 1 line, that cannot be deleted
#setmacro surroundblock 1 (ifelse !cb (\$arg1) (while cb down pushdot up while cb up eval (\$arg1) pushmark unblock down block block swapdot down bmove popdot up popmark))
setmacro surroundblock 2 (ifelse !cb (\$arg1) (while cb up down eval (\$arg2) up insline eval (\$arg1) down bmove up))
map s-nk* ((/* */) col -3)
map a-a ((&& ))
map sa-a ((& ))
map sA-a ((void* ))
map a-c (c-case)
map sa-c ((const) cr tab)
map A-c ((char ; ) left )
map a-d ((/ ))
map a-e (c-else)
map sa-e (c-elif)
map A-e ((extern ))
map a-f (c-for)
map A-f ((FALSE))
map a-i (c-if)
map sa-i (surroundblock (first (#if ) spdw (#endif /* */) up col 5) ())
map A-i ((int ;) left)
map a-k (firstnb `/* ' last right `*/')
map sa-k (first findstr (*) next left del del del last prev del del bs firstnb)
map A-l ((long ;) left)
map sA-l ((unsigned long ;) left)
map a-m ((% ))
map a-n ((!))
map A-n ((NULL ))
map sa-n ($getname)
map sA-n ($gettype)
map a-p ($gettype $getname if !vlname (splitlastword type name) first (\$type) cr (\$name()) cr ({) cr (} /* \$name */) adjustline last cr goto -3 last left)
map A-p ((Prototype ))
map sa-r ((return ) if c=32 ((();) col -2))
map A-r ((register ))
map a-s (c-switch)
map A-s (c-struct)
map sA-s ((static ))
map a-t ((typedef) -tab)
map A-t ((TRUE))
map A-v ((void))
map a-w (c-while)
map a-z ((printf("",,0);) col -6)
map help ctags
map s-help ref
#map -return (split down set crline \$lineno up firstnb while r (up firstnb) set crcol \$colno (if c=123 add crcol 4) goto \$crline first ifelse ca
# you should test for , { \ ) ( you do test for {
#map -return (split down set _crl \$lineno prevline firstnb set _crc \$colno ifelse ca (rx ("trace results; if ~(find('\$blockbeginner','\\\$currentword')=0) then 'add _crc 4')) (last left if c=123 (add _crc 4)) goto \$_crl first while x<\$_crc (( ))
set blockbeginner (if else while for switch case FOREVER)
set blockender (else case)
## some c-possibilities are not respected here:
## (it did not disturb me, as I do not use such style too much)
## "if ((...) <cr> (...)) { <cr>" would cause 2 tabs
## "} else { /* bla bla */ <cr>" would cause no tab
## "#if/#ifdef/#endif/..."-lines are not ignored
## "if (...) <cr> state <cr> does not go back to old-insertion */
## (in comments the used formatting is disgusting, too)
setmacro checkblockers 1 (unfail (last left if !ca (add $arg1 \$tabstop if c=123 abort if c=58 abort sub $arg1 \$tabstop) if c=59 abort firstnb if ca (rx ("if find('\$blockbeginner','\$currentword') ~= 0 then 'add $arg1 \$tabstop'"))))
setmacro checkunblockers 1 (firstnb ifelse c=125 (sub $arg1 \$tabstop) (firstnb if ca (rx ("if find('\$blockender','\$currentword') ~= 0 then 'sub $arg1 \$tabstop'"))))