stardis-program.h (1735B)
1 /* Copyright (C) 2018-2025 |Méso|Star> (contact@meso-star.com) 2 * 3 * This program is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 3 of the License, or 6 * (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 16 #ifndef STARDIS_PROGRAM_H 17 #define STARDIS_PROGRAM_H 18 19 #include "stardis-app.h" 20 #include "stardis-prog-properties.h" 21 22 #include <rsys/rsys.h> 23 #include <rsys/str.h> 24 25 /* Forward declarations */ 26 struct mem_allocator; 27 28 /* type to store data for libraries involved in programmed descriptions */ 29 struct program { 30 void* prog_data; /* result of the create() call */ 31 struct str name; 32 struct str lib_path; 33 size_t argc; 34 char** argv; 35 /* lib handle and function ptrs */ 36 void* lib_handle; 37 const char* (*get_copyright_notice)(void*); 38 const char* (*get_license_short)(void*); 39 const char* (*get_license_text)(void*); 40 void* (*create)(struct stardis_program_context*, size_t, char**); 41 enum stardis_return_status (*finalize)(void*); 42 void (*release)(void*); 43 }; 44 45 res_T 46 init_program 47 (struct mem_allocator* allocator, 48 struct program** dst); 49 50 void 51 release_program 52 (struct program* program, 53 struct mem_allocator* allocator); 54 55 res_T 56 str_print_program 57 (struct str* str, 58 const struct program* program); 59 60 #endif