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
;; Fibers: cooperative, event-driven user-space threads. | |
;;;; Copyright (C) 2016,2021 Free Software Foundation, Inc. | |
;;;; | |
;;;; This library is free software; you can redistribute it and/or | |
;;;; modify it under the terms of the GNU Lesser General Public | |
;;;; License as published by the Free Software Foundation; either | |
;;;; version 3 of the License, or (at your option) any later version. | |
;;;; | |
;;;; This library is distributed in the hope that it will be useful, |
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
;; Lambkin, a garbage-collected heap suitable for microcontrollers. | |
;; Copyright (C) 2015 Andy Wingo <[email protected]>. | |
;; | |
;; This program is free software: you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or | |
;; (at your option) any later version. | |
;; | |
;; This program is distributed in the hope that it will be useful, | |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
#!/usr/bin/env luajit | |
-- -*- lua -*- | |
function equals(expected, actual) | |
if type(expected) ~= type(actual) then return false end | |
if type(expected) == 'table' then | |
for k, v in pairs(expected) do | |
if not equals(v, actual[k]) then return false end | |
end | |
for k, _ in pairs(actual) do |
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
return (function() | |
local cast = ffi.cast | |
local band = bit.band | |
local lshift = bit.lshift | |
local rshift = bit.rshift | |
local bswap = bit.bswap | |
return function(P,length) | |
if not (length >= 34) then return false end | |
do | |
if not (cast("uint16_t*", P+12)[0] == 8) then goto L3 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
<style type="text/css"> | |
background { background: #ffffff; color: #000000; } | |
pre.ljdump { | |
font-size: 10pt; | |
background: #f0f4ff; | |
color: #000000; | |
border: 1px solid #bfcfff; | |
padding: 0.5em; | |
margin-left: 2em; | |
margin-right: 2em; |
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
return function(P,length) | |
if not 24 <= length then return false end | |
local v1 = P:u16(12) | |
if not v1 == 2048 then goto L2 end | |
local v2 = P:u8(23) | |
if not v2 == 6 then return false end | |
if v2 == 6 then goto L4 end | |
if v2 == 17 then goto L4 end | |
if not v2 == 132 then return false end | |
::L4:: |
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
// Assuming that for-of and proxies are available, this function will detect the | |
// version of for-of being used, and bind the std_iterator object. | |
// | |
// The return value will be one of: | |
// | |
// * 'old-spidermonkey' for currently deployed spidermonkey. This code will call | |
// y.iterator() on "for (x of y) ...", then call "next" on that iterator to yield | |
// values until next() throws StopIteration. When control exits the loop, | |
// .close() is called on the iterator. | |
// |