1 /* 2 DeaDBeeF -- the music player 3 Copyright (C) 2009-2014 Alexey Yakovenko and other contributors 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 18 2. Altered source versions must be plainly marked as such, and must not be 19 misrepresented as being the original software. 20 21 3. This notice may not be removed or altered from any source distribution. 22 */ 23 24 #ifndef __TF_H 25 #define __TF_H 26 27 // compile the input title formatting string into bytecode 28 // script: freeform string with title formatting special characters in it 29 // returns the pointer to compiled bytecode, which must be tf_free'd by the caller. 30 char * 31 tf_compile (const char *script); 32 33 void 34 tf_free (char *code); 35 36 // evaluate the titleformatting script in a given context 37 // ctx: a pointer to ddb_tf_context_t structure initialized by the caller 38 // code: the bytecode data created by tf_compile 39 // out: buffer allocated by the caller, must be big enough to fit the output string 40 // outlen: the size of out buffer 41 // returns -1 on fail, output size on success 42 int 43 tf_eval (ddb_tf_context_t *ctx, const char *code, char *out, int outlen); 44 45 // convert legacy title formatting to the new format, usable with tf_compile 46 void 47 tf_import_legacy (const char *fmt, char *out, int outsize); 48 49 #endif // __TF_H 50