qemu/scripts
Markus Armbruster 7b29353fdd qapi: Smarter camel_to_upper() to reduce need for 'prefix'
camel_to_upper() converts its argument from camel case to upper case
with '_' between words.  Used for generated enumeration constant
prefixes.

When some of the words are spelled all caps, where exactly to insert
'_' is guesswork.  camel_to_upper()'s guesses are bad enough in places
to make people override them with a 'prefix' in the schema.

Rewrite it to guess better:

1. Insert '_' after a non-upper case character followed by an upper
   case character:

       OneTwo -> ONE_TWO
       One2Three -> ONE2_THREE

2. Insert '_' before the last upper case character followed by a
   non-upper case character:

       ACRONYMWord -> ACRONYM_Word

   Except at the beginning (as in OneTwo above), or when there is
   already one:

       AbCd -> AB_CD

This changes the default enumeration constant prefix for a number of
enums.  Generated enumeration constants change only where the default
is not overridden with 'prefix'.

The following enumerations without a 'prefix' change:

    enum                            old camel_to_upper()
                                    new camel_to_upper()
    ------------------------------------------------------------------
    DisplayGLMode                   DISPLAYGL_MODE
                                    DISPLAY_GL_MODE
    EbpfProgramID                   EBPF_PROGRAMID
                                    EBPF_PROGRAM_ID
    HmatLBDataType                  HMATLB_DATA_TYPE
                                    HMAT_LB_DATA_TYPE
    HmatLBMemoryHierarchy           HMATLB_MEMORY_HIERARCHY
                                    HMAT_LB_MEMORY_HIERARCHY
    MultiFDCompression              MULTIFD_COMPRESSION
                                    MULTI_FD_COMPRESSION
    OffAutoPCIBAR                   OFF_AUTOPCIBAR
                                    OFF_AUTO_PCIBAR
    QCryptoBlockFormat              Q_CRYPTO_BLOCK_FORMAT
                                    QCRYPTO_BLOCK_FORMAT
    QCryptoBlockLUKSKeyslotState    Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE
                                    QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE
    QKeyCode                        Q_KEY_CODE
                                    QKEY_CODE
    XDbgBlockGraphNodeType          X_DBG_BLOCK_GRAPH_NODE_TYPE
                                    XDBG_BLOCK_GRAPH_NODE_TYPE
    TestUnionEnumA                  TEST_UNION_ENUMA
                                    TEST_UNION_ENUM_A

Add a 'prefix' so generated code doesn't change now.  Subsequent
commits will remove most of them again.  Two will remain:
MULTIFD_COMPRESSION, because migration code generally spells "multifd"
that way, and Q_KEY_CODE, because that one is baked into
subprojects/keycodemapdb/tools/keymap-gen.

The following enumerations with a 'prefix' change so that the prefix
is now superfluous:

    enum                            old camel_to_upper()
                                    new camel_to_upper() [equal to prefix]
    ------------------------------------------------------------------
    BlkdebugIOType                  BLKDEBUGIO_TYPE
                                    BLKDEBUG_IO_TYPE
    QCryptoTLSCredsEndpoint         Q_CRYPTOTLS_CREDS_ENDPOINT
                                    QCRYPTO_TLS_CREDS_ENDPOINT
    QCryptoSecretFormat             Q_CRYPTO_SECRET_FORMAT
                                    QCRYPTO_SECRET_FORMAT
    QCryptoCipherMode               Q_CRYPTO_CIPHER_MODE
                                    QCRYPTO_CIPHER_MODE
    QCryptodevBackendType           Q_CRYPTODEV_BACKEND_TYPE
                                    QCRYPTODEV_BACKEND_TYPE
    QType [builtin]                 Q_TYPE
                                    QTYPE

Drop these prefixes.

