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/doc/manual/manual_tex4ht.cfg view on Meta::CPAN
% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
%
%//////////////////////////////////////////////////////////////////////////////
% Set html output type and how the pages will be organized; index=a,b,c means a
% column index, b depth partitioning per page, and if c is present and 'next',
% that next-links recurses.
% Use b=1 for outputting one big html page. b=2 would partition by sections, b=3
% by sections and subsections, and so on...
\Preamble{html,info,index=2,1,pic-tabular,pic-align,charset="utf-8",p-width}
% For manual partitioning we use b=1 above, then \CutAt
%\CutAt{subsubsection,subsection,likesubsection,section,likesection,part}
\CutAt{section}
%% Don't want TOC to be on own page.
%\ConfigureToc{likesubsubsection}{}{~}{}{ }
% Here goes stuff that should be *before* <head>...</head>
% Use it for configurations, no actual output.
dyncall/doc/manual/manual_tex4ht.cfg view on Meta::CPAN
% TITLE+ is only on main page, other use section title. Prefix everything, though.
\Configure{TITLE}{\HCode{<title>}dyncall Manual - }{\HCode{</title>}}
\Configure{TITLE+}{Index}
% Clear default header, define our custom one. Using @HEAD will make this be used on all pages generated.
% @@@Ideally, this wouldn't be a copy&paste of the website's header, here. Such
% thing should be done in the website build, and this here a generic header
% (however, style is kinda needed).
\Configure{@HEAD}{}
\Configure{@HEAD}{\HCode{<meta http-equiv="content-type" content="text/html; charset=utf-8"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<meta name="resource-type" content="document"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<meta name="keywords" content="C, function, dynamic, call, calling, convention, VM, abstraction, closure"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<meta name="distribution" content="global"/>\Hnewline}}
% should this really rely on online content (dyncall's .css) even for an offline build? @@@ also, we need a relative path here, so this complicates things further
\Configure{@HEAD}{\HCode{<link rel="stylesheet" href="/data/main.css" type="text/css" media="all"/>\Hnewline}}
% Image path prefix can be set here...
%\Configure{IMG}
%{\ht:special{t4ht=<img src="}}
%{\ht:special{t4ht=" alt="}}
dyncall/test/dynload_plain/Nmakefile view on Meta::CPAN
#///////////////////////////////////////////////////
TOP = ..\..
!INCLUDE $(TOP)\buildsys\nmake\prolog.nmake
!IF "$(BUILD_OS)" == "windows"
TEST_U8_SO = dynload_plain_Ã_test # this non-ASCII character seems to work in Nmakefiles *iff* the utf-8/BOM mark is present
TARGETS = dynload_plain.exe $(TEST_U8_SO)
OBJS = dynload_plain.obj
dynload_plain.exe: $(OBJS)
echo Linking $@ ...
$(LD) /OUT:"$@" $(LDFLAGS) $(OBJS) $(TOP)\dynload\dynload_s.lib $(TOP)\dyncall\dyncall_s.lib
$(TEST_U8_SO):
echo Building helper lib with UTF-8 path $(TEST_U8_SO) ...
echo.int dynload_plain_testfunc^(^) { return 5; } > x.c
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.pm view on Meta::CPAN
my $ret = qr'^_ZN(?:\d+\w+?)?' . sprintf $name =~ '::' ? '%sE' : '%s17h\w{16}E$',
join( '', ( map { length($_) . $_ } split '::', $name ) );
my @symbols = grep { $_ =~ $ret } grep { defined $_ } @{ $symbol_cache->{$lib} };
return shift @symbols;
}
}
};
1;
__END__
=encoding utf-8
=head1 NAME
Affix - A Foreign Function Interface eXtension
=head1 SYNOPSIS
use Affix;
# bind to exported function
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;
$|++;
#
t/src/64_affix_wchar_t.c view on Meta::CPAN
#include "std.h"
#include <locale.h>
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
int demo(const wchar_t *lhs, const wchar_t *rhs) {
setlocale(LC_ALL, "en_US.utf-8");
int rc = wcscmp(lhs, rhs);
const char *rel = rc < 0 ? "precedes" : rc > 0 ? "follows" : "equals";
if (rc != 0) {
warn("[%ls] %s [%ls] (%d)", lhs, rel, rhs, rc);
DumpHex(lhs, 16);
DumpHex(rhs, 16);
}
return rc;
}
DLLEXPORT int check_string(wchar_t *stringx) {
setlocale(LC_ALL, "en_US.utf-8");
return demo(L"æç©º", stringx);
}
DLLEXPORT const wchar_t *get_string() {
setlocale(LC_ALL, "en_US.utf-8");
return L"æç©º";
}
typedef struct {
char *c;
wchar_t *w;
} WStruct;
DLLEXPORT int struct_string(WStruct wstruct) {
setlocale(LC_ALL, "en_US.utf-8");
return demo(L"æç©º", wstruct.w);
}
DLLEXPORT int check_char(wchar_t chr) {
return chr == L'æ' ? 1 : -1;
}
DLLEXPORT wchar_t get_char() {
return L'æ';
}