Created
August 13, 2015 21:32
-
-
Save ischwabacher/405afb86e28282946cc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby translation of complex string interpolation example | |
# This file displays proper syntax highlighting in vim; other | |
# editors may or may not be able to handle the nested interpolations. | |
puts <<CODE | |
static char #{entry.doc_cname}[] = "#{ | |
split_string_literal(escape_bytestring(docstr))}"; | |
#{ # nested! | |
entry.is_special ? <<IFDEF : '' | |
#if CYTHON_COMPILING_IN_CPYTHON | |
struct wrapperbase #{entry.wrapperbase_cname}; | |
#endif | |
IFDEF | |
} | |
#{["...", naming.args_cname].let do |temp, argn| | |
<<LOOP | |
for (#{temp}=0; #{temp}<PyTuple_GET_SIZE(#{argn}); #{temp}++) { | |
PyObject *item = PyTuple_GET_ITEM(#{argn}, #{temp}); | |
} | |
LOOP | |
end} | |
#{self.starstar_arg.entry.cname} = | |
(#{naming.kwds_cname}) ? PyDict_Copy(#{naming.kwds_cname}) | |
: PyDict_New(); | |
if (unlikely(!#{self.starstar_arg.entry.cname})) return #{self.error_value()}; | |
CODE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment