"Fossies" - the Fresh Open Source Software Archive

Member "AutoHotkey_L-1.1.33.09/source/script_func_impl.h" (8 May 2021, 2549 Bytes) of package /windows/misc/AutoHotkey_L-1.1.33.09.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "script_func_impl.h" see the Fossies "Dox" file reference documentation.

    1 
    2 #define ParamIndexToString(index, ...)              TokenToString(*aParam[(index)], __VA_ARGS__)
    3 #define ParamIndexToInt64(index)                    TokenToInt64(*aParam[(index)])
    4 #define ParamIndexToInt(index)                      (int)ParamIndexToInt64(index)
    5 #define ParamIndexToIntPtr(index)                   (INT_PTR)ParamIndexToInt64(index)
    6 #define ParamIndexToDouble(index)                   TokenToDouble(*aParam[(index)])
    7 #define ParamIndexToNumber(index, output)           TokenToDoubleOrInt64(*aParam[(index)], output)
    8 #define ParamIndexToBOOL(index)                     TokenToBOOL(*aParam[(index)])
    9 #define ParamIndexToObject(index)                   TokenToObject(*aParam[(index)])
   10 
   11 #define ParamIndexLength(index, param_as_string)    EXPR_TOKEN_LENGTH(aParam[index], param_as_string)
   12 
   13 // For functions that allow "" to mean parameter is omitted.
   14 #define ParamIndexIsOmittedOrEmpty(index)  (ParamIndexIsOmitted(index) || TokenIsEmptyString(*aParam[(index)], TRUE))
   15 
   16 // For functions that don't allow "" to mean parameter is omitted.
   17 #define ParamIndexIsOmitted(index)  ((index) >= aParamCount || aParam[(index)]->symbol == SYM_MISSING)
   18 
   19 #define PASTE(a, b) a##b
   20 
   21 #define ParamIndexToOptionalType(type, index, def)  (ParamIndexIsOmitted(index) ? (def) : PASTE(ParamIndexTo,type)(index))
   22 #define ParamIndexToOptionalInt(index, def)         ParamIndexToOptionalType(Int, index, def)
   23 #define ParamIndexToOptionalIntPtr(index, def)      ParamIndexToOptionalType(IntPtr, index, def)
   24 #define ParamIndexToOptionalDouble(index, def)      ParamIndexToOptionalType(Double, index, def)
   25 #define ParamIndexToOptionalInt64(index, def)       ParamIndexToOptionalType(Int64, index, def)
   26 #define ParamIndexToOptionalVar(index)              (((index) < aParamCount && aParam[index]->symbol == SYM_VAR) ? aParam[index]->var : NULL)
   27 
   28 // The macro below defaults to "", since that is by far the most common default.
   29 // This allows it to skip the check for SYM_MISSING, which always has marker == _T("").
   30 #define ParamIndexToOptionalString(index, ...)      (((index) < aParamCount) ? ParamIndexToString(index, __VA_ARGS__) : _T(""))
   31 
   32 #define ParamIndexToOptionalObject(index)           ((index) < aParamCount ? ParamIndexToObject(index) : NULL)
   33 
   34 #define _f_param_string(name, index, ...) \
   35     TCHAR name##_buf[MAX_NUMBER_SIZE], *name = ParamIndexToString(index, name##_buf, __VA_ARGS__)
   36 #define _f_param_string_opt(name, index, ...) \
   37     TCHAR name##_buf[MAX_NUMBER_SIZE], *name = ParamIndexToOptionalString(index, name##_buf, __VA_ARGS__)
   38 #define _f_param_string_opt_def(name, index, def, ...) \
   39     TCHAR name##_buf[MAX_NUMBER_SIZE], *name = ParamIndexToOptionalStringDef(index, def, name##_buf, __VA_ARGS__)