1 /* 2 Copyright 1999-2020 ImageMagick Studio LLC, a non-profit organization 3 dedicated to making software imaging solutions freely available. 4 5 You may not use this file except in compliance with the License. You may 6 obtain a copy of the License at 7 8 https://imagemagick.org/script/license.php 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 16 MagickWand convert command-line method. 17 */ 18 #ifndef _SCRIPT_TOKEN_H 19 #define _SCRIPT_TOKEN_H 20 21 #if defined(__cplusplus) || defined(c_plusplus) 22 extern "C" { 23 #endif 24 25 /* Status of the Stream */ 26 typedef enum { 27 TokenStatusOK = 0, 28 TokenStatusEOF, 29 TokenStatusBadQuotes, 30 TokenStatusBinary, 31 TokenStatusMemoryFailed 32 } TokenStatus; 33 34 /* Initial length is MagickPathExtent/64 => 64 (divisor is a power of 4) 35 most tokens are never larger than this, so no need to waste memory! 36 Also no CLI option is larger than about 40 characters! 37 */ 38 #define INITAL_TOKEN_LENGTH 64 39 typedef struct 40 { 41 FILE 42 *stream; /* the file stream we are reading from */ 43 44 MagickBooleanType 45 opened; /* was that stream opened? */ 46 47 char 48 *token; /* array of characters to holding details of he token */ 49 50 size_t 51 length, /* length of token char array */ 52 curr_line, /* current location in script file */ 53 curr_column, 54 token_line, /* start of last token (option or argument) */ 55 token_column; 56 57 TokenStatus 58 status; /* Have we reached EOF? see Token Status */ 59 60 size_t 61 signature; 62 } ScriptTokenInfo; 63 64 65 extern WandExport ScriptTokenInfo 66 *AcquireScriptTokenInfo(const char *), 67 *DestroyScriptTokenInfo(ScriptTokenInfo *); 68 69 extern WandExport MagickBooleanType 70 GetScriptToken(ScriptTokenInfo *); 71 72 #if defined(__cplusplus) || defined(c_plusplus) 73 } 74 #endif 75 76 #endif 77