-
-
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.
Signed-off-by: Joe McCain III <jo3mccain@icloud.com>
- Loading branch information
Showing
20 changed files
with
276 additions
and
87 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
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
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 |
---|---|---|
|
@@ -15,4 +15,3 @@ macro_rules! unit_impl_fmt { | |
$(impl_fmt!(@impl $trait::<$T>($($fmt)*));)* | ||
}; | ||
} | ||
|
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
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
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
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
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,48 @@ | ||
/* | ||
Appellation: cursor <module> | ||
Contrib: FL03 <jo3mccain@icloud.com> | ||
*/ | ||
|
||
/// [Cursor] contains contextual information about the position of the head of a tape. | ||
/// | ||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] | ||
pub struct Cursor<T = char> { | ||
pub(crate) pos: usize, | ||
pub(crate) ptr: *mut T, | ||
pub(crate) step: usize, | ||
} | ||
|
||
impl<T> Cursor<T> { | ||
pub fn new(ptr: *mut T) -> Self { | ||
Self { | ||
pos: 0, | ||
ptr, | ||
step: 0, | ||
} | ||
} | ||
|
||
pub fn from_vec(vec: &mut Vec<T>) -> Self { | ||
Self::new(vec.as_mut_ptr()) | ||
} | ||
|
||
pub fn pointer(&self) -> *mut T { | ||
self.ptr | ||
} | ||
|
||
pub fn position(&self) -> usize { | ||
self.pos | ||
} | ||
|
||
pub fn step(&self) -> usize { | ||
self.step | ||
} | ||
|
||
pub fn update(&mut self, cursor: usize) { | ||
self.pos = cursor; | ||
self.next(); | ||
} | ||
|
||
fn next(&mut self) { | ||
self.step += 1; | ||
} | ||
} |
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,10 @@ | ||
/* | ||
Appellation: ds <module> | ||
Contrib: FL03 <jo3mccain@icloud.com> | ||
*/ | ||
#![allow(unused)] | ||
/// [DoubleTape] preserves the input, recording all actions taken on a seperate tape. | ||
pub struct DoubleTape<I = char, O = char> { | ||
pub(crate) inputs: Vec<I>, | ||
pub(crate) output: Vec<O>, | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.