-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add unicode upcase
, downcase
#2547
base: master
Are you sure you want to change the base?
Changes from 15 commits
9f0bde5
7837686
12385d6
868a166
8213f7a
af614af
a6af7c7
fed59d7
2b02345
8f19800
1e9bb8d
98cf7c8
4f6e4ab
d0ffb98
f120bee
88a102f
a87d7d0
9530dad
3422fd6
26dd908
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \ | |
src/jv_dtoa.c src/jv_file.c src/jv_parse.c src/jv_print.c \ | ||
src/jv_unicode.c src/linker.c src/locfile.c src/util.c \ | ||
src/decNumber/decContext.c src/decNumber/decNumber.c \ | ||
src/jv_dtoa_tsd.c \ | ||
src/jv_dtoa_tsd.c \ | ||
${LIBJQ_INCS} | ||
|
||
### C build options | ||
|
@@ -175,13 +175,37 @@ endif | |
jq.1: jq.1.prebuilt | ||
$(AM_V_GEN) cp $(srcdir)/jq.1.prebuilt $@ | ||
|
||
SUBDIRS = | ||
|
||
AM_CFLAGS += ${utf8proc_CFLAGS} | ||
|
||
if BUNDLE_UTF8PROC | ||
LIBJQ_SRC += modules/utf8proc/utf8proc.c | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
AM_CFLAGS += -I${srcdir}/modules/utf8proc | ||
AM_CPPFLAGS += -I$(srcdir)/modules/utf8proc | ||
else | ||
if BUILD_UTF8PROC | ||
BUILT_SOURCES += $(builddir)/libutf8proc.a | ||
CLEANFILES += $(builddir)/libutf8proc.a | ||
jq_LDADD += $(builddir)/libutf8proc.a | ||
|
||
AM_CFLAGS += -I${srcdir}/modules/utf8proc | ||
AM_CPPFLAGS += -I$(srcdir)/modules/utf8proc | ||
|
||
$(builddir)/libutf8proc.a: | ||
$(MAKE) $(AM_MAKEFLAGS) -C $(srcdir)/modules/utf8proc builddir=$(shell cd $(builddir) && pwd) libutf8proc.a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using non-POSIX feature may cause portability problems. Hope FreeBSD users could test this.
|
||
else | ||
jq_LDADD += ${utf8proc_LIBS} | ||
endif | ||
endif | ||
|
||
CLEANFILES += jq.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] Put this line above the added lines. |
||
|
||
### Build oniguruma | ||
|
||
if BUILD_ONIGURUMA | ||
libjq_la_LIBADD += modules/oniguruma/src/.libs/libonig.la | ||
SUBDIRS = modules/oniguruma | ||
SUBDIRS += modules/oniguruma | ||
endif | ||
|
||
AM_CFLAGS += $(onig_CFLAGS) | ||
|
@@ -202,6 +226,7 @@ DOC_FILES = docs/content docs/public docs/templates docs/site.yml \ | |
EXTRA_DIST = $(DOC_FILES) $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) \ | ||
jq.1.prebuilt jq.spec src/lexer.c src/lexer.h src/parser.c \ | ||
src/parser.h src/version.h src/builtin.jq scripts/version \ | ||
modules/utf8proc \ | ||
libjq.pc \ | ||
tests/base64.test tests/jq-f-test.sh tests/jq.test \ | ||
tests/modules/a.jq tests/modules/b/b.jq tests/modules/c/c.jq \ | ||
|
@@ -220,7 +245,7 @@ EXTRA_DIST = $(DOC_FILES) $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) \ | |
tests/onig.test tests/base64.test tests/utf8-truncate.jq \ | ||
tests/jq-f-test.sh | ||
|
||
AM_DISTCHECK_CONFIGURE_FLAGS=--disable-maintainer-mode --with-oniguruma=builtin | ||
AM_DISTCHECK_CONFIGURE_FLAGS=--disable-maintainer-mode --with-oniguruma=builtin --with-utf8proc=builtin | ||
|
||
# README.md is expected in GitHub projects, good stuff in it, so we'll | ||
# distribute it and install it with the package in the doc directory. | ||
|
@@ -237,3 +262,6 @@ rpm: dist jq.spec | |
rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $(VERSION)" --define "myrel ${RELEASE}" rpm/SOURCES/jq-$(VERSION).tar.gz | ||
find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \; | ||
rm -rf rpm | ||
|
||
dist-hook: | ||
make -C $(distdir)/modules/utf8proc clean |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1726,6 +1726,17 @@ sections: | |
input: '"useful but not for é"' | ||
output: '"USEFUL BUT NOT FOR é"' | ||
|
||
- title: "`downcase`, `upcase`" | ||
body: | | ||
|
||
Emit a copy of the input string with its characters (unicode) converted to the | ||
specified case. | ||
|
||
example: | ||
- program: 'upcase' | ||
input: '"useful for é"' | ||
output: '"USEFUL FOR É"' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering why they did not show up in jq.1. These examples were just copied from the existing examples for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, those examples should be fixed as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those You should put examples in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there any definition of the schema that manual.yml should conform to? If so (or if not, and it's easy to create), I will run a validator on it to check for any other issues (and the validation steps would be available for future reuse as well...) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a schema for manual files in #2745, and validate both on building the manual locally and on GitHub Actions. |
||
|
||
- title: "`while(cond; update)`" | ||
body: | | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
cmake_minimum_required (VERSION 3.0.0) | ||
|
||
include (utils.cmake) | ||
|
||
disallow_intree_builds() | ||
|
||
if (POLICY CMP0048) | ||
cmake_policy (SET CMP0048 NEW) | ||
endif () | ||
project (utf8proc VERSION 2.8.0 LANGUAGES C) | ||
|
||
# This is the ABI version number, which may differ from the | ||
# API version number (defined in utf8proc.h and above). | ||
# Be sure to also update these in Makefile and MANIFEST! | ||
set(SO_MAJOR 2) | ||
set(SO_MINOR 6) | ||
set(SO_PATCH 0) | ||
|
||
option(UTF8PROC_INSTALL "Enable installation of utf8proc" On) | ||
option(UTF8PROC_ENABLE_TESTING "Enable testing of utf8proc" Off) | ||
option(LIB_FUZZING_ENGINE "Fuzzing engine to link against" Off) | ||
|
||
add_library (utf8proc | ||
utf8proc.c | ||
utf8proc.h | ||
) | ||
|
||
# expose header path, for when this is part of a larger cmake project | ||
target_include_directories(utf8proc PUBLIC .) | ||
|
||
if (BUILD_SHARED_LIBS) | ||
# Building shared library | ||
else() | ||
# Building static library | ||
target_compile_definitions(utf8proc PUBLIC "UTF8PROC_STATIC") | ||
if (MSVC) | ||
set_target_properties(utf8proc PROPERTIES OUTPUT_NAME "utf8proc_static") | ||
endif() | ||
endif() | ||
|
||
target_compile_definitions(utf8proc PRIVATE "UTF8PROC_EXPORTS") | ||
|
||
if (NOT MSVC) | ||
set_target_properties( | ||
utf8proc PROPERTIES | ||
COMPILE_FLAGS "-O2 -std=c99 -pedantic -Wall" | ||
) | ||
endif () | ||
|
||
set_target_properties (utf8proc PROPERTIES | ||
POSITION_INDEPENDENT_CODE ON | ||
VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_PATCH}" | ||
SOVERSION ${SO_MAJOR} | ||
) | ||
|
||
if (UTF8PROC_INSTALL) | ||
include(GNUInstallDirs) | ||
install(FILES utf8proc.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}") | ||
install(TARGETS utf8proc | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" | ||
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" | ||
) | ||
configure_file(libutf8proc.pc.cmakein libutf8proc.pc @ONLY) | ||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libutf8proc.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") | ||
endif() | ||
|
||
if(UTF8PROC_ENABLE_TESTING) | ||
enable_testing() | ||
file(MAKE_DIRECTORY data) | ||
set(UNICODE_VERSION 15.0.0) | ||
file(DOWNLOAD https://www.unicode.org/Public/${UNICODE_VERSION}/ucd/NormalizationTest.txt ${CMAKE_BINARY_DIR}/data/NormalizationTest.txt SHOW_PROGRESS) | ||
file(DOWNLOAD https://www.unicode.org/Public/${UNICODE_VERSION}/ucd/auxiliary/GraphemeBreakTest.txt ${CMAKE_BINARY_DIR}/data/GraphemeBreakTest.txt SHOW_PROGRESS) | ||
add_executable(case test/tests.h test/tests.c utf8proc.h test/case.c) | ||
target_link_libraries(case utf8proc) | ||
add_executable(custom test/tests.h test/tests.c utf8proc.h test/custom.c) | ||
target_link_libraries(custom utf8proc) | ||
add_executable(iterate test/tests.h test/tests.c utf8proc.h test/iterate.c) | ||
target_link_libraries(iterate utf8proc) | ||
add_executable(misc test/tests.h test/tests.c utf8proc.h test/misc.c) | ||
target_link_libraries(misc utf8proc) | ||
add_executable(printproperty test/tests.h test/tests.c utf8proc.h test/printproperty.c) | ||
target_link_libraries(printproperty utf8proc) | ||
add_executable(valid test/tests.h test/tests.c utf8proc.h test/valid.c) | ||
target_link_libraries(valid utf8proc) | ||
add_test(utf8proc.testcase case) | ||
add_test(utf8proc.testcustom custom) | ||
add_test(utf8proc.testiterate iterate) | ||
add_test(utf8proc.testmisc misc) | ||
add_test(utf8proc.testprintproperty printproperty) | ||
add_test(utf8proc.testvalid valid) | ||
|
||
if (NOT WIN32) | ||
# no wcwidth function on Windows | ||
add_executable(charwidth test/tests.h test/tests.c utf8proc.h test/charwidth.c) | ||
target_link_libraries(charwidth utf8proc) | ||
add_test(utf8proc.testcharwidth charwidth) | ||
endif() | ||
add_executable(graphemetest test/tests.h test/tests.c utf8proc.h test/graphemetest.c) | ||
target_link_libraries(graphemetest utf8proc) | ||
add_executable(normtest test/tests.h test/tests.c utf8proc.h test/normtest.c) | ||
target_link_libraries(normtest utf8proc) | ||
add_test(utf8proc.testgraphemetest graphemetest data/GraphemeBreakTest.txt) | ||
add_test(utf8proc.testnormtest normtest data/NormalizationTest.txt) | ||
|
||
if(LIB_FUZZING_ENGINE) | ||
add_executable(fuzzer utf8proc.h test/fuzzer.c) | ||
target_link_libraries(fuzzer ${LIB_FUZZING_ENGINE} utf8proc) | ||
else() | ||
add_executable(fuzzer utf8proc.h test/fuzz_main.c test/fuzzer.c) | ||
target_link_libraries(fuzzer utf8proc) | ||
endif() | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Unexpected tab spaces.