Skip to content

Commit

Permalink
Merge #202
Browse files Browse the repository at this point in the history
202: More small fixes r=behnam a=behnam
  • Loading branch information
bors[bot] committed Feb 7, 2018
2 parents 988fe90 + 44727cd commit fcdf416
Show file tree
Hide file tree
Showing 54 changed files with 786 additions and 265 deletions.
3 changes: 1 addition & 2 deletions apps/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ readme = "README.md"


[dependencies]
unic-ucd = { path = "../../unic/ucd/", version = "0.6.0" }
unic-char-property = { path = "../../unic/char/property/", version = "0.6.0" }
unic = { path = "../../unic/", version = "0.6.0" }

clap = "2.29"
lazy_static = "1.0"
Expand Down
8 changes: 4 additions & 4 deletions apps/cli/src/bin/unic-inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

#[macro_use]
extern crate clap;

#[macro_use]
extern crate prettytable;

extern crate unic_char_property;
extern crate unic;
extern crate unic_cli;
extern crate unic_ucd;

use clap::Arg;
use prettytable::format::TableFormat;
use prettytable::Table;

use unic_char_property::EnumeratedCharProperty;
use unic_ucd::{GeneralCategory, Name};
use unic::char::property::EnumeratedCharProperty;
use unic::ucd::{GeneralCategory, Name};

fn main() {
let app = app_from_crate!()
Expand Down
94 changes: 94 additions & 0 deletions apps/cli/src/bin/unic-versions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright 2017 The UNIC Project Developers.
//
// See the COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![forbid(unsafe_code)]

//! Command-line tool to list versions of UNIC components.
extern crate unic;

macro_rules! print_component_desc {
( $component:tt ) => (
println!("Component: {}", unic::$component::PKG_DESCRIPTION);
);
}

macro_rules! print_component_name_version {
( $component:tt ) => (
println!(
"Package: {} ({})",
unic::$component::PKG_NAME,
unic::$component::PKG_VERSION
);
);
}

macro_rules! print_unicode_version {
( $component:tt ) => (
println!(
"Unicode Version: {}.{}.{}",
unic::$component::UNICODE_VERSION.major,
unic::$component::UNICODE_VERSION.minor,
unic::$component::UNICODE_VERSION.micro
);
);
}

macro_rules! print_emoji_version {
( $component:tt ) => (
println!(
"Emoji Version: {}.{}.{}",
unic::$component::EMOJI_VERSION.major,
unic::$component::EMOJI_VERSION.minor,
unic::$component::EMOJI_VERSION.micro
);
);
}

macro_rules! print_component_info {
( $component:tt ) => (
print_component_desc!($component);
print_component_name_version!($component);
println!();
);
}

macro_rules! print_component_info_with_unicode_version {
( $component:tt ) => (
print_component_desc!($component);
print_component_name_version!($component);
print_unicode_version!($component);
println!();
);
}

macro_rules! print_component_info_with_emoji_version {
( $component:tt ) => (
print_component_desc!($component);
print_component_name_version!($component);
print_emoji_version!($component);
println!();
);
}

fn main() {
println!("UNIC: Unicode and Internationalization Crates for Rust");
println!("Package: unic ({})", unic::PKG_VERSION);
println!();

print_component_info!(char);

print_component_info_with_unicode_version!(ucd);
print_component_info_with_unicode_version!(bidi);
print_component_info_with_unicode_version!(normal);
print_component_info_with_unicode_version!(idna);

print_component_info_with_emoji_version!(emoji);
}
35 changes: 35 additions & 0 deletions etc/check-components.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

# Copyright 2017 The UNIC Project Developers.
#
# See the COPYRIGHT file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

# Since `cargo publish --all` does not exist yet, we use this dumb alternative
# solution for now.
#
# Main downside of this approch is that there are separate `target/`
# directories used for each component, increasing the test and publish process
# time.

set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "$DIR/common.sh"


# Steps

# Package all components
for component in $COMPONENTS; do
pkg_file="$component/src/pkg_info.rs"
if [ ! -f "$pkg_file" ]
then
echo "Missing pkg_file: $component"
fi
done
2 changes: 2 additions & 0 deletions etc/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ set -e

# List of components, in order of dependency
export COMPONENTS="
unic/common
unic/char/property
unic/char/range
unic/char
Expand Down
3 changes: 2 additions & 1 deletion unic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ exclude = []

[features]
default = []
unstable = [] # Rust nightly features
unstable = ["unic-common/unstable"] # Rust nightly features
bench_it = ["unic-bidi/bench_it"]
serde = ["unic-bidi/serde"]

[dependencies]
unic-bidi = { path = "bidi/", version = "0.6.0" }
unic-char = { path = "char/", version = "0.6.0", features = ["std"] }
unic-common = { path = "common/", version = "0.6.0" }
unic-emoji = { path = "emoji/", version = "0.6.0" }
unic-idna = { path = "idna/", version = "0.6.0" }
unic-normal = { path = "normal/", version = "0.6.0" }
Expand Down
27 changes: 12 additions & 15 deletions unic/bidi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,23 @@ extern crate serde;
#[cfg(all(feature = "serde", test))]
extern crate serde_test;

pub use unic_ucd_bidi::UNICODE_VERSION;
pub use unic_ucd_bidi::{bidi_class, BidiClass, BidiClassCategory};

mod pkg_info;
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};

