repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
tailhook/paperjam
src/print.h
<gh_stars>1-10 #ifndef _H_PRINT #define _H_PRINT void print_message(char *data, size_t datalen, int more); #endif // _H_PRINT
xackery/eqgzi
src/util.h
<filename>src/util.h #ifndef UTIL_H #define UTIL_H #include "types.h" #include "geo.h" #include <cstdio> #include <cstring> #include <unordered_map> #include <lua.hpp> namespace Util { void LoadFunctions(lua_State* L); class Buffer; byte* CheckHeader(lua_State* L, const char* magic, const char* err_name); void ...
xackery/eqgzi
include/iup/iup_scintilla.h
<reponame>xackery/eqgzi /** \file * \brief Scintilla control. * * See Copyright Notice in "iup.h" */ #ifndef __IUP_SCINTILLA_H #define __IUP_SCINTILLA_H #ifdef __cplusplus extern "C" { #endif void IupScintillaOpen(void); Ihandle *IupScintilla(void); #ifdef __cplusplus } #endif #endif
xackery/eqgzi
src/viewer.h
#include <cstdio> #include <cstring> #include <thread> #include <atomic> #include <chrono> #include <unordered_map> #include <lua.hpp> #include <irrlicht.h> #include <FreeImagePlus.h> #include "types.h" #include "util.h" #include <cmath> using namespace irr; namespace Viewer { void LoadFunctions(lua_State* L); cl...
xackery/eqgzi
include/iup/iupcontrols.h
<filename>include/iup/iupcontrols.h<gh_stars>0 /** \file * \brief initializes dial, gauge, colorbrowser, colorbar controls. * * See Copyright Notice in "iup.h" */ #ifndef __IUPCONTROLS_H #define __IUPCONTROLS_H #ifdef __cplusplus extern "C" { #endif int IupControlsOpen(void); void IupControlsClose(void); /...
xackery/eqgzi
src/geo.h
#ifndef GEO_H #define GEO_H #include "types.h" struct Material { uint32 index; uint32 name_index; uint32 shader_index; uint32 property_count; static const uint32 SIZE = sizeof(uint32) * 4; }; struct Property { uint32 name_index; uint32 type; union { uint32 i; float f; } value; static const uint32 SIZ...
xackery/eqgzi
src/ter.h
<gh_stars>0 #include <lua.hpp> #include <cstdio> #include <cstring> #include "types.h" #include "util.h" #include "geo.h" namespace TER { void LoadFunctions(lua_State* L); struct Header { char magic[4]; //EQGT uint32 version; uint32 strings_len; uint32 material_count; uint32 vertex_count; uint32 trian...
xackery/eqgzi
src/wld.h
#include <lua.hpp> #include <cstdio> #include <cstring> #include <vector> #include <unordered_map> #include <unordered_set> #include <string> #include "types.h" #include "util.h" namespace WLD { void LoadFunctions(lua_State* L); struct Header { char magic[4]; uint32 version; uint32 frag_count; uint32 unkn...
xackery/eqgzi
src/zon.h
<gh_stars>0 #include <lua.hpp> #include <cstdio> #include <cstring> #include "types.h" #include "util.h" namespace ZON { void LoadFunctions(lua_State* L); struct Header { char magic[4]; //EQGZ uint32 version; uint32 strings_len; uint32 model_count; uint32 object_count; uint32 region_count; uint32 li...
xackery/eqgzi
src/types.h
#ifndef TYPES_H #define TYPES_H #include <cstdint> #include <cstdlib> typedef std::uint8_t byte; typedef std::uint8_t uint8; typedef std::int8_t int8; typedef std::uint16_t uint16; typedef std::int16_t int16; typedef std::uint32_t uint32; typedef std::int32_t int32; typedef std::uint64_t uint64; typedef std::int64_...
xackery/eqgzi
include/iup/iup_mglplot.h
<gh_stars>10-100 /** \file * \brief Plot component for Iup. * * See Copyright Notice in "iup.h" */ #ifndef __IUP_MGLPLOT_H #define __IUP_MGLPLOT_H #ifdef __cplusplus extern "C" { #endif /* Initialize IupMglPlot widget class */ void IupMglPlotOpen(void); /* Create an IupMglPlot widget instance */ Ihandle* IupM...
xackery/eqgzi
src/mod.h
#include <lua.hpp> #include <cstdio> #include <cstring> #include "types.h" #include "util.h" #include "geo.h" namespace MOD { void LoadFunctions(lua_State* L); struct Header { char magic[4]; //EQGM uint32 version; uint32 strings_len; uint32 material_count; uint32 vertex_count; uint32 triangle_count; ...
jjbourdev/IGListKit
Examples/Examples-iOS/Pods/Target Support Files/Pods-IGListKitTodayExample/Pods-IGListKitTodayExample-umbrella.h
<filename>Examples/Examples-iOS/Pods/Target Support Files/Pods-IGListKitTodayExample/Pods-IGListKitTodayExample-umbrella.h /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #ifdef _...
jjbourdev/IGListKit
Examples/Examples-tvOS/Pods/Target Support Files/IGListKit/IGListKit-umbrella.h
<filename>Examples/Examples-tvOS/Pods/Target Support Files/IGListKit/IGListKit-umbrella.h /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #ifdef __OBJC__ #import <UIKit/UIKit.h> #...
jjbourdev/IGListKit
Source/IGListKit/IGListAdapterUpdaterDelegate.h
<reponame>jjbourdev/IGListKit /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import <UIKit/UIKit.h> #import <IGListDiffKit/IGListBatchUpdateData.h> @class IGListAdapterUpdater...
jjbourdev/IGListKit
Examples/Examples-macOS/Pods/Target Support Files/IGListDiffKit/IGListDiffKit-umbrella.h
<gh_stars>1-10 /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #ifdef __OBJC__ #import <Cocoa/Cocoa.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_...
jjbourdev/IGListKit
Source/IGListKit/Internal/IGListAdapterInternal.h
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import <IGListKit/IGListAdapter.h> #import <IGListKit/IGListBatchContext.h> #import <IGListKit/IGListCollectionContext.h> #import...
jjbourdev/IGListKit
Tests/Objects/IGTestDelegateDataSource.h
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import <Foundation/Foundation.h> #import <IGListKit/IGListAdapterDataSource.h> #import "IGListTestCase.h" @class IGTestDelegate...
muhajirrr/fp_sisop_xv6
split.c
<reponame>muhajirrr/fp_sisop_xv6 #include "types.h" #include "stat.h" #include "user.h" #include "fcntl.h" #include "fs.h" int isDirectory(char *s) { struct stat st; int fd = open(s, O_RDONLY); fstat(fd, &st); int res; if (st.type == T_DIR) res = 1; else res = 0; close(fd); return res; } void split(ch...
muhajirrr/fp_sisop_xv6
touch.c
<filename>touch.c #include "types.h" #include "stat.h" #include "user.h" #include "fcntl.h" int main(int argc, char *argv[]) { if (argc < 2) { printf(2, "Help ...\n"); } else { int i; for (i = 1; i < argc; i++) { if (open(argv[i], O_CREATE) == -1) { printf(2,"creating file failed..\n"); } } } ex...
muhajirrr/fp_sisop_xv6
cp.c
<reponame>muhajirrr/fp_sisop_xv6 #include "types.h" #include "stat.h" #include "user.h" #include "fcntl.h" #include "fs.h" char *getFileName(char *s) { char *filename = s; char *temp = s; int i; for (i = strlen(temp); i >= 0; i--) { if (temp[i] == '/') { filename = &temp[i+1]; break; } } return filen...
muhajirrr/fp_sisop_xv6
rm.c
#include "types.h" #include "stat.h" #include "user.h" #include "fcntl.h" #include "fs.h" void rm_one(char *s) { if (unlink(s) < 0) { printf(2, "rm: %s failed to delete\n", s); return; } } void rm_recurse(char *dir) { int fd; char buf[512], *p; struct dirent de; struct stat st; fd = open(dir, O_RDONLY); ...
Synthetic-Automated-Systems/RUDER_MBOT_RL
libraries/DualG2HighPowerMotorShieldTop/DualG2HighPowerMotorShieldTop.h
#pragma once #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || \ defined(__AVR_ATmega328PB__) || defined (__AVR_ATmega32U4__) #define DUALG2HIGHPOWERMOTORSHIELD_TIMER1_AVAILABLE #endif #include <Arduino.h> class DualG2HighPowerMotorShieldTop { public: // CONSTRUCTORS DualG2HighPowerMot...
arcangelw/ReactiveAutomaton
Sources/ReactiveAutomaton.h
<reponame>arcangelw/ReactiveAutomaton<filename>Sources/ReactiveAutomaton.h #import <Foundation/Foundation.h> //! Project version number for ReactiveAutomaton. FOUNDATION_EXPORT double ReactiveAutomatonVersionNumber; //! Project version string for ReactiveAutomaton. FOUNDATION_EXPORT const unsigned char ReactiveAutoma...
vladimirbelinski/Genetic_algorithm-T1_IA
src/ia.h
/* Arquivo: ia.h Autores: <NAME>, <NAME> e <NAME> Descrição: o presente arquivo faz parte da resolução do Trabalho I do CCR Inteligência Artificial, 2017-1, do curso de Ciência da Computação da Universidade Federal da Fronteira Sul - UFFS, o qual consiste na implementação de um algorit...
weilLove/LWRouter
LWRouter/Classess/LWRouter.h
// // LWRouter.h // LWRouterDemo // // Created by weil on 2018/11/17. // Copyright © 2018 allyoga. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> //跳转分模态和push两种 typedef NS_ENUM(NSUInteger, YGRouterJumpType) { YGRouterJumpTypePush, YGRouterJumpTypeModal }; @interface LWRo...
pro55series/FirstGame
Player.h
class classPlayer { private: int health, mana, strength, dexterity, stamina; std::string playerName; public: void createCharacter(int, int, int, int, int, std::string); void setHealth(int); void setMana(int); void setStrength(int); void setDexterity(int); void setStamina(int); int showHealth(){retur...
mcauser/VCC_GND_F407ZG
mpconfigboard.h
<reponame>mcauser/VCC_GND_F407ZG<gh_stars>1-10 #define MICROPY_HW_BOARD_NAME "VCC-GND STM32F407ZG" #define MICROPY_HW_MCU_NAME "STM32F407ZG" #define MICROPY_HW_FLASH_FS_LABEL "VCCGNDF407ZG" // 1 = use internal flash (1 MByte) // 0 = use onboard SPI flash (512 KByte) Winbond W25X40 #define MICROPY_HW_EN...
rodriguezg68/ep-oc-mcu
extensions/TimeoutFlag.h
<reponame>rodriguezg68/ep-oc-mcu /* * Mbed-OS Microcontroller Library * Copyright (c) 2021 Embedded Planet * Copyright (c) 2021 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. ...
rodriguezg68/ep-oc-mcu
extensions/PersistentArray.h
<reponame>rodriguezg68/ep-oc-mcu /* * Mbed-OS Microcontroller Library * Copyright (c) 2021 Embedded Planet * Copyright (c) 2021 ARM Limited * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. ...
rodriguezg68/ep-oc-mcu
extensions/PersistentVariable.h
<filename>extensions/PersistentVariable.h<gh_stars>1-10 /** * ep-oc-mcu * Embedded Planet Open Core for Microcontrollers * * Built with ARM Mbed-OS * * Copyright (c) 2019 Embedded Planet, Inc. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may n...
hlef/xmotd
main.c
<gh_stars>0 /* xmotd is a message of the day displayer for X11 and dumb-terminals * * It displays a logo in the top-left corner, a 3-line title to its * right and a text-widget (optionally a HTML widget) for displaying * the message, just below. The motd filename(s) are supplied on the * command-line. A single bu...
hlef/xmotd
maindefs.h
/* $Id: maindefs.h,v 1.3 2003/02/14 00:35:22 elf Exp $ */ #define TIMESTAMP ".xmotd" /* the date of this file, in user's * home-directory, is used to * determine whether the motd has * changed and should be displayed*/ #define USAGESTRING "Usage:\n%s [X-toolkit-options] [options] {{file [fi...
hlef/xmotd
xmotd.c
/*$Id: xmotd.c,v 1.20 2003/02/14 00:37:38 elf Exp $*/ /* * Copyright 1994-97, 2003 <NAME> <<EMAIL>> * * Permission to use, copy, hack, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * tha...
hlef/xmotd
textmode.c
<gh_stars>0 /* $Id: textmode.c,v 1.7 1998/11/03 22:24:31 elf Exp $ */ /* * Copyright 1993-97 <NAME> <<EMAIL>> * * Permission to use, copy, hack, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies ...
hlef/xmotd
logo.c
/* * Copyright 1993-97 <NAME> <<EMAIL>> * * Permission to use, copy, hack, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appe...
hlef/xmotd
changed.c
<gh_stars>0 /* Copyright 1993-97 <NAME> <<EMAIL>> * * Permission to use, copy, hack, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission no...
hlef/xmotd
main.h
/* $Id: main.h,v 1.5 1999/11/23 23:01:14 elf Exp $ */ typedef struct _resources { int always; /* flag; if set, ignore .xmotd timestamp */ int pto; /* popdown time-out value in seconds*/ int usedomains; /* do timestamping with .xmotd.domain-name */ int showfilename; /* display the name of the file...
hlef/xmotd
patchlevel.h
#define RELEASE 1 #define PATCH 17 #define STATUS "FCS"
hlef/xmotd
appdefs.h
<filename>appdefs.h /* $Id: appdefs.h,v 1.3 1999/08/20 23:45:22 elf Exp $ */ #ifdef MOTIF String fallback_resources[] = { "*form.foreground: black", "*form.background: lightsteelblue3", "*text*fontList: -*-times-bold-r-*-*-*-140-*", "*text*background: lightsteelblue1", #ifdef HAVE_HTML "*text.width: 680...
hlef/xmotd
atom.c
<gh_stars>0 /*$Id: atom.c,v 1.2 1999/11/23 00:50:14 elf Exp $*/ /* * Copyright 1999 <NAME> <<EMAIL>> * * Permission to use, copy, hack, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * th...
hlef/xmotd
browser.c
/* Copyright 1996-97 <NAME> <NAME> <<EMAIL>> * * Permission to use, copy, hack, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice a...
hlef/xmotd
usage.c
<gh_stars>0 /* $Id: usage.c,v 1.8 2003/02/14 00:34:14 elf Exp $ */ /* * Copyright 1994-97, 1999, 2003 <NAME> <<EMAIL>> * * Permission to use, copy, hack, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all...
fgolemo/map
tools/ad_map_access_qgis_python/include/core_python.h
<filename>tools/ad_map_access_qgis_python/include/core_python.h<gh_stars>0 // ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma ...
fgolemo/map
tools/ad_map_access_qgis_python/include/py_point.h
// ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <ad/map/point/Operation.hpp> #include <ad/map/point/Types.hp...
fgolemo/map
tools/ad_map_access_qgis_python/include/py_utils.h
// ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <string> #include <vector> #include "./core_python.h" /////...
fgolemo/map
ad_map_opendrive_reader/include/opendrive/parser/LaneParser.h
/* * ----------------- BEGIN LICENSE BLOCK --------------------------------- * * Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma * de Barcelona (UAB). * Copyright (C) 2019 Intel Corporation * * SPDX-License-Identifier: MIT * * ----------------- END LICENSE BLOCK --------------------...
fgolemo/map
tools/ad_map_access_qgis_python/include/py_restriction.h
<gh_stars>0 // ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <ad/map/restriction/Types.hpp> #include "py_phys...
fgolemo/map
ad_map_opendrive_reader/include/opendrive/parser/RoadLinkParser.h
/* * ----------------- BEGIN LICENSE BLOCK --------------------------------- * * Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma * de Barcelona (UAB). * Copyright (C) 2019 Intel Corporation * * SPDX-License-Identifier: MIT * * ----------------- END LICENSE BLOCK --------------------...
fgolemo/map
tools/ad_map_access_qgis_python/include/py_lane.h
// ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <ad/map/lane/Types.hpp> #include "py_utils.h" template <> P...
fgolemo/map
tools/ad_map_access_qgis_python/include/core_py_utils.h
<reponame>fgolemo/map // ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <ad/map/landmark/Types.hpp> #include <...
fgolemo/map
tools/ad_map_access_qgis_python/include/py_access.h
<gh_stars>0 // ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <ad/map/access/Types.hpp> #include "py_utils.h" ...
fgolemo/map
ad_map_opendrive_reader/include/opendrive/parser/GeoReferenceParser.h
<reponame>fgolemo/map /* * ----------------- BEGIN LICENSE BLOCK --------------------------------- * * Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma * de Barcelona (UAB). * Copyright (C) 2019 Intel Corporation * * SPDX-License-Identifier: MIT * * ----------------- END LICENSE BLOC...
fgolemo/map
tools/ad_map_access_qgis_python/include/py_landmark.h
// ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <ad/map/landmark/Types.hpp> #include "py_utils.h" template ...
fgolemo/map
tools/ad_map_access_qgis_python/include/py_match.h
<gh_stars>0 // ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <ad/map/match/Types.hpp> #include "py_point.h" #...
fgolemo/map
tools/ad_map_access_qgis_python/include/py_physics.h
<gh_stars>0 // ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <ad/physics/Types.hpp> #include "py_utils.h" te...
eregon/event
ext/event/backend/epoll.c
// Copyright, 2021, by <NAME>. <http://www.codeotaku.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, ...
eregon/event
ext/event/backend/uring.c
<filename>ext/event/backend/uring.c // Copyright, 2021, by <NAME>. <http://www.codeotaku.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without lim...
eregon/event
ext/event/backend/kqueue.c
<filename>ext/event/backend/kqueue.c<gh_stars>0 // Copyright, 2021, by <NAME>. <http://www.codeotaku.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including...
crs4/ge-k8s
gek8s-node-start-launcher.c
/** * Copyright 2019 CRS4. * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writin...
xilletex/MonteCarlo
source.c
<filename>source.c #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <unistd.h> #define SRAND_REDEF 100000 #define RND_MIN 0 #define RND_MAX 1 static int float_rand_seed_flag = 0; float maybe_pi = 0; float FlortGetRandom(float min, float max) { float ret_value; if (float_ran...
KIodine/naiveds
singly-linked-list/main.c
<filename>singly-linked-list/main.c #include <stdio.h> #include <assert.h> #include "sllist.h" #define NL "\n" void basic_test(void){ int ret_code, res; struct sllist *list; list = sll_alloc(); printf("test push"NL); for (int i = 0; i < 8; ++i){ ret_code = sll_push(list, i); asse...
KIodine/naiveds
hashtable-chain/include/hashmap.h
<filename>hashtable-chain/include/hashmap.h #ifndef HASHMAP_H #define HASHMAP_H #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stddef.h> #include <string.h> #include <assert.h> // copy from <linux/kernel.h> and strip debug stuffs. #define container_of(ptr, type, member) ({ \ void *__mptr = (...
KIodine/naiveds
arrayq/fifoq.c
<reponame>KIodine/naiveds<gh_stars>1-10 #include "fifoq.h" #include <assert.h> static unsigned int round_up_pow_2(unsigned int v){ /* * fill bits lower than the leftmost bit. * the decrement and increment prevents numbers already are * power or 2 doubles. */ v--; v |= v >> 1; v...
KIodine/naiveds
union-find/test/main.c
<reponame>KIodine/naiveds #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "unionfind.h" #define NL "\n" #define ARRAYSZ(arr) (sizeof(arr)/sizeof(arr[0])) static struct ufnode sets[8192]; static void uf_test(void){ static const int arrsz = ARRAYSZ(sets); printf("[union-find] set size=%d"...
KIodine/naiveds
intrusive-avltree/include/avldbg.h
#ifndef AVLDBG_H #define AVLDBG_H #include "avltree.h" void avl_print(struct avltree *tree); void avl_validate(struct avltree *tree); #endif /* AVLDBG_H */
KIodine/naiveds
binheap/binheap.c
#include <assert.h> #include <stdlib.h> #include "binheap.h" /* get_parent() get_left() get_right() get_last_parent() sift_down() sift_up() */ /* --- static routines --- */ static inline int get_parent(int cur){ return ((cur + 1) >> 1) - 1; } static inline int get_left(int cur){ ret...
KIodine/naiveds
skiplist/include/slist_internal.h
<filename>skiplist/include/slist_internal.h<gh_stars>1-10 #ifndef SLIST_INTERNAL_H #define SLIST_INTERNAL_H /* Includes symbols for internal usage only. */ #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #endif
KIodine/naiveds
union-find/src/unionfind.h
#ifndef UNIONFIND_H #define UNIONFIND_H struct ufnode { struct ufnode *parent; int rank; }; void uf_init_set(struct ufnode *node); struct ufnode *uf_find(struct ufnode *node); int uf_connected(struct ufnode *a, struct ufnode *b); int uf_union(struct ufnode *a, struct ufnode *b); #endif
KIodine/naiveds
intrusive-rbtree/main.c
<gh_stars>1-10 #include <stdio.h> #include <assert.h> #include <unistd.h> #include <fcntl.h> #include <stdint.h> #include "rbtree.h" #define NL "\n" #define NINT32 65536 #define TESTFNAME "./testints.bin" struct pair { struct rbtnode node; int key, val; }; int paircmp(struct rbtnode *a, s...
KIodine/naiveds
binheap/binheap.h
<gh_stars>1-10 #ifndef BINHEAP_H #define BINHEAP_H #include <stddef.h> /* A max heap/priority queue implementation. */ /* struct binheap binheap_alloc() binheap_free() binheap_insert() binheap_extract() binheap_chgprior() maxheapify() */ struct binheap { int *arr; int c...
KIodine/naiveds
bstree/bstree.c
<gh_stars>1-10 #include "bstree.h" static struct bstnode *node_alloc(int key, int val){ struct bstnode *node = NULL; node = calloc(1, sizeof(struct bstnode)); node->key = key; node->val = val; return node; } static void tree_purge(struct bstnode* start){ if (start == NULL){ return; ...
KIodine/naiveds
hashtable-chain/test/main.c
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include "hashmap.h" #define NL "\n" struct data { int value; struct map_node node; }; static void shuffle(int32_t *arr, size_t n){ unsigned int i_excg, tmp; srand(9997); // for test usage, this produces same psuedo random every time....
KIodine/naiveds
doubly-linked-list/dllist.c
#include "dllist.h" static struct dllnode *node_alloc(int val){ struct dllnode *node; node = calloc(1, sizeof(struct dllnode)); node->val = val; return node; } static void node_purge(struct dllnode *node){ struct dllnode *hold; for (struct dllnode *n = node->next; n != node;){ hold = ...
KIodine/naiveds
intrusive-avltree/test/main.c
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <unistd.h> #include <assert.h> #include <fcntl.h> #include "avltree.h" #include "avldbg.h" #define NL "\n" #define NNUMS 4096 struct pair { struct avlnode node; int key; }; static int pair_cmp(struct avlnode const *a, struct avlnode const ...
KIodine/naiveds
skiplist/test/slist_basic.c
#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <time.h> #include "skiplist.h" static int shuffle_int(int arr[], int n); static int basic_test(void); static int main_test(int test_nodes); //static int const test_nodes = 2600000; static int const test_scales[] = { /* 1...
KIodine/naiveds
threaded-avltree/src/avltree.c
<gh_stars>1-10 #include "avltree.h" #include "avlinc.h" static inline int max(int a, int b); static inline int min(int a, int b); static inline void node_clear(struct avlnode *node); static struct avlnode *node_min(struct avlnode *node); static void left_rotate(struct avltree *tree, struct avlnode *a); static void rig...
KIodine/naiveds
intrusive-avltree/include/avltree.h
#ifndef AVLTREE_H #define AVLTREE_H #include <string.h> #include <stddef.h> // copy from <linux/kernel.h> and strip debug stuffs. #define container_of(ptr, type, member) ({ \ void *__mptr = (void *)(ptr); \ ((type *)(__mptr - offsetof(type, member))); }) struct avlnode; /* eval: a <cmp op> b ret val...
KIodine/naiveds
threaded-avltree/src/list.c
#include "list.h" /* insert after */ void list_push(struct list *head, struct list *node){ struct list *hnxt; hnxt = head->next; node->next = hnxt; node->prev = head; hnxt->prev = node; head->next = node; return; } struct list *list_pop(struct list *head){ struct list *tmp, *tnxt; ...
KIodine/naiveds
skiplist/src/skiplist.c
#include "skiplist.h" #include "slist_internal.h" static int generate_level(void); static struct skiplist_node *slist_node_alloc(int level); static struct skiplist_node *skiplist_get_ex( struct skiplist *slist, int key, struct skiplist_link *prevs[SKIPLIST_MAX_LEVEL] ); //static void slist_node_free(struct sk...
KIodine/naiveds
hashtable-chain/src/hashmap.c
<reponame>KIodine/naiveds #include "hashmap.h" #define NL "\n" #define debug_print(fmt, ...) printf("[hashmap]" fmt, __VA_ARGS__); #define debug_msg(s) printf("[hashmap]" s); static void map_init(struct map *m, unsigned int size_hint, obj_hasher hash, obj_cmp cmp); static struct map_nod...
KIodine/naiveds
skiplist/include/skiplist.h
<reponame>KIodine/naiveds<gh_stars>1-10 #ifndef SKIPLIST_H #define SKIPLIST_H #define SKIPLIST_MAX_LEVEL 24 /* > Hide definition completly? */ struct skiplist_link { struct skiplist_node *next; }; /* TODO: Move `links` to head and alloc separately. */ struct skiplist_node { //struct skiplist_link *links; ...
KIodine/naiveds
intrusive-list/test.c
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <assert.h> #include <unistd.h> #include <fcntl.h> #include "list.h" #define NL "\n" #define NINT32 1000000 struct testnode { int val; struct list node; }; void basic_test(void){ int fd; uint32_t *arr; uint32_t readsz = sizeof...
KIodine/naiveds
threaded-avltree/include/avlinc.h
#ifndef AVLINC_H #define AVLINC_H /* Headers for internal usage. */ #include <assert.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <stddef.h> #endif /* AVLINC_H */
KIodine/naiveds
avltree/avltree.c
<filename>avltree/avltree.c<gh_stars>1-10 #include "avltree.h" static struct avlnode *node_alloc(int key, int val); static void node_free(struct avlnode *node); static int node_insert(struct avlnode **node, int key, int val); static int node_delete(struct avlnode **node, int key); static void node_fix(struct avlnode ...
KIodine/naiveds
bstree/main.c
#include <stdio.h> #include <assert.h> #include <unistd.h> #include <fcntl.h> #include <stdint.h> #include "bstree.h" #define NL "\n" static void node_traversal(struct bstnode *node){ if (node == NULL){ return; } node_traversal(node->left); printf("%d"NL, node->key); node_traversal(node...
KIodine/naiveds
threaded-avltree/include/avltree.h
#ifndef AVLTREE_H #define AVLTREE_H #include <string.h> #include <stddef.h> #include "list.h" /* TODO: - Implement `threaded-avltree`. - Add a `struct list node` member. - Add implementation of insert in `avl_insert`. - Add implementation of remove in `avl_delete`. - Update `avl_...
KIodine/naiveds
intrusive-avltree/src/avldbg.c
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "avldbg.h" #define NL "\n" static void node_print(struct avlnode *node, int depth); static void node_validate(struct avlnode *node, avl_cmp_t cmp); void avl_print(struct avltree *tree){ putchar('\n'); node_print(tree->root, 0); retur...
KIodine/naiveds
rbtree/main.c
<reponame>KIodine/naiveds #include <stdio.h> #include <assert.h> #include <unistd.h> #include <fcntl.h> #include <stdint.h> #include "rbtree.h" #define NL "\n" static void node_traversal(struct rbtnode *node){ if (node == NULL){ return; } node_traversal(node->left); printf("%d"NL, node->key...
KIodine/naiveds
rbtree/rbtree.h
#ifndef RBTREE_H #define RBTREE_H #include <stdlib.h> #include <assert.h> struct rbtree { unsigned int count; struct rbtnode *root, *nil; }; struct rbtnode { int color; int key, val; struct rbtnode *left, *right, *parent; }; enum { RBT_OK, RBT_NOELEM, }; enum { COLOR_RED, COLO...
KIodine/naiveds
bstree/bstree.h
#ifndef BSTREE_H #define BSTREE_H #include <stdlib.h> struct bstree { unsigned int count; struct bstnode *root; }; struct bstnode { int key, val; struct bstnode *left, *right; }; enum { BST_OK, BST_NOELEM, }; struct bstree *bstree_alloc(void); void bstree_free(struct bstree *tree); int b...
KIodine/naiveds
avltree/main.c
<filename>avltree/main.c<gh_stars>1-10 #include <stdio.h> #include <stdint.h> #include <assert.h> #include <unistd.h> #include <fcntl.h> #include "avltree.h" #define NL "\n" #define NINT32 4096 void trav(struct avlnode *node, int depth){ if (node == NULL){ return; } trav(node->child[CLD_L], dept...
KIodine/naiveds
doubly-linked-list/dllist.h
<reponame>KIodine/naiveds<filename>doubly-linked-list/dllist.h #ifndef DLLIST_H #define DLLIST_H #include <stdlib.h> struct dllnode { int val; struct dllnode *prev, *next; }; struct dllist { int count; struct dllnode first; }; enum { DLL_OK, DLL_NOELEM }; struct dllist *dll_alloc(void); vo...
KIodine/naiveds
avltree/avltree.h
<filename>avltree/avltree.h #ifndef AVLTREE_H #define AVLTREE_H #include <stdio.h> #include <stdlib.h> #include <assert.h> // TODO: use `struct avlnode *[2]` to store left and right children. // by doing so, specific style of coding can be performed. struct avlnode { struct avlnode *child[2]; int key, ...
KIodine/naiveds
binheap/main.c
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "binheap.h" #define ARRSZ(array) ((sizeof(array))/sizeof(array[0])) #define RESET "\e[0m" #define REDTEXT "\e[31m" #define HEAPSZ 8192 int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; /* --- util routines --- */ static void verify_maxheap(int *arr, i...
KIodine/naiveds
intrusive-rbtree/rbtree.h
#ifndef RBTREE_H #define RBTREE_H #include <stdlib.h> #include <stddef.h> #include <assert.h> /* or just include `linux/kernel.h`? */ #define container_of(ptr, type, member) ({ \ void *__mptr = (void*)(ptr); \ (type*)(__mptr - offsetof(type, member)); \ }) #define rbt_is_black(node) ((n...
KIodine/naiveds
singly-linked-list/sllist.h
<reponame>KIodine/naiveds #ifndef SLLIST_H #define SLLIST_H #include <stdlib.h> #include <stdint.h> struct sllnode { int val; struct sllnode *next; }; struct sllist { int count; struct sllnode *first; }; enum { SLL_OK, SLL_NOELEM, }; struct sllist *sll_alloc(void); void sll_free(struct sl...
KIodine/naiveds
rbtree/rbtree.c
#include "rbtree.h" #ifdef __GNUC__ #define FORCE_INLINE __attribute__((always_inline)) #elif #define FORCE_INLINE #endif enum chiral { CHIRAL_LEFT = 0, CHIRAL_RIGHT = 1 }; static inline FORCE_INLINE struct rbtnode *node_alloc(int key, int val){ struct rbtnode *node = NULL; node = calloc(1...
KIodine/naiveds
threaded-avltree/test/main.c
<reponame>KIodine/naiveds #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <unistd.h> #include <assert.h> #include <fcntl.h> #include <time.h> #include "avltree.h" #include "avldbg.h" #define NL "\n" #define NNUMS 4096 struct pair { struct avlnode node; int key; }; s...
KIodine/naiveds
arrayq/main.c
#include <stdio.h> #include <assert.h> #include "fifoq.h" #define NL "\n" #define ARRSIZE(arr) sizeof(arr)/sizeof(arr[0]) int test_data[] = { 1, 2, 3, 4, 5 }; void test_fifoq(void){ int ret; struct fifoq *q; q = fifoq_alloc(17); assert(fifoq_is_empty(q)); printf("--- test push ---"NL); ...