Advertisement
Guest User

anthony gorecki anthony@anthonygorecki.ca

a guest
Nov 24th, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.89 KB | None | 0 0
  1. Tue Nov 24 04:47:25 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 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/u8_bcss.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/u8_bcss.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: u8_bcss -> u8_b for pars_ -> publish
  105. // changes back to original u8_bcss 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 u8_bcss_init(struct u8_bcss_i *buf, struct u8_bcss_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 u8_bcss_ia(struct u8_bcss_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 u8_bcss_oa(struct u8_bcss_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 u8_bcss_igc(struct u8_bcss_i *buf)
  170. {
  171. return atmc_load(&buf->cin);
  172. }
  173.  
  174.  
  175. u32 u8_bcss_ogc(struct u8_bcss_i *buf)
  176. {
  177. return atmc_load(&buf->cout);
  178. }
  179.  
  180.  
  181.  
  182. //==============================================================================
  183. // Contiguous count and pointer
  184. //==============================================================================
  185. u32 u8_bcss_igcc(struct u8_bcss_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 *u8_bcss_igcp(struct u8_bcss_i *buf)
  198. {
  199. return buf->din;
  200. }
  201.  
  202.  
  203. u32 u8_bcss_ogcc(struct u8_bcss_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 *u8_bcss_ogcp(struct u8_bcss_i *buf)
  216. {
  217. return buf->dout;
  218. }
  219.  
  220.  
  221.  
  222. //==============================================================================
  223. // Peeking
  224. //==============================================================================
  225. u8 u8_bcss_op1(struct u8_bcss_i *buf)
  226. {
  227. return buf->dout[0];
  228. }
  229.  
  230.  
  231. u16 u8_bcss_op2(struct u8_bcss_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 u8_bcss_if(struct u8_bcss_i *buf, u8 (*fin)(void*, u8*, u32, u32*),
  252. void *arg)
  253. {
  254. u32 ret;
  255.  
  256. if (unlikely(fin(arg, buf->din, u8_bcss_igcc(buf), &ret)))
  257. return 1;
  258.  
  259. u8_bcss_ia(buf, ret);
  260. return 0;
  261. }
  262.  
  263.  
  264. u8 u8_bcss_of(struct u8_bcss_i *buf, u8 (*fout)(void*, u8*, u32, u32*),
  265. void *arg)
  266. {
  267. u32 ret;
  268.  
  269. if (unlikely(fout(arg, buf->dout, u8_bcss_ogcc(buf), &ret)))
  270. return 1;
  271.  
  272. u8_bcss_oa(buf, ret);
  273. return 0;
  274. }
  275. ./dev/gc-base-lib/1/src/ct/u8_a.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/u8_a.h>
  296.  
  297.  
  298.  
  299. //==============================================================================
  300. // Initialization and deinitialization
  301. //==============================================================================
  302. u8 u8_a_init(u8 **arr, u32 *size, struct u8_a_c *conf)
  303. {
  304. *arr = mem_alloc(conf->size);
  305.  
  306. if (unlikely(*arr == NULL && conf->size))
  307. return 1;
  308.  
  309. *size = conf->size;
  310. return 0;
  311. }
  312.  
  313.  
  314. void u8_a_deinit(u8 **arr)
  315. {
  316. mem_dealloc(*arr);
  317. }
  318.  
  319.  
  320.  
  321. //==============================================================================
  322. // "u8's"
  323. //==============================================================================
  324. u32 u8_a_u8m1(u8 *arr, u32 size, u8 data)
  325. {
  326. while (size && *arr == data) {
  327. ++arr;
  328. --size;
  329. }
  330.  
  331. return size;
  332. }
  333.  
  334.  
  335. u32 u8_a_u8m2(u8 *arr, u32 size, u8 data1, u8 data2)
  336. {
  337. while (size >= 2 && *arr == data1 && *(arr+1) == data2) {
  338. arr += 2;
  339. size -= 2;
  340. }
  341.  
  342. return size;
  343. }
  344.  
  345.  
  346.  
  347. //==============================================================================
  348. // New line characters
  349. //==============================================================================
  350. u8 u8_a_nld(u8 *arr, u32 size, u8 types)
  351. {
  352. assert((types & NL_RN) || (types & NL_N) || (types & NL_R));
  353.  
  354. if (size >= 2 && (types & NL_RN) && *arr == '\r' && *(arr+1) == '\n')
  355. return NL_RN;
  356.  
  357. if (size) {
  358. if ((types & NL_N) && *arr == '\n')
  359. return NL_N;
  360.  
  361. if ((types & NL_R) && *arr == '\r')
  362. return NL_R;
  363. }
  364.  
  365. return 0;
  366. }
  367.  
  368.  
  369. u32 u8_a_nlms(u8 *arr, u32 size, u8 types)
  370. {
  371. u8 dtype = u8_a_nld(arr, size, types);
  372. __unused u8 nl;
  373. u32 ret;
  374.  
  375. if (unlikely(!dtype))
  376. return 0;
  377.  
  378. if ((dtype & NL_RN)) {
  379. arr += 2;
  380. size -= 2;
  381. ret = u8_a_u8m2(arr, size, '\r', '\n');
  382. }
  383.  
  384. else {
  385. ++arr;
  386. --size;
  387.  
  388. if ((dtype & NL_N))
  389. nl = '\n';
  390.  
  391. else
  392. nl = '\r';
  393.  
  394. ret = u8_a_u8m1(arr, size, nl);
  395. }
  396.  
  397. return ret;
  398. }
  399.  
  400.  
  401. u32 u8_a_nlmm(u8 *arr, u32 size, u8 types)
  402. {
  403. u32 rem;
  404.  
  405. for (;;) {
  406. rem = u8_a_nlms(arr, size, types);
  407.  
  408. if (rem >= size)
  409. break;
  410.  
  411. arr += size - rem;
  412. size = rem;
  413. }
  414.  
  415. return size;
  416. }
  417. ./dev/gc-base-lib/1/src/ct/u8_ib.c
  418. //==============================================================================
  419. // This file is part of Gc-Base-Lib.
  420. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  421. //
  422. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  423. // the terms of the GNU General Public License as published by the Free Software
  424. // Foundation, either version 3 of the License, or (at your option) any later
  425. // version.
  426. //
  427. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  428. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  429. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  430. // details.
  431. //
  432. // You should have received a copy of the GNU General Public License along with
  433. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  434. //==============================================================================
  435. #include <gc/mem.h>
  436.  
  437. #include <gc/u8_ib.h>
  438.  
  439.  
  440.  
  441. //==============================================================================
  442. // Initialization and deinitialization
  443. //==============================================================================
  444. CT_WRAP_MSI2D1(u8_ib);
  445.  
  446.  
  447. u8 u8_ib_init_ms(struct u8_ib_i *ibuf, struct u8_ib_c *conf)
  448. {
  449. MS_BEG(0);
  450.  
  451. MS_SP {
  452. ibuf->buf = mem_alloc(conf->sbuf);
  453. MS_EV(ibuf->buf != NULL || !conf->sbuf);
  454. }
  455.  
  456. MS_SP { MS_EV(!conf->f->init(ibuf->buf, conf->buf)); }
  457. MS_SP { ibuf->f = conf->f; }
  458. return 0;
  459. }
  460.  
  461.  
  462. void u8_ib_deinit_ms(struct u8_ib_i *ibuf, u8 step)
  463. {
  464. MS_BEG(step);
  465. MS_EM;
  466. MS_SP { ibuf->f->deinit(ibuf->buf); }
  467. MS_SP { mem_dealloc(ibuf->buf); }
  468. }
  469.  
  470.  
  471.  
  472. //==============================================================================
  473. // Advance
  474. //==============================================================================
  475. void u8_ib_ia(struct u8_ib_i *ibuf, u32 size)
  476. {
  477. ibuf->f->ia(ibuf->buf, size);
  478. }
  479.  
  480.  
  481. void u8_ib_oa(struct u8_ib_i *ibuf, u32 size)
  482. {
  483. ibuf->f->oa(ibuf->buf, size);
  484. }
  485.  
  486.  
  487.  
  488. //==============================================================================
  489. // Count
  490. //==============================================================================
  491. u32 u8_ib_igc(struct u8_ib_i *ibuf)
  492. {
  493. return ibuf->f->igc(ibuf->buf);
  494. }
  495.  
  496.  
  497. u32 u8_ib_ogc(struct u8_ib_i *ibuf)
  498. {
  499. return ibuf->f->ogc(ibuf->buf);
  500. }
  501.  
  502.  
  503.  
  504. //==============================================================================
  505. // Contiguous count and pointer
  506. //==============================================================================
  507. u32 u8_ib_igcc(struct u8_ib_i *ibuf)
  508. {
  509. return ibuf->f->igcc(ibuf->buf);
  510. }
  511.  
  512.  
  513. u8 *u8_ib_igcp(struct u8_ib_i *ibuf)
  514. {
  515. return ibuf->f->igcp(ibuf->buf);
  516. }
  517.  
  518.  
  519. u32 u8_ib_ogcc(struct u8_ib_i *ibuf)
  520. {
  521. return ibuf->f->ogcc(ibuf->buf);
  522. }
  523.  
  524.  
  525. u8 *u8_ib_ogcp(struct u8_ib_i *ibuf)
  526. {
  527. return ibuf->f->ogcp(ibuf->buf);
  528. }
  529.  
  530.  
  531.  
  532. //==============================================================================
  533. // Peeking
  534. //==============================================================================
  535. u8 u8_ib_op1(struct u8_ib_i *ibuf)
  536. {
  537. return ibuf->f->op1(ibuf->buf);
  538. }
  539.  
  540.  
  541. u16 u8_ib_op2(struct u8_ib_i *ibuf)
  542. {
  543. return ibuf->f->op2(ibuf->buf);
  544. }
  545.  
  546.  
  547.  
  548. //==============================================================================
  549. // Input and output
  550. //==============================================================================
  551. u8 u8_ib_if(struct u8_ib_i *ibuf, u8 (*fin)(void*, u8*, u32, u32*), void *arg)
  552. {
  553. return ibuf->if(ibuf->buf, fin, arg);
  554. }
  555.  
  556.  
  557. u8 u8_ib_of(struct u8_ib_i *ibuf, u8 (*fout)(void*, u8*, u32, u32*), void *arg)
  558. {
  559. return ibuf->of(ibuf->buf, fout, arg);
  560. }
  561. ./dev/gc-base-lib/1/src/ct/u8_b.c
  562. ./dev/gc-base-lib/1/src/ct/u8_bc.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/u8_bc.h>
  584.  
  585.  
  586.  
  587. //==============================================================================
  588. // Initialization and deinitialization
  589. //==============================================================================
  590. u8 u8_bc_init(struct u8_bc_i *buf, struct u8_bc_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 u8_bc_deinit(struct u8_bc_i *buf)
  606. {
  607. mem_dealloc(buf->dbeg);
  608. }
  609.  
  610.  
  611.  
  612. //==============================================================================
  613. // Advance
  614. //==============================================================================
  615. void u8_bc_ia(struct u8_bc_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 u8_bc_oa(struct u8_bc_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 u8_bc_igc(struct u8_bc_i *buf)
  650. {
  651. return atmc_load(&buf->cin);
  652. }
  653.  
  654.  
  655. u32 u8_bc_ogc(struct u8_bc_i *buf)
  656. {
  657. return atmc_load(&buf->cout);
  658. }
  659.  
  660.  
  661.  
  662. //==============================================================================
  663. // Contiguous count and pointer
  664. //==============================================================================
  665. u32 u8_bc_igcc(struct u8_bc_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 *u8_bc_igcp(struct u8_bc_i *buf)
  678. {
  679. return buf->din;
  680. }
  681.  
  682.  
  683. u32 u8_bc_ogcc(struct u8_bc_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 *u8_bc_ogcp(struct u8_bc_i *buf)
  696. {
  697. return buf->dout;
  698. }
  699.  
  700.  
  701.  
  702. //==============================================================================
  703. // Peeking
  704. //==============================================================================
  705. u8 u8_bc_op1(struct u8_bc_i *buf)
  706. {
  707. return buf->dout[0];
  708. }
  709.  
  710.  
  711. u16 u8_bc_op2(struct u8_bc_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 u8_bc_if(struct u8_bc_i *buf, u8 (*fin)(void*, u8*, u32, u32*),
  732. void *arg)
  733. {
  734. u32 ret;
  735.  
  736. if (unlikely(fin(arg, buf->din, u8_bc_igcc(buf), &ret)))
  737. return 1;
  738.  
  739. u8_bc_ia(buf, ret);
  740. return 0;
  741. }
  742.  
  743.  
  744. u8 u8_bc_of(struct u8_bc_i *buf, u8 (*fout)(void*, u8*, u32, u32*),
  745. void *arg)
  746. {
  747. u32 ret;
  748.  
  749. if (unlikely(fout(arg, buf->dout, u8_bc_ogcc(buf), &ret)))
  750. return 1;
  751.  
  752. u8_bc_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/os/unix/proc.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. // proc_st_init, proc_st_next, ...
  801. #include <gc/proc.h>
  802.  
  803.  
  804.  
  805. //==============================================================================
  806. // Execution
  807. //==============================================================================
  808. u8 proc_exec(void)
  809. {
  810. }
  811. ./dev/gc-base-lib/1/src/os/unix/mem.c
  812. //==============================================================================
  813. // This file is part of Gc-Base-Lib.
  814. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  815. //
  816. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  817. // the terms of the GNU General Public License as published by the Free Software
  818. // Foundation, either version 3 of the License, or (at your option) any later
  819. // version.
  820. //
  821. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  822. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  823. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  824. // details.
  825. //
  826. // You should have received a copy of the GNU General Public License along with
  827. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  828. //==============================================================================
  829. #include <gc/mem.h>
  830.  
  831. #include <stdlib.h>
  832. #include <string.h>
  833.  
  834.  
  835.  
  836. //==============================================================================
  837. // Allocation, reallocation and deallocation
  838. //==============================================================================
  839. void *mem_alloc(size_t size)
  840. {
  841. return malloc(size);
  842. }
  843.  
  844.  
  845. void *mem_realloc(void *ptr, size_t size)
  846. {
  847. return realloc(ptr, size);
  848. }
  849.  
  850.  
  851. void mem_dealloc(void *ptr)
  852. {
  853. free(ptr);
  854. }
  855.  
  856.  
  857.  
  858. //==============================================================================
  859. // Utility
  860. //==============================================================================
  861. s8 mem_comp(void *data1, void *data2, size_t size)
  862. {
  863. return memcmp(data1, data2, size);
  864. }
  865.  
  866.  
  867. void mem_copy(void *dest, void *src, size_t size)
  868. {
  869. memcpy(dest, src, size);
  870. }
  871.  
  872.  
  873. void mem_move(void *dest, void *src, size_t size)
  874. {
  875. memmove(dest, src, size);
  876. }
  877.  
  878.  
  879. void mem_set(void *ptr, u8 data, size_t size)
  880. {
  881. memset(ptr, data, size);
  882. }
  883. ./dev/gc-base-lib/1/src/os/unix/file.c
  884. //==============================================================================
  885. // This file is part of Gc-Base-Lib.
  886. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  887. //
  888. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  889. // the terms of the GNU General Public License as published by the Free Software
  890. // Foundation, either version 3 of the License, or (at your option) any later
  891. // version.
  892. //
  893. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  894. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  895. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  896. // details.
  897. //
  898. // You should have received a copy of the GNU General Public License along with
  899. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  900. //==============================================================================
  901. #include <gc/file.h>
  902.  
  903. #include <unistd.h>
  904.  
  905.  
  906.  
  907. //==============================================================================
  908. // Initialization and deinitialization
  909. //==============================================================================
  910. u8 file_init(struct file_i *file, struct file_c *conf)
  911. {
  912. if (!(conf->flags & FILE_CREAT))
  913. file->fd = open(conf->path, conf->flags);
  914.  
  915. else
  916. file->fd = open(conf->path, conf->flags, conf->mode);
  917.  
  918. if (unlikely(file->fd == -1))
  919. return 1;
  920.  
  921. return 0;
  922. }
  923.  
  924.  
  925. void file_deinit(struct file_i *file)
  926. {
  927. close(file->fd);
  928. }
  929.  
  930.  
  931.  
  932. //==============================================================================
  933. // Read and write
  934. //==============================================================================
  935. u8 file_read(struct file_i *file, u8 *buf, u32 size, u32 *ret)
  936. {
  937. ssize_t bytes = read(file->fd, buf, size);
  938.  
  939. if (unlikely(bytes == -1))
  940. return 1;
  941.  
  942. *ret = bytes;
  943. return 0;
  944. }
  945.  
  946.  
  947. u8 file_write(struct file_i *file, u8 *buf, u32 size, u32 *ret)
  948. {
  949. ssize_t bytes = write(file->fd, buf, size);
  950.  
  951. if (unlikely(bytes == -1))
  952. return 1;
  953.  
  954. *ret = bytes;
  955. return 0;
  956. }
  957.  
  958.  
  959.  
  960. //==============================================================================
  961. // Utility
  962. //==============================================================================
  963. u8 file_gstats(struct file_i *file, struct file_stats *stats)
  964. {
  965. if (unlikely(fstat(file->fd, &stats->data)))
  966. return 1;
  967.  
  968. return 0;
  969. }
  970. ./dev/gc-base-lib/1/make.sh
  971. gcc -o libgc-base -shared -I include -std=c11 -Wall -Wextra -Wpedantic -Werror `find src -type f -name '*.c'`
  972. ./dev/gc-base-lib/1/inc/gc/macro/ms.h
  973. //==============================================================================
  974. // This file is part of Gc-Base-Lib.
  975. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  976. //
  977. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  978. // the terms of the GNU General Public License as published by the Free Software
  979. // Foundation, either version 3 of the License, or (at your option) any later
  980. // version.
  981. //
  982. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  983. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  984. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  985. // details.
  986. //
  987. // You should have received a copy of the GNU General Public License along with
  988. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  989. //==============================================================================
  990. #pragma once
  991.  
  992. #define MS_BEG(STEP)
  993. #define MS_EM
  994. #define MS_SP
  995. #define MS_EV
  996. ./dev/gc-base-lib/1/inc/gc/proc.h
  997. //==============================================================================
  998. // This file is part of Gc-Base-Lib.
  999. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1000. //
  1001. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1002. // the terms of the GNU General Public License as published by the Free Software
  1003. // Foundation, either version 3 of the License, or (at your option) any later
  1004. // version.
  1005. //
  1006. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1007. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1008. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1009. // details.
  1010. //
  1011. // You should have received a copy of the GNU General Public License along with
  1012. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1013. //==============================================================================
  1014. #pragma once
  1015.  
  1016. #include <gc/common.h>
  1017.  
  1018. #if defined(__use_gnu_bktrc)
  1019. #include <gc/proc-gnu-bktrc.h>
  1020. #endif
  1021.  
  1022. #if defined(__use_lunwind)
  1023. #include <gc/proc-lunwind.h>
  1024. #endif
  1025.  
  1026. // Null function pointers for systems where back traces are not supported.
  1027. ./dev/gc-base-lib/1/inc/gc/common.h
  1028. //==============================================================================
  1029. // This file is part of Gc-Base-Lib.
  1030. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1031. //
  1032. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1033. // the terms of the GNU General Public License as published by the Free Software
  1034. // Foundation, either version 3 of the License, or (at your option) any later
  1035. // version.
  1036. //
  1037. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1038. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1039. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1040. // details.
  1041. //
  1042. // You should have received a copy of the GNU General Public License along with
  1043. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1044. //==============================================================================
  1045. #pragma once
  1046.  
  1047. #include <stddef.h>
  1048. #include <stdint.h>
  1049.  
  1050. // "__unused" is expected to be provided by a system library. Define it in this
  1051. // file only if it is missing on the host system.
  1052.  
  1053. #define likely(EXPR) __builtin_expect(EXPR, 1)
  1054. #define unlikely(EXPR) __builtin_expect(EXPR, 0)
  1055.  
  1056. typedef int8_t s8;
  1057. typedef int16_t s16;
  1058. typedef int32_t s32;
  1059. typedef int64_t s64;
  1060.  
  1061. typedef uint8_t u8;
  1062. typedef uint16_t u16;
  1063. typedef uint32_t u32;
  1064. typedef uint64_t u64;
  1065. ./dev/gc-base-lib/1/inc/gc/u8_ib.h
  1066. //==============================================================================
  1067. // This file is part of Gc-Base-Lib.
  1068. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1069. //
  1070. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1071. // the terms of the GNU General Public License as published by the Free Software
  1072. // Foundation, either version 3 of the License, or (at your option) any later
  1073. // version.
  1074. //
  1075. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1076. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1077. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1078. // details.
  1079. //
  1080. // You should have received a copy of the GNU General Public License along with
  1081. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1082. //==============================================================================
  1083. #pragma once
  1084.  
  1085. #include <gc/ct.h>
  1086.  
  1087. struct u8_ib_i {
  1088. };
  1089.  
  1090. struct u8_ib_c {
  1091. };
  1092. ./dev/gc-base-lib/1/inc/gc/atmc.h
  1093. //==============================================================================
  1094. // This file is part of Gc-Base-Lib.
  1095. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1096. //
  1097. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1098. // the terms of the GNU General Public License as published by the Free Software
  1099. // Foundation, either version 3 of the License, or (at your option) any later
  1100. // version.
  1101. //
  1102. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1103. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1104. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1105. // details.
  1106. //
  1107. // You should have received a copy of the GNU General Public License along with
  1108. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1109. //==============================================================================
  1110. #pragma once
  1111.  
  1112. #include <gc/common.h>
  1113.  
  1114. typedef _Atomic s8 as8;
  1115. typedef _Atomic s16 as16;
  1116. typedef _Atomic s32 as32;
  1117. typedef _Atomic s64 as64;
  1118.  
  1119. typedef _Atomic u8 au8;
  1120. typedef _Atomic u16 au16;
  1121. typedef _Atomic u32 au32;
  1122. typedef _Atomic u64 au64;
  1123.  
  1124. #define atmc_fadd atomic_fetch_add
  1125. #define atmc_fsub atomic_fetch_sub
  1126. #define atmc_load atomic_load
  1127. ./dev/gc-base-lib/1/inc/gc/ct.h
  1128. //==============================================================================
  1129. // This file is part of Gc-Base-Lib.
  1130. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1131. //
  1132. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1133. // the terms of the GNU General Public License as published by the Free Software
  1134. // Foundation, either version 3 of the License, or (at your option) any later
  1135. // version.
  1136. //
  1137. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1138. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1139. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1140. // details.
  1141. //
  1142. // You should have received a copy of the GNU General Public License along with
  1143. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1144. //==============================================================================
  1145. #pragma once
  1146.  
  1147. #include <gc/macro/ms.h>
  1148.  
  1149. // Configuration for composite types needs space for two offsets (u16's), to
  1150. // allow for two variable types (such as "u8_a").
  1151.  
  1152. #define CT_M1V 1 // Member 1 pass by value.
  1153. #define CT_M2V 2 // Member 2 pass by value.
  1154. #define CT_M2D 4 // Member 2 pass to deinit.
  1155.  
  1156. #define CT_WRAP_MSI2D1(PREF) \
  1157. u8 PREF##_init_ms(struct PREF##_i*, struct PREF##_c*); \
  1158. void PREF##_deinit_ms(struct PREF##_i*); \
  1159. u8 PREF##_init(struct PREF##_i *info, struct PREF##_c *conf) \
  1160. { \
  1161. u8 step = PREF##_init_ms(info, conf); \
  1162. if (!step) \
  1163. return 0; \
  1164. PREF##_deinit_ms(info, step); \
  1165. return 1; \
  1166. } \
  1167. void PREF##_deinit(struct PREF##_i *info) \
  1168. { \
  1169. PREF##_deinit_ms(info, 0); \
  1170. }
  1171. ./dev/gc-base-lib/1/inc/gc/u8b.h
  1172. //==============================================================================
  1173. // This file is part of Gc-Base-Lib.
  1174. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1175. //
  1176. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1177. // the terms of the GNU General Public License as published by the Free Software
  1178. // Foundation, either version 3 of the License, or (at your option) any later
  1179. // version.
  1180. //
  1181. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1182. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1183. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1184. // details.
  1185. //
  1186. // You should have received a copy of the GNU General Public License along with
  1187. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1188. //==============================================================================
  1189. #pragma once
  1190.  
  1191. #include <gc/atmc.h>
  1192.  
  1193. struct u8b_i {
  1194. u32 cbeg;
  1195. au32 cin;
  1196. au32 cout;
  1197. u8 *dbeg;
  1198. u8 *din;
  1199. u8 *dout;
  1200. };
  1201. ./dev/gc-base-lib/1/inc/gc/pars.h
  1202. //==============================================================================
  1203. // This file is part of Gc-Base-Lib.
  1204. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1205. //
  1206. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1207. // the terms of the GNU General Public License as published by the Free Software
  1208. // Foundation, either version 3 of the License, or (at your option) any later
  1209. // version.
  1210. //
  1211. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1212. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1213. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1214. // details.
  1215. //
  1216. // You should have received a copy of the GNU General Public License along with
  1217. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1218. //==============================================================================
  1219. #pragma once
  1220.  
  1221. #include <gc/u8b.h>
  1222.  
  1223. struct pars_i {
  1224. struct u8b_i buf;
  1225. };
  1226. ./dev/gc-base-lib/1/inc/gc/file.h
  1227. //==============================================================================
  1228. // This file is part of Gc-Base-Lib.
  1229. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1230. //
  1231. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1232. // the terms of the GNU General Public License as published by the Free Software
  1233. // Foundation, either version 3 of the License, or (at your option) any later
  1234. // version.
  1235. //
  1236. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1237. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1238. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1239. // details.
  1240. //
  1241. // You should have received a copy of the GNU General Public License along with
  1242. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1243. //==============================================================================
  1244. #pragma once
  1245.  
  1246. #include <gc/u8b.h>
  1247.  
  1248. #include <sys/stat.h>
  1249. #include <fcntl.h>
  1250.  
  1251. struct file_i {
  1252. int fd;
  1253. };
  1254.  
  1255. struct file_c {
  1256. const char *path;
  1257. int flags;
  1258. mode_t mode;
  1259. };
  1260.  
  1261. struct file_stats {
  1262. struct stat data;
  1263. };
  1264. ./dev/gc-base-lib/1/inc/gc/mem.h
  1265. //==============================================================================
  1266. // This file is part of Gc-Base-Lib.
  1267. // Copyright (C) 2015 Anthony Gorecki <agorecki@gcproj.org>
  1268. //
  1269. // Gc-Base-Lib is free software: you can redistribute it and/or modify it under
  1270. // the terms of the GNU General Public License as published by the Free Software
  1271. // Foundation, either version 3 of the License, or (at your option) any later
  1272. // version.
  1273. //
  1274. // Gc-Base-Lib is distributed in the hope that it will be useful, but WITHOUT
  1275. // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  1276. // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  1277. // details.
  1278. //
  1279. // You should have received a copy of the GNU General Public License along with
  1280. // Gc-Base-Lib. If not, see <http://www.gnu.org/licenses/>.
  1281. //==============================================================================
  1282. #pragma once
  1283.  
  1284. #include <gc/common.h>
  1285.  
  1286. void* mem_alloc(size_t);
  1287. void* mem_realloc(void*, size_t);
  1288. void mem_dealloc(void*);
  1289.  
  1290. u8 mem_comp(void*, void*, size_t);
  1291. void mem_copy(void*, void*, size_t);
  1292. void mem_move(void*, void*, size_t);
  1293. void mem_set(void*, u8, size_t);
  1294. ./dev/doc/includes.txt
  1295. External Gc headers, Gc header for local file, all other headers; groups
  1296. separated by a single new line.
  1297. ./dev/doc/func-args.txt
  1298. Structs are always used for info and conf varaibles so their contents /
  1299. implementation can easily be changed later and without modifying the code of
  1300. software using the libraries.
  1301. ./dev/doc/code-style.txt
  1302. Soft limit for line length is 80 characters, hard limit is 100 characters.
  1303.  
  1304. Conditional statements requiring multiple lines should indent the subsequent
  1305. lines with two tabs (one additional tab, relative the the code following the
  1306. conditional statement).
  1307. ./dev/doc/func-naming.txt
  1308. Hard limit for function name first part is five characters. Soft limit is
  1309. four characters.
  1310.  
  1311. Function name hard limit for second part is five characters (initialization /
  1312. activation). Does not apply to names that have been shortened to individual
  1313. characters per word.
  1314.  
  1315. Struct member name soft limit is four characters.
  1316. ./script/upload-pastebin.sh
  1317. cd /root
  1318.  
  1319. echo 'Files:'
  1320.  
  1321. files=$(find -name '*.c' -o -name '*.h' -o -name '*.py' -o -name '*.sh' -o -name '*.txt' -o -name '.vimrc')
  1322.  
  1323. date > upload-data.txt
  1324.  
  1325. for file in $files; do
  1326. echo " $file"
  1327. echo $file >> upload-data.txt
  1328. cat $file >> upload-data.txt
  1329. done
  1330.  
  1331. echo
  1332. echo -n 'URL: '
  1333. python ./script/intrn/upload-pastebin.py `cat script/intrn/dev-key`
  1334. rm upload-data.txt
  1335. ./script/intrn/upload-pastebin.py
  1336. import pastebin_python
  1337. import sys
  1338.  
  1339. pb = pastebin_python.pastebin.PastebinPython(api_dev_key=sys.argv[1])
  1340. print pb.createPasteFromFile('upload-data.txt', 'anthony gorecki anthony@anthonygorecki.ca', '', '0', 'N')
  1341. ./.vimrc
  1342. set ts=4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement