Skip to content

Instantly share code, notes, and snippets.

Sylvain Colinet Skarsnik

Block or report user

Report or block Skarsnik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View NativeCall 6.d.md

Introduction

There is probably a lot to discuss about Test and NativeCall module versionning. Since there are not really part of the language themselves they can be decoupled from the language version, but at the same time they are an important part of the functionnality a perl6 bundle provide you so tt's probably not an easy anwser.

Anyway 6.d is probably the occasion to fix this but also fix or address some issue that exist with the current NativeCall.

My experience with NativeCall is tied to the writing of a binding module (Gumbo), some work on DBIish to introduce more perl6ish method and the writing of GPTrixie, a NativeCall code generator.

I also had some work in the NativeCall.pm module itself (type checking for sub signature and ABI version for lib) and some lowlevel stuff (bool and size_t type)

View ploppng.c
void export_tile_to_png(tile8 rawtile, const palette pal, const char* filename)
{
FILE *fp = fopen(filename, "wb");
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_infop info_ptr = png_create_info_struct(png_ptr);
png_init_io(png_ptr, fp);
png_set_strip_alpha(png_ptr);
png_read_update_info(png_ptr, info_ptr);
png_color* png_palette = (png_color*) png_malloc(png_ptr, pal.size * sizeof(png_color));
View soebank00.asm
C0/0000: 1304 ora ($04,S),Y
C0/0002: D200 cmp ($00)
C0/0004: C05941 cpy #$4159
C0/0007: 3A dec A
C0/0008: 00C0 brk $C0
C0/000A: ADA8D3 lda $D3A8
C0/000D: 1210 ora ($10)
C0/000F: 00C0 brk $C0
C0/0011: 590041 eor $4100,Y
C0/0014: A20F00 ldx #$000F
View Terranigma rng.lua
-- Window properties
local title = " RNG "
local nr_rows = 16
local nr_columns = 2
local column_width = 16
local text_size = 10;
local targetxpos = 0
local targetypos = 36
local xpos = targetxpos
local ypos = targetypos
View terranigma collision.lua
-- Original Script by Gunty found on http://tasvideos.org/forum/viewtopic.php?t=3686&postdays=0&postorder=asc&start=20
-- Modifications by @wzl_
console.writeline("Hello")
local hidden = false
-- These tile IDs encode open/cleared tiles where motion is possible
local clear = {}
--for i,v in pairs({0x00, 0x02, 0x04, 0x22, 0x2c, 0x3a}) do clear[v]=true end
for i,v in pairs({0x00}) do clear[v]=true end
View SoE timer.lua
local framestarted = 0
function savestateloaded()
framestarted = 0;
end
event.onloadstate(savestateloaded);
function to_rta(ftime)
local cpy = ftime
View alttpshuffleinput.asm
lorom
; $04CB is free ram, let use 12x2 bytes for our changes
!TABLE_ICHANGE = $04CB
!CPY_ORIGINAL_INPUT = $7C
; $80-81 copy of input
!CPY_INPUT = $80
!ROOM_COUNTER = $2B2
View alttp collision.lua
local camera_x
local camera_y
local link_x
local link_y
-- $0114
-- $6C[0x01] - Indicates whether you are standing in a doorway
View testleak.p6
use Gumbo::Parser; # replace with HTML::Parser::XML
use XML;
my $parser = Gumbo::Parser.new;
my $html = qqx{wget -o /dev/null -O - https://www.fimfiction.net/bookshelf/149291/};
say "Getting/parsing a wegpage with a quite huge xml tree, prepare yourself some coffee if you use H:P:X";
say "webpage is "~$html.chars~" size.";
my $xml = $parser.parse($html);
View NC.sh
root@testperl6:~/piko/DBIish# perl6 -e 'use NativeCall; sub sqlite3_libversion_number() returns int32 is native("libsqlite3.so") is export { ... }; say sqlite3_libversion_number()'
3008007
root@testperl6:~/piko/DBIish# perl6 -e 'use NativeCall; sub sqlite3_libversion_number() returns Int is native("libsqlite3.so") is export { ... }; say sqlite3_libversion_number()'
895812289686267399
root@testperl6:~/piko/DBIish# uname -a
Linux testperl6 3.16.0-4-586 #1 Debian 3.16.7-ckt11-1+deb8u5 (2015-10-09) i686 GNU/Linux
You can’t perform that action at this time.