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
// hooks for future customizing | |
typedef int (db_log_fnc)(const char *fmt, ... ); | |
typedef void* (db_malloc_fnc)(size_t sz); | |
typedef void* (db_realloc_fnc)(void *ptr, size_t sz); | |
typedef void (db_free_fnc)(void *ptr); | |
typedef void (db_exit_fnc)(int status); | |
struct _db_hook | |
{ | |
db_log_fnc *log; |
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
// hooks for future customizing | |
typedef int (db_log_fnc)(const char *fmt, ... ); | |
typedef void* (db_malloc_fnc)(size_t sz); | |
typedef void* (db_realloc_fnc)(void *ptr, size_t sz); | |
typedef void (db_free_fnc)(void *ptr); | |
typedef void (db_exit_fnc)(int status); | |
struct _db_hook | |
{ | |
db_log_fnc *log; |
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
// hooks for future customizing | |
typedef int (db_log_fnc)(const char *fmt, ... ); | |
typedef void* (db_malloc_fnc)(size_t sz); | |
typedef void* (db_realloc_fnc)(void *ptr, size_t sz); | |
typedef void (db_free_fnc)(void *ptr); | |
typedef void (db_exit_fnc)(int status); | |
struct _db_hook | |
{ | |
db_log_fnc *log; |
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
void pack_double(struct db *database, double d[], int n) | |
{ | |
int len = sizeof(double) * n; | |
struct db_node *node = new_node(len); | |
memcpy(node->data, d, len); | |
dump(database, node); | |
} | |
int unpack_double(struct db *database, double d[], int n, int idx) | |
{ |
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
int pack_arr(struct db *dbase, void *data, int len) | |
{ | |
int code = -1; | |
struct db_node *node = new_node(len); | |
memcpy(node->data, data, len); | |
// insert node into dbase | |
dump(dbase, node); | |
code = 0; |
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
//----------.h file ------------ | |
#ifndef MYVIDEOWIDGET_H | |
#define MYVIDEOWIDGET_H | |
#include <QtOpenGL/QtOpenGL> | |
#include <QtGui/QImage> | |
class MyVideoWidget : public QGLWidget | |
{ | |
Q_OBJECT |
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
#!/usr/bin/python | |
""" | |
Simulate a command pipe in windows. | |
reason: I always need to do batch processing | |
in my dailylife, rename a bunch of files, | |
generate some sets from it, and move files | |
into different folders. Or, I have a module, | |
and I need to processing lots of file, but, | |
this module can only process one at most, and I |
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 "vpack.h" | |
#include <stdio.h> | |
struct Model | |
{ | |
char c; | |
int pts[4]; | |
float vec[1024]; | |
}; | |
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
/* Simple linked-list demo */ | |
typedef struct node{ | |
void *data; | |
struct node *next; | |
struct node *prev; | |
} node; | |
node* create(node **ns, void *data); | |
node* search(node **ns, void *data); |
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
/** | |
* Binary search tree, a C implementation. | |
* | |
* I hope it could be a bit more efficient ;) | |
* | |
* @blackball | |
*/ | |
#include <stdlib.h> | |
/* for futher use */ |
OlderNewer