parameters: (proto, defin, name, nd)
docstring: Like C lookup, but the first index is optimized instead.
docstring_summary: Like C lookup, but the first index is optimized instead.
docstring_tokens: Like C lookup but the first index is optimized instead .
function: def buf_lookup_fortran_code(proto, defin, name, nd):
      """
      Like C lookup, but the first index is optimized instead.
      """
      if nd == 1:
          proto.putln("#define %s(type, buf, i0, s0) ((type)buf + i0)" % name)
      else:
          args = ", ".join(["i%d, s%d" % (i, i) for i in range(nd)])
          offset = " + ".join(["i%d * s%d" % (i, i) for i in range(1, nd)])
          proto.putln("#define %s(type, buf, %s) ((type)((char*)buf + %s) + i%d)" % (name, args, offset, 0))
function_tokens: def buf_lookup_fortran_code ( proto , defin , name , nd ) : if nd == 1 : proto . putln ( "#define %s(type, buf, i0, s0) ((type)buf + i0)" % name ) else : args = ", " . join ( [ "i%d, s%d" % ( i , i ) for i in range ( nd ) ] ) offset = " + " . join ( [ "i%d * s%d" % ( i , i ) for i in range ( 1 , nd ) ] ) proto . putln ( "#define %s(type, buf, %s) ((type)((char*)buf + %s) + i%d)" % ( name , args , offset , 0 ) )