move text from durandal to marathon

gui-branch
an 2019-03-30 17:19:10 -04:00
parent 392e20ae65
commit 2875da07e1
8 changed files with 14 additions and 22 deletions

View File

@ -15,6 +15,5 @@ pub mod file;
pub mod fixed;
pub mod image;
pub mod sound;
pub mod text;
// EOF

View File

@ -1,6 +1,6 @@
//! Binary data conversion utilities.
use crate::durandal::{err::*, text::mac_roman_conv};
use crate::durandal::err::*;
use std::{fmt, num::NonZeroU16};
#[doc(hidden)]
@ -489,14 +489,6 @@ impl fmt::Debug for OptU16
}
}
impl fmt::Debug for Ident
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{
write!(f, "\"{}\"", mac_roman_conv(&self.0))
}
}
impl PartialEq<[u8; 4]> for Ident
{
#[inline]
@ -528,7 +520,7 @@ impl<'a> PartialEq<&'a [u8; 4]> for Ident
/// assert_eq!(&Ident(*b"POLY"), *b"POLY");
/// assert_eq!(&Ident(*b"POLY"), b"POLY");
/// ```
#[derive(Clone, Copy, Default, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize, serde::Deserialize))]
pub struct Ident(/** The individual bytes of this identifier. */ pub [u8; 4]);

View File

@ -8,6 +8,7 @@ pub mod pict;
pub mod ppm;
pub mod shp;
pub mod snd;
pub mod text;
pub mod tga;
pub mod trm;
pub mod wad;

View File

@ -1,7 +1,7 @@
//! Structures used by Marathon's Map format.
use crate::{durandal::{bin::*, err::*, fixed::*, text::*},
marathon::xfer::TransferMode};
use crate::{durandal::{bin::*, err::*, fixed::*},
marathon::{text::*, xfer::TransferMode}};
use bitflags::bitflags;
/// Reads a `LightFunc` object.

View File

@ -1,7 +1,7 @@
//! Marathon Shapes format handling.
use crate::{durandal::{bin::*, err::*, fixed::*, image::*, text::*},
marathon::xfer::TransferMode};
use crate::{durandal::{bin::*, err::*, fixed::*, image::*},
marathon::{text::*, xfer::TransferMode}};
use bitflags::bitflags;
/// Reads a color from a color table into `clut`.

View File

@ -5,7 +5,7 @@
/// # Examples
///
/// ```
/// use maraiah::durandal::text::to_binsize;
/// use maraiah::marathon::text::to_binsize;
///
/// assert_eq!(to_binsize(5000), "5kB".to_string());
/// ```
@ -57,7 +57,7 @@ pub fn fuck_string(s: &[u8]) -> Vec<u8>
/// # Examples
///
/// ```
/// use maraiah::durandal::text::pascal_str;
/// use maraiah::marathon::text::pascal_str;
///
/// assert_eq!(pascal_str(b"\x0bhello world"), b"hello world"[..].into());
/// assert_eq!(pascal_str(b"\x0chello world"), None);
@ -74,7 +74,7 @@ pub fn pascal_str(b: &[u8]) -> Option<&[u8]>
/// # Examples
///
/// ```
/// use maraiah::durandal::text::mac_roman_conv;
/// use maraiah::marathon::text::mac_roman_conv;
///
/// assert_eq!(mac_roman_conv(b"p\x8cth"), "påth");
/// assert_eq!(mac_roman_conv(b"I\xd5ve"), "Ive");
@ -99,7 +99,7 @@ pub fn mac_roman_conv(s: &[u8]) -> String
/// # Examples
///
/// ```
/// use maraiah::durandal::text::mac_roman_cstr;
/// use maraiah::marathon::text::mac_roman_cstr;
///
/// assert_eq!(mac_roman_cstr(b"I\xd5ve awaken\0ed"), "Ive awaken");
/// assert_eq!(mac_roman_cstr(b"I\xd5ve awaken\0"), "Ive awaken");

View File

@ -1,6 +1,6 @@
//! Structures used by Marathon's Map format's terminal definitions.
use crate::durandal::{bin::*, err::*, text::*};
use crate::{durandal::{bin::*, err::*}, marathon::text::*};
use bitflags::bitflags;
/// Reads an `InterGroup`.

View File

@ -1,7 +1,7 @@
//! Marathon Wad format handling.
use crate::{durandal::{bin::*, err::*, image, text::mac_roman_cstr},
marathon::{map, phy, pict, trm}};
use crate::{durandal::{bin::*, err::*, image},
marathon::{map, phy, pict, text::mac_roman_cstr, trm}};
use std::collections::BTreeMap;
/// Reads all chunks in an entry.