The following enumerations with a 'prefix' change without making the
'prefix' superfluous:

    enum                            old camel_to_upper()
                                    new camel_to_upper() [equal to prefix]
                                    prefix
    ------------------------------------------------------------------
    CpuS390Entitlement              CPUS390_ENTITLEMENT
                                    CPU_S390_ENTITLEMENT
                                    S390_CPU_ENTITLEMENT
    CpuS390Polarization             CPUS390_POLARIZATION
                                    CPU_S390_POLARIZATION
                                    S390_CPU_POLARIZATION
    CpuS390State                    CPUS390_STATE
                                    CPU_S390_STATE
                                    S390_CPU_STATE
    QAuthZListFormat                Q_AUTHZ_LIST_FORMAT
                                    QAUTH_Z_LIST_FORMAT
                                    QAUTHZ_LIST_FORMAT
    QAuthZListPolicy                Q_AUTHZ_LIST_POLICY
                                    QAUTH_Z_LIST_POLICY
                                    QAUTHZ_LIST_POLICY
    QCryptoAkCipherAlgorithm        Q_CRYPTO_AK_CIPHER_ALGORITHM
                                    QCRYPTO_AK_CIPHER_ALGORITHM
                                    QCRYPTO_AKCIPHER_ALG
    QCryptoAkCipherKeyType          Q_CRYPTO_AK_CIPHER_KEY_TYPE
                                    QCRYPTO_AK_CIPHER_KEY_TYPE
                                    QCRYPTO_AKCIPHER_KEY_TYPE
    QCryptoCipherAlgorithm          Q_CRYPTO_CIPHER_ALGORITHM
                                    QCRYPTO_CIPHER_ALGORITHM
                                    QCRYPTO_CIPHER_ALG
    QCryptoHashAlgorithm            Q_CRYPTO_HASH_ALGORITHM
                                    QCRYPTO_HASH_ALGORITHM
                                    QCRYPTO_HASH_ALG
    QCryptoIVGenAlgorithm           Q_CRYPTOIV_GEN_ALGORITHM
                                    QCRYPTO_IV_GEN_ALGORITHM
                                    QCRYPTO_IVGEN_ALG
    QCryptoRSAPaddingAlgorithm      Q_CRYPTORSA_PADDING_ALGORITHM
                                    QCRYPTO_RSA_PADDING_ALGORITHM
                                    QCRYPTO_RSA_PADDING_ALG
    QCryptodevBackendAlgType        Q_CRYPTODEV_BACKEND_ALG_TYPE
                                    QCRYPTODEV_BACKEND_ALG_TYPE
                                    QCRYPTODEV_BACKEND_ALG
    QCryptodevBackendServiceType    Q_CRYPTODEV_BACKEND_SERVICE_TYPE
                                    QCRYPTODEV_BACKEND_SERVICE_TYPE
                                    QCRYPTODEV_BACKEND_SERVICE

