Dejan Mircevski | b6fe02f | 2016-01-07 13:44:22 -0500 | [diff] [blame] | 1 | // Copyright (c) 2015-2016 The Khronos Group Inc. |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 2 | // |
David Neto | 9fc8658 | 2016-09-01 15:33:59 -0400 | [diff] [blame] | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 6 | // |
David Neto | 9fc8658 | 2016-09-01 15:33:59 -0400 | [diff] [blame] | 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 8 | // |
David Neto | 9fc8658 | 2016-09-01 15:33:59 -0400 | [diff] [blame] | 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 14 | |
dan sinclair | 58a6876 | 2018-08-03 08:05:33 -0400 | [diff] [blame] | 15 | #ifndef SOURCE_BINARY_H_ |
| 16 | #define SOURCE_BINARY_H_ |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 17 | |
David Neto | 5a70335 | 2016-02-17 14:44:00 -0500 | [diff] [blame] | 18 | #include "spirv-tools/libspirv.h" |
Umar Arshad | fd965c9 | 2016-08-06 13:25:02 -0400 | [diff] [blame] | 19 | #include "spirv_definition.h" |
David Neto | 0ca6b59 | 2015-10-30 16:06:15 -0400 | [diff] [blame] | 20 | |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 21 | // Functions |
| 22 | |
Lei Zhang | af9906e | 2015-11-16 10:48:43 -0500 | [diff] [blame] | 23 | // Grabs the header from the SPIR-V module given in the binary parameter. The |
| 24 | // endian parameter specifies the endianness of the binary module. On success, |
| 25 | // returns SPV_SUCCESS and writes the parsed header into *header. |
Andrew Woloszyn | 55ecc2e | 2015-11-11 11:05:07 -0500 | [diff] [blame] | 26 | spv_result_t spvBinaryHeaderGet(const spv_const_binary binary, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 27 | const spv_endianness_t endian, |
Lei Zhang | af9906e | 2015-11-16 10:48:43 -0500 | [diff] [blame] | 28 | spv_header_t* header); |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 29 | |
David Neto | 37422e9 | 2016-12-19 13:26:42 -0500 | [diff] [blame] | 30 | // Returns the number of non-null characters in str before the first null |
| 31 | // character, or strsz if there is no null character. Examines at most the |
| 32 | // first strsz characters in str. Returns 0 if str is nullptr. This is a |
| 33 | // replacement for C11's strnlen_s which might not exist in all environments. |
| 34 | size_t spv_strnlen_s(const char* str, size_t strsz); |
| 35 | |
dan sinclair | 58a6876 | 2018-08-03 08:05:33 -0400 | [diff] [blame] | 36 | #endif // SOURCE_BINARY_H_ |