From: Javier Sancho Date: Fri, 8 May 2020 15:40:04 +0000 (+0200) Subject: file-archive X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=cb00a4ce59df131e82f28deb4160015baae1fabe;p=guile-irrlicht.git file-archive --- diff --git a/src/file-archive.cpp b/src/file-archive.cpp index 97d842b..10d3dbd 100644 --- a/src/file-archive.cpp +++ b/src/file-archive.cpp @@ -23,59 +23,49 @@ #include #include "file-archive.h" -extern "C" { - void - init_file_archive (void) - { - init_file_archive_type (); - } +using namespace irr; - DEFINE_WRAPPED_TYPE (irr::io::IFileArchive*, "file-archive", - init_file_archive_type, file_archive_p, - wrap_file_archive, unwrap_file_archive); - - irr::io::E_FILE_ARCHIVE_TYPE - scm_to_file_archive_type (SCM file_archive_type) - { - char* type = scm_to_utf8_stringn (scm_symbol_to_string (file_archive_type), NULL); - if (!strcmp (type, "zip")) - { - return irr::io::EFAT_ZIP; - } - else if (!strcmp (type, "gzip")) - { - return irr::io::EFAT_GZIP; - } - else if (!strcmp (type, "folder")) - { - return irr::io::EFAT_FOLDER; - } - else if (!strcmp (type, "pak")) - { - return irr::io::EFAT_PAK; - } - else if (!strcmp (type, "npk")) - { - return irr::io::EFAT_NPK; - } - else if (!strcmp (type, "tar")) - { - return irr::io::EFAT_TAR; - } - else if (!strcmp (type, "wad")) - { - return irr::io::EFAT_WAD; - } - else if (!strcmp (type, "unknown")) - { - return irr::io::EFAT_UNKNOWN; - } - else - { - scm_error (scm_arg_type_key, NULL, "Wrong file archive type: ~S", - scm_list_1 (file_archive_type), scm_list_1 (file_archive_type)); - } - } +io::E_FILE_ARCHIVE_TYPE +scm_to_file_archive_type (SCM file_archive_type) +{ + char* type = scm_to_utf8_stringn (scm_symbol_to_string (file_archive_type), NULL); + if (!strcmp (type, "zip")) + { + return io::EFAT_ZIP; + } + else if (!strcmp (type, "gzip")) + { + return io::EFAT_GZIP; + } + else if (!strcmp (type, "folder")) + { + return io::EFAT_FOLDER; + } + else if (!strcmp (type, "pak")) + { + return io::EFAT_PAK; + } + else if (!strcmp (type, "npk")) + { + return io::EFAT_NPK; + } + else if (!strcmp (type, "tar")) + { + return io::EFAT_TAR; + } + else if (!strcmp (type, "wad")) + { + return io::EFAT_WAD; + } + else if (!strcmp (type, "unknown")) + { + return io::EFAT_UNKNOWN; + } + else + { + scm_error (scm_arg_type_key, NULL, "Wrong file archive type: ~S", + scm_list_1 (file_archive_type), scm_list_1 (file_archive_type)); + } } diff --git a/src/file-archive.h b/src/file-archive.h index 1679ad1..5c0635c 100644 --- a/src/file-archive.h +++ b/src/file-archive.h @@ -24,19 +24,8 @@ #include #include -#include "wrapped.h" -extern "C" { - - void - init_file_archive (void); - - DECLARE_WRAPPED_TYPE (irr::io::IFileArchive*, init_file_archive_type, - file_archive_p, wrap_file_archive, unwrap_file_archive); - - irr::io::E_FILE_ARCHIVE_TYPE - scm_to_file_archive_type (SCM file_archive_type); - -} +irr::io::E_FILE_ARCHIVE_TYPE +scm_to_file_archive_type (SCM file_archive_type); #endif