00001 /* 00002 Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization 00003 dedicated to making software imaging solutions freely available. 00004 00005 You may not use this file except in compliance with the License. You may 00006 obtain a copy of the License at 00007 00008 https://imagemagick.org/script/license.php 00009 00010 Unless required by applicable law or agreed to in writing, software 00011 distributed under the License is distributed on an "AS IS" BASIS, 00012 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 See the License for the specific language governing permissions and 00014 limitations under the License. 00015 00016 MagickWand convert command-line method. 00017 */ 00018 #ifndef _SCRIPT_TOKEN_H 00019 #define _SCRIPT_TOKEN_H 00020 00021 #if defined(__cplusplus) || defined(c_plusplus) 00022 extern "C" { 00023 #endif 00024 00025 /* Status of the Stream */ 00026 typedef enum { 00027 TokenStatusOK = 0, 00028 TokenStatusEOF, 00029 TokenStatusBadQuotes, 00030 TokenStatusBinary, 00031 TokenStatusMemoryFailed 00032 } TokenStatus; 00033 00034 /* Initial length is MagickPathExtent/64 => 64 (divisor is a power of 4) 00035 most tokens are never larger than this, so no need to waste memory! 00036 Also no CLI option is larger than about 40 characters! 00037 */ 00038 #define INITAL_TOKEN_LENGTH 64 00039 typedef struct 00040 { 00041 FILE 00042 *stream; /* the file stream we are reading from */ 00043 00044 MagickBooleanType 00045 opened; /* was that stream opened? */ 00046 00047 char 00048 *token; /* array of characters to holding details of he token */ 00049 00050 size_t 00051 length, /* length of token char array */ 00052 curr_line, /* current location in script file */ 00053 curr_column, 00054 token_line, /* start of last token (option or argument) */ 00055 token_column; 00056 00057 TokenStatus 00058 status; /* Have we reached EOF? see Token Status */ 00059 00060 size_t 00061 signature; 00062 } ScriptTokenInfo; 00063 00064 00065 extern WandExport ScriptTokenInfo 00066 *AcquireScriptTokenInfo(const char *), 00067 *DestroyScriptTokenInfo(ScriptTokenInfo *); 00068 00069 extern WandExport MagickBooleanType 00070 GetScriptToken(ScriptTokenInfo *); 00071 00072 #if defined(__cplusplus) || defined(c_plusplus) 00073 } 00074 #endif 00075 00076 #endif