// Platform API
-// Opcode API
-
-/// @brief Populate the Opcode table
-///
-/// @param[out] pOpcodeTable table to be populated
-///
-/// @return result code
-spv_result_t spvOpcodeTableGet(spv_opcode_table* pOpcodeTable);
-
-/// @brief Populate the operand table
-///
-/// @param[in] pOperandTable table to be populated
-///
-/// @return result code
-spv_result_t spvOperandTableGet(spv_operand_table* pOperandTable);
-
-/// @brief Populate the extended instruction table
-///
-/// @param pTable table to be populated
-///
-/// @return result code
-spv_result_t spvExtInstTableGet(spv_ext_inst_table* pTable);
-
-// Text API
-
-/// @brief Entry point to covert text form to binary form
-///
-/// @param[in] text input text
-/// @param[in] length of the input text
-/// @param[out] pBinary the binary module
-/// @param[out] pDiagnostic contains diagnostic on failure
-///
-/// @return result code
+// Encodes the given SPIR-V assembly text to its binary representation. The
+// length parameter specifies the number of bytes for text. Encoded binary will
+// be stored into *binary. Any error will be written into *diagnostic.
spv_result_t spvTextToBinary(const char* text, const size_t length,
- spv_binary* pBinary, spv_diagnostic* pDiagnostic);
+ spv_binary* binary, spv_diagnostic* diagnostic);
-/// @brief Free an allocated text stream
-///
-/// This is a no-op if the text parameter is a null pointer.
-///
-/// @param text the text object to be destored
+// @brief Frees an allocated text stream. This is a no-op if the text parameter
+// is a null pointer.
void spvTextDestroy(spv_text text);
-// Binary API
-
-/// @brief Entry point to convert binary to text form
-///
-/// @param[in] binary the input binary
-/// @param[in] wordCount the number of input words
-/// @param[in] options bitfield of spv_binary_to_text_options_t values
-/// @param[out] pText the textual form
-/// @param[out] pDiagnostic contains diagnostic on failure
-///
-/// @return result code
-spv_result_t spvBinaryToText(const uint32_t* binary, const size_t wordCount,
- const uint32_t options, spv_text* pText,
- spv_diagnostic* pDiagnostic);
-
-/// @brief Free a binary stream from memory.
-///
-/// This is a no-op if binary is a null pointer.
-///
-/// @param binary stream to destroy
-void spvBinaryDestroy(spv_binary binary);
+// Decodes the given SPIR-V binary representation to its assembly text. The
+// word_count parameter specifies the number of words for binary. The options
+// parameter is a bit field of spv_binary_to_text_options_t. Decoded text will
+// be stored into *text. Any error will be written into *diagnostic.
+spv_result_t spvBinaryToText(const uint32_t* binary, const size_t word_count,
+ const uint32_t options, spv_text* text,
+ spv_diagnostic* diagnostic);
-// Validation API
+// Frees a binary stream from memory. This is a no-op if binary is a null
+// pointer.
+void spvBinaryDestroy(spv_binary binary);
-/// @brief Validate a SPIR-V binary for correctness
-///
-/// @param[in] binary the input binary stream
-/// @param[in] options bitfield of spv_validation_options_t
-/// @param[out] pDiagnostic contains diagnostic on failure
-///
-/// @return result code
+// Validates a SPIR-V binary for correctness. The options parameter is a bit
+// field of spv_validation_options_t.
spv_result_t spvValidate(const spv_const_binary binary, const uint32_t options,
spv_diagnostic* pDiagnostic);
-// Diagnostic API
-
-/// @brief Create a diagnostic object
-///
-/// @param position position in the text or binary stream
-/// @param message error message to display, is copied
-///
-/// @return the diagnostic object
+// Creates a diagnostic object. The position parameter specifies the location in
+// the text/binary stream. The message parameter, copied into the diagnostic
+// object, contains the error message to display.
spv_diagnostic spvDiagnosticCreate(const spv_position position,
const char* message);
-/// @brief Destroy a diagnostic object
-///
-/// @param diagnostic object to destory
+/// Destroys a diagnostic object.
void spvDiagnosticDestroy(spv_diagnostic diagnostic);
-/// @brief Print the diagnostic to stderr
-///
-/// @param[in] diagnostic to print
-///
-/// @return result code
+// Prints the diagnostic to stderr.
spv_result_t spvDiagnosticPrint(const spv_diagnostic diagnostic);
#ifdef __cplusplus
--- /dev/null
+// Copyright (c) 2015 The Khronos Group Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and/or associated documentation files (the
+// "Materials"), to deal in the Materials without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Materials, and to
+// permit persons to whom the Materials are furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Materials.
+//
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+// https://www.khronos.org/registry/
+//
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+#ifndef LIBSPIRV_TABLE_H_
+#define LIBSPIRV_TABLE_H_
+
+#include <libspirv/libspirv.h>
+
+/// @brief Populate the Opcode table
+///
+/// @param[out] pOpcodeTable table to be populated
+///
+/// @return result code
+spv_result_t spvOpcodeTableGet(spv_opcode_table* pOpcodeTable);
+
+/// @brief Populate the operand table
+///
+/// @param[in] pOperandTable table to be populated
+///
+/// @return result code
+spv_result_t spvOperandTableGet(spv_operand_table* pOperandTable);
+
+/// @brief Populate the extended instruction table
+///
+/// @param pTable table to be populated
+///
+/// @return result code
+spv_result_t spvExtInstTableGet(spv_ext_inst_table* pTable);
+
+#endif // LIBSPIRV_TABLE_H_