Skip to content

Commit

Permalink
Basic documentation for the core interface
Browse files Browse the repository at this point in the history
Shows usage and inform the user to use the man page.
  • Loading branch information
abelsiqueira committed Aug 4, 2015
1 parent 546a633 commit f82c0e5
Show file tree
Hide file tree
Showing 2 changed files with 951 additions and 5 deletions.
28 changes: 23 additions & 5 deletions interface_script/build_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
s=" "
el='\n'+2*s

def wrap(str):
return el.join(textwrap.wrap(str))
def wrap(str, spc=el):
return spc.join(textwrap.wrap(str))

# Workarounds
ignore_intent = ["ureport", "creport"]
Expand Down Expand Up @@ -160,8 +160,26 @@ def arguments (args, types, intents, dims, use_types = True, use_nlp = False,
return ', '.join(str)


def core_function(name, args, types, dims):
str = ""
def core_function(name, args, types, intents, dims):
if name != "cstats":
help_args = arguments(args, types, [], dims, intent="all",
use_nlp=False, use_types=False, all_ptrs=True, typeset=cutypes)
str = '"""' + name
str += "(" + wrap(help_args, "\n") + ", libname)"
str += "\n\n"
n = max([7] + [len(arg) for arg in args])
for i, arg in enumerate(args):
k = n - len(arg)
d = max([len(dims[i]), 1])
str += " - {}: {}[{}] Array{{{}, {}}}\n".format(arg, " "*k,
intents[i].upper(), cutypes[types[i]], d)
str += " - libname: [IN] ASCIIString\n\n"
str += "This help was generated automatically and still needs\n"
str += "improvement. For more information, run the shell command\n\n"
str += " man cutest_" + name + "\n\n"
str += '"""\n'
else:
str = ""
arg_call = arguments(args, types, [], dims, intent="all",
use_nlp=False, use_types=True, all_ptrs=True, typeset=cutypes)
str += "function "+name+"("+wrap( "{}, libname".format(arg_call))+")\n"
Expand Down Expand Up @@ -256,7 +274,7 @@ def specialized_function(name, args, types, intents, dims, use_nlp = False,
inter_file.write("\n")
for name in names:
args, types, intents, dims = get_function_data(name)
core_file.write(core_function(name, args, types, dims))
core_file.write(core_function(name, args, types, intents, dims))
core_file.write("\n")
for use_nlp in [False, True]:
if use_nlp and name in nlp_ignore:
Expand Down
Loading

0 comments on commit f82c0e5

Please sign in to comment.