Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sat Nov 14 02:51:02 EST 2015
- dev/libgc-proj/proj-make.txt
- #===============================================================================
- # This file is part of Libgc-proj.
- # Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca
- #
- # GPLv3 License here
- #===============================================================================
- # gc-proj-conf (tracks config; can reconfigure)
- # gc-proj-make (will rebuild changed files; will rebuild only necessary after conf change)
- # gc-proj-inst (installs all built targets)
- DTGT gc-proj
- TGEN dev
- MAKE
- EXEC lib/pkgconfig/make.sh $PREF
- INST
- COPY include/gc $PREF/include
- MOVE lib/pkgconfig/gc-proj.pc.tmp $PREF/lib/pkgconfig/gc-proj.pc
- TLIB gc-proj
- dev/libgc-base/src/ct/u8b.c
- //==============================================================================
- // This file is part of Libgc-base.
- // Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca>
- //
- // Libgc-base is free software: you can redistribute it and/or modify it under
- // the terms of the GNU General Public License as published by the Free Software
- // Foundation, either version 3 of the License, or (at your option) any later
- // version.
- //
- // Libgc-base is distributed in the hope that it will be useful, but WITHOUT ANY
- // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with
- // Libgc-base. If not, see <http://www.gnu.org/licenses/>.
- //==============================================================================
- #include <gc/mem.h>
- #include <gc/u8b.h>
- //==============================================================================
- // Initialization and deinitialization
- //==============================================================================
- u8 u8b_init(struct u8b_i *buf, struct u8b_c *conf)
- {
- buf->dbeg = mem_alloc(conf->size);
- if (unlikely(buf->dbeg == NULL))
- return 1;
- buf->cbeg = size;
- buf->ccur = 0;
- buf->dcur = NULL;
- return 0;
- }
- void u8b_deinit(struct u8b_i *buf)
- {
- mem_dealloc(buf->dbeg);
- }
- //==============================================================================
- // Utility
- //==============================================================================
- void u8b_rda(struct u8b_i *buf, u32 size)
- {
- // circular buffer
- buf->cread -= size;
- buf->cwrite += size;
- buf->dread += size;
- }
- u32 u8b_rdgc(struct u8b_i *buf)
- {
- return buf->cread;
- }
- void u8b_wra(struct u8b_i *buf, u32 size)
- {
- buf->cread += size;
- buf->cwrite -= size;
- buf->dwrite += size;
- }
- u32 u8b_wrgc(struct u8b_i *buf)
- {
- return buf->cwrite;
- }
- //==============================================================================
- // Peeking
- //==============================================================================
- u8 u8b_peek1(struct u8b_i *buf)
- {
- return buf->dread[0];
- }
- u16 u8b_peek2(struct u8b_i *buf)
- {
- u8 cdata[2];
- cdata[0] = buf->dread[0];
- cdata[1] = buf->dread[1];
- return (u16)cdata;
- }
- dev/libgc-base/src/util/pars.c
- //==============================================================================
- // This file is part of Libgc-base.
- // Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca>
- //
- // Libgc-base is free software: you can redistribute it and/or modify it under
- // the terms of the GNU General Public License as published by the Free Software
- // Foundation, either version 3 of the License, or (at your option) any later
- // version.
- //
- // Libgc-base is distributed in the hope that it will be useful, but WITHOUT ANY
- // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with
- // Libgc-base. If not, see <http://www.gnu.org/licenses/>.
- //==============================================================================
- #include <gc/pars.h>
- //==============================================================================
- // "u8's"
- //==============================================================================
- u8 pars_u8c(struct u8b_i *buf, u8 data)
- {
- u32 orig_cnt = u8b_cnt(buf);
- while (u8b_cnt(buf)) {
- if (u8b_peek1(buf) != data)
- break;
- u8b_adv(buf, 1);
- }
- return !(u8b_cnt(buf) < orig_cnt);
- }
- u8 pars_u8c2(struct u8b_i *buf, u8 data1, u8 data2)
- {
- u8 cdata[] = {data1, data2};
- u32 orig_cnt = u8b_cnt(buf);
- while (u8b_cnt(buf) >= 2) {
- if (u8b_peek2(buf) != (u16)cdata)
- break;
- u8b_adv(buf, 2);
- }
- return !(u8b_cnt(buf) < orig_cnt);
- }
- //==============================================================================
- // New line characters
- //==============================================================================
- u8 pars_nld(struct u8b_i *buf, u8 types)
- {
- assert((types & NL_RN) || (types & NL_N) || (types & NL_R));
- u8 rn[] = {'\r', '\n'};
- if (u8b_cnt(buf) >= 2 && (types & NL_RN) && u8b_peek2(buf) == (u16)rn)
- return NL_RN;
- if (u8b_cnt(buf)) {
- if ((types & NL_N) && u8b_peek(buf) == '\n')
- return NL_N;
- if ((types & NL_R) && u8b_peek(buf) == '\r')
- return NL_R;
- }
- return 0;
- }
- u8 pars_nlcs(struct u8b_i *buf, u8 types)
- {
- u8 dtype = pars_nld(buf, types);
- if (unlikely(!dtype))
- return 1;
- if ((dtype & NL_RN)) {
- u8b_adv(buf, 2);
- pars_u8c2(buf, '\r', '\n');
- }
- else {
- u8b_adv(buf, 1);
- if ((dtype & NL_N))
- pars_u8c(buf, '\n');
- if ((dtype & NL_R))
- pars_u8c(buf, '\r');
- }
- return 0;
- }
- u8 pars_nlcm(struct u8b_i *buf, u8 types)
- {
- u8 ret = 1;
- for (;;) {
- if (pars_nlcs(buf, types))
- break;
- ret = 0;
- }
- return ret;
- }
- dev/libgc-base/src/os/unix/proc.c
- //==============================================================================
- // This file is part of Libgc-base.
- // Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca>
- //
- // Libgc-base is free software: you can redistribute it and/or modify it under
- // the terms of the GNU General Public License as published by the Free Software
- // Foundation, either version 3 of the License, or (at your option) any later
- // version.
- //
- // Libgc-base is distributed in the hope that it will be useful, but WITHOUT ANY
- // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with
- // Libgc-base. If not, see <http://www.gnu.org/licenses/>.
- //==============================================================================
- // proc_st_init, proc_st_next, ...
- //==============================================================================
- // Execution
- //==============================================================================
- u8 proc_exec(void)
- {
- }
- dev/libgc-base/src/os/unix/mem.c
- //==============================================================================
- // This file is part of Libgc-base.
- // Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca>
- //
- // Libgc-base is free software: you can redistribute it and/or modify it under
- // the terms of the GNU General Public License as published by the Free Software
- // Foundation, either version 3 of the License, or (at your option) any later
- // version.
- //
- // Libgc-base is distributed in the hope that it will be useful, but WITHOUT ANY
- // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with
- // Libgc-base. If not, see <http://www.gnu.org/licenses/>.
- //==============================================================================
- #include <gc/mem.h>
- #include <string.h>
- //==============================================================================
- // Allocation, reallocation and deallocation
- //==============================================================================
- void *mem_alloc(size_t size)
- {
- return malloc(size);
- }
- void *mem_realloc(void *ptr, size_t size)
- {
- return realloc(ptr, size);
- }
- void mem_dealloc(void *ptr)
- {
- free(ptr);
- }
- //==============================================================================
- // Utility
- //==============================================================================
- s8 mem_comp(void *data1, void *data2, size_t size)
- {
- return memcmp(data1, data2, size);
- }
- void mem_copy(void *dest, void *src, size_t size)
- {
- memcpy(dest, src, size);
- }
- void mem_move(void *dest, void *src, size_t size)
- {
- memmove(dest, src, size);
- }
- void mem_set(void *ptr, u8 data, size_t size)
- {
- memset(ptr, data, size);
- }
- dev/libgc-base/src/os/unix/file.c
- //==============================================================================
- // This file is part of Libgc-base.
- // Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca>
- //
- // Libgc-base is free software: you can redistribute it and/or modify it under
- // the terms of the GNU General Public License as published by the Free Software
- // Foundation, either version 3 of the License, or (at your option) any later
- // version.
- //
- // Libgc-base is distributed in the hope that it will be useful, but WITHOUT ANY
- // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with
- // Libgc-base. If not, see <http://www.gnu.org/licenses/>.
- //==============================================================================
- #include <gc/file.h>
- //==============================================================================
- // Initialization and deinitialization
- //==============================================================================
- u8 file_init(struct file_i *file, struct file_c *conf)
- {
- if (!(conf->flags & DIO_CREAT))
- file->fd = open(conf->path, conf->flags);
- else
- file->fd = open(conf->path, conf->flags, conf->mode);
- if (unlikely(file->fd == -1))
- return 1;
- return 0;
- }
- void file_deinit(struct file_i *file)
- {
- close(file->fd);
- }
- //==============================================================================
- // Read and write
- //==============================================================================
- u8 file_read(struct file_i *file, struct u8b_i *buf)
- {
- ssize_t size = read(file->fd, buf->dwrite, buf->cwrite);
- if (unlikely(size == -1))
- return 1;
- u8b_wrr(buf, size);
- return 0;
- }
- u8 file_write(struct file_i *file, struct u8b_i *buf)
- {
- ssize_t size = write(file->fd, buf->dread, buf->cread);
- if (unlikely(size == -1))
- return 1;
- u8b_rdr(buf, size);
- return 0;
- }
- //==============================================================================
- // Utility
- //==============================================================================
- u8 file_gstats(struct file_i *file, struct file_stats *stats)
- {
- if (unlikely(fstat(file->fd, &stats->data)))
- return 1;
- return 0;
- }
- dev/libgc-base/include/gc/proc.h
- //==============================================================================
- // This file is part of Libgc-base.
- // Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca>
- //
- // Libgc-base is free software: you can redistribute it and/or modify it under
- // the terms of the GNU General Public License as published by the Free Software
- // Foundation, either version 3 of the License, or (at your option) any later
- // version.
- //
- // Libgc-base is distributed in the hope that it will be useful, but WITHOUT ANY
- // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with
- // Libgc-base. If not, see <http://www.gnu.org/licenses/>.
- //==============================================================================
- #pragma once
- #if defined(__use_gnu_bktrc)
- #include <gc/proc-gnu-bktrc.h>
- #endif
- #if defined(__use_lunwind)
- #include <gc/proc-lunwind.h>
- #endif
- // Null function pointers for systems where back traces are not supported.
- dev/libgc-base/include/gc/common.h
- //==============================================================================
- // This file is part of Libgc-base.
- // Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca>
- //
- // Libgc-base is free software: you can redistribute it and/or modify it under
- // the terms of the GNU General Public License as published by the Free Software
- // Foundation, either version 3 of the License, or (at your option) any later
- // version.
- //
- // Libgc-base is distributed in the hope that it will be useful, but WITHOUT ANY
- // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with
- // Libgc-base. If not, see <http://www.gnu.org/licenses/>.
- //==============================================================================
- #pragma once
- #include <stddef.h>
- #include <stdint.h>
- typedef int8_t s8;
- typedef int16_t s16;
- typedef int32_t s32;
- typedef int64_t s64;
- typedef uint8_t u8;
- typedef uint16_t u16;
- typedef uint32_t u32;
- typedef uint64_t u64;
- dev/libgc-base/include/gc/u8b.h
- dev/libgc-base/include/gc/pars.h
- dev/libgc-base/include/gc/mem.h
- //==============================================================================
- // This file is part of Libgc-base.
- // Copyright (C) 2015 Anthony Gorecki <anthony@anthonygorecki.ca>
- //
- // Libgc-base is free software: you can redistribute it and/or modify it under
- // the terms of the GNU General Public License as published by the Free Software
- // Foundation, either version 3 of the License, or (at your option) any later
- // version.
- //
- // Libgc-base is distributed in the hope that it will be useful, but WITHOUT ANY
- // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- // A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License along with
- // Libgc-base. If not, see <http://www.gnu.org/licenses/>.
- //==============================================================================
- #pragma once
- #include <gc/common.h>
- dev/doc/includes.txt
- External Gc headers, Gc header for local file, all other headers; groups
- separated by a single new line.
- dev/doc/code-style.txt
- Soft limit for line length is 80 characters, hard limit is 100 characters.
- Conditional statements requiring multiple lines should indent the subsequent
- lines with two tabs (one additional tab, relative the the code following the
- conditional statement).
- dev/doc/func-naming.txt
- Hard limit for function name first part is five characters. Soft limit is
- four characters.
- Function name hard limit for second part is five characters (initialization /
- activation). Does not apply to names that have been shortened to individual
- characters per word.
- Struct member name soft limit is four characters.
- script/upload-pastebin.sh
- cd /root
- date > upload-data.txt
- echo 'Files:'
- files=$(find dev -name '*.c' -o -name '*.h' -o -name '*.py' -o -name '*.sh' -o -name '*.txt' -o -name '.vimrc')
- for file in $files; do
- echo " $file"
- echo $file >> upload-data.txt
- cat $file >> upload-data.txt
- done
- files=$(find script -name '*.c' -o -name '*.h' -o -name '*.py' -o -name '*.sh' -o -name '*.txt' -o -name '.vimrc')
- for file in $files; do
- echo " $file"
- echo $file >> upload-data.txt
- cat $file >> upload-data.txt
- done
- echo
- echo -n 'URL: '
- python ./script/intrn/upload-pastebin.py `cat script/intrn/dev-key`
- rm upload-data.txt
- script/intrn/upload-pastebin.py
- import pastebin_python
- import sys
- pb = pastebin_python.pastebin.PastebinPython(api_dev_key=sys.argv[1])
- print pb.createPasteFromFile('upload-data.txt', 'anthony gorecki anthony@anthonygorecki.ca', '', '0', 'N')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement