this repo has no description
at main 90 lines 2.8 kB view raw
1// MIT License 2 3// Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com 4 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to deal 7// in the Software without restriction, including without limitation the rights 8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9// copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11 12// The above copyright notice and this permission notice shall be included in all 13// copies or substantial portions of the Software. 14 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21// SOFTWARE. 22 23#pragma once 24 25#include "api.h" 26 27struct tic_script 28{ 29 u8 id; 30 const char* name; 31 const char* fileExtension; 32 const char* projectComment; 33 struct 34 { 35 bool(*init)(tic_mem* memory, const char* code); 36 void(*close)(tic_mem* memory); 37 38 tic_tick tick; 39 tic_boot boot; 40 tic_blit_callback callback; 41 }; 42 43 const tic_outline_item* (*getOutline)(const char* code, s32* size); 44 void (*eval)(tic_mem* tic, const char* code); 45 46 const char* blockCommentStart; 47 const char* blockCommentEnd; 48 const char* blockCommentStart2; 49 const char* blockCommentEnd2; 50 const char* blockStringStart; 51 const char* blockStringEnd; 52 const char* stdStringStartEnd; 53 const char* singleComment; 54 const char* blockEnd; 55 56 const char* const *keywords; 57 s32 keywordsCount; 58 59 tic_lang_isalnum lang_isalnum; 60 bool useStructuredEdition; 61 bool useBinarySection; 62 63 s32 api_keywordsCount; 64 const char** api_keywords; 65 66 struct tic_demo 67 { 68 const u8* data; 69 s32 size; 70 const char* name; 71 } demo, mark, *demos; 72 73}; 74 75typedef struct tic_script tic_script; 76 77const tic_script* tic_get_script(tic_mem* memory); 78void tic_add_script(const tic_script* script); 79const tic_script** tic_scripts(); 80 81#define FOREACH_LANG(script) \ 82 for(const tic_script **MACROVAR(it) = tic_scripts(), *script = *MACROVAR(it); *MACROVAR(it); script = *++MACROVAR(it)) 83 84#define SCRIPT_CONFIG ScriptConfig 85 86#if defined(TIC_RUNTIME_STATIC) 87#define EXPORT_SCRIPT(X) CONCAT(X, SCRIPT_CONFIG) 88#else 89#define EXPORT_SCRIPT(X) SCRIPT_CONFIG 90#endif