# Pre-processor. bsnip("inc", r"""#include 'Header.h'""", r""" #include "${1:`!p res=re.sub(r'\.[^.]+$', '', fn)+'.h'`}" """) bsnip("Inc", "#include <Header.h>", r""" #include <${1:.h}> """) # Standard data types. # int8_t, uint8_t, and friends. for width in [8, 16, 32, 64]: t = "%d" % width t_t = t + "_t" wabbr("i" + t, "int" + t_t) wabbr("ui" + t, "uint" + t_t, aliases=[t]) wabbr("st", "size_t") wabbr("sst", "ssize_t") wabbr("un", "unsigned") # Doxygen. babbr("@param", "@param[in] ${1:inParam} ${0:@todo Description of $1.}", aliases=["@p", "@pi"]) babbr("@po", "@param[out] ${1:outParam} ${0:@todo Description of $1.}") babbr("@pio", "@param[in,out] ${1:inOutParam} ${0:@todo Description of $1.}") babbr("@b", "@brief ${0:Description.}") babbr("@return", "@return ", aliases=["@re", "@ret"]) bsnip("@retval", "@retval value, Description", r""" @retval ${1:returnValue}
"if clk'event and clk = '1' then ... end if;", r""" if clk'event and clk = '1' then $0 end if; """, ) bsnip( "else", "else ...", r""" else $0 """, aliases=["el"], ) bsnip( "elsif", "elsif ... {...}", r""" elsif $1 $0 """, aliases=["ei"], ) # Primitive types. wabbr("slv", "STD_LOGIC_VECTOR ")
"eib", "else _ifBool", """ else _ifBool $0 """, aliases=[], ) wsnip( "inb", "_ifNotBool ... endif", """ _ifNotBool $0 endif """, aliases=[], ) wsnip( "einb", "else _ifNotBool", """ else _ifNotBool $0 """, aliases=[], ) wabbr("t", "$(true)") wabbr("f", "$(false)") wabbr("e", "$(empty)")
put(r""" global !p from sniputil import betterVisual endglobal """) bsnip("docstring", "docstring for func or type", r""" /** * ${1:Brief description.} * * ${0:Full description.} */ """, flags="b", aliases=["doc", "/**"]) # Javadoc. wabbr("@param", "@param ${1:inParam} ${0:@todo Description of $1.}", aliases=["@p", "@pi", "@po", "@pio"]) wabbr("@return", "@return ", aliases=["@re", "@ret", "@retval", "@rv"]) wabbr("todo", "/** @todo ${1:Description of what's TO DO.} */") wabbr("bug", "/** @bug ${1:Description of BUG.} */") bsnip("pl", "System.out.println()", r""" System.out.println($1); """, flags="b") put(r""" snippet printf "printf('...', ...);" w System.out.printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/} endsnippet snippet pf "printf('...', ...);" w System.out.printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/}
# Snippets are now cleared in "clearsnippets" directory. #put("clearsnippets\n") # 'if' snippets. bsnip("if", "if ... then ... end if;", r""" if $1 then $0 end if; """) bsnip("ifclk", "if clk'event and clk = '1' then ... end if;", r""" if clk'event and clk = '1' then $0 end if; """) bsnip("else", "else ...", r""" else $0 """, aliases=["el"]) bsnip("elsif", "elsif ... {...}", r""" elsif $1 $0 """, aliases = ["ei"]) # Primitive types. wabbr("slv", "STD_LOGIC_VECTOR ")
wsnip("if", "$(if $1,$0)",""" $(if $1,$0) """, aliases=[]) bsnip("ife", "ifeq '$1' $'2' ... endif",""" ifeq '$1' '$2' $0 endif """, aliases=["ifeq"]) bsnip("ifn", "ifneq '$1' $'2' ... endif",""" ifneq '$1' '$2' $0 endif """, aliases=["ifne", "ifneq"]) bsnip("ei", "else ifeq '$1' $'2' ... endif",""" else ifeq '$1' '$2' $0 """, aliases=["eie", "eieq"]) bsnip("ein", "else ifenq '$1' $'2' ... endif",""" else ifneq '$1' '$2' $0 """, aliases=["eine", "eineq"]) wabbr("t","$(true)") wabbr("f","$(false)") wabbr("e","$(empty)")
# Pre-processor. bsnip("inc", r"""#include 'Header.h'""", r""" #include "${1:`!p res=re.sub(r'\.[^.]+$', '', fn)+'.h'`}" """) bsnip("Inc", "#include <Header.h>", r""" #include <${1:.h}> """) # Standard data types. # int8_t, uint8_t, and friends. for width in [8, 16, 32, 64]: t = "%d" % width t_t = t + "_t" wabbr("i" + t, "int" + t_t) wabbr("ui" + t, "uint" + t_t, aliases=[t]) wabbr("st", "size_t") wabbr("sst", "ssize_t") wabbr("un", "unsigned") wabbr("uc", "unsigned char") # Doxygen. babbr("@param", "@param[in] ${1:inParam} ${0:@todo Description of $1.}", aliases=["@p", "@pi"]) babbr("@po", "@param[out] ${1:outParam} ${0:@todo Description of $1.}") babbr("@pio", "@param[in,out] ${1:inOutParam} ${0:@todo Description of $1.}") babbr("@b", "@brief ${0:Description.}") babbr("@return", "@return ", aliases=["@re", "@ret"]) bsnip("@retval", "@retval value, Description", r"""
# Pre-processor. bsnip("inc", r"""#include 'Header.h'""", r""" #include "${1:`!p res=re.sub(r'\.[^.]+$', '', fn)+'.h'`}" """) bsnip("Inc", "#include <Header.h>", r""" #include <${1:.h}> """) # Standard data types. # int8_t, uint8_t, and friends. for width in [8, 16, 32, 64]: t = "%d" % width t_t = t + "_t" wabbr("i" + t, "int" + t_t) wabbr("ui" + t, "uint" + t_t, aliases=[t]) # Doxygen. babbr("@param", "@param[in] ${1:inParam} ${0:@todo Description of $1.}", aliases=["@p", "@pi"]) babbr("@po", "@param[out] ${1:outParam} ${0:@todo Description of $1.}") babbr("@pio", "@param[in,out] ${1:inOutParam} ${0:@todo Description of $1.}") babbr("@b", "@brief ${0:Description.}") babbr("@return", "@return ", aliases=["@re", "@ret"]) bsnip("@retval", "@retval value, Description", r""" @retval ${1:returnValue} ${0:Reason to return $1.}