repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
GarryLau/DesignPatterns
Visitor/Element.h
#pragma once #include "Visitor.h" #ifdef __cplusplus extern "C" { #endif class Visitor; class Element { public: ~Element() {} virtual void accept(Visitor *visitor) = 0; }; class ElementA : public Element { public: virtual void accept(Visitor...
GarryLau/DesignPatterns
Adapter_multi-inheritance/Rect.h
<gh_stars>0 #pragma once #include <iostream> /* Target class */ class Rect { public: Rect() { std::cout << "Rect constructor called." << std::endl; } virtual void draw() = 0; // some function members protected: ~Rect() = default; private: // some data members };
GarryLau/DesignPatterns
Composite/Graphic.h
#pragma once #include <vector> #include <iostream> /* component */ class Graphic { public: virtual void draw() const = 0; virtual void add(Graphic *g){} Graphic() = default; ~Graphic() = default; }; /* leaf */ class Line : public Graphic { public: Line() { std::cout <<...
GarryLau/DesignPatterns
AbstractFactory/FactoryA.h
<gh_stars>0 #ifndef _FACTORY_A_H #define _FACTORY_A_H #include "WidgetFactory.h" #ifdef __cplusplus extern "C" { #endif class FactoryA : public WidgetFactory { public: FactoryA() = default; ~FactoryA() = default; virtual Window * createWindow() override; virtual ScrollBar * createS...
GarryLau/DesignPatterns
AbstractFactory/WidgetFactory.h
#ifndef _WIDGET_FACTORY_H_ #define _WIDGET_FACTORY_H_ #include "Window.h" #include "ScrollBar.h" #ifdef __cplusplus extern "C"{ #endif class WidgetFactory { public: WidgetFactory() = default; ~WidgetFactory() = default; public: virtual Window * createWindow() = 0; virtual ScrollBar *...
GarryLau/DesignPatterns
Iterator/Stack.h
<filename>Iterator/Stack.h #pragma once #include <exception> #include <iostream> #define SIZE (10) class Stack { friend class StackIterator; public: Stack() { m_current = -1; } void push(int a) { if (m_current >= SIZE-1) { throw("Stack is too full to add an e...
GarryLau/DesignPatterns
State/State.h
<reponame>GarryLau/DesignPatterns<gh_stars>0 #pragma once #include "Context.h" class State { public: ~State() = default; /* State为所有委托给它的请求实现缺省行为 */ virtual void Action1_S(Context *context) { std::cout << "Do default action1." << std::endl; } virtual void Action2_S(Context *context) { std::cout ...
GarryLau/DesignPatterns
Facade/Alarm.h
#ifndef _ALARM_H_ #define _ALARM_H_ #include <iostream> #ifdef __cplusplus extern "C" { #endif class Alarm { public: void alarmOn() { std::cout << "Alarm is on." << std::endl; } void alarmOff() { std::cout << "Alarm is off." << std::endl; } }; #ifdef __cplusplus } #endif #en...
GarryLau/DesignPatterns
Facade/Facade.h
<gh_stars>0 #ifndef _FACADE_H_ #define _FACADE_H_ #include <iostream> #include "AirCondition.h" #include "Alarm.h" #include "TV.h" #ifdef __cplusplus extern "C" { #endif class Facade { public: Facade(){ std::cout << "Facade ctor called." << std::endl; } void goToWork() { m_air_condi...
GarryLau/DesignPatterns
Prototype/Document.h
<filename>Prototype/Document.h #ifndef _DOCUMENT_H_ #define _DOCUMENT_H_ #include <iostream> #ifdef __cplusplus extern "C" { #endif typedef enum CATEGORY { XML = 0, JSON = 1, SPREADSHEET = 2 }Category; class Document { public: Document() = d...
GarryLau/DesignPatterns
AbstractFactory/WinStyleA.h
#ifndef _WIN_STYLE_A_H_ #define _WIN_STYLE_A_H_ #include "Window.h" #ifdef __cplusplus extern "C"{ #endif class WinStyleA : public Window { public: WinStyleA(unsigned int resolution); ~WinStyleA() = default; virtual WinStyleA * addWindow() override; unsigned int getResolution(); priva...
GarryLau/DesignPatterns
State/Context.h
<reponame>GarryLau/DesignPatterns #pragma once #include <iostream> class Context { friend class State; public: /* 通过构造函数设定初始状态 */ Context(State *state); /* 与状态有关的操作,在本实现中以_S作为标识,均委托给Context的State类型的成员m_state进行实现 */ void Action1_S(); void Action2_S(); void Action3_S(); /* 与状态无关的操作,没有_S */ void ...
GarryLau/DesignPatterns
Memento/Number.h
<reponame>GarryLau/DesignPatterns #ifndef _NUMBER_H_ #define _NUMBER_H_ #include <iostream> #include "Memento.h" #ifdef __cplusplus extern "C" { #endif // __cplusplus class Number { public: Number(int val) : m_val(val) { std::cout << "Number ctor called." << std::endl;...
GarryLau/DesignPatterns
Memento/Command.h
#ifndef _COMMAND_H_ #define _COMMAND_H_ #include <iostream> #include "Memento.h" #include "Number.h" #ifdef __cplusplus extern "C" { #endif // __cplusplus #define MAX_OPERATION (20) class Command { public: typedef void(Number::*Action)(); Command(Number *receiver, Acti...
GarryLau/DesignPatterns
Strategy/Collection .h
<reponame>GarryLau/DesignPatterns<gh_stars>0 #pragma once #include <iostream> #include "SortBehavior .h" #include "SearchBehavior .h" /* Context */ class Collection { public: Collection() { m_sort = nullptr; m_search = nullptr; } void setSort(SortBehavior *sort) { m_...
GarryLau/DesignPatterns
Command/RemoteControl.h
<filename>Command/RemoteControl.h #ifndef _REMOTE_CONTROL_H_ #define _REMOTE_CONTROL_H_ #include <iostream> #include "Command.h" #ifdef __cplusplus extern "C" { #endif /* invoker : Stores the ConcreteCommand object */ class RemoteControl { public: void setCommand(ICommand *comm...
GarryLau/DesignPatterns
Adapter_multi-inheritance/LegacyRect.h
#pragma once #include <iostream> /* Adaptee class */ class LegacyRect { public: LegacyRect(int x,int y,int w,int h): m_x(x),m_y(y),m_w(w),m_h(h){ std::cout << "LegacyRect constructor called." << std::endl; } void legacyDraw() { std::cout << "m_x:" << m_x << "\tm_y:" << m_y << ...
GarryLau/DesignPatterns
AbstractFactory/WinStyleB.h
#ifndef _WIN_STYLE_B_H_ #define _WIN_STYLE_B_H_ #include "Window.h" #ifdef __cplusplus extern "C"{ #endif class WinStyleB : public Window { public: WinStyleB(int w,int h); ~WinStyleB()=default; unsigned int getWidth(); unsigned int getHeight(); virtual WinStyleB * addWindow() over...
GarryLau/DesignPatterns
Adapter_multi-inheritance/Adapter.h
<gh_stars>0 #pragma once #include "Rect.h" #include "LegacyRect.h" /* Adapter class */ class Adapter : public Rect, private LegacyRect { public: Adapter(int x,int y, int w,int h):LegacyRect(x,y,w,h) { std::cout << "Adapter constructor called." << std::endl; } void draw(){ lega...
GarryLau/DesignPatterns
AbstractFactory/ScrollStyleA.h
#ifndef _SCROLL_STYLEA_H_ #define _SCROLL_STYLEA_H_ #include "ScrollBar.h" #include <string> #ifdef __cplusplus extern "C"{ #endif class ScrollStyleA : public ScrollBar { public: ScrollStyleA(std::string direction); ~ScrollStyleA() = default; std::string getDirection(); virtual Scroll...
GarryLau/DesignPatterns
Proxy/Subject .h
<reponame>GarryLau/DesignPatterns<filename>Proxy/Subject .h #ifndef _SUBJECT_H_ #define _SUBJECT_H_ #include <iostream> #ifdef __cplusplus extern "C" { #endif // __cplusplus class Subject { public: ~Subject(){} virtual void doRequest() = 0; }; class RealSubject ...
GarryLau/DesignPatterns
Interpreter/RomanNumInterpreter.h
#include <iostream> #include <string> class Thousand; class Hundred; class Ten; class One; class RNInterpreter { public: RNInterpreter(); // ctor for client RNInterpreter(int) {} // ctor for subclasses, avoids infinite loop int interpret(char*); // interpret() for client virtual voi...
GarryLau/DesignPatterns
State/StateB.h
<filename>State/StateB.h<gh_stars>0 #pragma once #include "State.h" class StateB : public State { public: /* StateB模式下Context做Action2_S、Action3_S是有意义的,因此无需实现Action1_S方法 */ virtual void Action2_S(Context *context) override; virtual void Action3_S(Context *context) override; /* 具体状态以单例模式实现 */ static Sta...
GarryLau/DesignPatterns
IteratorPattern/Iterator.h
<filename>IteratorPattern/Iterator.h #pragma once #include "Aggregate.h" #include <iostream> class Iterator { public: virtual void First() = 0; virtual void Next() = 0; virtual bool isDone() const = 0; virtual int currentItem() const = 0; }; class ListIterator : public Iterator { public...
GarryLau/DesignPatterns
TemplateMethod/AbstractClass .h
<reponame>GarryLau/DesignPatterns<filename>TemplateMethod/AbstractClass .h #pragma once #include <iostream> class AbstractClass { public: ~AbstractClass() = default; /* A template method */ void templateMethod() { primitiveOperation1(); primitiveOperation2(); concreteOp...
GarryLau/DesignPatterns
Observer/Observer.h
#ifndef _OBSERVER_H_ #define _OBSERVER_H_ #include <string> #include <iostream> class Observer { public: virtual ~Observer() = default; virtual void update(std::string message) = 0; }; class ConcreteObserver : public Observer { public: ConcreteObserver(std::string name) : m_name(name) { std::cout...
GarryLau/DesignPatterns
Strategy/SortBehavior .h
<filename>Strategy/SortBehavior .h #pragma once #include <iostream> class SortBehavior { public: ~SortBehavior() = default; virtual void sort() = 0; }; class HeapSort : public SortBehavior { public: virtual void sort() override { std::cout << "Using HeapSort." << std::endl; } ...
GarryLau/DesignPatterns
Facade/TV.h
#ifndef _TV_H_ #define _TV_H_ #include <iostream> #ifdef __cplusplus extern "C" { #endif class TV { public: void tvOn() { std::cout << "TV is on." << std::endl; } void tvOff() { std::cout << "TV is off." << std::endl; } }; #ifdef __cplusplus } #endif #endif // end of _TV_...
GarryLau/DesignPatterns
Memento/Memento.h
#ifndef _MEMENTO_H_ #define _MEMENTO_H_ #include <iostream> #ifdef __cplusplus extern "C" { #endif // __cplusplus class Memento { public: Memento(int num) : m_num(num) { std::cout << "Memento ctor called." << std::endl; } private: int m_num; ...
GarryLau/DesignPatterns
Command/Light.h
<reponame>GarryLau/DesignPatterns #ifndef _LIGHT_H_ #define _LIGHT_H_ #include <iostream> #ifdef __cplusplus extern "C"{ #endif /* Receiver Class */ class Light { public: void LightOn() { std::cout << "Turning on the light." << std::endl; } void LightOff() { std::cout...
GarryLau/DesignPatterns
Flyweight/Model.h
#ifndef _MODEL_H_ #define _MODEL_H_ #include <string> #include <iostream> #ifdef __cplusplus extern "C" { #endif /* Flyweight Abstract Class */ class Model { public: Model(std::string name, int speed) : m_name(name), m_speed(speed) { std::cout << "Model ctor called....
GarryLau/DesignPatterns
Mediator/Mediator.h
<reponame>GarryLau/DesignPatterns #pragma once #include <vector> #ifdef __cplusplus extern "C" { #endif class IColleague; class IMediator { public: ~IMediator() {} virtual void registerColleague(IColleague *colleague) = 0; virtual void broadCast(IColleague *colleague) = 0; protected: s...
GarryLau/DesignPatterns
Visitor/Visitor.h
#pragma once #include <iostream> #include "Element.h" #ifdef __cplusplus extern "C" { #endif class ElementA; class ElementB; class Visitor { public: ~Visitor() {} virtual void visitElementA(ElementA *element) = 0; virtual void visitElementB(ElementB *elem...
Zoulei-CSU/3dtiles-mod
src/osg/osg/FastPicker_dll.h
<reponame>Zoulei-CSU/3dtiles-mod<gh_stars>0 #ifndef dll_h__ #define dll_h__ # define FastPicker_API __declspec(dllexport) // #ifdef FastPicker_Lib // # define FastPicker_API __declspec(dllexport) // #else // # define FastPicker_API __declspec(dllimport) // #endif #endif // dll_h__
Zoulei-CSU/3dtiles-mod
src/osg/AsyncReader/AsyncRequestBase.h
<gh_stars>0 #ifndef AsyncRequestBase_h__ #define AsyncRequestBase_h__ #include<windows.h> #include<osg/Referenced> #include<osg/ref_ptr> #include<osg/observer_ptr> #include<osg/Group> class AsyncRequestBase; class AsyncFunctorBase :public osg::Referenced { public: AsyncFunctorBase(osg::ref_ptr<AsyncRequestBase> requ...
Zoulei-CSU/3dtiles-mod
src/osg/AsyncReader/AsyncReader.h
<reponame>Zoulei-CSU/3dtiles-mod #ifndef AsyncReader_h__ #define AsyncReader_h__ #include<osg/Referenced> #include<osg/ref_ptr> #include<osg/OperationThread> #include<OpenThreads/Mutex> #include<OpenThreads/Thread> #include "AsyncRequestBase.h" #include<list> class AsyncReader :public osg::Referenced { public: stati...
Zoulei-CSU/3dtiles-mod
src/osg/osg/FastPicker.h
<gh_stars>0 #ifndef FastPicker_h__ #define FastPicker_h__ #include "FastPicker_dll.h" #include "windows.h" #include <osg/Camera> #include <osgDB/WriteFile> #include <osg/Image> #include <OpenThreads/Mutex> #include <osg/Matrix> #include <osgViewer/Viewer> #include <osg/GraphicsContext> #include <osg/Group> #include <os...
Panda-Lewandowski/kernelspacelog
keylogger.h
#ifndef KEYLOGGER_H #define KEYLOGGER_H #include <asm/uaccess.h> #include <asm/segment.h> #include <linux/fs.h> #include <linux/types.h> #include <linux/module.h> #include <linux/keyboard.h> #include <linux/input.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/buffer_head.h> #include <linux/time.h...
Panda-Lewandowski/kernelspacelog
parser.h
#ifndef PARSER_H #define PARSER_H #include <linux/keyboard.h> #include <linux/input.h> #include <stdio.h> #include <time.h> #define KEYS_NUM 127 const char* keymap[] = { "<UKNWN>", "ESC", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "<BACKSPACE>", "<TAB>", "q", "w", "e", "r", ...
Panda-Lewandowski/kernelspacelog
keylogger.c
#ifndef __KERNEL__ #define __KERNEL__ #endif #ifndef MODULE #define MODULE #endif #include "keylogger.h" int flag; int * buffer; int * buffer_ptr; int * buffer_endptr; long buf_length; unsigned int * deltas; unsigned int * deltas_ptr; unsigned int * deltas_endptr; long deltas_length; struct timespec * times; struc...
Panda-Lewandowski/kernelspacelog
parser.c
<gh_stars>1-10 #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include "parser.h" extern const char* keymap[]; int main(int argc, char *argv[]) { FILE * fp; int * buffer; unsigned int * deltas; struct timespec * times; int s; float speed; float av_delta; f...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_interface_unregister.c
<reponame>Acidburn0zzz/skabus<gh_stars>1-10 /* ISC license. */ #include <errno.h> #include <skalibs/tai.h> #include <skalibs/skaclient.h> #include <skabus/rpc.h> int skabus_rpc_interface_unregister (skabus_rpc_t *a, uint32_t ifid, tain_t const *deadline, tain_t *stamp) { skabus_rpc_interface_result_t r ; if (!s...
Acidburn0zzz/skabus
src/pub/skabus-pubd.c
<filename>src/pub/skabus-pubd.c /* ISC license. */ #include <stdint.h> #include <unistd.h> #include <sys/stat.h> #include <sys/uio.h> #include <fcntl.h> #include <errno.h> #include <signal.h> #include <stdlib.h> #include <regex.h> #include <skalibs/posixishard.h> #include <skalibs/uint32.h> #include <skalibs/uint64.h...
Acidburn0zzz/skabus
src/libskabus/skabus_pub_sendpm_async.c
<reponame>Acidburn0zzz/skabus /* ISC license. */ #include <string.h> #include <sys/uio.h> #include <errno.h> #include <skalibs/unixmessage.h> #include <skalibs/skaclient.h> #include <skabus/pub.h> #include "skabus-pub-internal.h" int skabus_pub_sendpm_withfds_async (skabus_pub_t *a, char const *idstr, char const *s...
Acidburn0zzz/skabus
src/rpc/skabus-rpcd.c
<reponame>Acidburn0zzz/skabus /* ISC license. */ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdint.h> #include <fcntl.h> #include <limits.h> #include <regex.h> #include <errno.h> #include <signal.h> #include <skalibs/posixplz.h> #include <skalibs/posixishard.h> #include <skalibs/uint32...
Acidburn0zzz/skabus
src/libskabus/skabus_pub_send_cb.c
/* ISC license. */ #include <errno.h> #include <skalibs/posixishard.h> #include <skalibs/uint64.h> #include <skalibs/unixmessage.h> #include <skabus/pub.h> int skabus_pub_send_cb (unixmessage_t const *m, void *p) { skabus_pub_send_result_t *r = p ; if (!m->len || m->nfds) return (errno = EPROTO, 0) ; if (m->s...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_interface_register.c
<gh_stars>1-10 /* ISC license. */ #include <errno.h> #include <skalibs/tai.h> #include <skalibs/skaclient.h> #include <skabus/rpc.h> int skabus_rpc_interface_register (skabus_rpc_t *a, uint32_t *ifid, char const *ifname, skabus_rpc_interface_t const *ifbody, char const *re, tain_t const *deadline, tain_t *stamp) { ...
Acidburn0zzz/skabus
src/libskabus/skabus_pub_subunsub.c
/* ISC license. */ #include <errno.h> #include <skalibs/skaclient.h> #include <skabus/pub.h> int skabus_pub_subunsub (skabus_pub_t *a, char what, char const *id, tain_t const *deadline, tain_t *stamp) { unsigned char r ; if (!skabus_pub_subunsub_async(a, what, id, &r)) return 0 ; if (!skaclient_syncify(&a->co...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_send.c
<filename>src/libskabus/skabus_rpc_send.c /* ISC license. */ #include <skabus/rpc.h> #include "skabus-rpc-internal.h" uint64_t skabus_rpc_send_withfds (skabus_rpc_t *a, char const *ifname, char const *s, size_t len, int const *fds, unsigned int nfds, unsigned char const *bits, tain_t const *limit, tain_t const *deadl...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_send_cb.c
/* ISC license. */ #include <sys/uio.h> #include <errno.h> #include <skalibs/posixishard.h> #include <skalibs/uint64.h> #include <skalibs/gensetdyn.h> #include <skalibs/avltree.h> #include <skalibs/unixmessage.h> #include <skalibs/skaclient.h> #include <skabus/rpc.h> #include "skabus-rpc-internal.h" static int auto...
Acidburn0zzz/skabus
src/rpc/skabus-rpc-daemon.c
/* ISC license. */ #include <sys/types.h> #include <limits.h> #include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/exec.h> #include <s6/config.h> #include <skabus/config.h> #define USAGE "skabus-rpc-daemon [ -v verbosity ] [ -d | -D ] [ -1 ] [ -c maxconn ] [ -b bac...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_sendvpm_async.c
<reponame>Acidburn0zzz/skabus /* ISC license. */ #include <skabus/rpc.h> #include "skabus-rpc-internal.h" int skabus_rpc_sendvpm_withfds_async (skabus_rpc_t *a, char const *cname, struct iovec const *v, unsigned int vlen, int const *fds, unsigned int nfds, unsigned char const *bits, tain_t const *limit, skabus_rpc_se...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_send_async.c
<reponame>Acidburn0zzz/skabus /* ISC license. */ #include <skabus/rpc.h> #include "skabus-rpc-internal.h" int skabus_rpc_send_withfds_async (skabus_rpc_t *a, char const *ifname, char const *s, size_t len, int const *fds, unsigned int nfds, unsigned char const *bits, tain_t const *limit, skabus_rpc_send_result_t *r) {...
Acidburn0zzz/skabus
src/libskabus/skabus_pub_sendpm.c
/* ISC license. */ #include <errno.h> #include <skalibs/skaclient.h> #include <skabus/pub.h> uint64_t skabus_pub_sendpm_withfds (skabus_pub_t *a, char const *id, char const *s, size_t len, int const *fds, unsigned int nfds, unsigned char const *bits, tain_t const *deadline, tain_t *stamp) { skabus_pub_send_result...
Acidburn0zzz/skabus
src/libskabus/skabus-rpc-internal.h
/* ISC license. */ #ifndef SKABUS_RPC_INTERNAL_H #define SKABUS_RPC_INTERNAL_H #include <sys/uio.h> #include <skalibs/uint64.h> #include <skalibs/tai.h> #include <skalibs/unixmessage.h> #include <skabus/rpc.h> extern int skabus_rpc_sendq_withfds_async (skabus_rpc_t *, char const *, size_t, char const *, char const *...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_start.c
<reponame>Acidburn0zzz/skabus /* ISC license. */ #include <skalibs/skaclient.h> #include <skabus/rpc.h> int skabus_rpc_start (skabus_rpc_t *a, char const *path, tain_t const *deadline, tain_t *stamp) { return skaclient_start_b( &a->connection, &a->buffers, path, SKACLIENT_OPTION_ASYNC_ACCEPT_FDS, ...
Acidburn0zzz/skabus
src/rpc/skabus_rpcd_client.c
/* ISC license. */ #include <sys/types.h> #include <stdint.h> #include <errno.h> #include <regex.h> #include <skalibs/djbunix.h> #include <skalibs/error.h> #include <skalibs/strerr2.h> #include <skalibs/tai.h> #include <skalibs/iopause.h> #include <skalibs/genalloc.h> #include <skalibs/genset.h> #include <skalibs/gens...
Acidburn0zzz/skabus
src/rpc/skabus_rpccctl.c
<gh_stars>1-10 /* ISC license. */ #include <sys/uio.h> #include <stdint.h> #include <string.h> #include <errno.h> #include <stdlib.h> #include <limits.h> #include <skalibs/posixishard.h> #include <skalibs/uint32.h> #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> #include <skalibs/socket.h> #include <skali...
Acidburn0zzz/skabus
src/libskabus/skabus_pub_list.c
/* ISC license. */ #include <errno.h> #include <skalibs/skaclient.h> #include <skabus/pub.h> int skabus_pub_list (skabus_pub_t *a, stralloc *sa, diuint32 *n, tain_t const *deadline, tain_t *stamp) { skabus_pub_list_result_t r ; if (!skabus_pub_list_async(a, sa, &r)) return 0 ; if (!skaclient_syncify(&a->conne...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_sendpm.c
<gh_stars>1-10 /* ISC license. */ #include <skabus/rpc.h> #include "skabus-rpc-internal.h" uint64_t skabus_rpc_sendpm_withfds (skabus_rpc_t *a, char const *cname, char const *s, size_t len, int const *fds, unsigned int nfds, unsigned char const *bits, tain_t const *limit, tain_t const *deadline, tain_t *stamp) { re...
Acidburn0zzz/skabus
src/libskabus/skabus_pub_register.c
/* ISC license. */ #include <errno.h> #include <skalibs/skaclient.h> #include <skabus/pub.h> int skabus_pub_register (skabus_pub_t *a, char const *id, char const *sre, char const *wre, tain_t const *deadline, tain_t *stamp) { unsigned char r ; if (!skabus_pub_register_async(a, id, sre, wre, &r)) return 0 ; if...
Acidburn0zzz/skabus
src/misc/skabus-dynteed.c
/* ISC license. */ #include <skalibs/nonposix.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> #include <sys/socket.h> /* shutdown */ #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <signal.h> #include <skalibs/types.h> #include <skalibs/siovec.h> #include <skalibs/allreadwrite....
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_sendv.c
/* ISC license. */ #include <skabus/rpc.h> #include "skabus-rpc-internal.h" uint64_t skabus_rpc_sendv_withfds (skabus_rpc_t *a, char const *ifname, struct iovec const *v, unsigned int vlen, int const *fds, unsigned int nfds, unsigned char const *bits, tain_t const *limit, tain_t const *deadline, tain_t *stamp) { re...
Acidburn0zzz/skabus
src/libskabus/skabus_rpc_sendq.c
/* ISC license. */ #include <errno.h> #include <skalibs/skaclient.h> #include <skabus/rpc.h> #include "skabus-rpc-internal.h" uint64_t skabus_rpc_sendq_withfds (skabus_rpc_t *a, char const *prefix, size_t plen, char const *ifname, char const *s, size_t len, int const *fds, unsigned int nfds, unsigned char const *bi...
Acidburn0zzz/skabus
src/rpc/skabus-rpc-client.c
<reponame>Acidburn0zzz/skabus /* ISC license. */ #include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/exec.h> #include <s6/config.h> #include <skabus/config.h> #include "skabus-rpcc.h" #define USAGE "skabus-rpc-client [ -v verbosity ] [ -d | -D ] [ -1 ] [ -c maxconn...
jorjiiie/chot
board.h
<gh_stars>0 #include <vector> #include <string> #include <cmath> #include <iostream> // #include "legal.h" class board { int pos[8][8][2],atk[8][8][2]; public: std::string printBoard(void); // print board void startGame(void); // starts game with default setup void setPos(int, int, int, int); // testing met...
jorjiiie/chot
legal.h
<reponame>jorjiiie/chot<gh_stars>0 #include <vector> #include <string> #include <cmath> #include "board.h" bool checkStr(int ul, int pn, int x, int y, int d) { if (d > 7 || x > 7 || y > 7 || d < 0 || x < 0 || y < 0) return false; int use = 0; d+=pn; if (ul){ use = y; while (abs(d-use) > 0) { if(r...
jiskattema/openmptest
main.c
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <omp.h> int slow_function_with_mp() { double stuff[1000]; long i; #pragma omp parallel for private(i) shared(stuff) for (i=0; i<9999999; i++) { stuff[i % 1000] = sin(i*i); } } void main(int argc, char **argv) { double start, end; int ...
OpenSatKit-Apps/tftp
fsw/src/netif.h
/* ** Purpose: Network interface abstractions file transfer application. ** ** Notes: ** None ** ** References: ** 1. OpenSatKit Object-based Application Developer's Guide and the ** osk_c_demo app that illustrates best practices with comments. ** 2. cFS Application Developer's Guide. ** ** Written by <...
OpenSatKit-Apps/tftp
fsw/src/app_cfg.h
<filename>fsw/src/app_cfg.h /* ** Purpose: Define configurations for the Trivial File Transfer Protocol (TFTP) ** application ** ** Notes: ** 1. These configurations should have an application scope and define ** parameters that shouldn't need to change across deployments. If ** a change is made to...
OpenSatKit-Apps/tftp
fsw/src/netif.c
<reponame>OpenSatKit-Apps/tftp /* ** Purpose: Network interface abstractions ** ** Notes: ** 1. ** ** References: ** 1. OpenSatKit Object-based Application Developer's Guide and the ** osk_c_demo app that illustrates best practices with comments. ** 2. cFS Application Developer's Guide. ** ** Written ...
OpenSatKit-Apps/tftp
fsw/src/tftp_app.h
<filename>fsw/src/tftp_app.h /* ** Purpose: Trivial File Transport Protocol application ** ** Notes: ** 1. FSW is connectionless server and ground system is client ** ** References: ** 1. OpenSatKit Object-based Application Developer's Guide and the ** osk_c_demo app that illustrates best practices with commen...
OpenSatKit-Apps/tftp
fsw/src/tftp_app.c
<reponame>OpenSatKit-Apps/tftp<filename>fsw/src/tftp_app.c /* ** Purpose: Trivial File Transport Protocol application ** ** Notes: ** 1. This is non-flight code so an attempt has been made to balance keeping ** it simple while making it robust. Limiting the number of configuration ** parameters and integra...
OpenSatKit-Apps/tftp
fsw/platform_inc/tftp_platform_cfg.h
/* ** Purpose: Define platform configurations for the OpenSatKit TFTP application ** ** Notes: ** 1. These definitions should be minimal and only contain parameters that ** need to be configurable and that must be defined at compile time. ** Use app_cfg.h for compile-time parameters that don't need to be ...
JamalJo/AndroLua
app/src/main/jni/luajava/log.h
<gh_stars>100-1000 // // Created by leon on 16/3/10. // #ifndef LUA_LOG_H #define LUA_LOG_H #include <android/log.h> #define LOG_LEVEL 10 #define LOG_TAG "LUA-JNI" #define LOGI(level, ...) if (level <= LOG_LEVEL) {__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__);} #define LOGE(level, ...) if (level <= L...
ScottTodd/uVkCompute
uvkc/vulkan/command_buffer.h
<reponame>ScottTodd/uVkCompute // Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by...
Jiaqi-WANG/DroneTarget
Drones_Test_Multiboot/include/drone_test/keyboard_controller.h
<filename>Drones_Test_Multiboot/include/drone_test/keyboard_controller.h #include <ros/ros.h> #include <std_msgs/Empty.h> #include <geometry_msgs/Twist.h> class DroneController { public: DroneController(); ~DroneController(); void sendTakeoff(); void sendLand(); void sendEmergen...
agentS/UnmanglerBackend
unmangler/src/unmangler.h
<filename>unmangler/src/unmangler.h #ifndef UNMANGLER_H #define UNMANGLER_H #include <ngrest/common/Service.h> class unmangler: public ngrest::Service { public: // *method: GET std::string unmangle(std::string mangled); }; #endif // UNMANGLER_H
GreatBlambo/voxel_cone_tracing
src/device.h
#pragma once #include <glad/glad.h> #include <GLFW/glfw3.h> #include <vector> #define MAX_BOUND_TEXTURES 32 #define MAX_BOUND_UBOS 32 typedef size_t pipeline_id_t; typedef size_t vertex_buffer_t; typedef struct { GLuint vao; GLuint shader_program; GLuint textures[MAX_BOUND_TEXTURES]; size_t num_textures; ...
GreatBlambo/voxel_cone_tracing
src/texture_3d.h
#pragma once #include <glad/glad.h> #include <GLFW/glfw3.h> GLuint create_tex_3d(int width, int height, int depth, int levels); void destroy_tex_3d(GLuint tex); void activate_tex_3d(GLuint program, GLuint tex, GLuint unit); void clear_tex_3d(GLuint tex, GLfloat clear_color[4]); void mip_tex_3d(GLuint tex);
GreatBlambo/voxel_cone_tracing
src/shared.h
#pragma once #include <stdint.h> typedef struct { uint8_t* ptr; size_t used; size_t size; } buffer_t;
GreatBlambo/voxel_cone_tracing
src/renderer.h
<filename>src/renderer.h // TODO: Eliminate std // TODO: Make backend agnostic // TODO: Buckets accept commands rather than draw_objs // TODO: Handles should actually do something; currently they're just indices // TODO: Move shader loading to the device #pragma once #include <glad/glad.h> #include <GLFW/glfw3.h> #in...
GreatBlambo/voxel_cone_tracing
lib/gl_utils/include/gl_utils/gl_helpers.h
<reponame>GreatBlambo/voxel_cone_tracing #pragma once #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <glad/glad.h> #include <GLFW/glfw3.h> #ifdef __cplusplus extern "C" { #endif typedef struct { char name[256]; int location; int size; GLenum type; bool normalize; size_t stride; s...
GreatBlambo/voxel_cone_tracing
lib/gl_utils/src/gl_helpers.c
#include <gl_utils/gl_helpers.h> #include <string.h> // Vertex Specs void create_vert_attrib(vert_attrib_t* attrib, const char* name, int location, int size, GLenum type, bool normalize, ...
GreatBlambo/voxel_cone_tracing
src/camera.h
<gh_stars>10-100 #pragma once #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #define GLM_ENABLE_EXPERIMENTAL #include <glm/gtx/rotate_vector.hpp> struct Camera { public: Camera(glm::vec3 initial_pos, float pitch, float yaw) : m_up(0, 1, 0) , m_pos(initial_pos) , m_pitch(pitch)...
ftdi-paul-jiao/eve_sdk
eve/bt81x.h
<filename>eve/bt81x.h #ifndef BT81X_H #define BT81X_H #define RAM_G_SIZE 1024*1024L #define CMDBUF_SIZE 4096UL #define PPC 16 #define ADC_DIFFERENTIAL 1UL #define ADC_SINGLE_ENDED 0UL #define ADPCM_SAMPLES 2UL #define ALPHA 5UL #define ALWAYS 7UL #define...
ftdi-paul-jiao/eve_sdk
eve/eve.h
<gh_stars>1-10 #if defined(FT800_ENABLE) || defined(FT801_ENABLE) # include <ft80x.h> #elif defined(FT810_ENABLE) || defined(FT811_ENABLE) || defined(FT812_ENABLE) || defined(FT813_ENABLE) # include <ft81x.h> #elif defined(BT815_ENABLE) || defined(BT816_ENABLE) # include <bt81x.h> #else # error "You must d...
ftdi-paul-jiao/eve_sdk
eve/ft80x.h
#ifndef FT80X_H #define FT80X_H #define RAM_G_SIZE 256*1024L #define CMDBUF_SIZE 4096UL #define ADC_DIFFERENTIAL 1UL #define ADC_SINGLE_ENDED 0UL #define ADPCM_SAMPLES 2UL #define ALWAYS 7UL #define ARGB1555 0UL #define ARGB2 5UL #define ARGB...
ftdi-paul-jiao/eve_sdk
eve/ft81x.h
<gh_stars>1-10 #ifndef FT81X_H #define FT81X_H #define RAM_G_SIZE 1024*1024L #define CMDBUF_SIZE 4096UL #define ADC_DIFFERENTIAL 1UL #define ADC_SINGLE_ENDED 0UL #define ADPCM_SAMPLES 2UL #define ALWAYS 7UL #define ARGB1555 0UL #define ARGB2 ...
GhostlyDark/OoT-Randomizer
ASM/c/icetrap.c
#include "icetrap.h" #include "z64.h" _Bool ice_trap_is_pending() { return z64_file.scene_flags[0x49].unk_00_ > 0; //Unused word in scene x49. } void push_pending_ice_trap() { z64_file.scene_flags[0x49].unk_00_++; } void give_ice_trap() { if (z64_file.scene_flags[0x49].unk_00_) { z64_file.scene_f...
GhostlyDark/OoT-Randomizer
ASM/c/file_message.c
<reponame>GhostlyDark/OoT-Randomizer #include "file_message.h" #include "text.h" extern uint8_t CFG_SHOW_SETTING_INFO; extern char WORLD_STRING_TXT[]; extern char CFG_CUSTOM_MESSAGE_1[]; extern char CFG_CUSTOM_MESSAGE_2[]; extern char VERSION_STRING_TXT[]; extern char TIME_STRING_TXT[]; extern uint8_t SPOILER_AVAILAB...
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/src/SerialImp.c
/*------------------------------------------------------------------------- | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. | RXTX is a native interface to serial ports in java. | Copyright 1997-2009 by <NAME> <EMAIL> and others who | actually wrote it. See individual source files for mo...
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/include/target/gnu_io_RXTXPort_MonitorThread.h
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class gnu_io_RXTXPort_MonitorThread */ #ifndef _Included_gnu_io_RXTXPort_MonitorThread #define _Included_gnu_io_RXTXPort_MonitorThread #ifdef __cplusplus extern "C" { #endif #undef gnu_io_RXTXPort_MonitorThread_MIN_PRIORITY #define gn...
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/include/target/gnu_io_RXTXPort_SerialInputStream.h
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class gnu_io_RXTXPort_SerialInputStream */ #ifndef _Included_gnu_io_RXTXPort_SerialInputStream #define _Included_gnu_io_RXTXPort_SerialInputStream #ifdef __cplusplus extern "C" { #endif #undef gnu_io_RXTXPort_SerialInputStream_SKIP_BU...
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/include/target/gnu_io_RXTXVersion.h
<gh_stars>1-10 /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class gnu_io_RXTXVersion */ #ifndef _Included_gnu_io_RXTXVersion #define _Included_gnu_io_RXTXVersion #ifdef __cplusplus extern "C" { #endif /* * Class: gnu_io_RXTXVersion * Method: nativeGetVersion * Signatur...
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/include/target/gnu_io_Zystem.h
<filename>lib/nrjavaserial-master/src/main/c/include/target/gnu_io_Zystem.h<gh_stars>1-10 /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class gnu_io_Zystem */ #ifndef _Included_gnu_io_Zystem #define _Included_gnu_io_Zystem #ifdef __cplusplus extern "C" { #endif #undef gnu_io_Zyst...
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/src/fuserImp.c
#if defined(__MWERKS__) /* dima */ #include "CommPortIdentifier.h" #else /* dima */ #include "gnu_io_CommPortIdentifier.h" #endif /* dima */ #ifndef __linux__ JNIEXPORT jstring JNICALL Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner (JNIEnv *env, jobject obj, jstring arg) { return (*env)->NewStringUTF(env...
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/include/target/gnu_io_CommPortIdentifier.h
<filename>lib/nrjavaserial-master/src/main/c/include/target/gnu_io_CommPortIdentifier.h /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class gnu_io_CommPortIdentifier */ #ifndef _Included_gnu_io_CommPortIdentifier #define _Included_gnu_io_CommPortIdentifier #ifdef __cplusplus exte...
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/include/SerialImp.h
<reponame>asimm-hirani/SimpleSerial /*------------------------------------------------------------------------- | RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. | RXTX is a native interface to serial ports in java. | Copyright 1997-2009 by <NAME> <EMAIL> and others who | actually wrote it....
asimm-hirani/SimpleSerial
lib/nrjavaserial-master/src/main/c/include/target/gnu_io_RXTXPort.h
<gh_stars>1-10 /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class gnu_io_RXTXPort */ #ifndef _Included_gnu_io_RXTXPort #define _Included_gnu_io_RXTXPort #ifdef __cplusplus extern "C" { #endif #undef gnu_io_RXTXPort_debug #define gnu_io_RXTXPort_debug 0L #undef gnu_io_RXTXPort_DA...