Affix

 view release on metacpan or  search on metacpan

dyncall/doc/manual/Makefile.generic  view on Meta::CPAN

	#   better bitmaps
	# - create empty multirow.4ht file, to simply override tex4ht's default one,
	#   which produces wrong output in our case - since all the tables where we
	#   use the multirow package are rendered into .pngs for our html doc, we don't
	#   need any tex4ht specific version outputing html
	cd "${VPATH}" &&  ( \
		:>./multirow.4ht; \
		cp $$(dirname $$(which tex4ht))/../share/texmf-dist/tex4ht/base/unix/tex4ht.env ./custom_tex4ht.env; \
		sed -E -i '' 's/(Text|Graphics)(AlphaBits)=[1,2,3]([^0-9])/\1\2=4\3/g' custom_tex4ht.env; \
		mkdir -p ./html/; \
		htlatex manual.tex manual_tex4ht " -cunihtf -e./custom_tex4ht.env -utf8" "-e./custom_tex4ht.env -d./html/"; \
		rm ./html/*.css; \
	)
	# Postprocessing. Inject menu into output html pages. Replace some pieces, etc..
	for f in "${VPATH}/html/"*.html; do \
		sed -E -i '' $$'s/([[:space:]]class=["\'])lstlisting(["\'])/\\1ttDiv\\2/' "$$f"; \
	done

manual.pdf: sources
	# run twice for toc on some tex installs
	cd "${VPATH}" && for i in 1 2; do pdflatex -output-directory="${PWD}" manual.tex; done

dyncall/test/dynload_plain/dynload_plain.c  view on Meta::CPAN

    *p = '\0';
  else
    path = (char*)dot;
  return path;
}
#else
#  include <libgen.h>
#endif


int strlen_utf8(const char *s)
{
  int i=0, j=0;
  while(s[i])
    j += ((s[i++] & 0xc0) != 0x80);
  return j;
}


int main(int argc, char* argv[])
{

dyncall/test/dynload_plain/dynload_plain.c  view on Meta::CPAN

        int nu8c, b;

        pLib = dlLoadLibrary(pathU8); /* check if we can load a lib with a UTF-8 path */
        printf("pLib (loaded w/ UTF-8 path %s with wd being exec's dir) handle: %p\n", pathU8, pLib);
        r += (p != NULL);

        if(pLib) {
          /* get UTF-8 path back */
          bs = dlGetLibraryPath((DLLib*)pLib, queriedPath, 200);
          if(bs && bs <= 200) {
            nu8c = strlen_utf8(queriedPath); /* num of UTF-8 chars is as big as ... */
            b = (bs > 0) && (nu8c == bs-2);   /* ... buffer size minus 2 (b/c of one 2-byte UTF-8 char and "\0") */
            printf("UTF-8 path of lib looked up via handle: %s\n", queriedPath);
            printf("looked up UTF-8 path's needed buffer size (%d) for %d UTF-8 char string computed correctly: %d\n", bs, nu8c, b);
            r += b;
 
            dlFreeLibrary(pLib);
          }
          else
            printf("failed to query UTF-8 lib path using lib's handle\n");
        }

eg/Cookbook/win32_messagebox.pl  view on Meta::CPAN

use utf8;
use Affix;

# Send a Unicode string to the Windows API MessageBoxW function.
use constant MB_OK                   => 0x00000000;
use constant MB_DEFAULT_DESKTOP_ONLY => 0x00020000;
#
affix 'user32', [ MessageBoxW => 'MessageBox' ] => [ Pointer [Void], WStr, WStr, UInt ] => Int;
MessageBox( undef, "Keep your stick on the ice.", "🏒", MB_OK | MB_DEFAULT_DESKTOP_ONLY );

lib/Affix.xs  view on Meta::CPAN

                    mPUSHs(sv_setref_pv(newSV(1), "Affix::Pointer", ptr));
                    break;
                }
            } break;
            case DC_SIGCHAR_STRING: {
                DCpointer ptr = dcbArgPointer(args);
                PUSHs(newSVpv((char *)ptr, 0));
            } break;
            case DC_SIGCHAR_WIDE_STRING: {
                DCpointer ptr = dcbArgPointer(args);
                PUSHs(newSVpvn_utf8((char *)ptr, 0, 1));
            } break;
            case DC_SIGCHAR_WIDE_CHAR: {
                SV *container, *RETVAL;
                RETVAL = newSVpvs("");
                const char *pat = "W";
                switch (WCHAR_T_SIZE) {
                case I8SIZE:
                    container = newSViv((IV)dcbArgChar(args));
                    break;
                case SHORTSIZE:

lib/Affix.xs  view on Meta::CPAN

as_string(DCpointer ptr, ...)
OVERLOAD: \"\"
CODE:
    // clang-format on
    RETVAL = (char *)ptr;
// clang-format off
OUTPUT:
    RETVAL

SV *
raw(ptr, size_t size, bool utf8 = false)
CODE:
// clang-format on
{
    DCpointer ptr;
    if (sv_derived_from(ST(0), "Affix::Pointer")) {
        IV tmp = SvIV((SV *)SvRV(ST(0)));
        ptr = INT2PTR(DCpointer, tmp);
    }
    else if (SvIOK(ST(0))) {
        IV tmp = SvIV((SV *)(ST(0)));
        ptr = INT2PTR(DCpointer, tmp);
    }
    else
        croak("dest is not of type Affix::Pointer");
    RETVAL = newSVpvn_utf8((const char *)ptr, size, utf8 ? 1 : 0);
}
// clang-format off
OUTPUT:
    RETVAL

void
dump(ptr, size_t size)
CODE:
// clang-format on
{

t/64_affix_wchar_t.t  view on Meta::CPAN

use strict;
use utf8;
use Test::More 0.98;
BEGIN { chdir '../' if !-d 't'; }
use lib '../lib', '../blib/arch', '../blib/lib', 'blib/arch', 'blib/lib', '../../', '.';
use Affix qw[:all];
use File::Spec;
use t::lib::nativecall;
$|++;

# https://www.gnu.org/software/libunistring/manual/html_node/The-wchar_005ft-mess.html
plan skip_all => 'wchar * is broken on *BSD and Solaris' if $^O =~ /(?:bsd|solaris)/i;

t/82_affix_mangle_itanium.t  view on Meta::CPAN

use strict;
use utf8;
use Test::More 0.98;
BEGIN { chdir '../' if !-d 't'; }
use lib '../lib', '../blib/arch', '../blib/lib', 'blib/arch', 'blib/lib', '../../', '.';
use Affix qw[:all];
use t::lib::nativecall;
use experimental 'signatures';
$|++;
#
my $lib = compile_test_lib('82_affix_mangle_itanium');

t/85_affix_mangle_rust.t  view on Meta::CPAN

use strict;
use utf8;
use Test::More 0.98;
BEGIN { chdir '../' if !-d 't'; }
use lib '../lib', '../blib/arch', '../blib/lib', 'blib/arch', 'blib/lib', '../../', '.';
use Affix qw[:all];
use t::lib::nativecall;
use experimental 'signatures';
use Devel::CheckBin;
use Config;
$|++;
#



( run in 0.296 second using v1.01-cache-2.11-cpan-4d50c553e7e )