This file contains 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 typedefs = require 'nelua.typedefs' | |
typedefs.function_annots.noerror = true | |
local cgenerator = require 'nelua.cgenerator' | |
local CEmitter = require 'nelua.cemitter' | |
local orig_Call = cgenerator.visitors.Call | |
function cgenerator.visitors.Call(context, node, emitter, ...) | |
local isblockcall = context:get_visiting_node(1).tag == 'Block' | |
local funcscope = context.scope:get_up_scope_of_kind('is_function') | |
local funcsym = funcscope and funcscope.funcsym |
This file contains 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
##[[ | |
if GLSL then | |
primtypes.number = primtypes.float32 | |
primtypes.integer = primtypes.cint | |
primtypes.uinteger = primtypes.cuint | |
else | |
primtypes.number = primtypes.float32 | |
primtypes.integer = primtypes.int32 | |
primtypes.uinteger = primtypes.uint32 | |
end |
This file contains 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 fs = require 'nelua.utils.fs' | |
local traits = require 'nelua.utils.traits' | |
local stringer = require 'nelua.utils.stringer' | |
local parser = require 'nelua.syntaxdefs'().parser | |
local re = require 'nelua.thirdparty.relabel' | |
local filename = 'lib/string.nelua' | |
local filecode = fs.ereadfile(filename) | |
local ast = parser:parse(filecode, filename) |
This file contains 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
collectgarbage('stop') -- we don't want the GC to generate noise in the benchmarks | |
local function bench(f, n) | |
collectgarbage('collect') | |
n = n or 1000000 | |
local rdtsc = require 'rdtsc' | |
local s = rdtsc() | |
for _=1,n do | |
f() | |
end |
This file contains 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
package = "luacov" | |
version = "scm-1" | |
source = { | |
url = "git+https://github.com/keplerproject/luacov.git", | |
} | |
description = { | |
summary = "Coverage analysis tool for Lua scripts", | |
detailed = [[ | |
LuaCov is a simple coverage analysis tool for Lua scripts. | |
When a Lua script is run with the luacov module, it |
This file contains 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
#ifndef __KERNEL__ | |
#define __KERNEL__ | |
#endif | |
#ifndef MODULE | |
#define MODULE | |
#endif | |
#include <generated/autoconf.h> | |
#include <linux/kernel.h> | |
#include <linux/module.h> |
This file contains 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 re = require 'relabel' | |
local file = require 'pl.file' | |
local stringx = require 'pl.stringx' | |
local grammar = [[ | |
body <- {| line+ |} | |
line <- (extern / anyline) | |
anyline <- linerest | |
linerest<- [^;]* ';' sp | |
sp <- %s* |
This file contains 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
-------------------------------------------------------------------------------- | |
-- meta programming utilities for inheritance | |
##[[ | |
local function check_record_type(sym) | |
staticassert(sym and sym.type and sym.type:is_type() and sym.value:is_record(), | |
"symbol '%s' must be a type holding a record type", sym.name) | |
return sym.value | |
end |
This file contains 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 <stdio.h> | |
struct Shape { | |
Shape(int64_t x, int64_t y): x(x), y(y) {} | |
virtual int64_t area() {return 0;} | |
int64_t x, y; | |
}; | |
struct Rectangle : public Shape { |
This file contains 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
!!strict | |
-- optimize for performance | |
!!cflags '-O3 -ffast-math -march=native -fno-plt -flto -fopenmp -rdynamic -g' | |
!!ldflags '-flto' | |
-------------------------------------------------------------------------------- | |
-- SDL | |
-- import SDL headers |