aboutsummaryrefslogtreecommitdiff
path: root/openssl/util
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/util')
-rw-r--r--openssl/util/ck_errf.pl2
-rw-r--r--openssl/util/indent.pro751
-rw-r--r--openssl/util/libeay.num1
-rw-r--r--openssl/util/mk1mf.pl2
-rw-r--r--openssl/util/mkerr.pl134
-rw-r--r--openssl/util/openssl-format-source148
-rw-r--r--openssl/util/su-filter.pl260
7 files changed, 1229 insertions, 69 deletions
diff --git a/openssl/util/ck_errf.pl b/openssl/util/ck_errf.pl
index f13af5c50..1a8665ab6 100644
--- a/openssl/util/ck_errf.pl
+++ b/openssl/util/ck_errf.pl
@@ -21,7 +21,7 @@ foreach $file (@ARGV)
$func="";
while (<IN>)
{
- if (!/;$/ && /^([a-zA-Z].*[\s*])?([A-Za-z_0-9]+)\(.*[),]/)
+ if (!/;$/ && /^\**([a-zA-Z].*[\s*])?([A-Za-z_0-9]+)\(.*([),]|$)/)
{
/^([^()]*(\([^()]*\)[^()]*)*)\(/;
$1 =~ /([A-Za-z_0-9]*)$/;
diff --git a/openssl/util/indent.pro b/openssl/util/indent.pro
new file mode 100644
index 000000000..e8714310c
--- /dev/null
+++ b/openssl/util/indent.pro
@@ -0,0 +1,751 @@
+-bap
+-bbo
+-br
+-brs
+-c33
+-cd33
+-ce
+-ci4
+-cli0
+-cp33
+-d0
+-di1
+-hnl
+-i4
+-il1
+-ip0
+-l78
+-lp
+-nbad
+-nbc
+-ncdb
+-ncs
+-nfc1
+-nfca
+-npcs
+-nprs
+-npsl
+-nsc
+-ppi1
+-saf
+-sai
+-saw
+-sob
+-ss
+-ts0
+-T ACCESS_DESCRIPTION
+-T ADDED_OBJ
+-T AEP_BBOOL
+-T AEP_CHAR
+-T AEP_CHAR_PTR
+-T AEP_CONNECTION_ENTRY
+-T AEP_CONNECTION_HNDL
+-T AEP_CONNECTION_HNDL_PTR
+-T AEP_FLAGS
+-T AEP_RV
+-T AEP_TRANSACTION_ID
+-T AEP_TRANSACTION_ID_PTR
+-T AEP_U16
+-T AEP_U32
+-T AEP_U32_PTR
+-T AEP_U64_PTR
+-T AEP_U8
+-T AEP_U8_PTR
+-T AEP_VOID_PTR
+-T AEP_VOID_PTR_PTR
+-T AES_KEY
+-T APP_INFO
+-T ARGS
+-T ASIdOrRange
+-T ASIdOrRanges
+-T ASIdentifierChoice
+-T ASIdentifiers
+-T ASN1_ADB
+-T ASN1_ADB_TABLE
+-T ASN1_AUX
+-T ASN1_BIT_STRING
+-T ASN1_BMPSTRING
+-T ASN1_BOOLEAN
+-T ASN1_COMPAT_FUNCS
+-T ASN1_CTX
+-T ASN1_ENCODING
+-T ASN1_ENUMERATED
+-T ASN1_EXTERN_FUNCS
+-T ASN1_GENERALIZEDTIME
+-T ASN1_GENERALSTRING
+-T ASN1_IA5STRING
+-T ASN1_INTEGER
+-T ASN1_ITEM
+-T ASN1_ITEM_EXP
+-T ASN1_NULL
+-T ASN1_OBJECT
+-T ASN1_OCTET_STRING
+-T ASN1_PCTX
+-T ASN1_PRIMITIVE_FUNCS
+-T ASN1_PRINTABLESTRING
+-T ASN1_PRINT_ARG
+-T ASN1_SCTX
+-T ASN1_STREAM_ARG
+-T ASN1_STRING
+-T ASN1_STRING_TABLE
+-T ASN1_T61STRING
+-T ASN1_TEMPLATE
+-T ASN1_TIME
+-T ASN1_TLC
+-T ASN1_TYPE
+-T ASN1_UNIVERSALSTRING
+-T ASN1_UTCTIME
+-T ASN1_UTF8STRING
+-T ASN1_VALUE
+-T ASN1_VISIBLESTRING
+-T ASN1_const_CTX
+-T AUTHORITY_INFO_ACCESS
+-T AUTHORITY_KEYID
+-T BASIC_CONSTRAINTS
+-T BF_KEY
+-T BF_LONG
+-T BIGNUM
+-T BIO
+-T BIO_ACCEPT
+-T BIO_ASN1_BUF_CTX
+-T BIO_ASN1_EX_FUNCS
+-T BIO_B64_CTX
+-T BIO_CONNECT
+-T BIO_ENC_CTX
+-T BIO_F_BUFFER_CTX
+-T BIO_LINEBUFFER_CTX
+-T BIO_METHOD
+-T BIO_OK_CTX
+-T BIO_SSL
+-T BIT_STRING_BITNAME
+-T BN_BLINDING
+-T BN_CTX
+-T BN_GENCB
+-T BN_MONT_CTX
+-T BN_POOL
+-T BN_POOL_ITEM
+-T BN_RECP_CTX
+-T BN_STACK
+-T BN_ULONG
+-T BUF_MEM
+-T BY_DIR
+-T BY_DIR_ENTRY
+-T BY_DIR_HASH
+-T Bytef
+-T CAMELLIA_KEY
+-T CAST_KEY
+-T CAST_LONG
+-T CA_DB
+-T CCM128_CONTEXT
+-T CERT
+-T CERTIFICATEPOLICIES
+-T CERT_PKEY
+-T CIPHER_ORDER
+-T CMAC_CTX
+-T CMS_AuthenticatedData
+-T CMS_CertificateChoices
+-T CMS_CompressedData
+-T CMS_ContentInfo
+-T CMS_DigestedData
+-T CMS_EncapsulatedContentInfo
+-T CMS_EncryptedContentInfo
+-T CMS_EncryptedData
+-T CMS_EnvelopedData
+-T CMS_IssuerAndSerialNumber
+-T CMS_KEKIdentifier
+-T CMS_KEKRecipientInfo
+-T CMS_KeyAgreeRecipientIdentifier
+-T CMS_KeyAgreeRecipientInfo
+-T CMS_KeyTransRecipientInfo
+-T CMS_OriginatorIdentifierOrKey
+-T CMS_OriginatorInfo
+-T CMS_OriginatorPublicKey
+-T CMS_OtherCertificateFormat
+-T CMS_OtherKeyAttribute
+-T CMS_OtherRecipientInfo
+-T CMS_OtherRevocationInfoFormat
+-T CMS_PasswordRecipientInfo
+-T CMS_Receipt
+-T CMS_ReceiptRequest
+-T CMS_ReceiptsFrom
+-T CMS_RecipientEncryptedKey
+-T CMS_RecipientIdentifier
+-T CMS_RecipientInfo
+-T CMS_RecipientKeyIdentifier
+-T CMS_RevocationInfoChoice
+-T CMS_SignedData
+-T CMS_SignerIdentifier
+-T CMS_SignerInfo
+-T COMP_CTX
+-T COMP_METHOD
+-T CONF
+-T CONF_IMODULE
+-T CONF_METHOD
+-T CONF_MODULE
+-T CONF_VALUE
+-T CRYPTO_EX_DATA
+-T CRYPTO_EX_DATA_FUNCS
+-T CRYPTO_EX_DATA_IMPL
+-T CRYPTO_EX_dup
+-T CRYPTO_EX_dup
+-T CRYPTO_EX_free
+-T CRYPTO_EX_free
+-T CRYPTO_EX_new
+-T CRYPTO_EX_new
+-T CRYPTO_MEM_LEAK_CB
+-T CRYPTO_THREADID
+-T CRYPTO_dynlock_value
+-T DB_ATTR
+-T DES_LONG
+-T DES_cblock
+-T DES_key_schedule
+-T DH
+-T DH_METHOD
+-T DH_PKEY_CTX
+-T DIST_POINT
+-T DIST_POINT_NAME
+-T DRBG_CTX
+-T DSA
+-T DSA_METHOD
+-T DSA_SIG
+-T DSO
+-T DSO_FUNC_TYPE
+-T DSO_MERGER_FUNC
+-T DSO_METHOD
+-T DSO_NAME_CONVERTER_FUNC
+-T DSO_VMS_INTERNAL
+-T DTLS1_BITMAP
+-T DTLS1_RECORD_DATA
+-T DTLS1_STATE
+-T Dl_info
+-T ECDH_DATA
+-T ECDH_METHOD
+-T ECDSA_DATA
+-T ECDSA_METHOD
+-T ECDSA_SIG
+-T ECPARAMETERS
+-T ECPKPARAMETERS
+-T EC_EXTRA_DATA
+-T EC_GROUP
+-T EC_KEY
+-T EC_METHOD
+-T EC_POINT
+-T EC_PRE_COMP
+-T EC_PRIVATEKEY
+-T EC_builtin_curve
+-T EDIPARTYNAME
+-T ENGINE
+-T ENGINE_CIPHERS_PTR
+-T ENGINE_CLEANUP_CB
+-T ENGINE_CLEANUP_ITEM
+-T ENGINE_CMD_DEFN
+-T ENGINE_CTRL_FUNC_PTR
+-T ENGINE_DIGESTS_PTR
+-T ENGINE_GEN_FUNC_PTR
+-T ENGINE_GEN_INT_FUNC_PTR
+-T ENGINE_LOAD_KEY_PTR
+-T ENGINE_PILE
+-T ENGINE_PILE_DOALL
+-T ENGINE_PKEY_ASN1_METHS_PTR
+-T ENGINE_PKEY_METHS_PTR
+-T ENGINE_SSL_CLIENT_CERT_PTR
+-T ENGINE_TABLE
+-T ENUMERATED_NAMES
+-T ERR_FNS
+-T ERR_STATE
+-T ERR_STRING_DATA
+-T ESS_CERT_ID
+-T ESS_ISSUER_SERIAL
+-T ESS_SIGNING_CERT
+-T EVP_AES_HMAC_SHA1
+-T EVP_AES_HMAC_SHA256
+-T EVP_CIPHER
+-T EVP_CIPHER_CTX
+-T EVP_CIPHER_INFO
+-T EVP_ENCODE_CTX
+-T EVP_MD
+-T EVP_MD_CTX
+-T EVP_PBE_CTL
+-T EVP_PBE_KEYGEN
+-T EVP_PKEY
+-T EVP_PKEY_ASN1_METHOD
+-T EVP_PKEY_CTX
+-T EVP_PKEY_METHOD
+-T EVP_PKEY_gen_cb
+-T EX_CLASS_ITEM
+-T E_GMP_RSA_CTX
+-T E_RSAX_MOD_CTX
+-T FILE
+-T F_DIGITALSIGNATUREVERIFY
+-T F_PUBLICKEYEXTRACT
+-T GCM128_CONTEXT
+-T GENERAL_NAME
+-T GENERAL_NAMES
+-T GENERAL_SUBTREE
+-T GEN_SESSION_CB
+-T HASH_CTX
+-T HEAPENTRY32
+-T HEAPLIST32
+-T HEARTBEAT_TEST_FIXTURE
+-T HMAC_CTX
+-T ICA_KEY_RSA_CRT
+-T ICA_KEY_RSA_CRT_REC
+-T ICA_KEY_RSA_MODEXPO
+-T ICA_KEY_RSA_MODEXPO_REC
+-T IDEA_KEY_SCHEDULE
+-T IPAddrBlocks
+-T IPAddressFamily
+-T IPAddressOrRange
+-T IPAddressOrRanges
+-T ISSUING_DIST_POINT
+-T JPAKE_CTX
+-T JPAKE_STEP1
+-T JPAKE_STEP2
+-T JPAKE_STEP3A
+-T JPAKE_STEP3B
+-T JPAKE_STEP_PART
+-T JPAKE_ZKP
+-T KEY_TABLE_TYPE
+-T KRB5_APREQBODY
+-T KRB5_AUTHDATA
+-T KRB5_AUTHENTBODY
+-T KRB5_CHECKSUM
+-T KRB5_ENCDATA
+-T KRB5_ENCKEY
+-T KRB5_PRINCNAME
+-T KRB5_TKTBODY
+-T KSSL_CTX
+-T KSSL_ERR
+-T LHASH
+-T LHASH_COMP_FN_TYPE
+-T LHASH_DOALL_ARG_FN_TYPE
+-T LHASH_DOALL_FN_TYPE
+-T LHASH_HASH_FN_TYPE
+-T LHASH_NODE
+-T LPDIR_CTX
+-T LPHEAPENTRY32
+-T LPHEAPLIST32
+-T LPMODULEENTRY32
+-T LPMODULEENTRY32W
+-T LPPROCESSENTRY32
+-T LPPROCESSENTRY32W
+-T LPTHREADENTRY32
+-T LP_DIR_CTX
+-T MD2_CTX
+-T MD4_CTX
+-T MD5_CTX
+-T MDC2_CTX
+-T MD_DATA
+-T MEM
+-T MEM_LEAK
+-T MEM_OBJECT_DATA
+-T MIME_HEADER
+-T MIME_PARAM
+-T MODULEENTRY32
+-T MODULEENTRY32W
+-T MS_FAR
+-T NAME_CONSTRAINTS
+-T NAME_FUNCS
+-T NBIO_TEST
+-T NDEF_SUPPORT
+-T NETSCAPE_CERT_SEQUENCE
+-T NETSCAPE_ENCRYPTED_PKEY
+-T NETSCAPE_PKEY
+-T NETSCAPE_SPKAC
+-T NETSCAPE_SPKI
+-T NETSCAPE_X509
+-T NET_API_FUNCTION
+-T NOTICEREF
+-T OBJ_NAME
+-T OCB128_CONTEXT
+-T OCB_BLOCK
+-T OCSP_BASICRESP
+-T OCSP_CERTID
+-T OCSP_CERTSTATUS
+-T OCSP_CRLID
+-T OCSP_ONEREQ
+-T OCSP_REQINFO
+-T OCSP_REQUEST
+-T OCSP_REQ_CTX
+-T OCSP_RESPBYTES
+-T OCSP_RESPDATA
+-T OCSP_RESPID
+-T OCSP_RESPONSE
+-T OCSP_REVOKEDINFO
+-T OCSP_SERVICELOC
+-T OCSP_SIGNATURE
+-T OCSP_SINGLERESP
+-T OCSP_TBLSTR
+-T OPENSSL_BLOCK
+-T OPENSSL_CSTRING
+-T OPENSSL_DIR_CTX
+-T OPENSSL_ITEM
+-T OPENSSL_PSTRING
+-T OPENSSL_STRING
+-T OPENSSL_STRING
+-T OTHERNAME
+-T P256_POINT
+-T P256_POINT_AFFINE
+-T PBE2PARAM
+-T PBEPARAM
+-T PBKDF2PARAM
+-T PCRYPTO_MEM_LEAK_CB
+-T PEM_CTX
+-T PEM_ENCODE_SEAL_CTX
+-T PEM_USER
+-T PHEAPENTRY32
+-T PHEAPLIST32
+-T PKCS12
+-T PKCS12_BAGS
+-T PKCS12_SAFEBAG
+-T PKCS7
+-T PKCS7_DIGEST
+-T PKCS7_ENCRYPT
+-T PKCS7_ENC_CONTENT
+-T PKCS7_ENVELOPE
+-T PKCS7_ISSUER_AND_SERIAL
+-T PKCS7_RECIP_INFO
+-T PKCS7_SIGNED
+-T PKCS7_SIGNER_INFO
+-T PKCS7_SIGN_ENVELOPE
+-T PKCS8_PRIV_KEY_INFO
+-T PKEY_USAGE_PERIOD
+-T PMODULEENTRY32
+-T PMODULEENTRY32W
+-T POLICYINFO
+-T POLICYQUALINFO
+-T POLICY_CONSTRAINTS
+-T POLICY_MAPPING
+-T POLICY_MAPPINGS
+-T PPROCESSENTRY32
+-T PPROCESSENTRY32W
+-T PRECOMP256_ROW
+-T PROCESSENTRY32
+-T PROCESSENTRY32W
+-T PROXY_CERT_INFO_EXTENSION
+-T PROXY_POLICY
+-T PTHREADENTRY32
+-T PW_CB_DATA
+-T RAND_METHOD
+-T RC2_KEY
+-T RC4_KEY
+-T RC5_32_KEY
+-T RIPEMD160_CTX
+-T RSA
+-T RSA_METHOD
+-T RSA_OAEP_PARAMS
+-T RSA_PKEY_CTX
+-T RSA_PSS_PARAMS
+-T SCT
+-T SEED_KEY_SCHEDULE
+-T SESS_CERT
+-T SHA256_CTX
+-T SHA512_CTX
+-T SHA_CTX
+-T SRP_ARG
+-T SRP_CLIENT_ARG
+-T SRP_CTX
+-T SRP_SERVER_ARG
+-T SRP_VBASE
+-T SRP_gN_cache
+-T SRP_user_pwd
+-T SRTP_PROTECTION_PROFILE
+-T SSL
+-T SSL2_STATE
+-T SSL3_BUFFER
+-T SSL3_BUF_FREELIST
+-T SSL3_BUF_FREELIST_ENTRY
+-T SSL3_COMP
+-T SSL3_ENC_METHOD
+-T SSL3_RECORD
+-T SSL3_STATE
+-T SSL_CIPHER
+-T SSL_COMP
+-T SSL_CONF_CTX
+-T SSL_CTX
+-T SSL_EXCERT
+-T SSL_METHOD
+-T SSL_SESSION
+-T SSL_SESSION_ASN1
+-T STACK_OF
+-T STORE
+-T STORE_ATTR_INFO
+-T STORE_ATTR_TYPES
+-T STORE_CERTIFICATE_STATUS
+-T STORE_CLEANUP_FUNC_PTR
+-T STORE_CTRL_FUNC_PTR
+-T STORE_END_OBJECT_FUNC_PTR
+-T STORE_GENERATE_OBJECT_FUNC_PTR
+-T STORE_GENERIC_FUNC_PTR
+-T STORE_GET_OBJECT_FUNC_PTR
+-T STORE_HANDLE_OBJECT_FUNC_PTR
+-T STORE_INITIALISE_FUNC_PTR
+-T STORE_METHOD
+-T STORE_MODIFY_OBJECT_FUNC_PTR
+-T STORE_NEXT_OBJECT_FUNC_PTR
+-T STORE_OBJECT
+-T STORE_OBJECT_TYPES
+-T STORE_PARAM_TYPES
+-T STORE_START_OBJECT_FUNC_PTR
+-T STORE_STORE_OBJECT_FUNC_PTR
+-T SW_ALGTYPE
+-T SW_BYTE
+-T SW_COMMAND_BITMAP
+-T SW_COMMAND_CODE
+-T SW_CONTEXT_HANDLE
+-T SW_CRT
+-T SW_DSA
+-T SW_EXP
+-T SW_LARGENUMBER
+-T SW_NVDATA
+-T SW_OSHANDLE
+-T SW_PARAM
+-T SW_STATE
+-T SW_STATUS
+-T SW_U16
+-T SW_U32
+-T SW_U64
+-T SXNET
+-T SXNETID
+-T TCHAR
+-T TEST_INFO
+-T THREADENTRY32
+-T TIMEOUT_PARAM
+-T TLS_SESSION_TICKET_EXT
+-T TLS_SIGALGS
+-T TS_ACCURACY
+-T TS_MSG_IMPRINT
+-T TS_REQ
+-T TS_RESP
+-T TS_RESP_CTX
+-T TS_STATUS_INFO
+-T TS_TST_INFO
+-T TS_VERIFY_CTX
+-T TXT_DB
+-T UI
+-T UINT64
+-T UI_METHOD
+-T UI_STRING
+-T USERNOTICE
+-T WCHAR
+-T WHIRLPOOL_CTX
+-T WINAPI
+-T WSAAPI
+-T X509
+-T X509V3_CONF_METHOD
+-T X509V3_CTX
+-T X509V3_EXT_D2I
+-T X509V3_EXT_FREE
+-T X509V3_EXT_I2D
+-T X509V3_EXT_I2R
+-T X509V3_EXT_I2S
+-T X509V3_EXT_METHOD
+-T X509V3_EXT_NEW
+-T X509V3_EXT_R2I
+-T X509V3_EXT_S2I
+-T X509V3_EXT_V2I
+-T X509_ALGOR
+-T X509_ATTRIBUTE
+-T X509_CERT_AUX
+-T X509_CERT_FILE_CTX
+-T X509_CERT_PAIR
+-T X509_CINF
+-T X509_CRL
+-T X509_CRL_INFO
+-T X509_CRL_METHOD
+-T X509_EXTENSION
+-T X509_INFO
+-T X509_LOOKUP
+-T X509_LOOKUP_METHOD
+-T X509_NAME
+-T X509_NAME_ENTRY
+-T X509_OBJECT
+-T X509_OBJECTS
+-T X509_PKEY
+-T X509_POLICY_CACHE
+-T X509_POLICY_DATA
+-T X509_POLICY_LEVEL
+-T X509_POLICY_NODE
+-T X509_POLICY_TREE
+-T X509_PUBKEY
+-T X509_PURPOSE
+-T X509_REQ
+-T X509_REQ_INFO
+-T X509_REVOKED
+-T X509_SIG
+-T X509_STORE
+-T X509_STORE_CTX
+-T X509_TRUST
+-T X509_VAL
+-T X509_VERIFY_PARAM
+-T X509_VERIFY_PARAM_ID
+-T X9_62_CHARACTERISTIC_TWO
+-T X9_62_CURVE
+-T X9_62_FIELDID
+-T X9_62_PENTANOMIAL
+-T XTS128_CONTEXT
+-T ZEN_MD_DATA
+-T _LHASH
+-T _STACK
+-T __int64
+-T _ossl_old_des_cblock
+-T asn1_ps_func
+-T bio_dgram_data
+-T bio_info_cb
+-T char_io
+-T conf_finish_func
+-T conf_init_func
+-T const_DES_cblock
+-T d2i_of_void
+-T des_cblock
+-T dynamic_data_ctx
+-T dynamic_fns
+-T engine_table_doall_cb
+-T i2d_of_void
+-T int_dhx942_dh
+-T nid_triple
+-T pem_password_cb
+-T pitem
+-T piterator
+-T pqueue_s
+-T session_op
+-T size_t
+-T tag_exp_arg
+-T testdata
+-T time_t
+-T time_t
+-T u32
+-T u64
+-T u8
+-T v3_ext_ctx
+-T v3_ext_method
+-T STACK_OF_ACCESS_DESCRIPTION_
+-T STACK_OF_ASIdOrRange_
+-T STACK_OF_ASN1_ADB_TABLE_
+-T STACK_OF_ASN1_INTEGER_
+-T STACK_OF_ASN1_OBJECT_
+-T STACK_OF_ASN1_STRING_TABLE_
+-T STACK_OF_ASN1_TYPE_
+-T STACK_OF_ASN1_UTF8STRING_
+-T STACK_OF_ASN1_VALUE_
+-T STACK_OF_BIO_
+-T STACK_OF_BY_DIR_ENTRY_
+-T STACK_OF_BY_DIR_HASH_
+-T STACK_OF_CMS_CertificateChoices_
+-T STACK_OF_CMS_RecipientEncryptedKey_
+-T STACK_OF_CMS_RecipientInfo_
+-T STACK_OF_CMS_RevocationInfoChoice_
+-T STACK_OF_CMS_SignerInfo_
+-T STACK_OF_CONF_IMODULE_
+-T STACK_OF_CONF_MODULE_
+-T STACK_OF_CONF_VALUE_
+-T STACK_OF_CRYPTO_EX_DATA_FUNCS_
+-T STACK_OF_CRYPTO_dynlock_
+-T STACK_OF_DIST_POINT_
+-T STACK_OF_ENGINE_
+-T STACK_OF_ENGINE_CLEANUP_ITEM_
+-T STACK_OF_ESS_CERT_ID_
+-T STACK_OF_EVP_PBE_CTL_
+-T STACK_OF_EVP_PKEY_ASN1_METHOD_
+-T STACK_OF_EVP_PKEY_METHOD_
+-T STACK_OF_GENERAL_NAMES_
+-T STACK_OF_GENERAL_NAME_
+-T STACK_OF_GENERAL_SUBTREE_
+-T STACK_OF_IPAddressFamily_
+-T STACK_OF_IPAddressOrRange_
+-T STACK_OF_KRB5_APREQBODY_
+-T STACK_OF_KRB5_AUTHENTBODY_
+-T STACK_OF_KRB5_TKTBODY_
+-T STACK_OF_MEM_OBJECT_DATA_
+-T STACK_OF_MIME_HEADER_
+-T STACK_OF_MIME_PARAM_
+-T STACK_OF_NAME_FUNCS_
+-T STACK_OF_OCSP_CERTID_
+-T STACK_OF_OCSP_ONEREQ_
+-T STACK_OF_OCSP_RESPID_
+-T STACK_OF_OCSP_SINGLERESP_
+-T STACK_OF_OPENSSL_BLOCK_
+-T STACK_OF_OPENSSL_PSTRING_
+-T STACK_OF_OPENSSL_STRING_
+-T STACK_OF_PKCS12_SAFEBAG_
+-T STACK_OF_PKCS7_
+-T STACK_OF_PKCS7_RECIP_INFO_
+-T STACK_OF_PKCS7_SIGNER_INFO_
+-T STACK_OF_POLICYINFO_
+-T STACK_OF_POLICYQUALINFO_
+-T STACK_OF_POLICY_MAPPING_
+-T STACK_OF_Request_
+-T STACK_OF_SCT_
+-T STACK_OF_SRP_gN_
+-T STACK_OF_SRP_gN_cache_
+-T STACK_OF_SRP_user_pwd_
+-T STACK_OF_SRTP_PROTECTION_PROFILE_
+-T STACK_OF_SSL_CIPHER_
+-T STACK_OF_SSL_COMP_
+-T STACK_OF_STORE_ATTR_INFO_
+-T STACK_OF_STRING_
+-T STACK_OF_SXNETID_
+-T STACK_OF_SingleResponse_
+-T STACK_OF_UI_STRING_
+-T STACK_OF_X509V3_EXT_METHOD_
+-T STACK_OF_X509_
+-T STACK_OF_X509_ALGOR_
+-T STACK_OF_X509_ATTRIBUTE_
+-T STACK_OF_X509_CRL_
+-T STACK_OF_X509_EXTENSION_
+-T STACK_OF_X509_INFO_
+-T STACK_OF_X509_LOOKUP_
+-T STACK_OF_X509_NAME_
+-T STACK_OF_X509_NAME_ENTRY_
+-T STACK_OF_X509_OBJECT_
+-T STACK_OF_X509_POLICY_DATA_
+-T STACK_OF_X509_POLICY_NODE_
+-T STACK_OF_X509_PURPOSE_
+-T STACK_OF_X509_REVOKED_
+-T STACK_OF_X509_TRUST_
+-T STACK_OF_X509_VERIFY_PARAM_
+-T STACK_OF_nid_triple_
+-T STACK_OF_void_
+-T LHASH_OF_ADDED_OBJ_
+-T LHASH_OF_APP_INFO_
+-T LHASH_OF_CONF_VALUE_
+-T LHASH_OF_ENGINE_PILE_
+-T LHASH_OF_ERR_STATE_
+-T LHASH_OF_ERR_STRING_DATA_
+-T LHASH_OF_EX_CLASS_ITEM_
+-T LHASH_OF_FUNCTION_
+-T LHASH_OF_MEM_
+-T LHASH_OF_OBJ_NAME_
+-T LHASH_OF_OPENSSL_STRING_
+-T LHASH_OF_SSL_SESSION_
+-T LHASH_OF_STRING_
+-T clock_t
+-T custom_ext_methods
+-T hm_fragment
+-T krb5_auth_context
+-T krb5_authdata
+-T KRB5_CALLCONV
+-T krb5_ccache
+-T krb5_context
+-T krb5_creds
+-T krb5_data
+-T krb5_deltat
+-T krb5_flags
+-T krb5_int32
+-T krb5_keyblock
+-T krb5_keytab
+-T krb5_keytab_entry
+-T krb5_octet
+-T krb5_principal
+-T krb5_principal_data
+-T krb5_rcache
+-T krb5_ticket
+-T krb5_ticket_times
+-T krb5_timestamp
+-T record_pqueue
+-T ssl_ctx_st
+-T ssl_flag_tbl
+-T ssl_st
+-T ssl_trace_tbl
+-T _stdcall
+-T tls12_lookup
diff --git a/openssl/util/libeay.num b/openssl/util/libeay.num
index 3821c9c99..b594caf2c 100644
--- a/openssl/util/libeay.num
+++ b/openssl/util/libeay.num
@@ -1806,6 +1806,7 @@ d2i_ASN1_SET_OF_PKCS12_SAFEBAG 2341 NOEXIST::FUNCTION:
ASN1_UTCTIME_get 2350 NOEXIST::FUNCTION:
X509_REQ_digest 2362 EXIST::FUNCTION:EVP
X509_CRL_digest 2391 EXIST::FUNCTION:EVP
+ASN1_STRING_clear_free 2392 EXIST::FUNCTION:
d2i_ASN1_SET_OF_PKCS7 2397 NOEXIST::FUNCTION:
X509_ALGOR_cmp 2398 EXIST::FUNCTION:
EVP_CIPHER_CTX_set_key_length 2399 EXIST::FUNCTION:
diff --git a/openssl/util/mk1mf.pl b/openssl/util/mk1mf.pl
index fa45a6ead..83334a253 100644
--- a/openssl/util/mk1mf.pl
+++ b/openssl/util/mk1mf.pl
@@ -706,7 +706,7 @@ open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h";
printf OUT <<EOF;
#ifdef $platform_cpp_symbol
/* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
- #define CFLAGS "$cc $cflags"
+ #define CFLAGS "compiler: $cc $cflags"
#define PLATFORM "$platform"
EOF
printf OUT " #define DATE \"%s\"\n", scalar gmtime();
diff --git a/openssl/util/mkerr.pl b/openssl/util/mkerr.pl
index ee23a8291..8d2fdbc7e 100644
--- a/openssl/util/mkerr.pl
+++ b/openssl/util/mkerr.pl
@@ -250,7 +250,7 @@ while (($hdr, $lib) = each %libinc)
if ($gotfile) {
while(<IN>) {
- if(/^\#define\s+(\S+)\s+(\S+)/) {
+ if(/^\#\s*define\s+(\S+)\s+(\S+)/) {
$name = $1;
$code = $2;
next if $name =~ /^${lib}err/;
@@ -458,7 +458,8 @@ foreach $lib (keys %csrc)
print OUT @out;
undef @out;
print OUT <<"EOF";
-/* The following lines are auto generated by the script mkerr.pl. Any changes
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
EOF
@@ -472,7 +473,7 @@ EOF
${staticloader}void ERR_load_${lib}_strings(void);
${staticloader}void ERR_unload_${lib}_strings(void);
${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line);
-#define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__)
+# define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__)
EOF
}
@@ -483,7 +484,7 @@ EOF
EOF
foreach $i (@function) {
- $z=6-int(length($i)/8);
+ $z=48 - length($i);
if($fcodes{$i} eq "X") {
$fassigned{$lib} =~ m/^:([^:]*):/;
$findcode = $1;
@@ -497,13 +498,13 @@ EOF
$fassigned{$lib} .= "$findcode:";
print STDERR "New Function code $i\n" if $debug;
}
- printf OUT "#define $i%s $fcodes{$i}\n","\t" x $z;
+ printf OUT "# define $i%s $fcodes{$i}\n"," " x $z;
}
print OUT "\n/* Reason codes. */\n";
foreach $i (@reasons) {
- $z=6-int(length($i)/8);
+ $z=48 - length($i);
if($rcodes{$i} eq "X") {
$rassigned{$lib} =~ m/^:([^:]*):/;
$findcode = $1;
@@ -517,7 +518,7 @@ EOF
$rassigned{$lib} .= "$findcode:";
print STDERR "New Reason code $i\n" if $debug;
}
- printf OUT "#define $i%s $rcodes{$i}\n","\t" x $z;
+ printf OUT "# define $i%s $rcodes{$i}\n"," " x $z;
}
print OUT <<"EOF";
@@ -583,7 +584,7 @@ EOF
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -629,7 +630,8 @@ EOF
*
*/
-/* NOTE: this file was auto generated by the mkerr.pl script: any changes
+/*
+ * NOTE: this file was auto generated by the mkerr.pl script: any changes
* made to it will be overwritten when the script next updates this file,
* only reason strings will be preserved.
*/
@@ -641,11 +643,10 @@ EOF
/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR
-#define ERR_FUNC(func) ERR_PACK($pack_errcode,func,0)
-#define ERR_REASON(reason) ERR_PACK($pack_errcode,0,reason)
+# define ERR_FUNC(func) ERR_PACK($pack_errcode,func,0)
+# define ERR_REASON(reason) ERR_PACK($pack_errcode,0,reason)
-static ERR_STRING_DATA ${lib}_str_functs[]=
- {
+static ERR_STRING_DATA ${lib}_str_functs[] = {
EOF
# Add each function code: if a function name is found then use it.
foreach $i (@function) {
@@ -656,20 +657,22 @@ EOF
$fn = $ftrans{$fn};
}
# print OUT "{ERR_PACK($pack_errcode,$i,0),\t\"$fn\"},\n";
- print OUT "{ERR_FUNC($i),\t\"$fn\"},\n";
+ if(length($i) + length($fn) > 58) {
+ print OUT " {ERR_FUNC($i),\n \"$fn\"},\n";
+ } else {
+ print OUT " {ERR_FUNC($i), \"$fn\"},\n";
+ }
}
print OUT <<"EOF";
-{0,NULL}
- };
+ {0, NULL}
+};
-static ERR_STRING_DATA ${lib}_str_reasons[]=
- {
+static ERR_STRING_DATA ${lib}_str_reasons[] = {
EOF
# Add each reason code.
foreach $i (@reasons) {
my $rn;
my $rstr = "ERR_REASON($i)";
- my $nspc = 0;
if (exists $err_reason_strings{$i}) {
$rn = $err_reason_strings{$i};
} else {
@@ -677,90 +680,87 @@ EOF
$rn = $1;
$rn =~ tr/_[A-Z]/ [a-z]/;
}
- $nspc = 40 - length($rstr) unless length($rstr) > 40;
- $nspc = " " x $nspc;
- print OUT "{${rstr}${nspc},\"$rn\"},\n";
+ if(length($i) + length($rn) > 56) {
+ print OUT " {${rstr},\n \"$rn\"},\n";
+ } else {
+ print OUT " {${rstr}, \"$rn\"},\n";
+ }
}
if($static) {
print OUT <<"EOF";
-{0,NULL}
- };
+ {0, NULL}
+};
#endif
${staticloader}void ERR_load_${lib}_strings(void)
- {
+{
#ifndef OPENSSL_NO_ERR
- if (ERR_func_error_string(${lib}_str_functs[0].error) == NULL)
- {
- ERR_load_strings($load_errcode,${lib}_str_functs);
- ERR_load_strings($load_errcode,${lib}_str_reasons);
- }
+ if (ERR_func_error_string(${lib}_str_functs[0].error) == NULL) {
+ ERR_load_strings($load_errcode, ${lib}_str_functs);
+ ERR_load_strings($load_errcode, ${lib}_str_reasons);
+ }
#endif
- }
+}
EOF
} else {
print OUT <<"EOF";
-{0,NULL}
- };
+ {0, NULL}
+};
#endif
#ifdef ${lib}_LIB_NAME
-static ERR_STRING_DATA ${lib}_lib_name[]=
- {
-{0 ,${lib}_LIB_NAME},
-{0,NULL}
- };
+static ERR_STRING_DATA ${lib}_lib_name[] = {
+ {0, ${lib}_LIB_NAME},
+ {0, NULL}
+};
#endif
-
-static int ${lib}_lib_error_code=0;
-static int ${lib}_error_init=1;
+static int ${lib}_lib_error_code = 0;
+static int ${lib}_error_init = 1;
${staticloader}void ERR_load_${lib}_strings(void)
- {
- if (${lib}_lib_error_code == 0)
- ${lib}_lib_error_code=ERR_get_next_error_library();
+{
+ if (${lib}_lib_error_code == 0)
+ ${lib}_lib_error_code = ERR_get_next_error_library();
- if (${lib}_error_init)
- {
- ${lib}_error_init=0;
+ if (${lib}_error_init) {
+ ${lib}_error_init = 0;
#ifndef OPENSSL_NO_ERR
- ERR_load_strings(${lib}_lib_error_code,${lib}_str_functs);
- ERR_load_strings(${lib}_lib_error_code,${lib}_str_reasons);
+ ERR_load_strings(${lib}_lib_error_code, ${lib}_str_functs);
+ ERR_load_strings(${lib}_lib_error_code, ${lib}_str_reasons);
#endif
#ifdef ${lib}_LIB_NAME
- ${lib}_lib_name->error = ERR_PACK(${lib}_lib_error_code,0,0);
- ERR_load_strings(0,${lib}_lib_name);
+ ${lib}_lib_name->error = ERR_PACK(${lib}_lib_error_code, 0, 0);
+ ERR_load_strings(0, ${lib}_lib_name);
#endif
- }
- }
+ }
+}
${staticloader}void ERR_unload_${lib}_strings(void)
- {
- if (${lib}_error_init == 0)
- {
+{
+ if (${lib}_error_init == 0) {
#ifndef OPENSSL_NO_ERR
- ERR_unload_strings(${lib}_lib_error_code,${lib}_str_functs);
- ERR_unload_strings(${lib}_lib_error_code,${lib}_str_reasons);
+ ERR_unload_strings(${lib}_lib_error_code, ${lib}_str_functs);
+ ERR_unload_strings(${lib}_lib_error_code, ${lib}_str_reasons);
#endif
#ifdef ${lib}_LIB_NAME
- ERR_unload_strings(0,${lib}_lib_name);
+ ERR_unload_strings(0, ${lib}_lib_name);
#endif
- ${lib}_error_init=1;
- }
- }
+ ${lib}_error_init = 1;
+ }
+}
${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line)
- {
- if (${lib}_lib_error_code == 0)
- ${lib}_lib_error_code=ERR_get_next_error_library();
- ERR_PUT_error(${lib}_lib_error_code,function,reason,file,line);
- }
+{
+ if (${lib}_lib_error_code == 0)
+ ${lib}_lib_error_code = ERR_get_next_error_library();
+ ERR_PUT_error(${lib}_lib_error_code, function, reason, file, line);
+}
EOF
}
diff --git a/openssl/util/openssl-format-source b/openssl/util/openssl-format-source
new file mode 100644
index 000000000..8c3a7c0db
--- /dev/null
+++ b/openssl/util/openssl-format-source
@@ -0,0 +1,148 @@
+#!/bin/sh
+#
+# openssl-format-source
+# - format source tree according to OpenSSL coding style using indent
+#
+# usage:
+# openssl-format-source [-v] [-n] [file|directory] ...
+#
+# note: the indent options assume GNU indent v2.2.10 which was released
+# Feb-2009 so if you have an older indent the options may not
+# match what is expected
+#
+# any marked block comment blocks have to be moved to align manually after
+# the reformatting has been completed as marking a block causes indent to
+# not move it at all ...
+#
+
+PATH=/usr/local/bin:/bin:/usr/bin:$PATH
+export PATH
+HERE="`dirname $0`"
+
+set -e
+
+if [ $# -eq 0 ]; then
+ echo "usage: $0 [-v] [-n] [-c] [sourcefile|sourcedir] ..." >&2
+ exit 1
+fi
+
+VERBOSE=false
+DONT=false
+STOPARGS=false
+COMMENTS=false
+DEBUG=""
+
+# for this exercise, we want to force the openssl style, so we roll
+# our own indent profile, which is at a well known location
+INDENT_PROFILE="$HERE/indent.pro"
+export INDENT_PROFILE
+if [ ! -f "$INDENT_PROFILE" ]; then
+ echo "$0: unable to locate the openssl indent.pro file" >&2
+ exit 1
+fi
+
+# Extra arguments; for adding the comment-formatting
+INDENT_ARGS=""
+for i
+do
+ if [ "$STOPARGS" != "true" ]; then
+ case $i in
+ --) STOPARGS="true"; continue;;
+ -n) DONT="true"; continue;;
+ -v) VERBOSE="true";
+ echo "INDENT_PROFILE=$INDENT_PROFILE";
+ continue;;
+ -c) COMMENTS="true";
+ INDENT_ARGS="-fc1 -fca -cdb -sc";
+ continue;;
+ -nc) COMMENTS="true";
+ continue;;
+ -d) DEBUG='eval tee "$j.pre" |'
+ continue;;
+ esac
+ fi
+
+ if [ -d "$i" ]; then
+ LIST=`find "$i" -name '*.[ch]' -print`
+ else
+ if [ ! -f "$i" ]; then
+ echo "$0: source file not found: $i" >&2
+ exit 1
+ fi
+ LIST="$i"
+ fi
+
+ for j in $LIST
+ do
+ # ignore symlinks - we only ever process the base file - so if we
+ # expand a directory tree we need to ignore any located symlinks
+ if [ -d "$i" ]; then
+ if [ -h "$j" ]; then
+ continue;
+ fi
+ fi
+
+ if [ "$VERBOSE" = "true" ]; then
+ echo "$j"
+ fi
+
+ if [ "$DONT" = "false" ]; then
+ tmp=$(mktemp /tmp/indent.XXXXXX)
+ trap 'rm -f "$tmp"' HUP INT TERM EXIT
+
+ case `basename $j` in
+ # the list of files that indent is unable to handle correctly
+ # that we simply leave alone for manual formatting now
+ obj_dat.h|aes_core.c|aes_x86core.c|ecp_nistz256.c)
+ echo "skipping $j"
+ ;;
+ *)
+ if [ "$COMMENTS" = "true" ]; then
+ # we have to mark single line comments as /*- ...*/ to stop indent
+ # messing with them, run expand then indent as usual but with the
+ # the process-comments options and then undo that marking, and then
+ # finally re-run indent without process-comments so the marked-to-
+ # be-ignored comments we did automatically end up getting moved
+ # into the right possition within the code as indent leaves marked
+ # comments entirely untouched - we appear to have no way to avoid
+ # the double processing and get the desired output
+ cat "$j" | \
+ expand | \
+ perl -0 -np \
+ -e 's/(\n#[ \t]*ifdef[ \t]+__cplusplus\n[^\n]*\n#[ \t]*endif\n)/\n\/**INDENT-OFF**\/$1\/**INDENT-ON**\/\n/g;' \
+ -e 's/(\n\/\*\!)/\n\/**/g;' \
+ -e 's/(STACK_OF|LHASH_OF)\(([^ \t,\)]+)\)( |\n)/$1_$2_$3/g;' \
+ | \
+ perl -np \
+ -e 's/^([ \t]*)\/\*([ \t]+.*)\*\/[ \t]*$/if (length("$1$2")<75) {$c="-"}else{$c=""}; "$1\/*$c$2*\/"/e;' \
+ -e 's/^\/\* ((Copyright|=|----).*)$/\/*-$1/;' \
+ -e 's/^((DECLARE|IMPLEMENT)_(EXTERN_ASN1|ASN1|ADB|STACK_OF|PKCS12_STACK_OF).*)$/\/**INDENT-OFF**\/\n$1\n\/**INDENT-ON**\//;' \
+ -e 's/^([ \t]*(make_dh|make_dh_bn|make_rfc5114_td)\(.*\)[ \t,]*)$/\/**INDENT-OFF**\/\n$1\n\/**INDENT-ON**\//;' \
+ -e 's/^(ASN1_ADB_TEMPLATE\(.*)$/\/**INDENT-OFF**\/\n$1\n\/**INDENT-ON**\//;' \
+ -e 's/^((ASN1|ADB)_.*_(end|END)\(.*[\){=,;]+[ \t]*)$/$1\n\/**INDENT-ON**\//;' \
+ -e '/ASN1_(ITEM_ref|ITEM_ptr|ITEM_rptr|PCTX)/ || s/^((ASN1|ADB)_[^\*]*[){=,]+[ \t]*)$/\/**INDENT-OFF**\/\n$1/;' \
+ -e 's/^(} (ASN1|ADB)_[^\*]*[\){=,;]+)$/$1\n\/**INDENT-ON**\//;' \
+ | \
+ $DEBUG indent $INDENT_ARGS | \
+ perl -np \
+ -e 's/^([ \t]*)\/\*-(.*)\*\/[ \t]*$/$1\/*$2*\//;' \
+ -e 's/^\/\*-((Copyright|=|----).*)$/\/* $1/;' \
+ | indent | \
+ perl -0 -np \
+ -e 's/\/\*\*INDENT-(ON|OFF)\*\*\/\n//g;' \
+ | perl -np \
+ -e 's/(STACK_OF|LHASH_OF)_([^ \t,]+)_( |\/)/$1($2)$3/g;' \
+ -e 's/(STACK_OF|LHASH_OF)_([^ \t,]+)_$/$1($2)/g;' \
+ | perl "$HERE"/su-filter.pl \
+ > "$tmp"
+ else
+ expand "$j" | indent $INDENT_ARGS > "$tmp"
+ fi;
+ mv "$tmp" "$j"
+ ;;
+ esac
+ fi
+ done
+done
+
+
diff --git a/openssl/util/su-filter.pl b/openssl/util/su-filter.pl
new file mode 100644
index 000000000..8975af64f
--- /dev/null
+++ b/openssl/util/su-filter.pl
@@ -0,0 +1,260 @@
+#!/usr/bin/env perl
+#
+# su-filter.pl
+#
+use strict;
+
+my $in_su = 0;
+my $indent = 0;
+my $out;
+my $braces = 0;
+my $arrcnt;
+my $data;
+my $tststr;
+my $incomm = 0;
+
+while(<>) {
+ $tststr = $_;
+ $incomm++ while $tststr =~ /\/\*/g;
+ $incomm-- while $tststr =~ /\*\//g;
+
+ if($in_su == 1) {
+ if(/}(.*);/) {
+ $out .= $_;
+ do_output($out);
+ $in_su = 0;
+ } elsif(/^ *\} [^\s]+(\[\d*\])* = \{/) {
+ $tststr = $1;
+ $arrcnt = 0;
+ $arrcnt++ while $tststr =~ /\[/g;
+ $in_su++;
+ $braces = 1;
+ /^(.* = \{)(.*)$/;
+ $data = $2;
+ $out .= $1."\n";
+ } else {
+ $out .= $_;
+ }
+ } elsif($in_su == 2) {
+ $data .= $_;
+ if(/};$/) {
+ #$data = "\n$data";
+ $data =~ s/\n */\n/g;
+ $data =~ s/};\n?//s;
+ my @strucdata = structureData($data);
+ $out .= displayData($indent, 0, \@strucdata);
+ $out .= "\n$indent};\n";
+ do_output($out);
+ $in_su = 0;
+ }
+ } elsif($incomm <= 0 && /( *)(static )?(const )?(union|struct) ([^\s]+ )?\{/) {
+ $in_su = 1;
+ $indent = $1;
+ $out = $_;
+ next;
+ } else {
+ do_output($_);
+ }
+}
+
+
+sub structureData {
+ my $data = $_[0];
+ my @datalist = split(/(\{|\}|,|"|#|\n|\/\*|\*\/|\(|\))/, $data);
+ my $item;
+ my $dataitem = "";
+ my @struclist = ();
+ my $substruc;
+ my $inquote = 0;
+ my $inbrace = 0;
+ my $preproc = 0;
+ my $comment = 0;
+ my $inparen = 0;
+
+
+ foreach $item (@datalist) {
+ if($comment) {
+ if($item eq "*/") {
+ $comment = 0;
+ $dataitem .= "*/";
+ push @struclist, $dataitem;
+ $dataitem = "";
+ next;
+ }
+ $dataitem .= $item;
+ next;
+ }
+ if($inquote) {
+ $dataitem .= $item;
+ if($item eq "\"") {
+ $inquote--;
+ }
+ next;
+ }
+ if($preproc) {
+ if($item eq "\n") {
+ $preproc = 0;
+ push @struclist, $dataitem;
+ $dataitem = "";
+ next;
+ }
+ $dataitem .= $item;
+ next;
+ }
+ if($inbrace) {
+ if($item eq "}") {
+ $inbrace --;
+
+ if(!$inbrace) {
+ $substruc = structureData($dataitem);
+ $dataitem = $substruc;
+ next;
+ }
+ } elsif($item eq "{") {
+ $inbrace++;
+ } elsif ($item eq "\"") {
+ $inquote++;
+ }
+ $dataitem .= $item;
+ next;
+ }
+ if($inparen) {
+ if($item eq ")") {
+ $inparen--;
+ }
+ $dataitem .= $item;
+ next;
+ }
+ if($item eq "\n") {
+ next;
+ }
+ if($item eq "#") {
+ $preproc = 1;
+ push @struclist, $dataitem;
+ $dataitem = "#";
+ next;
+ }
+ if($item eq "/*") {
+ $comment = 1;
+ push @struclist, $dataitem;
+ $dataitem= "/*";
+ next;
+ }
+ if($item eq "\"") {
+ $dataitem .= $item;
+ $inquote++;
+ next;
+ }
+ if($item eq "{") {
+ $inbrace++;
+ next;
+ }
+ if($item eq ",") {
+ push @struclist, $dataitem;
+ $dataitem = "";
+ next;
+ }
+ if($item eq "(") {
+ $dataitem .= $item;
+ $inparen++;
+ next;
+ }
+ if($item =~ /^\s*$/) {
+ next;
+ }
+ if(ref $dataitem eq 'ARRAY') {
+ push @struclist, $dataitem;
+ $dataitem = "";
+ }
+ $dataitem .= $item;
+ }
+ push @struclist, $dataitem;
+ return \@struclist;
+}
+
+sub displayData {
+ my $indent = shift;
+ my $depth = shift;
+ my $data = shift;
+ my $item;
+ my $out = "";
+ my $currline = "";
+ my $first = 1;
+ my $prevpreproc = 0;
+ my $prevcomment = 0;
+
+ foreach $item (@{$data}) {
+ if($item =~ /^\/\*/) {
+ #Comment
+ $item =~ s/\n/\n$indent/g;
+ if($out =~ /\n\s*$/s) {
+ $out .= $item."\n".$indent;
+ } else {
+ $out .= "\n".$indent.$item."\n".$indent;
+ }
+ $currline = $indent;
+ $prevcomment = 1;
+ next;
+ }
+ $item =~ s/^\s+//;
+ if($item =~ /^#/) {
+ #Pre-processor directive
+ if($out =~ /\n\s*$/s) {
+ $out =~ s/\n\s*$/\n/;
+ $out .= $item."\n".$indent;
+ } else {
+ $out .= "\n".$item."\n".$indent;
+ }
+ $currline = $indent;
+ $prevpreproc = 1;
+ next;
+ }
+ if($first) {
+ $first = 0;
+ if($depth != 0) {
+ $out .= $indent;
+ $currline = $indent;
+ }
+ } else {
+ if(!$prevpreproc && !$prevcomment) {
+ $out .= ", ";
+ $currline .= ", ";
+ if($depth == 1) {
+ $out .= "\n";
+ $currline = "";
+ }
+ if($depth == 1) {
+ $out .= $indent;
+ $currline .= $indent;
+ }
+ }
+
+ }
+ $prevpreproc = 0;
+ $prevcomment = 0;
+
+ if (ref $item eq 'ARRAY') {
+ if($depth == 0) {
+ $out .= displayData("$indent ", $depth+1, $item);
+ } else {
+ $out .= "{\n".displayData("$indent ", $depth+1, $item)."\n".$indent."}";
+ $currline = $indent."}";
+ }
+ } else {
+ if(length $currline.$item > 79) {
+ $currline = $indent;
+ $out .= "\n$indent";
+ }
+ $out .= $item;
+ $currline .= $item;
+ }
+ }
+ return $out;
+}
+
+sub do_output {
+ my $out = shift;
+ # Strip any trailing whitespace
+ $out =~ s/\s+\n/\n/g;
+ print $out;
+}