Exemple #1
0
def test_extensions(gldir, command):
  # See if removing an extension gives us a real entry
  for extension in extensions:
    if command[-len(extension):] == extension:
      command_file = shared.find_command_file(gldir, command[0:-len(extension)])
      if not command_file == False:
        return command[0:-len(extension)]
        
  return ""
Exemple #2
0
def test_extensions(gldir, command):
    # See if removing an extension gives us a real entry
    for extension in extensions:
        if command[-len(extension):] == extension:
            command_file = shared.find_command_file(gldir,
                                                    command[0:-len(extension)])
            if not command_file == False:
                return command[0:-len(extension)]

    return ""
Exemple #3
0
      if major_version[:2] == 'gl':
        command_versions += "<a " + link_class + " href='../" + major_version + "/" + command + "'>OpenGL " + major_version[2] + "</a><br />"
      elif major_version[:2] == 'es':
        command_versions += "<a " + link_class + " href='../" + major_version + "/" + command + "'>OpenGL ES " + major_version[2] + "</a><br />"
      
    header_for_command = header_for_command.replace("{$command_versions}", command_versions)
    header_for_command = header_for_command.replace("{$command}", command)
    
    improvepage = "Think you can improve this page? <a href='https://github.com/BSVino/docs.gl/blob/master/" + version + "/" + command + ".xhtml'>Edit this page</a> on <a href='https://github.com/BSVino/docs.gl/'>GitHub</a>."
    footer_for_command = footer_for_command.replace("{$improvepage}", improvepage)

    version_dir = version
    
    create_directory(output_dir + version_dir)

    command_file = shared.find_command_file(version, command)
    if command_file == False:
      raise IOError("Couldn't find page for command " + command + " (" + version + ")")

    fp = open(command_file)
    command_html = fp.read()
    fp.close()
    
    if args.buildmode == 'full':
      command_html = command_html.decode('utf8')

    command_html = command_html.replace("{$pipelinestall}", "")
    
    examples_html = ""
    if command in opengl.example_functions:
      examples = "<div class='refsect1' id='examples'><h2>Examples</h2>"
Exemple #4
0
      if major_version[:2] == 'gl':
        command_versions += "<a " + link_class + " href='../" + major_version + "/" + command + "'>OpenGL " + major_version[2] + "</a><br />"
      elif major_version[:2] == 'es':
        command_versions += "<a " + link_class + " href='../" + major_version + "/" + command + "'>OpenGL ES " + major_version[2] + "</a><br />"
      
    header_for_command = header_for_command.replace("{$command_versions}", command_versions)
    header_for_command = header_for_command.replace("{$command}", command)
    
    improvepage = "Think you can improve this page? <a href='https://github.com/BSVino/docs.gl/blob/master/" + version + "/" + command + ".xhtml'>Edit this page</a> on <a href='https://github.com/BSVino/docs.gl/'>GitHub</a>."
    footer_for_command = footer_for_command.replace("{$improvepage}", improvepage)

    version_dir = version
    
    create_directory(output_dir + version_dir)

    command_file = shared.find_command_file(version, command)
    if command_file == False:
      raise IOError("Couldn't find page for command " + command + " (" + version + ")")

    fp = open(command_file)
    command_html = fp.read()
    fp.close()
    
    if args.buildmode == 'full':
      command_html = command_html.decode('utf8')

    command_html = command_html.replace("{$pipelinestall}", "")
    
    examples_html = ""
    if command in opengl.example_functions:
      examples = "<div class='refsect1' id='examples'><h2>Examples</h2>"
