Skip to content

Instantly share code, notes, and snippets.

View ntrel's full-sized avatar

Nick Treleaven ntrel

  • London
View GitHub Profile
$ ./autogen.sh
+ type autoreconf
autoreconf is /usr/bin/autoreconf
+ type pkg-config
pkg-config is /usr/bin/pkg-config
+ '[' -z '' ']'
+ type make
+ MAKE=make
++ make -s -f makefiles/list-optlib2c-input.mak
+ ctags_files='optlib/RSpec.ctags
@ntrel
ntrel / geo.d
Last active June 28, 2020 08:04
import std.stdio;
import std.file;
import std.algorithm.iteration;
import std.range;
import std.conv;
void main()
{
auto bytes = read("geo_points.txt");
auto s = cast(string)bytes; // avoid Unicode validation of readText
Czastka Family@family-desktop MINGW32 /c/git/v (arr-get)
$ gcc --version
gcc.exe (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Czastka Family@family-desktop MINGW32 /c/git/v (arr-get)
$ /c/v/v.exe --version
Czastka Family@family-desktop MINGW32 /c/git/v (arr-get)
$ time ./v.exe -prod self
V self compiling (-prod)...
real 0m29.046s
user 0m0.015s
sys 0m0.000s
Czastka Family@family-desktop MINGW32 /c/git/v (arr-get)
$ cp /c/v/v.exe . && time ./v.exe -prod self
@ntrel
ntrel / v_in_range
Created July 20, 2020 18:16
Grepping for inclusive and exclusive range checks
# Note: maybe some false positives for both
# inclusive range: 65 lines
$ gg -E '\b(\w+) >=?.+&&\s*\1\s*<='
cmd/v/help/help.v:15: if (b >= `a` && b <= `z`) || b == `-` || (b >= `0` && b <= `9`) {
examples/vpwgen.v:15: if c >= `0` && c <= `~` {
thirdparty/fontstash/stb_truetype.h:1128: STBTT_assert(n >= 1 && n <= 4);
thirdparty/fontstash/stb_truetype.h:1163: STBTT_assert(offsize >= 1 && offsize <= 4);
thirdparty/fontstash/stb_truetype.h:1173: if (b0 >= 32 && b0 <= 246) return b0 - 139;
thirdparty/fontstash/stb_truetype.h:1174: else if (b0 >= 247 && b0 <= 250) return (b0 - 247)*256 + stbtt__buf_get8(b) + 108;

Introduction

Symbols are the ultimate representation of any native programming language, language features. When they not represented correctly at either the compiler level or language level, things fail to link. This has some serious potential to cause frustration on a level that abandons all hope of a solution working. The purpose of this DIP is to remove common failings that will cause D to not link against and as a shared library on a multitude of platforms and targets.

To do this we must offer the compiler the ability to distinguish between a module that is going into the currently building binary, as well as representing modules that is not in the currently building binary. From this we can determine what symbol mode a symbol must be in more accurately than what is possible right now.

It will also be important to note that the D interface generator is currently very limited in its ability to produce functional D files that represent its input. While this DIP does not attempt to solve many of its sh