repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
kiwiroy/libtickit | t/47window-dragndrop.c | #include "tickit.h"
#include "taplib.h"
#include "taplib-tickit.h"
#include "taplib-mockterm.h"
int next_event = 0;
struct SavedEvent {
TickitWindow *win;
int type;
int line, col;
} events[9];
int on_input_push(TickitWindow *win, TickitEventFlags flags, void *_info, void *data)
{
TickitMouseEventInfo *info = ... |
kiwiroy/libtickit | t/51tickit-io.c | <gh_stars>0
#include "tickit.h"
#include "tickit-mockterm.h"
#include "taplib.h"
#include <unistd.h>
static int on_call_incr(Tickit *t, TickitEventFlags flags, void *info, void *user)
{
if(flags & TICKIT_EV_FIRE) {
int *ip = user;
(*ip)++;
tickit_stop(t);
}
return 1;
}
int main(int argc, char *ar... |
kiwiroy/libtickit | t/40rootwindow.c | <gh_stars>10-100
#include "tickit.h"
#include "taplib.h"
#include "taplib-tickit.h"
#include "taplib-mockterm.h"
int on_event_incr_int(TickitWindow *window, TickitEventFlags flags, void *_info, void *data)
{
(*(int*)data)++;
return 1;
}
int nextrect = 0;
TickitRect rects[4];
int push_on_expose(TickitWindow *win, ... |
kiwiroy/libtickit | src/string.c | #include "tickit.h"
#include <string.h>
struct TickitString {
int refcount;
size_t len;
char str[0];
};
TickitString *tickit_string_new(const char *str, size_t len)
{
TickitString *s = malloc(sizeof(TickitString) + len + 1);
s->refcount = 1;
s->len = len;
memcpy(s->str, str, len);
s->str[len] = '\0'... |
kiwiroy/libtickit | src/tickit.c | #include "tickit.h"
#include "tickit-evloop.h"
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#define streq(a,b) (!strcmp(a,b))
/* INTERNAL */
TickitWindow* tickit_window_new_root2(Tickit *t, TickitTerm *term);
struct TickitWatch {
TickitWatch *next;
Tickit... |
kiwiroy/libtickit | examples/evloop-libuv.c | <reponame>kiwiroy/libtickit<gh_stars>0
#ifdef __GLIBC__
# define _XOPEN_SOURCE 500 /* strdup */
#endif
#include "tickit.h"
#include "tickit-evloop.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <uv.h>
TickitKeyEventInfo lastkey;
TickitWindow *keywin... |
kiwiroy/libtickit | t/13term-pen.c | #include "tickit.h"
#include "taplib.h"
#include <string.h>
void output(TickitTerm *tt, const char *bytes, size_t len, void *user)
{
char *buffer = user;
strncat(buffer, bytes, len);
}
int main(int argc, char *argv[])
{
TickitTerm *tt;
char buffer[1024] = { 0 };
tt = tickit_term_new_for_termtype("xterm");... |
kiwiroy/libtickit | t/36renderbuffer-blit.c | #include "tickit.h"
#include "taplib.h"
#include "taplib-mockterm.h"
int main(int argc, char *argv[])
{
TickitTerm *tt = make_term(25, 80);
TickitRenderBuffer *screen, *window;
screen = tickit_renderbuffer_new(25, 80);
window = tickit_renderbuffer_new(10, 20);
// Basic blit
{
tickit_renderbuffer_text... |
kiwiroy/libtickit | t/16term-read.c | #ifdef __GLIBC__
# define _XOPEN_SOURCE 500 // usleep
#endif
#include "tickit.h"
#include "taplib.h"
#include <string.h>
#include <unistd.h>
TickitKeyEventType keytype;
char keystr[16];
int on_key(TickitTerm *tt, TickitEventFlags flags, void *_info, void *data)
{
TickitKeyEventInfo *info = _info;
... |
kiwiroy/libtickit | t/31renderbuffer-line.c | <filename>t/31renderbuffer-line.c
#include "tickit.h"
#include "taplib.h"
#include "taplib-mockterm.h"
int main(int argc, char *argv[])
{
TickitTerm *tt = make_term(25, 80);
TickitRenderBuffer *rb;
rb = tickit_renderbuffer_new(30, 30);
// Simple lines, end caps
{
TickitPen *fg_pen = tickit_pen_new_attr... |
kiwiroy/libtickit | t/mockterm.c | <reponame>kiwiroy/libtickit
#include "taplib-mockterm.h"
#include "taplib.h"
#include "tickit-mockterm.h"
#include <string.h>
#define streq(a,b) (!strcmp(a,b))
static char *lognames[] = {
[EXPECT_GOTO] = "goto",
[EXPECT_PRINT] = "print",
[EXPECT_ERASECH] = "erasech",
[EXPECT_CLEAR] = "cle... |
kiwiroy/libtickit | src/termdriver.h | <reponame>kiwiroy/libtickit<filename>src/termdriver.h
#include "tickit.h"
#include "tickit-termdrv.h"
typedef struct {
const char *termtype;
const struct TickitTerminfoHook *ti_hook;
} TickitTermProbeArgs;
typedef struct {
TickitTermDriver *(*new)(const TickitTermProbeArgs *args);
} TickitTermDriverProbe;
exte... |
kiwiroy/libtickit | t/05string.c | #include "tickit.h"
#include "taplib.h"
int main(int argc, char *argv[])
{
TickitString *s;
s = tickit_string_new("Hello, world!", 13);
ok(!!s, "tickit_string_new");
is_str(tickit_string_get(s), "Hello, world!", "tickit_string_get");
is_int(tickit_string_len(s), 13, "tickit_string_len");
{
is_ptr(ti... |
kiwiroy/libtickit | src/rect.c | <reponame>kiwiroy/libtickit
#include "tickit.h"
static inline int minint(int a, int b) { return a < b ? a : b; }
static inline int maxint(int a, int b) { return a > b ? a : b; }
void tickit_rect_init_sized(TickitRect *rect, int top, int left, int lines, int cols)
{
rect->top = top;
rect->left = left;
rect->l... |
kiwiroy/libtickit | t/09debug.c | <gh_stars>10-100
#ifdef __GLIBC__
# define _XOPEN_SOURCE 500 // strdup
#endif
#include "tickit.h"
#include "taplib.h"
#include <stdlib.h>
#include <string.h>
char *msg = NULL;
void savemsg(const char *str, void *data)
{
if(msg)
free(msg);
msg = strdup(str);
}
int main(int argc, char *argv[])
{
putenv("... |
kiwiroy/libtickit | t/taplib-tickit.h | #ifndef __TAPLIB_TICKIT_H__
#define __TAPLIB_TICKIT_H__
#include "tickit.h"
TickitRect *rect_init_strp(TickitRect *rect, const char *str);
void is_rect(TickitRect *got, const char *expect, char *name);
#endif
|
kiwiroy/libtickit | t/taplib.h | <gh_stars>0
void plan_tests(int n);
void skip_all(char *reason);
void ok(int cmp, char *name);
void pass(char *name);
void fail(char *name);
void diag(char *fmt, ...);
void is_int(int got, int expect, char *name);
void is_ptr(void *got, void *expect, char *name);
void is_str(const char *got, const char *expect, char *n... |
kiwiroy/libtickit | t/50tickit.c | #include "tickit.h"
#include "tickit-mockterm.h"
#include "taplib.h"
int main(int argc, char *argv[])
{
Tickit *t = tickit_new_for_term(tickit_mockterm_new(25, 80));
ok(!!t, "tickit_new_stdio()");
/* TODO: add some real tests
* There isn't a lot that can be checked in a unit-test script yet, until
* more... |
kiwiroy/libtickit | t/taplib-mockterm.h | #include <tickit-mockterm.h>
struct TermLogExpectation {
enum {
EXPECT_GOTO = LOG_GOTO,
EXPECT_PRINT = LOG_PRINT,
EXPECT_ERASECH = LOG_ERASECH,
EXPECT_CLEAR = LOG_CLEAR,
EXPECT_SCROLLRECT = LOG_SCROLLRECT,
EXPECT_SETPEN = LOG_SETPEN,
} type;
int val[6];
char *str;... |
kiwiroy/libtickit | t/10term-write.c | <gh_stars>0
#include "tickit.h"
#include "taplib.h"
#include <string.h>
#include <unistd.h>
bool output_eof = false;
void output(TickitTerm *tt, const char *bytes, size_t len, void *user)
{
char *buffer = user;
if(bytes)
strncat(buffer, bytes, len);
else
output_eof = true;
}
int main(int argc, char *... |
kiwiroy/libtickit | t/45window-input.c | <reponame>kiwiroy/libtickit
#include "tickit.h"
#include "taplib.h"
#include "taplib-mockterm.h"
#include <string.h>
struct LastEvent {
int type;
int mod;
int line, col, button;
char str[16];
int ret;
};
int on_key_event_capture(TickitWindow *win, TickitEventFlags flags, void *_info, void *data)
{
struc... |
kiwiroy/libtickit | t/03rect.c | #include "tickit.h"
#include "taplib.h"
#include "taplib-tickit.h"
#include <stdio.h>
int main(int argc, char *argv[])
{
TickitRect rect1, rect2, rectOut;
tickit_rect_init_sized(&rect1, 5, 10, 7, 20);
is_int(rect1.top, 5, "rect1.top");
is_int(rect1.left, 10, "rect1.left");
is_int(rect1.lines, 7, "rec... |
kiwiroy/libtickit | t/52tickit-timer.c | #include "tickit.h"
#include "tickit-mockterm.h"
#include "taplib.h"
static int unbound_count;
static int on_call_incr(Tickit *t, TickitEventFlags flags, void *info, void *user)
{
if(flags & TICKIT_EV_FIRE) {
int *ip = user;
(*ip)++;
tickit_stop(t);
}
if(flags & TICKIT_EV_UNBIND)
unbound_count+... |
kiwiroy/libtickit | src/bindings.h | #include "tickit.h"
struct TickitBinding;
struct TickitBindings {
struct TickitBinding *first;
int is_iterating : 1;
int needs_delete : 1;
};
typedef int TickitEventFn(void *owner, TickitEventFlags flags, void *info, void *data);
void tickit_bindings_run_event(struct TickitBindings *bindings, void *owner, int... |
kiwiroy/libtickit | t/18term-builder.c | #include "tickit.h"
#include "taplib.h"
#include <string.h>
#define streq(a,b) (!strcmp(a,b))
static const char *ti_getstr(const char *name, const char *value, void *user)
{
if(streq(name, "cursor_address"))
return "GOTO(%p1%d,%p2%d)";
return value;
}
static void output(TickitTerm *tt, const char *bytes, s... |
kiwiroy/libtickit | t/35renderbuffer-mask.c | #include "tickit.h"
#include "taplib.h"
#include "taplib-mockterm.h"
int main(int argc, char *argv[])
{
TickitTerm *tt = make_term(25, 80);
TickitRenderBuffer *rb;
rb = tickit_renderbuffer_new(10, 20);
TickitRect mask = {.top = 3, .left = 5, .lines = 4, .cols = 6};
// Mask over text
{
tickit_renderb... |
kiwiroy/libtickit | examples/demo-rgb8.c | <filename>examples/demo-rgb8.c
#include "tickit.h"
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define streq(a,b) (!strcmp(a,b))
#define COL_RED 1
#define COL_GREEN 2
#define COL_BLUE 4
static int on_geomchange(TickitWindow *win, TickitEventFlags flags, void ... |
kiwiroy/libtickit | t/15term-input.c | <reponame>kiwiroy/libtickit<filename>t/15term-input.c<gh_stars>0
#ifdef __GLIBC__
# define _XOPEN_SOURCE 500 // usleep
#endif
#include "tickit.h"
#include "taplib.h"
#include <string.h>
#include <unistd.h>
TickitKeyEventType keytype;
char keystr[16];
int keymod;
int on_key_return = 1;
... |
kiwiroy/libtickit | t/60tickit-setup.c | #include "tickit.h"
#include "taplib.h"
#include <string.h>
void output(TickitTerm *tt, const char *bytes, size_t len, void *user)
{
char *buffer = user;
strncat(buffer, bytes, len);
}
int main(int argc, char *argv[])
{
char buffer[1024] = { 0 };
/* Regular setup */
{
TickitTerm *tt = tickit_term_new_... |
DimaBond174/lib_template | include/geomlib.h | /*
* This is the source code of SpecNet project
* It is licensed under MIT License.
*
* Copyright (c) <NAME>
* feel free to contact me: <EMAIL>
*/
#ifndef GEOMLIB_H
#define GEOMLIB_H
#if defined _WIN32 || defined __CYGWIN__
#ifdef BUILDING_GeomLib
#ifdef __GNUC__
#define DLL_PUBLIC __attribute__ ((d... |
DimaBond174/lib_template | src/common/i/iconfig.h | <reponame>DimaBond174/lib_template
/*
* This is the source code of SpecNet project
* It is licensed under MIT License.
*
* Copyright (c) <NAME>
* feel free to contact me: <EMAIL>
*/
#ifndef ICONFIG_H
#define ICONFIG_H
#include <string>
#include "tools/specstatic.h"
class IConfig {
public:
virtual ~IConfig... |
DimaBond174/lib_template | src/common/tools/specjson.h | <gh_stars>0
/*
* This is the source code of SpecNet project
* It is licensed under MIT License.
*
* Copyright (c) <NAME>
* feel free to contact me: <EMAIL>
*/
#ifndef SPECJSON_H
#define SPECJSON_H
#include <string.h>
#include <string>
//must be greater 4:
const int kSPECJSON_LEAF_SIZE = 256;
class TNode {
pu... |
DimaBond174/lib_template | src/common/config/json/configjson.h | /*
* This is the source code of SpecNet project
* It is licensed under MIT License.
*
* Copyright (c) <NAME>
* feel free to contact me: <EMAIL>
*/
#ifndef ConfigJSON_H
#define ConfigJSON_H
#pragma once
#include <string>
#include <map>
#include "i/iconfig.h"
#include "tools/specjson.h"
class ConfigJSON : public ... |
DimaBond174/lib_template | src/main_lib/src/impl/geomimpl.h | <reponame>DimaBond174/lib_template<gh_stars>0
/*
* This is the source code of SpecNet project
* It is licensed under MIT License.
*
* Copyright (c) <NAME>
* feel free to contact me: <EMAIL>
*/
#ifndef GeomImpl_H
#define GeomImpl_H
class GeomImpl
{
public:
const char *get_tag() { return TAG; }
void app... |
DimaBond174/lib_template | src/common/i/ilib.h | /*
* This is the source code of SpecNet project
* It is licensed under MIT License.
*
* Copyright (c) <NAME>
* feel free to contact me: <EMAIL>
*/
#ifndef ILIB_H
#define ILIB_H
#if defined _WIN32 || defined __CYGWIN__
#ifdef BUILDING_LIB
#ifdef __GNUC__
#define DLL_PUBLIC __attribute__ ((dllexport)... |
DimaBond174/lib_template | src/main_test/src/test1/test1_impl.h | <filename>src/main_test/src/test1/test1_impl.h
/*
* This is the source code of SpecNet project
* It is licensed under MIT License.
*
* Copyright (c) <NAME>
* feel free to contact me: <EMAIL>
*/
#ifndef Test1Lib_H
#define Test1Lib_H
#if defined _WIN32 || defined __CYGWIN__
#ifdef BUILDING_Test1Lib
#ifdef _... |
tacrazymage/Data-Structures-and-Algorithms | Graph Algorithms/boilerplate.h | <gh_stars>10-100
/*
* author: @tirthasheshpatel
* Base code for all Graph Algorithms
* Contains implementation of: Queue, Stack, Linked Lists.
*/
#ifndef GUARD_BOILERPLATE_H
#define GUARD_BOILERPLATE_H
// Importing dependencies
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include ... |
tacrazymage/Data-Structures-and-Algorithms | priority_queue.c | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define MAX 3
typedef struct queue Queue;
struct queue
{
int front;
int rear;
int q[MAX+1][2];
};
// Deletes a element from the front of the Queue.
int* dequeue(Queue* q)
{
/*
* Arguments: `q` (Queue*) -> A referance to a Queue object
... |
tacrazymage/Data-Structures-and-Algorithms | queue_using_static_array.c | <filename>queue_using_static_array.c<gh_stars>10-100
/*
* @author: tirthasheshpatel
* @g-mail: <EMAIL>
* Summary: Queue implemented using static array
*/
// Inclusing necessary libraries
#include <stdio.h> // printf, scanf, fflush
#include <stdlib.h>
#define MAX 65535
// Alternate for `struct queue`
typedef str... |
tacrazymage/Data-Structures-and-Algorithms | Greedy Algorithms/huffmann_codes.c | <reponame>tacrazymage/Data-Structures-and-Algorithms
#include <stdio.h>
#include <stdlib.h>
typedef struct node Node;
struct node
{
int value;
Node* right;
Node* left;
};
int left(int i) { return 2 * i + 1; }
int right(int i) { return 2 * i + 2; }
int parent(int i) { return ceil((float)i / 2) - 1; }
vo... |
tacrazymage/Data-Structures-and-Algorithms | polynomial_addition.c | <reponame>tacrazymage/Data-Structures-and-Algorithms<filename>polynomial_addition.c<gh_stars>10-100
#include <stdio.h>
#include <stdlib.h>
typedef struct node* iterator;
typedef struct node
{
int coef;
int expo;
struct node* next;
}Node;
iterator create_singly_linked_list(int coef, int expo)
{
iterat... |
tacrazymage/Data-Structures-and-Algorithms | infix_to_prefix/main.c | <reponame>tacrazymage/Data-Structures-and-Algorithms<filename>infix_to_prefix/main.c
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAX 65535
struct stack
{
int top;
char s_content[MAX+1];
};
void PUSH(struct stack *s, char value)
{
if(s->top==M... |
tacrazymage/Data-Structures-and-Algorithms | Dynamic Programming/longest_common_subsequence.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
void LCS(char X[], char Y[])
{
int m = strlen(X)+1;
int n = strlen(Y)+1;
int c[m][n];
char b[m][n];
for(int i=0;i<m;i++) c[i][0] = 0;
for(int i=0;i<n;i++) c[0][i] = 0;
for(int i=1;i<m;i++)
{
for(int j=1;j<n;j++)
... |
tacrazymage/Data-Structures-and-Algorithms | tower_of_hanoi.c | #include <stdio.h>
#include <stdlib.h>
void tower_of_hanoi(int n, int fromPeg, int auxPeg, int toPeg)
{
if(n == 1) printf("Move top disk from peg %d to peg %d\n", fromPeg, toPeg);
else{
tower_of_hanoi(n-1, fromPeg, toPeg, auxPeg);
printf("Move top disk from peg %d to peg %d\n", fromPeg, toPeg);... |
tacrazymage/Data-Structures-and-Algorithms | queue/queue/Queue.h | <reponame>tacrazymage/Data-Structures-and-Algorithms
#ifndef GUARD_QUEUE_H
#define GUARD_QUEUE_H
#include <memory>
#include <algorithm>
#include <stdexcept>
using std::max;
template<class T>
class Queue
{
public:
typedef T* iterator;
typedef const T* const_iterator;
typedef size_t size_type;
typedef T value_type... |
tacrazymage/Data-Structures-and-Algorithms | stack/stack/Stack.h | <filename>stack/stack/Stack.h
#ifndef GUARD_STACK_H
#define GUARD_STACK_H
#include <memory>
#include <cstddef>
#include <stdexcept>
#include <algorithm>
template<class T>
class Stack
{
public:
typedef T* iterator;
typedef const T* const_iterator;
typedef size_t size_type;
typedef T value_type;
Stack() { create(... |
tacrazymage/Data-Structures-and-Algorithms | prefix_to_postfix/main.c | <reponame>tacrazymage/Data-Structures-and-Algorithms
/*
->Author : <NAME>
->Editor : <NAME>
->E-mail : <EMAIL>
->Summary : Converting `prefix` to `postfix` using STACK
*/
#include <stdio.h>
#include <stdlib.h> // malloc, calloc
#include <ctype.h> // isalpha
#include <string.h> // strlen, strcpy, strcat
#include <er... |
tacrazymage/Data-Structures-and-Algorithms | warshall_algorithm.c | <reponame>tacrazymage/Data-Structures-and-Algorithms<gh_stars>0
#include <stdio.h>
#include <stdlib.h>
void run_warshall(int graph[][4])
{
int num_iterations = 4 + 1;
for(int i=0;i<num_iterations;i++)
{
}
}
int main()
{
int num_vertices = 4;
int graph[4][4] = {
{0 , 1 , 0 , 0}... |
tacrazymage/Data-Structures-and-Algorithms | euclidean_gcd.c | #include <stdio.h>
#include <stdlib.h>
int gcd(int m, int n)
{
if(n == 0) return m;
else if(n>m) return gcd(n,m);
else return gcd(n, m%n);
}
int main()
{
int i = gcd(10,20);
printf("%d", i);
}
|
tacrazymage/Data-Structures-and-Algorithms | doubly_linked_list.c | <gh_stars>10-100
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
// Making the `size_t` keyword easier to interpret.
typedef size_t size_type;
// A pointer to the nodes in the list
// is defined for easy use in functions.
typedef struct Node* list_iterator;
// A structu... |
tacrazymage/Data-Structures-and-Algorithms | Dynamic Programming/fibonacci.c | <filename>Dynamic Programming/fibonacci.c<gh_stars>10-100
/*
* @author: <EMAIL>
* Implement a program to find n'th term
* in the fibonacci sequence through
* dynamic programming.
*/
#include <stdio.h>
#include <stdlib.h>
// We take as arguments: `n` -> The integer representing the term
// ... |
tacrazymage/Data-Structures-and-Algorithms | stack_as_static_arrays.c | #include <stdio.h> // Handles standard input/output
#include <errno.h> // Error Handling library
#include <stdlib.h>
// The maximum number of elements that can be stored in a stack.
#define MAX 65535
// Structure of stack
struct stack
{
// A integer pointing at the top of the stack.
int top;
// A array to hold the... |
tacrazymage/Data-Structures-and-Algorithms | Graph Algorithms/depth_first_search.c | #include <stdio.h>
#include <stdlib.h>
#include "boilerplate.h"
#define print printf
#define scan scanf
void DFS(vertex_iterator* graph, int nb_vertices, vertex_iterator source)
{
// graph = 1->2->3->4->5, source = 1
int currTime = 0, explored = 0;
Stack* s = (Stack*)malloc(sizeof(Stack));
init_stack(... |
tacrazymage/Data-Structures-and-Algorithms | postfix_to_infix/text.c | <filename>postfix_to_infix/text.c
#include<stdio.h>
#include<string.h>
#include<ctype.h>
void main()
{
char c='w';
char r[100] = "tirht";
strcat(r,c);
puts(r);
}
|
tacrazymage/Data-Structures-and-Algorithms | Graph Algorithms/breadth_first_search.c | <reponame>tacrazymage/Data-Structures-and-Algorithms
#include <stdio.h>
#include <stdlib.h>
#include "boilerplate.h"
#define print printf
#define scan scanf
void BFS(vertex_iterator source)
{
Queue* q = (Queue*)malloc(sizeof(Queue));
initalize_queue(q, 10);
source->color = 'G';
source->depth = 0;
... |
tacrazymage/Data-Structures-and-Algorithms | direct_address_table.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 10000
typedef size_t size_type;
typedef struct Table* iterator;
typedef const struct Table* const_iterator;
struct Table
{
int key;
char element[100];
};
int insert_in_dat(iterator t, int key, char element[])
{
if(key < 0 || key >= MAX) retu... |
tacrazymage/Data-Structures-and-Algorithms | infix_to_postfix/main.c | <gh_stars>0
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAX 65535
struct stack{
int top;
char s_content[MAX+1];
};
void PUSH(struct stack *s, char value)
{
if(s->top==MAX) perror("Overflow");
s->top++;
s->s_content[s->top]=value;... |
tacrazymage/Data-Structures-and-Algorithms | hash_tables.c | <filename>hash_tables.c
/*
* @author: tirthasheshpatel
* @e-mail: <EMAIL>
* Summary: Implemented hash tables and resolved
* collisions using (primarily) chaining
* and open addressing.
*/
// Including necessary libraries.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string... |
tacrazymage/Data-Structures-and-Algorithms | Dynamic Programming/rod_cutting_problem.c | <gh_stars>10-100
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#define max(a,b) (((a) > (b)) ? (a) : (b))
typedef struct pair
{
int x;
int y;
}Pair;
int callbacks = 0;
int cut_rod_top_down(int n, int rev[])
{
callbacks++;
if(n == 0) return 0;
int r = INT_MIN;
f... |
tacrazymage/Data-Structures-and-Algorithms | Greedy Algorithms/activity_selection_problem.c | #include <stdio.h>
#include <stdlib.h>
void recursive_activity_selector(int (*set)[2], int a[], int i, int n, int k)
{
int m = k+1;
while(m < n && set[m][0] < set[k][1])
{
m++;
}
if(m<n)
{
a[i++] = m+1;
recursive_activity_selector(set, a, i, n, m);
}
}
void greedy_a... |
tacrazymage/Data-Structures-and-Algorithms | Dynamic Programming/matrix_chain_multiplication.c | <reponame>tacrazymage/Data-Structures-and-Algorithms
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
void print_param_of_matrix_chain(int (*s)[6],int i, int j, int n)
{
if(i == j) printf(" A[%d] ", i+1);
else{
printf("( ");
print_param_of_matrix_chain(s, i, s[i][j], n);
prin... |
PlaymodesStudio/ofxOceanode_Osc | src/oscSender.h | <filename>src/oscSender.h<gh_stars>1-10
//
// oscSender.h
// Oceanode
//
// Created by <NAME> on 17/02/2021.
//
#ifndef oscSender_h
#define oscSender_h
#include "ofxOceanodeNodeModel.h"
#include "ofxOsc.h"
#include "ofxOceanodeOSCController.h"
class oscSender : public ofxOceanodeNodeModel{
public:
oscSender(s... |
PlaymodesStudio/ofxOceanode_Osc | src/ofxOceanodeOSCController.h | <reponame>PlaymodesStudio/ofxOceanode_Osc
//
// ofxOceanodeOSCController.h
// PLedNodes
//
// Created by <NAME> on 09/05/2018.
//
#ifndef ofxOceanodeOSCController_h
#define ofxOceanodeOSCController_h
#include "ofxOceanodeBaseController.h"
class ofxOceanodeOSCController : public ofxOceanodeBaseController{
public:
... |
parisiale/marionette-collective | lib/mcollective/vendor/json/ext/json/ext/generator/generator.c | #include "generator.h"
#ifdef HAVE_RUBY_ENCODING_H
static VALUE CEncoding_UTF_8;
static ID i_encoding, i_encode;
#endif
static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject,
mHash, mArray, mFixnum, mBignum, mFloat, mString, mString_Extend,
mTrueClass, mFalseClass, mNilCla... |
brexocoin/brexocoin | src/chainparamsseeds.h | #ifndef BREXO_CHAINPARAMSSEEDS_H
#define BREXO_CHAINPARAMSSEEDS_H
/**
* List of fixed seed nodes for the brexocoin network
* AUTOGENERATED by contrib/seeds/generate-seeds.py
*
* Each line contains a 16-byte IPv6 address and a port.
* IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
*... |
nequeo/sockets | NequeoSocketsEx/NequeoSocketsEx/NetworkUtils.h | /*
* ofxNetworkUtils.h
*
* Created on: 25/09/2010
* Author: arturo
*/
#pragma once
#include <cerrno>
#include "Constants.h"
#include "Utils.h"
#ifdef TARGET_WIN32
#define ENOTCONN WSAENOTCONN
#define EWOULDBLOCK WSAEWOULDBLOCK
#define ENOBUFS WSAENOBUFS
#define ECONNRESET WSAECONNR... |
nequeo/sockets | NequeoSocketsEx/NequeoSocketsEx/Network.h | <reponame>nequeo/sockets<filename>NequeoSocketsEx/NequeoSocketsEx/Network.h
#pragma once
#include "TCPClient.h"
#include "TCPManager.h"
#include "TCPServer.h"
#include "UDPManager.h"
|
2bbb/ofxMioAlpha | src/ofxMioAlphaInterface.h | //
// ofxMioAlphaInterface.h
//
// Created by ISHII 2bit on 2014/06/06.
//
//
#ifndef __ofxMioAlphaInterface__
#define __ofxMioAlphaInterface__
#include "ofMain.h"
class ofxMioAlphaInterface {
public:
virtual void findDevice(const string &uuid, bool isInTarget) {};
virtual void receiveHeartRate(const strin... |
2bbb/ofxMioAlpha | src/BluetoothManager.h | <gh_stars>1-10
//
// ofxBluetoothManager.h
//
// Created by ISHII 2bit on 2014/02/01.
// Copyright (c) 2014 buffer Renaiss co., ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
# import <CoreBluetooth/CoreBluetooth.h>
#elif TARGET_OS_MAC
#... |
2bbb/ofxMioAlpha | src/ofxMioAlphaBridge.h | //
// ofxMioAlphaBridge.h
//
// Created by ISHII 2bit on 2014/06/06.
//
//
#pragma once
#import "ofxMioAlphaInterface.h"
#import <Foundation/Foundation.h>
@interface ofxMioAlphaBridge : NSObject {
ofxMioAlphaInterface *interface;
}
- (instancetype)initWithInterface:(ofxMioAlphaInterface *)interface;
@end |
2bbb/ofxMioAlpha | example/ofApp.h | <reponame>2bbb/ofxMioAlpha
#pragma once
#include "ofMain.h"
#include "ofxMioAlpha.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int b... |
2bbb/ofxMioAlpha | src/ofxMioAlpha.h | <reponame>2bbb/ofxMioAlpha
//
// ofxMioAlpha.h
//
// Created by ISHII 2bit
//
#pragma once
#include "ofxMioAlphaInterface.h"
class ofxMioAlpha : public ofxMioAlphaInterface {
public:
ofxMioAlpha();
virtual ~ofxMioAlpha();
void setup(ofxMioAlphaInterface *interface = NULL);
void addDeviceUUID(c... |
Meru852/ecctools | modmath.c | <gh_stars>1-10
/*
Developed by <NAME>
email: <EMAIL>
gcc -o keymath keymath.c -lgmp
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <gmp.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include "util.h"
#include "gmpecc.h"
... |
Meru852/ecctools | calculatefromkey.c | /*
develop by <NAME>
Twitter: @albertobsd
email: <EMAIL>
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <gmp.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include "util.h"
#include "gmpecc.h"
#include "base58/libb... |
Meru852/ecctools | rehashaddress.c | <gh_stars>1-10
/*
Developed by <NAME>
email: <EMAIL>
Generate N deterministic privatekeys, publickey and legacy address from a password or passphrase, after M rehash of the given password
Examples:
Generate 1 privatekey and his address after 0 rehashes:
./rehashaddress -p "3'W-CB7;>bRMzH<zyE5~Woh=_O>#eX" -n... |
Meru852/ecctools | keydivision.c | <reponame>Meru852/ecctools<gh_stars>1-10
/*
Developed by <NAME>
email: <EMAIL>
gcc -o keydivision keydivision.c -lgmp
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <gmp.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include "... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/knapsack.c | #include<stdio.h>
int max (int a,int b)
{
if (a>b)
return a;
else
return b;
}
void knapsack(int m,int n,int w[],int p[])
{
int v[100][200],x[10],i,j,sum=0;
for(i=0;i<=n;i++)
v[i][0]=0;
for(j=0;j<=m;j++)
v[0][j]=0;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
if(j>=w[i])
v[i][j]=max(v[i-1][j],v[i-1][j-w[i]]+p[i]);
else
v[i... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/nqueen.c | <reponame>mvnsia/4th_Sem_Ise<filename>4rth-Sem-Ise/DAA LAB/nqueen.c<gh_stars>0
#include <stdio.h>
int N;
int board[20][20];
int is_attack(int i,int j)
{
int k,l;
for(k=0;k<N;k++)
{
if((board[i][k] == 1) || (board[k][j] == 1))
return 1;
}
for(k=0;k<N;k++)
... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/dijkstra.c | <gh_stars>0
#include<stdio.h>
void dijkstra(int source,int cost[20][20],int visited[20],int d[20],int n)
{
int i,j,min,u,w;
for(i=1;i<=n;i++)
{
visited[i]=0;
d[i]=cost[source][i];
}
visited[source]=1;
d[source]=0;
for(j=2;j<=n;j++)
{
min=111;
for... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/bubblesort.c | <gh_stars>0
#include<stdio.h>
#include<time.h>
void main()
{
int i,n,j,temp;
int a[100000];
printf("enter the size of the array \n");
scanf("%d",&n);
for(i=n;i>=1;i--)
a[n-i]=i;
clock_t start,end;
double cpu_time;
start=clock();
for(i=0;i<n;i++)
{
for(j=0;j<n-1-i;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/warshall.c | #include<stdio.h>
void warshall(int r[10][10],int n)
{
int i,j,k;
for(k=0;k<n;k++)
for(i=0;i<n;i++)
for(j=0;j<n;j++)
r[i][j]=(r[i][j]|r[i][k]&r[k][j]);
}
int main()
{
int r[10][10],i,j,n;
printf("Enter the number of vertices\n");
scanf("%d",&n);
printf("Enter adjacency matrix \n");
... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/prim.c | <reponame>mvnsia/4th_Sem_Ise<filename>4rth-Sem-Ise/DAA LAB/prim.c
#include<stdio.h>
int a,b,u,v,n,i,j,ne=1,source;
int visited[20]={0},min,mincost=0,cost[20][20];
int main()
{
printf("Enter the number of nodes\n");
scanf("%d",&n);
printf("Enter the cost matrix\n");
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
scan... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/kruskal.c | <gh_stars>0
#include<stdio.h>
int ne=1,min_cost=0;
void main()
{
int n,i,j,min,cost[20][20],a,u,b,v,parent[20];
printf("Number of vertices : \n ");
scanf("%d",&n);
printf("Enter the cost matrix \n");
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
scanf("%d",&cost[i][j]);
for(i=1;i<=n;i++)
parent[i]=0;
prin... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/selctionsort.c | <gh_stars>0
#include<stdio.h>
#include<time.h>
void main()
{
int i,n,j,min,temp;
int a[10000];
printf("enter the size of the array \n");
scanf("%d",&n);
for(i=n;i>=1;i--)
a[n-i]=i;
clock_t start,end;
double cpu_time;
start=clock();
for(i=0;i<=n-2;i++)
{
min=i;
for(j=i+1;j<=n-1;j++)
{
if(a[j]<a[min])
min=j;
}
temp=a[m... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/heapsort.c | <filename>4rth-Sem-Ise/DAA LAB/heapsort.c
#include<stdio.h>
#include<time.h>
#include<math.h>
int h[50];
void heapify(int h[],int n)
{
int i,j,n1,k,heap,v;
n1=n;
for(i=n/2;i>=1;i--)
{
k=i;
v=h[k];
heap=0;
while(!(heap)&&(2*k)<=n1)
{
j=2*k;
if(j<n1)
if(h[j]<h[j+1])
j=j+1;
if(v>=h[j])
... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/DFS.c | #include<stdio.h>
int count =0;
int dfs(int [20][20],int,int[20],int);
void main()
{
int n,a[20][20],i,j,visited[20],source,visitedorder[20];
printf("Enter the no of vertices\n");
scanf("%d",&n);
printf("Enter the adjacency matrix\n");
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
scanf("%... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/mergesort.c | <filename>4rth-Sem-Ise/DAA LAB/mergesort.c<gh_stars>0
#include<stdio.h>
#include<time.h>
//char a[100];
int a[10000];
int i,j,l,h;
void merge( int l,int mid,int h)
{
//char B[100];
int B[10000];
for(i=l;i<=h;i++)
B[i]=a[i];
i=l;
j=mid+1;
int k=l;
while(i<=mid&&j<=h)
{
if(B[i]<=B[j])
a[k++]=B[i++];
else
a[k++]=B[j++];
... |
mvnsia/4th_Sem_Ise | 4rth-Sem-Ise/DAA LAB/quicksort.c | <filename>4rth-Sem-Ise/DAA LAB/quicksort.c
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
void swap(int* a,int* b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
int Partition(int A[],int low,int high)
{
int temp,key=A[low],j=high,i=low+1;
while(i<=j)
{
while(A[i]<=key)i++;
while(A[j]>key)j--;
if(i<j)
s... |
shadyproject/xnuspy | module/el1/xnuspy_ctl/debug.c | <reponame>shadyproject/xnuspy
#include <mach/mach.h>
#include <stdbool.h>
#include <stdint.h>
#include "../../common/xnuspy_structs.h"
#include "debug.h"
#include "externs.h"
#include "mem.h"
void desc_freelist(void){
lck_rw_lock_shared(xnuspy_rw_lck);
SPYDBG("[Freelist] ");
if(STAILQ_EMPTY(&freelist))... |
shadyproject/xnuspy | module/el1/xnuspy_ctl/mem.c | #include <mach/mach.h>
#include <stdbool.h>
#include <stdint.h>
#include <unistd.h>
#include "externs.h"
#include "pte.h"
__attribute__ ((naked)) uint64_t kvtophys(uint64_t kaddr){
asm volatile(""
"mrs x1, DAIF\n"
"msr DAIFSet, #0xf\n"
"at s1e1r, x0\n"
"mrs x2, par_... |
shadyproject/xnuspy | module/preboot_hook.c | #include <mach-o/nlist.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/sysctl.h>
#include "common/asm.h"
#include "common/asm_support.h"
#include "common/common.h"
#include "common/pongo.h"
#include "common/xnuspy_structs.h"
#include "el1/hook_system_check_sysctlbyname_hook_instrs.h"
#inc... |
mike-burns/pick | pty.c | <gh_stars>100-1000
#include "config.h"
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/wait.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
__dead static ... |
jinhwang15/FBMessengerShareLocation | FBMessengerShareLocation/Pods/Headers/Public/FBSDKMessengerShareKit/FBSDKMessengerShareKit/FBSDKMessengerUrlHandler.h | // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with... |
jinhwang15/FBMessengerShareLocation | FBMessengerShareLocation/Pods/Target Support Files/Pods-FBMessengerShareLocation/Pods-FBMessengerShareLocation-environment.h | <reponame>jinhwang15/FBMessengerShareLocation
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Bolts
#define COCOAPODS_POD_AVAILABLE_Bolts
... |
jinhwang15/FBMessengerShareLocation | FBMessengerShareLocation/FBMessengerShareLocation/MessengerShareLocation-BridgingHeader.h | //
// MessengerShareLocation-BridgingHeader.h
// FBMessengerShareLocation
//
// Created by <NAME> on 16/05/15.
// Copyright (c) 2015 msdeveloper. All rights reserved.
//
#ifndef FBMessengerShareLocation_MessengerShareLocation_BridgingHeader_h
#define FBMessengerShareLocation_MessengerShareLocation_BridgingHeader_h... |
SJ-magic-youtube-VisualProgrammer/74_oF_SpreadParticle_musicSync | ofApp.h | /************************************************************
************************************************************/
#pragma once
/************************************************************
************************************************************/
#include "ofMain.h"
#include "sj_common.h"
#include "fft.... |
SJ-magic-youtube-VisualProgrammer/74_oF_SpreadParticle_musicSync | DrawFFT.h | <filename>DrawFFT.h
/************************************************************
************************************************************/
#pragma once
/************************************************************
************************************************************/
#include <ofMain.h>
#include "fft.h"
#... |
SJ-magic-youtube-VisualProgrammer/74_oF_SpreadParticle_musicSync | DrawSpreadParticle.h | <gh_stars>0
/************************************************************
************************************************************/
#pragma once
/************************************************************
************************************************************/
#include <ofMain.h>
#include "fft.h"
#include ... |
i-vishi/ds-and-algo | Binary Tree - Inorder Traversal/C/inorderBinaryTree.c | <gh_stars>1-10
/* Author: <NAME>
* Created: 06-28-2021 11:05:28
*/
#include <stdio.h>
#include <stdlib.h>
// Binary Tree Node
typedef struct TreeNode
{
int val;
struct TreeNode *left;
struct TreeNode *right;
} TreeNode;
// function to get a new tree node
TreeNode *newNode(int val)
{
TreeNode *nod... |
i-vishi/ds-and-algo | Sort - Quick/C/quickSort.c | /* Author: <NAME>
* Created: 13-01-2021 09:45:23
*/
#include <stdio.h>
// helper function to get pivot
int partition(int a[], int l, int h)
{
int p = a[h];
int i = l;
for (int j = l; j <= h - 1; j++)
{
if (a[j] < p)
{
int tmp = a[i];
a[i] = a[j];
a[j] = tmp;
i++;
}
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.