Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-mcgann committed Feb 7, 2024
2 parents 6343f92 + 68e27ef commit 98737bf
Show file tree
Hide file tree
Showing 35 changed files with 353 additions and 1,146 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ install: gen
go install $(GOFLAGS) ./...

test: ops doc
TZ=UTC go test $(GOFLAGS) ./...
TZ=UTC go test -test.timeout=5s $(GOFLAGS) ./...

wasm:
GOOS=js GOARCH=wasm go build -o web/zc.wasm cmd/wasm/main.go
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/angle.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Degrees, minutes, seconds:
| Input | Stack
|-----------------------|-------------
| `-77.016389` | `-77.016389`
| `dm` | `-77° 0.98334`
| `dm` | `-77° 0.9833400000002257`
| `0 dmsr` | `-77° 0′ 59″`

2 changes: 2 additions & 0 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@

- [u8de](ops/text.md#utf8-decode): Decode UTF-8 bytes
- [u8en](ops/text.md#utf8-encode): Encode UTF-8 bytes
- [unesc](ops/text.md#unescape): Unescape
- [unescape](ops/text.md#unescape): Unescape
- [up](ops/stack.md#up): Rotate items upward
- [upper](ops/text.md#upper): Uppercase
- [utf8-decode](ops/text.md#utf8-decode): Decode UTF-8 bytes
Expand Down
14 changes: 7 additions & 7 deletions doc/ops/angle.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Angular calculations
Convert the DMS angle *p0* to decimal degrees.

```
( p0:DMS -- Decimal )
( p0:DMS -- Float )
```

Example:
Expand All @@ -51,7 +51,7 @@ Example:

| Input | Stack
|--------------|---------------
| `10.1234 dm` | `10° 7.404`
| `10.1234 dm` | `10° 7.404000000000011`

## deg-min-round

Expand All @@ -61,7 +61,7 @@ Reformat the angle *p0* to degrees and minutes and round the minutes to
Alias: `dmr`

```
( p0:DMS n:Int32 -- DMS )
( p0:DMS n:Int -- DMS )
```

Example:
Expand All @@ -88,7 +88,7 @@ Example:

| Input | Stack
|------------------|---------------
| `-76.856944 dms` | `-76° 51′ 24.9984`
| `-76.856944 dms` | `-76° 51′ 24.998399999994945`

## deg-min-sec-round

Expand All @@ -98,7 +98,7 @@ seconds to *n* places.
Alias: `dmsr`

```
( p0:DMS n:Int32 -- DMS )
( p0:DMS n:Int -- DMS )
```

Example:
Expand Down Expand Up @@ -150,7 +150,7 @@ Example:
Converts the angle *p0* to minutes.

```
( p0:DMS -- Decimal )
( p0:DMS -- Float )
```

Example:
Expand Down Expand Up @@ -182,7 +182,7 @@ Example:
Converts the angle *p0* to seconds.

```
( p0:DMS -- Decimal )
( p0:DMS -- Float )
```

Example:
Expand Down
12 changes: 7 additions & 5 deletions doc/ops/geo.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ Example:

<!-- test: haversine -->

| Input | Stack
|-------------------------|---------------
| `51.510357 -0.116773 ` | `51.510357 \| -0.116773`
| `38.889931 -77.009003 ` | `51.510357 \| -0.116773 \| 38.889931 \| -77.009003`
| `haversine dec 3 round` | `5897658.289`
| Input | Stack
|-----------------------------------|---------------
| `38°54′17″N 77°00′59″W ` | `38°54′17″N \| 77°00′59″W`
| `40°42′46″N 74°00′22″W ` | `38°54′17″N \| 77°00′59″W \| 40°42′46″N \| 74°00′22″W`
| `haversine 2 round ` | `326364.76 # m`
| `m-km 2 round ` | `326.36 # km`
| `km-mi 2 round ` | `202.79 # mi`

## proj

Expand Down
27 changes: 27 additions & 0 deletions doc/ops/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Text operations
| [`right`](#right) | Right substring
| [`split`](#split) | Split string
| [`tone`](#tone) | Apply a skin tone to an emoji
| [`unescape, unesc`](#unescape) | Unescape
| [`upper`](#upper) | Uppercase
| [`utf8-decode, u8de`](#utf8-decode) | Decode UTF-8 bytes
| [`utf8-encode, u8en`](#utf8-encode) | Encode UTF-8 bytes
Expand Down Expand Up @@ -194,6 +195,32 @@ Example:
| `:waving-hand:` | `👋`
| `2 tone ` | `👋🏽`

## unescape

Unescapes characters in a string value that are prefixed by a backslash. The
escape sequences as defined for Go strings are used. A value such as
`\n` is converted to a new line. Values such as `\x7f`, `\u007f`, '\U0000007f`,
and `\077` are converted to the characters of that code point.

Alias: `unesc`

```
( p0:Str -- Str )
```

Example:

<!-- test: unescape -->

| Input | Stack
|--------------------------------------------|---------------
| `"\u65e5\u672c\u8a9e" ` | `\u65e5\u672c\u8a9e`
| `unescape ` | `日本語`
| `c "\U000065e5\U0000672c\U00008a9e" ` | `\U000065e5\U0000672c\U00008a9e`
| `unescape ` | `日本語`
| `c "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"` | `\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e`
| `unescape ` | `日本語`

## upper

Convert string *p0* to uppercase.
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module github.com/blackchip-org/zc/v5
go 1.21

require (
github.com/blackchip-org/dms v0.0.0-20240206010456-abead6bdc48f
github.com/blackchip-org/scan v0.1.0
github.com/peterh/liner v1.2.2
github.com/shopspring/decimal v1.3.1
github.com/twpayne/go-proj/v10 v10.1.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
github.com/blackchip-org/dms v0.0.0-20240206010456-abead6bdc48f h1:RaBc0/hHgaGrPWiCf9vk8Q7M8FfJcj2Pk9JHH8zTus8=
github.com/blackchip-org/dms v0.0.0-20240206010456-abead6bdc48f/go.mod h1:82Ee0ylgD+HbGDD23AqbuOCIdTlbBcYPNXNCqO5ha1s=
github.com/blackchip-org/scan v0.1.0 h1:hAFDKoENP7yNha7gchwqiACjJftVRSP59gVXgDwEeBY=
github.com/blackchip-org/scan v0.1.0/go.mod h1:eS9QMEdU0CgTZ3uyvO50h1NBet3JwXEGTCWr4e6sJ3w=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4=
Expand Down
3 changes: 1 addition & 2 deletions internal/gen-index/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"unicode/utf8"

"github.com/blackchip-org/zc/v5/pkg/doc"
"github.com/blackchip-org/zc/v5/pkg/scanner"
)

const (
Expand Down Expand Up @@ -79,7 +78,7 @@ func main() {
for _, q := range names {
name := q.String()
heading, _ := utf8.DecodeRuneInString(q.name)
if scanner.IsCharAZ(heading) && heading != thisHeading {
if ((heading >= 'a' && heading <= 'z') || (heading >= 'A' && heading <= 'Z')) && heading != thisHeading {
fmt.Fprintf(out, "\n## %v\n\n", string(heading))
thisHeading = heading
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/calc/ops_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 98737bf

Please sign in to comment.