From: Stoiko Ivanov Date: Wed, 2 Jun 2021 17:04:47 +0000 (+0000) Subject: remove fallback header files X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f0ad0d532f2d098f3dd4865681ee0b2f31044b56;p=libxdgmime-perl.git remove fallback header files they get recreated by Makefile.PL, if ExtUtils::Constant is present (which is the case on debian if perl-modules-$perlver is installed, which itself is a dependency of perl) Signed-off-by: Stoiko Ivanov --- diff --git a/Xdgmime/.gitignore b/Xdgmime/.gitignore index a180346..5bae0c8 100644 --- a/Xdgmime/.gitignore +++ b/Xdgmime/.gitignore @@ -1 +1,2 @@ ppport.h +fallback/ diff --git a/Xdgmime/fallback/const-c.inc b/Xdgmime/fallback/const-c.inc deleted file mode 100644 index 004c272..0000000 --- a/Xdgmime/fallback/const-c.inc +++ /dev/null @@ -1,447 +0,0 @@ -#define PERL_constant_NOTFOUND 1 -#define PERL_constant_NOTDEF 2 -#define PERL_constant_ISIV 3 -#define PERL_constant_ISNO 4 -#define PERL_constant_ISNV 5 -#define PERL_constant_ISPV 6 -#define PERL_constant_ISPVN 7 -#define PERL_constant_ISSV 8 -#define PERL_constant_ISUNDEF 9 -#define PERL_constant_ISUV 10 -#define PERL_constant_ISYES 11 - -#ifndef NVTYPE -typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ -#endif -#ifndef aTHX_ -#define aTHX_ /* 5.6 or later define this for threading support. */ -#endif -#ifndef pTHX_ -#define pTHX_ /* 5.6 or later define this for threading support. */ -#endif - -static int -constant_25 (pTHX_ const char *name, IV *iv_return) { - /* When generated this function returned values for the list of names given - here. However, subsequent manual editing may have added or removed some. - _xdg_mime_mime_type_equal xdg_mime_get_generic_icon - xdg_mime_get_mime_parents xdg_mime_media_type_equal */ - /* Offset 13 gives the best switch position. */ - switch (name[13]) { - case 'a': - if (memEQ(name, "xdg_mime_media_type_equal", 25)) { - /* ^ */ -#ifdef xdg_mime_media_type_equal - *iv_return = xdg_mime_media_type_equal; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'e': - if (memEQ(name, "_xdg_mime_mime_type_equal", 25)) { - /* ^ */ -#ifdef _xdg_mime_mime_type_equal - *iv_return = _xdg_mime_mime_type_equal; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'g': - if (memEQ(name, "xdg_mime_get_generic_icon", 25)) { - /* ^ */ -#ifdef xdg_mime_get_generic_icon - *iv_return = xdg_mime_get_generic_icon; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'm': - if (memEQ(name, "xdg_mime_get_mime_parents", 25)) { - /* ^ */ -#ifdef xdg_mime_get_mime_parents - *iv_return = xdg_mime_get_mime_parents; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - return PERL_constant_NOTFOUND; -} - -static int -constant_27 (pTHX_ const char *name, IV *iv_return) { - /* When generated this function returned values for the list of names given - here. However, subsequent manual editing may have added or removed some. - _xdg_mime_unalias_mime_type xdg_mime_is_valid_mime_type - xdg_mime_mime_type_subclass */ - /* Offset 14 gives the best switch position. */ - switch (name[14]) { - case 'i': - if (memEQ(name, "_xdg_mime_unalias_mime_type", 27)) { - /* ^ */ -#ifdef _xdg_mime_unalias_mime_type - *iv_return = _xdg_mime_unalias_mime_type; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'l': - if (memEQ(name, "xdg_mime_is_valid_mime_type", 27)) { - /* ^ */ -#ifdef xdg_mime_is_valid_mime_type - *iv_return = xdg_mime_is_valid_mime_type; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 't': - if (memEQ(name, "xdg_mime_mime_type_subclass", 27)) { - /* ^ */ -#ifdef xdg_mime_mime_type_subclass - *iv_return = xdg_mime_mime_type_subclass; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - return PERL_constant_NOTFOUND; -} - -static int -constant_31 (pTHX_ const char *name, IV *iv_return) { - /* When generated this function returned values for the list of names given - here. However, subsequent manual editing may have added or removed some. - xdg_mime_get_max_buffer_extents xdg_mime_get_mime_type_for_data - xdg_mime_get_mime_type_for_file */ - /* Offset 27 gives the best switch position. */ - switch (name[27]) { - case 'd': - if (memEQ(name, "xdg_mime_get_mime_type_for_data", 31)) { - /* ^ */ -#ifdef xdg_mime_get_mime_type_for_data - *iv_return = xdg_mime_get_mime_type_for_data; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'e': - if (memEQ(name, "xdg_mime_get_max_buffer_extents", 31)) { - /* ^ */ -#ifdef xdg_mime_get_max_buffer_extents - *iv_return = xdg_mime_get_max_buffer_extents; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'f': - if (memEQ(name, "xdg_mime_get_mime_type_for_file", 31)) { - /* ^ */ -#ifdef xdg_mime_get_mime_type_for_file - *iv_return = xdg_mime_get_mime_type_for_file; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - return PERL_constant_NOTFOUND; -} - -static int -constant (pTHX_ const char *name, STRLEN len, IV *iv_return) { - /* Initially switch on the length of the name. */ - /* When generated this function returned values for the list of names given - in this section of perl code. Rather than manually editing these functions - to add or remove constants, which would result in this comment and section - of code becoming inaccurate, we recommend that you edit this section of - code, and use it to regenerate a new set of constant functions which you - then use to replace the originals. - - Regenerate these constant functions by feeding this entire source file to - perl -x - -#!/usr/bin/perl -w -use ExtUtils::Constant qw (constant_types C_constant XS_constant); - -my $types = {map {($_, 1)} qw(IV)}; -my @names = (qw(XDG_MIME_TYPE_EMPTY XDG_MIME_TYPE_TEXTPLAIN - XDG_MIME_TYPE_UNKNOWN _xdg_mime_mime_type_equal - _xdg_mime_mime_type_subclass _xdg_mime_unalias_mime_type - xdg_mime_dump xdg_mime_get_generic_icon xdg_mime_get_icon - xdg_mime_get_max_buffer_extents xdg_mime_get_mime_parents - xdg_mime_get_mime_type_for_data xdg_mime_get_mime_type_for_file - xdg_mime_get_mime_type_from_file_name - xdg_mime_get_mime_types_from_file_name - xdg_mime_is_valid_mime_type xdg_mime_list_mime_parents - xdg_mime_media_type_equal xdg_mime_mime_type_equal - xdg_mime_mime_type_subclass xdg_mime_register_reload_callback - xdg_mime_remove_callback xdg_mime_shutdown xdg_mime_type_empty - xdg_mime_type_textplain xdg_mime_type_unknown - xdg_mime_unalias_mime_type)); - -print constant_types(), "\n"; # macro defs -foreach (C_constant ("Xdgmime", 'constant', 'IV', $types, undef, 3, @names) ) { - print $_, "\n"; # C constant subs -} -print "\n#### XS Section:\n"; -print XS_constant ("Xdgmime", $types); -__END__ - */ - - switch (len) { - case 13: - if (memEQ(name, "xdg_mime_dump", 13)) { -#ifdef xdg_mime_dump - *iv_return = xdg_mime_dump; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 17: - /* Names all of length 17. */ - /* xdg_mime_get_icon xdg_mime_shutdown */ - /* Offset 11 gives the best switch position. */ - switch (name[11]) { - case 't': - if (memEQ(name, "xdg_mime_get_icon", 17)) { - /* ^ */ -#ifdef xdg_mime_get_icon - *iv_return = xdg_mime_get_icon; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'u': - if (memEQ(name, "xdg_mime_shutdown", 17)) { - /* ^ */ -#ifdef xdg_mime_shutdown - *iv_return = xdg_mime_shutdown; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - break; - case 19: - /* Names all of length 19. */ - /* XDG_MIME_TYPE_EMPTY xdg_mime_type_empty */ - /* Offset 18 gives the best switch position. */ - switch (name[18]) { - case 'Y': - if (memEQ(name, "XDG_MIME_TYPE_EMPT", 18)) { - /* Y */ -#ifdef XDG_MIME_TYPE_EMPTY - *iv_return = XDG_MIME_TYPE_EMPTY; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'y': - if (memEQ(name, "xdg_mime_type_empt", 18)) { - /* y */ -#ifdef xdg_mime_type_empty - *iv_return = xdg_mime_type_empty; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - break; - case 21: - /* Names all of length 21. */ - /* XDG_MIME_TYPE_UNKNOWN xdg_mime_type_unknown */ - /* Offset 20 gives the best switch position. */ - switch (name[20]) { - case 'N': - if (memEQ(name, "XDG_MIME_TYPE_UNKNOW", 20)) { - /* N */ -#ifdef XDG_MIME_TYPE_UNKNOWN - *iv_return = XDG_MIME_TYPE_UNKNOWN; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'n': - if (memEQ(name, "xdg_mime_type_unknow", 20)) { - /* n */ -#ifdef xdg_mime_type_unknown - *iv_return = xdg_mime_type_unknown; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - break; - case 23: - /* Names all of length 23. */ - /* XDG_MIME_TYPE_TEXTPLAIN xdg_mime_type_textplain */ - /* Offset 22 gives the best switch position. */ - switch (name[22]) { - case 'N': - if (memEQ(name, "XDG_MIME_TYPE_TEXTPLAI", 22)) { - /* N */ -#ifdef XDG_MIME_TYPE_TEXTPLAIN - *iv_return = XDG_MIME_TYPE_TEXTPLAIN; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'n': - if (memEQ(name, "xdg_mime_type_textplai", 22)) { - /* n */ -#ifdef xdg_mime_type_textplain - *iv_return = xdg_mime_type_textplain; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - break; - case 24: - /* Names all of length 24. */ - /* xdg_mime_mime_type_equal xdg_mime_remove_callback */ - /* Offset 23 gives the best switch position. */ - switch (name[23]) { - case 'k': - if (memEQ(name, "xdg_mime_remove_callbac", 23)) { - /* k */ -#ifdef xdg_mime_remove_callback - *iv_return = xdg_mime_remove_callback; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'l': - if (memEQ(name, "xdg_mime_mime_type_equa", 23)) { - /* l */ -#ifdef xdg_mime_mime_type_equal - *iv_return = xdg_mime_mime_type_equal; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - break; - case 25: - return constant_25 (aTHX_ name, iv_return); - break; - case 26: - /* Names all of length 26. */ - /* xdg_mime_list_mime_parents xdg_mime_unalias_mime_type */ - /* Offset 19 gives the best switch position. */ - switch (name[19]) { - case 'm': - if (memEQ(name, "xdg_mime_unalias_mime_type", 26)) { - /* ^ */ -#ifdef xdg_mime_unalias_mime_type - *iv_return = xdg_mime_unalias_mime_type; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 'p': - if (memEQ(name, "xdg_mime_list_mime_parents", 26)) { - /* ^ */ -#ifdef xdg_mime_list_mime_parents - *iv_return = xdg_mime_list_mime_parents; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - break; - case 27: - return constant_27 (aTHX_ name, iv_return); - break; - case 28: - if (memEQ(name, "_xdg_mime_mime_type_subclass", 28)) { -#ifdef _xdg_mime_mime_type_subclass - *iv_return = _xdg_mime_mime_type_subclass; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 31: - return constant_31 (aTHX_ name, iv_return); - break; - case 33: - if (memEQ(name, "xdg_mime_register_reload_callback", 33)) { -#ifdef xdg_mime_register_reload_callback - *iv_return = xdg_mime_register_reload_callback; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 37: - if (memEQ(name, "xdg_mime_get_mime_type_from_file_name", 37)) { -#ifdef xdg_mime_get_mime_type_from_file_name - *iv_return = xdg_mime_get_mime_type_from_file_name; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - case 38: - if (memEQ(name, "xdg_mime_get_mime_types_from_file_name", 38)) { -#ifdef xdg_mime_get_mime_types_from_file_name - *iv_return = xdg_mime_get_mime_types_from_file_name; - return PERL_constant_ISIV; -#else - return PERL_constant_NOTDEF; -#endif - } - break; - } - return PERL_constant_NOTFOUND; -} - diff --git a/Xdgmime/fallback/const-xs.inc b/Xdgmime/fallback/const-xs.inc deleted file mode 100644 index f3436b0..0000000 --- a/Xdgmime/fallback/const-xs.inc +++ /dev/null @@ -1,90 +0,0 @@ -void -constant(sv) - PREINIT: -#ifdef dXSTARG - dXSTARG; /* Faster if we have it. */ -#else - dTARGET; -#endif - STRLEN len; - int type; - IV iv; - /* NV nv; Uncomment this if you need to return NVs */ - /* const char *pv; Uncomment this if you need to return PVs */ - INPUT: - SV * sv; - const char * s = SvPV(sv, len); - PPCODE: - /* Change this to constant(aTHX_ s, len, &iv, &nv); - if you need to return both NVs and IVs */ - type = constant(aTHX_ s, len, &iv); - /* Return 1 or 2 items. First is error message, or undef if no error. - Second, if present, is found value */ - switch (type) { - case PERL_constant_NOTFOUND: - sv = - sv_2mortal(newSVpvf("%s is not a valid Xdgmime macro", s)); - PUSHs(sv); - break; - case PERL_constant_NOTDEF: - sv = sv_2mortal(newSVpvf( - "Your vendor has not defined Xdgmime macro %s, used", - s)); - PUSHs(sv); - break; - case PERL_constant_ISIV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHi(iv); - break; - /* Uncomment this if you need to return NOs - case PERL_constant_ISNO: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_no); - break; */ - /* Uncomment this if you need to return NVs - case PERL_constant_ISNV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHn(nv); - break; */ - /* Uncomment this if you need to return PVs - case PERL_constant_ISPV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, strlen(pv)); - break; */ - /* Uncomment this if you need to return PVNs - case PERL_constant_ISPVN: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHp(pv, iv); - break; */ - /* Uncomment this if you need to return SVs - case PERL_constant_ISSV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(sv); - break; */ - /* Uncomment this if you need to return UNDEFs - case PERL_constant_ISUNDEF: - break; */ - /* Uncomment this if you need to return UVs - case PERL_constant_ISUV: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHu((UV)iv); - break; */ - /* Uncomment this if you need to return YESs - case PERL_constant_ISYES: - EXTEND(SP, 1); - PUSHs(&PL_sv_undef); - PUSHs(&PL_sv_yes); - break; */ - default: - sv = sv_2mortal(newSVpvf( - "Unexpected return type %d while processing Xdgmime macro %s, used", - type, s)); - PUSHs(sv); - }