Changeset 64888 in vbox
- Timestamp:
- Dec 15, 2016 5:25:57 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 112295
- Location:
- trunk/include/iprt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asn1-generator-init.h
r62473 r64888 34 34 #define RTASN1TMPL_PASS RTASN1TMPL_PASS_SETTERS_2 35 35 #include <iprt/asn1-generator-pass.h> 36 #define RTASN1TMPL_PASS RTASN1TMPL_PASS_ARRAY 37 #include <iprt/asn1-generator-pass.h> 36 38 -
trunk/include/iprt/asn1-generator-pass.h
r64883 r64888 78 78 #define RTASN1TMPL_PASS_SETTERS_1 18 79 79 #define RTASN1TMPL_PASS_SETTERS_2 19 80 #define RTASN1TMPL_PASS_ARRAY 20 80 81 81 82 #define RTASN1TMPL_PASS_DECODE 24 … … 905 906 } RTASN1TMPL_SEMICOLON_DUMMY() 906 907 907 # define RTASN1TMPL_END_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY()908 # define RTASN1TMPL_END_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY() 908 909 909 910 910 911 # define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SEMICOLON_DUMMY() 911 912 # define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SEMICOLON_DUMMY() 913 914 915 #elif RTASN1TMPL_PASS == RTASN1TMPL_PASS_ARRAY 916 /* 917 * 918 * Array operations. 919 * 920 */ 921 # define RTASN1TMPL_BEGIN_SEQCORE() RTASN1TMPL_SEMICOLON_DUMMY() 922 # define RTASN1TMPL_BEGIN_SETCORE() RTASN1TMPL_SEMICOLON_DUMMY() 923 # define RTASN1TMPL_MEMBER_EX(a_Name, a_Type, a_Api, a_Constraints) RTASN1TMPL_SEMICOLON_DUMMY() 924 # define RTASN1TMPL_MEMBER_DYN_BEGIN(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY() 925 # define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) RTASN1TMPL_SEMICOLON_DUMMY() 926 # define RTASN1TMPL_END_SEQCORE() RTASN1TMPL_SEMICOLON_DUMMY() 927 # define RTASN1TMPL_END_SETCORE() RTASN1TMPL_SEMICOLON_DUMMY() 928 # define RTASN1TMPL_BEGIN_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY() 929 # define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \ 930 RTASN1TMPL_SEMICOLON_DUMMY() 931 # define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \ 932 RTASN1TMPL_SEMICOLON_DUMMY() 933 # define RTASN1TMPL_END_PCHOICE() RTASN1TMPL_SEMICOLON_DUMMY() 934 935 # define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi) \ 936 RTASN1TMPL_DECL(int) RT_CONCAT(RTASN1TMPL_EXT_NAME,_Erase)(RT_CONCAT(P,RTASN1TMPL_TYPE) pThis, uint32_t iPosition) \ 937 { \ 938 /* Check and adjust iPosition. */ \ 939 uint32_t const cItems = pThis->cItems; \ 940 if (iPosition < cItems) \ 941 { /* likely */ } \ 942 else \ 943 { \ 944 AssertReturn(iPosition == UINT32_MAX, VERR_OUT_OF_RANGE); \ 945 AssertReturn(cItems > 0, VERR_OUT_OF_RANGE); \ 946 iPosition = cItems - 1; \ 947 } \ 948 \ 949 /* Delete the entry instance. */ \ 950 RT_CONCAT(P, a_ItemType) pErased = pThis->papItems[iPosition]; \ 951 if (RT_CONCAT(a_ItemApi,_IsPresent)(pErased)) \ 952 RT_CONCAT(a_ItemApi,_Delete)(pErased); \ 953 \ 954 /* If not the final entry, shift the other entries up and place the erased on at the end. */ \ 955 if (iPosition < cItems - 1) \ 956 { \ 957 memmove(&pThis->papItems[iPosition], &pThis->papItems[iPosition + 1], (cItems - iPosition - 1) * sizeof(void *)); \ 958 pThis->papItems[cItems - 1] = pErased; \ 959 } \ 960 /* Commit the new array size. */ \ 961 pThis->cItems = cItems - 1; \ 962 \ 963 /* Call the allocator to resize the array (ignore return). */ \ 964 RTAsn1MemResizeArray(&pThis->Allocation, (void ***)&pThis->papItems, cItems - 1, cItems); \ 965 return VINF_SUCCESS; \ 966 } \ 967 \ 968 RTASN1TMPL_DECL(int) RT_CONCAT(RTASN1TMPL_EXT_NAME,_InsertEx)(RT_CONCAT(P,RTASN1TMPL_TYPE) pThis, uint32_t iPosition, \ 969 RT_CONCAT(PC, a_ItemType) pToClone, \ 970 PCRTASN1ALLOCATORVTABLE pAllocator, uint32_t *piActualPos) \ 971 { \ 972 /* Check and adjust iPosition. */ \ 973 uint32_t const cItems = pThis->cItems; \ 974 if (iPosition <= cItems) \ 975 { /* likely */ } \ 976 else \ 977 { \ 978 AssertReturn(iPosition == UINT32_MAX, VERR_OUT_OF_RANGE); \ 979 iPosition = cItems; \ 980 } \ 981 \ 982 /* Ensure we've got space in the array. */ \ 983 int rc = RTAsn1MemResizeArray(&pThis->Allocation, (void ***)&pThis->papItems, cItems, cItems + 1); \ 984 if (RT_SUCCESS(rc)) \ 985 { \ 986 /* Initialize the new entry (which is currently at the end of the array) either with defaults or as a clone. */ \ 987 RT_CONCAT(P,a_ItemType) pInserted = pThis->papItems[cItems]; \ 988 if (RT_CONCAT(a_ItemApi,_IsPresent)(pToClone)) \ 989 rc = RT_CONCAT(a_ItemApi,_Clone)(pInserted, pToClone, pAllocator); \ 990 else \ 991 rc = RT_CONCAT(a_ItemApi,_Init)(pInserted, pAllocator); \ 992 if (RT_SUCCESS(rc)) \ 993 { \ 994 /* If not inserting at the end of the array, shift existing items out of the way and insert the new as req. */ \ 995 if (iPosition != cItems) \ 996 { \ 997 memmove(&pThis->papItems[iPosition + 1], &pThis->papItems[iPosition], (cItems - iPosition) * sizeof(void *)); \ 998 pThis->papItems[iPosition] = pInserted; \ 999 } \ 1000 \ 1001 /* Done! */ \ 1002 if (piActualPos) \ 1003 *piActualPos = iPosition; \ 1004 return VINF_SUCCESS; \ 1005 } \ 1006 RTAsn1MemResizeArray(&pThis->Allocation, (void ***)&pThis->papItems, cItems + 1, cItems); \ 1007 } \ 1008 return rc; \ 1009 } RTASN1TMPL_SEMICOLON_DUMMY() 1010 1011 # define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi) 1012 # define RTASN1TMPL_SET_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi) 912 1013 913 1014 -
trunk/include/iprt/asn1.h
r64887 r64888 738 738 739 739 740 /** Defines the typedefs and prototypes for a generic sequence-of type. */ 741 #define RTASN1_IMPL_GEN_SEQ_OF_TYPEDEFS_AND_PROTOS(a_SeqOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) \ 742 typedef struct a_SeqOfType \ 740 /** Defines the typedefs and prototypes for a generic sequence-of/set-of type. */ 741 #define RTASN1_IMPL_GEN_SEQ_OR_SET_OF_TYPEDEFS_AND_PROTOS(a_CoreType, a_CoreMember, \ 742 a_ThisType, a_ItemType, a_DeclMacro, a_ImplExtNm) \ 743 typedef struct a_ThisType \ 743 744 { \ 744 /** Sequence core. */ \745 RTASN1SEQUENCECORE SeqCore; \745 /** Sequence/set core. */ \ 746 a_CoreType a_CoreMember; \ 746 747 /** The array allocation tracker. */ \ 747 748 RTASN1ARRAYALLOCATION Allocation; \ … … 750 751 /** Array. */ \ 751 752 RT_CONCAT(P,a_ItemType) *papItems; \ 752 } a_SeqOfType; \ 753 typedef a_SeqOfType *RT_CONCAT(P,a_SeqOfType); \ 754 typedef a_SeqOfType const *RT_CONCAT(PC,a_SeqOfType); \ 755 RTASN1TYPE_STANDARD_PROTOTYPES(a_SeqOfType, a_DeclMacro, a_ImplExtNm, SeqCore.Asn1Core) 753 } a_ThisType; \ 754 typedef a_ThisType *RT_CONCAT(P,a_ThisType); \ 755 typedef a_ThisType const *RT_CONCAT(PC,a_ThisType); \ 756 a_DeclMacro(int) RT_CONCAT(a_ImplExtNm,_Erase)(RT_CONCAT(P,a_ThisType) pThis, uint32_t iPosition); \ 757 a_DeclMacro(int) RT_CONCAT(a_ImplExtNm,_InsertEx)(RT_CONCAT(P,a_ThisType) pThis, uint32_t iPosition, \ 758 RT_CONCAT(PC,a_ItemType) pToClone, \ 759 PCRTASN1ALLOCATORVTABLE pAllocator, uint32_t *piActualPos); \ 760 /** Appends entry with default content, returns index or negative error code. */ \ 761 DECLINLINE(int32_t) RT_CONCAT(a_ImplExtNm,_Append)(RT_CONCAT(P,a_ThisType) pThis) \ 762 { \ 763 uint32_t uPos = pThis->cItems; \ 764 int rc = RT_CONCAT(a_ImplExtNm,_InsertEx)(pThis, uPos, NULL /*pToClone*/, pThis->Allocation.pAllocator, &uPos); \ 765 if (RT_SUCCESS(rc)) \ 766 return uPos; \ 767 return rc; \ 768 } \ 769 RTASN1TYPE_STANDARD_PROTOTYPES(a_ThisType, a_DeclMacro, a_ImplExtNm, a_CoreMember.Asn1Core) 770 771 /** Defines the typedefs and prototypes for a generic sequence-of type. */ 772 #define RTASN1_IMPL_GEN_SEQ_OF_TYPEDEFS_AND_PROTOS(a_SeqOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) \ 773 RTASN1_IMPL_GEN_SEQ_OR_SET_OF_TYPEDEFS_AND_PROTOS(RTASN1SEQUENCECORE, SeqCore, a_SeqOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) 756 774 757 775 … … 796 814 /** Defines the typedefs and prototypes for a generic set-of type. */ 797 815 #define RTASN1_IMPL_GEN_SET_OF_TYPEDEFS_AND_PROTOS(a_SetOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) \ 798 typedef struct a_SetOfType \ 799 { \ 800 /** Set core. */ \ 801 RTASN1SETCORE SetCore; \ 802 /** The array allocation tracker. */ \ 803 RTASN1ARRAYALLOCATION Allocation; \ 804 /** Items in the array. */ \ 805 uint32_t cItems; \ 806 /** Array. */ \ 807 RT_CONCAT(P,a_ItemType) *papItems; \ 808 } a_SetOfType; \ 809 typedef a_SetOfType *RT_CONCAT(P,a_SetOfType); \ 810 typedef a_SetOfType const *RT_CONCAT(PC,a_SetOfType); \ 811 RTASN1TYPE_STANDARD_PROTOTYPES(a_SetOfType, a_DeclMacro, a_ImplExtNm, SetCore.Asn1Core) 816 RTASN1_IMPL_GEN_SEQ_OR_SET_OF_TYPEDEFS_AND_PROTOS(RTASN1SETCORE, SetCore, a_SetOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) 812 817 813 818 -
trunk/include/iprt/mangling.h
r64883 r64888 3378 3378 # define RTErrConvertFromDarwinKern RT_MANGLER(RTErrConvertFromDarwinKern) 3379 3379 3380 # define RTAsn1BitString_Erase RT_MANGLER(RTAsn1BitString_Erase) 3381 # define RTAsn1BitString_Erase RT_MANGLER(RTAsn1BitString_Erase) 3382 # define RTAsn1BitString_InsertEx RT_MANGLER(RTAsn1BitString_InsertEx) 3383 # define RTAsn1BitString_InsertEx RT_MANGLER(RTAsn1BitString_InsertEx) 3384 # define RTAsn1Boolean_Erase RT_MANGLER(RTAsn1Boolean_Erase) 3385 # define RTAsn1Boolean_Erase RT_MANGLER(RTAsn1Boolean_Erase) 3386 # define RTAsn1Boolean_InsertEx RT_MANGLER(RTAsn1Boolean_InsertEx) 3387 # define RTAsn1Boolean_InsertEx RT_MANGLER(RTAsn1Boolean_InsertEx) 3388 # define RTAsn1Core_Erase RT_MANGLER(RTAsn1Core_Erase) 3389 # define RTAsn1Core_Erase RT_MANGLER(RTAsn1Core_Erase) 3390 # define RTAsn1Core_InsertEx RT_MANGLER(RTAsn1Core_InsertEx) 3391 # define RTAsn1Core_InsertEx RT_MANGLER(RTAsn1Core_InsertEx) 3392 # define RTAsn1Integer_Erase RT_MANGLER(RTAsn1Integer_Erase) 3393 # define RTAsn1Integer_Erase RT_MANGLER(RTAsn1Integer_Erase) 3394 # define RTAsn1Integer_InsertEx RT_MANGLER(RTAsn1Integer_InsertEx) 3395 # define RTAsn1Integer_InsertEx RT_MANGLER(RTAsn1Integer_InsertEx) 3396 # define RTAsn1ObjId_Erase RT_MANGLER(RTAsn1ObjId_Erase) 3397 # define RTAsn1ObjId_Erase RT_MANGLER(RTAsn1ObjId_Erase) 3398 # define RTAsn1ObjId_InsertEx RT_MANGLER(RTAsn1ObjId_InsertEx) 3399 # define RTAsn1ObjId_InsertEx RT_MANGLER(RTAsn1ObjId_InsertEx) 3400 # define RTAsn1OctetString_Erase RT_MANGLER(RTAsn1OctetString_Erase) 3401 # define RTAsn1OctetString_Erase RT_MANGLER(RTAsn1OctetString_Erase) 3402 # define RTAsn1OctetString_InsertEx RT_MANGLER(RTAsn1OctetString_InsertEx) 3403 # define RTAsn1OctetString_InsertEx RT_MANGLER(RTAsn1OctetString_InsertEx) 3404 # define RTAsn1SeqOfObjIds_Erase RT_MANGLER(RTAsn1SeqOfObjIds_Erase) 3405 # define RTAsn1SeqOfObjIds_InsertEx RT_MANGLER(RTAsn1SeqOfObjIds_InsertEx) 3406 # define RTAsn1String_Erase RT_MANGLER(RTAsn1String_Erase) 3407 # define RTAsn1String_Erase RT_MANGLER(RTAsn1String_Erase) 3408 # define RTAsn1String_InsertEx RT_MANGLER(RTAsn1String_InsertEx) 3409 # define RTAsn1String_InsertEx RT_MANGLER(RTAsn1String_InsertEx) 3410 # define RTAsn1Time_Erase RT_MANGLER(RTAsn1Time_Erase) 3411 # define RTAsn1Time_Erase RT_MANGLER(RTAsn1Time_Erase) 3412 # define RTAsn1Time_InsertEx RT_MANGLER(RTAsn1Time_InsertEx) 3413 # define RTAsn1Time_InsertEx RT_MANGLER(RTAsn1Time_InsertEx) 3414 # define RTCrPkcs7Attribute_Erase RT_MANGLER(RTCrPkcs7Attribute_Erase) 3415 # define RTCrPkcs7Attribute_InsertEx RT_MANGLER(RTCrPkcs7Attribute_InsertEx) 3416 # define RTCrPkcs7Cert_Erase RT_MANGLER(RTCrPkcs7Cert_Erase) 3417 # define RTCrPkcs7Cert_InsertEx RT_MANGLER(RTCrPkcs7Cert_InsertEx) 3418 # define RTCrPkcs7ContentInfo_Erase RT_MANGLER(RTCrPkcs7ContentInfo_Erase) 3419 # define RTCrPkcs7ContentInfo_InsertEx RT_MANGLER(RTCrPkcs7ContentInfo_InsertEx) 3420 # define RTCrPkcs7SignedData_Erase RT_MANGLER(RTCrPkcs7SignedData_Erase) 3421 # define RTCrPkcs7SignedData_InsertEx RT_MANGLER(RTCrPkcs7SignedData_InsertEx) 3422 # define RTCrPkcs7SignerInfo_Erase RT_MANGLER(RTCrPkcs7SignerInfo_Erase) 3423 # define RTCrPkcs7SignerInfo_InsertEx RT_MANGLER(RTCrPkcs7SignerInfo_InsertEx) 3424 # define RTCrRsaOtherPrimeInfo_Erase RT_MANGLER(RTCrRsaOtherPrimeInfo_Erase) 3425 # define RTCrRsaOtherPrimeInfo_InsertEx RT_MANGLER(RTCrRsaOtherPrimeInfo_InsertEx) 3426 # define RTCrSpcSerializedObjectAttribute_Erase RT_MANGLER(RTCrSpcSerializedObjectAttribute_Erase) 3427 # define RTCrSpcSerializedObjectAttribute_InsertEx RT_MANGLER(RTCrSpcSerializedObjectAttribute_InsertEx) 3428 # define RTCrTafTrustAnchorChoice_Erase RT_MANGLER(RTCrTafTrustAnchorChoice_Erase) 3429 # define RTCrTafTrustAnchorChoice_InsertEx RT_MANGLER(RTCrTafTrustAnchorChoice_InsertEx) 3430 # define RTCrX509AlgorithmIdentifier_Erase RT_MANGLER(RTCrX509AlgorithmIdentifier_Erase) 3431 # define RTCrX509AlgorithmIdentifier_InsertEx RT_MANGLER(RTCrX509AlgorithmIdentifier_InsertEx) 3432 # define RTCrX509AttributeTypeAndValue_Erase RT_MANGLER(RTCrX509AttributeTypeAndValue_Erase) 3433 # define RTCrX509AttributeTypeAndValue_InsertEx RT_MANGLER(RTCrX509AttributeTypeAndValue_InsertEx) 3434 # define RTCrX509Certificate_Erase RT_MANGLER(RTCrX509Certificate_Erase) 3435 # define RTCrX509Certificate_InsertEx RT_MANGLER(RTCrX509Certificate_InsertEx) 3436 # define RTCrX509Extension_Erase RT_MANGLER(RTCrX509Extension_Erase) 3437 # define RTCrX509Extension_InsertEx RT_MANGLER(RTCrX509Extension_InsertEx) 3438 # define RTCrX509GeneralName_Erase RT_MANGLER(RTCrX509GeneralName_Erase) 3439 # define RTCrX509GeneralName_InsertEx RT_MANGLER(RTCrX509GeneralName_InsertEx) 3440 # define RTCrX509GeneralSubtree_Erase RT_MANGLER(RTCrX509GeneralSubtree_Erase) 3441 # define RTCrX509GeneralSubtree_InsertEx RT_MANGLER(RTCrX509GeneralSubtree_InsertEx) 3442 # define RTCrX509PolicyInformation_Erase RT_MANGLER(RTCrX509PolicyInformation_Erase) 3443 # define RTCrX509PolicyInformation_InsertEx RT_MANGLER(RTCrX509PolicyInformation_InsertEx) 3444 # define RTCrX509PolicyMapping_Erase RT_MANGLER(RTCrX509PolicyMapping_Erase) 3445 # define RTCrX509PolicyMapping_InsertEx RT_MANGLER(RTCrX509PolicyMapping_InsertEx) 3446 # define RTCrX509PolicyQualifierInfo_Erase RT_MANGLER(RTCrX509PolicyQualifierInfo_Erase) 3447 # define RTCrX509PolicyQualifierInfo_InsertEx RT_MANGLER(RTCrX509PolicyQualifierInfo_InsertEx) 3448 # define RTCrX509RelativeDistinguishedName_Erase RT_MANGLER(RTCrX509RelativeDistinguishedName_Erase) 3449 # define RTCrX509RelativeDistinguishedName_InsertEx RT_MANGLER(RTCrX509RelativeDistinguishedName_InsertEx) 3450 3380 3451 /* 3381 3452 * Stable variables (alphabetical order):
Note:
See TracChangeset
for help on using the changeset viewer.