From c6637a85905c776b64b095282ae1a90c0cc17fa1 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 22 Feb 2012 16:50:19 +0000 Subject: [PATCH 5/6] Generate TP_NUM_foo for every generated enum Unlike NUM_TP_foo, these are introspectable. --- docs/reference/telepathy-glib-sections.txt | 52 ++++++++++++++++++++++++++++ tools/c-constants-gen.py | 18 +++++++-- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index 41793a6..a3cc3f7 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -1930,6 +1930,7 @@ TP_STRUCT_TYPE_SERVICE_POINT_INFO # Channel - Contact Search TpChannelContactSearchState +TP_NUM_CHANNEL_CONTACT_SEARCH_STATES NUM_TP_CHANNEL_CONTACT_SEARCH_STATES TP_HASH_TYPE_CONTACT_SEARCH_MAP TP_HASH_TYPE_CONTACT_SEARCH_RESULT_MAP @@ -2790,129 +2791,180 @@ TP_TEXT_MIXIN telepathy-glib/telepathy-glib.h enums TpHandleType +TP_NUM_HANDLE_TYPES NUM_TP_HANDLE_TYPES TpConnMgrParamFlags TpConnectionStatus +TP_NUM_CONNECTION_STATUSES NUM_TP_CONNECTION_STATUSES TpConnectionStatusReason +TP_NUM_CONNECTION_STATUS_REASONS NUM_TP_CONNECTION_STATUS_REASONS TpConnectionAliasFlags TpConnectionCapabilityFlags TpConnectionPresenceType +TP_NUM_CONNECTION_PRESENCE_TYPES NUM_TP_CONNECTION_PRESENCE_TYPES TpDTMFEvent +TP_NUM_DTMF_EVENTS NUM_TP_DTMF_EVENTS tp_dtmf_event_to_char TpMediaStreamType NUM_TP_MEDIA_STREAM_TYPES +TP_NUM_MEDIA_STREAM_TYPES TpMediaStreamState NUM_TP_MEDIA_STREAM_STATES +TP_NUM_MEDIA_STREAM_STATES TpMediaStreamDirection NUM_TP_MEDIA_STREAM_DIRECTIONS +TP_NUM_MEDIA_STREAM_DIRECTIONS TpMediaStreamPendingSend TpChannelMediaCapabilities TpChannelTextSendError +TP_NUM_CHANNEL_TEXT_SEND_ERRORS NUM_TP_CHANNEL_TEXT_SEND_ERRORS TpChannelTextMessageType NUM_TP_CHANNEL_TEXT_MESSAGE_TYPES +TP_NUM_CHANNEL_TEXT_MESSAGE_TYPES TpChannelTextMessageFlags TpChannelChatState NUM_TP_CHANNEL_CHAT_STATES +TP_NUM_CHANNEL_CHAT_STATES TpChannelGroupFlags TpChannelGroupChangeReason NUM_TP_CHANNEL_GROUP_CHANGE_REASONS +TP_NUM_CHANNEL_GROUP_CHANGE_REASONS TpChannelPasswordFlags TpContactBlockingCapabilities TpDeliveryReportingSupportFlags TpDeliveryStatus NUM_TP_DELIVERY_STATUSES +TP_NUM_DELIVERY_STATUSES TpMediaStreamError NUM_TP_MEDIA_STREAM_ERRORS +TP_NUM_MEDIA_STREAM_ERRORS TpMediaStreamBaseProto NUM_TP_MEDIA_STREAM_BASE_PROTOS +TP_NUM_MEDIA_STREAM_BASE_PROTOS TpMediaStreamTransportType NUM_TP_MEDIA_STREAM_TRANSPORT_TYPES +TP_NUM_MEDIA_STREAM_TRANSPORT_TYPES TpPropertyFlags TpMessagePartSupportFlags TpMessageSendingFlags NUM_TP_SOCKET_ACCESS_CONTROLS +TP_NUM_SOCKET_ACCESS_CONTROLS TpSocketAccessControl NUM_TP_SOCKET_ADDRESS_TYPES +TP_NUM_SOCKET_ADDRESS_TYPES TpSocketAddressType NUM_TP_TUBE_STATES +TP_NUM_TUBE_STATES TpTubeState NUM_TP_TUBE_TYPES +TP_NUM_TUBE_TYPES TpTubeType TpChannelCallStateFlags NUM_TP_LOCAL_HOLD_STATES +TP_NUM_LOCAL_HOLD_STATES TpLocalHoldState NUM_TP_LOCAL_HOLD_STATE_REASONS +TP_NUM_LOCAL_HOLD_STATE_REASONS TpLocalHoldStateReason TpAccessControlType NUM_TP_ACCESS_CONTROL_TYPES +TP_NUM_ACCESS_CONTROL_TYPES TpRichPresenceAccessControlType NUM_TP_RICH_PRESENCE_ACCESS_CONTROL_TYPES +TP_NUM_RICH_PRESENCE_ACCESS_CONTROL_TYPES TpFileHashType NUM_TP_FILE_HASH_TYPES +TP_NUM_FILE_HASH_TYPES TpFileTransferState NUM_TP_FILE_TRANSFER_STATES +TP_NUM_FILE_TRANSFER_STATES TpFileTransferStateChangeReason NUM_TP_FILE_TRANSFER_STATE_CHANGE_REASONS +TP_NUM_FILE_TRANSFER_STATE_CHANGE_REASONS TpTubeChannelState NUM_TP_TUBE_CHANNEL_STATES +TP_NUM_TUBE_CHANNEL_STATES TpDebugLevel NUM_TP_DEBUG_LEVELS +TP_NUM_DEBUG_LEVELS TpContactInfoFlags TpContactInfoFieldFlags TpLocationFeatures TpServicePointType NUM_TP_SERVICE_POINT_TYPES +TP_NUM_SERVICE_POINT_TYPES TpAnonymityModeFlags TpStorageRestrictionFlags TpTLSCertificateRejectReason NUM_TP_TLS_CERTIFICATE_REJECT_REASONS +TP_NUM_TLS_CERTIFICATE_REJECT_REASONS TpTLSCertificateState NUM_TP_TLS_CERTIFICATE_STATES +TP_NUM_TLS_CERTIFICATE_STATES TpContactMetadataStorageType NUM_TP_CONTACT_METADATA_STORAGE_TYPES +TP_NUM_CONTACT_METADATA_STORAGE_TYPES TpSubscriptionState NUM_TP_SUBSCRIPTION_STATES +TP_NUM_SUBSCRIPTION_STATES TpContactListState NUM_TP_CONTACT_LIST_STATES +TP_NUM_CONTACT_LIST_STATES TpHTTPMethod NUM_TP_HTTP_METHODS +TP_NUM_HTTP_METHODS TpMailNotificationFlags TpSASLAbortReason NUM_TP_SASL_ABORT_REASONS +TP_NUM_SASL_ABORT_REASONS TpSASLStatus NUM_TP_SASL_STATUSES +TP_NUM_SASL_STATUSES TpCaptchaStatus NUM_TP_CAPTCHA_STATUSES +TP_NUM_CAPTCHA_STATUSES TpCaptchaCancelReason NUM_TP_CAPTCHA_CANCEL_REASONS +TP_NUM_CAPTCHA_CANCEL_REASONS TpCaptchaFlags TpCallContentDisposition NUM_TP_CALL_CONTENT_DISPOSITIONS +TP_NUM_CALL_CONTENT_DISPOSITIONS TpCallContentPacketizationType NUM_TP_CALL_CONTENT_PACKETIZATION_TYPES +TP_NUM_CALL_CONTENT_PACKETIZATION_TYPES TpCallState NUM_TP_CALL_STATES +TP_NUM_CALL_STATES TpCallStateChangeReason NUM_TP_CALL_STATE_CHANGE_REASONS +TP_NUM_CALL_STATE_CHANGE_REASONS TpCallStreamCandidateType NUM_TP_CALL_STREAM_CANDIDATE_TYPES +TP_NUM_CALL_STREAM_CANDIDATE_TYPES TpRCPTXRRTTMode NUM_TP_RCPT_XR_RTT_MODES +TP_NUM_RCPT_XR_RTT_MODES TpSendingState NUM_TP_SENDING_STATES +TP_NUM_SENDING_STATES TpStreamComponent NUM_TP_STREAM_COMPONENTS +TP_NUM_STREAM_COMPONENTS TpStreamEndpointState NUM_TP_STREAM_ENDPOINT_STATES +TP_NUM_STREAM_ENDPOINT_STATES TpStreamFlowState NUM_TP_STREAM_FLOW_STATES +TP_NUM_STREAM_FLOW_STATES TpStreamTransportType NUM_TP_STREAM_TRANSPORT_TYPES +TP_NUM_STREAM_TRANSPORT_TYPES TpCallFlags TpCallMemberFlags TpRTCPXRStatisticsFlags diff --git a/tools/c-constants-gen.py b/tools/c-constants-gen.py index ff2a24d..d04e034 100644 --- a/tools/c-constants-gen.py +++ b/tools/c-constants-gen.py @@ -123,19 +123,29 @@ extern "C" { self.d("""\ /** - * NUM_%(upper-plural)s: (skip) + * %(upper-prefix)sNUM_%(upper-plural)s: * * 1 higher than the highest valid value of #%(mixed-name)s. */ + +/** + * NUM_%(upper-prefix)s%(upper-plural)s: (skip) + * + * 1 higher than the highest valid value of #%(mixed-name)s. + * In new code, use %(upper-prefix)sNUM_%(upper-plural)s instead. + */ """ % {'mixed-name' : (self.prefix + name).replace('_', ''), - 'upper-plural' : (self.prefix + name_plural).upper(), + 'upper-prefix' : self.prefix.upper(), + 'upper-plural' : name_plural.upper(), 'last-val' : vals[-1].getAttribute('value')}) self.write("""\ -#define NUM_%(upper-plural)s (%(last-val)s+1) +#define %(upper-prefix)sNUM_%(upper-plural)s (%(last-val)s+1) +#define NUM_%(upper-prefix)s%(upper-plural)s %(upper-prefix)sNUM_%(upper-plural)s """ % {'mixed-name' : (self.prefix + name).replace('_', ''), - 'upper-plural' : (self.prefix + name_plural).upper(), + 'upper-prefix' : self.prefix.upper(), + 'upper-plural' : name_plural.upper(), 'last-val' : vals[-1].getAttribute('value')}) def do_val(self, val, value_prefix): -- 1.7.9.1