From 8739f7fccb7cafc54ca0f5fa074c9a740f7048ba Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 5 Jul 2018 10:31:29 +0000 Subject: Make tox.c unambiguously parseable. Rules: 1. Constants are uppercase names: THE_CONSTANT. 2. SUE[1] types start with an uppercase letter and have at least one lowercase letter in it: The_Type, THE_Type. 3. Function types end in "_cb": tox_friend_connection_cb. 4. Variable and function names are all lowercase: the_function. This makes it easier for humans reading the code to determine what an identifier means. I'm not convinced by the enum type name change, but I don't know a better rule. Currently, a lot of enum types are spelled like constants, which is confusing. [1] struct/union/enum --- toxcore/tox.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'toxcore/tox.h') diff --git a/toxcore/tox.h b/toxcore/tox.h index 45ebf176..faf4e559 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -2976,4 +2976,40 @@ uint16_t tox_self_get_tcp_port(const Tox *tox, TOX_ERR_GET_PORT *error); } #endif +typedef TOX_ERR_OPTIONS_NEW Tox_Err_Options_New; +typedef TOX_ERR_NEW Tox_Err_New; +typedef TOX_ERR_BOOTSTRAP Tox_Err_Bootstrap; +typedef TOX_ERR_SET_INFO Tox_Err_Set_Info; +typedef TOX_ERR_FRIEND_ADD Tox_Err_Friend_Add; +typedef TOX_ERR_FRIEND_DELETE Tox_Err_Friend_Delete; +typedef TOX_ERR_FRIEND_BY_PUBLIC_KEY Tox_Err_Friend_By_Public_Key; +typedef TOX_ERR_FRIEND_GET_PUBLIC_KEY Tox_Err_Friend_Get_Public_Key; +typedef TOX_ERR_FRIEND_GET_LAST_ONLINE Tox_Err_Friend_Get_Last_Online; +typedef TOX_ERR_FRIEND_QUERY Tox_Err_Friend_Query; +typedef TOX_ERR_SET_TYPING Tox_Err_Set_Typing; +typedef TOX_ERR_FRIEND_SEND_MESSAGE Tox_Err_Friend_Send_Message; +typedef TOX_ERR_FILE_CONTROL Tox_Err_File_Control; +typedef TOX_ERR_FILE_SEEK Tox_Err_File_Seek; +typedef TOX_ERR_FILE_GET Tox_Err_File_Get; +typedef TOX_ERR_FILE_SEND Tox_Err_File_Send; +typedef TOX_ERR_FILE_SEND_CHUNK Tox_Err_File_Send_Chunk; +typedef TOX_ERR_CONFERENCE_NEW Tox_Err_Conference_New; +typedef TOX_ERR_CONFERENCE_DELETE Tox_Err_Conference_Delete; +typedef TOX_ERR_CONFERENCE_PEER_QUERY Tox_Err_Conference_Peer_Query; +typedef TOX_ERR_CONFERENCE_INVITE Tox_Err_Conference_Invite; +typedef TOX_ERR_CONFERENCE_JOIN Tox_Err_Conference_Join; +typedef TOX_ERR_CONFERENCE_SEND_MESSAGE Tox_Err_Conference_Send_Message; +typedef TOX_ERR_CONFERENCE_TITLE Tox_Err_Conference_Title; +typedef TOX_ERR_CONFERENCE_GET_TYPE Tox_Err_Conference_Get_Type; +typedef TOX_ERR_FRIEND_CUSTOM_PACKET Tox_Err_Friend_Custom_Packet; +typedef TOX_ERR_GET_PORT Tox_Err_Get_Port; +typedef TOX_USER_STATUS Tox_User_Status; +typedef TOX_MESSAGE_TYPE Tox_Message_Type; +typedef TOX_PROXY_TYPE Tox_Proxy_Type; +typedef TOX_SAVEDATA_TYPE Tox_Savedata_Type; +typedef TOX_LOG_LEVEL Tox_Log_Level; +typedef TOX_CONNECTION Tox_Connection; +typedef TOX_FILE_CONTROL Tox_File_Control; +typedef TOX_CONFERENCE_TYPE Tox_Conference_Type; + #endif -- cgit v1.2.3