Subsequent commits will tweak things to remove most of these prefixes.
Only QAUTHZ_LIST_FORMAT and QAUTHZ_LIST_POLICY will remain.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20240904111836.3273842-2-armbru@redhat.com>
2024-09-10 13:22:47 +02:00
..
ci ci: refresh package lists with lcitool 2024-08-16 09:16:03 +02:00
coccinelle scripts/coccinelle: New script to add ResetType to hold and exit phases 2024-04-25 10:21:06 +01:00
codeconverter scripts/: spelling fixes 2023-09-08 13:08:52 +03:00
coverage scripts/coverage: initial coverage comparison script 2023-04-04 15:16:29 +01:00
coverity-scan scripts/coverity-scan/COMPONENTS.md: Include libqmp in testlibs 2024-06-21 14:01:59 +01:00
kvm target/i386: enumerate VMX nested-exception support 2024-06-08 10:33:38 +02:00
modules scripts/modules/module_block: Use Python 3 interpreter & add pseudo-main 2020-05-31 13:56:46 +02:00
oss-fuzz fuzz: disable leak-detection for oss-fuzz builds 2024-05-29 12:41:56 +02:00
performance scripts/: spelling fixes 2023-09-08 13:08:52 +03:00
qapi qapi: Smarter camel_to_upper() to reduce need for 'prefix' 2024-09-10 13:22:47 +02:00
qemu-guest-agent
qemugdb scripts/gdb: implement 'qemu bt' 2021-01-12 12:38:03 +01:00
qmp python: rename qemu.aqmp to qemu.qmp 2022-04-21 11:01:00 -04:00
simplebench scripts/: spelling fixes 2023-09-08 13:08:52 +03:00
tracetool tracetool: Forbid newline character in event format 2024-06-10 13:05:27 -04:00
analyse-9p-simpletrace.py drop "from __future__ import print_function" 2020-02-07 15:15:16 +01:00
analyse-locks-simpletrace.py scripts/analyse-locks-simpletrace.py: changed iteritems() to items() 2023-09-26 12:28:51 -04:00
analyze-inclusions exec: Rename NEED_CPU_H -> COMPILING_PER_TARGET 2024-04-26 09:49:51 +02:00
analyze-migration.py analyze-migration.py: Remove trick on parsing ramblocks 2024-01-29 11:02:12 +08:00
archive-source.sh make-release: do not ship dtc sources 2023-09-29 09:33:10 +02:00
block-coroutine-wrapper.py block-coroutine-wrapper: use qemu_get_current_aio_context() 2023-12-21 22:49:28 +01:00
check_sparse.py meson: move sparse detection to Meson and rewrite check_sparse.py 2020-10-04 18:36:23 +02:00
checkpatch.pl scripts/checkpatch: more checks on files imported from Linux 2024-08-16 14:04:19 +01:00
clean-header-guards.pl disas: Remove libvixl disassembler 2022-07-05 10:15:49 +02:00
clean-includes scripts/clean-includes: Update exclude list 2024-01-30 21:20:20 +03:00
cleanup-trace-events.pl scripts/cleanup-trace-events: Emit files in alphabetical order 2020-09-09 17:17:00 +01:00
cocci-macro-file.h compiler.h: replace QEMU_NORETURN with G_NORETURN 2022-04-21 17:03:51 +04:00
compare-machine-types.py scripts: add script to compare compatibility properties 2024-04-25 10:12:48 +02:00
cpu-x86-uarch-abi.py scripts: drop comment about autogenerated CPU API file 2024-02-09 12:48:07 +00:00
decodetree.py tests/decode: Suppress "error: " string for expected-failure tests 2023-07-25 10:56:52 +01:00
device-crash-test python/qemu: rename command() to cmd() 2023-10-12 14:21:43 -04:00
disas-objdump.pl
dump-guest-memory.py drop "from __future__ import print_function" 2020-02-07 15:15:16 +01:00
entitlement.sh scripts/entitlement.sh: Use backward-compatible cp flags 2021-11-30 22:25:58 +01:00
extract-vsssdk-headers
feature_to_c.py gdbstub: Add members to identify registers to GDBFeature 2024-02-28 09:10:11 +00:00
fix-multiline-comments.sh docs: move CODING_STYLE into the developer documentation 2021-02-24 11:05:21 +00:00
gensyscalls.sh target/nios2: Remove the deprecated Nios II target 2024-04-24 16:03:38 +02:00
get_maintainer.pl scripts/get_maintainer.pl: don't print parentheses 2023-10-17 15:20:53 +02:00
git-submodule.sh scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour 2023-07-25 10:56:51 +01:00
git.orderfile scripts/git.orderfile: Display MAINTAINERS changes first 2023-01-13 16:22:57 +01:00
hxtool meson: generate hxtool files 2020-08-21 06:30:14 -04:00
kernel-doc scripts/kernel-doc: strip QEMU_ from function definitions 2021-03-24 14:24:40 +00:00
make-config-poison.sh exec/poison: Do not poison CONFIG_SOFTMMU 2023-06-05 12:04:29 -07:00
make-release make-release: switch to .xz format by default 2024-03-09 18:56:37 +03:00
meson-buildoptions.py meson-buildoptions: document the data at the top 2023-10-18 10:01:02 +02:00
meson-buildoptions.sh meson: Update meson-buildoptions.sh 2024-07-17 14:04:15 +03:00
meson.build scripts: add a XML preprocessor script 2023-06-27 17:08:56 +02:00
minikconf.py meson: infrastructure for building emulators 2020-08-21 06:30:17 -04:00
modinfo-collect.py scripts: make sure scripts are invoked via $(PYTHON) 2023-05-19 20:40:29 +02:00
modinfo-generate.py scripts: make sure scripts are invoked via $(PYTHON) 2023-05-19 20:40:29 +02:00
mtest2make.py mtest2make: stop disabling meson test timeouts 2024-01-12 13:23:48 +00:00
nsis.py scripts/nsis.py: Automatically package required DLLs of QEMU executables 2022-10-31 10:06:11 +01:00
probe-gdb-support.py target/nios2: Remove the deprecated Nios II target 2024-04-24 16:03:38 +02:00
python_qmp_updater.py scripts: add python_qmp_updater.py 2023-10-12 14:21:44 -04:00
qapi-gen.py qapi: move generator entrypoint into package 2020-10-10 11:37:47 +02:00
qemu-binfmt-conf.sh scripts/qemu-binfmt-conf: Add LoongArch to qemu_get_family() 2022-07-05 16:17:53 +05:30
qemu-gdb.py scripts/gdb: implement 'qemu bt' 2021-01-12 12:38:03 +01:00
qemu-stamp.py meson, configure: move --with-pkgversion, CONFIG_STAMP to meson 2022-05-07 07:46:58 +02:00
qemu-trace-stap qemu-trace-stap: changing SYSTEMTAP_TAPSET considered harmful. 2021-07-12 17:37:06 +01:00
qemu-version.sh build-sys: fix git version from -version 2020-10-12 11:50:23 -04:00
qom-cast-macro-clean-cocci-gen.py scripts: Add qom-cast-macro-clean-cocci-gen.py 2023-06-05 20:48:34 +02:00
refresh-pxe-roms.sh
render_block_graph.py python/qemu: rename command() to cmd() 2023-10-12 14:21:43 -04:00
replay-dump.py tests/avocado: excercise scripts/replay-dump.py in replay tests 2024-08-16 14:04:19 +01:00
shaderinclude.py build-sys: fix crlf-ending C code 2023-02-02 10:44:23 +00:00
signrom.py drop "from __future__ import print_function" 2020-02-07 15:15:16 +01:00
simpletrace.py simpletrace: added simplified Analyzer2 class 2023-09-26 12:28:51 -04:00
symlink-install-tree.py Add information how to fix common build error on Windows in symlink-install-tree 2023-05-16 09:14:18 +02:00
tracetool.py tracetool: remove redundant --target-type / --target-name args 2024-03-12 14:52:07 -04:00
u2f-setup-gen.py scripts: Add u2f-setup-gen script 2020-08-31 08:23:39 +02:00
undefsym.py build: fix macOS --enable-modules build 2020-10-22 11:53:52 -04:00
update-linux-headers.sh update-linux-headers: import linux/kvm_para.h header 2024-06-05 11:01:06 +02:00
update-mips-syscall-args.sh linux-user, mips: update syscall-args-o32.c.inc to Linux v5.13 2021-07-13 13:59:59 +02:00
update-syscalltbl.sh linux-user, scripts: add a script to update syscall.tbl 2020-03-20 16:02:00 +01:00
userfaultfd-wrlat.py migration: introduce 'userfaultfd-wrlat.py' script 2021-02-08 11:19:51 +00:00
vmstate-static-checker.py vmstate-static-checker: Recognize "num" field 2023-04-27 10:18:26 +02:00
xen-detect.c xen: Drop support for Xen versions below 4.7.1 2023-06-07 15:07:10 +01:00
xml-preprocess-test.py scripts: add a XML preprocessor script 2023-06-27 17:08:56 +02:00
xml-preprocess.py scripts/xml-preprocess: Make sure this script is invoked via the right Python 2023-10-12 00:37:39 +03:00