Lines Matching +full:- +full:s

1 // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
4 // SPDX-License-Identifier: BSD-2-Clause
8 #include <ceed-impl.h>
11 #include <ceed/jit-tools.h>
23 @return An error code: 0 - success, otherwise - failure
34 size_t source_file_path_length = (last_colon - source_file_path + 1); in CeedCheckFilePath()
37 memcpy(source_file_path_only, source_file_path, source_file_path_length - 1); in CeedCheckFilePath()
44 CeedDebug(ceed, "%s\n", source_file_path_only); in CeedCheckFilePath()
54 CeedDebug(ceed, "%s\n", source_file_path_only); in CeedCheckFilePath()
70 @return An error code: 0 - success, otherwise - failure
83 // -- Check for /./ and covert to / in CeedNormalizePath()
84 …t_dot != *normalized_source_file_path && strlen(first_dot) > 2) memcpy(keyword, &first_dot[-1], 3); in CeedNormalizePath()
88 for (CeedInt i = 0; first_dot[i - 1]; i++) first_dot[i] = first_dot[i + 2]; in CeedNormalizePath()
91 // -- Check for /foo/../ and convert to / in CeedNormalizePath()
92 …t_dot != *normalized_source_file_path && strlen(first_dot) > 3) memcpy(keyword, &first_dot[-1], 4); in CeedNormalizePath()
96 char *last_slash = &first_dot[-2]; in CeedNormalizePath()
98 while (last_slash[0] != '/' && last_slash != *normalized_source_file_path) last_slash--; in CeedNormalizePath()
99 …normalized_source_file_path, ceed, CEED_ERROR_MAJOR, "Malformed source path %s", source_file_path); in CeedNormalizePath()
120 @return An error code: 0 - success, otherwise - failure
130 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- Ceed JiT ----------\n"); in CeedLoadSourceToInitializedBuffer()
132 CeedDebug(ceed, "%s\n", source_file_path); in CeedLoadSourceToInitializedBuffer()
136 CeedCheck(source_file, ceed, CEED_ERROR_MAJOR, "Couldn't open source file: %s", source_file_path); in CeedLoadSourceToInitializedBuffer()
137 // -- Compute size of source in CeedLoadSourceToInitializedBuffer()
141 // -- Allocate memory for entire source file in CeedLoadSourceToInitializedBuffer()
149 // -- Copy the file into the buffer in CeedLoadSourceToInitializedBuffer()
154 return CeedError(ceed, CEED_ERROR_MAJOR, "Couldn't read source file: %s", source_file_path); in CeedLoadSourceToInitializedBuffer()
163 // -- Check for 'pragma' keyword in CeedLoadSourceToInitializedBuffer()
167 if (next_m && next_m - first_hash >= 5) memcpy(keyword, &next_m[-4], 6); in CeedLoadSourceToInitializedBuffer()
170 // ---- Spaces allowed in '# pragma' in CeedLoadSourceToInitializedBuffer()
172 for (CeedInt i = 1; first_hash - next_m + i < -5; i++) { in CeedLoadSourceToInitializedBuffer()
177 // -- Check if '#pragma once' in CeedLoadSourceToInitializedBuffer()
180 bool is_pragma_once = next_o && (next_new_line - next_o > 0) && !strncmp(next_o, "once", 4); in CeedLoadSourceToInitializedBuffer()
182 // -- Copy into buffer, omitting last line if #pragma once in CeedLoadSourceToInitializedBuffer()
184 …long copy_size = first_hash - &temp_buffer[file_offset] + (is_pragma_once ? 0 : (next_new_line in CeedLoadSourceToInitializedBuffer()
191 file_offset = strchr(first_hash, '\n') - temp_buffer + 1; in CeedLoadSourceToInitializedBuffer()
194 // -- Check for 'include' keyword in CeedLoadSourceToInitializedBuffer()
197 if (next_e && next_e - first_hash >= 7) memcpy(keyword, &next_e[-6], 7); in CeedLoadSourceToInitializedBuffer()
200 // ---- Spaces allowed in '# include <header.h>' in CeedLoadSourceToInitializedBuffer()
202 for (CeedInt i = 1; first_hash - next_e + i < -6; i++) { in CeedLoadSourceToInitializedBuffer()
207 // -- Copy into buffer all preceding # in CeedLoadSourceToInitializedBuffer()
209 long copy_size = first_hash - &temp_buffer[file_offset]; in CeedLoadSourceToInitializedBuffer()
215 // -- Load local "header.h" in CeedLoadSourceToInitializedBuffer()
218 bool is_local_header = is_hash_include && next_quote && (next_new_line - next_quote > 0); in CeedLoadSourceToInitializedBuffer()
220 bool is_ceed_header = next_left_chevron && (next_new_line - next_left_chevron > 0) && in CeedLoadSourceToInitializedBuffer()
221 …(!strncmp(next_left_chevron, "<ceed/jit-source/", 17) || !strncmp(next_left_chevron, "<ceed/types.… in CeedLoadSourceToInitializedBuffer()
222 …!strncmp(next_left_chevron, "<ceed/ceed-f32.h>", 17) || !strncmp(next_left_chevron, "<ceed/ceed-f6… in CeedLoadSourceToInitializedBuffer()
224 next_left_chevron && (next_new_line - next_left_chevron > 0) && in CeedLoadSourceToInitializedBuffer()
228 // ---- Build source path in CeedLoadSourceToInitializedBuffer()
233 long root_length = strrchr(source_file_path, '/') - source_file_path; in CeedLoadSourceToInitializedBuffer()
234 long include_file_name_len = strchr(&next_quote[1], '"') - next_quote - 1; in CeedLoadSourceToInitializedBuffer()
243 long ceed_relative_path_length = next_right_chevron - next_left_chevron - 1; in CeedLoadSourceToInitializedBuffer()
250 // ---- Recursive call to load source to buffer in CeedLoadSourceToInitializedBuffer()
256 …CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "JiT Including: %s\n", normalized_include_source_path… in CeedLoadSourceToInitializedBuffer()
265 long header_copy_size = next_new_line - first_hash + 1; in CeedLoadSourceToInitializedBuffer()
272 file_offset = strchr(first_hash, '\n') - temp_buffer + 1; in CeedLoadSourceToInitializedBuffer()
274 // -- Next hash in CeedLoadSourceToInitializedBuffer()
290 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- Ceed JiT ----------\n"); in CeedLoadSourceToInitializedBuffer()
292 CeedDebug(ceed, "%s\n", source_file_path); in CeedLoadSourceToInitializedBuffer()
294 CeedDebug(ceed, "%s\n", *buffer); in CeedLoadSourceToInitializedBuffer()
309 @return An error code: 0 - success, otherwise - failure
335 @return An error code: 0 - success, otherwise - failure
364 @return An error code: 0 - success, otherwise - failure
370 …size_t base_length = (last_slash - base_file_path + 1), relative_length = strlen(relative_file_pat… in CeedPathConcatenate()
385 @return An error code: 0 - success, otherwise - failure
390 *(relative_file_path) = strstr(absolute_file_path, "ceed/jit-source"); in CeedGetJitRelativePath()
391 …, CEED_ERROR_MAJOR, "Couldn't find relative path including 'ceed/jit-source' for: %s", absolute_fi… in CeedGetJitRelativePath()
402 @return An error code: 0 - success, otherwise - failure
411 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- Ceed JiT ----------\n"); in CeedGetJitAbsolutePath()
413 CeedDebug(ceed, "%s\n", relative_file_path); in CeedGetJitAbsolutePath()
421 CeedDebug(ceed, "%s\n", jit_source_dirs[i]); in CeedGetJitAbsolutePath()
437 …return CeedError(ceed, CEED_ERROR_MAJOR, "Couldn't find matching JiT source file: %s", relative_fi… in CeedGetJitAbsolutePath()