Rename printf crate to fish-printf

Preparing to publish to crates.io
This commit is contained in:
ridiculousfish 2024-06-09 12:29:09 -07:00
parent 56ea456ca3
commit 838ff86ae7
16 changed files with 32 additions and 32 deletions

18
Cargo.lock generated
View file

@ -91,6 +91,7 @@ dependencies = [
"cc", "cc",
"errno", "errno",
"fast-float", "fast-float",
"fish-printf",
"lazy_static", "lazy_static",
"libc", "libc",
"lru", "lru",
@ -98,7 +99,6 @@ dependencies = [
"num-traits", "num-traits",
"once_cell", "once_cell",
"pcre2", "pcre2",
"printf",
"rand", "rand",
"rand_pcg", "rand_pcg",
"rsconf", "rsconf",
@ -107,6 +107,14 @@ dependencies = [
"widestring", "widestring",
] ]
[[package]]
name = "fish-printf"
version = "0.1.0"
dependencies = [
"libc",
"widestring",
]
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"
@ -323,14 +331,6 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "printf"
version = "0.1.0"
dependencies = [
"libc",
"widestring",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.85" version = "1.0.85"

View file

@ -34,7 +34,7 @@ lru = "0.12.3"
nix = { version = "0.29.0", default-features = false, features = ["inotify", "resource", "fs"] } nix = { version = "0.29.0", default-features = false, features = ["inotify", "resource", "fs"] }
num-traits = "0.2.19" num-traits = "0.2.19"
once_cell = "1.19.0" once_cell = "1.19.0"
printf = { path = "./printf" } fish-printf = { path = "./printf" }
rand = { version = "0.8.5", features = ["small_rng"] } rand = { version = "0.8.5", features = ["small_rng"] }
widestring = "1.1.0" widestring = "1.1.0"
terminfo = "0.9.0" terminfo = "0.9.0"

View file

@ -1,5 +1,5 @@
[package] [package]
name = "printf" name = "fish-printf"
edition = "2021" edition = "2021"
version = "0.1.0" version = "0.1.0"
description = "printf implementation, based on musl" description = "printf implementation, based on musl"

View file

@ -17,8 +17,8 @@ use crate::{
wchar::{wstr, WString, L}, wchar::{wstr, WString, L},
wutil::{fish_wcstoi, wgettext_fmt}, wutil::{fish_wcstoi, wgettext_fmt},
}; };
use fish_printf::sprintf;
use libc::c_int; use libc::c_int;
use printf::sprintf;
use std::num::NonZeroU32; use std::num::NonZeroU32;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;

View file

@ -57,7 +57,7 @@ use crate::wutil::{
wcstoi::{wcstoi_partial, Options as WcstoiOpts}, wcstoi::{wcstoi_partial, Options as WcstoiOpts},
wstr_offset_in, wstr_offset_in,
}; };
use printf::{sprintf_locale, ToArg}; use fish_printf::{sprintf_locale, ToArg};
/// Return true if `c` is an octal digit. /// Return true if `c` is an octal digit.
fn is_octal_digit(c: char) -> bool { fn is_octal_digit(c: char) -> bool {

View file

@ -1,5 +1,5 @@
use fish_printf::sprintf;
use pcre2::utf32::{Captures, Regex, RegexBuilder}; use pcre2::utf32::{Captures, Regex, RegexBuilder};
use printf::sprintf;
use std::collections::HashMap; use std::collections::HashMap;
use super::*; use super::*;

View file

@ -15,8 +15,8 @@ use crate::{
util::wcsfilecmp, util::wcsfilecmp,
}; };
use bitflags::bitflags; use bitflags::bitflags;
use fish_printf::sprintf;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use printf::sprintf;
use crate::{ use crate::{
abbrs::with_abbrs, abbrs::with_abbrs,

View file

@ -41,8 +41,8 @@ impl ToWString for MaybeJobId {
} }
} }
impl<'a> printf::ToArg<'a> for MaybeJobId { impl<'a> fish_printf::ToArg<'a> for MaybeJobId {
fn to_arg(self) -> printf::Arg<'a> { fn to_arg(self) -> fish_printf::Arg<'a> {
self.as_num().to_arg() self.as_num().to_arg()
} }
} }

View file

@ -375,9 +375,9 @@ impl std::fmt::Display for Key {
} }
} }
impl printf::ToArg<'static> for Key { impl fish_printf::ToArg<'static> for Key {
fn to_arg(self) -> printf::Arg<'static> { fn to_arg(self) -> fish_printf::Arg<'static> {
printf::Arg::WString(self.into()) fish_printf::Arg::WString(self.into())
} }
} }

