Advertisement
Guest User

anthony gorecki anthony@anthonygorecki.ca

a guest
Nov 25th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.70 KB | None | 0 0
  1. Wed Nov 25 04:21:25 EST 2015
  2. ./dev/gc-base-lib/2/src/ct/tavl.c
  3. ./dev/gc-base-lib/2/src/ct/trbll.c
  4. ./dev/gc-base-lib/2/src/ct/it.c
  5. ./dev/gc-base-lib/2/src/svc/atq.c
  6. ./dev/gc-base-lib/2/src/svc/tpool_a.c
  7. ./dev/gc-base-lib/2/src/os/linux/aio.txt
  8. kernel aio linux 512, 2048 or other sector size, as determined by the underlying
  9. block device. can get this value via ioctl.
  10.  
  11. also can do simple kernel aio implementation better than libaio. use this instead.
  12. see firefox bookmark "own aio impl" x2
  13.  
  14. aio works for block size increments. reads / writes other than that size to the
  15. beginning or end of the file will be blocking. see firefox bookmark "blocking aio".
  16. this has not been verified.
  17. ./dev/gc-base-lib/2/src/os/linux/this_dir.txt
  18. linux specific things like signalfd, timerfd, kernel aio go in this directory
  19. ./dev/gc-base-lib/2/src/os/unix/pcnd.c
  20. ./dev/gc-base-lib/2/src/os/unix/mtx_attr.c
  21. ./dev/gc-base-lib/2/src/os/unix/cnd_attr.c
  22. ./dev/gc-base-lib/2/src/os/unix/mtx.c
  23. ./dev/gc-base-lib/2/src/os/unix/cnd.c
  24. ./dev/gc-base-lib/2/src/os/unix/thrd.c
  25. ./dev/gc-base-lib/2/src/os/unix/pmtx.c
  26. ./dev/gc-base-lib/1/proj-make.txt
  27. #===============================================================================
  28. # This file is part of Gc-Base-Lib.
  29. # Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  30. #
  31. # Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  32. # the terms of the GNU General Public License as published by the Free Software
  33. # Foundation, either version 3 of the License, or (at your option) any later
  34. # version.
  35. #
  36. # Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  37. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  38. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  39. #
  40. # You should have received a copy of the GNU General Public License along with
  41. # Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  42. #===============================================================================
  43. # gc-proj-conf (tracks config; can reconfigure; if you aren't going to make 'dev'
  44. # it won't be configured)
  45. # gc-proj-make (will rebuild changed files; will rebuild only necessary after conf change)
  46. # gc-proj-inst (installs all built targets)
  47.  
  48. TGEN dev
  49. CONF
  50. NDIR INC
  51. NDIR PKGCONFIG
  52. MAKE
  53. EXEC lib/pkgconfig/make.sh $DPKGCONFIG
  54. INST
  55. COPY inc/gc $DINC
  56. MOVE lib/pkgconfig/gc-base.pc.tmp $DPKGCONFIG/gc-base.pc
  57.  
  58. TLIB lib
  59. CONF
  60. DEF # Default target
  61. # NDIR LIB (implied by target type)
  62. ./dev/gc-base-lib/1/src/ct/u8bcss.c
  63. //==============================================================================
  64. // This file is part of Gc-Base-Lib.
  65. // Lockless circular buffer, supporting a single producer and single consumer.
  66. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  67. //
  68. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  69. // the terms of the GNU General Public License as published by the Free Software
  70. // Foundation, either version 3 of the License, or (at your option) any later
  71. // version.
  72. //
  73. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  74. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  75. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  76. // details.
  77. //
  78. // You should have received a copy of the GNU General Public License along with
  79. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  80. //==============================================================================
  81. #include <gc/mem.h>
  82.  
  83. #include <gc/u8bcss.h>
  84.  
  85. // Two variable "u8_a" type, member 1 is "dbeg", member 2 is "cbeg".
  86. //
  87. // Minimum size for this buffer implementation is two bytes. Check for this in
  88. // conf validation.
  89. //
  90. // Implementation should work out figures using the nonatomic 'scout' member.
  91. // Contig is inteded for buffer output, where parsers might need a certain
  92. // number of contiguous bytes to function properly. Support is also provided for
  93. // contiguous bytes for buffer input, should it be useful. These numbers are
  94. // designed to represent the /minimum/ that the application can handle.
  95. //
  96. // This buffer is not designed to handle circumstances in which the read or
  97. // write address needs to be aligned to some specific value, or when the reads
  98. // and writes need to be of a particular size. In other words, it is not
  99. // designed for linux kernel aio or any other kind of disk aio.
  100. //
  101. // This buffer is a candidate for sync and async network io, and sync disk io,
  102. // as well as unix pipes.
  103. //
  104. // Buffer conversion will be available: u8bcss -> u8_b for pars_ -> publish
  105. // changes back to original u8bcss once finished. This will work for more
  106. // advanced to less advanced buffers, and the other way around. Will have a
  107. // similar style to the (file) input and output functions at the end of this
  108. // file. This might only be for contiguous io segments. The buffer conversion
  109. // function is not responsible for doing any initialization or deinitialization
  110. // of the target buffer.
  111.  
  112.  
  113.  
  114. //==============================================================================
  115. // Initialization
  116. //==============================================================================
  117. u8 u8bcss_init(struct u8bcss_i *buf, struct u8bcss_c *conf)
  118. {
  119. // Atomic members need to be initialized before being used. Do that here.
  120.  
  121. buf->scin = conf->scin; // U16
  122. buf->scout = conf->scout;
  123. buf->cin = buf->cbeg - conf->scntg;
  124. buf->cout = 0;
  125. buf->din = buf->dbeg + conf->scntg;
  126. buf->dout = buf->dbeg + conf->scntg;
  127. return 0;
  128. }
  129.  
  130.  
  131.  
  132. //==============================================================================
  133. // Advance
  134. //==============================================================================
  135. void u8bcss_ia(struct u8bcss_i *buf, u32 size)
  136. {
  137. u32 off = buf->din - buf->dbeg + size;
  138.  
  139. if (off < buf->cbeg - 1)
  140. buf->din += size;
  141.  
  142. else // Wrap around.
  143. buf->din = buf->dbeg + off - buf->cbeg;
  144.  
  145. atmc_fsub(&buf->cin, size);
  146. atmc_fadd(&buf->cout, size);
  147. }
  148.  
  149.  
  150. void u8bcss_oa(struct u8bcss_i *buf, u32 size)
  151. {
  152. u32 off = buf->dout - buf->dbeg + size;
  153.  
  154. if (off < buf->cbeg - 1)
  155. buf->dout += size;
  156.  
  157. else // Wrap around.
  158. buf->dout = buf->dbeg + off - buf->cbeg;
  159.  
  160. atmc_fsub(&buf->cout, size);
  161. atmc_fadd(&buf->cin, size);
  162. }
  163.  
  164.  
  165.  
  166. //==============================================================================
  167. // Count
  168. //==============================================================================
  169. u32 u8bcss_igc(struct u8bcss_i *buf)
  170. {
  171. return atmc_load(&buf->cin);
  172. }
  173.  
  174.  
  175. u32 u8bcss_ogc(struct u8bcss_i *buf)
  176. {
  177. return atmc_load(&buf->cout);
  178. }
  179.  
  180.  
  181.  
  182. //==============================================================================
  183. // Contiguous count and pointer
  184. //==============================================================================
  185. u32 u8bcss_igcc(struct u8bcss_i *buf)
  186. {
  187. u32 off_in = buf->din - buf->dbeg;
  188. u32 orig_cin = atmc_load(&buf->cin);
  189.  
  190. if (off_in + orig_cin < buf->cbeg - 1)
  191. return orig_cout;
  192.  
  193. return buf->cbeg - off_in;
  194. }
  195.  
  196.  
  197. u8 *u8bcss_igcp(struct u8bcss_i *buf)
  198. {
  199. return buf->din;
  200. }
  201.  
  202.  
  203. u32 u8bcss_ogcc(struct u8bcss_i *buf)
  204. {
  205. u32 off_out = buf->dout - buf->dbeg;
  206. u32 orig_cout = atmc_load(&buf->cout);
  207.  
  208. if (off_out + orig_cout < buf->cbeg - 1)
  209. return orig_cout;
  210.  
  211. return buf->cbeg - off_out;
  212. }
  213.  
  214.  
  215. u8 *u8bcss_ogcp(struct u8bcss_i *buf)
  216. {
  217. return buf->dout;
  218. }
  219.  
  220.  
  221.  
  222. //==============================================================================
  223. // Peeking
  224. //==============================================================================
  225. u8 u8bcss_op1(struct u8bcss_i *buf)
  226. {
  227. return buf->dout[0];
  228. }
  229.  
  230.  
  231. u16 u8bcss_op2(struct u8bcss_i *buf)
  232. {
  233. u8 data[2];
  234.  
  235. data[0] = buf->dout[0];
  236.  
  237. if (buf->dout <= buf->dbeg + buf->cbeg - 2)
  238. data[1] = buf->dout[1];
  239.  
  240. else
  241. data[1] = buf->dbeg[0];
  242.  
  243. return (u16)data;
  244. }
  245.  
  246.  
  247.  
  248. //==============================================================================
  249. // Input and output
  250. //==============================================================================
  251. u8 u8bcss_if(struct u8bcss_i *buf, u8 (*fin)(void*, u8*, u32, u32*),
  252. void *arg)
  253. {
  254. u32 ret;
  255.  
  256. if (unlikely(fin(arg, buf->din, u8bcss_igcc(buf), &ret)))
  257. return 1;
  258.  
  259. u8bcss_ia(buf, ret);
  260. return 0;
  261. }
  262.  
  263.  
  264. u8 u8bcss_of(struct u8bcss_i *buf, u8 (*fout)(void*, u8*, u32, u32*),
  265. void *arg)
  266. {
  267. u32 ret;
  268.  
  269. if (unlikely(fout(arg, buf->dout, u8bcss_ogcc(buf), &ret)))
  270. return 1;
  271.  
  272. u8bcss_oa(buf, ret);
  273. return 0;
  274. }
  275. ./dev/gc-base-lib/1/src/ct/u8ib.c
  276. //==============================================================================
  277. // This file is part of Gc-Base-Lib.
  278. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  279. //
  280. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  281. // the terms of the GNU General Public License as published by the Free Software
  282. // Foundation, either version 3 of the License, or (at your option) any later
  283. // version.
  284. //
  285. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  286. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  287. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  288. // details.
  289. //
  290. // You should have received a copy of the GNU General Public License along with
  291. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  292. //==============================================================================
  293. #include <gc/mem.h>
  294.  
  295. #include <gc/u8ib.h>
  296.  
  297.  
  298.  
  299. //==============================================================================
  300. // Initialization and deinitialization
  301. //==============================================================================
  302. CT_WRAP_MSI2D1(u8ib);
  303.  
  304.  
  305. u8 u8ib_init_ms(struct u8ib_i *ibuf, struct u8ib_c *conf)
  306. {
  307. MS_BEG(0);
  308.  
  309. MS_SP {
  310. ibuf->buf = mem_alloc(conf->sbuf);
  311. MS_EV(ibuf->buf != NULL || !conf->sbuf);
  312. }
  313.  
  314. MS_SP { MS_EV(!conf->f->init(ibuf->buf, conf->buf)); }
  315. MS_SP { ibuf->f = conf->f; }
  316. return 0;
  317. }
  318.  
  319.  
  320. void u8ib_deinit_ms(struct u8ib_i *ibuf, u8 step)
  321. {
  322. MS_BEG(step);
  323. MS_EM;
  324. MS_SP { ibuf->f->deinit(ibuf->buf); }
  325. MS_SP { mem_dealloc(ibuf->buf); }
  326. }
  327.  
  328.  
  329.  
  330. //==============================================================================
  331. // Advance
  332. //==============================================================================
  333. void u8ib_ia(struct u8ib_i *ibuf, u32 size)
  334. {
  335. ibuf->f->ia(ibuf->buf, size);
  336. }
  337.  
  338.  
  339. void u8ib_oa(struct u8ib_i *ibuf, u32 size)
  340. {
  341. ibuf->f->oa(ibuf->buf, size);
  342. }
  343.  
  344.  
  345.  
  346. //==============================================================================
  347. // Count
  348. //==============================================================================
  349. u32 u8ib_igc(struct u8ib_i *ibuf)
  350. {
  351. return ibuf->f->igc(ibuf->buf);
  352. }
  353.  
  354.  
  355. u32 u8ib_ogc(struct u8ib_i *ibuf)
  356. {
  357. return ibuf->f->ogc(ibuf->buf);
  358. }
  359.  
  360.  
  361.  
  362. //==============================================================================
  363. // Contiguous count and pointer
  364. //==============================================================================
  365. u32 u8ib_igcc(struct u8ib_i *ibuf)
  366. {
  367. return ibuf->f->igcc(ibuf->buf);
  368. }
  369.  
  370.  
  371. u8 *u8ib_igcp(struct u8ib_i *ibuf)
  372. {
  373. return ibuf->f->igcp(ibuf->buf);
  374. }
  375.  
  376.  
  377. u32 u8ib_ogcc(struct u8ib_i *ibuf)
  378. {
  379. return ibuf->f->ogcc(ibuf->buf);
  380. }
  381.  
  382.  
  383. u8 *u8ib_ogcp(struct u8ib_i *ibuf)
  384. {
  385. return ibuf->f->ogcp(ibuf->buf);
  386. }
  387.  
  388.  
  389.  
  390. //==============================================================================
  391. // Peeking
  392. //==============================================================================
  393. u8 u8ib_op1(struct u8ib_i *ibuf)
  394. {
  395. return ibuf->f->op1(ibuf->buf);
  396. }
  397.  
  398.  
  399. u16 u8ib_op2(struct u8ib_i *ibuf)
  400. {
  401. return ibuf->f->op2(ibuf->buf);
  402. }
  403.  
  404.  
  405.  
  406. //==============================================================================
  407. // Input and output
  408. //==============================================================================
  409. u8 u8ib_if(struct u8ib_i *ibuf, u8 (*fin)(void*, u8*, u32, u32*), void *arg)
  410. {
  411. return ibuf->if(ibuf->buf, fin, arg);
  412. }
  413.  
  414.  
  415. u8 u8ib_of(struct u8ib_i *ibuf, u8 (*fout)(void*, u8*, u32, u32*), void *arg)
  416. {
  417. return ibuf->of(ibuf->buf, fout, arg);
  418. }
  419. ./dev/gc-base-lib/1/src/ct/u8a.c
  420. //==============================================================================
  421. // This file is part of Gc-Base-Lib.
  422. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  423. //
  424. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  425. // the terms of the GNU General Public License as published by the Free Software
  426. // Foundation, either version 3 of the License, or (at your option) any later
  427. // version.
  428. //
  429. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  430. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  431. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  432. // details.
  433. //
  434. // You should have received a copy of the GNU General Public License along with
  435. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  436. //==============================================================================
  437. #include <gc/mem.h>
  438.  
  439. #include <gc/u8a.h>
  440.  
  441.  
  442.  
  443. //==============================================================================
  444. // Initialization and deinitialization
  445. //==============================================================================
  446. u8 u8a_init(u8 **arr, u32 *size, struct u8a_c *conf)
  447. {
  448. *arr = mem_alloc(conf->size);
  449.  
  450. if (unlikely(*arr == NULL && conf->size))
  451. return 1;
  452.  
  453. *size = conf->size;
  454. return 0;
  455. }
  456.  
  457.  
  458. void u8a_deinit(u8 **arr)
  459. {
  460. mem_dealloc(*arr);
  461. }
  462.  
  463.  
  464.  
  465. //==============================================================================
  466. // "u8's"
  467. //==============================================================================
  468. u32 u8a_u8m1(u8 *arr, u32 size, u8 data)
  469. {
  470. while (size && *arr == data) {
  471. ++arr;
  472. --size;
  473. }
  474.  
  475. return size;
  476. }
  477.  
  478.  
  479. u32 u8a_u8m2(u8 *arr, u32 size, u8 data1, u8 data2)
  480. {
  481. while (size >= 2 && *arr == data1 && *(arr+1) == data2) {
  482. arr += 2;
  483. size -= 2;
  484. }
  485.  
  486. return size;
  487. }
  488.  
  489.  
  490.  
  491. //==============================================================================
  492. // New line characters
  493. //==============================================================================
  494. u8 u8a_nld(u8 *arr, u32 size, u8 types)
  495. {
  496. assert((types & NL_RN) || (types & NL_N) || (types & NL_R));
  497.  
  498. if (size >= 2 && (types & NL_RN) && *arr == '\r' && *(arr+1) == '\n')
  499. return NL_RN;
  500.  
  501. if (size) {
  502. if ((types & NL_N) && *arr == '\n')
  503. return NL_N;
  504.  
  505. if ((types & NL_R) && *arr == '\r')
  506. return NL_R;
  507. }
  508.  
  509. return 0;
  510. }
  511.  
  512.  
  513. u32 u8a_nlms(u8 *arr, u32 size, u8 types)
  514. {
  515. u8 dtype = u8a_nld(arr, size, types);
  516. __unused u8 nl;
  517. u32 ret;
  518.  
  519. if (unlikely(!dtype))
  520. return 0;
  521.  
  522. if ((dtype & NL_RN)) {
  523. arr += 2;
  524. size -= 2;
  525. ret = u8a_u8m2(arr, size, '\r', '\n');
  526. }
  527.  
  528. else {
  529. ++arr;
  530. --size;
  531.  
  532. if ((dtype & NL_N))
  533. nl = '\n';
  534.  
  535. else
  536. nl = '\r';
  537.  
  538. ret = u8a_u8m1(arr, size, nl);
  539. }
  540.  
  541. return ret;
  542. }
  543.  
  544.  
  545. u32 u8a_nlmm(u8 *arr, u32 size, u8 types)
  546. {
  547. u32 rem;
  548.  
  549. for (;;) {
  550. rem = u8a_nlms(arr, size, types);
  551.  
  552. if (rem >= size)
  553. break;
  554.  
  555. arr += size - rem;
  556. size = rem;
  557. }
  558.  
  559. return size;
  560. }
  561. ./dev/gc-base-lib/1/src/ct/u8b.c
  562. ./dev/gc-base-lib/1/src/ct/u8bc.c
  563. //==============================================================================
  564. // This file is part of Gc-Base-Lib.
  565. // Simple circular buffer, supporting nonsimultaneous input and output.
  566. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  567. //
  568. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  569. // the terms of the GNU General Public License as published by the Free Software
  570. // Foundation, either version 3 of the License, or (at your option) any later
  571. // version.
  572. //
  573. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  574. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  575. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  576. // details.
  577. //
  578. // You should have received a copy of the GNU General Public License along with
  579. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  580. //==============================================================================
  581. #include <gc/mem.h>
  582.  
  583. #include <gc/u8bc.h>
  584.  
  585.  
  586.  
  587. //==============================================================================
  588. // Initialization and deinitialization
  589. //==============================================================================
  590. u8 u8bc_init(struct u8bc_i *buf, struct u8bc_c *conf)
  591. {
  592. // Minimum size for this buffer implementation is two bytes. Check for this
  593. // in conf validation.
  594.  
  595. buf->dbeg = mem_alloc(conf->size);
  596.  
  597. if (unlikely(buf->dbeg == NULL))
  598. return 1;
  599.  
  600. buf->cbeg = size;
  601. return 0;
  602. }
  603.  
  604.  
  605. void u8bc_deinit(struct u8bc_i *buf)
  606. {
  607. mem_dealloc(buf->dbeg);
  608. }
  609.  
  610.  
  611.  
  612. //==============================================================================
  613. // Advance
  614. //==============================================================================
  615. void u8bc_ia(struct u8bc_i *buf, u32 size)
  616. {
  617. u32 off = buf->din - buf->dbeg + size;
  618.  
  619. if (off < buf->cbeg - 1)
  620. buf->din += size;
  621.  
  622. else // Wrap around.
  623. buf->din = buf->dbeg + off - buf->cbeg;
  624.  
  625. atmc_fsub(&buf->cin, size);
  626. atmc_fadd(&buf->cout, size);
  627. }
  628.  
  629.  
  630. void u8bc_oa(struct u8bc_i *buf, u32 size)
  631. {
  632. u32 off = buf->dout - buf->dbeg + size;
  633.  
  634. if (off < buf->cbeg - 1)
  635. buf->dout += size;
  636.  
  637. else // Wrap around.
  638. buf->dout = buf->dbeg + off - buf->cbeg;
  639.  
  640. atmc_fsub(&buf->cout, size);
  641. atmc_fadd(&buf->cin, size);
  642. }
  643.  
  644.  
  645.  
  646. //==============================================================================
  647. // Count
  648. //==============================================================================
  649. u32 u8bc_igc(struct u8bc_i *buf)
  650. {
  651. return atmc_load(&buf->cin);
  652. }
  653.  
  654.  
  655. u32 u8bc_ogc(struct u8bc_i *buf)
  656. {
  657. return atmc_load(&buf->cout);
  658. }
  659.  
  660.  
  661.  
  662. //==============================================================================
  663. // Contiguous count and pointer
  664. //==============================================================================
  665. u32 u8bc_igcc(struct u8bc_i *buf)
  666. {
  667. u32 off_in = buf->din - buf->dbeg;
  668. u32 orig_cin = atmc_load(&buf->cin);
  669.  
  670. if (off_in + orig_cin < buf->cbeg - 1)
  671. return orig_cout;
  672.  
  673. return buf->cbeg - off_in;
  674. }
  675.  
  676.  
  677. u8 *u8bc_igcp(struct u8bc_i *buf)
  678. {
  679. return buf->din;
  680. }
  681.  
  682.  
  683. u32 u8bc_ogcc(struct u8bc_i *buf)
  684. {
  685. u32 off_out = buf->dout - buf->dbeg;
  686. u32 orig_cout = atmc_load(&buf->cout);
  687.  
  688. if (off_out + orig_cout < buf->cbeg - 1)
  689. return orig_cout;
  690.  
  691. return buf->cbeg - off_out;
  692. }
  693.  
  694.  
  695. u8 *u8bc_ogcp(struct u8bc_i *buf)
  696. {
  697. return buf->dout;
  698. }
  699.  
  700.  
  701.  
  702. //==============================================================================
  703. // Peeking
  704. //==============================================================================
  705. u8 u8bc_op1(struct u8bc_i *buf)
  706. {
  707. return buf->dout[0];
  708. }
  709.  
  710.  
  711. u16 u8bc_op2(struct u8bc_i *buf)
  712. {
  713. u8 data[2];
  714.  
  715. data[0] = buf->dout[0];
  716.  
  717. if (buf->dout <= buf->dbeg + buf->cbeg - 2)
  718. data[1] = buf->dout[1];
  719.  
  720. else
  721. data[1] = buf->dbeg[0];
  722.  
  723. return (u16)data;
  724. }
  725.  
  726.  
  727.  
  728. //==============================================================================
  729. // Input and output
  730. //==============================================================================
  731. u8 u8bc_if(struct u8bc_i *buf, u8 (*fin)(void*, u8*, u32, u32*),
  732. void *arg)
  733. {
  734. u32 ret;
  735.  
  736. if (unlikely(fin(arg, buf->din, u8bc_igcc(buf), &ret)))
  737. return 1;
  738.  
  739. u8bc_ia(buf, ret);
  740. return 0;
  741. }
  742.  
  743.  
  744. u8 u8bc_of(struct u8bc_i *buf, u8 (*fout)(void*, u8*, u32, u32*),
  745. void *arg)
  746. {
  747. u32 ret;
  748.  
  749. if (unlikely(fout(arg, buf->dout, u8bc_ogcc(buf), &ret)))
  750. return 1;
  751.  
  752. u8bc_oa(buf, ret);
  753. return 0;
  754. }
  755. ./dev/gc-base-lib/1/src/util/pars.c
  756. //==============================================================================
  757. // This file is part of Gc-Base-Lib.
  758. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  759. //
  760. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  761. // the terms of the GNU General Public License as published by the Free Software
  762. // Foundation, either version 3 of the License, or (at your option) any later
  763. // version.
  764. //
  765. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  766. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  767. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  768. // details.
  769. //
  770. // You should have received a copy of the GNU General Public License along with
  771. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  772. //==============================================================================
  773. #include <gc/pars.h>
  774.  
  775. // If it is possible to convert between buffer types, this should probably be
  776. // moved to u8_a. u8_a_nlcs et al.
  777. //
  778. // This parser requires exclusive access the the buffer region provided by buf.
  779. // For multiple reader buffers, it's expected that a block of data will be read,
  780. // converted to a u8_b for the parser, and treated as a contiguous array.
  781.  
  782. ./dev/gc-base-lib/1/src/pt/u8.c
  783. //==============================================================================
  784. // This file is part of Gc-Base-Lib.
  785. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  786. //
  787. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  788. // the terms of the GNU General Public License as published by the Free Software
  789. // Foundation, either version 3 of the License, or (at your option) any later
  790. // version.
  791. //
  792. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  793. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  794. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  795. // details.
  796. //
  797. // You should have received a copy of the GNU General Public License along with
  798. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  799. //==============================================================================
  800. #include <gc/u8.h>
  801. ./dev/gc-base-lib/1/src/os/unix/proc.c
  802. //==============================================================================
  803. // This file is part of Gc-Base-Lib.
  804. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  805. //
  806. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  807. // the terms of the GNU General Public License as published by the Free Software
  808. // Foundation, either version 3 of the License, or (at your option) any later
  809. // version.
  810. //
  811. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  812. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  813. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  814. // details.
  815. //
  816. // You should have received a copy of the GNU General Public License along with
  817. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  818. //==============================================================================
  819. // proc_st_init, proc_st_next, ...
  820. #include <gc/proc.h>
  821.  
  822.  
  823.  
  824. //==============================================================================
  825. // Execution
  826. //==============================================================================
  827. u8 proc_exec(void)
  828. {
  829. }
  830. ./dev/gc-base-lib/1/src/os/unix/mem.c
  831. //==============================================================================
  832. // This file is part of Gc-Base-Lib.
  833. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  834. //
  835. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  836. // the terms of the GNU General Public License as published by the Free Software
  837. // Foundation, either version 3 of the License, or (at your option) any later
  838. // version.
  839. //
  840. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  841. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  842. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  843. // details.
  844. //
  845. // You should have received a copy of the GNU General Public License along with
  846. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  847. //==============================================================================
  848. #include <gc/mem.h>
  849.  
  850. #include <stdlib.h>
  851. #include <string.h>
  852.  
  853.  
  854.  
  855. //==============================================================================
  856. // Allocation, reallocation and deallocation
  857. //==============================================================================
  858. void *mem_alloc(size_t size)
  859. {
  860. return malloc(size);
  861. }
  862.  
  863.  
  864. void *mem_realloc(void *ptr, size_t size)
  865. {
  866. return realloc(ptr, size);
  867. }
  868.  
  869.  
  870. void mem_dealloc(void *ptr)
  871. {
  872. free(ptr);
  873. }
  874.  
  875.  
  876.  
  877. //==============================================================================
  878. // Utility
  879. //==============================================================================
  880. s8 mem_comp(void *data1, void *data2, size_t size)
  881. {
  882. return memcmp(data1, data2, size);
  883. }
  884.  
  885.  
  886. void mem_copy(void *dest, void *src, size_t size)
  887. {
  888. memcpy(dest, src, size);
  889. }
  890.  
  891.  
  892. void mem_move(void *dest, void *src, size_t size)
  893. {
  894. memmove(dest, src, size);
  895. }
  896.  
  897.  
  898. void mem_set(void *ptr, u8 data, size_t size)
  899. {
  900. memset(ptr, data, size);
  901. }
  902. ./dev/gc-base-lib/1/src/os/unix/file.c
  903. //==============================================================================
  904. // This file is part of Gc-Base-Lib.
  905. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  906. //
  907. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  908. // the terms of the GNU General Public License as published by the Free Software
  909. // Foundation, either version 3 of the License, or (at your option) any later
  910. // version.
  911. //
  912. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  913. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  914. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  915. // details.
  916. //
  917. // You should have received a copy of the GNU General Public License along with
  918. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  919. //==============================================================================
  920. #include <gc/file.h>
  921.  
  922. #include <unistd.h>
  923.  
  924.  
  925.  
  926. //==============================================================================
  927. // Initialization and deinitialization
  928. //==============================================================================
  929. u8 file_init(struct file_i *file, struct file_c *conf)
  930. {
  931. if (!(conf->flags & FILE_CREAT))
  932. file->fd = open(conf->path, conf->flags);
  933.  
  934. else
  935. file->fd = open(conf->path, conf->flags, conf->mode);
  936.  
  937. if (unlikely(file->fd == -1))
  938. return 1;
  939.  
  940. return 0;
  941. }
  942.  
  943.  
  944. void file_deinit(struct file_i *file)
  945. {
  946. close(file->fd);
  947. }
  948.  
  949.  
  950.  
  951. //==============================================================================
  952. // Read and write
  953. //==============================================================================
  954. u8 file_read(struct file_i *file, u8 *buf, u32 size, u32 *ret)
  955. {
  956. ssize_t bytes = read(file->fd, buf, size);
  957.  
  958. if (unlikely(bytes == -1))
  959. return 1;
  960.  
  961. *ret = bytes;
  962. return 0;
  963. }
  964.  
  965.  
  966. u8 file_write(struct file_i *file, u8 *buf, u32 size, u32 *ret)
  967. {
  968. ssize_t bytes = write(file->fd, buf, size);
  969.  
  970. if (unlikely(bytes == -1))
  971. return 1;
  972.  
  973. *ret = bytes;
  974. return 0;
  975. }
  976.  
  977.  
  978.  
  979. //==============================================================================
  980. // Utility
  981. //==============================================================================
  982. u8 file_gstats(struct file_i *file, struct file_stats *stats)
  983. {
  984. if (unlikely(fstat(file->fd, &stats->data)))
  985. return 1;
  986.  
  987. return 0;
  988. }
  989. ./dev/gc-base-lib/1/make.sh
  990. gcc -o libgc-base -shared -I include -std=c11 -Wall -Wextra -Wpedantic -Werror `find src -type f -name '*.c'`
  991. ./dev/gc-base-lib/1/inc/gc/macro/ms.h
  992. //==============================================================================
  993. // This file is part of Gc-Base-Lib.
  994. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  995. //
  996. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  997. // the terms of the GNU General Public License as published by the Free Software
  998. // Foundation, either version 3 of the License, or (at your option) any later
  999. // version.
  1000. //
  1001. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1002. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1003. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1004. // details.
  1005. //
  1006. // You should have received a copy of the GNU General Public License along with
  1007. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1008. //==============================================================================
  1009. #pragma once
  1010.  
  1011. #define MS_BEG(STEP)
  1012. #define MS_EM
  1013. #define MS_SP
  1014. #define MS_EV
  1015. ./dev/gc-base-lib/1/inc/gc/proc.h
  1016. //==============================================================================
  1017. // This file is part of Gc-Base-Lib.
  1018. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1019. //
  1020. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1021. // the terms of the GNU General Public License as published by the Free Software
  1022. // Foundation, either version 3 of the License, or (at your option) any later
  1023. // version.
  1024. //
  1025. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1026. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1027. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1028. // details.
  1029. //
  1030. // You should have received a copy of the GNU General Public License along with
  1031. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1032. //==============================================================================
  1033. #pragma once
  1034.  
  1035. #include <gc/common.h>
  1036.  
  1037. #if defined(__use_gnu_bktrc)
  1038. #include <gc/proc-gnu-bktrc.h>
  1039. #endif
  1040.  
  1041. #if defined(__use_lunwind)
  1042. #include <gc/proc-lunwind.h>
  1043. #endif
  1044.  
  1045. // Null function pointers for systems where back traces are not supported.
  1046. ./dev/gc-base-lib/1/inc/gc/common.h
  1047. //==============================================================================
  1048. // This file is part of Gc-Base-Lib.
  1049. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1050. //
  1051. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1052. // the terms of the GNU General Public License as published by the Free Software
  1053. // Foundation, either version 3 of the License, or (at your option) any later
  1054. // version.
  1055. //
  1056. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1057. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1058. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1059. // details.
  1060. //
  1061. // You should have received a copy of the GNU General Public License along with
  1062. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1063. //==============================================================================
  1064. #pragma once
  1065.  
  1066. #include <stddef.h>
  1067. #include <stdint.h>
  1068.  
  1069. // "__unused" is expected to be provided by a system library. Define it in this
  1070. // file only if it is missing on the host system.
  1071.  
  1072. #define likely(EXPR) __builtin_expect(EXPR, 1)
  1073. #define unlikely(EXPR) __builtin_expect(EXPR, 0)
  1074.  
  1075. typedef int8_t s8;
  1076. typedef int16_t s16;
  1077. typedef int32_t s32;
  1078. typedef int64_t s64;
  1079.  
  1080. typedef uint8_t u8;
  1081. typedef uint16_t u16;
  1082. typedef uint32_t u32;
  1083. typedef uint64_t u64;
  1084. ./dev/gc-base-lib/1/inc/gc/u8_ib.h
  1085. //==============================================================================
  1086. // This file is part of Gc-Base-Lib.
  1087. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1088. //
  1089. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1090. // the terms of the GNU General Public License as published by the Free Software
  1091. // Foundation, either version 3 of the License, or (at your option) any later
  1092. // version.
  1093. //
  1094. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1095. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1096. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1097. // details.
  1098. //
  1099. // You should have received a copy of the GNU General Public License along with
  1100. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1101. //==============================================================================
  1102. #pragma once
  1103.  
  1104. #include <gc/ct.h>
  1105.  
  1106. struct u8_ib_i {
  1107. };
  1108.  
  1109. struct u8_ib_c {
  1110. };
  1111. ./dev/gc-base-lib/1/inc/gc/atmc.h
  1112. //==============================================================================
  1113. // This file is part of Gc-Base-Lib.
  1114. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1115. //
  1116. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1117. // the terms of the GNU General Public License as published by the Free Software
  1118. // Foundation, either version 3 of the License, or (at your option) any later
  1119. // version.
  1120. //
  1121. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1122. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1123. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1124. // details.
  1125. //
  1126. // You should have received a copy of the GNU General Public License along with
  1127. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1128. //==============================================================================
  1129. #pragma once
  1130.  
  1131. #include <gc/common.h>
  1132.  
  1133. typedef _Atomic s8 as8;
  1134. typedef _Atomic s16 as16;
  1135. typedef _Atomic s32 as32;
  1136. typedef _Atomic s64 as64;
  1137.  
  1138. typedef _Atomic u8 au8;
  1139. typedef _Atomic u16 au16;
  1140. typedef _Atomic u32 au32;
  1141. typedef _Atomic u64 au64;
  1142.  
  1143. #define atmc_fadd atomic_fetch_add
  1144. #define atmc_fsub atomic_fetch_sub
  1145. #define atmc_load atomic_load
  1146. ./dev/gc-base-lib/1/inc/gc/ct.h
  1147. //==============================================================================
  1148. // This file is part of Gc-Base-Lib.
  1149. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1150. //
  1151. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1152. // the terms of the GNU General Public License as published by the Free Software
  1153. // Foundation, either version 3 of the License, or (at your option) any later
  1154. // version.
  1155. //
  1156. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1157. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1158. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1159. // details.
  1160. //
  1161. // You should have received a copy of the GNU General Public License along with
  1162. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1163. //==============================================================================
  1164. #pragma once
  1165.  
  1166. #include <gc/macro/ms.h>
  1167.  
  1168. // Configuration for composite types needs space for two offsets (u16's), to
  1169. // allow for two variable types (such as "u8_a").
  1170.  
  1171. #define CT_M1V 1 // Member 1 pass by value.
  1172. #define CT_M2V 2 // Member 2 pass by value.
  1173. #define CT_M2D 4 // Member 2 pass to deinit.
  1174.  
  1175. #define CT_WRAP_MSI2D1(PREF) \
  1176. u8 PREF##_init_ms(struct PREF##_i*, struct PREF##_c*); \
  1177. void PREF##_deinit_ms(struct PREF##_i*); \
  1178. u8 PREF##_init(struct PREF##_i *info, struct PREF##_c *conf) \
  1179. { \
  1180. u8 step = PREF##_init_ms(info, conf); \
  1181. if (!step) \
  1182. return 0; \
  1183. PREF##_deinit_ms(info, step); \
  1184. return 1; \
  1185. } \
  1186. void PREF##_deinit(struct PREF##_i *info) \
  1187. { \
  1188. PREF##_deinit_ms(info, 0); \
  1189. }
  1190. ./dev/gc-base-lib/1/inc/gc/u8b.h
  1191. //==============================================================================
  1192. // This file is part of Gc-Base-Lib.
  1193. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1194. //
  1195. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1196. // the terms of the GNU General Public License as published by the Free Software
  1197. // Foundation, either version 3 of the License, or (at your option) any later
  1198. // version.
  1199. //
  1200. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1201. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1202. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1203. // details.
  1204. //
  1205. // You should have received a copy of the GNU General Public License along with
  1206. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1207. //==============================================================================
  1208. #pragma once
  1209.  
  1210. #include <gc/atmc.h>
  1211.  
  1212. struct u8b_i {
  1213. u32 cbeg;
  1214. au32 cin;
  1215. au32 cout;
  1216. u8 *dbeg;
  1217. u8 *din;
  1218. u8 *dout;
  1219. };
  1220. ./dev/gc-base-lib/1/inc/gc/pars.h
  1221. //==============================================================================
  1222. // This file is part of Gc-Base-Lib.
  1223. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1224. //
  1225. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1226. // the terms of the GNU General Public License as published by the Free Software
  1227. // Foundation, either version 3 of the License, or (at your option) any later
  1228. // version.
  1229. //
  1230. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1231. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1232. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1233. // details.
  1234. //
  1235. // You should have received a copy of the GNU General Public License along with
  1236. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1237. //==============================================================================
  1238. #pragma once
  1239.  
  1240. #include <gc/u8b.h>
  1241.  
  1242. struct pars_i {
  1243. struct u8b_i buf;
  1244. };
  1245. ./dev/gc-base-lib/1/inc/gc/file.h
  1246. //==============================================================================
  1247. // This file is part of Gc-Base-Lib.
  1248. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1249. //
  1250. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1251. // the terms of the GNU General Public License as published by the Free Software
  1252. // Foundation, either version 3 of the License, or (at your option) any later
  1253. // version.
  1254. //
  1255. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1256. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1257. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1258. // details.
  1259. //
  1260. // You should have received a copy of the GNU General Public License along with
  1261. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1262. //==============================================================================
  1263. #pragma once
  1264.  
  1265. #include <gc/u8b.h>
  1266.  
  1267. #include <sys/stat.h>
  1268. #include <fcntl.h>
  1269.  
  1270. struct file_i {
  1271. int fd;
  1272. };
  1273.  
  1274. struct file_c {
  1275. const char *path;
  1276. int flags;
  1277. mode_t mode;
  1278. };
  1279.  
  1280. struct file_stats {
  1281. struct stat data;
  1282. };
  1283. ./dev/gc-base-lib/1/inc/gc/mem.h
  1284. //==============================================================================
  1285. // This file is part of Gc-Base-Lib.
  1286. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1287. //
  1288. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1289. // the terms of the GNU General Public License as published by the Free Software
  1290. // Foundation, either version 3 of the License, or (at your option) any later
  1291. // version.
  1292. //
  1293. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1294. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1295. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1296. // details.
  1297. //
  1298. // You should have received a copy of the GNU General Public License along with
  1299. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1300. //==============================================================================
  1301. #pragma once
  1302.  
  1303. #include <gc/common.h>
  1304.  
  1305. void* mem_alloc(size_t);
  1306. void* mem_realloc(void*, size_t);
  1307. void mem_dealloc(void*);
  1308.  
  1309. u8 mem_comp(void*, void*, size_t);
  1310. void mem_copy(void*, void*, size_t);
  1311. void mem_move(void*, void*, size_t);
  1312. void mem_set(void*, u8, size_t);
  1313. ./dev/doc/includes.txt
  1314. External Gc headers, Gc header for local file, all other headers; groups
  1315. separated by a single new line.
  1316. ./dev/doc/func-args.txt
  1317. Structs are always used for info and conf varaibles so their contents /
  1318. implementation can easily be changed later and without modifying the code of
  1319. software using the libraries.
  1320. ./dev/doc/code-style.txt
  1321. Soft limit for line length is 80 characters, hard limit is 100 characters.
  1322.  
  1323. Conditional statements requiring multiple lines should indent the subsequent
  1324. lines with two tabs (one additional tab, relative the the code following the
  1325. conditional statement).
  1326. ./dev/doc/func-naming.txt
  1327. Hard limit for function name first part is five characters. Soft limit is
  1328. four characters.
  1329.  
  1330. Function name hard limit for second part is five characters (initialization /
  1331. activation). Does not apply to names that have been shortened to individual
  1332. characters per word.
  1333.  
  1334. Struct member name soft limit is four characters.
  1335. ./script/upload-pastebin.sh
  1336. cd /root
  1337.  
  1338. echo 'Files:'
  1339.  
  1340. files=$(find -name '*.c' -o -name '*.h' -o -name '*.py' -o -name '*.sh' -o -name '*.txt' -o -name '.vimrc')
  1341.  
  1342. date > upload-data.txt
  1343.  
  1344. for file in $files; do
  1345. echo " $file"
  1346. echo $file >> upload-data.txt
  1347. cat $file >> upload-data.txt
  1348. done
  1349.  
  1350. echo
  1351. echo -n 'URL: '
  1352. python ./script/intrn/upload-pastebin.py `cat script/intrn/dev-key`
  1353. rm upload-data.txt
  1354. ./script/intrn/upload-pastebin.py
  1355. import pastebin_python
  1356. import sys
  1357.  
  1358. pb = pastebin_python.pastebin.PastebinPython(api_dev_key=sys.argv[1])
  1359. print pb.createPasteFromFile('upload-data.txt', 'anthony gorecki anthony@anthonygorecki.ca', '', '0', 'N')
  1360. ./.vimrc
  1361. set ts=4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement