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
/** | |
* @file | |
* Provides macros for compactly representing tree-like structures at compile- | |
* time. | |
* | |
* Must be compiled as C99 code to work correctly. With GCC, use -std=c99 or | |
* a superset thereof. | |
* | |
* Currently, traversal must be done manually. Soon, functions will exist to | |
* traverse the tree without understanding its internal structure. |
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
/** | |
* @file | |
* Provides a lightweight integer-keyed key-value store. | |
* | |
* The key must be an integral type (default @c int), but can be any integral | |
* type if @c KV_KEY_TYPE is defined before @c #include'ing this file. | |
*/ | |
#ifndef KV_INT_H_ | |
#define KV_INT_H_ |
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
// Adds Java-like "synchronize" to functions. | |
#if SYNCHRONIZE_ENABLE | |
#include <pthread.h> | |
#define SYNCHRONIZED(Ret,Func,Params,Args) \ | |
static Ret _synchronized_##Func Params; \ | |
Ret Func Params { \ | |
Ret _result; \ | |
static pthread_mutex_t _lock_for_##Func = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; \ |
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 perl | |
use strict; | |
use List::Util qw(max); | |
# so we don't have to bring in non-code List::MoreUtils | |
sub all (&@) | |
{ | |
my ($block, $a) = @_; | |
return @$a == grep { $block->() } @$a; |
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 perl | |
use strict; | |
my @n = sort { $a <=> $b } @ARGV; | |
my %n = map { $_ => 1 } @n; | |
my $line = <STDIN>; | |
for my $i (0 .. $n[-1]) { | |
print 0 + pos $line, " " if $n{$i}; | |
$line =~ /\G\s+X+/gc; | |
} |
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 perl | |
use strict; | |
use List::MoreUtils qw(zip); | |
use File::Basename qw(basename); | |
use XML::Simple; | |
use XXX; | |
my $num = qr/[0-9.]+/; | |
my $cmd = qr/[MZLHVCSQTA]/i; |
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 perl | |
use strict; | |
use List::Util qw(max); | |
my $name = "b"; | |
# for each significant bit position, where the sequence through the bit | |
# positions is chosen such that each bit chosen divides the remaining | |
# search space as nearly evenly as possible, construct an array that | |
# looks like this: |
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 perl | |
use strict; | |
use XML::SAX::ParserFactory; | |
our $p = "nsisXML::"; | |
our $f = "/NOUNLOAD"; | |
our $i = " " x 2; | |
$XML::SAX::ParserPackage = "XML::SAX::Expat"; |
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 perl | |
use strict; | |
use List::Util qw(max); | |
my $name = "b"; | |
# for each significant bit position, where the sequence through the bit | |
# positions is chosen such that each bit chosen divides the remaining | |
# search space as nearly evenly as possible, construct an array that | |
# looks like this: |
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
FAKELIBS += libfoo libbar | |
CLEANFILES += $(FAKELIBS:=.x) | |
libfoo_FAKESYMS = foosym1 foosym2 | |
libbar_FAKESYMS = barsym1 barsym2 | |
# Rules to create fake libraries that can stand in during link time only for | |
# real libraries that are not yet available. | |
define FAKE_LIBRARY_template | |
$(1).x: | |
echo $(2) | sed 's/\($$$$\| \)/ = 0;^M/g' > $$@ |