Skip to content

Commit

Permalink
Merge pull request #348 from miloush/multiple-arguments
Browse files Browse the repository at this point in the history
explicit AllowMultipleArgumentsPerToken on string[] options
  • Loading branch information
tannergooding authored Jun 8, 2022
2 parents 24d5a27 + 3dc2a60 commit 624eed1
Showing 1 changed file with 74 additions and 22 deletions.
96 changes: 74 additions & 22 deletions sources/ClangSharpPInvokeGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class Program
private static Option<string[]> s_withTypeNameValuePairs;
private static Option<string[]> s_withUsingNameValuePairs;


private static readonly TwoColumnHelpRow[] s_configOptions = new TwoColumnHelpRow[]
{
new TwoColumnHelpRow("?, h, help", "Show help and usage information for -c, --config"),
Expand Down Expand Up @@ -878,7 +878,9 @@ private static Option<string[]> GetAdditionalOption()
aliases: new string[] { "--additional", "-a" },
description: "An argument to pass to Clang when parsing the input files.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetConfigOption()
Expand All @@ -887,7 +889,9 @@ private static Option<string[]> GetConfigOption()
aliases: new string[] { "--config", "-c" },
description: "A configuration option that controls how the bindings are generated. Specify 'help' to see the available options.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetDefineMacroOption()
Expand All @@ -896,7 +900,9 @@ private static Option<string[]> GetDefineMacroOption()
aliases: new string[] { "--define-macro", "-D" },
description: "Define <macro> to <value> (or 1 if <value> omitted).",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetExcludeOption()
Expand All @@ -905,7 +911,9 @@ private static Option<string[]> GetExcludeOption()
aliases: new string[] { "--exclude", "-e" },
description: "A declaration name to exclude from binding generation.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetFileOption()
Expand All @@ -914,7 +922,9 @@ private static Option<string[]> GetFileOption()
aliases: new string[] { "--file", "-f" },
description: "A file to parse and generate bindings for.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string> GetFileDirectoryOption()
Expand All @@ -941,7 +951,9 @@ private static Option<string[]> GetIncludeOption()
aliases: new string[] { "--include", "-i" },
description: "A declaration name to include in binding generation.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetIncludeDirectoryOption()
Expand All @@ -950,7 +962,9 @@ private static Option<string[]> GetIncludeDirectoryOption()
aliases: new string[] { "--include-directory", "-I" },
description: "Add directory to include search path.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string> GetLanguageOption()
Expand Down Expand Up @@ -1022,7 +1036,9 @@ private static Option<string[]> GetRemapOption()
aliases: new string[] { "--remap", "-r" },
description: "A declaration name to be remapped to another name during binding generation.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string> GetStdOption()
Expand Down Expand Up @@ -1059,7 +1075,9 @@ private static Option<string[]> GetTraverseOption()
aliases: new string[] { "--traverse", "-t" },
description: "A file name included either directly or indirectly by -f that should be traversed during binding generation.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithAccessSpecifierOption()
Expand All @@ -1068,7 +1086,9 @@ private static Option<string[]> GetWithAccessSpecifierOption()
aliases: new string[] { "--with-access-specifier", "-was" },
description: "An access specifier to be used with the given qualified or remapped declaration name during binding generation.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithAttributeOption()
Expand All @@ -1077,87 +1097,119 @@ private static Option<string[]> GetWithAttributeOption()
aliases: new string[] { "--with-attribute", "-wa" },
description: "An attribute to be added to the given remapped declaration name during binding generation.",
getDefaultValue: Array.Empty<string>
);
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithCallConvOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-callconv", "-wcc" },
description: "A calling convention to be used for the given declaration during binding generation.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithClassOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-class", "-wc" },
description: "A class to be used for the given remapped constant or function declaration name during binding generation.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithLibraryPathOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-librarypath", "-wlb" },
description: "A library path to be used for the given declaration during binding generation.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithManualImportOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-manual-import", "-wmi" },
description: "A remapped function name to be treated as a manual import during binding generation.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithNamespaceOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-namespace", "-wn" },
description: "A namespace to be used for the given remapped declaration name during binding generation.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithSetLastErrorOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-setlasterror", "-wsle" },
description: "Add the SetLastError=true modifier or SetsSystemLastError attribute to a given DllImport or UnmanagedFunctionPointer.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithSuppressGCTransitionOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-suppressgctransition", "-wsgct" },
description: "Add the SuppressGCTransition calling convention to a given DllImport or UnmanagedFunctionPointer.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithTransparentStructOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-transparent-struct", "-wts" },
description: "A remapped type name to be treated as a transparent wrapper during binding generation.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithTypeOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-type", "-wt" },
description: "A type to be used for the given enum declaration during binding generation.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}

private static Option<string[]> GetWithUsingOption()
{
return new Option<string[]>(
aliases: new string[] { "--with-using", "-wu" },
description: "A using directive to be included for the given remapped declaration name during binding generation.",
getDefaultValue: Array.Empty<string>);
getDefaultValue: Array.Empty<string>
) {
AllowMultipleArgumentsPerToken = true
};
}
}
}

0 comments on commit 624eed1

Please sign in to comment.