From 90d6568af6168bbb639c08a2d6f51089f1bc2de9 Mon Sep 17 00:00:00 2001 From: Hussein Kasem Date: Fri, 9 Aug 2019 13:26:51 +0200 Subject: [PATCH] Extract status list from pEpEngine.h instead of having them hardcoded. --- .hgignore | 1 + src/Makefile | 6 ++- src/Makefile.conf | 4 +- src/pEp.yml2 | 99 +---------------------------------------------- 4 files changed, 10 insertions(+), 100 deletions(-) diff --git a/.hgignore b/.hgignore index 4af0472..fbfd9cb 100644 --- a/.hgignore +++ b/.hgignore @@ -37,6 +37,7 @@ IdentityFlags.java SyncHandshakeSignal.java CipherSuite.java +status_list.yml2 ndk*/ # ignore vim workspace diff --git a/src/Makefile b/src/Makefile index df20668..80b530b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -64,7 +64,7 @@ C_SOURCES=foundation_pEp_jniadapter_Engine.cc \ .PHONY: all all: $(JAR) $(SHARED) -$(JAR): $(JAVA_SOURCES) $(C_SOURCES) +$(JAR): status_list.yml2 $(JAVA_SOURCES) $(C_SOURCES) $(JP)/javac foundation/pEp/jniadapter/*.java $(JP)/jar cf $@ foundation/pEp/jniadapter/*.class @@ -88,6 +88,9 @@ $(LIBRARY): foundation_pEp_jniadapter_AbstractEngine.o foundation_pEp_jniadapter $(SHARED): $(LIBRARY) $(CXX) *.o $(LDFLAGS) $(LDLIBS) -o $@ +status_list.yml2: pEp.yml2 $(ENGINE_SRC_DIR)/pEpEngine.h + bash ../utils/extract_pEp_status_codes_from_engine.sh $(word 2,$^) $@ + foundation/pEp/jniadapter/pEpException.java: pEp.yml2 gen_java_exceptions.ysl2 pEp.yml2 $(YML2_PROC) -y gen_java_exceptions.ysl2 $< -o $@ @@ -131,3 +134,4 @@ clean: rm -f foundation/pEp/jniadapter/CipherSuite.java rm -f throw_pEp_exception.* rm -f foundation_pEp_jniadapter_Message.cc foundation_pEp_jniadapter_Engine.cc + rm -f status_list.yml2 diff --git a/src/Makefile.conf b/src/Makefile.conf index 91396e8..637278a 100644 --- a/src/Makefile.conf +++ b/src/Makefile.conf @@ -48,7 +48,9 @@ YML2_OPTS=--encoding=utf8 ENGINE_LIB=-L$(HOME)/lib #ENGINE_LIB=-L$(HOME)/local/lib -ENGINE_INC=-I$(HOME)/include +ENGINE_SRC_DIR=$(HOME)/src/pEpEngine/src + +ENGINE_INC=-I$(ENGINE_INC_DIR) #ENGINE_INC=-I$(HOME)/local/inc diff --git a/src/pEp.yml2 b/src/pEp.yml2 index da4e8a7..e0e3d6b 100644 --- a/src/pEp.yml2 +++ b/src/pEp.yml2 @@ -8,104 +8,7 @@ decl basic @type @name; namespace pEp { exception Status { - pEp_status_ok > 0 - - pEp_init_cannot_load_gpgme > 0x0110 - pEp_init_gpgme_init_failed > 0x0111 - pEp_init_no_gpg_home > 0x0112 - pEp_init_netpgp_init_failed > 0x0113 - pEp_init_cannot_determine_gpg_version > 0x0114 - pEp_init_unsupported_gpg_version > 0x0115 - pEp_init_cannot_config_gpg_agent > 0x0116 - - pEp_init_sqlite3_without_mutex > 0x0120 - pEp_init_cannot_open_db > 0x0121 - pEp_init_cannot_open_system_db > 0x0122 - pEp_unknown_db_error > 0x01ff - - pEp_key_not_found > 0x0201 - pEp_key_has_ambig_name > 0x0202 - pEp_get_key_failed > 0x0203 - pEp_cannot_export_key > 0x0204 - pEp_cannot_edit_key > 0x0205 - pEp_key_unsuitable > 0x0206 - pEp_malformed_key_reset_msg > 0x0210 - pEp_key_not_reset > 0x0211 - pEp_cannot_delete_key > 0x0212 - - pEp_key_imported > 0x0220 - pEp_no_key_imported > 0x0221 - pEp_key_import_status_unknown > 0x0222 - pEp_some_keys_imported > 0x0223 - - pEp_cannot_find_identity > 0x0301 - pEp_cannot_set_person > 0x0381 - pEp_cannot_set_pgp_keypair > 0x0382 - pEp_cannot_set_identity > 0x0383 - pEp_cannot_set_trust > 0x0384 - pEp_key_blacklisted > 0x0385 - pEp_cannot_find_person > 0x0386 - - pEp_cannot_find_alias > 0x0391 - pEp_cannot_set_alias > 0x0392 - - pEp_unencrypted > 0x0400 - pEp_verified > 0x0401 - pEp_decrypted > 0x0402 - pEp_decrypted_and_verified > 0x0403 - pEp_decrypt_wrong_format > 0x0404 - pEp_decrypt_no_key > 0x0405 - pEp_decrypt_signature_does_not_match > 0x0406 - pEp_verify_no_key > 0x0407 - pEp_verified_and_trusted > 0x0408 - pEp_cannot_reencrypt > 0x0409 - pEp_cannot_decrypt_unknown > 0x04ff - - pEp_trustword_not_found > 0x0501 - pEp_trustwords_fpr_wrong_length > 0x0502 - pEp_trustwords_duplicate_fpr > 0x0503 - - pEp_cannot_create_key > 0x0601 - pEp_cannot_send_key > 0x0602 - - pEp_phrase_not_found > 0x0701 - - pEp_send_function_not_registered > 0x0801 - pEp_contraints_violated > 0x0802 - pEp_cannot_encode > 0x0803 - - pEp_sync_no_notify_callback > 0x0901 - pEp_sync_illegal_message > 0x0902 - pEp_sync_no_inject_callback > 0x0903 - pEp_sync_no_channel > 0x0904 - pEp_sync_cannot_encrypt > 0x0905 - pEp_sync_no_message_send_callback > 0x0906 - pEp_sync_cannot_start > 0x0907 - - pEp_cannot_increase_sequence > 0x0971 - - pEp_statemachine_error > 0x0980 - pEp_no_trust > 0x0981 - pEp_statemachine_invalid_state > 0x0982 - pEp_statemachine_invalid_event > 0x0983 - pEp_statemachine_invalid_condition > 0x0984 - pEp_statemachine_invalid_action > 0x0985 - pEp_statemachine_inhibited_event > 0x0986 - pEp_statemachine_cannot_send > 0x0987 - - pEp_commit_failed > 0xff01 - pEp_message_consume > 0xff02 - pEp_message_ignore > 0xff03 - pEp_cannot_config > 0xff04 - - pEp_record_not_found > -6 - pEp_cannot_create_temp_file > -5 - pEp_illegal_value > -4 - pEp_buffer_too_small > -3 - pEp_out_of_memory > -2 - pEp_unknown_error > -1 - - pEp_version_mismatch > -7 + include ./status_list.yml2 }; enum Color {