2021-02-21 06:33:55 +00:00
|
|
|
package innerring
|
|
|
|
|
2021-02-21 06:37:48 +00:00
|
|
|
import "github.com/nspcc-dev/neo-go/pkg/util"
|
|
|
|
|
2021-07-06 11:27:07 +00:00
|
|
|
type GlagoliticLetter int8
|
2021-02-21 06:33:55 +00:00
|
|
|
|
|
|
|
const (
|
2021-07-06 11:27:07 +00:00
|
|
|
_ GlagoliticLetter = iota - 1
|
2021-02-21 06:33:55 +00:00
|
|
|
|
|
|
|
az
|
|
|
|
buky
|
|
|
|
vedi
|
|
|
|
glagoli
|
|
|
|
dobro
|
|
|
|
yest
|
|
|
|
zhivete
|
|
|
|
dzelo
|
|
|
|
zemlja
|
|
|
|
izhe
|
2021-02-24 14:58:03 +00:00
|
|
|
izhei
|
2021-02-21 06:33:55 +00:00
|
|
|
gerv
|
|
|
|
kako
|
|
|
|
ljudi
|
|
|
|
mislete
|
|
|
|
nash
|
|
|
|
on
|
|
|
|
pokoj
|
|
|
|
rtsi
|
|
|
|
slovo
|
|
|
|
tverdo
|
|
|
|
uk
|
|
|
|
fert
|
|
|
|
kher
|
|
|
|
oht
|
|
|
|
shta
|
|
|
|
tsi
|
|
|
|
cherv
|
|
|
|
sha
|
|
|
|
yer
|
|
|
|
yeri
|
|
|
|
yerj
|
|
|
|
yat
|
|
|
|
jo
|
|
|
|
yu
|
|
|
|
smallYus
|
|
|
|
smallIotatedYus
|
|
|
|
bigYus
|
|
|
|
bigIotatedYus
|
|
|
|
fita
|
|
|
|
izhitsa
|
|
|
|
|
|
|
|
lastLetterNum
|
|
|
|
)
|
|
|
|
|
2022-10-17 12:03:55 +00:00
|
|
|
// String returns l in config-compatible format.
|
2023-03-20 07:01:27 +00:00
|
|
|
//
|
|
|
|
// nolint: funlen
|
2021-07-06 11:27:07 +00:00
|
|
|
func (l GlagoliticLetter) String() string {
|
2021-02-21 06:33:55 +00:00
|
|
|
switch l {
|
|
|
|
default:
|
|
|
|
return "unknown"
|
|
|
|
case az:
|
|
|
|
return "az"
|
|
|
|
case buky:
|
|
|
|
return "buky"
|
|
|
|
case vedi:
|
|
|
|
return "vedi"
|
|
|
|
case glagoli:
|
|
|
|
return "glagoli"
|
|
|
|
case dobro:
|
|
|
|
return "dobro"
|
|
|
|
case yest:
|
|
|
|
return "yest"
|
|
|
|
case zhivete:
|
|
|
|
return "zhivete"
|
|
|
|
case dzelo:
|
|
|
|
return "dzelo"
|
|
|
|
case zemlja:
|
|
|
|
return "zemlja"
|
|
|
|
case izhe:
|
|
|
|
return "izhe"
|
2021-02-24 14:58:03 +00:00
|
|
|
case izhei:
|
2021-02-21 06:33:55 +00:00
|
|
|
return "izhei"
|
|
|
|
case gerv:
|
|
|
|
return "gerv"
|
|
|
|
case kako:
|
|
|
|
return "kako"
|
|
|
|
case ljudi:
|
|
|
|
return "ljudi"
|
|
|
|
case mislete:
|
|
|
|
return "mislete"
|
|
|
|
case nash:
|
|
|
|
return "nash"
|
|
|
|
case on:
|
|
|
|
return "on"
|
|
|
|
case pokoj:
|
|
|
|
return "pokoj"
|
|
|
|
case rtsi:
|
|
|
|
return "rtsi"
|
|
|
|
case slovo:
|
|
|
|
return "slovo"
|
|
|
|
case tverdo:
|
|
|
|
return "tverdo"
|
|
|
|
case uk:
|
|
|
|
return "uk"
|
|
|
|
case fert:
|
|
|
|
return "fert"
|
|
|
|
case kher:
|
|
|
|
return "kher"
|
|
|
|
case oht:
|
|
|
|
return "oht"
|
|
|
|
case shta:
|
|
|
|
return "shta"
|
|
|
|
case tsi:
|
|
|
|
return "tsi"
|
|
|
|
case cherv:
|
|
|
|
return "cherv"
|
|
|
|
case sha:
|
|
|
|
return "sha"
|
|
|
|
case yer:
|
|
|
|
return "yer"
|
|
|
|
case yeri:
|
|
|
|
return "yeri"
|
|
|
|
case yerj:
|
|
|
|
return "yerj"
|
|
|
|
case yat:
|
|
|
|
return "yat"
|
|
|
|
case jo:
|
|
|
|
return "jo"
|
|
|
|
case yu:
|
|
|
|
return "yu"
|
|
|
|
case smallYus:
|
|
|
|
return "small.yus"
|
|
|
|
case smallIotatedYus:
|
|
|
|
return "small.iotated.yus"
|
|
|
|
case bigYus:
|
|
|
|
return "big.yus"
|
|
|
|
case bigIotatedYus:
|
|
|
|
return "big.iotated.yus"
|
|
|
|
case fita:
|
|
|
|
return "fita"
|
|
|
|
case izhitsa:
|
|
|
|
return "izhitsa"
|
|
|
|
}
|
|
|
|
}
|
2021-02-21 06:37:48 +00:00
|
|
|
|
2021-07-06 11:27:07 +00:00
|
|
|
type alphabetContracts map[GlagoliticLetter]util.Uint160
|
2021-02-21 06:37:48 +00:00
|
|
|
|
|
|
|
func newAlphabetContracts() alphabetContracts {
|
2021-07-06 11:27:07 +00:00
|
|
|
return make(map[GlagoliticLetter]util.Uint160, lastLetterNum)
|
2021-02-21 06:37:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a alphabetContracts) GetByIndex(ind int) (util.Uint160, bool) {
|
|
|
|
if ind < 0 || ind >= int(lastLetterNum) {
|
|
|
|
return util.Uint160{}, false
|
|
|
|
}
|
|
|
|
|
2021-07-06 11:27:07 +00:00
|
|
|
contract, ok := a[GlagoliticLetter(ind)]
|
2021-02-21 06:37:48 +00:00
|
|
|
|
|
|
|
return contract, ok
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a alphabetContracts) indexOutOfRange(ind int) bool {
|
|
|
|
return ind < 0 && ind >= len(a)
|
|
|
|
}
|
|
|
|
|
2021-07-06 11:27:07 +00:00
|
|
|
func (a alphabetContracts) iterate(f func(GlagoliticLetter, util.Uint160)) {
|
2021-02-21 06:37:48 +00:00
|
|
|
for letter, contract := range a {
|
|
|
|
f(letter, contract)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-06 11:27:07 +00:00
|
|
|
func (a *alphabetContracts) set(l GlagoliticLetter, h util.Uint160) {
|
2021-02-21 06:37:48 +00:00
|
|
|
(*a)[l] = h
|
|
|
|
}
|