Extendable programs are wonderful... but how does one actually implement plugable portions of code?
An interface
is a structure that contains function
pointers. These functions are used to call into either
the plugin or the main program.
#include <stdlib.h> | |
#include <malloc.h> | |
char *makeThing( void ) { | |
return malloc( 10 ); | |
} | |
void unmakeThing( char *thing ) { | |
free( thing ); | |
} |
{ | |
data: { | |
data: { | |
groups: [{ | |
captain: { | |
children: [], | |
created: 2019-05-16T14:05:10-07:00, |
void MemSet ( POINTER p, uintptr_t n, size_t sz ) | |
{ | |
#if defined( _MSC_VER ) && !defined( __NO_WIN32API__ ) && !defined( UNDER_CE ) | |
# if defined( __64__ ) | |
// quad word align... | |
if( ((uintptr_t)p) & 1 ) { | |
(*(uint8_t*)( ((uintptr_t)p) + sz - (sz&1) ) ) = (uint8_t)n; | |
p = (POINTER)( ((uintptr_t)p) + 1 ) | |
sz -= 1; | |
} |
import * as tfa from '@tensorflow/tfjs'; | |
const tf = tfa.default; | |
// Optional Load the binding: | |
// Use '@tensorflow/tfjs-node-gpu' if running with GPU. | |
import * as unused from '@tensorflow/tfjs-node-gpu'; | |
import * as CRa from "./chainReact.mjs" |
// best version | |
// would like to do CreateEvent in static initializer; but that's not a constant expression. | |
#define PTHREAD_ONCE_INIT { 0, 0 } | |
struct pthread_once { | |
HANDLE event; | |
volatile LONG inited; | |
}; | |
typedef struct pthread_once pthread_once_t; |
like struct hashNode { | |
struct data { | |
int used; | |
union hndata { | |
struct hashNode *nextPage; | |
char *hash | |
}data; | |
} data[256]; | |
}; | |
struct hashNode root; |
Thing is: "�"
LINE: <Buffer f0 9f 92 a9 0d 0a>
output 1:
["�","�","\r","\n"]
output 2: 💩
[ '�', '�', '\r', '\n' ]
💩
javascript
create index object type 1a) index object types have a specific object type on the disk 2b) Indexes are assigned unique filenames (related to the source object they index as?)
query for records from storage
2a) db = os.get( "root" );
2b) db.setmap( "players", "firstName = 'bob'" ).on( handleBobs );
2c) db.setmap( "players", "firstName = 'bob' and lastName='bob'" ).on( handleBobs );
2d) db.setmap( "players", "firstName = 'bob' or lastName='bob'" ).on( handleBobs );
var vfs = require( "sack.vfs" ); | |
var vol = vfs.Volume( "MountName", "vfsFile.dat" ); | |
var Gun = require('gun'); | |
require('gun-db'); | |
var peers = [ | |
'http://localhost:8081/gun', | |
] | |
// Create a new gun instance |