Advertisement
Guest User

anthony gorecki anthony@anthonygorecki.ca

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