pub mod format_chars;

pub mod level;
pub use level::Level;

mod bidi_info;
mod explicit;
mod implicit;
mod prepare;

pub use unic_ucd_bidi::UNICODE_VERSION;
pub use unic_ucd_bidi::{bidi_class, BidiClass, BidiClassCategory};

pub use bidi_info::{BidiInfo, ParagraphInfo};
pub use level::Level;
pub use prepare::LevelRun;

/// UNIC component version.
pub const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
mod explicit;

/// UNIC component name.
pub const PKG_NAME: &str = env!("CARGO_PKG_NAME");
mod implicit;

/// UNIC component description.
pub const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
mod prepare;
pub use prepare::LevelRun;
20 changes: 20 additions & 0 deletions unic/bidi/src/pkg_info.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2017 The UNIC Project Developers.
//
// See the COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Package information
/// UNIC component version.
pub const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");

/// UNIC component name.
pub const PKG_NAME: &str = env!("CARGO_PKG_NAME");

/// UNIC component description.
pub const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
19 changes: 10 additions & 9 deletions unic/char/property/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,26 @@
#[macro_use]
extern crate unic_char_range;

// pub because is used in macros, called from macro call-site.
pub mod tables;

mod macros;
mod pkg_info;
mod property;
mod range_types;
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};

mod property;
pub use self::property::{CharProperty, PartialCharProperty, TotalCharProperty};
pub use self::range_types::{

mod range_types;
pub use range_types::{
BinaryCharProperty,
CustomCharProperty,
EnumeratedCharProperty,
NumericCharProperty,
NumericCharPropertyValue,
};

mod macros;

// pub because is used in macros, called from macro call-site.
pub mod tables;

// Used in macros
#[doc(hidden)]
pub use core::{fmt as __fmt, str as __str};

pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
16 changes: 9 additions & 7 deletions unic/char/range/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@
#[cfg(feature = "std")]
extern crate core;

mod iter;
mod macros;
mod pkg_info;
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};

mod iter;
pub use iter::CharIter;

mod range;
pub use range::CharRange;

mod macros;

mod step;

#[cfg(feature = "fused")]
mod iter_fused;

#[cfg(feature = "trusted-len")]
mod iter_trusted_len;

pub use range::CharRange;
pub use iter::CharIter;

pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
1 change: 0 additions & 1 deletion unic/char/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ pub extern crate unic_char_property as property;
pub extern crate unic_char_range as range;

mod pkg_info;

pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
19 changes: 19 additions & 0 deletions unic/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "unic-common"
version = "0.6.0"
authors = ["The UNIC Project Developers"]
repository = "https://github.com/behnam/rust-unic/"
license = "MIT/Apache-2.0"
description = "UNIC - Common Utilities"
keywords = ["unicode", "version"]
categories = ["internationalization", "text-processing"]

# No tests/benches that depends on /data/
exclude = []

[features]
default = []
unstable = [] # Rust nightly features

[badges]
travis-ci = { repository = "behnam/rust-unic", branch = "master" }
7 changes: 7 additions & 0 deletions unic/common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# UNIC — Common Utilities

[![Crates.io](https://img.shields.io/crates/v/unic-common.svg)](https://crates.io/crates/unic-common)
[![Documentation](https://docs.rs/unic-common/badge.svg)](https://docs.rs/unic-common/)

This UNIC component provides common types, algorithms and macros not shared
between many components.
25 changes: 25 additions & 0 deletions unic/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2017 The UNIC Project Developers.
//
// See the COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![no_std]
#![forbid(unsafe_code, missing_docs, unconditional_recursion)]
#![cfg_attr(feature = "unstable", feature(unicode))]

//! # UNIC — Common Utilities
//!
//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
//!
//! This UNIC component provides common types, algorithms and macros not shared between many
//! components.
mod pkg_info;
pub use pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};

pub mod version;
20 changes: 20 additions & 0 deletions unic/common/src/pkg_info.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2017 The UNIC Project Developers.
//
// See the COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Package information
/// UNIC component version.
pub const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");

/// UNIC component name.
pub const PKG_NAME: &str = env!("CARGO_PKG_NAME");

/// UNIC component description.
pub const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
Loading

0 comments on commit fcdf416

Please sign in to comment.