View file

@ -1,5 +1,5 @@
/// Support for the "current locale." /// Support for the "current locale."
pub use printf::locale::{Locale, C_LOCALE}; pub use fish_printf::locale::{Locale, C_LOCALE};
use std::sync::Mutex; use std::sync::Mutex;
/// Lock guarding libc `setlocale()` or `localeconv()` calls to avoid races. /// Lock guarding libc `setlocale()` or `localeconv()` calls to avoid races.

View file

@ -235,9 +235,9 @@ impl ParseKeyword {
} }
} }
impl printf::ToArg<'static> for ParseKeyword { impl fish_printf::ToArg<'static> for ParseKeyword {
fn to_arg(self) -> printf::Arg<'static> { fn to_arg(self) -> fish_printf::Arg<'static> {
printf::Arg::WStr(self.to_wstr()) fish_printf::Arg::WStr(self.to_wstr())
} }
} }

View file

@ -31,8 +31,8 @@ use crate::wait_handle::WaitHandleStore;
use crate::wchar::{wstr, WString, L}; use crate::wchar::{wstr, WString, L};
use crate::wutil::{perror, wgettext, wgettext_fmt}; use crate::wutil::{perror, wgettext, wgettext_fmt};
use crate::{function, FLOG}; use crate::{function, FLOG};
use fish_printf::sprintf;
use libc::c_int; use libc::c_int;
use printf::sprintf;
use std::cell::{Ref, RefCell, RefMut}; use std::cell::{Ref, RefCell, RefMut};
use std::ffi::{CStr, OsStr}; use std::ffi::{CStr, OsStr};
use std::os::fd::{AsRawFd, OwnedFd, RawFd}; use std::os::fd::{AsRawFd, OwnedFd, RawFd};

View file

@ -25,6 +25,7 @@ use crate::wait_handle::{InternalJobId, WaitHandle, WaitHandleRef, WaitHandleSto
use crate::wchar::{wstr, WString, L}; use crate::wchar::{wstr, WString, L};
use crate::wchar_ext::ToWString; use crate::wchar_ext::ToWString;
use crate::wutil::{perror, wbasename, wgettext, wperror}; use crate::wutil::{perror, wbasename, wgettext, wperror};
use fish_printf::sprintf;
use libc::{ use libc::{
EBADF, EINVAL, ENOTTY, EPERM, EXIT_SUCCESS, SIGABRT, SIGBUS, SIGCONT, SIGFPE, SIGHUP, SIGILL, EBADF, EINVAL, ENOTTY, EPERM, EXIT_SUCCESS, SIGABRT, SIGBUS, SIGCONT, SIGFPE, SIGHUP, SIGILL,
SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSYS, SIGTTOU, SIG_DFL, SIG_IGN, STDIN_FILENO, SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSYS, SIGTTOU, SIG_DFL, SIG_IGN, STDIN_FILENO,
@ -32,7 +33,6 @@ use libc::{
WUNTRACED, _SC_CLK_TCK, WUNTRACED, _SC_CLK_TCK,
}; };
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use printf::sprintf;
use std::cell::{Cell, Ref, RefCell, RefMut}; use std::cell::{Cell, Ref, RefCell, RefMut};
use std::fs; use std::fs;
use std::io::{Read, Write}; use std::io::{Read, Write};

View file

@ -191,10 +191,10 @@ impl From<TokenizerError> for &'static wstr {
} }
} }
impl printf::ToArg<'static> for TokenizerError { impl fish_printf::ToArg<'static> for TokenizerError {
fn to_arg(self) -> printf::Arg<'static> { fn to_arg(self) -> fish_printf::Arg<'static> {
let msg: &'static wstr = self.into(); let msg: &'static wstr = self.into();
printf::Arg::WStr(msg) fish_printf::Arg::WStr(msg)
} }
} }

View file

@ -26,8 +26,8 @@ use std::fs::{self, canonicalize};
use std::io::{self, Write}; use std::io::{self, Write};
use std::os::unix::prelude::*; use std::os::unix::prelude::*;
extern crate printf as extern_printf; extern crate fish_printf;
pub use extern_printf::sprintf; pub use fish_printf::sprintf;
pub use wcstoi::*; pub use wcstoi::*;

View file

@ -1,5 +1,5 @@
// Re-export sprintf macro. // Re-export sprintf macro.
pub use printf::sprintf; pub use fish_printf::sprintf;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {