# argp [v3.0]

Author: Tuncay Last Modified: 20100130

Parse an argument string with options and get keys and values.

argp_getopt(ByRef _args, _keylist="", _case=true, ByRef _1="", ByRef _2="", ByRef _3="", ByRef _4="", ByRef _5="", ByRef _6="", ByRef _7="", ByRef _8="", ByRef _9="", ByRef _10="", ByRef _11="", ByRef _12="", ByRef _13="", ByRef _14="", ByRef _15="", ByRef _16="", ByRef _17="", ByRef _18="", ByRef _19="", ByRef _20="", ByRef _21="", ByRef _22="", ByRef _23="", ByRef _24="", ByRef _25="", ByRef _26="", ByRef _27="", ByRef _28="", ByRef _29="", ByRef _30="", ByRef _31="", ByRef _32="")
argp_parse(ByRef _args, _maxcount=32, ByRef _n1="", ByRef _v1="", ByRef _n2="", ByRef _v2="", ByRef _n3="", ByRef _v3="", ByRef _n4="", ByRef _v4="", ByRef _n5="", ByRef _v5="", ByRef _n6="", ByRef _v6="", ByRef _n7="", ByRef _v7="", ByRef _n8="", ByRef _v8="", ByRef _n9="", ByRef _v9="", ByRef _n10="", ByRef _v10="", ByRef _n11="", ByRef _v11="", ByRef _n12="", ByRef _v12="", ByRef _n13="", ByRef _v13="", ByRef _n14="", ByRef _v14="", ByRef _n15="", ByRef _v15="", ByRef _n16="", ByRef _v16="", ByRef _n17="", ByRef _v17="", ByRef _n18="", ByRef _v18="", ByRef _n19="", ByRef _v19="", ByRef _n20="", ByRef _v20="", ByRef _n21="", ByRef _v21="", ByRef _n22="", ByRef _v22="", ByRef _n23="", ByRef _v23="", ByRef _n24="", ByRef _v24="", ByRef _n25="", ByRef _v25="", ByRef _n26="", ByRef _v26="", ByRef _n27="", ByRef _v27="", ByRef _n28="", ByRef _v28="", ByRef _n29="", ByRef _v29="", ByRef _n30="", ByRef _v30="", ByRef _n31="", ByRef _v31="", ByRef _n32="", ByRef _v32="")

For more details of the functions's parameters and return value, please see it's source code or the document.

#### Remarks

Richard Hauer is the original author of the regular expression, I have modified it:
* http://regexlib.com/REDetails.aspx?regexp_id=1220

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?p=310409

#### License

The functions is an open source item under the GNU LGPL license. For details, please see lgpl-3.0.txt

#### Example

    ; #Include argp.ahk
    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%

    ; This demo shows the two functions working on same options string

    options = -A='33' -i /f:c:\test -time:5:10 -x /date:11:08:2009

    ; Example 1: argp_parse()
    count := argp_parse(options, 8, n1, v1, n2, v2, n3, v3, n4, v4, n5, v5, n6, v6, n7, v7, n8, v8)
    Text =
    (
    Options string:
    %options%

    Number of options in source (options):
    %count%

    Name of key 3 (n3):
    %n3%

    Value of key 3 (v3):
    %v3%
    )
    MsgBox,, argp_parse(), %Text%

    ; Example 1: argp_getopt()
    searchList := "s i test a"
    optlist := argp_getopt(options, searchList, false, v1, v2, v3, v4)
    Text =
    (
    Options string:
    %options%

    Search list:
    %searchList%

    Number of options in source (options):
    %count%

    List of all matching key names (optlist):
    %optlist%

    Value of key 4 from search list (v4, "a" in this example):
    %v4%
    )
    MsgBox,, argp_getopt(), %Text%