This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------ | |
-- basic TLS/SSL3.1 implementation | |
-- $Id: ssl.lua,v 1.13 2006-12-02 21:25:58 kt Exp $ | |
------------------------------------ | |
require "clua" | |
require "util" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "crypto.h" | |
/************************************************* | |
* math lib | |
*************************************************/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local funtab=setmetatable({}, {__mode="k",__index=function(t,k) t[k]={}; return t[k] end}) | |
debug.setmetatable(function() end, { | |
__index=function(f,k) | |
return funtab[f][k] | |
end, | |
__newindex=function(f,k,v) | |
funtab[f][k] = v | |
end | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local resurrect | |
local t = setmetatable({}, { | |
__gc = function(t) | |
print("resurrecting") | |
resurrect=t | |
end | |
}) | |
local weak = setmetatable({x=t}, {__mode="v"}) | |
t = nil | |
collectgarbage() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ruN lua-5.3.0-work2/src/lgc.c lua-5.3.0-work2-resurrectfin/src/lgc.c | |
--- lua-5.3.0-work2/src/lgc.c 2014-03-21 14:52:33.000000000 +0100 | |
+++ lua-5.3.0-work2-resurrectfin/src/lgc.c 2014-05-03 17:53:35.358176913 +0200 | |
@@ -815,6 +815,7 @@ | |
int running = g->gcrunning; | |
L->allowhook = 0; /* stop debug hooks during GC metamethod */ | |
g->gcrunning = 0; /* avoid GC steps */ | |
+ resetbit(gch(gcvalue(&v))->marked, FINALIZEDBIT); /* Might be finalized again. */ | |
setobj2s(L, L->top, tm); /* push finalizer... */ | |
setobj2s(L, L->top + 1, &v); /* ... and its argument */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- class implementation | |
local function class(t) | |
t.__index = t | |
return t | |
end | |
local function extend(dst,src) | |
for k,v in pairs(src) do | |
if type(k) == "string" and k:sub(1,1) ~= "_" then | |
dst[k] = dst[k] or v | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- example class Foo | |
local Foo = { | |
attr1 = 1, | |
attr2 = 2, | |
} | |
Foo.__index = Foo | |
function Foo:getattr1() | |
return self.attr1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* OPCODES: | |
* ------- | |
* OP_SETABC(a,b,c) | |
* frame->A = frame[a] etc | |
* set "segments" for each a, b, c (-1 do not set anything for given letter) | |
* arguments must refer to valid TT_TAGGED tables. | |
* OP_GETT(a,b,c) | |
* A[a] = B[b][C[c]] if table | |
* OR A[a] = B[b](->self,C[c]) if function call | |
* OP_SETT(a=val,b=tab,c=key) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
let inherits = require('util').inherits | |
let Buffer = function(a,b) | |
{ | |
if (!(this instanceof Buffer)) | |
return new Buffer(a, b) | |
return Uint8Array.call(this,a,b) | |
} | |
inherits(Uint8Array, Buffer) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
let Buffer = function(a,b) | |
{ | |
if (!(this instanceof Buffer)) | |
return new Buffer(a, b) | |
let self = Uint8Array.call(this,a,b) | |
self.__proto__ = Buffer.prototype | |
return self | |
} | |
Buffer.prototype = Object.create(Uint8Array.prototype, Buffer.prototype) |
OlderNewer