mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
s4:scripting: Generate HRESULT definitions as part of the build process
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
2e82159d0f
commit
cce290e8f5
@ -1,4 +1,4 @@
|
||||
[codespell]
|
||||
skip = ./.git,./bin,./docs-xml/archives,./docs-xml/manpages/vfs_fruit.8.xml,./docs-xml/smbdotconf/browse/preferredmaster.xml,./lib/ldb/ldb_sqlite3/trees.ps,./libcli/util/ntstatus.h,./libcli/util/hresult.c,./python/samba/tests/blackbox/testdata,./source3/include/MacExtensions.h,./source3/selftest/ktest-krb5_ccache-2.txt,./source4/setup/display-specifiers,./source4/ldap_server/devdocs,./source4/selftest/provisions,./source4/setup/adprep/WindowsServerDocs,./source4/setup/display-specifiers,./source4/torture/vfs/fruit.c,./testdata,./third_party,*.IBM-DS,*.config,*.diff,*.dump,*.ldif,*.ldf,*.pdml,*.pem,*.po,*.schema
|
||||
skip = ./.git,./bin,./docs-xml/archives,./docs-xml/manpages/vfs_fruit.8.xml,./docs-xml/smbdotconf/browse/preferredmaster.xml,./lib/ldb/ldb_sqlite3/trees.ps,./libcli/util/hresult_err_table.txt,./python/samba/tests/blackbox/testdata,./source3/include/MacExtensions.h,./source3/selftest/ktest-krb5_ccache-2.txt,./source4/setup/display-specifiers,./source4/ldap_server/devdocs,./source4/selftest/provisions,./source4/setup/adprep/WindowsServerDocs,./source4/setup/display-specifiers,./source4/torture/vfs/fruit.c,./testdata,./third_party,*.IBM-DS,*.config,*.diff,*.dump,*.ldif,*.ldf,*.pdml,*.pem,*.po,*.schema
|
||||
ignore-regex = \\[t]
|
||||
ignore-words = .codespellignore
|
||||
|
14706
libcli/util/hresult.c
14706
libcli/util/hresult.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
20520
libcli/util/hresult_err_table.txt
Normal file
20520
libcli/util/hresult_err_table.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,13 @@ bld.SAMBA_LIBRARY('samba-errors',
|
||||
vnum='1.0.0',
|
||||
)
|
||||
|
||||
bld.SAMBA_GENERATOR('hresult_generated',
|
||||
source='../../source4/scripting/bin/gen_hresult.py hresult_err_table.txt ../../source4/scripting/bin/gen_error_common.py',
|
||||
target='hresult.h hresult.c',
|
||||
group='build_source',
|
||||
rule='${PYTHON} ${SRC[0].abspath(env)} ${SRC[1].abspath(env)} ${TGT[0].abspath(env)} ${TGT[1].abspath(env)}'
|
||||
)
|
||||
|
||||
bld.SAMBA_GENERATOR('ntstatus_generated',
|
||||
source='../../source4/scripting/bin/gen_ntstatus.py ntstatus_err_table.txt ../../source4/scripting/bin/gen_error_common.py',
|
||||
target='ntstatus_gen.h nterr_gen.c py_ntstatus.c',
|
||||
|
@ -5,7 +5,6 @@ samba.tests.usage.samba.tests.usage.PythonScriptHelpTests.test_config_base.none.
|
||||
samba.tests.usage.samba.tests.usage.PythonScriptHelpTests.test_ctdb_etcd_lock.none.
|
||||
samba.tests.usage.samba.tests.usage.PythonScriptHelpTests.test_depfilter_py.none.
|
||||
samba.tests.usage.samba.tests.usage.PythonScriptHelpTests.test_dns_hub_py.none.
|
||||
samba.tests.usage.samba.tests.usage.PythonScriptHelpTests.test_gen_hresult_py.none.
|
||||
samba.tests.usage.samba.tests.usage.PythonScriptHelpTests.test_run_py.none.
|
||||
samba.tests.usage.samba.tests.usage.PythonScriptHelpTests.test_run_py_.none.
|
||||
samba.tests.usage.samba.tests.usage.PythonScriptHelpTests.test_smbstatus.none.
|
||||
|
@ -148,29 +148,33 @@ def transformErrorName(error_name):
|
||||
return "HRES_" + error_name
|
||||
|
||||
# Very simple script to generate files hresult.c & hresult.h
|
||||
# The script simply takes a text file as input, format of input file is
|
||||
# very simple and is just the content of a html table ( such as that found
|
||||
# in http://msdn.microsoft.com/en-us/library/cc704587.aspx ) copied and
|
||||
# pasted into a text file
|
||||
# This script takes three inputs:
|
||||
# [1]: The name of the text file which is the content of an HTML table
|
||||
# (such as that found at https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/705fb797-2175-4a90-b5a3-3918024b10b8)
|
||||
# copied and pasted.
|
||||
# [2]: The name of the output generated header file with HResult #defines
|
||||
# [3]: The name of the output generated source file with C arrays
|
||||
|
||||
def main ():
|
||||
input_file1 = None
|
||||
filename = "hresult"
|
||||
headerfile_name = filename + ".h"
|
||||
sourcefile_name = filename + ".c"
|
||||
if len(sys.argv) > 1:
|
||||
|
||||
if len(sys.argv) == 4:
|
||||
input_file1 = sys.argv[1]
|
||||
gen_headerfile_name = sys.argv[2]
|
||||
gen_sourcefile_name = sys.argv[3]
|
||||
else:
|
||||
print("usage: %s winerrorfile"%(sys.argv[0]))
|
||||
print("usage: %s winerrorfile headerfile sourcefile"%(sys.argv[0]))
|
||||
sys.exit()
|
||||
|
||||
# read in the data
|
||||
with open(input_file1) as file_contents:
|
||||
errors = parseErrorDescriptions(file_contents, False, transformErrorName)
|
||||
|
||||
with open(headerfile_name,"w") as out_file:
|
||||
print(f"writing new header file: {gen_headerfile_name}")
|
||||
with open(gen_headerfile_name,"w") as out_file:
|
||||
generateHeaderFile(out_file, errors)
|
||||
with open(sourcefile_name,"w") as out_file:
|
||||
print(f"writing new source file: {gen_sourcefile_name}")
|
||||
with open(gen_sourcefile_name,"w") as out_file:
|
||||
generateSourceFile(out_file, errors)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user