Skip to content

Commit

Permalink
Merge pull request #436 from gfngfn/dev-how-to-load-files-in-packages
Browse files Browse the repository at this point in the history
Develop how to load files in packages and use it for handling hyphenation dictionaries
  • Loading branch information
gfngfn authored Mar 26, 2024
2 parents c851c55 + e64eb99 commit 891ac43
Show file tree
Hide file tree
Showing 51 changed files with 963 additions and 521 deletions.
8 changes: 8 additions & 0 deletions check-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
SAPHE="${1:-saphe}"

FAILED=0
FIRST=1
for FILE in $(find lib-satysfi -name saphe.yaml); do
DIR="$(dirname "$FILE")"
if [ $FIRST -eq 1 ]; then
echo "UPDATING..."
"$SAPHE" update "$DIR"
FIRST=0
echo "UPDATED."
fi
echo " ==== $DIR ===="
"$SAPHE" solve "$DIR"
if [ $? -ne 0 ]; then
Expand All @@ -30,5 +37,6 @@ for FILE in $(find lib-satysfi -name saphe.yaml); do
fi
done
if [ $FAILED -ne 0 ]; then
echo "! some test has failed."
exit 1
fi
2 changes: 1 addition & 1 deletion default-registry-commit-hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fd0685fc3be78942759bbf95ff66b0d037a79f6e refs/heads/temp-dev-saphe
ce6060ddaf44efc0f6a9ac6609450e855b7afa0c refs/heads/temp-dev-saphe
9 changes: 9 additions & 0 deletions demo/demo.saphe.lock.yaml.expected
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ locks:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: footnote-scheme
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
dependencies: []
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: hyph-english
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.itemize.0.0.1
dependencies:
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down Expand Up @@ -104,6 +111,8 @@ locks:
used_as: FontIpaEx
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.font-latin-modern-math.0.0.1
used_as: FontLatinModernMath
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
used_as: HyphEnglish
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
Expand Down
9 changes: 9 additions & 0 deletions doc/doc-lang.saphe.lock.yaml.expected
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ locks:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: font-latin-modern-math
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
dependencies: []
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: hyph-english
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.itemize.0.0.1
dependencies:
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down Expand Up @@ -84,6 +91,8 @@ locks:
used_as: FontIpaEx
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.font-latin-modern-math.0.0.1
used_as: FontLatinModernMath
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
used_as: HyphEnglish
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
Expand Down
9 changes: 9 additions & 0 deletions doc/doc-primitives.saphe.lock.yaml.expected
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ locks:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: footnote-scheme
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
dependencies: []
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: hyph-english
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.itemize.0.0.1
dependencies:
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down Expand Up @@ -95,6 +102,8 @@ locks:
used_as: FontIpaEx
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.font-latin-modern-math.0.0.1
used_as: FontLatinModernMath
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
used_as: HyphEnglish
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
Expand Down
9 changes: 9 additions & 0 deletions doc/math1.saphe.lock.yaml.expected
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ locks:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: font-latin-modern-math
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
dependencies: []
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: hyph-english
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.math.0.0.1
dependencies:
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down Expand Up @@ -84,6 +91,8 @@ locks:
used_as: FontIpaEx
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.font-latin-modern-math.0.0.1
used_as: FontLatinModernMath
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
used_as: HyphEnglish
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
Expand Down
4 changes: 2 additions & 2 deletions install-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ INSTALL=${2:-install}
"${INSTALL}" -d "${LIBDIR}"
"${INSTALL}" -d "${LIBDIR}/unidata"
"${INSTALL}" -m 644 lib-satysfi/unidata/*.txt "${LIBDIR}/unidata"
"${INSTALL}" -d "${LIBDIR}/hyph"
"${INSTALL}" -m 644 lib-satysfi/hyph/* "${LIBDIR}/hyph"

# It is no longer necessary to install packages beforehand due to the package system:
#
# "${INSTALL}" -d "${LIBDIR}/hyph"
# "${INSTALL}" -m 644 lib-satysfi/hyph/* "${LIBDIR}/hyph"
# "${INSTALL}" -d "${LIBDIR}/packages"
# (cd lib-satysfi && find packages -type f -exec "${INSTALL}" -Dm 644 "{}" "${LIBDIR}/{}" \;)
# "${INSTALL}" -d "${LIBDIR}/registries"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
saphe: ^0.0.1
locks: []
dependencies: []
test_dependencies: []
11 changes: 11 additions & 0 deletions lib-satysfi/packages/hyph-english/hyph-english.0.0.1/saphe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
saphe: "^0.0.1"
satysfi: "^0.1.0"
name: "hyph-english"
authors:
- "Takashi Suwa <@gfngfn>"
contents:
library:
main_module: "HyphEnglish"
source_directories:
- "./src"
dependencies: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
library:
main_module: HyphEnglish
source_directories:
- ./src
test_directories: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module HyphEnglish :> sig
val hyphenation : hyphenation
end = struct
val hyphenation =
load-hyphenation-dictionary
(here ^ `/../hyph/english.satysfi-hyph`)
end
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ locks:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: footnote-scheme
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
dependencies: []
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: hyph-english
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.itemize.0.0.1
dependencies:
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down Expand Up @@ -97,6 +104,8 @@ dependencies:
used_as: FontLatinModernMath
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.footnote-scheme.0.0.1
used_as: FootnoteScheme
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
used_as: HyphEnglish
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.itemize.0.0.1
used_as: Itemize
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.math.0.0.1
Expand Down
5 changes: 5 additions & 0 deletions lib-satysfi/packages/md-ja/md-ja.0.0.1/saphe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ dependencies:
registry: "default"
name: "font-latin-modern-math"
requirement: "^0.0.1"
- used_as: "HyphEnglish"
registered:
registry: "default"
name: "hyph-english"
requirement: "^0.0.1"
3 changes: 3 additions & 0 deletions lib-satysfi/packages/md-ja/md-ja.0.0.1/src/md-ja.satyh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use package Code
use package Itemize
use package Annot

use package HyphEnglish

use package FontJunicode
use package FontIpaEx
use package FontLatinModern
Expand Down Expand Up @@ -88,6 +90,7 @@ end = struct

val initial-context =
get-initial-context text-width (command \Math.math)
|> set-hyphenation-dictionary HyphEnglish.hyphenation
|> set-dominant-narrow-script Latin
|> set-dominant-wide-script Kana
|> set-latin-font font-latin-roman
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ locks:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: footnote-scheme
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
dependencies: []
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: hyph-english
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.math.0.0.1
dependencies:
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down Expand Up @@ -88,6 +95,8 @@ dependencies:
used_as: FontLatinModernMath
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.footnote-scheme.0.0.1
used_as: FootnoteScheme
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
used_as: HyphEnglish
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.math.0.0.1
used_as: Math
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down
5 changes: 5 additions & 0 deletions lib-satysfi/packages/std-ja-book/std-ja-book.0.0.1/saphe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ dependencies:
registry: "default"
name: "font-latin-modern-math"
requirement: "^0.0.1"
- used_as: "HyphEnglish"
registered:
registry: "default"
name: "hyph-english"
requirement: "^0.0.1"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use package Annot
use package Code
use package FootnoteScheme

use package HyphEnglish

use package FontJunicode
use package FontIpaEx
use package FontLatinModern
Expand Down Expand Up @@ -132,6 +134,7 @@ end = struct
val get-standard-context wid =
get-initial-context wid (command \Math.math)
|> set-code-text-command (command \Code.code)
|> set-hyphenation-dictionary HyphEnglish.hyphenation
|> set-dominant-wide-script Kana
|> set-language Kana Japanese
|> set-language HanIdeographic Japanese
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ locks:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: footnote-scheme
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
dependencies: []
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: hyph-english
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.math.0.0.1
dependencies:
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down Expand Up @@ -88,6 +95,8 @@ dependencies:
used_as: FontLatinModernMath
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.footnote-scheme.0.0.1
used_as: FootnoteScheme
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
used_as: HyphEnglish
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.math.0.0.1
used_as: Math
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@ dependencies:
registry: "default"
name: "font-latin-modern-math"
requirement: "^0.0.1"
- used_as: "HyphEnglish"
registered:
registry: "default"
name: "hyph-english"
requirement: "^0.0.1"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use package Code
use package Annot
use package FootnoteScheme

use package HyphEnglish

use package FontJunicode
use package FontIpaEx
use package FontLatinModern
Expand Down Expand Up @@ -130,6 +132,7 @@ end = struct
val get-standard-context wid =
get-initial-context wid (command \Math.math)
|> set-code-text-command (command \Code.code)
|> set-hyphenation-dictionary HyphEnglish.hyphenation
|> set-dominant-wide-script Kana
|> set-language Kana Japanese
|> set-language HanIdeographic Japanese
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ locks:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: font-latin-modern-math
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
dependencies: []
test_only: false
registered:
registry_hash_value: 6f2b80e9bb7c4e8af2104999fc25dbb3
package_name: hyph-english
version: 0.0.1
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.math.0.0.1
dependencies:
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down Expand Up @@ -77,6 +84,8 @@ dependencies:
used_as: FontLatinModern
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.font-latin-modern-math.0.0.1
used_as: FontLatinModernMath
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.hyph-english.0.0.1
used_as: HyphEnglish
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.math.0.0.1
used_as: Math
- name: registered.6f2b80e9bb7c4e8af2104999fc25dbb3.stdlib.0.0.1
Expand Down
5 changes: 5 additions & 0 deletions lib-satysfi/packages/std-ja/std-ja.0.0.1/saphe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ dependencies:
registry: "default"
name: "font-latin-modern-math"
requirement: "^0.0.1"
- used_as: "HyphEnglish"
registered:
registry: "default"
name: "hyph-english"
requirement: "^0.0.1"
3 changes: 3 additions & 0 deletions lib-satysfi/packages/std-ja/std-ja.0.0.1/src/std-ja.satyh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use package Math
use package Code
use package Annot

use package HyphEnglish

use package FontJunicode
use package FontIpaEx
use package FontLatinModern
Expand Down Expand Up @@ -113,6 +115,7 @@ end = struct
val get-standard-context wid =
get-initial-context wid (command \Math.math)
|> set-code-text-command (command \Code.code)
|> set-hyphenation-dictionary HyphEnglish.hyphenation
|> set-dominant-wide-script Kana
|> set-language Kana Japanese
|> set-language HanIdeographic Japanese
Expand Down
1 change: 1 addition & 0 deletions src/frontend/display.ml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ let show_base_type = function
| RegExpType -> "regexp"
| TextInfoType -> "text-info"
| InputPosType -> "input-position"
| HyphenationType -> "hyphenation"


type paren_level =
Expand Down
5 changes: 5 additions & 0 deletions src/frontend/evalUtil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,11 @@ let get_prepath (value : syntactic_value) : PrePath.t =
| _ -> report_bug_value "get_prepath" value


let get_hyphenation : syntactic_value -> LoadHyph.t = function
| BaseConstant(BCHyphenation(hyph)) -> hyph
| value -> report_bug_value "get_hyphenation" value


let get_outline (value : syntactic_value) =
match value with
| Tuple([
Expand Down
Loading

0 comments on commit 891ac43

Please sign in to comment.