Exemple #5
0
def test_replacements(gldir, command):
  command_docs = test_extensions(gldir, command)

  if (len(command_docs)):
    return command_docs
  
  # Some commands need just a single letter removed
  command_test = command.replace("I", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("L", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("Getn", "Get")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  if command_test != command:
    test = test_extensions(gldir, command_test)
    if len(test):
      return test

  command_test = command.replace("Readn", "Read")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  # Named commands are stored under their non-named equivalents
  command_test = command.replace("NamedFramebuffer", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("NamedFramebuffer", "Buffer")
  if command_test != command:
    test = test_extensions(gldir, command_test)
    if len(test):
      return test

  command_test = command.replace("Named", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  if command_test != command:
    test = test_extensions(gldir, command_test)
    if len(test):
      return test

  command_test = command.replace("Named", "").replace("Data", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("Named", "").replace("SubData", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("Texture", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("ArrayAttrib", "AttribArray")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("VertexArray", "Bind")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("Array", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("ArrayAttribI", "Attrib")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  command_test = command.replace("ArrayAttribL", "Attrib")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  # For glTextureBuffer -> glTexBuffer and glTextureBufferRange -> glTexBufferRange
  command_test = command.replace("ture", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  if command_test != command:
    return test_extensions(gldir, command_test)
    
  command_test = command.replace("ByRegion", "")
  if not shared.find_command_file(gldir, command_test) == False:
    return command_test

  return command
Exemple #6
0
            continue
          current_command_list.append(command.attrib['name'])
      elif child.tag == 'remove':
        for command in child:
          if command.tag != 'command':
            continue
          current_command_list.remove(command.attrib['name'])

    output.write("  '" + gl_prefix + feature.attrib['number'] + "': {\n")
    for command in current_command_list:
      gldir = gl_prefix + gl_major_version
      
      command_docs = command
      
      # See if the reference file exists on disk
      if os.path.exists(gldir):
        command_file = shared.find_command_file(gldir, command)
        if command_file == False:
          command_docs = test_replacements(gldir, command)

          command_file = shared.find_command_file(gldir, command_docs)
        if command_file == False:
          print "No command docs file found for " + command + " (" + gl_prefix + gl_major_version + ")"
          output.close()
          assert(false)
        
      output.write("    '" + command + "': '" + command_docs + "',\n")
    output.write("  },\n")
    
output.write("}\n")
output.close()
Exemple #7
0
def test_replacements(gldir, command):
    command_docs = test_extensions(gldir, command)

    if (len(command_docs)):
        return command_docs

    # Some commands need just a single letter removed
    command_test = command.replace("I", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("L", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("Getn", "Get")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    if command_test != command:
        test = test_extensions(gldir, command_test)
        if len(test):
            return test

    command_test = command.replace("Readn", "Read")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    # Named commands are stored under their non-named equivalents
    command_test = command.replace("NamedFramebuffer", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("NamedFramebuffer", "Buffer")
    if command_test != command:
        test = test_extensions(gldir, command_test)
        if len(test):
            return test

    command_test = command.replace("Named", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    if command_test != command:
        test = test_extensions(gldir, command_test)
        if len(test):
            return test

    command_test = command.replace("Named", "").replace("Data", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("Named", "").replace("SubData", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("Texture", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("ArrayAttrib", "AttribArray")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("VertexArray", "Bind")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("Array", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("ArrayAttribI", "Attrib")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    command_test = command.replace("ArrayAttribL", "Attrib")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    # For glTextureBuffer -> glTexBuffer and glTextureBufferRange -> glTexBufferRange
    command_test = command.replace("ture", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    if command_test != command:
        return test_extensions(gldir, command_test)

    command_test = command.replace("ByRegion", "")
    if not shared.find_command_file(gldir, command_test) == False:
        return command_test

    return command
Exemple #8
0
                    current_command_list.append(command.attrib['name'])
            elif child.tag == 'remove':
                for command in child:
                    if command.tag != 'command':
                        continue
                    current_command_list.remove(command.attrib['name'])

        output.write("  '" + gl_prefix + feature.attrib['number'] + "': {\n")
        for command in current_command_list:
            gldir = gl_prefix + gl_major_version

            command_docs = command

            # See if the reference file exists on disk
            if os.path.exists(gldir):
                command_file = shared.find_command_file(gldir, command)
                if command_file == False:
                    command_docs = test_replacements(gldir, command)

                    command_file = shared.find_command_file(
                        gldir, command_docs)
                if command_file == False:
                    print "No command docs file found for " + command + " (" + gl_prefix + gl_major_version + ")"
                    output.close()
                    assert (false)

            output.write("    '" + command + "': '" + command_docs + "',\n")
        output.write("  },\n")

output.write("}\n")
output.close()