func (x *Imp) Defined(s string) bool { // n, i, p := uint(len(s)), uint(0), uint(0) if str.Contains(s, separator, &i) && i < n && nat.Defined(&p, str.Part(s, i+1, n-(i+1))) { return x.Defined2(str.Part(s, 0, i), p) } return false }
func names(mask, suffix string, n uint, l, c uint, f, b col.Colour) (string, string) { // t, t1 := uint(len(mask)), uint(0) if t > 0 { t1 = 1 + t } scr.Save(l, c, t1+n, 1) if t > 0 { mbx.Wd(t) mbx.ColoursScreen() mbx.Write(mask, l, c) } bx.Wd(n) bx.Colours(f, b) ptSuffix = "." + suffix errh.Hint("falls Dateien vorhanden, auswählen F2-, dann Pfeil-/Eingabetaste, ggf. Esc") name := env.Par(1) if name == "" { name = str.Clr(n) // Wörkeraunt um Fehler in box/imp.go } var p uint if str.Contains(name, '.', &p) { name = str.Part(name, 0, p) } bx.Edit(&name, l, c+t1) str.RemSpaces(&name) if str.Contains(name, '.', &p) { name = str.Part(name, 0, p) } filename := name + ptSuffix a := files.NumPred(hasSuffix) if a > 0 { var d uint switch kbd.LastCommand(&d) { case kbd.Esc: return "", "" // str.Clr (n), "" case kbd.Enter: // entered case kbd.LookFor: i := uint(0) select_(aus, a, a, n, &i, l, c+t1, b, f) if i == a { return "", "" // str.Clr (n), "" } else { str.Set(&filename, files.NamePred(hasSuffix, i)) } } } errh.DelHint() str.RemSpaces(&filename) if str.Contains(filename, '.', &p) { name = str.Part(filename, 0, p) } scr.Restore(l, c, t1+n, 1) return name, filename }
func (x *Imp) Defined(t string) bool { // x.Clr() if str.Empty(t) { return true } n, ss, P, L := nat.DigitSequences(t) if n == 0 || n > 3 { return false } if n == 3 { if x.fmt == Hh_mm { return false } } if L[0] >= textlength[x.fmt] { return false } h, m, s := uint(0), uint(0), uint(0) if n == 1 { if !nat.Defined(&h, str.Part(t, P[0], 2)) { return false } if L[0] > 2 { if !nat.Defined(&m, str.Part(t, P[0]+2, 2)) { return false } if L[0] > 4 { if !nat.Defined(&s, str.Part(t, P[0]+4, 2)) { return false } } } } else { if !nat.Defined(&h, ss[0]) { return false } if !nat.Defined(&m, ss[1]) { return false } if n == 2 && x.fmt == Mm_ss { s, m, h = m, h, 0 } if n == 3 { if !nat.Defined(&s, ss[2]) { return false } } } return x.defined(h, m, s) }
func defined(z *int, s string) bool { // str.Move(&s, true) negative := s[0] == '-' var n uint if negative { n = uint(len(s)) s = str.Part(s, 1, n-1) } if str.Empty(s) { return false } if nat.Defined(&n, s) { if negative { if n < m2 { *z = -int(n) return true } else if n == m2 { *z = MinInt return true } } else if n <= MaxInt { *z = int(n) return true } } return false }
func (x *Imp) Defined(s string) bool { // x.Clr() n := uint(len(s)) if n < 7 { return false } if s[0] != '(' || s[n-1] != ')' { return false } t := str.Part(s, 1, n-2) + "," var p uint for d := D0; d < NDirs; d++ { if !str.Contains(t, ',', &p) { return false } r, err := strconv.ParseFloat(t[:p], 64) if err == nil { x.x[d] = r } else { return false } str.Rem(&t, 0, p+1) } return true }
func aus(n, l, c uint, f, b col.Colour) { // N := files.NamePred(hasSuffix, n) var p uint if str.IsPart(ptSuffix, N, &p) { N = str.Part(N, 0, p) } bx.Colours(f, b) bx.Write(N, l, c) }
func (x *Imp) SetReal(r float64) { // i, _ := math.Modf(r + 0.5) s := strconv.FormatFloat(i, 'f', -1, 64) p := uint(0) if str.Contains(s, '.', &p) { s = str.Part(s, 0, p) } if _, ok := x.n.SetString(s, 10); !ok { x.n.SetInt64(0) } }
func (x *Imp) Defined(s string) bool { // x.Clr() if str.Empty(s) { return true } str.Move(&s, true) x.geq0 = s[0] != '-' switch s[0] { case '+', '-': str.Rem(&s, 0, 1) } n := str.ProperLen(s) var p uint if str.Contains(s, '/', &p) { s1 := str.Part(s, p+1, n-p-1) if nat.Defined(&x.denom, s1) { if x.denom >= max { return false } } else { return false } } else { p = n x.denom = 1 } s1 := str.Part(s, 0, p) if nat.Defined(&x.num, s1) { if x.num >= max { return false } } else { return false } return true }
func isMonth(Monat *uint, Wort string) bool { // var T string n := str.ProperLen(Wort) if n > 0 { for m := uint(1); m <= maxmonth; m++ { T = str.Part(nameMonth[m], 0, n) if Wort == T { // str.QuasiEq (Wort, T) { *Monat = uint(m) return true } } } return false }
func (x *Imp) String() string { // if x.year == emptyYear { return str.Clr(length[x.fmt]) } const mitNullen = true s := "" switch x.fmt { case Dd, Dd_mm_, Dd_mm_yy, Dd_mm_yyyy, Dd_M, Dd_M_yyyy: if x.day == 0 { Panic("day.String: x.day == 0") } s = nat.StringFmt(x.day, 2, mitNullen) if x.fmt == Dd { return s } s += "." switch x.fmt { case Dd_M, Dd_M_yyyy: s += " " + nameMonth[x.month] str.RemSpaces(&s) if x.fmt == Dd_M { return s } s += " " default: s += nat.StringFmt(x.month, 2, mitNullen) + "." } switch x.fmt { case Dd_mm_: case Dd_mm_yy: s += nat.StringFmt(x.year, 2, true) default: // Dd_mm_yyyy, Dd_M_yyyy: s += nat.StringFmt(x.year, 4, false) } case Yymmdd: s = nat.StringFmt(x.year%100, 2, true) + nat.StringFmt(x.month, 2, true) + nat.StringFmt(x.day, 2, true) case Yyyymmdd: s = nat.StringFmt(x.year, 4, true) + nat.StringFmt(x.month, 2, true) + nat.StringFmt(x.day, 2, true) case Yy: s = nat.StringFmt(x.year, 2, true) case Yyyy: s = nat.StringFmt(x.year, 4, false) case Wd: s = WdShorttext[x.Weekday(Daily)] case WD: s = WdText[x.Weekday(Daily)] case Mmm, M: s = nameMonth[x.month] if x.fmt == Mmm { s = str.Part(s, 0, 3) } case Myyyy: s = nameMonth[x.month] + " " + nat.StringFmt(x.year, 4, false) case Wn, WN, WNyyyy: s = nat.StringFmt(x.Weeknumber(), 2, false) if x.fmt > Wn { s += ".Woche" } if x.fmt == WNyyyy { s += " " + nat.StringFmt(x.year, 4, false) } case Qu: switch (x.month - 1) / 3 { case 0: s = " I" case 1: s = " II" case 2: s = "III" case 3: s = " IV" } s += "/" + nat.StringFmt(x.year, 2, true) } return s }
func (x *Imp) Defined(s string) bool { // if str.Empty(s) { x.Clr() return true } var d Imp d.day, d.month, d.year = x.day, x.month, x.year var T string var l, p uint n, ss, P, L := nat.DigitSequences(s) switch x.fmt { case Dd, // e.g. " 8" Dd_mm_, // e.g. " 8.10." Dd_mm_yy, // e.g. " 8.10.07" Dd_mm_yyyy: // e.g. " 8.10.2007" *): switch n { case 1: l = 2 case 2, 3: l = L[0] default: return false } // see below case Dd_M, // e.g. "8. Oktober" Dd_M_yyyy: // e.g. "8. Oktober 2007" if x.fmt == Dd_M { if n != 1 { return false } } else { if n != 2 { return false } } if !str.Contains(s, '.', &p) { return false } if x.fmt == Dd_M_yyyy { // l = str.ProperLen (s) // T = str.Part (s, p, l - p) T = ss[1] if !nat.Defined(&d.year, T) { return false } } T = ss[0] str.Move(&T, true) if !nat.Defined(&d.day, T) { return false } T = str.Part(s, p+1, P[1]-p-1) str.Move(&T, true) if !isMonth(&d.month, T) { return false } return x.defined(d.day, d.month, d.year) case Yymmdd: // e.g. "090418" if !nat.Defined(&d.year, str.Part(s, 0, 2)) { return false } if !nat.Defined(&d.month, str.Part(s, 2, 2)) { return false } if !nat.Defined(&d.day, str.Part(s, 4, 2)) { return false } return x.defined(d.day, d.month, d.year) case Yyyymmdd: // e.g. "20090418" if !nat.Defined(&d.year, str.Part(s, 0, 4)) { return false } if !nat.Defined(&d.month, str.Part(s, 4, 2)) { return false } if !nat.Defined(&d.day, str.Part(s, 6, 2)) { return false } return x.defined(d.day, d.month, d.year) case Yy, // e.g. "08" Yyyy: // e.g. "2007" if n != 1 { return false } if nat.Defined(&d.year, ss[0]) { return x.defined(d.day, d.month, d.year) } else { return false } case Wd, // e.g. "Mo" WD: // e.g. "Monday" return false // Fall noch nicht erledigt case Mmm, // e.g. "Mon" M: // e.g. "Oktober" if !isMonth(&d.month, s) { return false } return x.defined(d.day, d.month, d.year) case Myyyy: // e.g. "Oktober 2007" if n != 1 { return false } if !nat.Defined(&d.year, ss[0]) { return false } if !str.Contains(s, ' ', &p) { return false } if !isMonth(&d.month, str.Part(s, 0, p)) { return false } return x.defined(d.day, d.month, d.year) case Wn, // e.g. "1" (.Woche) WN: // e.g. "1.Woche" if n != 1 { return false } if nat.Defined(&n, T) { if 0 < n && n <= 3 { d.day, d.month, d.year = 1, 1, x.year c := internalCode(d) w := weekday(d) if w > Thursday { c += 7 } // see Weeknumber if c < uint16(w) { return false } c -= uint16(w) // so c is a Monday d.Decode(Encode(uint(c) + 7*n)) if d.year == x.year { x.day = d.day x.month = d.month return true } } return false } case WNyyyy: // e.g. "1.Woche 2007" return false // not yet implemented case Qu: // e.g. " I/06" if n != 1 { return false } if !str.Contains(s, '/', &p) { return false } if !nat.Defined(&d.year, ss[0]) { return false } T = str.Part(s, 0, p) str.Move(&T, true) n = str.ProperLen(T) if T[0] != 'I' { return false } switch n { case 1: d.month = 1 case 2: switch T[1] { case 'I': d.month = 4 case 'V': d.month = 10 default: return false } case 3: if T[1] == 'I' && T[2] == 'I' { d.month = 7 } default: return false } return x.defined(d.day, d.month, d.year) } if !nat.Defined(&d.day, str.Part(s, P[0], l)) { return false } if n == 1 { if L[0] > 8 { return false } // maximal "Dd_mm_yyyy" if L[0] > 2 { if !nat.Defined(&d.month, str.Part(s, P[0]+2, 2)) { return false } } if L[0] > 4 { if !nat.Defined(&d.year, str.Part(s, P[0]+4, L[0]-4)) { return false } } } else { // n == 2, 3 if !nat.Defined(&d.month, ss[1]) { return false } if n == 2 && x.Empty() { d.year = today.(*Imp).year } if n == 3 { if !nat.Defined(&d.year, ss[2]) { return false } } } return x.defined(d.day, d.month, d.year) }
func init() { // l[Title] = []string{"", "Dr.", "Dr.med.", "Dr.med.dent.", "Dr.rer.nat.", "Dr.phil.", "Dr.iur.", "Dr.med.vet.", "Dr.rer.pol.", "Dr.-Ing.", "Prof.Dr.", "Prof.Dr.med.", "Prof.Dr.-Ing."} s[Title] = l[Title] l[Composer] = []string{"", "Monteverdi, Claudio (1567-1643)", "Frescobaldi, Girolamo (1583-1643)", "Schütz, Heinrich (1585-1672)", "Lully, Jean Baptiste (1632-1687)", "Buxtehude, Dietrich (1637-1707)", "Corelli, Arcangelo (1653-1713)", "Purcell, Henry (1659-1695)", "Scarlatti, Alessandro (1659-1725)", "Couperin, Francois (1668-1733)", "Caldara, Antonio (1670-1736)", "Albinoni, Tomaso (1671-1751)", "Vivaldi, Antonio (1680-1743)", "Telemann, Georg Philipp (1681-1767)", "Rameau, Jean-Philippe (1683-1764) ", "Bach, Johann Sebastian (1685-1750) ", "Händel, Georg Friedrich (1685-1759)", "Pergolesi, Giovanni Battista (1710-1736)", "Gluck, Christoph Willibald (1714-1787)", "Bach, Philip Emanuel (1714-1788)", // 19, see 15 "Haydn, Joseph (1732-1809)", "Boccherini, Luigi (1743-1805)", "Mozart, Wolfgang Amadeus (1756-1791)", "Cherubini, Luigi (1760-1842)", "Beethoven, Ludwig van (1770-1827)", "Spohr, Ludwig (1774-1859)", "Paganini, Niccolo (1782-1840)", "Weber, Carl Maria von (1786-1826)", "Rossini, Gioacchino (1792-1868)", "Schubert, Franz (1797-1828)", "Lortzing, Albert (1801-1851)", "Berlioz, Hector (1803-1869)", "Glinka, Michael (1804-1857)", "Mendelssohn-Bartholdy, Felix (1809-1874)", "Schumann, Robert (1810-1856)", "Chopin, Frederic (1810-1849)", "Liszt, Franz (1811-1886)", "Wagner, Richard (1813-1883)", "Verdi, Giuseppe (1813-1901)", "Franck, Cesar (1822-1890)", "Lalo, Edouard (1823-1892)", "Smetana, Friedrich (1824-1884)", "Bruckner, Anton (1824-1896)", "Strauss, Johann (1825-1899)", "Brahms, Johannes (1833-1897)", "Borodin, Alexander (1834-1887)", "Saint-Saens, Camille (1835-1921)", "Bizet, Georges (1836-1875)", "Mussorgski, Modest (1839-1881)", "Tschaikowskij, Peter (1840-1893)", "Dvorak, Antonin (1841-1904)", "Grieg, Edward (1843-1907)", "Rimskij-Korssakow, Nikolai (1844-1908)", "Janacek, Leos (1854-1928)", "Mahler, Gustav (1860-1911)", "Debussy, Claude (1862-1918)", "Strauß, Richard (1864-1949)", "Sibelius, Jean (1865-1957)", "Pfitzner, Hans (1869-1949)", "Scriabin, Alexander (1872-1915)", "Reger, Max (1873-1916)", "Rachmaninow, Sergej (1873-1947)", "Schönberg, Arnold (1874-1951)", "Ravel, Maurice (1875-1937)", "Falla, Manuel de (1876-1946)", "Bartok, Bela (1881-1945)", "Strawinsky, Igor (1882-1971)", "Webern, Anton von (1883-1945)", "Berg, Alban (1885-1935)", "Furtwängler, Wilhelm (1886-1954)", "Prokofieff, Serge (1891-1953)", "Honegger, Arthur (1892-1955)", "Hindemith, Paul (1895-1963)", "Orff, Carl (1895-1982)", "Blacher, Boris (1903-1975)", "Chatschaturian, Aram (1903-1978)", "Schostakowitsch, Dimitri (1906-1975)", "Fortner, Wolfgang (1907-1987)", "Britten, Benjamin (1913-1976)", "Boulez, Pierre (1925-)", "Henze, Hans Werner (1926-2012)"} n := uint(len(l[Composer])) s[Composer] = make([]string, n) s[Composer][0] = "" for i := uint(1); i < n; i++ { s[Composer][i] = str.Part(l[Composer][i], 0, str.Pos(l[Composer][i], ',')) } s[Composer][19] = "Bach, Ph.E." l[RecordLabel] = []string{"", "2001", "Angel", "BMG", "CBS", "Decca", "Denon", "Deutsche Grammophon", "EMI", "Erato", "Harmonia mundi", "Melodia", "Philips", "Polygram", "Sony", "Supraphon", "Teldec", "UMG", "Warner", "Zyx"} s[RecordLabel] = l[RecordLabel] l[AudioMedium] = []string{"", "Single Play record", "Long Play record", "Composeract disk", "Digital versatile disc", "Super Audio CD", "Blu-ray disc"} s[AudioMedium] = []string{"", "SP", "LP", "CD", "DVD", "SACD", "BD"} l[SparsCode] = []string{"AAA", "AAD", "ADD", "DAD", "DDD"} s[SparsCode] = l[SparsCode] l[Religion] = []string{"keine", "evangelisch", "katholisch", "jüdisch", "muslimisch", "hinduistisch", "buddhistisch", "andere"} s[Religion] = l[Religion] l[Subject] = []string{"keinFach", "Deutsch", "Englisch", "Französisch", "Italienisch", "Spanisch", "Polnisch", "Russisch", "Türkisch", "Japanisch", "Chinesisch", "Latein", "Griechisch", "Musik", "BildendeKunst", "DarstellendesSpiel", "Politikwissenschaft", "Geschichte", "Geografie", "Sozialwissenschaften", "Psychologie", "Philosophie", "Recht", "Wirtschaftswissenschaft", "Pädagogik", "RechnungswesenUndControlling", "Wirtschaft", "Mathematik", "Physik", "Chemie", "Biologie", "Informatik", "Physiktechnik", "Physiklabortechnik", "Elektrotechnik", "RegenerativeEnergietechnik", "Bautechnik", "Mechatronik", "Metalltechnik_Maschinenbau", "Chemietechnik", "Chemielabortechnik", "Biologietechnik", "Biologielabortechnik", "Biotechnologie", "AgrartechnikMitBiologie", "Gesundheit", "Ernährung", "Medizintechnik", "Umwelttechnik", "Wirtschaftsinformatik", "TechnischeInformatik", "Medizininformatik", "Informationstechnik", "Medientechnik", "GestaltungsMedientechnik", "Gestaltung", "Sport"} s[Subject] = []string{" ", "de", "e ", "f ", "i ", "s ", "p ", "r ", "t ", "j ", "c ", "l ", "g ", "mu", "ku", "ds", "pw", "ge", "gg", "sw", "ps", "ph", "re", "ww", "pa", "rc", "wi", "ma", "ph", "ch", "bi", "in", "pt", "pt", "et", "rt", "bt", "me", "mm", "ct", "c", "bt", "bt", "bt", "ab", "gs", "er", "me", "ut", "wi", "ti", "mi", "it", "mt", "gm", "gt", "sp"} l[LexicalCategory] = []string{"", "Substantiv", "Adjektiv", "Pronomen", "Numerale", "Verb", "Adverb", "Präposition", "Konjunktion", "Interjektion"} s[LexicalCategory] = []string{"", "Subst.", "Adj.", "Pron.", "Num.", "Verb", "Adv.", "Präp.", "Konj.", "Interj."} l[Casus] = []string{"", "Nominativ", "Genitiv", "Dativ", "Akkusativ", "Ablativ"} s[Casus] = []string{"", "Nom.", "Gen.", "Dat.", "Akk.", "Abl."} l[Genus] = []string{"", "masc.", "fem.", "neut."} // "maskulinum", "femininum", "neutrum" } s[Genus] = []string{"", "m.", "f.", "n."} l[Persona] = []string{"", "1.", "2.", "3."} s[Persona] = l[Persona] l[Numerus] = []string{"", "Sing.", "Plur."} // "Singular", "Plural" } s[Numerus] = []string{"", "Sg.", "Pl."} l[Tempus] = []string{"", "Präsens", "Imperfekt", "FuturI", "Perfekt", "Plusquamp.", "FuturII"} s[Tempus] = []string{"", "Präs.", "Impf.", "Fut.I", "Perf.", "Plusq.", "Fut.II"} l[Modus] = []string{"", "Indikativ", "Konjunktiv"} s[Modus] = []string{"", "Ind.", "Konj."} l[GenusVerbi] = []string{"", "Aktiv", "Passiv"} s[GenusVerbi] = []string{"", "Akt.", "Pass."} }