-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f30305
commit ff3f8a2
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ Library Code | |
c/bcd | ||
c/digits | ||
c/factors | ||
c/fibonacci | ||
c/iterator | ||
c/macros | ||
c/math | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
digits.h | ||
======== | ||
|
||
.. c:namespace-push:: digits | ||
.. c:type:: digit_counter | ||
Implements the :c:macro:`Iterator <c.iterator.IteratorHead>` API | ||
and yields successive decimal digits of a given number. | ||
|
||
.. c:member:: unsigned char (*iterator_function)(*digit_counter) | ||
The function to advance the iterator and return the next element. | ||
.. c:member:: bool exhausted : 1 | ||
An indicator that tells you if the iterator is exhausted. | ||
.. c:member:: bool started : 1 | ||
An indicator that tells you if the interator has moved at all. | ||
.. c:member:: bool phase : 1 | ||
An indicator that flips every time the iterator moves. | ||
.. c:member:: unsigned char *digits | ||
This array holds the individual digits of a parsed integer. | ||
.. c:member:: size_t idx | ||
This represents the current position in :c:member:`digits`. | ||
.. c:function:: digit_counter digits(uintmax_t n) | ||
.. c:function:: void free_digit_counter(digit_counter dc) | ||
.. c:namespace-pop:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
fibonacci.h | ||
======== | ||
|
||
.. c:namespace-push:: fibonacci | ||
.. c:type:: fibonacci | ||
Implements the :c:macro:`Iterator <c.iterator.IteratorHead>` API | ||
and yields successive Fibonacci numbers. | ||
|
||
.. c:member:: uintmax_t (*iterator_function)(*digit_counter) | ||
The function to advance the iterator and return the next element. | ||
|
||
.. c:member:: bool exhausted : 1 | ||
An indicator that tells you if the iterator is exhausted. | ||
|
||
.. c:member:: bool started : 1 | ||
An indicator that tells you if the interator has moved at all. | ||
|
||
.. c:member:: bool phase : 1 | ||
An indicator that flips every time the iterator moves. | ||
|
||
.. c:member:: uintmax_t a | ||
.. c:member:: uintmax_t b | ||
.. c:member:: uintmax_t limit | ||
This represents the largest number the iterator is allowed to yield. | ||
|
||
.. c:function:: fibonacci fibonacci1(uintmax_t limit) | ||
.. c:function:: fibonacci fibonacci0() | ||
.. c:namespace-pop:: |