diff --git a/.gitattributes b/.gitattributes index c7d9f3332a950355d5a77d85000f05e6f45435ea..51f24d89cb47a3c6eda9b97701236097db94d603 100644 --- a/.gitattributes +++ b/.gitattributes @@ -32,3 +32,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +lilypond-2.24.2/bin/libgio-2.0-0.dll filter=lfs diff=lfs merge=lfs -text +lilypond-2.24.2/bin/libglib-2.0-0.dll filter=lfs diff=lfs merge=lfs -text +lilypond-2.24.2/bin/lilypond.exe filter=lfs diff=lfs merge=lfs -text +lilypond-2.24.2/bin/python310.dll filter=lfs diff=lfs merge=lfs -text +lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/assembler.go filter=lfs diff=lfs merge=lfs -text +lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/dwarf.go filter=lfs diff=lfs merge=lfs -text +lilypond-2.24.2/libexec/gs.exe filter=lfs diff=lfs merge=lfs -text diff --git a/lilypond-2.24.2/bin/abc2ly.py b/lilypond-2.24.2/bin/abc2ly.py new file mode 100644 index 0000000000000000000000000000000000000000..6893957051479fcfb5205ef6c99cb843079d8b84 --- /dev/null +++ b/lilypond-2.24.2/bin/abc2ly.py @@ -0,0 +1,1557 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 +# -*- coding: utf-8 -*- + +# once upon a rainy monday afternoon. + +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 1999--2022 Han-Wen Nienhuys +# Jan Nieuwenhuizen +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + +# +# ... +# +# (not finished.) +# ABC standard v1.6: http://abcnotation.com/ +# +# Enhancements (Roy R. Rankin) +# +# Header section moved to top of lilypond file +# handle treble, treble-8, alto, and bass clef +# Handle voices (V: headers) with clef and part names, multiple voices +# Handle w: lyrics with multiple verses +# Handle key mode names for minor, major, phrygian, ionian, locrian, aeolian, +# mixolydian, lydian, dorian +# Handle part names from V: header +# Tuplets handling fixed up +# Lines starting with |: not discarded as header lines +# Multiple T: and C: header entries handled +# Accidental maintained until next bar check +# Silent rests supported +# articulations fermata, upbow, downbow, ltoe, accent, tenuto supported +# Chord strings([-^]"string") can contain a '#' +# Header fields enclosed by [] in notes string processed +# W: words output after tune as abc2ps does it (they failed before) + +# Enhancements (Laura Conrad) +# +# Barring now preserved between ABC and lilypond +# the default placement for text in abc is above the staff. +# %%LY now supported. +# \breve and \longa supported. +# M:none doesn't crash lily. +# lilypond '--' supported. + +# Enhancements (Guy Gascoigne-Piggford) +# +# Add support for maintaining ABC's notion of beaming, this is selectable +# from the command line with a -b or --beam option. +# Fixd a problem where on cygwin empty lines weren't being correctly identifed +# and so were complaining, but still generating the correct output. + +# Limitations +# +# Multiple tunes in single file not supported +# Blank T: header lines should write score and open a new score +# Not all header fields supported +# ABC line breaks are ignored +# Block comments generate error and are ignored +# Postscript commands are ignored +# lyrics not resynchronized by line breaks (lyrics must fully match notes) +# %%LY slyrics can't be directly before a w: line. +# ??? + + +# TODO: +# +# * coding style +# * lilylib +# * GNU style messages: warning:FILE:LINE: +# * l10n +# +# Convert to new chord styles. +# +# UNDEF -> None +# + +import __main__ +import getopt +import gettext +import os +import re +import sys + +""" + +# relocate-preamble.py.in +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2007--2022 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . +# + +This is generic code, used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +# This is needed for installations with a non-default layout, ie where share/ +# is not next to bin/. +sys.path.insert (0, os.path.join ('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/lilypond/2.24.2', 'python')) + +# Dynamic relocation, for installations with a default layout including GUB, +# but also for execution from the build directory. +bindir = os.path.abspath (os.path.dirname (sys.argv[0])) +topdir = os.path.dirname (bindir) +if bindir.endswith (r'/scripts/out'): + topdir = os.path.join (os.path.dirname (topdir), 'out') +datadir = os.path.abspath (os.path.join (topdir, 'share', 'lilypond')) +for v in [ 'current', '2.24.2' ]: + sys.path.insert (0, os.path.join (datadir, v, 'python')) + +""" +""" + +# Load translation and install _() into Python's builtins namespace. +gettext.install('lilypond', '/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/locale') + +import lilylib as ly + +version = '2.24.2' +if version == '@' + 'TOPLEVEL_VERSION' + '@': + version = '(unknown version)' # uGUHGUHGHGUGH + +UNDEF = 255 +state = UNDEF +voice_idx_dict = {} +header = {} +header['footnotes'] = '' +lyrics = [] +slyrics = [] +voices = [] +state_list = [] +repeat_state = [0] * 8 +current_voice_idx = -1 +current_lyric_idx = -1 +lyric_idx = -1 +part_names = 0 +default_len = 8 +length_specified = 0 +nobarlines = 0 +global_key = [0] * 7 # UGH +names = ["One", "Two", "Three"] +DIGITS = '0123456789' +HSPACE = ' \t' +midi_specs = '' + + +def error(msg): + sys.stderr.write(msg) + if global_options.strict: + sys.exit(1) + + +def alphabet(i): + return chr(i + ord('A')) + + +def check_clef(s): + # the number gives the base_octave + clefs = [("treble", "treble", 0), + ("treble1", "french", 0), + ("bass3", "varbaritone", 0), + ("bass", "bass", 0), + ("alto4", "tenor", 0), + ("alto2", "mezzosoprano", 0), + ("alto1", "soprano", 0), + ("alto", "alto", 0), + ("perc", "percussion", 0)] + modifier = [("-8va", "_8", -1), + ("-8", "_8", -1), + (r"\+8", "^8", +1), + ("8", "_8", -1)] + + if not s: + return '' + clef = None + octave = 0 + for c in clefs: + m = re.match('^'+c[0], s) + if m: + (clef, octave) = (c[1], c[2]) + s = s[m.end():] + break + if not clef: + return s + + mod = "" + for md in modifier: + m = re.match('^'+md[0], s) + if m: + mod = md[1] + octave += md[2] + s = s[m.end():] + break + + state.base_octave = octave + voices_append("\\clef \""+clef+mod+"\"\n") + return s + + +def select_voice(name, rol): + if name not in voice_idx_dict: + state_list.append(Parser_state()) + voices.append('') + slyrics.append([]) + voice_idx_dict[name] = len(voices) - 1 + __main__.current_voice_idx = voice_idx_dict[name] + __main__.state = state_list[current_voice_idx] + while rol != '': + m = re.match('^([^ \t=]*)=(.*)$', rol) # find keywork + if m: + keyword = m.group(1) + rol = m.group(2) + a = re.match('^("[^"]*"|[^ \t]*) *(.*)$', rol) + if a: + value = a.group(1) + rol = a.group(2) + if keyword == 'clef': + check_clef(value) + elif keyword == "name": + value = re.sub('\\\\', '\\\\\\\\', value) + # < 2.2 + voices_append("\\set Staff.instrument = %s\n" % value) + + __main__.part_names = 1 + elif keyword == "sname" or keyword == "snm": + voices_append("\\set Staff.instr = %s\n" % value) + else: + break + + +def dump_header(outf, hdr): + outf.write('\\header {\n') + ks = sorted(hdr.keys()) + for k in ks: + hdr[k] = re.sub('"', '\\"', hdr[k]) + outf.write('\t%s = "%s"\n' % (k, hdr[k])) + outf.write('}') + + +def dump_lyrics(outf): + if lyrics: + outf.write("\n\\markup \\column {\n") + for i in range(len(lyrics)): + outf.write(lyrics[i]) + outf.write("\n") + outf.write("}\n") + + +def dump_default_bar(outf): + """ + Nowadays abc2ly outputs explicits barlines (?) + """ + # < 2.2 + outf.write("\n\\set Score.measureBarType = \"\"\n") + + +def dump_slyrics(outf): + ks = sorted(voice_idx_dict.keys()) + for k in ks: + if re.match('[1-9]', k): + m = alphabet(int(k)) + else: + m = k + for i in range(len(slyrics[voice_idx_dict[k]])): + l = alphabet(i) + outf.write("\nwords%sV%s = \\lyricmode {" % (m, l)) + outf.write("\n" + slyrics[voice_idx_dict[k]][i]) + outf.write("\n}") + + +def dump_voices(outf): + global doing_alternative, in_repeat + ks = sorted(voice_idx_dict.keys()) + for k in ks: + if re.match('[1-9]', k): + m = alphabet(int(k)) + else: + m = k + outf.write("\nvoice%s = {" % m) + dump_default_bar(outf) + if repeat_state[voice_idx_dict[k]]: + outf.write("\n\\repeat volta 2 {") + outf.write("\n" + voices[voice_idx_dict[k]]) + if not using_old: + if doing_alternative[voice_idx_dict[k]]: + outf.write("}") + if in_repeat[voice_idx_dict[k]]: + outf.write("}") + outf.write("\n}") + + +def try_parse_q(a): + # assume that Q takes the form "Q:'opt. description' 1/4=120" + # There are other possibilities, but they are deprecated + r = re.compile(r'^(.*) *([0-9]+) */ *([0-9]+) *=* *([0-9]+)\s*') + m = r.match(a) + if m: + descr = m.group(1) # possibly empty + numerator = int(m.group(2)) + denominator = int(m.group(3)) + tempo = m.group(4) + dur = duration_to_lilypond_duration((numerator, denominator), 1, 0) + voices_append("\\tempo " + descr + " " + dur + "=" + tempo + "\n") + else: + # Parsing of numeric tempi, as these are fairly + # common. The spec says the number is a "beat" so using + # a quarter note as the standard time + numericQ = re.compile('[0-9]+') + m = numericQ.match(a) + if m: + voices_append("\\tempo 4=" + m.group(0)) + else: + sys.stderr.write( + "abc2ly: Warning, unable to parse Q specification: %s\n" % a) + + +def dump_score(outf): + outf.write(r""" + +\score{ + << +""") + + ks = sorted(voice_idx_dict.keys()) + for k in ks: + if re.match('[1-9]', k): + m = alphabet(int(k)) + else: + m = k + if k == 'default' and len(voice_idx_dict) > 1: + break + outf.write("\n\t\\context Staff=\"%s\"\n\t{\n" % k) + if k != 'default': + outf.write("\t \\voicedefault\n") + outf.write("\t \\voice%s " % m) + outf.write("\n\t}\n") + + l = ord('A') + for lyrics in slyrics[voice_idx_dict[k]]: + outf.write("\n\t\\addlyrics {\n") + if re.match('[1-9]', k): + m = alphabet(int(k)) + else: + m = k + + outf.write(" \\words%sV%s } " % (m, chr(l))) + l += 1 + + outf.write("\n >>") + outf.write("\n\t\\layout {\n") + outf.write("\t}\n\t\\midi {%s}\n}\n" % midi_specs) + + +def set_default_length(s): + global length_specified + m = re.search('1/([0-9]+)', s) + if m: + __main__.default_len = int(m.group(1)) + length_specified = 1 + + +def set_default_len_from_time_sig(s): + m = re.search('([0-9]+)/([0-9]+)', s) + if m: + n = int(m.group(1)) + d = int(m.group(2)) + if (n * 1.0)/(d * 1.0) < 0.75: + __main__.default_len = 16 + else: + __main__.default_len = 8 + + +def gulp_file(f): + try: + i = open(f, encoding="utf8") + i.seek(0, 2) + n = i.tell() + i.seek(0, 0) + except FileNotFoundError: + sys.stderr.write("cannot open file: `%s'\n" % f) + return '' + s = i.read(n) + if len(s) <= 0: + sys.stderr.write("gulped empty file: `%s'\n" % f) + i.close() + return s + + +# pitch manipulation. Tuples are (name, alteration). +# 0 is (central) C. Alteration -1 is a flat, Alteration +1 is a sharp +# pitch in semitones. +def semitone_pitch(tup): + p = 0 + + t = tup[0] + p = p + 12 * (t // 7) + t = t % 7 + + if t > 2: + p = p - 1 + + p = p + t * 2 + tup[1] + return p + + +def fifth_above_pitch(tup): + (n, a) = (tup[0] + 4, tup[1]) + + difference = 7 - (semitone_pitch((n, a)) - semitone_pitch(tup)) + a = a + difference + + return (n, a) + + +def sharp_keys(): + p = (0, 0) + l = [] + k = 0 + while True: + l.append(p) + (t, a) = fifth_above_pitch(p) + if semitone_pitch((t, a)) % 12 == 0: + break + + p = (t % 7, a) + return l + + +def flat_keys(): + p = (0, 0) + l = [] + k = 0 + while True: + l.append(p) + (t, a) = quart_above_pitch(p) + if semitone_pitch((t, a)) % 12 == 0: + break + + p = (t % 7, a) + return l + + +def quart_above_pitch(tup): + (n, a) = (tup[0] + 3, tup[1]) + + difference = 5 - (semitone_pitch((n, a)) - semitone_pitch(tup)) + a = a + difference + + return (n, a) + + +key_lookup = { # abc to lilypond key mode names + 'm': 'minor', + 'min': 'minor', + 'maj': 'major', + 'major': 'major', + 'phr': 'phrygian', + 'ion': 'ionian', + 'loc': 'locrian', + 'aeo': 'aeolian', + 'mix': 'mixolydian', + 'mixolydian': 'mixolydian', + 'lyd': 'lydian', + 'dor': 'dorian', + 'dorian': 'dorian' +} + + +def lily_key(k): + if k == 'none': + return + orig = "" + k + # UGR + k = k.lower() + key = k[0] + # UGH + k = k[1:] + if k and k[0] == '#': + key = key + 'is' + k = k[1:] + elif k and k[0] == 'b': + key = key + 'es' + k = k[1:] + if not k: + return '%s \\major' % key + + type = k[0:3] + if type not in key_lookup: + # ugh, use lilylib, say WARNING:FILE:LINE: + sys.stderr.write("abc2ly:warning:") + sys.stderr.write("ignoring unknown key: `%s'" % orig) + sys.stderr.write('\n') + return 0 + return "%s \\%s" % (key, key_lookup[type]) + + +def shift_key(note, acc, shift): + s = semitone_pitch((note, acc)) + s = (s + shift + 12) % 12 + if s <= 4: + n = s // 2 + a = s % 2 + else: + n = (s + 1) // 2 + a = (s + 1) % 2 + if a: + n = n + 1 + a = -1 + return (n, a) + + +key_shift = { # semitone shifts for key mode names + 'm': 3, + 'min': 3, + 'minor': 3, + 'maj': 0, + 'major': 0, + 'phr': -4, + 'phrygian': -4, + 'ion': 0, + 'ionian': 0, + 'loc': 1, + 'locrian': 1, + 'aeo': 3, + 'aeolian': 3, + 'mix': 5, + 'mixolydian': 5, + 'lyd': -5, + 'lydian': -5, + 'dor': -2, + 'dorian': -2 +} + + +def compute_key(k): + k = k.lower() + intkey = (ord(k[0]) - ord('a') + 5) % 7 + intkeyacc = 0 + k = k[1:] + + if k and k[0] == 'b': + intkeyacc = -1 + k = k[1:] + elif k and k[0] == '#': + intkeyacc = 1 + k = k[1:] + k = k[0:3] + if k and k in key_shift: + (intkey, intkeyacc) = shift_key(intkey, intkeyacc, key_shift[k]) + keytup = (intkey, intkeyacc) + + sharp_key_seq = sharp_keys() + flat_key_seq = flat_keys() + + accseq = None + accsign = 0 + if keytup in sharp_key_seq: + accsign = 1 + key_count = sharp_key_seq.index(keytup) + accseq = [(4*x - 1) % 7 for x in range(1, key_count + 1)] + + elif keytup in flat_key_seq: + accsign = -1 + key_count = flat_key_seq.index(keytup) + accseq = [(3*x + 3) % 7 for x in range(1, key_count + 1)] + else: + error("Huh?") + raise Exception("Huh") + + key_table = [0] * 7 + for a in accseq: + key_table[a] = key_table[a] + accsign + + return key_table + + +tup_lookup = { + '2': '3/2', + '3': '2/3', + '4': '4/3', + '5': '4/5', + '6': '4/6', + '7': '6/7', + '9': '8/9', +} + + +def try_parse_tuplet_begin(s, state): + if re.match(r'\([2-9]', s): + dig = s[1] + s = s[2:] + prev_tuplet_state = state.parsing_tuplet + state.parsing_tuplet = int(dig[0]) + if prev_tuplet_state: + voices_append("}") + voices_append("\\times %s {" % tup_lookup[dig]) + return s + + +def try_parse_group_end(s, state): + if s and s[0] in HSPACE: + s = s[1:] + close_beam_state(state) + return s + + +def header_append(key, a): + s = '' + if key in header: + s = header[key] + "\n" + header[key] = s + a + + +def wordwrap(a, v): + linelen = len(v) - v.rfind('\n') + if linelen + len(a) > 80: + v = v + '\n' + return v + a + ' ' + + +def stuff_append(stuff, idx, a): + if not stuff: + stuff.append(a) + else: + stuff[idx] = wordwrap(a, stuff[idx]) + +# ignore wordwrap since we are adding to the previous word + + +def stuff_append_back(stuff, idx, a): + if not stuff: + stuff.append(a) + else: + point = len(stuff[idx])-1 + while stuff[idx][point] == ' ': + point = point - 1 + point = point + 1 + stuff[idx] = stuff[idx][:point] + a + stuff[idx][point:] + + +def voices_append(a): + if current_voice_idx < 0: + select_voice('default', '') + stuff_append(voices, current_voice_idx, a) + +# word wrap really makes it hard to bind beams to the end of notes since it +# pushes out whitespace on every call. The _back functions do an append +# prior to the last space, effectively tagging whatever they are given +# onto the last note + + +def voices_append_back(a): + if current_voice_idx < 0: + select_voice('default', '') + stuff_append_back(voices, current_voice_idx, a) + + +def repeat_prepend(): + global repeat_state + if current_voice_idx < 0: + select_voice('default', '') + if not using_old: + repeat_state[current_voice_idx] = 't' + + +def lyrics_append(a): + a = re.sub('#', '\\#', a) # latex does not like naked #'s + a = re.sub('"', '\\"', a) # latex does not like naked "'s + a = ' \\line { "' + a + '" }\n' + stuff_append(lyrics, current_lyric_idx, a) + +# break lyrics to words and put "'s around words containing numbers and '"'s + + +def fix_lyric(s): + ret = '' + while s != '': + m = re.match('[ \t]*([^ \t]*)[ \t]*(.*$)', s) + if m: + word = m.group(1) + s = m.group(2) + word = re.sub('"', '\\"', word) # escape " + if re.match(r'.*[0-9"\(]', word): + word = re.sub('_', ' ', word) # _ causes probs inside "" + ret = ret + '\"' + word + '\" ' + else: + ret = ret + word + ' ' + else: + return ret + return ret + + +def slyrics_append(a): + a = re.sub('_', ' _ ', a) # _ to ' _ ' + # split words with "-" unless was originally "--" + a = re.sub('([^-])-([^-])', '\\1- \\2', a) + a = re.sub('\\\\- ', '-', a) # unless \- + a = re.sub('~', '_', a) # ~ to space('_') + a = re.sub(r'\*', '_ ', a) # * to to space + a = re.sub('#', '\\#', a) # latex does not like naked #'s + if re.match(r'.*[0-9"\(]', a): # put numbers and " and ( into quoted string + a = fix_lyric(a) + a = re.sub('$', ' ', a) # insure space between lines + __main__.lyric_idx = lyric_idx + 1 + if len(slyrics[current_voice_idx]) <= lyric_idx: + slyrics[current_voice_idx].append(a) + else: + v = slyrics[current_voice_idx][lyric_idx] + slyrics[current_voice_idx][lyric_idx] = wordwrap( + a, slyrics[current_voice_idx][lyric_idx]) + + +def try_parse_header_line(ln, state): + global length_specified + m = re.match('^([A-Za-z]): *(.*)$', ln) + + if m: + g = m.group(1) + a = m.group(2) + if g == 'T': # title + a = re.sub('[ \t]*$', '', a) # strip trailing blanks + if 'title' in header: + if a: + if len(header['title']): + # the non-ascii character + # in the string below is a + # punctuation dash. (TeX ---) + header['title'] = header['title'] + ' — ' + a + else: + header['subtitle'] = a + else: + header['title'] = a + if g == 'M': # Meter + if a == 'C': + if not state.common_time: + state.common_time = 1 + voices_append( + " \\override Staff.TimeSignature.style = #'C\n") + a = '4/4' + if a == 'C|': + if not state.common_time: + state.common_time = 1 + voices_append( + "\\override Staff.TimeSignature.style = #'C\n") + a = '2/2' + if not length_specified: + set_default_len_from_time_sig(a) + else: + length_specified = 0 + if not a == 'none': + voices_append('\\time %s' % a) + state.next_bar = '' + if g == 'K': # KEY + a = check_clef(a) + if a: + # separate clef info + m = re.match('^([^ \t]*) *([^ ]*)( *)(.*)$', a) + if m: + # there may or may not be a space + # between the key letter and the mode + # convert the mode to lower-case before comparing + mode = m.group(2)[0:3].lower() + if mode in key_lookup: + # use the full mode, not only the first three letters + key_info = m.group(1) + m.group(2).lower() + clef_info = a[m.start(4):] + else: + key_info = m.group(1) + clef_info = a[m.start(2):] + __main__.global_key = compute_key(key_info) + k = lily_key(key_info) + if k: + voices_append('\\key %s' % k) + check_clef(clef_info) + else: + __main__.global_key = compute_key(a) + k = lily_key(a) + if k: + voices_append('\\key %s \\major' % k) + if g == 'N': # Notes + header['footnotes'] = header['footnotes'] + '\\\\\\\\' + a + if g == 'O': # Origin + header['origin'] = a + if g == 'X': # Reference Number + header['crossRefNumber'] = a + if g == 'A': # Area + header['area'] = a + if g == 'H': # History + header_append('history', a) + if g == 'B': # Book + header['book'] = a + if g == 'C': # Composer + if 'composer' in header: + if a: + header['composer'] = header['composer'] + '\\\\\\\\' + a + else: + header['composer'] = a + if g == 'S': + header['subtitle'] = a + if g == 'L': # Default note length + set_default_length(ln) + if g == 'V': # Voice + voice = re.sub(' .*$', '', a) + rest = re.sub('^[^ \t]* *', '', a) + if state.next_bar: + voices_append(state.next_bar) + state.next_bar = '' + select_voice(voice, rest) + if g == 'W': # Words + lyrics_append(a) + if g == 'w': # vocals + slyrics_append(a) + if g == 'Q': # tempo + try_parse_q(a) + if g == 'R': # Rhythm (e.g. jig, reel, hornpipe) + header['meter'] = a + if g == 'Z': # Transcription (e.g. Steve Mansfield 1/2/2000) + header['transcription'] = a + return '' + return ln + +# we use in this order specified accidental, active accidental for bar, +# active accidental for key + + +def pitch_to_lilypond_name(name, acc, bar_acc, key): + s = '' + if acc == UNDEF: + if not nobarlines: + acc = bar_acc + if acc == UNDEF: + acc = key + if acc == -1: + s = 'es' + elif acc == 1: + s = 'is' + + if name > 4: + name = name - 7 + return chr(name + ord('c')) + s + + +def octave_to_lilypond_quotes(o): + o = o + 2 + s = '' + if o < 0: + o = -o + s = ',' + else: + s = '\'' + + return s * o + + +def parse_num(s): + durstr = '' + while s and s[0] in DIGITS: + durstr = durstr + s[0] + s = s[1:] + + n = None + if durstr: + n = int(durstr) + return (s, n) + + +def duration_to_lilypond_duration(multiply_tup, defaultlen, dots): + base = 1 + # (num / den) / defaultlen < 1/base + while base * multiply_tup[0] < multiply_tup[1]: + base = base * 2 + if base == 1: + if (multiply_tup[0] / multiply_tup[1]) == 2: + base = '\\breve' + if (multiply_tup[0] / multiply_tup[1]) == 3: + base = '\\breve' + dots = 1 + if (multiply_tup[0] / multiply_tup[1]) == 4: + base = '\\longa' + return '%s%s' % (base, '.' * dots) + + +class Parser_state: + def __init__(self): + self.in_acc = {} + self.next_articulation = '' + self.next_bar = '' + self.next_dots = 0 + self.next_den = 1 + self.parsing_tuplet = 0 + self.plus_chord = 0 + self.base_octave = 0 + self.common_time = 0 + self.parsing_beam = 0 + + +# return (str, num,den,dots) +def parse_duration(s, parser_state): + num = 0 + den = parser_state.next_den + parser_state.next_den = 1 + + (s, num) = parse_num(s) + if not num: + num = 1 + if len(s): + if s[0] == '/': + if len(s[0]): + while s[:1] == '/': + s = s[1:] + d = 2 + if s[0] in DIGITS: + (s, d) = parse_num(s) + + den = den * d + + den = den * default_len + + current_dots = parser_state.next_dots + parser_state.next_dots = 0 + if re.match('[ \t]*[<>]', s): + while s[0] in HSPACE: + s = s[1:] + while s[0] == '>': + s = s[1:] + current_dots = current_dots + 1 + parser_state.next_den = parser_state.next_den * 2 + + while s[0] == '<': + s = s[1:] + den = den * 2 + parser_state.next_dots = parser_state.next_dots + 1 + + try_dots = [3, 2, 1] + for d in try_dots: + f = 1 << d + multiplier = (2*f-1) + if num % multiplier == 0 and den % f == 0: + num = num / multiplier + den = den / f + current_dots = current_dots + d + + return (s, num, den, current_dots) + + +def try_parse_rest(s, parser_state): + if not s or s[0] != 'z' and s[0] != 'x': + return s + + __main__.lyric_idx = -1 + + if parser_state.next_bar: + voices_append(parser_state.next_bar) + parser_state.next_bar = '' + + if s[0] == 'z': + rest = 'r' + else: + rest = 's' + s = s[1:] + + (s, num, den, d) = parse_duration(s, parser_state) + voices_append( + '%s%s' % (rest, duration_to_lilypond_duration((num, den), default_len, d))) + if parser_state.next_articulation: + voices_append(parser_state.next_articulation) + parser_state.next_articulation = '' + + return s + + +artic_tbl = { + '.': '-.', + 'T': '^\\trill', + 'H': '^\\fermata', + 'u': '^\\upbow', + 'K': '^\\ltoe', + 'k': '^\\accent', + 'M': '^\\tenuto', + '~': '^"~" ', + 'J': '', # ignore slide + 'R': '', # ignore roll + 'S': '^\\segno', + 'O': '^\\coda', + 'v': '^\\downbow' +} + + +def try_parse_articulation(s, state): + while s and s[:1] in artic_tbl: + state.next_articulation = state.next_articulation + artic_tbl[s[:1]] + if not artic_tbl[s[:1]]: + sys.stderr.write("Warning: ignoring `%s'\n" % s[:1]) + + s = s[1:] + + # s7m2 input doesn't care about spaces + if re.match(r'[ \t]*\(', s): + s = s.lstrip() + + slur_begin = 0 + while s[:1] == '(' and s[1] not in DIGITS: + slur_begin = slur_begin + 1 + state.next_articulation = state.next_articulation + '(' + s = s[1:] + + return s + +# +# remember accidental for rest of bar +# + + +def set_bar_acc(note, octave, acc, state): + if acc == UNDEF: + return + n_oct = note + octave * 7 + state.in_acc[n_oct] = acc + +# get accidental set in this bar or UNDEF if not set + + +def get_bar_acc(note, octave, state): + n_oct = note + octave * 7 + if n_oct in state.in_acc: + return state.in_acc[n_oct] + else: + return UNDEF + + +def clear_bar_acc(state): + state.in_acc = {} + + +# if we are parsing a beam, close it off +def close_beam_state(state): + if state.parsing_beam and global_options.beams: + state.parsing_beam = 0 + voices_append_back(']') + + +# WAT IS ABC EEN ONTZETTENDE PROGRAMMEERPOEP ! +def try_parse_note(s, parser_state): + mud = '' + + slur_begin = 0 + if not s: + return s + + articulation = '' + acc = UNDEF + if s[0] in '^=_': + c = s[0] + s = s[1:] + if c == '^': + acc = 1 + if c == '=': + acc = 0 + if c == '_': + acc = -1 + + octave = parser_state.base_octave + if s[0] in "ABCDEFG": + s = s[0].lower() + s[1:] + octave = octave - 1 + + notename = 0 + if s[0] in "abcdefg": + notename = (ord(s[0]) - ord('a') + 5) % 7 + s = s[1:] + else: + return s # failed; not a note! + + __main__.lyric_idx = -1 + + if parser_state.next_bar: + voices_append(parser_state.next_bar) + parser_state.next_bar = '' + + while s[0] == ',': + octave = octave - 1 + s = s[1:] + while s[0] == '\'': + octave = octave + 1 + s = s[1:] + + (s, num, den, current_dots) = parse_duration(s, parser_state) + + if re.match(r'[ \t]*\)', s): + s = s.lstrip() + + slur_end = 0 + while s[:1] == ')': + slur_end = slur_end + 1 + s = s[1:] + + bar_acc = get_bar_acc(notename, octave, parser_state) + pit = pitch_to_lilypond_name(notename, acc, bar_acc, global_key[notename]) + oct = octave_to_lilypond_quotes(octave) + if acc != UNDEF and (acc == global_key[notename] or acc == bar_acc): + mod = '!' + else: + mod = '' + voices_append("%s%s%s%s" % + (pit, oct, mod, + duration_to_lilypond_duration((num, den), default_len, current_dots))) + + set_bar_acc(notename, octave, acc, parser_state) + if parser_state.next_articulation: + articulation = articulation + parser_state.next_articulation + parser_state.next_articulation = '' + + voices_append(articulation) + + if slur_begin: + voices_append('-(' * slur_begin) + if slur_end: + voices_append('-)' * slur_end) + + if parser_state.parsing_tuplet: + parser_state.parsing_tuplet = parser_state.parsing_tuplet - 1 + if not parser_state.parsing_tuplet: + voices_append("}") + + if global_options.beams and \ + s[0] in '^=_ABCDEFGabcdefg' and \ + not parser_state.parsing_beam and \ + not parser_state.parsing_tuplet: + parser_state.parsing_beam = 1 + voices_append_back('[') + + return s + + +def junk_space(s, state): + while s and s[0] in '\t\n\r ': + s = s[1:] + close_beam_state(state) + + return s + + +def try_parse_guitar_chord(s, state): + if s[:1] == '"': + s = s[1:] + gc = '' + if s[0] == '_' or (s[0] == '^'): + position = s[0] + s = s[1:] + else: + position = '^' + while s and s[0] != '"': + gc = gc + s[0] + s = s[1:] + + if s: + s = s[1:] + gc = re.sub('#', '\\#', gc) # escape '#'s + state.next_articulation = ("%c\"%s\"" % (position, gc)) \ + + state.next_articulation + return s + + +def try_parse_escape(s): + if not s or s[0] != '\\': + return s + + s = s[1:] + if s[:1] == 'K': + key_table = compute_key() + return s + + +# +# |] thin-thick double bar line +# || thin-thin double bar line +# [| thick-thin double bar line +# :| left repeat +# |: right repeat +# :: left-right repeat +# |1 volta 1 +# |2 volta 2 +old_bar_dict = { + '|]': '|.', + '||': '||', + '[|': '||', + ':|': ':|.', + '|:': '|:', + '::': ':|.|:', + '|1': '|', + '|2': '|', + ':|2': ':|.', + '|': '|' +} +bar_dict = { + '|]': '\\bar "|."', + '||': '\\bar "||"', + '[|': '\\bar "||"', + ':|': '}', + '|:': '\\repeat volta 2 {', + '::': '} \\repeat volta 2 {', + '|1': '} \\alternative{{', + '|2': '} {', + ':|2': '} {', + '|': '\\bar "|"' +} + + +warn_about = ['|:', '::', ':|', '|1', ':|2', '|2'] +alternative_opener = ['|1', '|2', ':|2'] +repeat_ender = ['::', ':|'] +repeat_opener = ['::', '|:'] +in_repeat = [''] * 8 +doing_alternative = [''] * 8 +using_old = '' + +def try_parse_bar(string, state): + global in_repeat, doing_alternative, using_old + do_curly = '' + bs = None + if current_voice_idx < 0: + select_voice('default', '') + # first try the longer one + for trylen in [3, 2, 1]: + if string[:trylen] and string[:trylen] in bar_dict: + s = string[:trylen] + if using_old: + bs = "\\bar \"%s\"" % old_bar_dict[s] + else: + bs = "%s" % bar_dict[s] + string = string[trylen:] + if s in alternative_opener: + if not in_repeat[current_voice_idx]: + using_old = 't' + bs = "\\bar \"%s\"" % old_bar_dict[s] + else: + doing_alternative[current_voice_idx] = 't' + + if s in repeat_ender: + if not in_repeat[current_voice_idx]: + sys.stderr.write( + "Warning: inserting repeat to beginning of notes.\n") + repeat_prepend() + in_repeat[current_voice_idx] = '' + else: + if doing_alternative[current_voice_idx]: + do_curly = 't' + if using_old: + bs = "\\bar \"%s\"" % old_bar_dict[s] + else: + bs = bar_dict[s] + doing_alternative[current_voice_idx] = '' + in_repeat[current_voice_idx] = '' + if s in repeat_opener: + in_repeat[current_voice_idx] = 't' + if using_old: + bs = "\\bar \"%s\"" % old_bar_dict[s] + else: + bs = bar_dict[s] + break + if string[:1] == '|': + state.next_bar = '|\n' + string = string[1:] + clear_bar_acc(state) + close_beam_state(state) + + if string[:1] == '}': + close_beam_state(state) + + if bs is not None or state.next_bar != '': + if state.parsing_tuplet: + state.parsing_tuplet = 0 + voices_append('} ') + + if bs is not None: + clear_bar_acc(state) + close_beam_state(state) + voices_append(bs) + if do_curly != '': + voices_append("} ") + do_curly = '' + return string + + +def try_parse_tie(s): + if s[:1] == '-': + s = s[1:] + voices_append(' ~ ') + return s + + +def bracket_escape(s, state): + m = re.match(r'^([^\]]*)] *(.*)$', s) + if m: + cmd = m.group(1) + s = m.group(2) + try_parse_header_line(cmd, state) + return s + + +def try_parse_chord_delims(s, state): + if s[:1] == '[': + s = s[1:] + if re.match('[A-Z]:', s): # bracket escape + return bracket_escape(s, state) + if state.next_bar: + voices_append(state.next_bar) + state.next_bar = '' + voices_append('<<') + + if s[:1] == '+': + s = s[1:] + if state.plus_chord: + voices_append('>>') + state.plus_chord = 0 + else: + if state.next_bar: + voices_append(state.next_bar) + state.next_bar = '' + voices_append('<<') + state.plus_chord = 1 + + ch = '' + if s[:1] == ']': + s = s[1:] + ch = '>>' + + end = 0 + while s[:1] == ')': + end = end + 1 + s = s[1:] + + voices_append("\\spanrequest \\stop \"slur\"" * end) + voices_append(ch) + return s + + +def try_parse_grace_delims(s, state): + if s[:1] == '{': + if state.next_bar: + voices_append(state.next_bar) + state.next_bar = '' + s = s[1:] + voices_append('\\grace { ') + + if s[:1] == '}': + s = s[1:] + voices_append('}') + + return s + + +def try_parse_comment(s): + global nobarlines + if s[0] == '%': + if s[0:5] == '%MIDI': + # the nobarlines option is necessary for an abc to lilypond translator for + # exactly the same reason abc2midi needs it: abc requires the user to enter + # the note that will be printed, and MIDI and lilypond expect entry of the + # pitch that will be played. + # + # In standard 19th century musical notation, the algorithm for translating + # between printed note and pitch involves using the barlines to determine + # the scope of the accidentals. + # + # Since ABC is frequently used for music in styles that do not use this + # convention, such as most music written before 1700, or ethnic music in + # non-western scales, it is necessary to be able to tell a translator that + # the barlines should not affect its interpretation of the pitch. + if 'nobarlines' in s: + nobarlines = 1 + elif s[0:3] == '%LY': + p = s.find('voices') + if p > -1: + voices_append(s[p+7:]) + voices_append("\n") + p = s.find('slyrics') + if p > -1: + slyrics_append(s[p+8:]) + +# write other kinds of appending if we ever need them. + return s + + +lineno = 0 +happy_count = 100 + + +def parse_file(fn): + f = open(fn, encoding='utf-8') + ls = f.readlines() + ls = [re.sub("\r$", '', x) for x in ls] + + select_voice('default', '') + global lineno + lineno = 0 + if not global_options.quiet: + sys.stderr.write("Line ... ") + sys.stderr.flush() + __main__.state = state_list[current_voice_idx] + + for ln in ls: + lineno = lineno + 1 + + if not lineno % happy_count: + sys.stderr.write('[%d]' % lineno) + sys.stderr.flush() + m = re.match('^([^%]*)%(.*)$', ln) # add comments to current voice + if m: + if m.group(2): + try_parse_comment(m.group(2)) + voices_append('%% %s\n' % m.group(2)) + ln = m.group(1) + + orig_ln = ln + + ln = junk_space(ln, state) + ln = try_parse_header_line(ln, state) + + # Try nibbling characters off until the line doesn't change. + prev_ln = '' + while ln != prev_ln: + prev_ln = ln + ln = try_parse_chord_delims(ln, state) + ln = try_parse_rest(ln, state) + ln = try_parse_articulation(ln, state) + ln = try_parse_note(ln, state) + ln = try_parse_bar(ln, state) + ln = try_parse_tie(ln) + ln = try_parse_escape(ln) + ln = try_parse_guitar_chord(ln, state) + ln = try_parse_tuplet_begin(ln, state) + ln = try_parse_group_end(ln, state) + ln = try_parse_grace_delims(ln, state) + ln = junk_space(ln, state) + + if ln: + error("%s: %d: Huh? Don't understand\n" % (fn, lineno)) + left = orig_ln[0:-len(ln)] + sys.stderr.write(left + '\n') + sys.stderr.write(' ' * len(left) + ln + '\n') + + +def identify(): + if not global_options.quiet: + sys.stderr.write("%s from LilyPond %s\n" % (ly.program_name, version)) + + +authors = """ +Written by Han-Wen Nienhuys , Laura Conrad +, Roy Rankin . +""" + + +def print_version(): + print(r"""abc2ly (GNU lilypond) %s""" % version) + + +def get_option_parser(): + p = ly.get_option_parser(usage=_("%s [OPTION]... FILE") % 'abc2ly', + description=_('''abc2ly converts ABC music files (see +%s) to LilyPond input. +''') % 'http://abcnotation.com/abc2mtex/abc.txt', + add_help_option=False) + + p.version = "abc2ly (LilyPond) 2.24.2" + p.add_option("--version", + action="version", + help=_("show version number and exit")) + p.add_option("-h", "--help", + action="help", + help=_("show this help and exit")) + p.add_option("-o", "--output", metavar='FILE', + action="store", + help=_("write output to FILE")) + p.add_option("-s", "--strict", + action="store_true", + help=_("be strict about success")) + p.add_option('-b', '--beams', + action="store_true", + help=_("preserve ABC's notion of beams")) + p.add_option('-q', '--quiet', + action="store_true", + help=_("suppress progress messages")) + p.add_option_group('', + description=( + _('Report bugs via %s') + % 'bug-lilypond@gnu.org') + '\n') + return p + + +option_parser = get_option_parser() +(global_options, files) = option_parser.parse_args() + + +identify() + +header['tagline'] = 'Lily was here %s -- automatically converted from ABC' % version +for f in files: + if f == '-': + f = '' + + if not global_options.quiet: + sys.stderr.write('Parsing `%s\'...\n' % f) + parse_file(f) + + if not global_options.output: + global_options.output = os.path.basename( + os.path.splitext(f)[0]) + ".ly" + if not global_options.quiet: + sys.stderr.write('lilypond output to: `%s\'...' % + global_options.output) + outf = open(global_options.output, 'w', encoding='utf-8') + +# don't substitute @VERSION@. We want this to reflect +# the last version that was verified to work. + outf.write('\\version "2.7.40"\n') + +# dump_global (outf) + dump_header(outf, header) + dump_slyrics(outf) + dump_voices(outf) + dump_score(outf) + dump_lyrics(outf) + if not global_options.quiet: + sys.stderr.write('\n') diff --git a/lilypond-2.24.2/bin/convert-ly.py b/lilypond-2.24.2/bin/convert-ly.py new file mode 100644 index 0000000000000000000000000000000000000000..f58fa293374b3f676052cd85a306d8c9b9091fc1 --- /dev/null +++ b/lilypond-2.24.2/bin/convert-ly.py @@ -0,0 +1,445 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 + +# convert-ly.py -- Update old LilyPond input files (fix name?) +# converting rules are found in python/convertrules.py + +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 1998--2022 Han-Wen Nienhuys +# Jan Nieuwenhuizen +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + +import gettext +import io +import os +import re +import shutil +import sys + +""" + +# relocate-preamble.py.in +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2007--2022 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . +# + +This is generic code, used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +# This is needed for installations with a non-default layout, ie where share/ +# is not next to bin/. +sys.path.insert (0, os.path.join ('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/lilypond/2.24.2', 'python')) + +# Dynamic relocation, for installations with a default layout including GUB, +# but also for execution from the build directory. +bindir = os.path.abspath (os.path.dirname (sys.argv[0])) +topdir = os.path.dirname (bindir) +if bindir.endswith (r'/scripts/out'): + topdir = os.path.join (os.path.dirname (topdir), 'out') +datadir = os.path.abspath (os.path.join (topdir, 'share', 'lilypond')) +for v in [ 'current', '2.24.2' ]: + sys.path.insert (0, os.path.join (datadir, v, 'python')) + +""" +""" + +# Load translation and install _() into Python's builtins namespace. +gettext.install('lilypond', '/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/locale') + +import convertrules +import lilylib as ly + +lilypond_version_re_str = '\\\\version *\"([0-9.]+)"' +lilypond_version_re = re.compile(lilypond_version_re_str) + +lilypond_version_strict_re_str = '\\\\version *\"([0-9]+(?:[.]([0-9]+))([.][0-9]+)?)"' +lilypond_version_strict_re = re.compile(lilypond_version_strict_re_str) + +help_summary = ( + _('''Update LilyPond input to newer version. By default, update from the +version taken from the \\version command, to the current LilyPond version.''') + + "\n" + + _("If FILE is `-', read from standard input.") + + "\n\n" + + _("Examples:") + + ''' + $ convert-ly -e old.ly + $ convert-ly --from=2.3.28 --to=2.5.21 foobar.ly > foobar-new.ly +''') + +copyright = ('Jan Nieuwenhuizen ', + 'Han-Wen Nienhuys ') + +program_version = '2.24.2' + +authors = ('Jan Nieuwenhuizen ', + 'Han-Wen Nienhuys ') + + +def identify(): + ly.progress('%s (GNU LilyPond) %s\n' % (ly.program_name, program_version)) + + +def warranty(): + identify() + sys.stdout.write(''' +%s + +%s + +%s +%s +''' % (_('Copyright (c) %s by') % '2001--2023', + ' '.join(authors), + _('Distributed under terms of the GNU General Public License.'), + _('It comes with NO WARRANTY.'))) + + +def get_option_parser(): + p = ly.get_option_parser(usage=_("%s [OPTION]... FILE") % 'convert-ly', + description=help_summary, + add_help_option=False) + + p.version = "2.24.2" + p.add_option("--version", + action="version", + help=_("show version number and exit")) + + p.add_option("-h", "--help", + action="help", + help=_("show this help and exit")) + + p.add_option('-f', '--from', + action="store", + metavar=_("VERSION"), + dest="from_version", + help=_( + "start from VERSION [default: \\version found in file]"), + default='') + + p.add_option('-e', '--edit', help=_("edit in place"), + action='store_true') + + p.add_option("-l", "--loglevel", + help=_("Print log messages according to LOGLEVEL " + "(NONE, ERROR, WARNING, PROGRESS (default), DEBUG)"), + metavar=_("LOGLEVEL"), + action='callback', + callback=ly.handle_loglevel_option, + type='string') + + p.add_option('-n', '--no-version', + help=_("do not add \\version command if missing"), + action='store_true', + dest='skip_version_add', + default=False) + + p.add_option('-c', '--current-version', + help=_("force updating \\version number to %s") % program_version, + action='store_true', + dest='force_current_version', + default=False) + + p.add_option('-d', '--diff-version-update', + help=_("only update \\version number if file is modified"), + action='store_true', + dest='diff_version_update', + default=False) + + p.add_option("-s", '--show-rules', + help=_("show rules [default: -f 0, -t %s]") % program_version, + dest='show_rules', + action='store_true', default=False) + + p.add_option('-t', '--to', + help=_("convert to VERSION [default: %s]") % program_version, + metavar=_('VERSION'), + action='store', + dest="to_version", + default='') + + p.add_option('-b', '--backup-numbered', + help=_("make a numbered backup [default: filename.ext~]"), + action='store_true', + dest="backup_numbered", + default='') + + p.add_option('-w', '--warranty', help=_("show warranty and copyright"), + action='store_true', + ), + p.add_option_group('', + description=( + _("Report bugs via %s") + % 'bug-lilypond@gnu.org') + '\n') + + return p + + +def str_to_tuple(s): + return tuple([int(n) for n in s.split('.')]) + +def tup_to_str(t): + return '.'.join(['%s' % x for x in t]) + +def latest_version(): + return convertrules.conversions[-1][0] + + +def show_rules(file, from_version, to_version): + for x in convertrules.conversions: + if (not from_version or x[0] > from_version) \ + and (not to_version or x[0] <= to_version): + file.write('%s: %s\n' % (tup_to_str(x[0]), x[2])) + +def do_conversion(s, from_version, to_version): + """Apply conversions from FROM_VERSION to TO_VERSION. Return +tuple (LAST,LASTCHANGED,STR,ERRORS), with the last applied conversion, +the last conversion resulting in a change, the resulting +string and the number of errors.""" + conv_list = [conv for conv in convertrules.conversions if from_version < conv[0] <= to_version] + + ly.progress(_("Applying conversion: "), newline=False) + + last_conversion = None + last_change = None + errors = 0 + try: + for x in conv_list: + if x != conv_list[-1]: + ly.progress(tup_to_str(x[0]), newline=False) + ly.progress(', ', newline=False) + else: + ly.progress(tup_to_str(x[0])) + newstr = x[1](s) + last_conversion = x[0] + if newstr != s: + last_change = last_conversion + s = newstr + + except convertrules.FatalConversionError: + ly.error(_("Error while converting") + + '\n' + + _("Stopping at last successful rule")) + errors += 1 + + return (last_conversion, last_change, s, errors) + + +def guess_lilypond_version(input): + m = lilypond_version_strict_re.search(input) + # Accept a missing third component if the second component + # is even. That works because we don't have conversion rules + # within stable releases, as the syntax doesn't change. + if m and (m.group(3) is not None or int(m.group(2))%2 == 0): + return m.group(1) + m = lilypond_version_re.search(input) + if m: + raise InvalidVersion(m.group(1)) + else: + return '' + + +class FatalConversionError (Exception): + pass + + +class UnknownVersion (Exception): + pass + + +class InvalidVersion (Exception): + def __init__(self, version): + self.version = version + + +def back_up(file, numbered): + if numbered: + n = 0 + while True: + n = n + 1 + back_up = file + '.~' + str(n) + '~' + if not os.path.exists(back_up): + break + else: + back_up = file + '~' + shutil.copy2(file, back_up) + return back_up + + +def do_one_file(infile_name): + ly.progress(_("Processing `%s\'... ") % infile_name, True) + + if infile_name: + infile = open(infile_name, 'rb') + original = infile.read() + infile.close() + + # Cope early with encoding change in 2.5.13: Try UTF-8 and attempt + # conversion from latin1 if that fails. + try: + input = original.decode('utf-8') + except UnicodeError: + ly.progress(_("Attempting conversion from `latin1'...")) + input = original.decode('latin1') + + # Convert platform-dependent newline character sequences + # to `\n`. This is default behaviour when opening files in + # text mode, which does not work for us, though, since we do not + # know the encoding in advance. + input = io.StringIO(input, newline=None).read() + else: + input = sys.stdin.read() + + to_version = None + org_version = None + guess = guess_lilypond_version(input) + org_version = guess and str_to_tuple(guess) + from_version = global_options.from_version or org_version + if not from_version: + raise UnknownVersion() + + if global_options.to_version: + to_version = global_options.to_version + else: + to_version = latest_version() + + (last, last_change, result, errors) = \ + do_conversion(input, from_version, to_version) + + if global_options.force_current_version and \ + (last is None or last == to_version): + last = str_to_tuple(program_version) + if last: + if global_options.diff_version_update: + # Note that last_change can be set even if the result is + # the same if two conversion rules cancelled out + if result == input: + # make no (actual) change to the version number + last = org_version or from_version + else: + last = last_change + # If the last update was to an unstable version + # number, and the final update target is no longer in + # the same unstable series, we update to the stable + # series following the unstable version. + if last[1] % 2: # unstable + next_stable = (last[0], last[1]+1, 0) + if next_stable <= to_version: + last = next_stable + + newversion = r'\version "%s"' % tup_to_str(last) + if lilypond_version_re.search(result): + result = re.sub(lilypond_version_re_str, + '\\' + newversion, result) + elif not global_options.skip_version_add: + result = newversion + '\n' + result + + ly.progress('\n') + + if global_options.edit: + backup = back_up(infile_name, global_options.backup_numbered) + outfile = open(infile_name, 'w', encoding='utf-8') + else: + outfile = sys.stdout + + outfile.write(result) + + sys.stderr.flush() + + return errors + + +def do_options(): + opt_parser = get_option_parser() + (options, args) = opt_parser.parse_args() + + if options.warranty: + warranty() + sys.exit(0) + + if options.from_version: + options.from_version = str_to_tuple(options.from_version) + if options.to_version: + options.to_version = str_to_tuple(options.to_version) + + options.outfile_name = '' + global global_options + global_options = options + + if not args and not options.show_rules: + opt_parser.print_help() + sys.exit(2) + + return args + + +def main(): + files = do_options() + + # should parse files[] to read \version? + if global_options.show_rules: + show_rules(sys.stdout, global_options.from_version, + global_options.to_version) + sys.exit(0) + + identify() + + errors = 0 + for f in files: + if f == '-': + f = '' + elif not os.path.isfile(f): + ly.error(_("%s: Unable to open file") % f) + errors += 1 + continue + try: + errors += do_one_file(f) + except UnknownVersion: + ly.error(_("%s: Unable to determine version. Skipping") % f) + errors += 1 + except InvalidVersion as v: + ly.error(_("%s: Invalid version string `%s' \n" + "Valid version strings consist of three numbers, " + "separated by dots, e.g. `2.8.12'") % (f, v.version)) + errors += 1 + + if errors: + ly.warning(gettext.ngettext("There was %d error.", + "There were %d errors.", errors) % errors) + sys.exit(1) + + +main() diff --git a/lilypond-2.24.2/bin/etf2ly.py b/lilypond-2.24.2/bin/etf2ly.py new file mode 100644 index 0000000000000000000000000000000000000000..cafcf24a71004f83e94978c0f2829fb991dae047 --- /dev/null +++ b/lilypond-2.24.2/bin/etf2ly.py @@ -0,0 +1,1326 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 + +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2001--2022 Han-Wen Nienhuys +# Jan Nieuwenhuizen +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + +# info mostly taken from looking at files. See also +# https://www.gnu.org/software/lilypond/src/Developers/Details/etfformat.html + +# This supports +# +# * notes +# * rests +# * ties +# * slurs +# * lyrics +# * articulation +# * grace notes +# * tuplets +# + +# todo: +# * slur/stem directions +# * voices (2nd half of frame?) +# * more intelligent lyrics +# * beams (better use autobeam?) +# * more robust: try entertainer.etf (freenote) +# * dynamics +# * empty measures (eg. twopt03.etf from freenote) +# + + +import __main__ +import getopt +import gettext +import os +import re +import sys + +authors = ('Jan Nieuwenhuizen ', + 'Han-Wen Nienhuys ') + +version = '2.24.2' +if version == '@' + 'TOPLEVEL_VERSION' + '@': + version = '(unknown version)' # uGUHGUHGHGUGH + +""" + +# relocate-preamble.py.in +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2007--2022 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . +# + +This is generic code, used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +# This is needed for installations with a non-default layout, ie where share/ +# is not next to bin/. +sys.path.insert (0, os.path.join ('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/lilypond/2.24.2', 'python')) + +# Dynamic relocation, for installations with a default layout including GUB, +# but also for execution from the build directory. +bindir = os.path.abspath (os.path.dirname (sys.argv[0])) +topdir = os.path.dirname (bindir) +if bindir.endswith (r'/scripts/out'): + topdir = os.path.join (os.path.dirname (topdir), 'out') +datadir = os.path.abspath (os.path.join (topdir, 'share', 'lilypond')) +for v in [ 'current', '2.24.2' ]: + sys.path.insert (0, os.path.join (datadir, v, 'python')) + +""" +""" + +################################################################ +# Load translation and install _() into Python's builtins namespace. +gettext.install('lilypond', '/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/locale') + +import lilylib as ly + +finale_clefs = ['treble', 'alto', 'tenor', 'bass', + 'percussion', 'treble_8', 'bass_8', 'baritone'] + + +def lily_clef(fin): + try: + return finale_clefs[fin] + except IndexError: + sys.stderr.write('\nHuh? Found clef number %d\n' % fin) + + return 'treble' + + +def gulp_file(f): + return open(f, encoding='utf-8').read() + + +# notename 0 == central C +distances = [0, 2, 4, 5, 7, 9, 11, 12] + + +def semitones(name, acc): + return (name / 7) * 12 + distances[name % 7] + acc + +# represent pitches as (notename, alteration), relative to C-major scale + + +def transpose(orig, delta): + (oname, oacc) = orig + (dname, dacc) = delta + + old_pitch = semitones(oname, oacc) + delta_pitch = semitones(dname, dacc) + nname = (oname + dname) + nacc = oacc + new_pitch = semitones(nname, nacc) + + nacc = nacc - (new_pitch - old_pitch - delta_pitch) + + return (nname, nacc) + + +def interpret_finale_key_sig(finale_id): + """ +find the transposition of C-major scale that belongs here. + +we are not going to insert the correct major/minor, we only want to +have the correct number of accidentals +""" + + p = (0, 0) + + bank_number = finale_id >> 8 + accidental_bits = finale_id & 0xff + + if 0 <= accidental_bits < 7: + while accidental_bits > 0: + p = transpose(p, (4, 0)) # a fifth up + accidental_bits = accidental_bits - 1 + elif 248 < accidental_bits <= 255: + while accidental_bits < 256: + p = transpose(p, (3, 0)) + accidental_bits = accidental_bits + 1 + + if bank_number == 1: + # minor scale + p = transpose(p, (5, 0)) + p = (p[0] % 7, p[1]) + + return KeySignature(p, bank_number) + +# should cache this. + + +def find_scale(keysig): + cscale = [(x, 0) for x in range(0, 7)] +# print "cscale: ", cscale + ascale = [(x, 0) for x in range(-2, 5)] +# print "ascale: ", ascale + transposition = keysig.pitch + if keysig.sig_type == 1: + transposition = transpose(transposition, (2, -1)) + transposition = (transposition[0] % 7, transposition[1]) + trscale = list(map(lambda x, k=transposition: transpose(x, k), ascale)) + else: + trscale = list(map(lambda x, k=transposition: transpose(x, k), cscale)) +# print "trscale: ", trscale + return trscale + + +def EDU_to_duration(edu): + log = 1 + d = 4096 + while d > edu: + d = d >> 1 + log = log << 1 + + edu = edu - d + dots = 0 + if edu == d / 2: + dots = 1 + elif edu == d*3/4: + dots = 2 + return (log, dots) + + +def rational_to_lily_skip(rat): + (n, d) = rat + + basedur = 1 + while d and d % 2 == 0: + basedur = basedur << 1 + d = d >> 1 + + str = 's%d' % basedur + if n != 1: + str = str + '*%d' % n + if d != 1: + str = str + '/%d' % d + + return str + + +def gcd(a, b): + if b == 0: + return a + c = a + while c: + c = a % b + a = b + b = c + return a + + +def rat_simplify(r): + (n, d) = r + if d < 0: + d = -d + n = -n + if n == 0: + return (0, 1) + else: + g = gcd(n, d) + return (n/g, d/g) + + +def rat_multiply(a, b): + (x, y) = a + (p, q) = b + + return rat_simplify((x*p, y*q)) + + +def rat_add(a, b): + (x, y) = a + (p, q) = b + + return rat_simplify((x*q + p*y, y*q)) + + +def rat_neg(a): + (p, q) = a + return (-p, q) + + +def rat_subtract(a, b): + return rat_add(a, rat_neg(b)) + + +def lily_notename(tuple2): + (n, a) = tuple2 + nn = chr((n + 2) % 7 + ord('a')) + + return nn + {-2: 'eses', -1: 'es', 0: '', 1: 'is', 2: 'isis'}[a] + + +class Tuplet: + def __init__(self, number): + self.start_note = number + self.finale = [] + + def append_finale(self, fin): + self.finale.append(fin) + + def factor(self): + n = self.finale[0][2]*self.finale[0][3] + d = self.finale[0][0]*self.finale[0][1] + return rat_simplify((n, d)) + + def dump_start(self): + return '\\times %d/%d { ' % self.factor() + + def dump_end(self): + return ' }' + + def calculate(self, chords): + edu_left = self.finale[0][0] * self.finale[0][1] + + startch = chords[self.start_note] + c = startch + while c and edu_left: + c.tuplet = self + if c == startch: + c.chord_prefix = self.dump_start() + c.chord_prefix + + if not c.grace: + edu_left = edu_left - c.EDU_duration() + if edu_left == 0: + c.chord_suffix = c.chord_suffix + self.dump_end() + c = c.__next__ + + if edu_left: + sys.stderr.write( + "\nHuh? Tuplet starting at entry %d was too short." % self.start_note) + + +class Slur: + def __init__(self, number, params): + self.number = number + self.finale = params + + def append_entry(self, finale_e): + self.finale.append(finale_e) + + def calculate(self, chords): + startnote = self.finale[5] + endnote = self.finale[3*6 + 2] + try: + cs = chords[startnote] + ce = chords[endnote] + + if not cs or not ce: + raise IndexError + + cs.note_suffix = '-(' + cs.note_suffix + ce.note_suffix = ce.note_suffix + '-)' + + except IndexError: + sys.stderr.write("""\nHuh? Slur no %d between (%d,%d), with %d notes""" % ( + self.number, startnote, endnote, len(chords))) + + +class Global_measure: + def __init__(self, number): + self.timesig = '' + self.number = number + self.key_signature = None + self.scale = None + self.force_break = 0 + + self.repeats = [] + self.finale = [] + + def __str__(self): + return repr(self.finale) + + def set_timesig(self, finale): + (beats, fdur) = finale + (log, dots) = EDU_to_duration(fdur) + + if dots == 1: + beats = beats * 3 + log = log * 2 + dots = 0 + + if dots != 0: + sys.stderr.write( + "\nHuh? Beat duration has dots? (EDU Duration = %d)" % fdur) + self.timesig = (beats, log) + + def length(self): + return self.timesig + + def set_key_sig(self, finale): + k = interpret_finale_key_sig(finale) + self.key_signature = k + self.scale = find_scale(k) + + def set_flags(self, flag1, flag2): + + # flag1 isn't all that interesting. + if flag2 & 0x8000: + self.force_break = 1 + + if flag2 & 0x0008: + self.repeats.append('start') + if flag2 & 0x0004: + self.repeats.append('stop') + + if flag2 & 0x0002: + if flag2 & 0x0004: + self.repeats.append('bracket') + + +articulation_dict = { + 94: '^', + 109: '\\prall', + 84: '\\turn', + 62: '\\mordent', + 85: '\\fermata', + 46: '.', + # 3: '>', + # 18: '\arpeggio' , +} + + +class Articulation_def: + def __init__(self, n, a, b): + self.finale_glyph = a & 0xff + self.number = n + + def dump(self): + try: + return articulation_dict[self.finale_glyph] + except KeyError: + sys.stderr.write("\nUnknown articulation no. %d" % + self.finale_glyph) + sys.stderr.write( + "\nPlease add an entry to articulation_dict in the Python source") + return None + + +class Articulation: + def __init__(self, a, b, finale): + self.definition = finale[0] + self.notenumber = b + + def calculate(self, chords, defs): + c = chords[self.notenumber] + + adef = defs[self.definition] + lystr = adef.dump() + if lystr is None: + lystr = '"art"' + sys.stderr.write("\nThis happened on note %d" % self.notenumber) + + c.note_suffix = '-' + lystr + + +class Syllable: + def __init__(self, a, b, finale): + self.chordnum = b + self.syllable = finale[1] + self.verse = finale[0] + + def calculate(self, chords, lyrics): + self.chord = chords[self.chordnum] + + +class Verse: + def __init__(self, number, body): + self.body = body + self.number = number + self.split_syllables() + + def split_syllables(self): + ss = re.split('(-| +)', self.body) + + sep = 0 + syls = [None] + for s in ss: + if sep: + septor = re.sub(" +", "", s) + septor = re.sub("-", " -- ", septor) + syls[-1] = syls[-1] + septor + else: + syls.append(s) + + sep = not sep + + self.syllables = syls + + def dump(self): + str = '' + line = '' + for s in self.syllables[1:]: + line = line + ' ' + s + if len(line) > 72: + str = str + ' ' * 4 + line + '\n' + line = '' + + str = """\nverse%s = \\lyricmode {\n %s }\n""" % ( + encodeint(self.number - 1), str) + return str + + +class KeySignature: + def __init__(self, pitch, sig_type=0): + self.pitch = pitch + self.sig_type = sig_type + + def signature_type(self): + if self.sig_type == 1: + return "\\minor" + else: + # really only for 0, but we only know about 0 and 1 + return "\\major" + + def equal(self, other): + if other and other.pitch == self.pitch and other.sig_type == self.sig_type: + return 1 + else: + return 0 + + +class Measure: + def __init__(self, no): + self.number = no + self.frames = [0] * 4 + self.flags = 0 + self.clef = 0 + self.finale = [] + self.global_measure = None + self.staff = None + self.valid = 1 + + def valid(self): + return self.valid + + def calculate(self): + fs = [] + + if len(self.finale) < 2: + fs = self.finale[0] + + self.clef = fs[1] + self.frames = [fs[0]] + else: + fs = self.finale + self.clef = fs[0] + self.flags = fs[1] + self.frames = fs[2:] + + +class Frame: + def __init__(self, finale): + self.measure = None + self.finale = finale + (number, start, end) = finale + self.number = number + self.start = start + self.end = end + self.chords = [] + + def set_measure(self, m): + self.measure = m + + def calculate(self): + + # do grace notes. + lastch = None + in_grace = 0 + for c in self.chords: + if c.grace and (lastch is None or (not lastch.grace)): + c.chord_prefix = r'\grace {' + c.chord_prefix + in_grace = 1 + elif not c.grace and lastch and lastch.grace: + lastch.chord_suffix = lastch.chord_suffix + ' } ' + in_grace = 0 + + lastch = c + + if lastch and in_grace: + lastch.chord_suffix += '}' + + def dump(self): + str = '%% FR(%d)\n' % self.number + left = self.measure.global_measure.length() + + ln = '' + for c in self.chords: + add = c.ly_string() + ' ' + if len(ln) + len(add) > 72: + str = str + ln + '\n' + ln = '' + ln = ln + add + left = rat_subtract(left, c.length()) + + str = str + ln + + if left[0] < 0: + sys.stderr.write("""\nHuh? Going backwards in frame no %d, start/end (%d,%d)""" % + (self.number, self.start, self.end)) + left = (0, 1) + if left[0]: + str = str + rational_to_lily_skip(left) + + str = str + ' |\n' + return str + + +def encodeint(i): + return chr(i + ord('A')) + + +class Staff: + def __init__(self, number): + self.number = number + self.measures = [] + + def get_measure(self, no): + fill_list_to(self.measures, no) + + if self.measures[no] is None: + m = Measure(no) + self.measures[no] = m + m.staff = self + + return self.measures[no] + + def staffid(self): + return 'staff' + encodeint(self.number - 1) + + def layerid(self, l): + return self.staffid() + 'layer%s' % chr(l - 1 + ord('A')) + + def dump_time_key_sigs(self): + k = '' + last_key = None + last_time = None + last_clef = None + gap = (0, 1) + for m in self.measures[1:]: + if not m or not m.valid: + continue # ugh. + + g = m.global_measure + e = '' + + if g: + if g.key_signature and not g.key_signature.equal(last_key): + pitch = g.key_signature.pitch + e = e + "\\key %s %s " % (lily_notename(pitch), + g.key_signature.signature_type()) + + last_key = g.key_signature + if last_time != g.timesig: + e = e + "\\time %d/%d " % g.timesig + last_time = g.timesig + + if 'start' in g.repeats: + e = e + ' \\bar ".|:" ' + + # we don't attempt voltas since they fail easily. + if 0: # and g.repeat_bar == '|:' or g.repeat_bar == ':|:' or g.bracket: + strs = [] + if g.repeat_bar == '|:' or g.repeat_bar == ':|:' or g.bracket == 'end': + strs.append('#f') + + if g.bracket == 'start': + strs.append('"0."') + + str = ' '.join(['(volta %s)' % x for x in strs]) + + e = e + ' \\set Score.repeatCommands = #\'(%s) ' % str + + if g.force_break: + e = e + ' \\break ' + + if last_clef != m.clef: + e = e + '\\clef "%s"' % lily_clef(m.clef) + last_clef = m.clef + if e: + if gap != (0, 1): + k = k + ' ' + rational_to_lily_skip(gap) + '\n' + gap = (0, 1) + k = k + e + + if g: + gap = rat_add(gap, g.length()) + if 'stop' in g.repeats: + k = k + ' \\bar ":|." ' + + k = '%sglobal = { %s }\n\n ' % (self.staffid(), k) + return k + + def dump(self): + str = '' + + layerids = [] + for x in range(1, 5): # 4 layers. + laystr = '' + last_frame = None + first_frame = None + gap = (0, 1) + for m in self.measures[1:]: + if not m or not m.valid: + sys.stderr.write( + "Skipping non-existant or invalid measure\n") + continue + + fr = None + try: + fr = m.frames[x] + except IndexError: + sys.stderr.write("Skipping nonexistent frame %d\n" % x) + laystr = laystr + \ + "%% non existent frame %d (skipped)\n" % x + if fr: + first_frame = fr + if gap != (0, 1): + laystr = laystr + \ + '} %s {\n ' % rational_to_lily_skip(gap) + gap = (0, 1) + laystr = laystr + fr.dump() + else: + if m.global_measure: + gap = rat_add(gap, m.global_measure.length()) + else: + sys.stderr.write( + "No global measure for staff %d measure %d\n" + % (self.number, m.number)) + if first_frame: + l = self.layerid(x) + laystr = '%s = { { %s } }\n\n' % (l, laystr) + str = str + laystr + layerids.append(l) + + str = str + self.dump_time_key_sigs() + stafdef = '\\%sglobal' % self.staffid() + for i in layerids: + stafdef = stafdef + ' \\' + i + + str = str + '%s = \\context Staff = %s <<\n %s\n >>\n' % \ + (self.staffid(), self.staffid(), stafdef) + return str + + +def ziplist(l): + if len(l) < 2: + return [] + else: + return [(l[0], l[1])] + ziplist(l[2:]) + + +class Chord: + def __init__(self, number, contents): + self.pitches = [] + self.frame = None + self.finale = contents[:7] + + self.notelist = ziplist(contents[7:]) + self.duration = None + self.next = None + self.prev = None + self.number = number + self.note_prefix = '' + self.note_suffix = '' + self.chord_suffix = '' + self.chord_prefix = '' + self.tuplet = None + self.grace = 0 + + def measure(self): + if not self.frame: + return None + return self.frame.measure + + def length(self): + if self.grace: + return (0, 1) + + l = (1, self.duration[0]) + + d = 1 << self.duration[1] + + dotfact = rat_subtract((2, 1), (1, d)) + mylen = rat_multiply(dotfact, l) + + if self.tuplet: + mylen = rat_multiply(mylen, self.tuplet.factor()) + return mylen + + def EDU_duration(self): + return self.finale[2] + + def set_duration(self): + self.duration = EDU_to_duration(self.EDU_duration()) + + def calculate(self): + self.find_realpitch() + self.set_duration() + + flag = self.finale[4] + if Chord.GRACE_MASK & flag: + self.grace = 1 + + def find_realpitch(self): + + meas = self.measure() + tiestart = 0 + if not meas or not meas.global_measure: + sys.stderr.write('note %d not in measure\n' % self.number) + elif not meas.global_measure.scale: + sys.stderr.write( + 'note %d: no scale in this measure.' % self.number) + else: + + for p in self.notelist: + (pitch, flag) = p + + nib1 = pitch & 0x0f + + if nib1 > 8: + nib1 = -(nib1 - 8) + rest = pitch / 16 + + scale = meas.global_measure.scale + (sn, sa) = scale[rest % 7] + sn = sn + (rest - (rest % 7)) + 7 + acc = sa + nib1 + self.pitches.append((sn, acc)) + tiestart = tiestart or (flag & Chord.TIE_START_MASK) + if tiestart: + self.chord_suffix = self.chord_suffix + ' ~ ' + + REST_MASK = 0x40000000 + TIE_START_MASK = 0x40000000 + GRACE_MASK = 0x00800000 + + def ly_string(self): + s = '' + + rest = '' + + if not (self.finale[4] & Chord.REST_MASK): + rest = 'r' + + for p in self.pitches: + (n, a) = p + o = n / 7 + n = n % 7 + + nn = lily_notename((n, a)) + + if o < 0: + nn = nn + (',' * -o) + elif o > 0: + nn = nn + ('\'' * o) + + if s: + s = s + ' ' + + if rest: + nn = rest + + s = s + nn + + if not self.pitches: + s = 'r' + if len(self.pitches) > 1: + s = '<%s>' % s + + s = s + '%d%s' % (self.duration[0], '.' * self.duration[1]) + s = self.note_prefix + s + self.note_suffix + + s = self.chord_prefix + s + self.chord_suffix + + return s + + +def fill_list_to(list, no): + """ +Add None to LIST until it contains entry number NO. + """ + while len(list) <= no: + list.extend([None] * (no - len(list) + 1)) + return list + + +def read_finale_value(str): + """ +Pry off one value from STR. The value may be $hex, decimal, or "string". +Return: (value, rest-of-STR) + """ + while str and str[0] in ' \t\n': + str = str[1:] + + if not str: + return (None, str) + + if str[0] == '$': + str = str[1:] + + hex = '' + while str and str[0] in '0123456789ABCDEF': + hex = hex + str[0] + str = str[1:] + + return (int(hex, 16), str) + elif str[0] == '"': + str = str[1:] + s = '' + while str and str[0] != '"': + s = s + str[0] + str = str[1:] + + return (s, str) + elif str[0] in '-0123456789': + dec = '' + while str and str[0] in '-0123456789': + dec = dec + str[0] + str = str[1:] + + return (int(dec), str) + else: + sys.stderr.write("cannot convert `%s'\n" % str) + return (None, str) + + +def parse_etf_file(fn, tag_dict): + """ Read FN, putting ETF info into + a giant dictionary. The keys of TAG_DICT indicate which tags + to put into the dict. + """ + + sys.stderr.write('parsing ... ') + f = open(fn, encoding='utf-8') + + gulp = re.sub('[\n\r]+', '\n', f.read()) + ls = gulp.split('\n^') + + etf_file_dict = {} + for k in tag_dict: + etf_file_dict[k] = {} + + last_tag = None + last_numbers = None + + for l in ls: + m = re.match(r'^([a-zA-Z0-9&]+)\(([^)]+)\)', l) + if m and m.group(1) in tag_dict: + tag = m.group(1) + + indices = tuple([int(s) for s in m.group(2).split(',')]) + content = l[m.end(2)+1:] + + tdict = etf_file_dict[tag] + if indices not in tdict: + tdict[indices] = [] + + parsed = [] + + if tag == 'verse' or tag == 'block': + m2 = re.match(r'(.*)\^end', content) + if m2: + parsed = [m2.group(1)] + else: + while content: + (v, content) = read_finale_value(content) + if v is not None: + parsed.append(v) + + tdict[indices].extend(parsed) + + last_indices = indices + last_tag = tag + + continue + +# let's not do this: this really confuses when eE happens to be before a ^text. +# if last_tag and last_indices: +# etf_file_dict[last_tag][last_indices].append (l) + + sys.stderr.write('\n') + return etf_file_dict + + +class Etf_file: + def __init__(self, name): + self.measures = [None] + self.chords = [None] + self.frames = [None] + self.tuplets = [None] + self.staffs = [None] + self.slurs = [None] + self.articulations = [None] + self.syllables = [None] + self.verses = [None] + self.articulation_defs = [None] + + # do it + self.parse(name) + + def get_global_measure(self, no): + fill_list_to(self.measures, no) + if self.measures[no] is None: + self.measures[no] = Global_measure(no) + + return self.measures[no] + + def get_staff(self, staffno): + fill_list_to(self.staffs, staffno) + if self.staffs[staffno] is None: + self.staffs[staffno] = Staff(staffno) + + return self.staffs[staffno] + + # staff-spec + def try_IS(self, indices, contents): + pass + + def try_BC(self, indices, contents): + bn = indices[0] + where = contents[0] / 1024.0 + + def try_TP(self, indices, contents): + (nil, num) = indices + + if self.tuplets[-1] is None or num != self.tuplets[-1].start_note: + self.tuplets.append(Tuplet(num)) + + self.tuplets[-1].append_finale(contents) + + def try_IM(self, indices, contents): + (a, b) = indices + fin = contents + self.articulations.append(Articulation(a, b, fin)) + + def try_verse(self, indices, contents): + a = indices[0] + body = contents[0] + + body = re.sub(r"""\^[a-z]+\([^)]+\)""", "", body) + body = re.sub(r"\^[a-z]+", "", body) + self.verses.append(Verse(a, body)) + + def try_ve(self, indices, contents): + (a, b) = indices + self.syllables.append(Syllable(a, b, contents)) + + def try_eE(self, indices, contents): + no = indices[0] + (prev, next, dur, pos, entryflag, extended, follow) = contents[:7] + + fill_list_to(self.chords, no) + self.chords[no] = Chord(no, contents) + + def try_Sx(self, indices, contents): + slurno = indices[0] + fill_list_to(self.slurs, slurno) + self.slurs[slurno] = Slur(slurno, contents) + + def try_IX(self, indices, contents): + n = indices[0] + a = contents[0] + b = contents[1] + + ix = None + try: + ix = self.articulation_defs[n] + except IndexError: + ix = Articulation_def(n, a, b) + self.articulation_defs.append(Articulation_def(n, a, b)) + + def try_GF(self, indices, contents): + (staffno, measno) = indices + + st = self.get_staff(staffno) + meas = st.get_measure(measno) + meas.finale = contents + + def try_FR(self, indices, contents): + frameno = indices[0] + + startnote = contents[0] + endnote = contents[1] + + fill_list_to(self.frames, frameno) + + self.frames[frameno] = Frame((frameno, startnote, endnote)) + + def try_MS(self, indices, contents): + measno = indices[0] + keynum = contents[1] + meas = self. get_global_measure(measno) + + meas.set_key_sig(keynum) + + beats = contents[2] + beatlen = contents[3] + meas.set_timesig((beats, beatlen)) + + meas_flag1 = contents[4] + meas_flag2 = contents[5] + + meas.set_flags(meas_flag1, meas_flag2) + + routine_dict = { + 'MS': try_MS, + 'FR': try_FR, + 'GF': try_GF, + 'IX': try_IX, + 'Sx': try_Sx, + 'eE': try_eE, + 'verse': try_verse, + 've': try_ve, + 'IM': try_IM, + 'TP': try_TP, + 'BC': try_BC, + 'IS': try_IS, + } + + def parse(self, etf_dict): + sys.stderr.write('reconstructing ...') + sys.stderr.flush() + + for (tag, routine) in list(Etf_file.routine_dict.items()): + ks = list(etf_dict[tag].keys()) + ks.sort() + for k in ks: + routine(self, k, etf_dict[tag][k]) + + sys.stderr.write('processing ...') + sys.stderr.flush() + + self.unthread_entries() + + for st in self.staffs[1:]: + if not st: + continue + mno = 1 + for m in st.measures[1:]: + if not m: + continue + + m.calculate() + try: + m.global_measure = self.measures[mno] + except IndexError: + sys.stderr.write("Non-existent global measure %d" % mno) + continue + + frame_obj_list = [None] + for frno in m.frames: + try: + fr = self.frames[frno] + frame_obj_list.append(fr) + except IndexError: + sys.stderr.write("\nNon-existent frame %d" % frno) + + m.frames = frame_obj_list + for fr in frame_obj_list[1:]: + if not fr: + continue + + fr.set_measure(m) + + fr.chords = self.get_thread(fr.start, fr.end) + for c in fr.chords: + c.frame = fr + mno = mno + 1 + + for c in self.chords[1:]: + if c: + c.calculate() + + for f in self.frames[1:]: + if f: + f.calculate() + + for t in self.tuplets[1:]: + t.calculate(self.chords) + + for s in self.slurs[1:]: + if s: + s.calculate(self.chords) + + for s in self.articulations[1:]: + s.calculate(self.chords, self.articulation_defs) + + def get_thread(self, startno, endno): + + thread = [] + + c = None + try: + c = self.chords[startno] + except IndexError: + sys.stderr.write( + "Huh? Frame has invalid bounds (%d,%d)\n" % (startno, endno)) + return [] + + while c and c.number != endno: + d = c # hack to avoid problem with scripts/build/grand-replace.py + thread.append(d) + c = c.__next__ + + if c: + d = c # hack to avoid problem with scripts/build/grand-replace.py + thread.append(d) + + return thread + + def dump(self): + str = '' + staffs = [] + for s in self.staffs[1:]: + if s: + str = str + '\n\n' + s.dump() + staffs.append('\\' + s.staffid()) + + # should use \addlyrics ? + + for v in self.verses[1:]: + str = str + v.dump() + + if len(self.verses) > 1: + sys.stderr.write( + "\nLyrics found; edit to use \\addlyrics to couple to a staff\n") + + if staffs: + str += '\\version "2.3.25"\n' + str = str + '<<\n %s\n>> } ' % ' '.join(staffs) + + return str + + def __str__(self): + return 'ETF FILE %s %s' % (self.measures, self.entries) + + def unthread_entries(self): + for e in self.chords[1:]: + if not e: + continue + + e.prev = self.chords[e.finale[0]] + e.next = self.chords[e.finale[1]] + + +def identify(): + sys.stderr.write("%s from LilyPond %s\n" % (ly.program_name, version)) + + +def warranty(): + identify() + sys.stdout.write(''' +%s + + %s + +%s +%s +''' % (_('Copyright (c) %s by') % '2001--2023', + '\n '.join(authors), + _('Distributed under terms of the GNU General Public License.'), + _('It comes with NO WARRANTY.'))) + + +def get_option_parser(): + p = ly.get_option_parser(usage=_("%s [OPTION]... ETF-FILE") % 'etf2ly', + description=_("""Enigma Transport Format is a format used by Coda Music Technology's +Finale product. etf2ly converts a subset of ETF to a ready-to-use LilyPond file. +"""), + add_help_option=False) + p.add_option("-h", "--help", + action="help", + help=_("show this help and exit")) + p.version = "etf2ly (LilyPond) 2.24.2" + p.add_option("--version", + action="version", + help=_("show version number and exit")) + p.add_option('-o', '--output', help=_("write output to FILE"), + metavar=_("FILE"), + action='store') + p.add_option('-w', '--warranty', help=_("show warranty and copyright"), + action='store_true', + ), + + p.add_option_group('', + description=( + _('Report bugs via %s') + % 'bug-lilypond@gnu.org') + '\n') + return p + + +def do_options(): + opt_parser = get_option_parser() + (options, args) = opt_parser.parse_args() + if options.warranty: + warranty() + sys.exit(0) + + return (options, args) + + +(options, files) = do_options() +identify() + +out_filename = options.output + +e = None +for f in files: + if f == '-': + f = '' + + sys.stderr.write('Processing `%s\'\n' % f) + + dict = parse_etf_file(f, Etf_file.routine_dict) + e = Etf_file(dict) + if not out_filename: + out_filename = os.path.basename(re.sub('(?i).etf$', '.ly', f)) + + if out_filename == f: + out_filename = os.path.basename(f + '.ly') + + sys.stderr.write('Writing `%s\'' % out_filename) + ly = e.dump() + + fo = open(out_filename, 'w', encoding='utf-8') + fo.write('%% lily was here -- automatically converted by etf2ly from %s\n' % f) + fo.write(ly) + fo.close() diff --git a/lilypond-2.24.2/bin/gspawn-win64-helper-console.exe b/lilypond-2.24.2/bin/gspawn-win64-helper-console.exe new file mode 100644 index 0000000000000000000000000000000000000000..c6c98d2217d4c167db2b7d8006dac3a448902d32 Binary files /dev/null and b/lilypond-2.24.2/bin/gspawn-win64-helper-console.exe differ diff --git a/lilypond-2.24.2/bin/libgio-2.0-0.dll b/lilypond-2.24.2/bin/libgio-2.0-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..a13f865f78955200456488b0e437b3fbd5101385 --- /dev/null +++ b/lilypond-2.24.2/bin/libgio-2.0-0.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16b31008c66821844d6724b81026f8be75d5e25fe52c4489f48ea014a2963eca +size 1873408 diff --git a/lilypond-2.24.2/bin/libglib-2.0-0.dll b/lilypond-2.24.2/bin/libglib-2.0-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..b881355928a4b4b6dbead802332d5c5190b3fbd4 --- /dev/null +++ b/lilypond-2.24.2/bin/libglib-2.0-0.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:176680ef7e5e080f726cf86f7e776a0c13c3fd79f2acd1c11a98f78f6c4264cc +size 1611264 diff --git a/lilypond-2.24.2/bin/libgmodule-2.0-0.dll b/lilypond-2.24.2/bin/libgmodule-2.0-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..6d1efcea45529f6b1441ae71d6a5e8f8afc172bd Binary files /dev/null and b/lilypond-2.24.2/bin/libgmodule-2.0-0.dll differ diff --git a/lilypond-2.24.2/bin/libgobject-2.0-0.dll b/lilypond-2.24.2/bin/libgobject-2.0-0.dll new file mode 100644 index 0000000000000000000000000000000000000000..b378faa4352b05086a65d8fcf157845df36513ae Binary files /dev/null and b/lilypond-2.24.2/bin/libgobject-2.0-0.dll differ diff --git a/lilypond-2.24.2/bin/libintl-8.dll b/lilypond-2.24.2/bin/libintl-8.dll new file mode 100644 index 0000000000000000000000000000000000000000..a71e9c73aa82be12ba530e5a2e64a97b29401cac Binary files /dev/null and b/lilypond-2.24.2/bin/libintl-8.dll differ diff --git a/lilypond-2.24.2/bin/lilymidi.py b/lilypond-2.24.2/bin/lilymidi.py new file mode 100644 index 0000000000000000000000000000000000000000..e7f5b27d78df00116483dcf9e02b70edb6732fde --- /dev/null +++ b/lilypond-2.24.2/bin/lilymidi.py @@ -0,0 +1,304 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 + +# Copyright (C) 2006--2022 Brailcom, o.p.s. +# +# Author: Milan Zamazal +# +# This file is part of LilyPond, the GNU music typesetter. +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + +import optparse +import os +import sys + +""" + +# relocate-preamble.py.in +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2007--2022 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . +# + +This is generic code, used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +# This is needed for installations with a non-default layout, ie where share/ +# is not next to bin/. +sys.path.insert (0, os.path.join ('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/lilypond/2.24.2', 'python')) + +# Dynamic relocation, for installations with a default layout including GUB, +# but also for execution from the build directory. +bindir = os.path.abspath (os.path.dirname (sys.argv[0])) +topdir = os.path.dirname (bindir) +if bindir.endswith (r'/scripts/out'): + topdir = os.path.join (os.path.dirname (topdir), 'out') +datadir = os.path.abspath (os.path.join (topdir, 'share', 'lilypond')) +for v in [ 'current', '2.24.2' ]: + sys.path.insert (0, os.path.join (datadir, v, 'python')) + +""" +""" + + +def process_options(args): + parser = optparse.OptionParser(version="2.24.2") + parser.add_option('', '--filter-tracks', metavar='REGEXP', action='store', type='string', dest='regexp', + help="display only tracks numbers, of those track names matching REGEXP") + parser.add_option('', '--prefix-tracks', metavar='PREFIX', action='store', type='string', dest='prefix', + help="prefix filtered track numbers with PREFIX") + parser.add_option('', '--dump', action='store_true', dest='dump', + help="just dump parsed contents of the MIDI file") + parser.add_option('', '--pretty', action='store_true', dest='pretty', + help="dump parsed contents of the MIDI file in human-readable form (implies --dump)") + parser.usage = parser.usage + " FILE" + options, args = parser.parse_args(args) + if len(args) != 1: + parser.print_help() + sys.exit(2) + return options, args + + +def read_midi(file): + import midi + return midi.parse(open(file, 'rb').read()) + + +def track_info(data): + tracks = data[1] + + def track_name(track): + name = '' + for time, event in track: + if time > 0: + break + if event[0] == 255 and event[1] == 3: + name = event[2] + break + return name + track_info = [] + for i in range(len(tracks)): + track_info.append((i, track_name(tracks[i]))) + return track_info + + +class formatter: + def __init__(self, txt=""): + self.text = txt + + def format_vals(self, val1, val2=""): + return str(val1) + str(val2) + + def format(self, val1, val2=""): + return self.text + self.format_vals(val1, val2) + + +class none_formatter (formatter): + def format_vals(self, val1, val2=""): + return '' + + +class meta_formatter (formatter): + def format_vals(self, val1, val2): + return str(val2) + + +class tempo_formatter (formatter): + def format_vals(self, val1, val2): + return str(ord(val2[0])*65536 + ord(val2[1])*256 + ord(val2[2])) \ + + " msec/quarter" + + +class time_signature_formatter (formatter): + def format_vals(self, val1, val2=""): + from fractions import Fraction + # if there are more notated 32nd notes per midi quarter than 8, + # we display a fraction smaller than 1 as scale factor. + r = Fraction(8, ord(val2[3])) + if r == 1: + ratio = "" + else: + ratio = " *" + str(r) + return str(ord(val2[0])) + "/" + str(1 << ord(val2[1])) + ratio \ + + ", metronome " + str(Fraction(ord(val2[2]), 96)) + + +class key_signature_formatter (formatter): + def format_vals(self, val1, val2): + key_names = ['F', 'C', 'G', 'D', 'A', 'E', 'B'] + key = (((ord(val2[0])+128) % 256)-128) + ord(val2[1])*3 + 1 + return (key_names[key % 7] + (key//7) * "is" + (-(key//7)) * "es" + + " " + ['major', 'minor'][ord(val2[1])]) + + +class channel_formatter (formatter): + def __init__(self, txt, ch): + formatter.__init__(self, txt) + self.channel = ch + + def format(self, val1, val2=""): + return self.text + "Channel " + str(self.channel) + ", " + \ + self.format_vals(val1, val2) + + +class control_mode_formatter (formatter): + def __init__(self, txt, ch): + formatter.__init__(self, txt) + self.mode = ch + + def format(self, val1, val2=""): + return self.text + str(self.mode) + ", " + \ + self.format_vals(val1, val2) + + +class note_formatter (channel_formatter): + def pitch(self, val): + pitch_names = ['C', 'Cis', 'D', 'Dis', 'E', + 'F', 'Fis', 'G', 'Gis', 'A', 'Ais', 'B'] + p = val % 12 + oct = val // 12 - 1 + return pitch_names[p] + str(oct) + "(" + str(val) + ")" + + def velocity(self, val): + return str(val) + + def format_vals(self, val1, val2): + if val2 > 0: + return self.pitch(val1) + '@' + self.velocity(val2) + return self.pitch(val1) + + +meta_dict = {0x00: meta_formatter("Seq.Nr.: "), + 0x01: meta_formatter("Text: "), + 0x02: meta_formatter("Copyright: "), + 0x03: meta_formatter("Track name: "), + 0x04: meta_formatter("Instrument: "), + 0x05: meta_formatter("Lyric: "), + 0x06: meta_formatter("Marker: "), + 0x07: meta_formatter("Cue point: "), + 0x2F: none_formatter("End of Track"), + 0x51: tempo_formatter("Tempo: "), + 0x54: meta_formatter("SMPTE Offs.:"), + 0x58: time_signature_formatter("Time signature: "), + 0x59: key_signature_formatter("Key signature: ") + } + + +def dump_event(ev, time, padding): + ch = ev[0] & 0x0F + func = ev[0] & 0xF0 + f = None + if ev[0] == 0xFF: + f = meta_dict.get(ev[1], formatter()) + if func == 0x80: + f = note_formatter("Note off: ", ch) + elif func == 0x90: + if ev[2] == 0: + desc = "Note off: " + else: + desc = "Note on: " + f = note_formatter(desc, ch) + elif func == 0xA0: + f = note_formatter("Polyphonic aftertouch: ", + ch, "Aftertouch pressure: ") + elif func == 0xB0: + f = control_mode_formatter("Control mode change: ", ch) + elif func == 0xC0: + f = channel_formatter("Program Change: ", ch) + elif func == 0xD0: + f = channel_formatter("Channel aftertouch: ", ch) + elif ev[0] in [0xF0, 0xF7]: + f = meta_formatter("System-exclusive event: ") + + if f: + if len(ev) > 2: + print(padding + f.format(ev[1], ev[2])) + elif len(ev) > 1: + print(padding + f.format(ev[1])) + else: + print(padding + f.format()) + else: + print(padding + "Unrecognized MIDI event: " + str(ev)) + + +def dump_midi(data, midi_file, options): + if not options.pretty: + print(data) + return + # First, dump general info, #tracks, etc. + print("Filename: " + midi_file) + i = data[0] + m_formats = {0: 'single multi-channel track', + 1: "one or more simultaneous tracks", + 2: "one or more sequentially independent single-track patterns"} + print("MIDI format: " + str(i[0]) + " (" + m_formats.get(i[0], "") + ")") + print("Divisions: " + str(i[1]) + " per whole note") + print("#Tracks: " + str(len(data[1]))) + n = 0 + for tr in data[1]: + time = 0 + n += 1 + print() + print("Track " + str(n) + ":") + print(" Time 0:") + for ev in tr: + if ev[0] > time: + time = ev[0] + print(" Time " + str(time) + ": ") + dump_event(ev[1], time, " ") + + +def go(): + options, args = process_options(sys.argv[1:]) + midi_file = args[0] + midi_data = read_midi(midi_file) + info = track_info(midi_data) + if (options.dump or options.pretty): + dump_midi(midi_data, midi_file, options) + elif options.regexp: + import re + regexp = re.compile(options.regexp) + numbers = [str(n+1) for n, name in info if regexp.search(name)] + if numbers: + if options.prefix: + sys.stdout.write('%s ' % (options.prefix,)) + sys.stdout.write(','.join(numbers)) + sys.stdout.write('\n') + else: + for n, name in info: + sys.stdout.write('%d %s\n' % (n+1, name,)) + + +if __name__ == '__main__': + go() diff --git a/lilypond-2.24.2/bin/lilypond-book.py b/lilypond-2.24.2/bin/lilypond-book.py new file mode 100644 index 0000000000000000000000000000000000000000..6418b0b6c5b8242839c0904ffa3de8191a3ab2c9 --- /dev/null +++ b/lilypond-2.24.2/bin/lilypond-book.py @@ -0,0 +1,790 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 +# -*- coding: utf-8 -*- + +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 1998--2022 Han-Wen Nienhuys +# Jan Nieuwenhuizen +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + +r''' +Example usage: + +test: + lilypond-book --filter="tr '[a-z]' '[A-Z]'" BOOK + +convert-ly on book: + lilypond-book --filter="convert-ly --no-version --from=1.6.11 -" BOOK + +classic lilypond-book: + lilypond-book --process="lilypond" BOOK.tely + +TODO: + + * ly-options: intertext? + * --line-width? + * eps in latex / eps by lilypond -b ps? + * check latex parameters, twocolumn, multicolumn? + * use --png --ps --pdf for making images? + + * Converting from lilypond-book source, substitute: + @mbinclude foo.itely -> @include foo.itely + \mbinput -> \input + +''' + + +# TODO: Better solve the global_options copying to the snippets... + +import gettext +import glob +import hashlib +from optparse import OptionGroup, SUPPRESS_HELP +import os +import re +import shlex +import stat +import subprocess +import sys +import tempfile +import typing + +# See lock_path and unlock_path; this module is not available at all on Windows. +if os.name == 'posix': + import fcntl + +""" + +# relocate-preamble.py.in +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2007--2022 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . +# + +This is generic code, used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +# This is needed for installations with a non-default layout, ie where share/ +# is not next to bin/. +sys.path.insert (0, os.path.join ('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/lilypond/2.24.2', 'python')) + +# Dynamic relocation, for installations with a default layout including GUB, +# but also for execution from the build directory. +bindir = os.path.abspath (os.path.dirname (sys.argv[0])) +topdir = os.path.dirname (bindir) +if bindir.endswith (r'/scripts/out'): + topdir = os.path.join (os.path.dirname (topdir), 'out') +datadir = os.path.abspath (os.path.join (topdir, 'share', 'lilypond')) +for v in [ 'current', '2.24.2' ]: + sys.path.insert (0, os.path.join (datadir, v, 'python')) + +""" +""" + +import book_base +import book_docbook +import book_html +import book_latex +import book_texinfo +import book_snippets + +# Load translation and install _() into Python's builtins namespace. +gettext.install('lilypond', '/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/locale') + +import lilylib as ly + +backend = 'ps' + +help_summary = ( + _("Process LilyPond snippets in hybrid HTML, LaTeX, texinfo or DocBook document.") + + '\n\n' + + _("Examples:") + + ''' + $ lilypond-book --filter="tr '[a-z]' '[A-Z]'" %(BOOK)s + $ lilypond-book -F "convert-ly --no-version --from=2.0.0 -" %(BOOK)s + $ lilypond-book --process='lilypond -I include' %(BOOK)s +''' % {'BOOK': _("BOOK")}) + +authors = ('Jan Nieuwenhuizen ', + 'Han-Wen Nienhuys ') + +################################################################ + + +def exit(i): + if ly.is_verbose(): + raise Exception(_('Exiting (%d)...') % i) + else: + sys.exit(i) + + +progress = ly.progress +warning = ly.warning +error = ly.error + +program_version = '2.24.2' +if program_version.startswith("@"): + # '@' in lilypond-book output confuses texinfo + program_version = "dev" + + +def identify(): + progress('%s (GNU LilyPond) %s' % (ly.program_name, program_version)) + + +def warranty(): + identify() + sys.stdout.write(''' +%s + + %s + +%s +%s +''' % (_('Copyright (c) %s by') % '2001--2023', + '\n '.join(authors), + _("Distributed under terms of the GNU General Public License."), + _("It comes with NO WARRANTY."))) + + +def get_option_parser(): + p = ly.get_option_parser(usage=_("%s [OPTION]... FILE") % 'lilypond-book', + description=help_summary, + conflict_handler="resolve", + add_help_option=False) + + p.add_option('-F', '--filter', + help=_("pipe snippets through FILTER " + "[default: `convert-ly -n -']"), + metavar=_("FILTER"), + action="store", + dest="filter_cmd", + default=None) + + p.add_option('-f', '--format', + help=_("use output format FORMAT (texi [default], " + "texi-html, latex, html, docbook)"), + metavar=_("FORMAT"), + action='store') + + p.add_option("-h", "--help", + action="help", + help=_("show this help and exit")) + + # Turn on syntax highlighting using vendored Pygments + # when building the main documentation. Purposefully + # undocumented, it is not for end users. + p.add_option("--highlight", + action="store_true", + help=SUPPRESS_HELP) + + p.add_option("-I", '--include', + help=_("add DIR to include path"), + metavar=_("DIR"), + action='append', + dest='include_path', + default=[]) + + p.add_option('--info-images-dir', + help=_("format Texinfo output so that Info will " + "look for images of music in DIR"), + metavar=_("DIR"), + action='store', + dest='info_images_dir', + default='') + + p.add_option('--left-padding', + help=_("pad left side of music to align music in spite " + "of uneven bar numbers (in mm) [default: %default]"), + metavar=_("PAD"), + dest="padding_mm", + type="float", + default=3.0) + + p.add_option('--lily-loglevel', + help=_("print lilypond log messages according to LOGLEVEL " + "[default: %default]"), + metavar=_("LOGLEVEL"), + action='store', + dest='lily_loglevel', + default=os.environ.get("LILYPOND_LOGLEVEL", None)) + + p.add_option('--lily-output-dir', + help=_("write lily-XXX files to DIR, " + "link into --output dir"), + metavar=_("DIR"), + action='store', + dest='lily_output_dir', + default=None) + + p.add_option("-l", "--loglevel", + help=_("print log messages according to LOGLEVEL " + "(NONE, ERROR, WARNING, PROGRESS [default], DEBUG)"), + metavar=_("LOGLEVEL"), + action='callback', + callback=ly.handle_loglevel_option, + type='string') + + p.add_option("-o", '--output', + help=_("write output to DIR"), + metavar=_("DIR"), + action='store', + dest='output_dir', + default='') + + p.add_option('-P', '--process', + help=_("process ly_files using COMMAND FILE..."), + metavar=_("COMMAND"), + action='store', + dest='process_cmd', + default='') + + p.add_option('--redirect-lilypond-output', + help=_("redirect the lilypond output"), + action='store_true', + dest='redirect_output', + default=False) + + p.add_option('-s', '--safe', + help=_("removed; using this option results in an error"), + action="store_true", + dest="safe_mode", + default=False) + + p.add_option('--skip-lily-check', + help=_("do not fail if no lilypond output is found"), + metavar=_("DIR"), + action='store_true', + dest='skip_lilypond_run', + default=False) + + p.add_option('--skip-png-check', + help=_("do not fail if no PNG images " + "are found for EPS files"), + metavar=_("DIR"), + action='store_true', + dest='skip_png_check', + default=False) + + p.add_option('--use-source-file-names', + help=_("write snippet output files with the same " + "base name as their source file"), + action='store_true', + dest='use_source_file_names', + default=False) + + p.add_option('-V', '--verbose', + help=_("be verbose"), + action="callback", + callback=ly.handle_loglevel_option, + callback_args=("DEBUG",)) + + p.version = "2.24.2" + p.add_option("--version", + help=_("show version number and exit"), + action="version") + + p.add_option('-w', '--warranty', + help=_("show warranty and copyright"), + action='store_true') + + group = OptionGroup(p, "Options only for the latex and texinfo backends") + group.add_option('--latex-program', + help=_("run executable PROG instead of latex or, " + "in case --pdf option is set, " + "instead of pdflatex"), + metavar=_("PROG"), + action='store', + dest='latex_program', + default='latex') + group.add_option('--texinfo-program', + help=_("run executable PROG instead of texi2pdf"), + metavar=_("PROG"), + action='store', + dest='texinfo_program', + default='texi2pdf') + group.add_option('--pdf', + help=_("create PDF files for use with pdftex"), + action="store_true", + dest="create_pdf", + default=False) + p.add_option_group(group) + + p.add_option_group('', + description=( + _("Report bugs via %s") + % 'bug-lilypond@gnu.org') + '\n') + + for formatter in book_base.all_formats: + formatter.add_options(p) + + return p + + +lilypond_binary = os.path.join('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/bin', 'lilypond') + +# If we are called with full path, try to use lilypond binary +# installed in the same path; this is needed in GUB binaries, where +# @bindir is always different from the installed binary path. +if 'bindir' in globals() and bindir: + lilypond_binary = os.path.join(bindir, 'lilypond') + +# Only use installed binary when we are installed too. +if '/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/bin' == ('@' + 'bindir@') or not os.path.exists(lilypond_binary): + lilypond_binary = 'lilypond' + +# Need to shell-quote, issue 3468 +# FIXME: we should really pass argument lists +# everywhere instead of playing with shell syntax. +lilypond_binary = shlex.quote(lilypond_binary) + +global_options = None + + +def command_name(cmd): + # Strip all stuf after command, + # deal with "((latex ) >& 1 ) .." too + cmd = re.match(r'([\(\)]*)([^\\ ]*)', cmd).group(2) + return os.path.basename(cmd) + + +def system_in_directory(cmd_str, directory, log_file): + """Execute a command in a different directory.""" + + if ly.is_verbose(): + ly.progress(_("Invoking `%s\'") % cmd_str) + elif global_options.redirect_output: + ly.progress(_("Processing %s.ly") % log_file) + else: + name = command_name(cmd_str) + ly.progress(_("Running %s...") % name) + + output_location = None + if global_options.redirect_output: + output_location = open(log_file + '.log', 'w', encoding='utf-8') + + try: + subprocess.run(cmd_str, stdout=output_location, + stderr=output_location, cwd=directory, + shell=True, check=True) + except subprocess.CalledProcessError as e: + sys.stderr.write("%s\n" % e) + sys.exit(1) + + +def process_snippets(cmd, outdated_dict, + formatter, lily_output_dir): + """Run cmd on all of the .ly files from snippets.""" + basenames = sorted(outdated_dict.keys()) + + # No need for a secure hash function, just need a digest. + checksum = hashlib.md5() + for name in basenames: + checksum.update(name.encode('ascii')) + checksum = checksum.hexdigest() + + lily_output_dir = global_options.lily_output_dir + + # Write list of snippet names. + snippet_names_file = 'snippet-names-%s.ly' % checksum + snippet_names_path = os.path.join(lily_output_dir, snippet_names_file) + with open(snippet_names_path, 'w', encoding='utf-8') as snippet_names: + snippet_names.write('\n'.join([name + '.ly' for name in basenames])) + + # Run command. + cmd = formatter.adjust_snippet_command(cmd) + # Remove .ly ending. + logfile = os.path.splitext(snippet_names_path)[0] + snippet_names_arg = mkarg(snippet_names_path.replace(os.path.sep, '/')) + system_in_directory(' '.join([cmd, snippet_names_arg]), + lily_output_dir, + logfile) + os.unlink(snippet_names_path) + + +def lock_path(name): + if os.name != 'posix': + return None + + fp = open(name, 'w', encoding='utf-8') + fcntl.lockf(fp, fcntl.LOCK_EX) + return fp + + +def unlock_path(lock): + if os.name != 'posix': + return None + fcntl.lockf(lock, fcntl.LOCK_UN) + lock.close() + + +def do_process_cmd(chunks, options): + """Wrap do_process_cmd_locked in a filesystem lock""" + snippets = [c for c in chunks if isinstance( + c, book_snippets.LilypondSnippet)] + + # calculate checksums eagerly + for s in snippets: + s.get_checksum() + + os.makedirs(options.lily_output_dir, exist_ok=True) + lock_file = os.path.join(options.lily_output_dir, "lock") + lock = None + try: + lock = lock_path(lock_file) + do_process_cmd_locked(snippets, options) + finally: + if lock: + unlock_path(lock) + + +def do_process_cmd_locked(snippets, options): + """Look at all snippets, write the outdated ones, and compile them.""" + outdated = [c for c in snippets if c.is_outdated(options.lily_output_dir)] + + if outdated: + # First unique the list based on the basename, by using them as keys + # in a dict. + outdated_dict = dict() + for snippet in outdated: + outdated_dict[snippet.basename()] = snippet + + # Next call write_ly() for each snippet once. + progress(_("Writing snippets...")) + for snippet in outdated_dict.values(): + snippet.write_ly() + + progress(_("Processing...")) + process_snippets(options.process_cmd, outdated_dict, + options.formatter, options.lily_output_dir) + + else: + progress(_("All snippets are up to date...")) + + progress(_("Linking files...")) + if options.lily_output_dir != options.output_dir: + for snippet in snippets: + snippet.link_all_output_files(options.lily_output_dir, + options.output_dir) + + +### +# Format guessing data + +def guess_format(input_filename): + format = None + e = os.path.splitext(input_filename)[1] + for formatter in book_base.all_formats: + if formatter.can_handle_extension(e): + return formatter + error(_("cannot determine format for: %s" % input_filename)) + exit(1) + +def write_if_updated(file_name, lines): + try: + with open(file_name, encoding='utf-8') as file: + old_str = file.read() + except FileNotFoundError: + pass + else: + new_str = ''.join(lines) + if old_str == new_str: + progress(_("%s is up to date.") % file_name) + + # this prevents make from always rerunning lilypond-book: + # output file must be touched in order to be up to date + os.utime(file_name, None) + return + + output_dir = os.path.dirname(file_name) + os.makedirs(output_dir, exist_ok=True) + + progress(_("Writing `%s'...") % file_name) + open(file_name, 'w', encoding='utf-8').writelines(lines) + + +def note_input_file(name, inputs=[]): + # hack: inputs is mutable! + inputs.append(name) + return inputs + + +def samefile(f1, f2): + try: + return os.path.samefile(f1, f2) + except AttributeError: # Windoze + f1 = re.sub("//*", "/", f1) + f2 = re.sub("//*", "/", f2) + return f1 == f2 + + +def do_file(input_filename, included=False): + # Ugh. + input_absname = input_filename + if not input_filename or input_filename == '-': + in_handle = sys.stdin + else: + if os.path.exists(input_filename): + input_fullname = input_filename + else: + input_fullname = global_options.formatter.input_fullname( + input_filename) + # Normalize path to absolute path, since we will change cwd to the output dir! + # Otherwise, "lilypond-book -o out test.tex" will complain that it is + # overwriting the input file (which it is actually not), since the + # input filename is relative to the CWD... + input_absname = os.path.abspath(input_fullname) + + note_input_file(input_fullname) + in_handle = open(input_fullname, 'r', encoding='utf-8') + + if input_filename == '-': + global_options.input_dir = os.getcwd() + input_base = 'stdin' + elif included: + input_base = os.path.splitext(input_filename)[0] + else: + global_options.input_dir = os.path.split(input_absname)[0] + input_base = os.path.basename( + os.path.splitext(input_filename)[0]) + + output_filename = os.path.join(global_options.output_dir, + input_base + global_options.formatter.default_extension) + if (os.path.exists(input_filename) + and os.path.exists(output_filename) + and samefile(output_filename, input_absname)): + error( + _("Output would overwrite input file; use --output.")) + exit(2) + + try: + progress(_("Reading `%s'") % input_absname) + source = in_handle.read() + + if not included: + global_options.formatter.init_default_snippet_options(source) + + progress(_("Dissecting...")) + chunks = book_base.find_toplevel_snippets( + source, global_options.formatter, global_options) + for c in chunks: + c.set_output_fullpath(output_filename) + + # Let the formatter modify the chunks before further processing + chunks = global_options.formatter.process_chunks(chunks) + + def process_include(snippet): + name = snippet.substring('filename') + progress(_("Processing include `%s'") % name) + return do_file(name, included=True) + + include_chunks = [] + for x in chunks: + if isinstance(x, book_snippets.IncludeSnippet): + include_chunks += process_include(x) + + return chunks + include_chunks + + except book_snippets.CompileError: + progress(_("Removing `%s'") % output_filename) + raise book_snippets.CompileError + + +def do_options(): + global global_options + + opt_parser = get_option_parser() + (global_options, args) = opt_parser.parse_args() + + if global_options.safe_mode: + error("""Due to security vulnerabilities deemed unfixable +by the developers, LilyPond's safe mode was removed in +version 2.23.12 in order not to provide a false sense of +security. If you need to compile an untrusted .ly file, please +use an external tool to run LilyPond in a sandbox.""") + raise SystemExit + + global_options.information = { + 'program_version': program_version, 'program_name': ly.program_name} + + if global_options.lily_output_dir: + global_options.lily_output_dir = os.path.expanduser( + global_options.lily_output_dir) + if global_options.output_dir: + global_options.output_dir = os.path.expanduser( + global_options.output_dir) + + # Compute absolute paths of include directories. + for i, path in enumerate(global_options.include_path): + global_options.include_path[i] = os.path.abspath(path) + + # Append the current directory. + global_options.include_path.append(os.getcwd()) + + if global_options.warranty: + warranty() + exit(0) + if not args or len(args) > 1: + opt_parser.print_help() + exit(2) + + return args + + +def mkarg(x): + r""" + A modified version of the commands.mkarg(x) + + Uses double quotes (since Windows can't handle the single quotes) + and escapes the characters \, $, ", and ` for unix shells. + """ + if os.name == 'nt': + return ' "%s"' % x + s = ' "' + for c in x: + if c in '\\$"`': + s = s + '\\' + s = s + c + s = s + '"' + return s + + +def write_output_documents(chunks: typing.List[book_snippets.Chunk], is_filter: bool): + text_by_path = {} + for ch in chunks: + path = ch.output_fullpath() + if path not in text_by_path: + text_by_path[path] = [] + + if is_filter: + s = ch.filter_text() + else: + s = ch.replacement_text() + + text_by_path[path].append(s) + + for path in text_by_path: + write_if_updated(path, text_by_path[path]) + + +def main(): + if "LILYPOND_BOOK_LOGLEVEL" in os.environ: + ly.set_loglevel(os.environ["LILYPOND_BOOK_LOGLEVEL"]) + files = do_options() + + basename = os.path.splitext(files[0])[0] + basename = os.path.split(basename)[1] + + if global_options.format: + # Retrieve the formatter for the given format + for formatter in book_base.all_formats: + if formatter.can_handle_format(global_options.format): + global_options.formatter = formatter + else: + global_options.formatter = guess_format(files[0]) + global_options.format = global_options.formatter.format + + # make the global options available to the formatters: + global_options.formatter.global_options = global_options + formats = global_options.formatter.image_formats + + if global_options.process_cmd == '': + global_options.process_cmd = ( + lilypond_binary + ' --formats=%s ' % formats) + + global_options.process_cmd += ( + ' '.join([' -I %s' % mkarg(p) for p in global_options.include_path]) + + ' -daux-files ') + + global_options.formatter.process_options(global_options) + + if global_options.lily_loglevel: + ly.debug_output(_("Setting LilyPond's loglevel to %s") % + global_options.lily_loglevel, True) + global_options.process_cmd += " --loglevel=%s" % global_options.lily_loglevel + elif ly.is_verbose(): + if os.environ.get("LILYPOND_LOGLEVEL", None): + ly.debug_output(_("Setting LilyPond's loglevel to %s (from environment variable LILYPOND_LOGLEVEL)") % + os.environ.get("LILYPOND_LOGLEVEL", None), True) + global_options.process_cmd += " --loglevel=%s" % os.environ.get( + "LILYPOND_LOGLEVEL", None) + else: + ly.debug_output( + _("Setting LilyPond's output to --verbose, implied by lilypond-book's setting"), True) + global_options.process_cmd += " --verbose" + + global_options.process_cmd += " -dread-file-list -dno-strip-output-dir" + + # Store the original argument to construct the dependency file below. + relative_output_dir = global_options.output_dir + + if global_options.output_dir: + global_options.output_dir = os.path.abspath(global_options.output_dir) + # Create the directory, but do not complain if it already exists. + os.makedirs(global_options.output_dir, exist_ok=True) + else: + global_options.output_dir = os.getcwd() + + if global_options.lily_output_dir: + global_options.lily_output_dir = os.path.abspath( + global_options.lily_output_dir) + else: + global_options.lily_output_dir = global_options.output_dir + + identify() + try: + chunks = do_file(files[0]) + if global_options.filter_cmd: + write_output_documents(chunks, is_filter=True) + elif global_options.process_cmd: + do_process_cmd(chunks, global_options) + progress(_("Compiling `%s'...") % files[0]) + write_output_documents(chunks, is_filter=False) + except book_snippets.CompileError: + exit(1) + + inputs = note_input_file('') + inputs.pop() + + base_file_name = os.path.splitext(os.path.basename(files[0]))[0] + dep_file = os.path.join(global_options.output_dir, base_file_name + '.dep') + final_output_file = os.path.join(relative_output_dir, + base_file_name + global_options.formatter.default_extension) + open(dep_file, 'w', encoding='utf-8').write('%s: %s\n' + % (final_output_file, ' '.join(inputs))) + + +if __name__ == '__main__': + main() diff --git a/lilypond-2.24.2/bin/lilypond-invoke-editor.py b/lilypond-2.24.2/bin/lilypond-invoke-editor.py new file mode 100644 index 0000000000000000000000000000000000000000..5089a2220dc82b722d5fca1c674aba3ae48045df --- /dev/null +++ b/lilypond-2.24.2/bin/lilypond-invoke-editor.py @@ -0,0 +1,135 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2022 Jonas Hahnfeld +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + +import gettext +import os +import re +import shlex +import subprocess +import sys +import urllib.parse + +# Load translation and install _() into Python's builtins namespace. +gettext.install("lilypond", "/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/locale") + + +def show_version(file): + file.write("lilypond-invoke-editor (GNU LilyPond 2.24.2)\n") + + +def show_help(file): + file.write( + _( + """Usage: lilypond-invoke-editor textedit://FILE:LINE:CHAR:COLUMN + +Visit a file and position the cursor. + +Options: + -h, --help show this help + -v, --version show version +""" + ) + ) + + +# We don't need heavy option parsing here, just expect exactly one argument. +if len(sys.argv) != 2: + show_version(sys.stderr) + show_help(sys.stderr) + sys.exit(2) + +argument = sys.argv[1] + +# Handle the two options this script knows about. +if argument in ("-h", "--help"): + show_version(sys.stdout) + show_help(sys.stdout) + sys.exit(0) +if argument in ("-v", "--version"): + show_version(sys.stdout) + sys.exit(0) + +# Now start parsing the textedit argument, first by matching its components. +m = re.fullmatch(r"textedit://(.*):([0-9]+):([0-9]+):([0-9]*)", argument) +if m is None: + show_help(sys.stderr) + sys.exit(2) + +file, line, char, column = m.groups() +file = urllib.parse.unquote(file) + + +def replace_template(template): + return template % { + "file": file, + "line": line, + "char": char, + "column": column, + } + + +# Determine the editor, going from more to less specific environment variables. +editor = "emacs" +for env in ("LYEDITOR", "XEDITOR", "EDITOR"): + if env in os.environ: + editor = os.environ[env] + break + +# Check if we have a template for this editor to position the cursor. +EDITOR_TEMPLATES = { + "atom": [("atom", "%(file)s:%(line)s:%(column)s")], + "emacs": [ + ("emacsclient", "--no-wait", "+%(line)s:%(column)s", "%(file)s"), + ("emacs", "+%(line)s:%(column)s", "%(file)s"), + ], + "geany": [("geany", "--line", "%(line)s", "--column", "%(column)s", "%(file)s")], + "gedit": [("gedit", "--wait", "%(file)s", "+%(line)s:%(column)s")], + "gvim": [("gvim", "--remote", "+:%(line)s:norm%(column)s", "%(file)s")], + "jedit": [("jedit", "-reuseview", "%(file)s", "+line:%(line)s")], + "kate": [ + ("kate", "--block", "--line", "%(line)s", "--column", "%(column)s", "%(file)s") + ], + # "nc" nowadays also stands for netcat... + "nedit": [("nc", "-noask", "+%(line)s", "%(file)s")], + "syn": [("syn", "-line", "%(line)s", "-col", "%(char)s", "%(file)s")], + "uedit32": [("uedit32", "%(file)s", "-l%(line)s", "-c%(char)s")], +} + +editor_commands = [] +if "%(file)s" in editor: + editor_commands = [shlex.split(editor)] +elif editor in EDITOR_TEMPLATES: + editor_commands = EDITOR_TEMPLATES[editor] +else: + editor_commands = [(editor, "%(file)s")] + +editor_commands = [list(map(replace_template, cmd)) for cmd in editor_commands] + +# Try commands one after another, until one succeeds. +for cmd in editor_commands: + try: + proc = subprocess.run(cmd) + if proc.returncode == 0: + sys.exit(0) + except FileNotFoundError as e: + pass + +sys.stderr.write(_("failed to invoke editor:")) +sys.stderr.write(" " + str(editor_commands) + "\n") +sys.exit(1) diff --git a/lilypond-2.24.2/bin/lilypond.exe b/lilypond-2.24.2/bin/lilypond.exe new file mode 100644 index 0000000000000000000000000000000000000000..61d0ec9603eeb039b5d189cd2ada8c640ae30a29 --- /dev/null +++ b/lilypond-2.24.2/bin/lilypond.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9c9ba6fc2c1d7c082f1e36d75053f29df32e5e513d853b30887dee2f1b2ed40 +size 13852160 diff --git a/lilypond-2.24.2/bin/lilysong.py b/lilypond-2.24.2/bin/lilysong.py new file mode 100644 index 0000000000000000000000000000000000000000..bb025fce0526c1075a93f17cc477423a714a84a9 --- /dev/null +++ b/lilypond-2.24.2/bin/lilysong.py @@ -0,0 +1,273 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 + +# Copyright (c) 2006--2022 Brailcom, o.p.s. +# +# Author: Milan Zamazal +# +# This file is part of LilyPond, the GNU music typesetter. +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + + +import codecs +import optparse +import os +import subprocess +import sys +import tempfile + +""" + +# relocate-preamble.py.in +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2007--2022 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . +# + +This is generic code, used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +# This is needed for installations with a non-default layout, ie where share/ +# is not next to bin/. +sys.path.insert (0, os.path.join ('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/lilypond/2.24.2', 'python')) + +# Dynamic relocation, for installations with a default layout including GUB, +# but also for execution from the build directory. +bindir = os.path.abspath (os.path.dirname (sys.argv[0])) +topdir = os.path.dirname (bindir) +if bindir.endswith (r'/scripts/out'): + topdir = os.path.join (os.path.dirname (topdir), 'out') +datadir = os.path.abspath (os.path.join (topdir, 'share', 'lilypond')) +for v in [ 'current', '2.24.2' ]: + sys.path.insert (0, os.path.join (datadir, v, 'python')) + +""" +""" + + +FESTIVAL_COMMAND = ['festival', '--pipe'] +VOICE_CODINGS = {'voice_czech_ph': 'iso-8859-2'} + +_USAGE = """lilysong [-p PLAY-PROGRAM] FILE.xml [LANGUAGE-CODE-OR-VOICE [SPEEDUP]] + lilysong FILE.ly [LANGUAGE-CODE-OR-VOICE] + lilysong --list-voices + lilysong --list-languages +""" + + +def usage(): + print('Usage:', _USAGE) + sys.exit(2) + + +def process_options(args): + parser = optparse.OptionParser(usage=_USAGE, version="2.24.2") + parser.add_option('', '--list-voices', action='store_true', dest='list_voices', + help="list available Festival voices") + parser.add_option('', '--list-languages', action='store_true', dest='list_languages', + help="list available Festival languages") + parser.add_option('-p', '--play-program', metavar='PROGRAM', + action='store', type='string', dest='play_program', + help="use PROGRAM to play song immediately") + options, args = parser.parse_args(args) + return options, args + + +def call_festival(scheme_code): + p = subprocess.Popen(FESTIVAL_COMMAND, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, close_fds=True) + p.stdin.write(scheme_code) + p.stdin.close() + answer = '' + while True: + process_output = p.stdout.read() + if not process_output: + break + answer = answer + process_output + return answer + + +def select_voice(language_or_voice): + if language_or_voice[:6] == 'voice_': + voice = language_or_voice + else: + voice = call_festival(''' +(let ((candidates '())) + (mapcar (lambda (v) + (if (eq (cadr (assoc 'language (cadr (voice.description v)))) '%s) + (set! candidates (cons v candidates)))) + (append (voice.list) (mapcar car Voice_descriptions))) + (if candidates + (format t "voice_%%s" (car candidates)) + (format t "nil"))) +''' % (language_or_voice,)) + if voice == 'nil': + voice = None + return voice + + +def list_voices(): + print(call_festival(''' +(let ((voices (voice.list)) + (print-voice (lambda (v) (format t "voice_%s\n" v)))) + (mapcar print-voice voices) + (mapcar (lambda (v) (if (not (member v voices)) (print-voice v))) + (mapcar car Voice_descriptions))) +''')) + + +def list_languages(): + print(call_festival(''' +(let ((languages '())) + (let ((voices (voice.list)) + (print-language (lambda (v) + (let ((language (cadr (assoc 'language (cadr (voice.description v)))))) + (if (and language (not (member language languages))) + (begin + (set! languages (cons language languages)) + (print language))))))) + (mapcar print-language voices) + (mapcar (lambda (v) (if (not (member v voices)) (print-language v))) + (mapcar car Voice_descriptions)))) +''')) + + +def process_xml_file(file_name, voice, speedup, play_program): + if speedup == 1: + speedup = None + coding = (VOICE_CODINGS.get(voice) or 'iso-8859-1') + _, xml_temp_file = tempfile.mkstemp('.xml') + try: + # recode the XML file + recodep = (coding != 'utf-8') + if recodep: + decode = codecs.getdecoder('utf-8') + encode = codecs.getencoder(coding) + input = open(file_name, encoding='utf-8') + output = open(xml_temp_file, 'w', encoding='utf-8') + while True: + data = input.read() + if not data: + break + if recodep: + data = encode(decode(data)[0])[0] + output.write(data) + output.close() + # synthesize + wav_file = file_name[:-3] + 'wav' + if speedup: + _, wav_temp_file = tempfile.mkstemp('.wav') + else: + wav_temp_file = wav_file + try: + print("text2wave -eval '(%s)' -mode singing '%s' -o '%s'" % + (voice, xml_temp_file, wav_temp_file,)) + result = os.system("text2wave -eval '(%s)' -mode singing '%s' -o '%s'" % + (voice, xml_temp_file, wav_temp_file,)) + if result: + sys.stdout.write("Festival processing failed.\n") + return + if speedup: + result = os.system("sox '%s' '%s' speed '%f'" % + (wav_temp_file, wav_file, speedup,)) + if result: + sys.stdout.write("Festival processing failed.\n") + return + finally: + if speedup: + try: + os.delete(wav_temp_file) + except OSError: + pass + sys.stdout.write("%s created.\n" % (wav_file,)) + # play + if play_program: + os.system("%s '%s' >/dev/null" % (play_program, wav_file,)) + finally: + try: + os.delete(xml_temp_file) + except OSError: + pass + + +def process_ly_file(file_name, voice): + result = os.system("lilypond '%s'" % (file_name,)) + if result: + return + xml_file = None + for f in os.listdir(os.path.dirname(file_name) or '.'): + if (f[-4:] == '.xml' and + (not xml_file or os.stat.st_mtime(f) > os.stat.st_mtime(xml_file))): + xml_file = f + if xml_file: + process_xml_file(xml_file, voice, None, None) + else: + sys.stderr.write("No XML file found\n") + + +def go(): + options, args = process_options(sys.argv[1:]) + if options.list_voices: + list_voices() + elif options.list_languages: + list_languages() + else: + arglen = len(args) + if arglen < 1: + usage() + file_name = args[0] + if arglen > 1: + language_or_voice = args[1] + voice = select_voice(language_or_voice) + else: + voice = None + if file_name[-3:] == '.ly': + if arglen > 2: + usage() + process_ly_file(file_name, voice) + else: + if arglen > 3: + usage() + elif arglen == 3: + try: + speedup = float(args[2]) + except ValueError: + usage() + else: + speedup = None + process_xml_file(file_name, voice, speedup, options.play_program) + + +if __name__ == '__main__': + go() diff --git a/lilypond-2.24.2/bin/midi2ly.py b/lilypond-2.24.2/bin/midi2ly.py new file mode 100644 index 0000000000000000000000000000000000000000..4cdbc6a2233f423335ff52deb1c382e470ad27d8 --- /dev/null +++ b/lilypond-2.24.2/bin/midi2ly.py @@ -0,0 +1,1329 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 +# +# midi2ly.py -- LilyPond midi import script + +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 1998--2022 Han-Wen Nienhuys +# Jan Nieuwenhuizen +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + + +''' +TODO: +''' + +import gettext +import math +import os +import sys + +""" + +# relocate-preamble.py.in +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2007--2022 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . +# + +This is generic code, used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +# This is needed for installations with a non-default layout, ie where share/ +# is not next to bin/. +sys.path.insert (0, os.path.join ('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/lilypond/2.24.2', 'python')) + +# Dynamic relocation, for installations with a default layout including GUB, +# but also for execution from the build directory. +bindir = os.path.abspath (os.path.dirname (sys.argv[0])) +topdir = os.path.dirname (bindir) +if bindir.endswith (r'/scripts/out'): + topdir = os.path.join (os.path.dirname (topdir), 'out') +datadir = os.path.abspath (os.path.join (topdir, 'share', 'lilypond')) +for v in [ 'current', '2.24.2' ]: + sys.path.insert (0, os.path.join (datadir, v, 'python')) + +""" +""" + +# Load translation and install _() into Python's builtins namespace. +gettext.install('lilypond', '/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/locale') + +import lilylib as ly + +################################################################ +# CONSTANTS + + +LINE_BELL = 60 +scale_steps = [0, 2, 4, 5, 7, 9, 11] +global_options = None + +clocks_per_1 = 1536 +clocks_per_4 = 0 + +time = None +reference_note = 0 # a mess +start_quant_clocks = 0 + +duration_quant_clocks = 0 +allowed_tuplet_clocks = [] +bar_max = 0 + +################################################################ + + +program_version = '2.24.2' + +authors = ('Jan Nieuwenhuizen ', + 'Han-Wen Nienhuys ') + + + +def identify(): + sys.stdout.write('%s (GNU LilyPond) %s\n' % + (ly.program_name, program_version)) + + +def warranty(): + identify() + sys.stdout.write(''' +%s + + %s + +%s +%s +''' % (_('Copyright (c) %s by') % '1998--2023', + '\n '.join(authors), + _('Distributed under terms of the GNU General Public License.'), + _('It comes with NO WARRANTY.'))) + + +def strip_extension(f, ext): + (p, e) = os.path.splitext(f) + if e == ext: + e = '' + return p + e + + +class Duration: + allowed_durs = (1, 2, 4, 8, 16, 32, 64, 128) + + def __init__(self, clocks): + self.clocks = clocks + (self.dur, self.num, self.den) = self.dur_num_den(clocks) + + def dur_num_den(self, clocks): + for i in range(len(allowed_tuplet_clocks)): + if clocks == allowed_tuplet_clocks[i]: + return global_options.allowed_tuplets[i] + + dur = 0 + num = 1 + den = 1 + g = math.gcd(int(clocks), clocks_per_1) + if g: + (dur, num) = (clocks_per_1 / g, clocks / g) + if not dur in self.allowed_durs: + dur = 4 + num = clocks + den = clocks_per_4 + return (dur, num, den) + + def __repr__(self): + if self.den == 1: + if self.num == 1: + s = '%d' % self.dur + elif self.num == 3 and self.dur != 1: + s = '%d.' % (self.dur / 2) + else: + s = '%d*%d' % (self.dur, self.num) + else: + s = '%d*%d/%d' % (self.dur, self.num, self.den) + return s + + def dump(self): + global reference_note + reference_note.duration = self + return repr(self) + + def compare(self, other): + return self.clocks - other.clocks + + +def sign(x): + if x >= 0: + return 1 + else: + return -1 + + +class Note: + names = (0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6) + alterations = (0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0) + alteration_names = ('eses', 'es', '', 'is', 'isis') + + def __init__(self, clocks, pitch, velocity): + self.pitch = pitch + self.velocity = velocity + # hmm + self.clocks = clocks + self.duration = Duration(clocks) + (self.octave, self.notename, self.alteration) = self.o_n_a() + + def o_n_a(self): + # major scale: do-do + # minor scale: la-la (= + 5) ''' + + n = self.names[(self.pitch) % 12] + a = self.alterations[(self.pitch) % 12] + + key = global_options.key + if not key: + key = Key(0, 0, 0) + + if a and key.flats: + a = - self.alterations[(self.pitch) % 12] + n = (n - a) % 7 + + # By tradition, all scales now consist of a sequence + # of 7 notes each with a distinct name, from amongst + # a b c d e f g. But, minor scales have a wide + # second interval at the top - the 'leading note' is + # sharped. (Why? it just works that way! Anything + # else doesn't sound as good and isn't as flexible at + # saying things. In medieval times, scales only had 6 + # notes to avoid this problem - the hexachords.) + + # So, the d minor scale is d e f g a b-flat c-sharp d + # - using d-flat for the leading note would skip the + # name c and duplicate the name d. Why isn't c-sharp + # put in the key signature? Tradition. (It's also + # supposedly based on the Pythagorean theory of the + # cycle of fifths, but that really only applies to + # major scales...) Anyway, g minor is g a b-flat c d + # e-flat f-sharp g, and all the other flat minor keys + # end up with a natural leading note. And there you + # have it. + + # John Sankey + # + # Let's also do a-minor: a b c d e f gis a + # + # --jcn + + o = self.pitch / 12 - 4 + + if key.minor: + # as -> gis + if (key.sharps == 0 and key.flats == 0 + and n == 5 and a == -1): + n = 4 + a = 1 + # des -> cis + elif key.flats == 1 and n == 1 and a == -1: + n = 0 + a = 1 + # ges -> fis + elif key.flats == 2 and n == 4 and a == -1: + n = 3 + a = 1 + # g -> fisis + elif key.sharps == 5 and n == 4 and a == 0: + n = 3 + a = 2 + # d -> cisis + elif key.sharps == 6 and n == 1 and a == 0: + n = 0 + a = 2 + # a -> gisis + elif key.sharps == 7 and n == 5 and a == 0: + n = 4 + a = 2 + + # b -> ces + if key.flats >= 6 and n == 6 and a == 0: + n = 0 + a = -1 + o = o + 1 + # e -> fes + if key.flats >= 7 and n == 2 and a == 0: + n = 3 + a = -1 + + # f -> eis + if key.sharps >= 3 and n == 3 and a == 0: + n = 2 + a = 1 + # c -> bis + if key.sharps >= 4 and n == 0 and a == 0: + n = 6 + a = 1 + o = o - 1 + + return (o, n, a) + + def __repr__(self): + s = chr((self.notename + 2) % 7 + ord('a')) + return 'Note(%s %s)' % (s, repr(self.duration)) + + def dump(self, dump_dur=True): + global reference_note + s = chr((self.notename + 2) % 7 + ord('a')) + s = s + self.alteration_names[self.alteration + 2] + if global_options.absolute_pitches: + commas = self.octave + else: + delta = self.pitch - reference_note.pitch + commas = sign(delta) * (abs(delta) // 12) + if (((sign(delta) + * (self.notename - reference_note.notename) + 7) + % 7 >= 4) + or ((self.notename == reference_note.notename) + and (abs(delta) > 4) and (abs(delta) < 12))): + commas = commas + sign(delta) + + if commas > 0: + s = s + "'" * commas + elif commas < 0: + s = s + "," * -commas + + if (dump_dur + and (self.duration.compare(reference_note.duration) + or global_options.explicit_durations)): + s = s + self.duration.dump() + + # Chords need to handle their reference duration themselves + + reference_note = self + + # TODO: move space + return s + ' ' + + +class Time: + def __init__(self, num, den): + self.clocks = 0 + self.num = num + self.den = den + + def bar_clocks(self): + return clocks_per_1 * self.num / self.den + + def __repr__(self): + return 'Time(%d/%d)' % (self.num, self.den) + + def dump(self): + global time + time = self + return '\n ' + '\\time %d/%d ' % (self.num, self.den) + '\n ' + + +class Tempo: + def __init__(self, seconds_per_1): + self.clocks = 0 + self.seconds_per_1 = seconds_per_1 + + def __repr__(self): + return 'Tempo(%d)' % self.bpm() + + def bpm(self): + return 4 * 60 / self.seconds_per_1 + + def dump(self): + return '\n ' + '\\tempo 4 = %d ' % (self.bpm()) + '\n ' + + +class Clef: + clefs = ('"bass_8"', 'bass', 'violin', '"violin^8"') + + def __init__(self, type): + self.type = type + + def __repr__(self): + return 'Clef(%s)' % self.clefs[self.type] + + def dump(self): + return '\n \\clef %s\n ' % self.clefs[self.type] + + +class Key: + key_sharps = ('c', 'g', 'd', 'a', 'e', 'b', 'fis') + key_flats = ('BUG', 'f', 'bes', 'es', 'as', 'des', 'ges') + + def __init__(self, sharps, flats, minor): + self.clocks = 0 + self.flats = flats + self.sharps = sharps + self.minor = minor + + def dump(self): + global_options.key = self + + s = '' + if self.sharps and self.flats: + pass + else: + if self.flats: + k = (ord('cfbeadg'[self.flats % 7]) - + ord('a') - 2 - 2 * self.minor + 7) % 7 + else: + k = (ord('cgdaebf'[self.sharps % 7]) - + ord('a') - 2 - 2 * self.minor + 7) % 7 + + if not self.minor: + name = chr((k + 2) % 7 + ord('a')) + else: + name = chr((k + 2) % 7 + ord('a')) + + # fis cis gis dis ais eis bis + sharps = (2, 4, 6, 1, 3, 5, 7) + # bes es as des ges ces fes + flats = (6, 4, 2, 7, 5, 3, 1) + a = 0 + if self.flats: + if flats[k] <= self.flats: + a = -1 + else: + if sharps[k] <= self.sharps: + a = 1 + + if a: + name = name + Note.alteration_names[a + 2] + + s = '\\key ' + name + if self.minor: + s = s + ' \\minor' + else: + s = s + ' \\major' + + return '\n\n ' + s + '\n ' + + +class Text: + text_types = ( + 'SEQUENCE_NUMBER', + 'TEXT_EVENT', + 'COPYRIGHT_NOTICE', + 'SEQUENCE_TRACK_NAME', + 'INSTRUMENT_NAME', + 'LYRIC', + 'MARKER', + 'CUE_POINT', + 'PROGRAM_NAME', + 'DEVICE_NAME', ) + + @staticmethod + def _text_only(chr): + if ((' ' <= chr <= '~') or chr in ['\n', '\r']): + return chr + else: + return '~' + + def __init__(self, type, text): + self.clocks = 0 + self.type = type + self.text = ''.join(map(self._text_only, text)) + + def dump(self): + # urg, we should be sure that we're in a lyrics staff + s = '' + if self.type == midi.LYRIC: + s = '"%s"' % self.text + d = Duration(self.clocks) + if (global_options.explicit_durations + or d.compare(reference_note.duration)): + s = s + Duration(self.clocks).dump() + s = s + ' ' + elif (self.text.strip() + and self.type == midi.SEQUENCE_TRACK_NAME + and not self.text == 'control track' + and not self.track.lyrics_p_): + text = self.text.replace('(MIDI)', '').strip() + if text: + s = '\n \\set Staff.instrumentName = "%(text)s"\n ' % locals( + ) + elif self.text.strip(): + s = '\n % [' + self.text_types[self.type] + '] ' + \ + self.text + '\n ' + return s + + def __repr__(self): + return 'Text(%d=%s)' % (self.type, self.text) + +class EndOfTrack: + def __init__(self): + self.clocks = 0 + + def __repr__(self): + return 'EndOfTrack()' + + def dump(self): + return '' + +def get_voice(channel, music): + ly.debug_output('channel: ' + str(channel) + '\n') + return unthread_notes(music) + + +class Channel: + def __init__(self, number): + self.number = number + self.events = [] + self.music = None + + def add(self, event): + self.events.append(event) + + def get_voice(self): + if not self.music: + self.music = self.parse() + return get_voice(self.number, self.music) + + def parse(self): + pitches = {} + notes = [] + music = [] + last_lyric = 0 + last_time = 0 + end_of_track_time = None + for e in self.events: + t = e[0] + + if start_quant_clocks: + t = quantise_clocks(t, start_quant_clocks) + + if (e[1][0] == midi.NOTE_OFF + or (e[1][0] == midi.NOTE_ON and e[1][2] == 0)): + ly.debug_output('%d: NOTE OFF: %s' % (t, e[1][1])) + if not e[1][2]: + ly.debug_output(' ...treated as OFF') + end_note(pitches, notes, t, e[1][1]) + + elif e[1][0] == midi.NOTE_ON: + if e[1][1] not in pitches: + ly.debug_output('%d: NOTE ON: %s' % (t, e[1][1])) + pitches[e[1][1]] = (t, e[1][2]) + else: + ly.debug_output('...ignored') + + # all include ALL_NOTES_OFF + elif (e[1][0] >= midi.ALL_SOUND_OFF + and e[1][0] <= midi.POLY_MODE_ON): + for i in pitches: + end_note(pitches, notes, t, i) + + elif e[1][0] == midi.META_EVENT: + if e[1][1] == midi.END_OF_TRACK: + for i in pitches: + end_note(pitches, notes, t, i) + end_of_track_time = t + break + + elif e[1][1] == midi.SET_TEMPO: + (u0, u1, u2) = list(map(ord, e[1][2])) + us_per_4 = u2 + 256 * (u1 + 256 * u0) + seconds_per_1 = us_per_4 * 4 / 1e6 + music.append((t, Tempo(seconds_per_1))) + elif e[1][1] == midi.TIME_SIGNATURE: + (num, dur, clocks4, count32) = list(map(ord, e[1][2])) + den = 2 ** dur + music.append((t, Time(num, den))) + elif e[1][1] == midi.KEY_SIGNATURE: + (alterations, minor) = list(map(ord, e[1][2])) + sharps = 0 + flats = 0 + if alterations < 127: + sharps = alterations + else: + flats = 256 - alterations + + k = Key(sharps, flats, minor) + if not t and global_options.key: + # At t == 0, a set --key overrides us + k = global_options.key + music.append((t, k)) + + # ugh, must set key while parsing + # because Note init uses key + # Better do Note.calc () at dump time? + global_options.key = k + + elif (e[1][1] == midi.LYRIC + or (global_options.text_lyrics + and e[1][1] == midi.TEXT_EVENT)): + self.lyrics_p_ = True + if last_lyric: + last_lyric.clocks = t - last_time + music.append((last_time, last_lyric)) + last_time = t + last_lyric = Text(midi.LYRIC, e[1][2]) + + elif (e[1][1] >= midi.SEQUENCE_NUMBER + and e[1][1] <= midi.CUE_POINT): + text = Text(e[1][1], e[1][2]) + text.track = self + music.append((t, text)) + if text.type == midi.SEQUENCE_TRACK_NAME: + self.name = text.text + else: + if global_options.verbose: + sys.stderr.write("SKIP: %s\n" % repr(e)) + else: + if global_options.verbose: + sys.stderr.write("SKIP: %s\n" % repr(e)) + + if last_lyric: + # last_lyric.clocks = t - last_time + # hmm + last_lyric.clocks = clocks_per_4 + music.append((last_time, last_lyric)) + last_lyric = 0 + + i = 0 + while len(notes): + if i < len(music) and notes[0][0] >= music[i][0]: + i = i + 1 + else: + music.insert(i, notes[0]) + del notes[0] + + if end_of_track_time is not None: + music.append((end_of_track_time, EndOfTrack())) + + return music + + +class Track (Channel): + def __init__(self): + Channel.__init__(self, None) + self.name = None + self.channels = {} + self.lyrics_p_ = False + + def _add(self, event): + self.events.append(event) + + def add(self, event, channel=None): + if channel is None: + self._add(event) + else: + self.channels[channel] = self.channels.get( + channel, Channel(channel)) + self.channels[channel].add(event) + + def get_voices(self): + return ([self.get_voice()] + + [self.channels[k].get_voice() + for k in sorted(self.channels.keys())]) + + +def create_track(events): + track = Track() + for e in events: + data = list(e[1]) + if data[0] > 0x7f and data[0] < 0xf0: + channel = data[0] & 0x0f + e = (e[0], tuple([data[0] & 0xf0] + data[1:])) + track.add(e, channel) + else: + track.add(e) + return track + + +def quantise_clocks(clocks, quant): + q = int(clocks / quant) * quant + if q != clocks: + for tquant in allowed_tuplet_clocks: + if int(clocks / tquant) * tquant == clocks: + return clocks + if 2 * (clocks - q) > quant: + q = q + quant + return q + + +def end_note(pitches, notes, t, e): + try: + (lt, vel) = pitches[e] + del pitches[e] + + i = len(notes) - 1 + while i > 0: + if notes[i][0] > lt: + i = i - 1 + else: + break + d = t - lt + if duration_quant_clocks: + d = quantise_clocks(d, duration_quant_clocks) + if not d: + d = duration_quant_clocks + + notes.insert(i + 1, + (lt, Note(d, e, vel))) + + except KeyError: + pass + + +def unthread_notes(channel): + threads = [] + while channel: + thread = [] + end_busy_t = 0 + start_busy_t = 0 + todo = [] + for e in channel: + t = e[0] + if (e[1].__class__ == Note + and ((t == start_busy_t + and e[1].clocks + t == end_busy_t) + or t >= end_busy_t)): + thread.append(e) + start_busy_t = t + end_busy_t = t + e[1].clocks + elif (e[1].__class__ == Time + or e[1].__class__ == Key + or e[1].__class__ == Text + or e[1].__class__ == Tempo + or e[1].__class__ == EndOfTrack): + thread.append(e) + else: + todo.append(e) + threads.append(thread) + channel = todo + + return threads + + +def dump_skip(skip, clocks): + global reference_note + saved_duration = reference_note.duration + result = skip + Duration(clocks).dump() + ' ' + # "\skip D" does not change the reference duration like "sD", + # so we restore it after Duration.dump changes it. + if skip[0] == '\\': + reference_note.duration = saved_duration + return result + + +def dump(d): + return d.dump() + + +def dump_chord(ch): + s = '' + notes = [] + for i in ch: + if i.__class__ == Note: + notes.append(i) + else: + s = s + i.dump() + if len(notes) == 1: + s = s + dump(notes[0]) + elif len(notes) > 1: + global reference_note + reference_dur = reference_note.duration + s = s + '<' + s = s + notes[0].dump(dump_dur=False) + r = reference_note + for i in notes[1:]: + s = s + i.dump(dump_dur=False) + s = s + '>' + if (r.duration.compare(reference_dur) + or global_options.explicit_durations): + s = s + r.duration.dump() + s = s + ' ' + reference_note = r + return s + + +def dump_bar_line(last_bar_t, t, bar_count): + s = '' + bar_t = time.bar_clocks() + if t - last_bar_t >= bar_t: + bar_count = bar_count + (t - last_bar_t) / bar_t + + if t - last_bar_t == bar_t: + s = '\n | %% %(bar_count)d\n ' % locals() + last_bar_t = t + else: + # urg, this will barf at meter changes + last_bar_t = last_bar_t + (t - last_bar_t) / bar_t * bar_t + + return (s, last_bar_t, bar_count) + + +def dump_voice(thread, skip): + global reference_note, time + ref = Note(0, 4*12, 0) + if not reference_note: + reference_note = ref + else: + ref.duration = reference_note.duration + reference_note = ref + last_e = None + chs = [] + ch = [] + + for e in thread: + if last_e and last_e[0] == e[0]: + ch.append(e[1]) + else: + if ch: + chs.append((last_e[0], ch)) + + ch = [e[1]] + + last_e = e + + if ch: + chs.append((last_e[0], ch)) + t = 0 + last_t = 0 + last_bar_t = 0 + bar_count = 1 + + lines = [''] + for ch in chs: + t = ch[0] + + i = lines[-1].rfind('\n') + 1 + if len(lines[-1][i:]) > LINE_BELL: + lines.append('') + + if t - last_t > 0: + d = t - last_t + if bar_max and t > time.bar_clocks() * bar_max: + d = time.bar_clocks() * bar_max - last_t + lines[-1] = lines[-1] + dump_skip(skip, d) + elif t - last_t < 0: + ly.error('BUG: time skew') + + (s, last_bar_t, bar_count) = dump_bar_line(last_bar_t, + t, bar_count) + + if bar_max and bar_count > bar_max: + break + + lines[-1] = lines[-1] + s + lines[-1] = lines[-1] + dump_chord(ch[1]) + + clocks = 0 + for i in ch[1]: + if i.clocks > clocks: + clocks = i.clocks + + last_t = t + clocks + + (s, last_bar_t, bar_count) = dump_bar_line(last_bar_t, + last_t, bar_count) + lines[-1] = lines[-1] + s + + return '\n '.join(lines) + '\n' + + +def number2ascii(i): + s = '' + i += 1 + while i > 0: + m = (i - 1) % 26 + s = '%c' % (m + ord('A')) + s + i = (i - m) // 26 + return s + + +def get_track_name(i): + return 'track' + number2ascii(i) + + +def get_channel_name(i): + return 'channel' + number2ascii(i) + + +def get_voice_name(i, zero_too_p=False): + if i or zero_too_p: + return 'voice' + number2ascii(i) + return '' + + +def lst_append(lst, x): + lst.append(x) + return lst + + +def get_voice_layout(average_pitch): + d = {} + for i in range(len(average_pitch)): + d[average_pitch[i]] = lst_append(d.get(average_pitch[i], []), i) + s = list(reversed(sorted(average_pitch))) + non_empty = len([x for x in s if x]) + names = ['One', 'Two'] + if non_empty > 2: + names = ['One', 'Three', 'Four', 'Two'] + layout = ['' for x in range(len(average_pitch))] + for i, n in zip(s, names): + if i: + v = d[i] + if isinstance(v, list): + d[i] = v[1:] + v = v[0] + layout[v] = n + return layout + + +def dump_track(track, n): + s = '\n' + track_name = get_track_name(n) + + average_pitch = track_average_pitch(track) + voices = len([x for x in average_pitch[1:] if x]) + clef = get_best_clef(average_pitch[0]) + + c = 0 + vv = 0 + for channel in track: + v = 0 + channel_name = get_channel_name(c) + c += 1 + for voice in channel: + voice_name = get_voice_name(v) + voice_id = track_name + channel_name + voice_name + item = voice_first_item(voice) + + if item and item.__class__ == Note: + skip = 'r' + if global_options.skip: + skip = 's' + s += '%(voice_id)s = ' % locals() + if not global_options.absolute_pitches: + s += '\\relative c ' + elif item and item.__class__ == Text: + skip = '" "' + s += '%(voice_id)s = \\lyricmode ' % locals() + else: + skip = '\\skip ' + s += '%(voice_id)s = ' % locals() + s += '{\n' + if not n and not vv and global_options.key: + s += global_options.key.dump() + if average_pitch[vv+1] and voices > 1: + vl = get_voice_layout(average_pitch[1:])[vv] + if vl: + s += ' \\voice' + vl + '\n' + else: + if not global_options.quiet: + ly.warning( + _('found more than 5 voices on a staff, expect bad output')) + s += ' ' + dump_voice(voice, skip) + s += '}\n\n' + v += 1 + vv += 1 + + s += '%(track_name)s = <<\n' % locals() + + if clef.type != 2: + s += clef.dump() + '\n' + + c = 0 + vv = 0 + for channel in track: + v = 0 + channel_name = get_channel_name(c) + c += 1 + for voice in channel: + voice_context_name = get_voice_name(vv, zero_too_p=True) + voice_name = get_voice_name(v) + v += 1 + vv += 1 + voice_id = track_name + channel_name + voice_name + item = voice_first_item(voice) + context = 'Voice' + if item and item.__class__ == Text: + context = 'Lyrics' + s += ' \\context %(context)s = %(voice_context_name)s \\%(voice_id)s\n' % locals() + s += '>>\n\n' + return s + + +def voice_first_item(voice): + for event in voice: + if (event[1].__class__ == Note + or (event[1].__class__ == Text + and event[1].type == midi.LYRIC)): + return event[1] + return None + + +def channel_first_item(channel): + for voice in channel: + first = voice_first_item(voice) + if first: + return first + return None + + +def track_first_item(track): + for channel in track: + first = channel_first_item(channel) + if first: + return first + return None + + +def track_average_pitch(track): + i = 0 + p = [0] + v = 1 + for channel in track: + for voice in channel: + c = 0 + p.append(0) + for event in voice: + if event[1].__class__ == Note: + i += 1 + c += 1 + p[v] += event[1].pitch + if c: + p[0] += p[v] + p[v] = p[v] / c + v += 1 + if i: + p[0] = p[0] / i + return p + + +def get_best_clef(average_pitch): + if average_pitch: + if average_pitch <= 3*12: + return Clef(0) + elif average_pitch <= 5*12: + return Clef(1) + elif average_pitch >= 7*12: + return Clef(3) + return Clef(2) + + +class Staff: + def __init__(self, track): + self.voices = track.get_voices() + + def dump(self, i): + return dump_track(self.voices, i) + + +def convert_midi(in_file, out_file): + global midi + import midi + + global clocks_per_1, clocks_per_4, key + global start_quant_clocks + global duration_quant_clocks + global allowed_tuplet_clocks + global time + + full_content = open(in_file, 'rb').read() + clocks_max = bar_max * clocks_per_1 * 2 + midi_dump = midi.parse(full_content, clocks_max) + + clocks_per_1 = midi_dump[0][1] + clocks_per_4 = clocks_per_1 / 4 + time = Time(4, 4) + + if global_options.start_quant: + start_quant_clocks = clocks_per_1 / global_options.start_quant + + if global_options.duration_quant: + duration_quant_clocks = clocks_per_1 / global_options.duration_quant + + allowed_tuplet_clocks = [] + for (dur, num, den) in global_options.allowed_tuplets: + allowed_tuplet_clocks.append(clocks_per_1 / dur * num / den) + + if global_options.verbose: + print('allowed tuplet clocks:', allowed_tuplet_clocks) + + tracks = [create_track(t) for t in midi_dump[1]] + # urg, parse all global track events, such as Key first + # this fixes key in different voice/staff problem + for t in tracks: + t.music = t.parse() + prev = None + staves = [] + for t in tracks: + voices = t.get_voices() + if ((t.name and prev and prev.name) + and t.name.split(':')[0] == prev.name.split(':')[0]): + # staves[-1].voices += voices + # all global track events first + staves[-1].voices = ([staves[-1].voices[0]] + + [voices[0]] + + staves[-1].voices[1:] + + voices[1:]) + else: + staves.append(Staff(t)) + prev = t + + tag = '%% Lily was here -- automatically converted by %s from %s' % ( + ly.program_name, in_file) + + s = tag + s += r''' +\version "2.14.0" +''' + + s += r''' +\layout { + \context { + \Voice + \remove Note_heads_engraver + \consists Completion_heads_engraver + \remove Rest_engraver + \consists Completion_rest_engraver + } +} +''' + + for i in global_options.include_header: + s += '\n%% included from %(i)s\n' % locals() + s += open(i, encoding='utf-8').read() + if s[-1] != '\n': + s += '\n' + s += '% end\n' + + for i, t in enumerate(staves): + s += t.dump(i) + + s += '\n\\score {\n <<\n' + + control_track = False + i = 0 + output_track_count = 0 + for i, staff in enumerate(staves): + track_name = get_track_name(i) + item = track_first_item(staff.voices) + staff_name = track_name + context = None + if not i and not item and len(staves) > 1: + control_track = track_name + continue + elif (item and item.__class__ == Note): + context = 'Staff' + if control_track: + s += ' \\context %(context)s=%(staff_name)s \\%(control_track)s\n' % locals() + elif item and item.__class__ == Text: + context = 'Lyrics' + if context: + output_track_count += 1 + s += ' \\context %(context)s=%(staff_name)s \\%(track_name)s\n' % locals() + + # If we found a control track but no other tracks with which + # to combine it, create a Staff for the control track alone. + if (output_track_count == 0) and control_track: + s += ' \\context Staff \\%(control_track)s\n' % locals() + + s = s + r''' >> + \layout {} + \midi {} +} +''' + + if not global_options.quiet: + ly.progress(_("%s output to `%s'...") % ('LY', out_file)) + + if out_file == '-': + handle = sys.stdout + else: + handle = open(out_file, 'w', encoding='utf-8') + + handle.write(s) + handle.close() + + +def get_option_parser(): + p = ly.get_option_parser(usage=_("%s [OPTION]... FILE") % 'midi2ly', + description=_( + "Convert %s to LilyPond input.\n") % 'MIDI', + add_help_option=False) + + p.add_option('-a', '--absolute-pitches', + action='store_true', + help=_('print absolute pitches')) + p.add_option('-d', '--duration-quant', + metavar=_('DUR'), + help=_('quantise note durations on DUR')) + p.add_option('-D', '--debug', + action='store_true', + help=_('debug printing')) + p.add_option('-e', '--explicit-durations', + action='store_true', + help=_('print explicit durations')) + p.add_option('-h', '--help', + action='help', + help=_('show this help and exit')) + p.add_option('-i', '--include-header', + help=_('prepend FILE to output'), + action='append', + default=[], + metavar=_('FILE')) + p.add_option('-k', '--key', help=_('set key: ALT=+sharps|-flats; MINOR=1'), + metavar=_('ALT[:MINOR]'), + default=None), + p.add_option('-o', '--output', help=_('write output to FILE'), + metavar=_('FILE'), + action='store') + p.add_option('-p', '--preview', help=_('preview of first 4 bars'), + action='store_true') + p.add_option('-q', '--quiet', + action="store_true", + help=_("suppress progress messages and warnings about excess voices")) + p.add_option('-s', '--start-quant', help=_('quantise note starts on DUR'), + metavar=_('DUR')) + p.add_option('-S', '--skip', + action="store_true", + help=_("use s instead of r for rests")) + p.add_option('-t', '--allow-tuplet', + metavar=_('DUR*NUM/DEN'), + action='append', + dest='allowed_tuplets', + help=_('allow tuplet durations DUR*NUM/DEN'), + default=[]) + p.add_option('-V', '--verbose', help=_('be verbose'), + action='store_true') + p.version = 'midi2ly (LilyPond) 2.24.2' + p.add_option('--version', + action='version', + help=_('show version number and exit')) + p.add_option('-w', '--warranty', help=_('show warranty and copyright'), + action='store_true',) + p.add_option('-x', '--text-lyrics', help=_('treat every text as a lyric'), + action='store_true') + + p.add_option_group(_('Examples'), + description=r''' + $ midi2ly --key=-2:1 --duration-quant=32 --allow-tuplet=4*2/3 --allow-tuplet=2*4/3 foo.midi +''') + p.add_option_group('', + description=( + _('Report bugs via %s') + % 'bug-lilypond@gnu.org') + '\n') + return p + + +def do_options(): + opt_parser = get_option_parser() + (options, args) = opt_parser.parse_args() + + if options.warranty: + warranty() + sys.exit(0) + + if not args or args[0] == '-': + opt_parser.print_help() + sys.stderr.write('\n%s: %s %s\n' % (ly.program_name, _('error: '), + _('no files specified on command line.'))) + sys.exit(2) + + if options.duration_quant: + options.duration_quant = int(options.duration_quant) + + if options.key: + (alterations, minor) = list( + map(int, (options.key + ':0').split(':')))[0:2] + sharps = 0 + flats = 0 + if alterations >= 0: + sharps = alterations + else: + flats = - alterations + options.key = Key(sharps, flats, minor) + + if options.start_quant: + options.start_quant = int(options.start_quant) + + global bar_max + if options.preview: + bar_max = 4 + + options.allowed_tuplets = [list(map(int, a.replace('/', '*').split('*'))) + for a in options.allowed_tuplets] + + if options.verbose: + sys.stderr.write('Allowed tuplets: %s\n' % + repr(options.allowed_tuplets)) + + global global_options + global_options = options + + return args + + +def main(): + files = do_options() + + exts = ['.midi', '.mid', '.MID'] + for f in files: + g = f + for e in exts: + g = strip_extension(g, e) + if not os.path.exists(f): + for e in exts: + n = g + e + if os.path.exists(n): + f = n + break + + if not global_options.output: + outdir = '.' + outbase = os.path.basename(g) + o = outbase + '-midi.ly' + elif (global_options.output[-1] == os.sep + or os.path.isdir(global_options.output)): + outdir = global_options.output + outbase = os.path.basename(g) + o = os.path.join(outdir, outbase + '-midi.ly') + else: + o = global_options.output + (outdir, outbase) = os.path.split(o) + + if outdir and outdir != '.' and not os.path.exists(outdir): + os.mkdir(outdir, 0o777) + + convert_midi(f, o) + + +if __name__ == '__main__': + main() diff --git a/lilypond-2.24.2/bin/musicxml2ly.py b/lilypond-2.24.2/bin/musicxml2ly.py new file mode 100644 index 0000000000000000000000000000000000000000..53c3c9227ec8fd5c6e960b5b3557cc84d58d2cac --- /dev/null +++ b/lilypond-2.24.2/bin/musicxml2ly.py @@ -0,0 +1,3482 @@ +#!/home/lily/lilypond-2.24.2/release/binaries/dependencies/install/Python-3.10.8/bin/python3.10 +# -*- coding: utf-8 -*- +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2005--2022 Han-Wen Nienhuys , +# Jan Nieuwenhuizen , +# Reinhold Kainhofer , +# Patrick L. Schmidt +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . + + +from collections import OrderedDict +from fractions import Fraction +from functools import reduce +import gettext +import io +import optparse +import os +import re +import sys +import tempfile +import warnings +import zipfile + +""" + +# relocate-preamble.py.in +# +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 2007--2022 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . +# + +This is generic code, used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +# This is needed for installations with a non-default layout, ie where share/ +# is not next to bin/. +sys.path.insert (0, os.path.join ('/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/lilypond/2.24.2', 'python')) + +# Dynamic relocation, for installations with a default layout including GUB, +# but also for execution from the build directory. +bindir = os.path.abspath (os.path.dirname (sys.argv[0])) +topdir = os.path.dirname (bindir) +if bindir.endswith (r'/scripts/out'): + topdir = os.path.join (os.path.dirname (topdir), 'out') +datadir = os.path.abspath (os.path.join (topdir, 'share', 'lilypond')) +for v in [ 'current', '2.24.2' ]: + sys.path.insert (0, os.path.join (datadir, v, 'python')) + +""" +""" + +import musicexp +import musicxml +import musicxml2ly_conversion +import utilities + +# Load translation and install _() into Python's builtins namespace. +gettext.install('lilypond', '/home/lily/lilypond-2.24.2/release/binaries/mingw/lilypond/install/share/locale') + +import lilylib as ly + +lilypond_version = "2.24.2" + +# Store command-line options in a global variable, so we can access them everywhere +options = None + + +class Conversion_Settings: + def __init__(self): + self.ignore_beaming = False + self.convert_stem_directions = False + self.convert_rest_positions = True + + +conversion_settings = Conversion_Settings() +# Use a global variable to store the setting needed inside a \layout block. +# whenever we need to change a setting or add/remove an engraver, we can access +# this layout and add the corresponding settings +layout_information = musicexp.Layout() +# Use a global variable to store the setting needed inside a \paper block. +paper = musicexp.Paper() + +needed_additional_definitions = [] +additional_definitions = { + "tuplet-note-wrapper": """ % a formatter function, which is simply a wrapper around an existing + % tuplet formatter function. It takes the value returned by the given + % function and appends a note of given length. + #(define-public ((tuplet-number::append-note-wrapper function note) grob) + (let* ((txt (if function (function grob) #f))) + (if txt + (markup txt #:fontsize -5 #:note note UP) + (markup #:fontsize -5 #:note note UP) + ) + ) + )""", + + "tuplet-non-default-denominator": """#(define ((tuplet-number::non-default-tuplet-denominator-text denominator) grob) + (number->string (if denominator + denominator + (ly:event-property (event-cause grob) 'denominator)))) +""", + + "tuplet-non-default-fraction": """#(define ((tuplet-number::non-default-tuplet-fraction-text denominator numerator) grob) + (let* ((ev (event-cause grob)) + (den (if denominator denominator (ly:event-property ev 'denominator))) + (num (if numerator numerator (ly:event-property ev 'numerator)))) + (format #f "~a:~a" den num))) +""", +} + + +def round_to_two_digits(val): + return round(val * 100) / 100 + + +def extract_paper_information(score_partwise): + defaults = score_partwise.get_maybe_exist_named_child('defaults') + if not defaults: + return None + tenths = -1 + scaling = defaults.get_maybe_exist_named_child('scaling') + default_tenths_to_millimeters_ratio = 0.175 + default_staff_size = 20 + if scaling: + mm = scaling.get_named_child('millimeters') + mm = float(mm.get_text()) + tn = scaling.get_maybe_exist_named_child('tenths') + tn = float(tn.get_text()) + # The variable 'tenths' is actually a ratio, NOT the value of . + # TODO: rename and replace. + tenths = mm / tn + ratio = tenths / default_tenths_to_millimeters_ratio + staff_size = default_staff_size * ratio + + if 1 < staff_size < 100: + paper.global_staff_size = staff_size + else: + msg = "paper.global_staff_size %s is too large, using defaults=20" % staff_size + warnings.warn(msg) + paper.global_staff_size = 20 + + # We need the scaling(i.e. the size of staff tenths for everything! + if tenths < 0: + return None + + def from_tenths(txt): + return round_to_two_digits(float(txt) * tenths / 10) + + def set_paper_variable(varname, parent, element_name): + el = parent.get_maybe_exist_named_child(element_name) + if el: # Convert to cm from tenths + setattr(paper, varname, from_tenths(el.get_text())) + + pagelayout = defaults.get_maybe_exist_named_child('page-layout') + if pagelayout: + # TODO: How can one have different margins for even and odd pages??? + set_paper_variable("page_height", pagelayout, 'page-height') + set_paper_variable("page_width", pagelayout, 'page-width') + + if conversion_settings.convert_page_margins: + pmargins = pagelayout.get_named_children('page-margins') + for pm in pmargins: + set_paper_variable("left_margin", pm, 'left-margin') + set_paper_variable("right_margin", pm, 'right-margin') + set_paper_variable("bottom_margin", pm, 'bottom-margin') + set_paper_variable("top_margin", pm, 'top-margin') + + systemlayout = defaults.get_maybe_exist_named_child('system-layout') + if systemlayout: + sl = systemlayout.get_maybe_exist_named_child('system-margins') + if sl: + set_paper_variable("system_left_margin", sl, 'left-margin') + set_paper_variable("system_right_margin", sl, 'right-margin') + set_paper_variable("system_distance", systemlayout, 'system-distance') + set_paper_variable("top_system_distance", + systemlayout, 'top-system-distance') + + stafflayout = defaults.get_named_children('staff-layout') + for sl in stafflayout: + nr = getattr(sl, 'number', 1) + dist = sl.get_named_child('staff-distance') + # TODO: the staff distance needs to be set in the Staff context!!! + + # TODO: Finish appearance?, music-font?, word-font?, lyric-font*, lyric-language* + appearance = defaults.get_named_child('appearance') + if appearance: + lws = appearance.get_named_children('line-width') + for lw in lws: + # Possible types are: beam, bracket, dashes, + # enclosure, ending, extend, heavy barline, leger, + # light barline, octave shift, pedal, slur middle, slur tip, + # staff, stem, tie middle, tie tip, tuplet bracket, and wedge + tp = lw.type + w = from_tenths(lw.get_text()) + # TODO: Do something with these values! + nss = appearance.get_named_children('note-size') + for ns in nss: + # Possible types are: cue, grace and large + tp = ns.type + sz = from_tenths(ns.get_text()) + # TODO: Do something with these values! + # elements have no specified meaning + + rawmusicfont = defaults.get_named_child('music-font') + if rawmusicfont: + # TODO: Convert the font + pass + rawwordfont = defaults.get_named_child('word-font') + if rawwordfont: + # TODO: Convert the font + pass + rawlyricsfonts = defaults.get_named_children('lyric-font') + for lyricsfont in rawlyricsfonts: + # TODO: Convert the font + pass + + return paper + + +credit_dict = { + None: None, + '': None, + 'page number': None, # TODO: what is it used for ? + 'title': 'title', + 'subtitle': 'subtitle', + 'composer': 'composer', + 'arranger': 'arranger', + 'lyricist': 'poet', + 'rights': 'copyright' +} +# score information is contained in the , or tags +# extract those into a hash, indexed by proper lilypond header attributes + + +def extract_score_information(tree): + header = musicexp.Header() + + def set_if_exists(field, value): + if value: + header.set_field(field, utilities.escape_ly_output_string(value)) + + movement_title = tree.get_maybe_exist_named_child('movement-title') + movement_number = tree.get_maybe_exist_named_child('movement-number') + if movement_title: + set_if_exists('title', movement_title.get_text()) + if movement_number: + set_if_exists('movementnumber', movement_number.get_text()) + # set_if_exists('piece', movement_number.get_text()) # the movement number should be visible in the score. + + work = tree.get_maybe_exist_named_child('work') + if work: + work_number = work.get_work_number() + work_title = work.get_work_title() + # Overwrite the title from movement-title with work->title + set_if_exists('title', work.get_work_title()) + set_if_exists('opus', work.get_work_number()) + # Use movement-title as subtitle + if movement_title: + set_if_exists('subtitle', movement_title.get_text()) + +# TODO: Translation of opus element. Not to be confused with opus in LilyPond. MusicXML opus is a document element for opus DTD + identifications = tree.get_named_children('identification') + for ids in identifications: + set_if_exists('copyright', ids.get_rights()) + set_if_exists('composer', ids.get_composer()) + set_if_exists('arranger', ids.get_arranger()) + set_if_exists('editor', ids.get_editor()) + set_if_exists('poet', ids.get_poet()) + + set_if_exists('encodingsoftware', ids.get_encoding_software()) + set_if_exists('encodingdate', ids.get_encoding_date()) + set_if_exists('encoder', ids.get_encoding_person()) + set_if_exists('encodingdescription', ids.get_encoding_description()) + set_if_exists('source', ids.get_source()) + + # ... becomes + # \header { texidoc = ... + set_if_exists('texidoc', ids.get_file_description()) + + # Finally, apply the required compatibility modes + # Some applications created wrong MusicXML files, so we need to + # apply some compatibility mode, e.g. ignoring some features/tags + # in those files + software = ids.get_encoding_software_list() + + # Case 1: "Sibelius 5.1" with the "Dolet 3.4 for Sibelius" plugin + # is missing all beam ends => ignore all beaming information + ignore_beaming_software = { + "Dolet 4 for Sibelius, Beta 2": "Dolet 4 for Sibelius, Beta 2", + "Dolet 3.5 for Sibelius": "Dolet 3.5 for Sibelius", + "Dolet 3.4 for Sibelius": "Dolet 3.4 for Sibelius", + "Dolet 3.3 for Sibelius": "Dolet 3.3 for Sibelius", + "Dolet 3.2 for Sibelius": "Dolet 3.2 for Sibelius", + "Dolet 3.1 for Sibelius": "Dolet 3.1 for Sibelius", + "Dolet for Sibelius 1.3": "Dolet for Sibelius 1.3", + "Noteworthy Composer": "Noteworthy Composer's nwc2xm[", + } + for s in software: + app_description = ignore_beaming_software.get(s, False) + if app_description: + conversion_settings.ignore_beaming = True + ly.warning(_("Encountered file created by %s, containing " + "wrong beaming information. All beaming " + "information in the MusicXML file will be " + "ignored") % app_description) + + credits = tree.get_named_children('credit') + has_composer = False + for cred in credits: + type = credit_dict.get(cred.get_type()) + if type is None: + type = credit_dict.get(cred.find_type(credits)) + if type == 'composer': + if has_composer: + type = 'poet' + else: + has_composer = True + set_if_exists(type, cred.get_text()) + elif type == 'title': + if not work and not movement_title: + set_if_exists('title', cred.get_text()) + # elif(not(movement_title)): #bullshit! + # set_if_exists('subtitle', cred.get_text()) #bullshit! otherwise both title and subtitle show the work-title. + elif type is None: + pass + else: + set_if_exists(type, cred.get_text()) + + # TODO: Check for other unsupported features + return header + + +class PartGroupInfo: + def __init__(self): + self.start = {} + self.end = {} + + def is_empty(self): + return len(self.start) + len(self.end) == 0 + + def add_start(self, g): + self.start[getattr(g, 'number', "1")] = g + + def add_end(self, g): + self.end[getattr(g, 'number', "1")] = g + + def print_ly(self, printer): + ly.warning(_("Unprocessed PartGroupInfo %s encountered") % self) + + def ly_expression(self): + ly.warning(_("Unprocessed PartGroupInfo %s encountered") % self) + return '' + + +def staff_attributes_to_string_tunings(mxl_attr): + details = mxl_attr.get_maybe_exist_named_child('staff-details') + if not details: + return [] + lines = 6 + staff_lines = details.get_maybe_exist_named_child('staff-lines') + if staff_lines: + lines = int(staff_lines.get_text()) + tunings = [musicexp.Pitch()] * lines + staff_tunings = details.get_named_children('staff-tuning') + for i in staff_tunings: + p = musicexp.Pitch() + line = 0 + try: + line = int(i.line) - 1 + except ValueError: + pass + tunings[line] = p + + step = i.get_named_child('tuning-step') + step = step.get_text().strip() + p.step = musicxml2ly_conversion.musicxml_step_to_lily(step) + + octave = i.get_named_child('tuning-octave') + octave = octave.get_text().strip() + p.octave = int(octave) - 4 + + alter = i.get_named_child('tuning-alter') + if alter: + p.alteration = int(alter.get_text().strip()) + # lilypond seems to use the opposite ordering than MusicXML... + tunings.reverse() + return tunings + + +def staff_attributes_to_lily_staff(mxl_attr): + if not mxl_attr: + return musicexp.Staff() + + (staff_id, attributes) = list(mxl_attr.items())[0] + + # distinguish by clef: + # percussion(percussion and rhythmic), tab, and everything else + clef_sign = None + clef = attributes.get_maybe_exist_named_child('clef') + if clef: + sign = clef.get_maybe_exist_named_child('sign') + if sign: + clef_sign = {"percussion": "percussion", + "TAB": "tab"}.get(sign.get_text(), None) + + lines = 5 + details = attributes.get_named_children('staff-details') + for d in details: + staff_lines = d.get_maybe_exist_named_child('staff-lines') + if staff_lines: + lines = int(staff_lines.get_text()) + + # TODO: Handle other staff attributes like staff-space, etc. + + staff = None + if clef_sign == "percussion" and lines == 1: + staff = musicexp.RhythmicStaff() + elif clef_sign == "percussion": + staff = musicexp.DrumStaff() + # staff.drum_style_table = ??? + elif clef_sign == "tab": + staff = musicexp.TabStaff() + staff.string_tunings = staff_attributes_to_string_tunings(attributes) + # staff.tablature_format = ??? + else: + staff = musicexp.Staff() + # TODO: Handle case with lines != 5! + if lines != 5: + staff.add_context_modification( + "\\override StaffSymbol.line-count = #%s" % lines) + + return staff + + +def extract_instrument_sound(score_part): + score_instrument = score_part.get_maybe_exist_named_child( + 'score-instrument') + if not score_instrument: + return None + sound = score_instrument.get_maybe_exist_named_child('instrument-sound') + if sound: + return utilities.musicxml_sound_to_lilypond_midi_instrument(sound.get_text()) + + +def extract_score_structure(part_list, staffinfo): + score = musicexp.Score() + structure = musicexp.StaffGroup(None) + score.set_contents(structure) + + if not part_list: + return structure + + def read_score_part(el): + if not isinstance(el, musicxml.Score_part): + return + # Depending on the attributes of the first measure, we create different + # types of staves(Staff, RhythmicStaff, DrumStaff, TabStaff, etc.) + staff = staff_attributes_to_lily_staff(staffinfo.get(el.id, None)) + if not staff: + return None + staff.id = el.id + partname = el.get_maybe_exist_named_child('part-name') + # Finale gives unnamed parts the name "MusicXML Part" automatically! + if partname and partname.get_text() != "MusicXML Part": + staff.instrument_name = partname.get_text() + # part-name-display overrides part-name! + partname = el.get_maybe_exist_named_child("part-name-display") + if partname: + staff.instrument_name = extract_display_text(partname) + if hasattr(options, 'midi') and options.midi: + staff.sound = extract_instrument_sound(el) + if staff.instrument_name: + paper.indent = max(paper.indent, len(staff.instrument_name)) + paper.instrument_names.append(staff.instrument_name) + partdisplay = el.get_maybe_exist_named_child('part-abbreviation') + if partdisplay: + staff.short_instrument_name = partdisplay.get_text() + # part-abbreviation-display overrides part-abbreviation! + partdisplay = el.get_maybe_exist_named_child( + "part-abbreviation-display") + if partdisplay: + staff.short_instrument_name = extract_display_text(partdisplay) + # TODO: Read in the MIDI device / instrument + if staff.short_instrument_name: + paper.short_indent = max( + paper.short_indent, len(staff.short_instrument_name)) + + return staff + + def read_score_group(el): + if not isinstance(el, musicxml.Part_group): + return + group = musicexp.StaffGroup() + if hasattr(el, 'number'): + id = el.number + group.id = id + #currentgroups_dict[id] = group + # currentgroups.append(id) + if el.get_maybe_exist_named_child('group-name'): + group.instrument_name = el.get_maybe_exist_named_child( + 'group-name').get_text() + if el.get_maybe_exist_named_child('group-abbreviation'): + group.short_instrument_name = el.get_maybe_exist_named_child( + 'group-abbreviation').get_text() + if el.get_maybe_exist_named_child('group-symbol'): + group.symbol = el.get_maybe_exist_named_child( + 'group-symbol').get_text() + if el.get_maybe_exist_named_child('group-barline'): + group.spanbar = el.get_maybe_exist_named_child( + 'group-barline').get_text() + return group + + parts_groups = part_list.get_all_children() + + # the start/end group tags are not necessarily ordered correctly and groups + # might even overlap, so we can't go through the children sequentially! + + # 1) Replace all Score_part objects by their corresponding Staff objects, + # also collect all group start/stop points into one PartGroupInfo object + staves = [] + group_info = PartGroupInfo() + for el in parts_groups: + if isinstance(el, musicxml.Score_part): + if not group_info.is_empty(): + staves.append(group_info) + group_info = PartGroupInfo() + staff = read_score_part(el) + if staff: + staves.append(staff) + elif isinstance(el, musicxml.Part_group): + if el.type == "start": + group_info.add_start(el) + elif el.type == "stop": + group_info.add_end(el) + if not group_info.is_empty(): + staves.append(group_info) + + # 2) Now, detect the groups: + group_starts = [] + pos = 0 + while pos < len(staves): + el = staves[pos] + if isinstance(el, PartGroupInfo): + prev_start = 0 + if len(group_starts) > 0: + prev_start = group_starts[-1] + elif len(el.end) > 0: # no group to end here + el.end = {} + if len(el.end) > 0: # closes an existing group + ends = list(el.end.keys()) + prev_started = list(staves[prev_start].start.keys()) + grpid = None + intersection = [x for x in prev_started if x in ends] + if len(intersection) > 0: + grpid = intersection[0] + else: + # Close the last started group + grpid = list(staves[prev_start].start.keys())[0] + # Find the corresponding closing tag and remove it! + j = pos + 1 + foundclosing = False + while j < len(staves) and not foundclosing: + if isinstance(staves[j], PartGroupInfo) and grpid in staves[j].end: + foundclosing = True + del staves[j].end[grpid] + if staves[j].is_empty(): + del staves[j] + j += 1 + grpobj = staves[prev_start].start[grpid] + group = read_score_group(grpobj) + # remove the id from both the start and end + if grpid in el.end: + del el.end[grpid] + del staves[prev_start].start[grpid] + if el.is_empty(): + del staves[pos] + # replace the staves with the whole group + for j in staves[(prev_start + 1):pos]: + group.append_staff(j) + del staves[(prev_start + 1):pos] + staves.insert(prev_start + 1, group) + # reset pos so that we continue at the correct position + pos = prev_start + # remove an empty start group + if staves[prev_start].is_empty(): + del staves[prev_start] + group_starts.remove(prev_start) + pos -= 1 + elif len(el.start) > 0: # starts new part groups + group_starts.append(pos) + pos += 1 + + for i in staves: + structure.append_staff(i) + return score + + +def musicxml_partial_to_lily(partial_len): + if partial_len > 0: + p = musicexp.Partial() + p.partial = musicxml2ly_conversion.rational_to_lily_duration( + partial_len) + return p + else: + return None + +# Detect repeats and alternative endings in the chord event list(music_list) +# and convert them to the corresponding musicexp objects, containing nested +# music + + +def group_repeats(music_list): + repeat_replaced = True + music_start = 0 + i = 0 + # Walk through the list of expressions, looking for repeat structure + # (repeat start/end, corresponding endings). If we find one, try to find the + # last event of the repeat, replace the whole structure and start over again. + # For nested repeats, as soon as we encounter another starting repeat bar, + # treat that one first, and start over for the outer repeat. + while repeat_replaced and i < 100: + i += 1 + repeat_start = -1 # position of repeat start / end + repeat_end = -1 # position of repeat start / end + repeat_times = 0 + ending_start = -1 # position of current ending start + endings = [] # list of already finished endings + pos = 0 + last = len(music_list) - 1 + repeat_replaced = False + final_marker = 0 + while pos < len(music_list) and not repeat_replaced: + e = music_list[pos] + repeat_finished = False + if isinstance(e, musicxml2ly_conversion.RepeatMarker): + if not repeat_times and e.times: + repeat_times = e.times + if e.direction == -1: + if repeat_end >= 0: + repeat_finished = True + else: + repeat_start = pos + repeat_end = -1 + ending_start = -1 + endings = [] + elif e.direction == 1: + if repeat_start < 0: + repeat_start = 0 + if repeat_end < 0: + repeat_end = pos + final_marker = pos + elif isinstance(e, musicxml2ly_conversion.EndingMarker): + if e.direction == -1: + if repeat_start < 0: + repeat_start = 0 + if repeat_end < 0: + repeat_end = pos + ending_start = pos + elif e.direction == 1: + if ending_start < 0: + ending_start = 0 + endings.append([ending_start, pos]) + ending_start = -1 + final_marker = pos + elif not isinstance(e, musicexp.BarLine): + # As soon as we encounter an element when repeat start and end + # is set and we are not inside an alternative ending, + # this whole repeat structure is finished => replace it + if repeat_start >= 0 and repeat_end > 0 and ending_start < 0: + repeat_finished = True + + # Finish off all repeats without explicit ending bar(e.g. when + # we convert only one page of a multi-page score with repeats) + if pos == last and repeat_start >= 0: + repeat_finished = True + final_marker = pos + if repeat_end < 0: + repeat_end = pos + if ending_start >= 0: + endings.append([ending_start, pos]) + ending_start = -1 + + if repeat_finished: + # We found the whole structure replace it! + r = musicexp.RepeatedMusic() + if repeat_times <= 0: + repeat_times = 2 + r.repeat_count = repeat_times + # don't erase the first element for "implicit" repeats(i.e. no + # starting repeat bars at the very beginning) + start = repeat_start + 1 + if repeat_start == music_start: + start = music_start + r.set_music(music_list[start:repeat_end]) + for(start, end) in endings: + s = musicexp.SequentialMusic() + s.elements = music_list[start + 1:end] + r.add_ending(s) + del music_list[repeat_start:final_marker + 1] + music_list.insert(repeat_start, r) + repeat_replaced = True + pos += 1 + # TODO: Implement repeats until the end without explicit ending bar + return music_list + + +# Extract the settings for tuplets from the and the +# elements of the note: +def musicxml_tuplet_to_lily(tuplet_elt, time_modification): + tsm = musicexp.TimeScaledMusic() + fraction = (1, 1) + if time_modification: + fraction = time_modification.get_fraction() + tsm.numerator = fraction[0] + tsm.denominator = fraction[1] + + normal_type = tuplet_elt.get_normal_type() + if not normal_type and time_modification: + normal_type = time_modification.get_normal_type() + if not normal_type and time_modification: + note = time_modification.get_parent() + if note: + normal_type = note.get_duration_info() + if normal_type: + normal_note = musicexp.Duration() + (normal_note.duration_log, normal_note.dots) = normal_type + tsm.normal_type = normal_note + + actual_type = tuplet_elt.get_actual_type() + if actual_type: + actual_note = musicexp.Duration() + (actual_note.duration_log, actual_note.dots) = actual_type + tsm.actual_type = actual_note + + # Obtain non-default nrs of notes from the tuplet object! + tsm.display_numerator = tuplet_elt.get_normal_nr() + tsm.display_denominator = tuplet_elt.get_actual_nr() + + if hasattr(tuplet_elt, 'bracket') and tuplet_elt.bracket == "no": + tsm.display_bracket = None + elif hasattr(tuplet_elt, 'line-shape') and getattr(tuplet_elt, 'line-shape') == "curved": + tsm.display_bracket = "curved" + else: + tsm.display_bracket = "bracket" + + display_values = {"none": None, "actual": "actual", "both": "both"} + if hasattr(tuplet_elt, "show-number"): + tsm.display_number = display_values.get( + getattr(tuplet_elt, "show-number"), "actual") + + if hasattr(tuplet_elt, "show-type"): + tsm.display_type = display_values.get( + getattr(tuplet_elt, "show-type"), None) + + return tsm + + +def group_tuplets(music_list, events): + """Collect Musics from + MUSIC_LIST demarcated by EVENTS_LIST in TimeScaledMusic objects. + """ + + indices = [] + brackets = {} + + j = 0 + for(ev_chord, tuplet_elt, time_modification) in events: + while j < len(music_list): + if music_list[j] == ev_chord: + break + j += 1 + nr = 0 + if hasattr(tuplet_elt, 'number'): + nr = getattr(tuplet_elt, 'number') + if tuplet_elt.type == 'start': + tuplet_object = musicxml_tuplet_to_lily( + tuplet_elt, time_modification) + tuplet_info = [j, None, tuplet_object] + indices.append(tuplet_info) + brackets[nr] = tuplet_info + elif tuplet_elt.type == 'stop': + bracket_info = brackets.get(nr, None) + if bracket_info: + bracket_info[1] = j # Set the ending position to j + del brackets[nr] + + new_list = [] + last = 0 + for(i1, i2, tsm) in indices: + if i1 > i2: + continue + + new_list.extend(music_list[last:i1]) + seq = musicexp.SequentialMusic() + last = i2 + 1 + + # At this point music_list[i1:last] encompasses all the notes of the + # tuplet. There might be dynamics following this range, however, which + # apply to the last note of the tuplet. Advance last to include them + # in the range. + while last < len(music_list) and isinstance(music_list[last], musicexp.DynamicsEvent): + last += 1 + + seq.elements = music_list[i1:last] + + tsm.element = seq + + new_list.append(tsm) + # TODO: Handle nested tuplets!!!! + + new_list.extend(music_list[last:]) + return new_list + + +def musicxml_clef_to_lily(attributes): + change = musicexp.ClefChange() + (change.type, change.position, change.octave) = attributes.get_clef_information() + return change + + +def musicxml_time_to_lily(attributes): + change = musicexp.TimeSignatureChange() + # time signature function + if hasattr(options, 'shift_meter') and options.shift_meter: + tmp_meter = options.shift_meter.split("/", 1) + sig = [int(tmp_meter[0]), int(tmp_meter[1])] + change.originalFractions = attributes.get_time_signature() + else: + sig = attributes.get_time_signature() + if not sig: + return None + change.fractions = sig + + time_elm = attributes.get_maybe_exist_named_child('time') + if time_elm and hasattr(time_elm, 'symbol'): + change.style = {'single-number': "'single-digit", + 'cut': None, + 'common': None, + 'normal': "'()"}.get(time_elm.symbol, "'()") + else: + change.style = "'()" + + if getattr(time_elm, 'print-object', 'yes') == 'no': + change.visible = False + + # TODO: Handle senza-misura measures + # TODO: What shall we do if the symbol clashes with the sig? e.g. "cut" + # with 3/8 or "single-number" with(2+3)/8 or 3/8+2/4? + return change + + +def musicxml_key_to_lily(attributes): + key_sig = attributes.get_key_signature() + if not key_sig or not(isinstance(key_sig, list) or isinstance(key_sig, tuple)): + ly.warning(_("Unable to extract key signature!")) + return None + + change = musicexp.KeySignatureChange() + + if len(key_sig) == 2 and not isinstance(key_sig[0], list): + # standard key signature,(fifths, mode) + (fifths, mode) = key_sig + change.mode = mode + + start_pitch = musicexp.Pitch() + start_pitch.octave = 0 + try: + (n, a) = { + 'major': (0, 0), + 'minor': (5, 0), + 'ionian': (0, 0), + 'dorian': (1, 0), + 'phrygian': (2, 0), + 'lydian': (3, 0), + 'mixolydian': (4, 0), + 'aeolian': (5, 0), + 'locrian': (6, 0), + }[mode] + start_pitch.step = n + start_pitch.alteration = a + except KeyError: + ly.warning(_("unknown mode %s, expecting 'major' or 'minor' " + "or a church mode!") % mode) + + fifth = musicexp.Pitch() + fifth.step = 4 + if fifths < 0: + fifths *= -1 + fifth.step *= -1 + fifth.normalize() + for x in range(fifths): + start_pitch = start_pitch.transposed(fifth) + change.tonic = start_pitch + + else: + # Non-standard key signature of the form [[step,alter<,octave>],...] + # MusicXML contains C,D,E,F,G,A,B as steps, lily uses 0-7, so convert + alterations = [] + for k in key_sig: + k[0] = musicxml2ly_conversion.musicxml_step_to_lily(k[0]) + alterations.append(k) + change.non_standard_alterations = alterations + return change + + +def musicxml_transpose_to_lily(attributes): + transpose = attributes.get_transposition() + if not transpose: + return None + + shift = musicexp.Pitch() + octave_change = transpose.get_maybe_exist_named_child('octave-change') + if octave_change: + shift.octave = int(octave_change.get_text()) + chromatic_shift = int(transpose.get_named_child('chromatic').get_text()) + chromatic_shift_normalized = chromatic_shift % 12 + (shift.step, shift.alteration) = [ + (0, 0), (0, 1), (1, 0), (2, -1), (2, 0), + (3, 0), (3, 1), (4, 0), (5, -1), (5, 0), + (6, -1), (6, 0)][chromatic_shift_normalized] + + shift.octave += (chromatic_shift - chromatic_shift_normalized) // 12 + + diatonic = transpose.get_maybe_exist_named_child('diatonic') + if diatonic: + diatonic_step = int(diatonic.get_text()) % 7 + if diatonic_step != shift.step: + # We got the alter incorrect! + old_semitones = shift.semitones() + shift.step = diatonic_step + new_semitones = shift.semitones() + shift.alteration += old_semitones - new_semitones + + transposition = musicexp.Transposition() + transposition.pitch = musicexp.Pitch().transposed(shift) + return transposition + + +def musicxml_staff_details_to_lily(attributes): + details = attributes.get_maybe_exist_named_child('staff-details') + if not details: + return None + + # TODO: Handle staff-type, staff-lines, staff-tuning, capo, staff-size + ret = [] + + stafflines = details.get_maybe_exist_named_child('staff-lines') + if stafflines: + lines = int(stafflines.get_text()) + lines_event = musicexp.StaffLinesEvent(lines) + ret.append(lines_event) + + return ret + + +def musicxml_attributes_to_lily(attrs): + elts = [] + attr_dispatch = [ + ('clef', musicxml_clef_to_lily), + ('time', musicxml_time_to_lily), + ('key', musicxml_key_to_lily), + ('transpose', musicxml_transpose_to_lily), + ('staff-details', musicxml_staff_details_to_lily), + ] + for (k, func) in attr_dispatch: + children = attrs.get_named_children(k) + if children: + ev = func(attrs) + if isinstance(ev, list): + for e in ev: + elts.append(e) + elif ev: + elts.append(ev) + + return elts + + +def extract_display_text(el): + children = el.get_typed_children(musicxml.get_class("display-text")) + if children: + return " ".join([child.get_text() for child in children]) + else: + return False + + +def musicxml_print_to_lily(el): + # TODO: Implement other print attributes + # + # + elts = [] + if (hasattr(el, "new-system") and conversion_settings.convert_system_breaks): + val = getattr(el, "new-system") + if val == "yes": + elts.append(musicexp.Break("break")) + if hasattr(el, "new-page") and conversion_settings.convert_page_breaks: + val = getattr(el, "new-page") + if val == "yes": + elts.append(musicexp.Break("pageBreak")) + child = el.get_maybe_exist_named_child("part-name-display") + if child: + elts.append(musicexp.SetEvent("Staff.instrumentName", + "\"%s\"" % extract_display_text(child))) + child = el.get_maybe_exist_named_child("part-abbreviation-display") + if child: + elts.append(musicexp.SetEvent("Staff.shortInstrumentName", + "\"%s\"" % extract_display_text(child))) + return elts + + +spanner_event_dict = { + 'beam': musicexp.BeamEvent, + 'dashes': musicexp.TextSpannerEvent, + 'bracket': musicexp.BracketSpannerEvent, + 'glissando': musicexp.GlissandoEvent, + 'octave-shift': musicexp.OctaveShiftEvent, + 'pedal': musicexp.PedalEvent, + 'slide': musicexp.GlissandoEvent, + 'slur': musicexp.SlurEvent, + 'wavy-line': musicexp.TextSpannerEvent, + 'wedge': musicexp.HairpinEvent +} +spanner_type_dict = { + 'start': -1, + 'begin': -1, + 'crescendo': -1, + 'decreschendo': -1, + 'diminuendo': -1, + 'continue': 0, + 'change': 0, + 'up': -1, + 'down': -1, + 'stop': 1, + 'end': 1 +} + + +def musicxml_spanner_to_lily_event(mxl_event): + ev = None + + name = mxl_event.get_name() + func = spanner_event_dict.get(name) + if func: + ev = func() + else: + ly.warning(_('unknown span event %s') % mxl_event) + + if name == "wavy-line": + ev.style = OrnamenthasWhat(mxl_event) + + type = mxl_event.get_type() + span_direction = spanner_type_dict.get(type) + # really check for None, because some types will be translated to 0, which + # would otherwise also lead to the unknown span warning + if span_direction is not None: + ev.span_direction = span_direction + else: + ly.warning(_('unknown span type %s for %s') % (type, name)) + + ev.set_span_type(type) + ev.line_type = getattr(mxl_event, 'line-type', 'solid') + + # assign the size, which is used for octave-shift, etc. + ev.size = mxl_event.get_size() + + return ev + + +def musicxml_direction_to_indicator(direction): + return {"above": 1, "upright": 1, "up": 1, "below": -1, "downright": -1, "down": -1, "inverted": -1}.get(direction, 0) + + +def musicxml_fermata_to_lily_event(mxl_event): + + ev = musicexp.ArticulationEvent() + txt = mxl_event.get_text() + + # The contents of the element defined the shape, possible are normal, angled and square + ev.type = {"angled": "shortfermata", + "square": "longfermata"}.get(txt, "fermata") + fermata_types = {"angled": "shortfermata", + "square": "longfermata"} + + # MusicXML fermata types can be specified in two different ways: + # 1. angled and + # 2. -- both need to be handled. + if hasattr(mxl_event, 'type'): + fermata_type = fermata_types.get(mxl_event.type, 'fermata') + else: + fermata_type = fermata_types.get(mxl_event.get_text(), 'fermata') + + ev.type = fermata_type + + if hasattr(mxl_event, 'type'): + dir = musicxml_direction_to_indicator(mxl_event.type) + if dir and options.convert_directions: + ev.force_direction = dir + return ev + + +def musicxml_arpeggiate_to_lily_event(mxl_event): + ev = musicexp.ArpeggioEvent() + ev.direction = musicxml_direction_to_indicator( + getattr(mxl_event, 'direction', None)) + return ev + + +def musicxml_nonarpeggiate_to_lily_event(mxl_event): + ev = musicexp.ArpeggioEvent() + ev.non_arpeggiate = True + ev.direction = musicxml_direction_to_indicator( + getattr(mxl_event, 'direction', None)) + return ev + + +def musicxml_tremolo_to_lily_event(mxl_event): + ev = musicexp.TremoloEvent() + txt = mxl_event.get_text() + if txt: + ev.strokes = txt + else: + # This is supposed to be a default for empty tremolo elements + # TODO: Add empty tremolo element to test cases in tremolo.xml + # TODO: Test empty tremolo element + # TODO: Consideration: Is 3 really a reasonable default? + ev.strokes = "3" + return ev + + +def musicxml_falloff_to_lily_event(mxl_event): + ev = musicexp.BendEvent() + ev.alter = -4 + return ev + + +def musicxml_doit_to_lily_event(mxl_event): + ev = musicexp.BendEvent() + ev.alter = 4 + return ev + + +def musicxml_bend_to_lily_event(mxl_event): + ev = musicexp.BendEvent() + ev.alter = mxl_event.bend_alter() + return ev + + +def musicxml_breath_mark_to_lily_event(mxl_event): + # TODO: Read the child and override the type + # of symbol: comma, tick, upbow, salzedo. + return musicexp.BreatheEvent() + + +def musicxml_caesura_to_lily_event(mxl_event): + # TODO: Read the child and override the type of + # symbol: normal, thick, short, curved, single. + return musicexp.CaesuraEvent() + + +def musicxml_fingering_event(mxl_event): + ev = musicexp.ShortArticulationEvent() + ev.type = mxl_event.get_text() + return ev + + +def musicxml_string_event(mxl_event): + ev = musicexp.NoDirectionArticulationEvent() + ev.type = mxl_event.get_text() + return ev + + +def musicxml_accidental_mark(mxl_event): + ev = musicexp.MarkupEvent() + contents = {"sharp": "\\sharp", + "natural": "\\natural", + "flat": "\\flat", + "double-sharp": "\\doublesharp", + "sharp-sharp": "\\sharp\\sharp", + "flat-flat": "\\flat\\flat", + "flat-flat": "\\doubleflat", + "natural-sharp": "\\natural\\sharp", + "natural-flat": "\\natural\\flat", + "quarter-flat": "\\semiflat", + "quarter-sharp": "\\semisharp", + "three-quarters-flat": "\\sesquiflat", + "three-quarters-sharp": "\\sesquisharp", + }.get(mxl_event.get_text()) + if contents: + ev.contents = contents + return ev + else: + return None + + +# translate articulations, ornaments and other notations into ArticulationEvents +# possible values: +# -) string (ArticulationEvent with that name) +# -) function (function(mxl_event) needs to return a full ArticulationEvent-derived object +# -) (class, name) (like string, only that a different class than ArticulationEvent is used) +# TODO: Some translations are missing! +articulations_dict = { + "accent": (musicexp.ShortArticulationEvent, ">"), # or "accent" + "accidental-mark": musicxml_accidental_mark, + "bend": musicxml_bend_to_lily_event, + "breath-mark": musicxml_breath_mark_to_lily_event, + "caesura": musicxml_caesura_to_lily_event, + # "delayed-turn": "?", + "detached-legato": (musicexp.ShortArticulationEvent, "_"), # or "portato" + "doit": musicxml_doit_to_lily_event, + # "double-tongue": "?", + "down-bow": "downbow", + "falloff": musicxml_falloff_to_lily_event, + "fingering": musicxml_fingering_event, + # "fingernails": "?", + # "fret": "?", + # "hammer-on": "?", + "harmonic": "flageolet", + # "heel": "?", + "inverted-mordent": "prall", + "inverted-turn": "reverseturn", + "mordent": "mordent", + "open-string": "open", + # "plop": "?", + # "pluck": "?", + # "pull-off": "?", + # "schleifer": "?", + # "scoop": "?", + # "shake": "?", + "snap-pizzicato": "snappizzicato", + # "spiccato": "?", + # or "staccatissimo" + "staccatissimo": (musicexp.ShortArticulationEvent, "!"), + "staccato": (musicexp.ShortArticulationEvent, "."), # or "staccato" + "stopped": (musicexp.ShortArticulationEvent, "+"), # or "stopped" + # "stress": "?", + "string": musicxml_string_event, + "strong-accent": (musicexp.ShortArticulationEvent, "^"), # or "marcato" + # "tap": "?", + "tenuto": (musicexp.ShortArticulationEvent, "-"), # or "tenuto" + "thumb-position": "thumb", + # "toe": "?", + "turn": "turn", + "tremolo": musicxml_tremolo_to_lily_event, + "trill-mark": "trill", + # "triple-tongue": "?", + # "unstress": "?" + "up-bow": "upbow", + # "wavy-line": "?", +} +articulation_spanners = ["wavy-line"] + + +def OrnamenthasWhat(mxl_event): + wavy = trilly = ignore = start = stop = False + for i in mxl_event._parent._children: + if i._name == "wavy-line": + wavy = True + elif i._name == "trill-mark": + trilly = True + try: + if i.type == "continue": + ignore = True + elif i.type == "start": + start = True + elif i.type == "stop": + stop = True + except Exception: ## TODO: find out what to except. + pass + if start == True: + if wavy == True and trilly == False: + musicexp.whatOrnament = "wave" + else: + musicexp.whatOrnament = "trill" + if ignore == True: + return "ignore" + elif stop == True: + return "stop" + elif wavy == True and trilly == True: + return "trill and wave" + elif wavy == True: + return "wave" + elif trilly == True: + return "trill" + + +def OrnamenthasWavyline(mxl_event): + for i in mxl_event._parent._children: + if i._name == "wavy-line": + return True + return False + + +def musicxml_articulation_to_lily_event(mxl_event): + # wavy-line elements are treated as trill spanners, not as articulation ornaments + if mxl_event.get_name() in articulation_spanners: + return musicxml_spanner_to_lily_event(mxl_event) + + tmp_tp = articulations_dict.get(mxl_event.get_name()) + if OrnamenthasWavyline(mxl_event): + return + if not tmp_tp: + return + + if isinstance(tmp_tp, str): + ev = musicexp.ArticulationEvent() + ev.type = tmp_tp + elif isinstance(tmp_tp, tuple): + ev = tmp_tp[0]() + ev.type = tmp_tp[1] + else: + ev = tmp_tp(mxl_event) + + # Some articulations use the type attribute, other the placement... + dir = None + if hasattr(mxl_event, 'type') and hasattr(options, 'convert_directions') and options.convert_directions: + dir = musicxml_direction_to_indicator(mxl_event.type) + if hasattr(mxl_event, 'placement') and hasattr(options, 'convert_directions') and options.convert_directions: + dir = musicxml_direction_to_indicator(mxl_event.placement) + if dir: + ev.force_direction = dir + return ev + + +def musicxml_dynamics_to_lily_event(dynentry): + dynamics_available = ( + "ppppp", "pppp", "ppp", "pp", "p", "mp", "mf", + "f", "ff", "fff", "ffff", "fp", "sf", "sff", "sp", "spp", "sfz", "rfz") + dynamicsname = dynentry.get_name() + if dynamicsname == "other-dynamics": + dynamicsname = dynentry.get_text() + if not dynamicsname or dynamicsname == "#text": + return None + + if not dynamicsname in dynamics_available: + # Get rid of - in tag names (illegal in ly tags!) + dynamicstext = dynamicsname + dynamicsname = dynamicsname.replace("-", "") + additional_definitions[dynamicsname] = dynamicsname + \ + " = #(make-dynamic-script \"" + dynamicstext + "\")" + needed_additional_definitions.append(dynamicsname) + event = musicexp.DynamicsEvent() + event.type = dynamicsname + return event + +# Convert single-color two-byte strings to numbers 0.0 - 1.0 + + +def hexcolorval_to_nr(hex_val): + try: + v = int(hex_val, 16) + if v == 255: + v = 256 + return v / 256. + except ValueError: + return 0. + + +def hex_to_color(hex_val): + res = re.match( + r'#([0-9a-f][0-9a-f]|)([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$', hex_val, re.IGNORECASE) + if res: + return [hexcolorval_to_nr(x) for x in res.group(2, 3, 4)] + else: + return None + + +def font_size_number_to_lily_command(size): + d = { + (0, 8): r'\teeny', + (8, 10): r'\tiny', + (10, 12): r'\small', + (12, 16): r'', + (16, 24): r'\large', + (24, float('inf')): r'\huge', + } + result = None + for r in list(d.keys()): + if r[0] <= size < r[1]: + result = d[r] + break + return result + + +def font_size_word_to_lily_command(size): + font_size_dict = { + "xx-small": '\\teeny', + "x-small": '\\tiny', + "small": '\\small', + "medium": '', + "large": '\\large', + "x-large": '\\huge', + "xx-large": '\\larger\\huge' + } + return font_size_dict.get(size, '') + + +def get_font_size(size): + try: + size = float(size) + return font_size_number_to_lily_command(size) + except ValueError: + return font_size_word_to_lily_command(size) + + +def musicxml_words_to_lily_event(words): + event = musicexp.TextEvent() + text = words.get_text() + # remove white spaces and line breaks before text + text = re.sub('^ *\n? *', '', text) + # remove white spaces and line breaks before text + text = re.sub(' *\n? *$', '', text) + event.text = text + + if hasattr(words, 'default-y') and hasattr(options, 'convert_directions') and options.convert_directions: + offset = getattr(words, 'default-y') + try: + off = int(offset) + if off > 0: + event.force_direction = 1 + else: + event.force_direction = -1 + except ValueError: + event.force_direction = 0 + + if hasattr(words, 'font-weight'): + font_weight = {"normal": '', "bold": '\\bold'}.get( + getattr(words, 'font-weight'), '') + if font_weight: + event.markup += font_weight + + if hasattr(words, 'font-size'): + size = getattr(words, 'font-size') + # font_size = font_size_dict.get(size, '') + font_size = get_font_size(size) + if font_size: + event.markup += font_size + + if hasattr(words, 'color'): + color = getattr(words, 'color') + rgb = hex_to_color(color) + if rgb: + event.markup += "\\with-color #(rgb-color %s %s %s)" % ( + rgb[0], rgb[1], rgb[2]) + + if hasattr(words, 'font-style'): + font_style = {"italic": '\\italic'}.get( + getattr(words, 'font-style'), '') + if font_style: + event.markup += font_style + + # TODO: How should I best convert the font-family attribute? + + # TODO: How can I represent the underline, overline and line-through + # attributes in LilyPond? Values of these attributes indicate + # the number of lines + + return event + + +# convert accordion-registration to lilypond. +# Since lilypond does not have any built-in commands, we need to create +# the markup commands manually and define our own variables. +# Idea was taken from: http://lsr.dsi.unimi.it/LSR/Item?id=194 +def musicxml_accordion_to_markup(mxl_event): + commandname = "accReg" + command = "" + + high = mxl_event.get_maybe_exist_named_child('accordion-high') + if high: + commandname += "H" + command += """\\combine + \\raise #2.5 \\musicglyph #\"accordion.dot\" + """ + middle = mxl_event.get_maybe_exist_named_child('accordion-middle') + if middle: + # By default, use one dot (when no or invalid content is given). The + # MusicXML spec is quiet about this case... + txt = 1 + try: + txt = int(middle.get_text()) + except ValueError: + pass + if txt == 3: + commandname += "MMM" + command += r"""\combine + \raise #1.5 \musicglyph #"accordion.dot" + \combine + \raise #1.5 \translate #(cons 1 0) \musicglyph #"accordion.dot" + \combine + \raise #1.5 \translate #(cons -1 0) \musicglyph #"accordion.dot" + """ + elif txt == 2: + commandname += "MM" + command += r"""\combine + \raise #1.5 \translate #(cons 0.5 0) \musicglyph #"accordion.dot" + \combine + \raise #1.5 \translate #(cons -0.5 0) \musicglyph #"accordion.dot" + """ + elif not txt <= 0: + commandname += "M" + command += r"""\combine + \raise #1.5 \musicglyph #"accordion.dot" + """ + low = mxl_event.get_maybe_exist_named_child('accordion-low') + if low: + commandname += "L" + command += r"""\combine + \raise #0.5 \musicglyph #"accordion.dot" + """ + + command += r'\musicglyph #"accordion.discant"' + command = r"\markup { \normalsize %s }" % command + # Define the newly built command \accReg[H][MMM][L] + additional_definitions[commandname] = "%s = %s" % (commandname, command) + needed_additional_definitions.append(commandname) + return "\\%s" % commandname + + +def musicxml_accordion_to_ly(mxl_event): + txt = musicxml_accordion_to_markup(mxl_event) + if txt: + ev = musicexp.MarkEvent(txt) + return ev + return + + +def musicxml_rehearsal_to_ly_mark(mxl_event): + text = mxl_event.get_text() + if not text: + return + # default is boxed rehearsal marks! + encl = "box" + if hasattr(mxl_event, 'enclosure'): + encl = {"none": None, "square": "box", "circle": "circle"}.get( + mxl_event.enclosure, None) + if encl: + text = "\\%s { %s }" % (encl, text) + ev = musicexp.MarkEvent("\\markup { %s }" % text) + return ev + + +def musicxml_harp_pedals_to_ly(mxl_event): + count = 0 + result = "\\harp-pedal #\"" + for t in mxl_event.get_named_children('pedal-tuning'): + alter = t.get_named_child('pedal-alter') + if alter: + val = int(alter.get_text().strip()) + result += {1: "v", 0: "-", -1: "^"}.get(val, "") + count += 1 + if count == 3: + result += "|" + ev = musicexp.MarkupEvent() + ev.contents = result + "\"" + return ev + + +def musicxml_eyeglasses_to_ly(mxl_event): + needed_additional_definitions.append("eyeglasses") + return musicexp.MarkEvent("\\markup { \\eyeglasses }") + + +def next_non_hash_index(lst, pos): + pos += 1 + while pos < len(lst) and isinstance(lst[pos], musicxml.Hash_text): + pos += 1 + return pos + + +def musicxml_metronome_to_ly(mxl_event, text_event=None): + children = mxl_event.get_all_children() + if not children: + return + + index = -1 + index = next_non_hash_index(children, index) + if isinstance(children[index], musicxml.BeatUnit): + # first form of metronome-mark, using unit and beats/min or other unit + ev = musicexp.TempoMark() + if text_event: + ev.set_text(text_event.get_text().strip()) + + if hasattr(mxl_event, 'parentheses'): + ev.set_parentheses(mxl_event.parentheses == "yes") + + d = musicexp.Duration() + d.duration_log = utilities.musicxml_duration_to_log( + children[index].get_text()) + index = next_non_hash_index(children, index) + if isinstance(children[index], musicxml.BeatUnitDot): + d.dots = 1 + index = next_non_hash_index(children, index) + ev.set_base_duration(d) + if isinstance(children[index], musicxml.BeatUnit): + # Form "note = newnote" + newd = musicexp.Duration() + newd.duration_log = utilities.musicxml_duration_to_log( + children[index].get_text()) + index = next_non_hash_index(children, index) + if isinstance(children[index], musicxml.BeatUnitDot): + newd.dots = 1 + index = next_non_hash_index(children, index) + ev.set_new_duration(newd) + elif isinstance(children[index], musicxml.PerMinute): + # Form "note = bpm" + try: + beats = int(children[index].get_text()) + ev.set_beats_per_minute(beats) + except ValueError: + pass + else: + ly.warning(_("Unknown metronome mark, ignoring")) + return + return ev + else: + # TODO: Implement the other (more complex) way for tempo marks! + ly.warning( + _("Metronome marks with complex relations ( in MusicXML) are not yet implemented.")) + return + + +# translate directions into Events, possible values: +# -) string (MarkEvent with that command) +# -) function (function(mxl_event) needs to return a full Event-derived object +# -) (class, name) (like string, only that a different class than MarkEvent is used) +directions_dict = { + 'accordion-registration': musicxml_accordion_to_ly, + 'coda': (musicexp.MusicGlyphMarkEvent, "coda"), + # 'damp' : ??? + # 'damp-all' : ??? + 'eyeglasses': musicxml_eyeglasses_to_ly, + 'harp-pedals': musicxml_harp_pedals_to_ly, + # 'image' : ??? + 'metronome': musicxml_metronome_to_ly, + 'rehearsal': musicxml_rehearsal_to_ly_mark, + # 'scordatura' : ??? + 'segno': (musicexp.MusicGlyphMarkEvent, "segno"), + 'words': musicxml_words_to_lily_event, +} +directions_spanners = ['octave-shift', 'pedal', 'wedge', 'dashes', 'bracket'] + + +def musicxml_direction_to_lily(n): + # TODO: Handle the element! + res = [] + # placement applies to all children! + dir = None + if hasattr(n, 'placement') and hasattr(options, 'convert_directions') and options.convert_directions: + dir = musicxml_direction_to_indicator(n.placement) + dirtype_children = [] + # TODO: The direction-type is used for grouping (e.g. dynamics with text), + # so we can't simply flatten them out! + for dt in n.get_typed_children(musicxml.DirType): + dirtype_children += dt.get_all_children() + + dirtype_children = [d for d in dirtype_children if d.get_name() != "#text"] + + for i, entry in enumerate(dirtype_children): + if not entry: + continue + + # brackets, dashes, octave shifts. pedal marks, hairpins etc. are spanners: + if entry.get_name() in directions_spanners: + event = musicxml_spanner_to_lily_event(entry) + if event: + event.force_direction = dir + res.append(event) + continue + + # handle text+bpm marks like "Allegro moderato (♩ = 144)" + if entry.get_name() == 'words' and i < len(dirtype_children) - 1: + next_entry = dirtype_children[i+1] + if next_entry.get_name() == 'metronome': + event = musicxml_metronome_to_ly(next_entry, entry) + if event: + res.append(event) + dirtype_children[i+1] = None + continue + + # now treat all the "simple" ones, that can be translated using the dict + ev = None + tmp_tp = directions_dict.get(entry.get_name(), None) + if isinstance(tmp_tp, str): # string means MarkEvent + ev = musicexp.MarkEvent(tmp_tp) + elif isinstance(tmp_tp, tuple): # tuple means (EventClass, "text") + ev = tmp_tp[0](tmp_tp[1]) + elif tmp_tp: + ev = tmp_tp(entry) + if ev: + # TODO: set the correct direction! Unfortunately, \mark in ly does + # not seem to support directions! + ev.force_direction = dir + res.append(ev) + continue + + if entry.get_name() == "dynamics": + for dynentry in entry.get_all_children(): + ev = musicxml_dynamics_to_lily_event(dynentry) + if ev: + ev.force_direction = dir + res.append(ev) + + return res + + +notehead_styles_dict = { + 'slash': '\'slash', + 'triangle': '\'triangle', + 'diamond': '\'diamond', + 'square': '\'la', # TODO: Proper squared note head + 'cross': None, # TODO: + shaped note head + 'x': '\'cross', + 'circle-x': '\'xcircle', + 'inverted triangle': None, # TODO: Implement + 'arrow down': None, # TODO: Implement + 'arrow up': None, # TODO: Implement + 'slashed': None, # TODO: Implement + 'back slashed': None, # TODO: Implement + 'normal': None, + 'cluster': None, # TODO: Implement + 'none': '#f', + 'do': '\'do', + 're': '\'re', + 'mi': '\'mi', + 'fa': '\'fa', + 'so': None, + 'la': '\'la', + 'ti': '\'ti', +} + + +def musicxml_chordpitch_to_lily(mxl_cpitch): + r = musicexp.ChordPitch() + r.alteration = mxl_cpitch.get_alteration() + r.step = musicxml2ly_conversion.musicxml_step_to_lily( + mxl_cpitch.get_step()) + return r + + +chordkind_dict = { + 'major': ':5', + 'minor': ':m5', + 'augmented': ':aug5', + 'diminished': ':dim5', + # Sevenths: + 'dominant': ':7', + 'dominant-seventh': ':7', + 'major-seventh': ':maj7', + 'minor-seventh': ':m7', + 'diminished-seventh': ':dim7', + 'augmented-seventh': ':aug7', + 'half-diminished': ':dim5m7', + 'major-minor': ':maj7m5', + # Sixths: + 'major-sixth': ':6', + 'minor-sixth': ':m6', + # Ninths: + 'dominant-ninth': ':9', + 'major-ninth': ':maj9', + 'minor-ninth': ':m9', + # 11ths (usually as the basis for alteration): + 'dominant-11th': ':11', + 'major-11th': ':maj11', + 'minor-11th': ':m11', + # 13ths (usually as the basis for alteration): + 'dominant-13th': ':13.11', + 'major-13th': ':maj13.11', + 'minor-13th': ':m13', + # Suspended: + 'suspended-second': ':sus2', + 'suspended-fourth': ':sus4', + # Functional sixths: + # TODO + # 'Neapolitan': '???', + # 'Italian': '???', + # 'French': '???', + # 'German': '???', + # Other: + # 'pedal': '???',(pedal-point bass) + 'power': ':1.5', + # 'Tristan': '???', + 'other': ':1', + 'none': None, +} + + +def musicxml_chordkind_to_lily(kind): + res = chordkind_dict.get(kind, None) + # Check for None, since a major chord is converted to '' + if res is None: + ly.warning(_("Unable to convert chord type %s to lilypond.") % kind) + return res + + +# Global variable for guitar string tunings +string_tunings = None + + +def musicxml_get_string_tunings(lines): + global string_tunings + if string_tunings is None: + if not lines: + lines = 6 + string_tunings = [musicexp.Pitch()] * lines + for i in range(0, lines): + p = musicexp.Pitch() + p.step = musicxml2ly_conversion.musicxml_step_to_lily( + ((("E", "A", "D", "G", "B")*(lines/5+1))[0:lines])[i]) + p.octave = (([-2+int(x % 5 > 1)+2*(x/5) + for x in range(0, lines)][0:lines])[i]) + p.alteration = 0 + p._force_absolute_pitch = True + string_tunings[i] = p + string_tunings = string_tunings[::-1] + return string_tunings[0:lines] + + +def musicxml_frame_to_lily_event(frame): + ev = musicexp.FretEvent() + ev.strings = frame.get_strings() + ev.frets = frame.get_frets() + #offset = frame.get_first_fret() - 1 + #offset = frame.get_first_fret() + barre = [] + open_strings = list(range(1, ev.strings+1)) + for fn in frame.get_named_children('frame-note'): + fret = fn.get_fret() + if fret <= 0: + fret = "o" + el = [fn.get_string(), fret] + fingering = fn.get_fingering() + if fingering >= 0: + el.append(fingering) + ev.elements.append(el) + open_strings.remove(fn.get_string()) + b = fn.get_barre() + if b == 'start': + barre.append(el[0]) # start string + barre.append(el[1]) # fret + elif b == 'stop': + barre.insert(1, el[0]) # end string + for string in open_strings: + ev.elements.append([string, 'x']) + ev.elements.sort() + ev.elements.reverse() + if barre: + ev.barre = barre + return ev + + +def musicxml_harmony_to_lily(n): + res = [] + for f in n.get_named_children('frame'): + ev = musicxml_frame_to_lily_event(f) + if ev: + res.append(ev) + return res + + +def musicxml_harmony_to_lily_fretboards(n): + res = [] + frame = n.get_maybe_exist_named_child('frame') + if frame: + strings = frame.get_strings() + if not strings: + strings = 6 + tunings = musicxml_get_string_tunings(strings) + ev = musicexp.FretBoardEvent() + #barre = [] + for fn in frame.get_named_children('frame-note'): + fbn = musicexp.FretBoardNote() + string = fn.get_string() + fbn.string = string + fingering = fn.get_fingering() + if fingering >= 0: + fbn.fingering = fingering + p = tunings[string-1].copy() + p.add_semitones(fn.get_fret()) + fbn.pitch = p + ev.append(fbn) + res.append(ev) + return res + + +def musicxml_harmony_to_lily_chordname(n): + res = [] + root = n.get_maybe_exist_named_child('root') + if root: + ev = musicexp.ChordNameEvent() + ev.root = musicxml_chordpitch_to_lily(root) + kind = n.get_maybe_exist_named_child('kind') + if kind: + ev.kind = musicxml_chordkind_to_lily(kind.get_text()) + if not ev.kind: + return res + bass = n.get_maybe_exist_named_child('bass') + if bass: + ev.bass = musicxml_chordpitch_to_lily(bass) + inversion = n.get_maybe_exist_named_child('inversion') + if inversion: + # TODO: LilyPond does not support inversions, does it? + + # Mail from Carl Sorensen on lilypond-devel, June 11, 2008: + # 4. LilyPond supports the first inversion in the form of added + # bass notes. So the first inversion of C major would be c:/g. + # To get the second inversion of C major, you would need to do + # e:6-3-^5 or e:m6-^5. However, both of these techniques + # require you to know the chord and calculate either the fifth + # pitch (for the first inversion) or the third pitch (for the + # second inversion) so they may not be helpful for musicxml2ly. + inversion_count = int(inversion.get_text()) + if inversion_count == 1: + # TODO: Calculate the bass note for the inversion... + pass + pass + for deg in n.get_named_children('degree'): + d = musicexp.ChordModification() + d.type = deg.get_type() + d.step = deg.get_value() + d.alteration = deg.get_alter() + ev.add_modification(d) + # TODO: convert the user-symbols attribute: + # major: a triangle, like Unicode 25B3 + # minor: -, like Unicode 002D + # augmented: +, like Unicode 002B + # diminished: (degree), like Unicode 00B0 + # half-diminished: (o with slash), like Unicode 00F8 + if ev and ev.root: + res.append(ev) + return res + + +def musicxml_figured_bass_note_to_lily(n): + res = musicexp.FiguredBassNote() + suffix_dict = {'sharp': "+", + 'flat': "-", + 'natural': "!", + 'double-sharp': "++", + 'flat-flat': "--", + 'sharp-sharp': "++", + 'slash': "/"} + prefix = n.get_maybe_exist_named_child('prefix') + if prefix: + res.set_prefix(suffix_dict.get(prefix.get_text(), "")) + fnumber = n.get_maybe_exist_named_child('figure-number') + if fnumber: + res.set_number(fnumber.get_text()) + suffix = n.get_maybe_exist_named_child('suffix') + if suffix: + res.set_suffix(suffix_dict.get(suffix.get_text(), "")) + if n.get_maybe_exist_named_child('extend'): + # TODO: Implement extender lines (unfortunately, in lilypond you have + # to use \set useBassFigureExtenders = ##t, which turns them on + # globally, while MusicXML has a property for each note... + # I'm not sure there is a proper way to implement this cleanly + # n.extend + pass + return res + + +def musicxml_figured_bass_to_lily(n): + if not isinstance(n, musicxml.FiguredBass): + return + res = musicexp.FiguredBassEvent() + for i in n.get_named_children('figure'): + note = musicxml_figured_bass_note_to_lily(i) + if note: + res.append(note) + dur = n.get_maybe_exist_named_child('duration') + if dur: + # apply the duration to res + length = Fraction(int(dur.get_text()), n._divisions) * Fraction(1, 4) + res.set_real_duration(length) + duration = musicxml2ly_conversion.rational_to_lily_duration(length) + if duration: + res.set_duration(duration) + if hasattr(n, 'parentheses') and n.parentheses == "yes": + res.set_parentheses(True) + return res + + +def musicxml_lyrics_to_text(lyrics, ignoremelismata): + # TODO: Implement text styles for lyrics syllables + continued = False + extended = False + text = '' + for e in lyrics.get_all_children(): + if isinstance(e, musicxml.Syllabic): + continued = e.continued() + elif isinstance(e, musicxml.Text): + # We need to convert soft hyphens to -, otherwise the ascii codec as well + # as lilypond will barf on that character + text += e.get_text().replace('\xad', '-') + elif isinstance(e, musicxml.Elision): + if text: + text += " " + continued = False + extended = False + elif isinstance(e, musicxml.Extend): + if text: + text += " " + extended = True + + if text == "-" and continued: + return "--" + elif text == "_" and extended: + return "__" + elif continued and text: + if hasattr(options, 'convert_beaming') and options.convert_beaming: + if ignoremelismata == "on": + return r" \set ignoreMelismata = ##t " + utilities.escape_ly_output_string(text) + elif ignoremelismata == "off": + return " " + utilities.escape_ly_output_string(text) + " -- \\unset ignoreMelismata" + else: + return " " + utilities.escape_ly_output_string(text) + " --" + else: + return " " + utilities.escape_ly_output_string(text) + " -- " + elif continued: + return "--" + elif extended and text: + return " " + utilities.escape_ly_output_string(text) + " __" + elif extended: + return "__" + elif text: + return " " + utilities.escape_ly_output_string(text) + else: + return "" + +# TODO + + +class NegativeSkip: + def __init__(self, here, dest): + self.here = here + self.dest = dest + + +class LilyPondVoiceBuilder: + def __init__(self): + self.elements = [] + self.pending_dynamics = [] + self.end_moment = Fraction(0) + self.begin_moment = Fraction(0) + self.pending_multibar = Fraction(0) + self.ignore_skips = False + self.has_relevant_elements = False + self.measure_length = Fraction(4, 4) + self.stay_here = False + + def _insert_multibar(self): + layout_information.set_context_item('Score', 'skipBars = ##t') + r = musicexp.MultiMeasureRest() + lenfrac = self.measure_length + r.duration = musicxml2ly_conversion.rational_to_lily_duration(lenfrac) + r.duration.factor *= self.pending_multibar / lenfrac + self.elements.append(r) + self.begin_moment = self.end_moment + self.end_moment = self.begin_moment + self.pending_multibar + self.pending_multibar = Fraction(0) + + def set_measure_length(self, mlen): + if (mlen != self.measure_length) and self.pending_multibar: + self._insert_multibar() + self.measure_length = mlen + + def add_multibar_rest(self, duration): + self.pending_multibar += duration + + def set_duration(self, duration): + self.end_moment = self.begin_moment + duration + + def current_duration(self): + return self.end_moment - self.begin_moment + + def add_pending_dynamics(self): + for d in self.pending_dynamics: + self.elements.append(d) + self.pending_dynamics = [] + + def add_music(self, music, duration, relevant=True): + assert isinstance(music, musicexp.Music) + if self.pending_multibar > Fraction(0): + self._insert_multibar() + + self.has_relevant_elements = self.has_relevant_elements or relevant + + if isinstance(music, musicexp.BarLine): + if self.pending_dynamics: + for d in self.pending_dynamics: + if not isinstance(d, (musicexp.SpanEvent, musicexp.DynamicsEvent)): + index = self.pending_dynamics.index(d) + dyn = self.pending_dynamics.pop(index) + self.elements.append(dyn) + + self.elements.append(music) + self.begin_moment = self.end_moment + self.set_duration(duration) + + # Insert all pending dynamics right after the note/rest: + if isinstance(music, musicexp.ChordEvent) and self.pending_dynamics: + self.add_pending_dynamics() + + # Insert some music command that does not affect the position in the measure + def add_command(self, command, relevant=True): + assert isinstance(command, musicexp.Music) + if self.pending_multibar > Fraction(0): + self._insert_multibar() + self.has_relevant_elements = self.has_relevant_elements or relevant + self.elements.append(command) + + def add_barline(self, barline, relevant=False): + # Insert only if we don't have a barline already + # TODO: Implement proper merging of default barline and custom bar line + has_relevant = self.has_relevant_elements + if (not (self.elements) or + not (isinstance(self.elements[-1], musicexp.BarLine)) or + (self.pending_multibar > Fraction(0))): + + self.add_music(barline, Fraction(0)) + + self.has_relevant_elements = has_relevant or relevant + + def add_partial(self, command): + self.ignore_skips = True + # insert the partial, but restore relevant_elements (partial is not relevant) + relevant = self.has_relevant_elements + self.add_command(command) + self.has_relevant_elements = relevant + + def add_dynamics(self, dynamic): + # store the dynamic item(s) until we encounter the next note/rest: + self.pending_dynamics.append(dynamic) + + def add_bar_check(self, number): + # re/store has_relevant_elements, so that a barline alone does not + # trigger output for figured bass, chord names + b = musicexp.BarLine() + b.bar_number = number + self.add_barline(b) + + def jumpto(self, moment): + if not self.stay_here: + current_end = self.end_moment + self.pending_multibar + diff = moment - current_end + + if diff < Fraction(0): + ly.warning(_('Negative skip %s (from position %s to %s)') % + (diff, current_end, moment)) + diff = Fraction(0) + + if diff > Fraction(0) and not(self.ignore_skips and moment == 0): + skip = musicexp.SkipEvent() + duration_factor = 1 + duration_log = {1: 0, 2: 1, 4: 2, 8: 3, 16: 4, 32: 5, + 64: 6, 128: 7, 256: 8, 512: 9}.get(diff.denominator, -1) + duration_dots = 0 + # TODO: Use the time signature for skips, too. Problem: The skip + # might not start at a measure boundary! + if duration_log > 0: # denominator is a power of 2... + if diff.numerator == 3: + duration_log -= 1 + duration_dots = 1 + else: + duration_factor = Fraction(diff.numerator) + else: + # for skips of a whole or more, simply use s1*factor + duration_log = 0 + duration_factor = diff + skip.duration.duration_log = duration_log + skip.duration.factor = duration_factor + skip.duration.dots = duration_dots + + evc = musicexp.ChordEvent() + evc.elements.append(skip) + self.add_music(evc, diff, False) + + if diff > Fraction(0) and moment == 0: + self.ignore_skips = False + + def last_event_chord(self, starting_at): + value = None + + # if the position matches, find the last ChordEvent, do not cross a bar line! + at = len(self.elements) - 1 + while (at >= 0 and + not isinstance(self.elements[at], musicexp.ChordEvent) and + not isinstance(self.elements[at], musicexp.BarLine)): + at -= 1 + + if (self.elements + and at >= 0 + and isinstance(self.elements[at], musicexp.ChordEvent) + and self.begin_moment == starting_at): + value = self.elements[at] + else: + self.jumpto(starting_at) + value = None + return value + + def correct_negative_skip(self, goto): + self.end_moment = goto + self.begin_moment = goto + evc = musicexp.ChordEvent() + self.elements.append(evc) + + +class VoiceData: + def __init__(self): + self.voicename = None + self.voicedata = None + self.ly_voice = None + self.figured_bass = None + self.chordnames = None + self.fretboards = None + self.lyrics_dict = {} + self.lyrics_order = [] + + +def measure_length_from_attributes(attr, current_measure_length): + len = attr.get_measure_length() + if not len: + len = current_measure_length + return len + + +def music_xml_voice_name_to_lily_name(part_id, name): + s = "Part%sVoice%s" % (part_id, name) + return musicxml_id_to_lily(s) + + +def music_xml_lyrics_name_to_lily_name(part_id, name, lyricsnr): + s = music_xml_voice_name_to_lily_name( + part_id, name)+("Lyrics%s" % lyricsnr) + return musicxml_id_to_lily(s) + + +def music_xml_figuredbass_name_to_lily_name(part_id, voicename): + s = music_xml_voice_name_to_lily_name(part_id, voicename)+"FiguredBass" + return musicxml_id_to_lily(s) + + +def music_xml_chordnames_name_to_lily_name(part_id, voicename): + s = music_xml_voice_name_to_lily_name(part_id, voicename)+"Chords" + return musicxml_id_to_lily(s) + + +def music_xml_fretboards_name_to_lily_name(part_id, voicename): + s = music_xml_voice_name_to_lily_name(part_id, voicename)+"FretBoards" + return musicxml_id_to_lily(s) + + +def get_all_lyric_parts_in_voice(voice): + r''' + Collect the indexes of all lyric parts in this voice. + In case not all of the current lyric parts are active (a typical case would be + a refrain/chorus), the current implementation inserts \skip-commands in the + inactive parts to keep them in sync. + ''' + all_lyric_parts = [] + for elem in voice._elements: + lyrics = elem.get_typed_children(musicxml.Lyric) + if lyrics: + for lyric in lyrics: + index = lyric.get_number() + if not index in all_lyric_parts: + all_lyric_parts.append(index) + return all_lyric_parts + + +def extract_lyrics(voice, lyric_key, lyrics_dict): + curr_number = None + result = [] + + def is_note(elem): + return isinstance(elem, musicxml.Note) + + def is_rest(elem): + return elem.get_typed_children(musicxml.Rest) + + def is_chord(elem): + return elem.get_typed_children(musicxml.Chord) + + def is_note_and_not_rest(elem): + return is_note(elem) and not is_rest(elem) + + def get_lyric_elements(note): + return note.get_typed_children(musicxml.Lyric) + + def has_lyric_belonging_to_lyric_part(note, lyric_part_id): + lyric_elements = get_lyric_elements(note) + lyric_numbers = [lyric.get_number() for lyric in lyric_elements] + return any([lyric_number == lyric_part_id for lyric_number in lyric_numbers]) + + for idx, elem in enumerate(voice._elements): + lyrics = get_lyric_elements(elem) + lyric_keys = [lyric.get_number() for lyric in lyrics] + note_has_lyric_belonging_to_lyric_part = lyric_key in lyric_keys + # Current note has lyric with 'number' matching 'lyric_key'. + if note_has_lyric_belonging_to_lyric_part: + for lyric in lyrics: + if lyric.get_number() == lyric_key: + text = musicxml_lyrics_to_text(lyric, None) + result.append(text) + # Note has any lyric. + elif get_lyric_elements(elem) and \ + not note_has_lyric_belonging_to_lyric_part: + result.append(r'\skip1 ') + # Note does not have any lyric attached to it. + elif is_chord(elem): + # note without lyrics part of a chord. MusicXML format is + # unclear if a chord element could contain a lyric, lets + # asume that we do not want to put a skip here. + continue + elif is_note_and_not_rest(elem): + result.append(r'\skip1 ') + + lyrics_dict[lyric_key].extend(result) + + +def musicxml_voice_to_lily_voice(voice): + tuplet_events = [] + lyrics = {} + return_value = VoiceData() + return_value.voicedata = voice + + # First pitch needed for relative mode (if selected in command-line options) + first_pitch = None + + # Needed for melismata detection (ignore lyrics on those notes!): + inside_slur = False + is_tied = False + is_chord = False + is_beamed = False + ignore_lyrics = False + + current_staff = None + + pending_figured_bass = [] + pending_chordnames = [] + pending_fretboards = [] + + # Make sure that the keys in the dict don't get reordered, since + # we need the correct ordering of the lyrics stanzas! By default, + # a dict will reorder its keys + return_value.lyrics_order = voice.get_lyrics_numbers() + for k in return_value.lyrics_order: + lyrics[k] = [] + + voice_builder = LilyPondVoiceBuilder() + figured_bass_builder = LilyPondVoiceBuilder() + chordnames_builder = LilyPondVoiceBuilder() + fretboards_builder = LilyPondVoiceBuilder() + current_measure_length = Fraction(4, 4) + voice_builder.set_measure_length(current_measure_length) + in_slur = False + + all_lyric_parts = set(get_all_lyric_parts_in_voice(voice)) + if list(lyrics.keys()): + for number in list(lyrics.keys()): + extracted_lyrics = extract_lyrics(voice, number, lyrics) + + last_bar_check = -1 + for idx, n in enumerate(voice._elements): + tie_started = False + if n.get_name() == 'forward': + continue + staff = n.get_maybe_exist_named_child('staff') + if staff: + staff = staff.get_text() + if current_staff and staff != current_staff and not n.get_maybe_exist_named_child('chord'): + voice_builder.add_command(musicexp.StaffChange(staff)) + current_staff = staff + + if isinstance(n, musicxml.Partial) and n.partial > 0: + a = musicxml_partial_to_lily(n.partial) + if a: + voice_builder.add_partial(a) + figured_bass_builder.add_partial(a) + chordnames_builder.add_partial(a) + fretboards_builder.add_partial(a) + continue + + is_chord = n.get_maybe_exist_named_child('chord') + is_after_grace = (isinstance(n, musicxml.Note) and n.is_after_grace()) + if not is_chord and not is_after_grace: + try: + voice_builder.jumpto(n._when) + figured_bass_builder.jumpto(n._when) + chordnames_builder.jumpto(n._when) + fretboards_builder.jumpto(n._when) + except NegativeSkip as neg: + voice_builder.correct_negative_skip(n._when) + figured_bass_builder.correct_negative_skip(n._when) + chordnames_builder.correct_negative_skip(n._when) + fretboards_builder.correct_negative_skip(n._when) + n.message(_("Negative skip found: from %s to %s, difference is %s") % ( + neg.here, neg.dest, neg.dest - neg.here)) + + if isinstance(n, musicxml.Barline): + barlines = n.to_lily_object() + for a in barlines: + if isinstance(a, musicexp.BarLine): + voice_builder.add_barline(a) + figured_bass_builder.add_barline(a, False) + chordnames_builder.add_barline(a, False) + fretboards_builder.add_barline(a, False) + elif isinstance(a, musicxml2ly_conversion.RepeatMarker) or isinstance(a, musicxml2ly_conversion.EndingMarker): + voice_builder.add_command(a) + figured_bass_builder.add_barline(a, False) + chordnames_builder.add_barline(a, False) + fretboards_builder.add_barline(a, False) + continue + + if isinstance(n, musicxml.Print): + for a in musicxml_print_to_lily(n): + voice_builder.add_command(a, False) + continue + + # Continue any multimeasure-rests before trying to add bar checks! + # Don't handle new MM rests yet, because for them we want bar checks! + rest = n.get_maybe_exist_typed_child(musicxml.Rest) + if (rest and rest.is_whole_measure() + and voice_builder.pending_multibar > Fraction(0)): + voice_builder.add_multibar_rest(n._duration) + continue + + # Print bar checks between measures. + if n._measure_position == Fraction(0) and n != voice._elements[0]: + try: + num = int(n.get_parent().number) + except ValueError: + num = 0 + if num > 0 and num > last_bar_check: + voice_builder.add_bar_check(num) + figured_bass_builder.add_bar_check(num) + chordnames_builder.add_bar_check(num) + fretboards_builder.add_bar_check(num) + last_bar_check = num + + if isinstance(n, musicxml.Direction): + # check if Direction already has been converted in another voice. + if n.converted: + continue + else: + n.converted = True + for direction in musicxml_direction_to_lily(n): + if direction.wait_for_note(): + voice_builder.add_dynamics(direction) + else: + voice_builder.add_command(direction) + continue + + # Start any new multimeasure rests + if (rest and rest.is_whole_measure()): + if pending_chordnames: + chordnames_builder.jumpto(n._when) + chordnames_builder.stay_here = True + if pending_figured_bass: + figured_bass_builder.jumpto(n._when) + figured_bass_builder.stay_here = True + if pending_fretboards: + fretboards_builder.jumpto(n._when) + fretboards_builder.stay_here = True + voice_builder.add_multibar_rest(n._duration) + continue + + if isinstance(n, musicxml.Harmony): + if options.fretboards: + # Makes fretboard diagrams in a separate FretBoards voice + for a in musicxml_harmony_to_lily_fretboards(n): + pending_fretboards.append(a) + else: + # Makes markup fretboard-diagrams inside the voice + for a in musicxml_harmony_to_lily(n): + if a.wait_for_note(): + voice_builder.add_dynamics(a) + else: + voice_builder.add_command(a) + for a in musicxml_harmony_to_lily_chordname(n): + pending_chordnames.append(a) + continue + + if isinstance(n, musicxml.FiguredBass): + a = musicxml_figured_bass_to_lily(n) + if a: + pending_figured_bass.append(a) + continue + + if isinstance(n, musicxml.Attributes): + for a in musicxml_attributes_to_lily(n): + voice_builder.add_command(a) + measure_length = measure_length_from_attributes( + n, current_measure_length) + if current_measure_length != measure_length: + current_measure_length = measure_length + voice_builder.set_measure_length(current_measure_length) + continue + + if not n.__class__.__name__ == 'Note': + n.message(_('unexpected %s; expected %s or %s or %s') % + (n, 'Note', 'Attributes', 'Barline')) + continue + +# if not hasattr(conversion_settings, 'convert_rest_positions'): +# conversion_settings.convert_rest_positions = True + + main_event = n.to_lily_object( + convert_stem_directions=conversion_settings.convert_stem_directions, + convert_rest_positions=conversion_settings.convert_rest_positions) + + if main_event and not first_pitch: + first_pitch = main_event.pitch + # ignore lyrics for notes inside a slur, tie, chord or beam + ignore_lyrics = is_tied or is_chord # or is_beamed or inside_slur + + ev_chord = voice_builder.last_event_chord(n._when) + if not ev_chord: + ev_chord = musicexp.ChordEvent() + voice_builder.add_music(ev_chord, n._duration) + + # For grace notes: + grace = n.get_maybe_exist_typed_child(musicxml.Grace) + if n.is_grace(): + is_after_grace = ev_chord.has_elements() or n.is_after_grace() + is_chord = n.get_maybe_exist_typed_child(musicxml.Chord) + + grace_chord = None + + # after-graces and other graces use different lists; Depending on + # whether we have a chord or not, obtain either a new ChordEvent or + # the previous one to create a chord + if is_after_grace: + if ev_chord.after_grace_elements and n.get_maybe_exist_typed_child(musicxml.Chord): + grace_chord = ev_chord.after_grace_elements.get_last_event_chord() + if not grace_chord: + grace_chord = musicexp.ChordEvent() + ev_chord.append_after_grace(grace_chord) + elif n.is_grace(): + if ev_chord.grace_elements and n.get_maybe_exist_typed_child(musicxml.Chord): + grace_chord = ev_chord.grace_elements.get_last_event_chord() + if not grace_chord: + grace_chord = musicexp.ChordEvent() + ev_chord.append_grace(grace_chord) + + if hasattr(grace, 'slash') and not is_after_grace: + # TODO: use grace_type = "appoggiatura" for slurred grace notes + if grace.slash == "yes": + ev_chord.grace_type = "acciaccatura" + # now that we have inserted the chord into the grace music, insert + # everything into that chord instead of the ev_chord + ev_chord = grace_chord + ev_chord.append(main_event) + ignore_lyrics = True + else: + ev_chord.append(main_event) + # When a note/chord has grace notes (duration==0), the duration of the + # event chord is not yet known, but the event chord was already added + # with duration 0. The following correct this when we hit the real note! + if voice_builder.current_duration() == 0 and n._duration > 0: + voice_builder.set_duration(n._duration) + + # if we have a figured bass, set its voice builder to the correct position + # and insert the pending figures + if pending_figured_bass: + try: + figured_bass_builder.jumpto(n._when) + if figured_bass_builder.stay_here: + figured_bass_builder.stay_here = False + except NegativeSkip as neg: + pass + for fb in pending_figured_bass: + # if a duration is given, use that, otherwise the one of the note + dur = fb.real_duration + if not dur: + dur = ev_chord.get_length() + if not fb.duration: + fb.duration = ev_chord.get_duration() + figured_bass_builder.add_music(fb, dur) + pending_figured_bass = [] + + if pending_chordnames: + try: + chordnames_builder.jumpto(n._when) + if chordnames_builder.stay_here: + chordnames_builder.stay_here = False + except NegativeSkip as neg: + pass + for cn in pending_chordnames: + # Assign the duration of the EventChord + cn.duration = ev_chord.get_duration() + chordnames_builder.add_music(cn, ev_chord.get_length()) + pending_chordnames = [] + + if pending_fretboards: + try: + fretboards_builder.jumpto(n._when) + if fretboards_builder.stay_here: + fretboards_builder.stay_here = False + except NegativeSkip as neg: + pass + for fb in pending_fretboards: + # Assign the duration of the EventChord + fb.duration = ev_chord.get_duration() + fretboards_builder.add_music(fb, ev_chord.get_length()) + pending_fretboards = [] + + notations_children = n.get_typed_children(musicxml.Notations) + tuplet_event = None + span_events = [] + + # The element can have the following children (+ means implemented, ~ partially, - not): + # +tied | +slur | +tuplet | glissando | slide | + # ornaments | technical | articulations | dynamics | + # +fermata | arpeggiate | non-arpeggiate | + # accidental-mark | other-notation + for notations in notations_children: + for tuplet_event in notations.get_tuplets(): + time_mod = n.get_maybe_exist_typed_child( + musicxml.Time_modification) + tuplet_events.append((ev_chord, tuplet_event, time_mod)) + + # First, close all open slurs, only then start any new slur + # TODO: Record the number of the open slur to dtermine the correct + # closing slur! + endslurs = [s for s in notations.get_named_children('slur') + if s.get_type() in ('stop')] + if endslurs and not inside_slur: + endslurs[0].message( + _('Encountered closing slur, but no slur is open')) + elif endslurs: + if len(endslurs) > 1: + endslurs[0].message( + _('Cannot have two simultaneous (closing) slurs')) + # record the slur status for the next note in the loop + inside_slur = False + lily_ev = musicxml_spanner_to_lily_event(endslurs[0]) + ev_chord.append(lily_ev) + + startslurs = [s for s in notations.get_named_children('slur') + if s.get_type() in ('start')] + if startslurs and inside_slur: + startslurs[0].message( + _('Cannot have a slur inside another slur')) + elif startslurs: + if len(startslurs) > 1: + startslurs[0].message( + _('Cannot have two simultaneous slurs')) + # record the slur status for the next note in the loop + inside_slur = True + lily_ev = musicxml_spanner_to_lily_event(startslurs[0]) + ev_chord.append(lily_ev) + + if not grace: + mxl_tie = notations.get_tie() + if mxl_tie and mxl_tie.type == 'start': + ev_chord.append(musicexp.TieEvent()) + is_tied = True + tie_started = True + else: + is_tied = False + + fermatas = notations.get_named_children('fermata') + for a in fermatas: + ev = musicxml_fermata_to_lily_event(a) + if ev: + ev_chord.append(ev) + + arpeggiate = notations.get_named_children('arpeggiate') + for a in arpeggiate: + ev = musicxml_arpeggiate_to_lily_event(a) + if ev: + ev_chord.append(ev) + + arpeggiate = notations.get_named_children('non-arpeggiate') + for a in arpeggiate: + ev = musicxml_nonarpeggiate_to_lily_event(a) + if ev: + ev_chord.append(ev) + + glissandos = notations.get_named_children('glissando') + glissandos += notations.get_named_children('slide') + for a in glissandos: + ev = musicxml_spanner_to_lily_event(a) + if ev: + ev_chord.append(ev) + + # accidental-marks are direct children of ! + for a in notations.get_named_children('accidental-mark'): + ev = musicxml_articulation_to_lily_event(a) + if ev: + ev_chord.append(ev) + + # Articulations can contain the following child elements: + # accent | strong-accent | staccato | tenuto | + # detached-legato | staccatissimo | spiccato | + # scoop | plop | doit | falloff | breath-mark | + # caesura | stress | unstress + # Technical can contain the following child elements: + # up-bow | down-bow | harmonic | open-string | + # thumb-position | fingering | pluck | double-tongue | + # triple-tongue | stopped | snap-pizzicato | fret | + # string | hammer-on | pull-off | bend | tap | heel | + # toe | fingernails | other-technical + # Ornaments can contain the following child elements: + # trill-mark | turn | delayed-turn | inverted-turn | + # shake | wavy-line | mordent | inverted-mordent | + # schleifer | tremolo | other-ornament, accidental-mark + ornaments = notations.get_named_children('ornaments') + ornaments += notations.get_named_children('articulations') + ornaments += notations.get_named_children('technical') + + for a in ornaments: + for ch in a.get_all_children(): + ev = musicxml_articulation_to_lily_event(ch) + if ev: + ev_chord.append(ev) + + dynamics = notations.get_named_children('dynamics') + for a in dynamics: + for ch in a.get_all_children(): + ev = musicxml_dynamics_to_lily_event(ch) + if ev: + ev_chord.append(ev) + + mxl_beams = [b for b in n.get_named_children('beam') + if (b.get_type() in ('begin', 'end') + and b.is_primary())] + if mxl_beams and not conversion_settings.ignore_beaming: + beam_ev = musicxml_spanner_to_lily_event(mxl_beams[0]) + if beam_ev: + ev_chord.append(beam_ev) + if beam_ev.span_direction == -1: # beam and thus melisma starts here + is_beamed = True + elif beam_ev.span_direction == 1: # beam and thus melisma ends here + is_beamed = False + + # Assume that a element only lasts for one note. + # This might not be correct MusicXML interpretation, but works for + # most cases and fixes broken files, which have the end tag missing + if is_tied and not tie_started: + is_tied = False + + # force trailing mm rests to be written out. + voice_builder.add_music (musicexp.ChordEvent(), Fraction(0)) + + if hasattr(options, 'shift_meter') and options.shift_meter: + for event in voice_builder.elements: + if isinstance(event, musicexp.TimeSignatureChange): + sd = [] + for i in range(0, 5): + sd.append(musicexp.ShiftDurations()) + sd[i].set_shift_durations_parameters(event) + break + + ly_voice = group_tuplets(voice_builder.elements, tuplet_events) + ly_voice = group_repeats(ly_voice) + + seq_music = musicexp.SequentialMusic() + + seq_music.elements = ly_voice + for k in list(lyrics.keys()): + return_value.lyrics_dict[k] = musicexp.Lyrics() + return_value.lyrics_dict[k].lyrics_syllables = lyrics[k] + + if hasattr(options, 'shift_meter') and options.shift_meter: + sd[-1].element = seq_music + seq_music = sd[-1] + sd.pop() + + if hasattr(options, 'relative') and options.relative: + v = musicexp.RelativeMusic() + v.element = seq_music + v.basepitch = first_pitch + seq_music = v + + return_value.ly_voice = seq_music + + # create \figuremode { figured bass elements } + if figured_bass_builder.has_relevant_elements: + fbass_music = musicexp.SequentialMusic() + fbass_music.elements = group_repeats(figured_bass_builder.elements) + v = musicexp.ModeChangingMusicWrapper() + v.mode = 'figuremode' + v.element = fbass_music + if hasattr(options, 'shift_meter') and options.shift_meter: + sd[-1].element = v + v = sd[-1] + sd.pop() + return_value.figured_bass = v + + # create \chordmode { chords } + if chordnames_builder.has_relevant_elements: + cname_music = musicexp.SequentialMusic() + cname_music.elements = group_repeats(chordnames_builder.elements) + v = musicexp.ModeChangingMusicWrapper() + v.mode = 'chordmode' + v.element = cname_music + if hasattr(options, 'shift_meter') and options.shift_meter: + sd[-1].element = v + v = sd[-1] + sd.pop() + return_value.chordnames = v + + # create diagrams for FretBoards engraver + if fretboards_builder.has_relevant_elements: + fboard_music = musicexp.SequentialMusic() + fboard_music.elements = group_repeats(fretboards_builder.elements) + v = musicexp.MusicWrapper() + v.element = fboard_music + if hasattr(options, 'shift_meter') and options.shift_meter: + sd[-1].element = v + v = sd[-1] + sd.pop() + return_value.fretboards = v + + # coll = [] + # pending = [] + + # for elt in return_value.ly_voice.element.elements: + # if isinstance(elt, musicexp.TimeScaledMusic): + # print elt.element.elements + # pending.append(elt) + # else: + # coll.append(elt) + + # if pending: + # coll.extend(pending) + + # return_value.ly_voice.element.elements = coll + + return return_value + + +def musicxml_id_to_lily(id): + digits = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', + 'Six', 'Seven', 'Eight', 'Nine', 'Ten'] + + for digit in digits: + d = digits.index(digit) + id = re.sub('%d' % d, digit, id) + + id = re.sub('[^a-zA-Z]', 'X', id) + return id + + +def voices_in_part(part): + """Return a Name -> Voice dictionary for PART""" + part.interpret() + part.extract_voices() + voices = part.get_voices() + part_info = part.get_staff_attributes() + + return (voices, part_info) + + +def voices_in_part_in_parts(parts): + """return a Part -> Name -> Voice dictionary""" + # don't crash if Part doesn't have an id (that's invalid MusicXML, + # but such files are out in the wild!) + dictionary = {} + for p in parts: + voices = voices_in_part(p) + if hasattr(p, "id"): + dictionary[p.id] = voices + else: + # TODO: extract correct part id from other sources + dictionary[None] = voices + return dictionary + + +def get_all_voices(parts): + all_voices = voices_in_part_in_parts(parts) + + all_ly_voices = {} + all_ly_staffinfo = {} + for p, (name_voice, staff_info) in list(all_voices.items()): + + part_ly_voices = OrderedDict() + for n, v in list(name_voice.items()): + ly.progress(_("Converting to LilyPond expressions..."), True) + # musicxml_voice_to_lily_voice returns (lily_voice, {nr->lyrics, nr->lyrics}) + voice = musicxml_voice_to_lily_voice(v) + part_ly_voices[n] = voice + + all_ly_voices[p] = part_ly_voices + all_ly_staffinfo[p] = staff_info + + return (all_ly_voices, all_ly_staffinfo) + + +def option_parser(): + p = ly.get_option_parser(usage=_("musicxml2ly [OPTION]... FILE.xml"), + description=_("""Convert MusicXML from FILE.xml to LilyPond input. +If the given filename is -, musicxml2ly reads from the command line. +"""), add_help_option=False) + + p.add_option("-h", "--help", + action="help", + help=_("show this help and exit")) + + p.version = ('%prog (LilyPond) ' + lilypond_version + '\n\n' + + + _("""Copyright (c) 2005--2023 by + Han-Wen Nienhuys , + Jan Nieuwenhuizen and + Reinhold Kainhofer + Patrick L. Schmidt +""" + + + """ +This program is free software. It is covered by the GNU General Public +License and you are welcome to change it and/or distribute copies of it +under certain conditions. Invoke as `%s --warranty' for more +information.""") % 'lilypond') + + p.add_option("--version", + action="version", + help=_("show version number and exit")) + + p.add_option('-v', '--verbose', + action="callback", + callback=ly.handle_loglevel_option, + callback_args=("DEBUG",), + help=_("be verbose")) + + p.add_option('', '--lxml', + action="store_true", + default=False, + dest="use_lxml", + help=_("use lxml.etree; uses less memory and cpu time")) + + p.add_option('-z', '--compressed', + action="store_true", + dest='compressed', + default=False, + help=_("input file is a compressed MusicXML file " + "(by default, activate if file extension is .mxl)")) + + p.add_option('-r', '--relative', + action="store_true", + default=True, + dest="relative", + help=_("convert pitches in relative mode (default)")) + + p.add_option('-a', '--absolute', + action="store_false", + dest="relative", + help=_("convert pitches in absolute mode")) + + p.add_option('-l', '--language', + metavar=_("LANG"), + action="store", + help=_("use LANG for pitch names, e.g. 'deutsch' for note names in German")) + + p.add_option("--loglevel", + help=_("Print log messages according to LOGLEVEL " + "(NONE, ERROR, WARNING, PROGRESS (default), DEBUG)"), + metavar=_("LOGLEVEL"), + action='callback', + callback=ly.handle_loglevel_option, + type='string') + + p.add_option('--nd', '--no-articulation-directions', + action="store_false", + default=True, + dest="convert_directions", + help=_("do not convert directions (^, _ or -) for articulations, dynamics, etc.")) + + p.add_option('--nrp', '--no-rest-positions', + action="store_false", + default=True, + dest="convert_rest_positions", + help=_("do not convert exact vertical positions of rests")) + + p.add_option('--nsb', '--no-system-breaks', + action="store_false", + default=True, + dest="convert_system_breaks", + help=_("ignore system breaks")) + + p.add_option('--npb', '--no-page-breaks', + action="store_false", + default=True, + dest="convert_page_breaks", + help=_("ignore page breaks")) + + p.add_option('--npm', '--no-page-margins', + action="store_false", + default=True, + dest="convert_page_margins", + help=_("ignore page margins")) + + p.add_option('--npl', '--no-page-layout', + action="store_false", + default=True, + dest="convert_page_layout", + help=_("do not convert the exact page layout and breaks (shortcut for \"--nsb --npb --npm\" options)")) + + p.add_option('--nsd', '--no-stem-directions', + action="store_false", + default=True, + dest="convert_stem_directions", + help=_("ignore stem directions from MusicXML, use lilypond's automatic stemming instead")) + + p.add_option('--nb', '--no-beaming', + action="store_false", + default=True, + dest="convert_beaming", + help=_("do not convert beaming information, use lilypond's automatic beaming instead")) + + p.add_option('-o', '--output', + metavar=_("FILE"), + action="store", + default=None, + type='string', + dest='output_name', + help=_("set output filename to FILE, stdout if -")) + + p.add_option('-m', '--midi', + action="store_true", + default=False, + dest="midi", + help=_("activate midi-block in .ly file")) + + # transpose function + p.add_option('--transpose', + metavar=_("TOPITCH"), + action="store", + dest="transpose", + help=_("set pitch to transpose by the interval between pitch 'c' and TOPITCH")) + + # time signature changing function + p.add_option('--sm', '--shift-meter', + metavar=_("BEATS/BEATTYPE"), + action="store", + dest="shift_meter", + help=_("change the length|duration of notes as a function of a given time signature to make the score look faster or slower, (eg. '4/4' or '2/2')")) + + # switch tabstaff clef + p.add_option('--tc', '--tab-clef', + metavar=_("TABCLEFNAME"), + action="store", + dest="tab_clef", + help=_("switch between two versions of tab clefs (\"tab\" and \"moderntab\")")) + + # StringNumber stencil on/off + p.add_option('--sn', '--string-numbers', + metavar=_("t[rue]/f[alse]"), + action="store", + dest="string_numbers", + help=_("deactivate string number stencil with --string-numbers f[alse]. Default is t[rue]")) + + # StringNumber stencil on/off + p.add_option('--fb', '--fretboards', + action="store_true", + default=False, + dest="fretboards", + help=_("converts '' events to a separate FretBoards voice instead of markups")) + + p.add_option_group('', + description=( + _("Report bugs via %s") + % 'bug-lilypond@gnu.org') + '\n') + return p + + +def print_voice_definitions(printer, part_list, voices): + for part in part_list: + part_id = part.id + nv_dict = voices.get(part_id, {}) + for (name, voice) in list(nv_dict.items()): + k = music_xml_voice_name_to_lily_name(part_id, name) + printer.dump('%s = ' % k) + voice.ly_voice.print_ly(printer) + printer.newline() + if voice.chordnames: + cnname = music_xml_chordnames_name_to_lily_name(part_id, name) + printer.dump('%s = ' % cnname) + voice.chordnames.print_ly(printer) + printer.newline() + for l in voice.lyrics_order: + lname = music_xml_lyrics_name_to_lily_name(part_id, name, l) + printer.dump('%s = ' % lname) + voice.lyrics_dict[l].print_ly(printer) + printer.newline() + if voice.figured_bass: + fbname = music_xml_figuredbass_name_to_lily_name(part_id, name) + printer.dump('%s = ' % fbname) + voice.figured_bass.print_ly(printer) + printer.newline() + if voice.fretboards: + fbdname = music_xml_fretboards_name_to_lily_name(part_id, name) + printer.dump('%s = ' % fbdname) + voice.fretboards.print_ly(printer) + printer.newline() + + +# format the information about the staff in the form +# [staffid, +# [ +# [voiceid1, [lyricsid11, lyricsid12,...], figuredbassid1], +# [voiceid2, [lyricsid21, lyricsid22,...], figuredbassid2], +# ... +# ] +# ] +# raw_voices is of the form [(voicename, lyricsids, havefiguredbass)*] + + +def format_staff_info(part_id, staff_id, raw_voices): + voices = [] + for (v, lyricsids, figured_bass, chordnames, fretboards) in raw_voices: + voice_name = music_xml_voice_name_to_lily_name(part_id, v) + voice_lyrics = [music_xml_lyrics_name_to_lily_name(part_id, v, l) + for l in lyricsids] + figured_bass_name = '' + if figured_bass: + figured_bass_name = music_xml_figuredbass_name_to_lily_name( + part_id, v) + chordnames_name = '' + if chordnames: + chordnames_name = music_xml_chordnames_name_to_lily_name( + part_id, v) + fretboards_name = '' + if fretboards: + fretboards_name = music_xml_fretboards_name_to_lily_name( + part_id, v) + voices.append([voice_name, voice_lyrics, figured_bass_name, + chordnames_name, fretboards_name]) + return [staff_id, voices] + + +def update_score_setup(score_structure, part_list, voices, parts): + for part_definition in part_list: + part_id = part_definition.id + nv_dict = voices.get(part_id) + if not nv_dict: + if len(part_list) == len(voices) == 1: + # If there is only one part, infer the ID. + # See input/regression/musicxml/41g-PartNoId.xml. + nv_dict = list(voices.values())[0] + voices[part_id] = nv_dict + else: + ly.warning(_('unknown part in part-list: %s') % part_id) + continue + + staves = reduce(lambda x, y: x + y, + [list(voice.voicedata._staves.keys()) + for voice in list(nv_dict.values())], + []) + staves_info = [] + if len(staves) > 1: + staves_info = [] + staves = sorted(set(staves)) + for s in staves: + thisstaff_raw_voices = [(voice_name, voice.lyrics_order, voice.figured_bass, voice.chordnames, voice.fretboards) + for (voice_name, voice) in list(nv_dict.items()) + if voice.voicedata._start_staff == s] + staves_info.append(format_staff_info( + part_id, s, thisstaff_raw_voices)) + else: + thisstaff_raw_voices = [(voice_name, voice.lyrics_order, voice.figured_bass, voice.chordnames, voice.fretboards) + for (voice_name, voice) in list(nv_dict.items())] + staves_info.append(format_staff_info( + part_id, None, thisstaff_raw_voices)) + score_structure.set_part_information(part_id, staves_info) + + sounds = [] + for part in parts: + for measure in part.get_typed_children(musicxml.Measure): + for sound in measure.get_typed_children(musicxml.Sound): + sounds.append(sound) + for direction in measure.get_typed_children(musicxml.Direction): + for sound in direction.get_typed_children(musicxml.Sound): + sounds.append(sound) + + score_structure.set_tempo('100') + if len(sounds) != 0: + for sound in sounds: + if (sound.get_tempo() is not None and sound.get_tempo() != ""): + score_structure.set_tempo(sound.get_tempo()) + break + + +# Set global values in the \layout block, like auto-beaming etc. +def update_layout_information(): + if not conversion_settings.ignore_beaming and layout_information: + layout_information.set_context_item('Score', 'autoBeaming = ##f') + if musicexp.get_string_numbers() == "f": + layout_information.set_context_item( + 'Score', '\\override StringNumber #\'stencil = ##f') + +# \n\t\t\t\t\\override StringNumber #\'stencil = ##f + + +def print_ly_preamble(printer, filename): + printer.dump_version(lilypond_version) + printer.print_verbatim( + '% automatically converted by musicxml2ly from ' + filename) + printer.newline() + printer.dump(r'\pointAndClickOff') + printer.newline() + if options.midi: + printer.newline() + printer.dump(r'\include "articulate.ly"') + printer.newline() + + +def print_ly_additional_definitions(printer, filename=None): + if needed_additional_definitions: + printer.newline() + printer.print_verbatim( + '%% additional definitions required by the score:') + printer.newline() + for a in sorted(set(needed_additional_definitions)): + printer.print_verbatim(additional_definitions.get(a, '')) + printer.newline() + printer.newline() + +# Read in the tree from the given I/O object (either file or string) and +# demarshall it using the classes from the musicxml.py file + + +def read_xml(io_object, use_lxml): + if use_lxml: + import lxml.etree + tree = lxml.etree.parse(io_object) + mxl_tree = musicxml.lxml_demarshal_node(tree.getroot()) + return mxl_tree + else: + from xml.dom import minidom, Node + doc = minidom.parse(io_object) + node = doc.documentElement + return musicxml.minidom_demarshal_node(node) + return None + + +def read_musicxml(filename, compressed, use_lxml): + raw_string = None + if compressed: + if filename == "-": + ly.progress( + _("Input is compressed, extracting raw MusicXML data from stdin"), True) + # unfortunately, zipfile.ZipFile can't read directly from + # stdin, so copy everything from stdin to a temp file and read + # that. TemporaryFile() will remove the file when it is closed. + tmp = tempfile.TemporaryFile() + # Make sys.stdin binary + sys.stdin = os.fdopen(sys.stdin.fileno(), 'rb', 0) + bytes_read = sys.stdin.read(8192) + while bytes_read: + tmp.write(bytes_read) + bytes_read = sys.stdin.read(8192) + z = zipfile.ZipFile(tmp, "r") + else: + ly.progress( + _("Input file %s is compressed, extracting raw MusicXML data") % filename, True) + z = zipfile.ZipFile(filename, "r") + container_xml = z.read("META-INF/container.xml").decode("utf-8") + if not container_xml: + return None + container = read_xml(io.StringIO(container_xml), use_lxml) + if not container: + return None + rootfiles = container.get_maybe_exist_named_child('rootfiles') + if not rootfiles: + return None + rootfile_list = rootfiles.get_named_children('rootfile') + mxml_file = None + if len(rootfile_list) > 0: + mxml_file = getattr(rootfile_list[0], 'full-path', None) + if mxml_file: + raw_string = z.read(mxml_file).decode('utf-8') + + if raw_string: + io_object = io.StringIO(raw_string) + elif filename == "-": + io_object = sys.stdin + else: + io_object = filename + + return read_xml(io_object, use_lxml) + + +def convert(filename, options): + if filename == "-": + ly.progress(_("Reading MusicXML from Standard input ..."), True) + else: + ly.progress(_("Reading MusicXML from %s ...") % filename, True) + + tree = read_musicxml(filename, options.compressed, options.use_lxml) + score_information = extract_score_information(tree) + paper_information = extract_paper_information(tree) + + parts = tree.get_typed_children(musicxml.Part) + (voices, staff_info) = get_all_voices(parts) + + score = None + mxl_pl = tree.get_maybe_exist_typed_child(musicxml.Part_list) + if mxl_pl: + score = extract_score_structure(mxl_pl, staff_info) + part_list = mxl_pl.get_named_children("score-part") + + # score information is contained in the , or tags + update_score_setup(score, part_list, voices, parts) + # After the conversion, update the list of settings for the \layout block + update_layout_information() + + if not options.output_name: + options.output_name = os.path.basename(filename) + options.output_name = os.path.splitext(options.output_name)[0] + elif re.match(r".*\.ly", options.output_name): + options.output_name = os.path.splitext(options.output_name)[0] + + #defs_ly_name = options.output_name + '-defs.ly' + if options.output_name == "-": + output_ly_name = 'Standard output' + else: + output_ly_name = options.output_name + '.ly' + ly.progress(_("Output to `%s'") % output_ly_name, True) + printer = musicexp.Output_printer() + #ly.progress(_("Output to `%s'") % defs_ly_name, True) + if options.output_name == "-": + printer.set_file(sys.stdout) + else: + printer.set_file(open(output_ly_name, 'w', encoding='utf-8')) + print_ly_preamble(printer, filename) + print_ly_additional_definitions(printer, filename) + if score_information: + score_information.print_ly(printer) + if paper_information and conversion_settings.convert_page_layout: + paper_information.print_ly(printer) + if layout_information: + layout_information.print_ly(printer) + print_voice_definitions(printer, part_list, voices) + + printer.newline() + printer.dump("% The score definition") + printer.newline() + score.print_ly(printer) + printer.newline() + + # Syntax update to current version + if options.output_name != "-": + version = os.popen( + "lilypond --version | head -1 | cut -d' ' -f3").read().strip() + ly.progress( + _("Converting to current version (%s) notations ..." % version), True) + os.system("convert-ly -e %s 2> /dev/null" % + utilities.escape_ly_output_string(output_ly_name)) + + return voices + + +def get_existing_filename_with_extension(filename, ext): + if os.path.exists(filename): + return filename + newfilename = filename + "." + ext + if os.path.exists(newfilename): + return newfilename + newfilename = filename + ext + if os.path.exists(newfilename): + return newfilename + return '' + + +def main(): + opt_parser = option_parser() + + global options + (options, args) = opt_parser.parse_args() + +# in case of shell entry w/o special characters + if options.language == 'catalan' or options.language == 'catala': + options.language = 'català' + if options.language == 'espanol': + options.language = 'español' + if options.language == 'francais': + options.language = 'français' + if options.language == 'portugues': + options.language = 'português' + + if not args: + opt_parser.print_usage() + sys.exit(2) + + # midi-block option + if options.midi: + musicexp.set_create_midi(options.midi) + + # transpose function + if options.transpose: + musicexp.set_transpose(options.transpose) + + # tab clef option + if options.tab_clef: + musicexp.set_tab_clef(options.tab_clef) + + # string numbers option + if options.string_numbers: + musicexp.set_string_numbers(options.string_numbers) + + if options.language: + musicexp.set_pitch_language(options.language) + needed_additional_definitions.append(options.language) + additional_definitions[options.language] = "\\language \"%s\"\n" % options.language + + conversion_settings.ignore_beaming = not options.convert_beaming + conversion_settings.convert_page_layout = options.convert_page_layout + if conversion_settings.convert_page_layout: + conversion_settings.convert_system_breaks = options.convert_system_breaks + conversion_settings.convert_page_breaks = options.convert_page_breaks + conversion_settings.convert_page_margins = options.convert_page_margins + else: + conversion_settings.convert_system_breaks = False + conversion_settings.convert_page_breaks = False + conversion_settings.convert_page_margins = False + conversion_settings.convert_stem_directions = options.convert_stem_directions + conversion_settings.convert_rest_positions = options.convert_rest_positions + + # Allow the user to leave out the .xml or xml on the filename + basefilename = args[0] + if basefilename == "-": # Read from stdin + filename = "-" + else: + filename = get_existing_filename_with_extension(basefilename, "xml") + if not filename: + filename = get_existing_filename_with_extension( + basefilename, "mxl") + options.compressed = True + if filename and filename.endswith("mxl"): + options.compressed = True + + if filename and (filename == "-" or os.path.exists(filename)): + voices = convert(filename, options) + else: + ly.error(_("Unable to find input file %s") % basefilename) + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/lilypond-2.24.2/bin/pyexpat.pyd b/lilypond-2.24.2/bin/pyexpat.pyd new file mode 100644 index 0000000000000000000000000000000000000000..a71cea021ded67e631149067a00ec0a0af187f41 Binary files /dev/null and b/lilypond-2.24.2/bin/pyexpat.pyd differ diff --git a/lilypond-2.24.2/bin/python.exe b/lilypond-2.24.2/bin/python.exe new file mode 100644 index 0000000000000000000000000000000000000000..cc56f324fa2587f530b47f178d1b32d1f4baed83 Binary files /dev/null and b/lilypond-2.24.2/bin/python.exe differ diff --git a/lilypond-2.24.2/bin/python310.dll b/lilypond-2.24.2/bin/python310.dll new file mode 100644 index 0000000000000000000000000000000000000000..15b384e6953602f2605efadcf0586f763320dbae --- /dev/null +++ b/lilypond-2.24.2/bin/python310.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c30589187be320bc8e65177aeb8dc1d39957f7b7dcda4c13524dd7f436fb0948 +size 4492160 diff --git a/lilypond-2.24.2/bin/python310.zip b/lilypond-2.24.2/bin/python310.zip new file mode 100644 index 0000000000000000000000000000000000000000..08038a540b6e8c5f478083bdc3d8e2abd0da8254 --- /dev/null +++ b/lilypond-2.24.2/bin/python310.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fc143399b184ff1c26246da037d1d20f99b166922cd3ac16ed299b99b80e4de +size 2640871 diff --git a/lilypond-2.24.2/etc/fonts/conf.d/10-hinting-slight.conf b/lilypond-2.24.2/etc/fonts/conf.d/10-hinting-slight.conf new file mode 100644 index 0000000000000000000000000000000000000000..96a81fb07f6ce3772561f60a0153659fbb3e3c6f --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/10-hinting-slight.conf @@ -0,0 +1,15 @@ + + + + Set hintslight to hintstyle + + + + hintslight + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/10-scale-bitmap-fonts.conf b/lilypond-2.24.2/etc/fonts/conf.d/10-scale-bitmap-fonts.conf new file mode 100644 index 0000000000000000000000000000000000000000..0c3a2efc30423b12307953ba45443b9ecb18e5ff --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/10-scale-bitmap-fonts.conf @@ -0,0 +1,83 @@ + + + + Bitmap scaling + + + + false + + + + pixelsize + pixelsize + + + + + + + false + + + false + + + true + + + + + pixelsizefixupfactor + 1.2 + + + pixelsizefixupfactor + 0.8 + + + + + + + true + + + 1.0 + + + + + + false + + + 1.0 + + + + matrix + + pixelsizefixupfactor 0 + 0 pixelsizefixupfactor + + + + + + size + pixelsizefixupfactor + + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/10-sub-pixel-none.conf b/lilypond-2.24.2/etc/fonts/conf.d/10-sub-pixel-none.conf new file mode 100644 index 0000000000000000000000000000000000000000..1fb6c98af78bf9236bdbfcf086e459a9040c6299 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/10-sub-pixel-none.conf @@ -0,0 +1,15 @@ + + + + Disable sub-pixel rendering + + + + none + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/10-yes-antialias.conf b/lilypond-2.24.2/etc/fonts/conf.d/10-yes-antialias.conf new file mode 100644 index 0000000000000000000000000000000000000000..4451f6ed10a2021ca08d6ae87d5a002038aa80e9 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/10-yes-antialias.conf @@ -0,0 +1,8 @@ + + + + Enable antialiasing + + true + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/11-lcdfilter-default.conf b/lilypond-2.24.2/etc/fonts/conf.d/11-lcdfilter-default.conf new file mode 100644 index 0000000000000000000000000000000000000000..60255978377ae6e0264c2f04a67bcea646b3ad4e --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/11-lcdfilter-default.conf @@ -0,0 +1,17 @@ + + + + Use lcddefault as default for LCD filter + + + + + lcddefault + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/20-unhint-small-vera.conf b/lilypond-2.24.2/etc/fonts/conf.d/20-unhint-small-vera.conf new file mode 100644 index 0000000000000000000000000000000000000000..e4e9c33cb524535bb7f095103d63e9c982ec6fdf --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/20-unhint-small-vera.conf @@ -0,0 +1,49 @@ + + + + Disable hinting for Bitstream Vera fonts when the size is less than 8ppem + + + + + Bitstream Vera Sans + + + 7.5 + + + false + + + + + + Bitstream Vera Serif + + + 7.5 + + + false + + + + + + Bitstream Vera Sans Mono + + + 7.5 + + + false + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/30-metric-aliases.conf b/lilypond-2.24.2/etc/fonts/conf.d/30-metric-aliases.conf new file mode 100644 index 0000000000000000000000000000000000000000..7216b4e934c68864eb6aca4247be7d7911bde694 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/30-metric-aliases.conf @@ -0,0 +1,637 @@ + + + + Set substitutions for similar/metric-compatible families + + + + + + + + Nimbus Sans L + + Helvetica + + + + + Nimbus Sans + + Helvetica + + + + + TeX Gyre Heros + + Helvetica + + + + + Nimbus Sans Narrow + + Helvetica Narrow + + + + + TeX Gyre Heros Cn + + Helvetica Narrow + + + + + Nimbus Roman No9 L + + Times + + + + + Nimbus Roman + + Times + + + + + TeX Gyre Termes + + Times + + + + + Nimbus Mono L + + Courier + + + + + Nimbus Mono + + Courier + + + + + Nimbus Mono PS + + Courier + + + + + TeX Gyre Cursor + + Courier + + + + + Avant Garde + + ITC Avant Garde Gothic + + + + + URW Gothic L + + ITC Avant Garde Gothic + + + + + URW Gothic + + ITC Avant Garde Gothic + + + + + TeX Gyre Adventor + + ITC Avant Garde Gothic + + + + + Bookman + + ITC Bookman + + + + + URW Bookman L + + ITC Bookman + + + + + Bookman URW + + ITC Bookman + + + + + URW Bookman + + ITC Bookman + + + + + TeX Gyre Bonum + + ITC Bookman + + + + + Bookman Old Style + + ITC Bookman + + + + + Zapf Chancery + + ITC Zapf Chancery + + + + + URW Chancery L + + ITC Zapf Chancery + + + + + Chancery URW + + ITC Zapf Chancery + + + + + Z003 + + ITC Zapf Chancery + + + + + TeX Gyre Chorus + + ITC Zapf Chancery + + + + + URW Palladio L + + Palatino + + + + + Palladio URW + + Palatino + + + + + P052 + + Palatino + + + + + TeX Gyre Pagella + + Palatino + + + + + Palatino Linotype + + Palatino + + + + + Century Schoolbook L + + New Century Schoolbook + + + + + Century SchoolBook URW + + New Century Schoolbook + + + + + C059 + + New Century Schoolbook + + + + + TeX Gyre Schola + + New Century Schoolbook + + + + + Century Schoolbook + + New Century Schoolbook + + + + + + Arimo + + Arial + + + + + Liberation Sans + + Arial + + + + + Liberation Sans Narrow + + Arial Narrow + + + + + Albany + + Arial + + + + + Albany AMT + + Arial + + + + + Tinos + + Times New Roman + + + + + Liberation Serif + + Times New Roman + + + + + Thorndale + + Times New Roman + + + + + Thorndale AMT + + Times New Roman + + + + + Cousine + + Courier New + + + + + Liberation Mono + + Courier New + + + + + Cumberland + + Courier New + + + + + Cumberland AMT + + Courier New + + + + + Gelasio + + Georgia + + + + + Caladea + + Cambria + + + + + Carlito + + Calibri + + + + + SymbolNeu + + Symbol + + + + + + + + Helvetica + + Arial + + + + + Helvetica Narrow + + Arial Narrow + + + + + Times + + Times New Roman + + + + + Courier + + Courier New + + + + + + Arial + + Helvetica + + + + + Arial Narrow + + Helvetica Narrow + + + + + Times New Roman + + Times + + + + + Courier New + + Courier + + + + + + + + Helvetica + + TeX Gyre Heros + + + + + Helvetica Narrow + + TeX Gyre Heros Cn + + + + + Times + + TeX Gyre Termes + + + + + Courier + + TeX Gyre Cursor + + + + + Courier Std + + Courier + + + + + ITC Avant Garde Gothic + + TeX Gyre Adventor + + + + + ITC Bookman + + Bookman Old Style + TeX Gyre Bonum + + + + + ITC Zapf Chancery + + TeX Gyre Chorus + + + + + Palatino + + Palatino Linotype + TeX Gyre Pagella + + + + + New Century Schoolbook + + Century Schoolbook + TeX Gyre Schola + + + + + + Arial + + Arimo + Liberation Sans + Albany + Albany AMT + + + + + Arial Narrow + + Liberation Sans Narrow + + + + + Times New Roman + + Tinos + Liberation Serif + Thorndale + Thorndale AMT + + + + + Courier New + + Cousine + Liberation Mono + Cumberland + Cumberland AMT + + + + + Georgia + + Gelasio + + + + + Cambria + + Caladea + + + + + Calibri + + Carlito + + + + + Symbol + + SymbolNeu + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/40-nonlatin.conf b/lilypond-2.24.2/etc/fonts/conf.d/40-nonlatin.conf new file mode 100644 index 0000000000000000000000000000000000000000..f8d96ce811f74755e0b8337d24495fd663a6c9b0 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/40-nonlatin.conf @@ -0,0 +1,332 @@ + + + + Set substitutions for non-Latin fonts + + + + + Nazli + serif + + + Lotoos + serif + + + Mitra + serif + + + Ferdosi + serif + + + Badr + serif + + + Zar + serif + + + Titr + serif + + + Jadid + serif + + + Kochi Mincho + serif + + + AR PL SungtiL GB + serif + + + AR PL Mingti2L Big5 + serif + + + MS 明朝 + serif + + + NanumMyeongjo + serif + + + UnBatang + serif + + + Baekmuk Batang + serif + + + MgOpen Canonica + serif + + + Sazanami Mincho + serif + + + AR PL ZenKai Uni + serif + + + ZYSong18030 + serif + + + FreeSerif + serif + + + SimSun + serif + + + + Arshia + sans-serif + + + Elham + sans-serif + + + Farnaz + sans-serif + + + Nasim + sans-serif + + + Sina + sans-serif + + + Roya + sans-serif + + + Koodak + sans-serif + + + Terafik + sans-serif + + + Kochi Gothic + sans-serif + + + AR PL KaitiM GB + sans-serif + + + AR PL KaitiM Big5 + sans-serif + + + MS ゴシック + sans-serif + + + NanumGothic + sans-serif + + + UnDotum + sans-serif + + + Baekmuk Dotum + sans-serif + + + MgOpen Modata + sans-serif + + + Sazanami Gothic + sans-serif + + + AR PL ShanHeiSun Uni + sans-serif + + + ZYSong18030 + sans-serif + + + FreeSans + sans-serif + + + + NSimSun + monospace + + + ZYSong18030 + monospace + + + NanumGothicCoding + monospace + + + FreeMono + monospace + + + + + Homa + fantasy + + + Kamran + fantasy + + + Fantezi + fantasy + + + Tabassom + fantasy + + + + + IranNastaliq + cursive + + + Nafees Nastaleeq + cursive + + + + + Noto Sans Arabic UI + system-ui + + + Noto Sans Bengali UI + system-ui + + + Noto Sans Devanagari UI + system-ui + + + Noto Sans Gujarati UI + system-ui + + + Noto Sans Gurmukhi UI + system-ui + + + Noto Sans Kannada UI + system-ui + + + Noto Sans Khmer UI + system-ui + + + Noto Sans Lao UI + system-ui + + + Noto Sans Malayalam UI + system-ui + + + Noto Sans Myanmar UI + system-ui + + + Noto Sans Oriya UI + system-ui + + + Noto Sans Sinhala UI + system-ui + + + Noto Sans Tamil UI + system-ui + + + Noto Sans Telugu UI + system-ui + + + Noto Sans Thai UI + system-ui + + + Leelawadee UI + system-ui + + + Nirmala UI + system-ui + + + Yu Gothic UI + system-ui + + + Meiryo UI + system-ui + + + MS UI Gothic + system-ui + + + Khmer UI + system-ui + + + Lao UI + system-ui + + + Microsoft JhengHei UI + system-ui + + + Microsoft YaHei UI + system-ui + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/45-generic.conf b/lilypond-2.24.2/etc/fonts/conf.d/45-generic.conf new file mode 100644 index 0000000000000000000000000000000000000000..5c1bd36b5c05075b333a28dce25de254e1eec26c --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/45-generic.conf @@ -0,0 +1,136 @@ + + + + Set substitutions for emoji/math fonts + + + + + + + + Noto Color Emoji + emoji + + + Apple Color Emoji + emoji + + + Segoe UI Emoji + emoji + + + Twitter Color Emoji + emoji + + + EmojiOne Mozilla + emoji + + + + Emoji Two + emoji + + + JoyPixels + emoji + + + Emoji One + emoji + + + + Noto Emoji + emoji + + + Android Emoji + emoji + + + + + + emoji + + + und-zsye + + + + + + und-zsye + + + emoji + + + + + emoji + + + + + + + + + XITS Math + math + + + STIX Two Math + math + + + Cambria Math + math + + + Latin Modern Math + math + + + Minion Math + math + + + Lucida Math + math + + + Asana Math + math + + + + + + math + + + und-zmth + + + + + + und-zmth + + + math + + + + + math + + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/45-latin.conf b/lilypond-2.24.2/etc/fonts/conf.d/45-latin.conf new file mode 100644 index 0000000000000000000000000000000000000000..86486c945bd3753e23b05c1294c44cf04db5c9c5 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/45-latin.conf @@ -0,0 +1,301 @@ + + + + Set substitutions for Latin fonts + + + + + Bitstream Vera Serif + serif + + + Cambria + serif + + + Constantia + serif + + + DejaVu Serif + serif + + + Elephant + serif + + + Garamond + serif + + + Georgia + serif + + + Liberation Serif + serif + + + Luxi Serif + serif + + + MS Serif + serif + + + Nimbus Roman No9 L + serif + + + Nimbus Roman + serif + + + Palatino Linotype + serif + + + Thorndale AMT + serif + + + Thorndale + serif + + + Times New Roman + serif + + + Times + serif + + + + Albany AMT + sans-serif + + + Albany + sans-serif + + + Arial Unicode MS + sans-serif + + + Arial + sans-serif + + + Bitstream Vera Sans + sans-serif + + + Britannic + sans-serif + + + Calibri + sans-serif + + + Candara + sans-serif + + + Century Gothic + sans-serif + + + Corbel + sans-serif + + + DejaVu Sans + sans-serif + + + Helvetica + sans-serif + + + Haettenschweiler + sans-serif + + + Liberation Sans + sans-serif + + + MS Sans Serif + sans-serif + + + Nimbus Sans L + sans-serif + + + Nimbus Sans + sans-serif + + + Luxi Sans + sans-serif + + + Tahoma + sans-serif + + + Trebuchet MS + sans-serif + + + Twentieth Century + sans-serif + + + Verdana + sans-serif + + + + Andale Mono + monospace + + + Bitstream Vera Sans Mono + monospace + + + Consolas + monospace + + + Courier New + monospace + + + Courier + monospace + + + Courier Std + monospace + + + Cumberland AMT + monospace + + + Cumberland + monospace + + + DejaVu Sans Mono + monospace + + + Fixedsys + monospace + + + Inconsolata + monospace + + + Liberation Mono + monospace + + + Luxi Mono + monospace + + + Nimbus Mono L + monospace + + + Nimbus Mono + monospace + + + Nimbus Mono PS + monospace + + + Terminal + monospace + + + + Bauhaus Std + fantasy + + + Cooper Std + fantasy + + + Copperplate Gothic Std + fantasy + + + Impact + fantasy + + + + Comic Sans MS + cursive + + + ITC Zapf Chancery Std + cursive + + + Zapfino + cursive + + + + Cantarell + system-ui + + + Noto Sans UI + system-ui + + + Segoe UI + system-ui + + + Segoe UI Historic + system-ui + + + Segoe UI Symbol + system-ui + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/48-spacing.conf b/lilypond-2.24.2/etc/fonts/conf.d/48-spacing.conf new file mode 100644 index 0000000000000000000000000000000000000000..6df5c11762017af95ffb7c112f9c14441b120cc3 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/48-spacing.conf @@ -0,0 +1,16 @@ + + + + Add mono to the family when spacing is 100 + + + + 100 + + + monospace + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/49-sansserif.conf b/lilypond-2.24.2/etc/fonts/conf.d/49-sansserif.conf new file mode 100644 index 0000000000000000000000000000000000000000..6cc3a1c4948368e3c342cd0c6a5db8ecfe67a2cd --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/49-sansserif.conf @@ -0,0 +1,22 @@ + + + + Add sans-serif to the family when no generic name + + + + sans-serif + + + serif + + + monospace + + + sans-serif + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/50-user.conf b/lilypond-2.24.2/etc/fonts/conf.d/50-user.conf new file mode 100644 index 0000000000000000000000000000000000000000..d019f4d4e6142603f4a03db5f7670c3ee5f29115 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/50-user.conf @@ -0,0 +1,16 @@ + + + + Load per-user customization files + + fontconfig/conf.d + fontconfig/fonts.conf + + ~/.fonts.conf.d + ~/.fonts.conf + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/51-local.conf b/lilypond-2.24.2/etc/fonts/conf.d/51-local.conf new file mode 100644 index 0000000000000000000000000000000000000000..82e3c1b2ff4107b264f90748016445d404afcc2b --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/51-local.conf @@ -0,0 +1,7 @@ + + + + Load local customization file + + local.conf + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/60-generic.conf b/lilypond-2.24.2/etc/fonts/conf.d/60-generic.conf new file mode 100644 index 0000000000000000000000000000000000000000..78315077194f7ed9f4e849ab2bbf18fd52068564 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/60-generic.conf @@ -0,0 +1,64 @@ + + + + Set preferable fonts for emoji/math fonts + + + + + + + + und-zsye + + + true + + + false + + + true + + + + + + emoji + + + Noto Color Emoji + Apple Color Emoji + Segoe UI Emoji + Twitter Color Emoji + EmojiOne Mozilla + + Emoji Two + JoyPixels + Emoji One + + Noto Emoji + Android Emoji + + + + + + + math + + XITS Math + STIX Two Math + Cambria Math + Latin Modern Math + Minion Math + Lucida Math + Asana Math + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/60-latin.conf b/lilypond-2.24.2/etc/fonts/conf.d/60-latin.conf new file mode 100644 index 0000000000000000000000000000000000000000..ff933af993320fd8d98101cc51d5738e46e6ae03 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/60-latin.conf @@ -0,0 +1,88 @@ + + + + Set preferable fonts for Latin + + serif + + Noto Serif + DejaVu Serif + Times New Roman + Thorndale AMT + Luxi Serif + Nimbus Roman No9 L + Nimbus Roman + Times + + + + sans-serif + + Noto Sans + DejaVu Sans + Verdana + Arial + Albany AMT + Luxi Sans + Nimbus Sans L + Nimbus Sans + Helvetica + Lucida Sans Unicode + BPG Glaho International + Tahoma + + + + monospace + + Noto Sans Mono + DejaVu Sans Mono + Inconsolata + Andale Mono + Courier New + Cumberland AMT + Luxi Mono + Nimbus Mono L + Nimbus Mono + Nimbus Mono PS + Courier + + + + + fantasy + + Impact + Copperplate Gothic Std + Cooper Std + Bauhaus Std + + + + + cursive + + ITC Zapf Chancery Std + Zapfino + Comic Sans MS + + + + + system-ui + + Cantarell + Noto Sans UI + Segoe UI + Segoe UI Historic + Segoe UI Symbol + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/65-fonts-persian.conf b/lilypond-2.24.2/etc/fonts/conf.d/65-fonts-persian.conf new file mode 100644 index 0000000000000000000000000000000000000000..47da1bb09027181b666a0760b795629af595cdb0 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/65-fonts-persian.conf @@ -0,0 +1,418 @@ + + + + + + + + + + Nesf + Nesf2 + + + Nesf2 + Persian_sansserif_default + + + + + + Nazanin + Nazli + + + Lotus + Lotoos + + + Yaqut + Yaghoot + + + Yaghut + Yaghoot + + + Traffic + Terafik + + + Ferdowsi + Ferdosi + + + Fantezy + Fantezi + + + + + + + + Jadid + Persian_title + + + Titr + Persian_title + + + + + Kamran + + Persian_fantasy + Homa + + + + Homa + + Persian_fantasy + Kamran + + + + Fantezi + Persian_fantasy + + + Tabassom + Persian_fantasy + + + + + Arshia + Persian_square + + + Nasim + Persian_square + + + Elham + + Persian_square + Farnaz + + + + Farnaz + + Persian_square + Elham + + + + Sina + Persian_square + + + + + + + Persian_title + + Titr + Jadid + Persian_serif + + + + + + Persian_fantasy + + Homa + Kamran + Fantezi + Tabassom + Persian_square + + + + + + Persian_square + + Arshia + Elham + Farnaz + Nasim + Sina + Persian_serif + + + + + + + + Elham + + + farsiweb + + + + + + Homa + + + farsiweb + + + + + + Koodak + + + farsiweb + + + + + + Nazli + + + farsiweb + + + + + + Roya + + + farsiweb + + + + + + Terafik + + + farsiweb + + + + + + Titr + + + farsiweb + + + + + + + + + + TURNED-OFF + + + farsiweb + + + + roman + + + + roman + + + + + matrix + 1-0.2 + 01 + + + + + + oblique + + + + + + + + + farsiweb + + + false + + + false + + + false + + + + + + + + + serif + + Nazli + Lotoos + Mitra + Ferdosi + Badr + Zar + + + + + + sans-serif + + Roya + Koodak + Terafik + + + + + + monospace + + + Terafik + + + + + + fantasy + + Homa + Kamran + Fantezi + Tabassom + + + + + + cursive + + IranNastaliq + Nafees Nastaleeq + + + + + + + + + serif + + + 200 + + + 24 + + + Titr + + + + + + + sans-serif + + + 200 + + + 24 + + + Titr + + + + + + + Persian_sansserif_default + + + 200 + + + 24 + + + Titr + + + + + + + + + Persian_sansserif_default + + + Roya + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/65-nonlatin.conf b/lilypond-2.24.2/etc/fonts/conf.d/65-nonlatin.conf new file mode 100644 index 0000000000000000000000000000000000000000..4d135b02cbd00f8eb149dc1919fe896ea454b337 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/65-nonlatin.conf @@ -0,0 +1,228 @@ + + + + Set preferable fonts for non-Latin + + serif + + Artsounk + BPG UTF8 M + Kinnari + Norasi + Frank Ruehl + Dror + JG LaoTimes + Saysettha Unicode + Pigiarniq + B Davat + B Compset + Kacst-Qr + Urdu Nastaliq Unicode + Raghindi + Mukti Narrow + malayalam + Sampige + padmaa + Hapax Berbère + MS Mincho + SimSun + PMingLiu + WenQuanYi Zen Hei + WenQuanYi Bitmap Song + AR PL ShanHeiSun Uni + AR PL New Sung + ZYSong18030 + HanyiSong + MgOpen Canonica + Sazanami Mincho + IPAMonaMincho + IPAMincho + Kochi Mincho + AR PL SungtiL GB + AR PL Mingti2L Big5 + AR PL Zenkai Uni + MS 明朝 + ZYSong18030 + NanumMyeongjo + UnBatang + Baekmuk Batang + KacstQura + Frank Ruehl CLM + Lohit Bengali + Lohit Gujarati + Lohit Hindi + Lohit Marathi + Lohit Maithili + Lohit Kashmiri + Lohit Konkani + Lohit Nepali + Lohit Sindhi + Lohit Punjabi + Lohit Tamil + Rachana + Lohit Malayalam + Lohit Kannada + Lohit Telugu + Lohit Oriya + LKLUG + + + + sans-serif + + Nachlieli + Lucida Sans Unicode + Yudit Unicode + Kerkis + ArmNet Helvetica + Artsounk + BPG UTF8 M + Waree + Loma + Garuda + Umpush + Saysettha Unicode + JG Lao Old Arial + GF Zemen Unicode + Pigiarniq + B Davat + B Compset + Kacst-Qr + Urdu Nastaliq Unicode + Raghindi + Mukti Narrow + malayalam + Sampige + padmaa + Hapax Berbère + MS Gothic + UmePlus P Gothic + Microsoft YaHei + Microsoft JhengHei + WenQuanYi Zen Hei + WenQuanYi Bitmap Song + AR PL ShanHeiSun Uni + AR PL New Sung + MgOpen Modata + VL Gothic + IPAMonaGothic + IPAGothic + Sazanami Gothic + Kochi Gothic + AR PL KaitiM GB + AR PL KaitiM Big5 + AR PL ShanHeiSun Uni + AR PL SungtiL GB + AR PL Mingti2L Big5 + MS ゴシック + ZYSong18030 + TSCu_Paranar + NanumGothic + UnDotum + Baekmuk Dotum + Baekmuk Gulim + KacstQura + Lohit Bengali + Lohit Gujarati + Lohit Hindi + Lohit Marathi + Lohit Maithili + Lohit Kashmiri + Lohit Konkani + Lohit Nepali + Lohit Sindhi + Lohit Punjabi + Lohit Tamil + Meera + Lohit Malayalam + Lohit Kannada + Lohit Telugu + Lohit Oriya + LKLUG + + + + monospace + + Miriam Mono + VL Gothic + IPAMonaGothic + IPAGothic + Sazanami Gothic + Kochi Gothic + AR PL KaitiM GB + MS Gothic + UmePlus Gothic + NSimSun + MingLiu + AR PL ShanHeiSun Uni + AR PL New Sung Mono + HanyiSong + AR PL SungtiL GB + AR PL Mingti2L Big5 + ZYSong18030 + NanumGothicCoding + NanumGothic + UnDotum + Baekmuk Dotum + Baekmuk Gulim + TlwgTypo + TlwgTypist + TlwgTypewriter + TlwgMono + Hasida + GF Zemen Unicode + Hapax Berbère + Lohit Bengali + Lohit Gujarati + Lohit Hindi + Lohit Marathi + Lohit Maithili + Lohit Kashmiri + Lohit Konkani + Lohit Nepali + Lohit Sindhi + Lohit Punjabi + Lohit Tamil + Meera + Lohit Malayalam + Lohit Kannada + Lohit Telugu + Lohit Oriya + LKLUG + + + + + system-ui + + Noto Sans Arabic UI + Noto Sans Bengali UI + Noto Sans Devanagari UI + Noto Sans Gujarati UI + Noto Sans Gurmukhi UI + Noto Sans Kannada UI + Noto Sans Khmer UI + Noto Sans Lao UI + Noto Sans Malayalam UI + Noto Sans Myanmar UI + Noto Sans Oriya UI + Noto Sans Sinhala UI + Noto Sans Tamil UI + Noto Sans Telugu UI + Noto Sans Thai UI + Leelawadee UI + Nirmala UI + Yu Gothic UI + Meiryo UI + MS UI Gothic + Khmer UI + Lao UI + Microsoft YaHei UI + Microsoft JhengHei UI + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/69-unifont.conf b/lilypond-2.24.2/etc/fonts/conf.d/69-unifont.conf new file mode 100644 index 0000000000000000000000000000000000000000..02854ff9dfe3d8826ddb069a8e2e5389491bc3df --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/69-unifont.conf @@ -0,0 +1,28 @@ + + + + + serif + + FreeSerif + Code2000 + Code2001 + + + + sans-serif + + FreeSans + Arial Unicode MS + Arial Unicode + Code2000 + Code2001 + + + + monospace + + FreeMono + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/80-delicious.conf b/lilypond-2.24.2/etc/fonts/conf.d/80-delicious.conf new file mode 100644 index 0000000000000000000000000000000000000000..d20990cd31de0e6975144334ee9fb919797b597d --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/80-delicious.conf @@ -0,0 +1,19 @@ + + + + + + + + + Delicious + + + Heavy + + + heavy + + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/90-synthetic.conf b/lilypond-2.24.2/etc/fonts/conf.d/90-synthetic.conf new file mode 100644 index 0000000000000000000000000000000000000000..dfce674bbf4ef96627b170dfdbdeb1c90f3f0baf --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/90-synthetic.conf @@ -0,0 +1,64 @@ + + + + + + + + + roman + + + + roman + + + + + matrix + 10.2 + 01 + + + + + + oblique + + + + false + + + + + + + + + medium + + + + bold + + + + true + + + + bold + + + diff --git a/lilypond-2.24.2/etc/fonts/conf.d/README b/lilypond-2.24.2/etc/fonts/conf.d/README new file mode 100644 index 0000000000000000000000000000000000000000..0d20ef4d03f82d985946d4fefed6f3816cd9a7ae --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/conf.d/README @@ -0,0 +1,23 @@ +conf.d/README + +Each file in this directory is a fontconfig configuration file. Fontconfig +scans this directory, loading all files of the form [0-9][0-9]*.conf. +These files are normally installed in /usr/share/fontconfig/conf.avail +and then symlinked here, allowing them to be easily installed and then +enabled/disabled by adjusting the symlinks. + +The files are loaded in numeric order, the structure of the configuration +has led to the following conventions in usage: + + Files beginning with: Contain: + + 00 through 09 Font directories + 10 through 19 system rendering defaults (AA, etc) + 20 through 29 font rendering options + 30 through 39 family substitution + 40 through 49 generic identification, map family->generic + 50 through 59 alternate config file loading + 60 through 69 generic aliases, map generic->family + 70 through 79 select font (adjust which fonts are available) + 80 through 89 match target="scan" (modify scanned patterns) + 90 through 99 font synthesis diff --git a/lilypond-2.24.2/etc/fonts/fonts.conf b/lilypond-2.24.2/etc/fonts/fonts.conf new file mode 100644 index 0000000000000000000000000000000000000000..06eec276a164bb3307f686361790cd4b089988e6 --- /dev/null +++ b/lilypond-2.24.2/etc/fonts/fonts.conf @@ -0,0 +1,101 @@ + + + + + Default configuration file + + + + + + WINDOWSFONTDIR WINDOWSUSERFONTDIR + + fonts + + ~/.fonts + + + + + mono + + + monospace + + + + + + + sans serif + + + sans-serif + + + + + + + sans + + + sans-serif + + + + + + system ui + + + system-ui + + + + + conf.d + + + + LOCAL_APPDATA_FONTCONFIG_CACHE + fontconfig + + ~/.fontconfig + + + + + 30 + + + + diff --git a/lilypond-2.24.2/etc/relocate/fontconfig.reloc b/lilypond-2.24.2/etc/relocate/fontconfig.reloc new file mode 100644 index 0000000000000000000000000000000000000000..dd39d55c2079239ba9614e5e9c45f2098d8c7899 --- /dev/null +++ b/lilypond-2.24.2/etc/relocate/fontconfig.reloc @@ -0,0 +1,2 @@ +set? FONTCONFIG_FILE=$INSTALLER_PREFIX/etc/fonts/fonts.conf +set? FONTCONFIG_PATH=$INSTALLER_PREFIX/etc/fonts diff --git a/lilypond-2.24.2/etc/relocate/guile.reloc b/lilypond-2.24.2/etc/relocate/guile.reloc new file mode 100644 index 0000000000000000000000000000000000000000..e34ffa91b4a2b3e077364c33dad36479a095758e --- /dev/null +++ b/lilypond-2.24.2/etc/relocate/guile.reloc @@ -0,0 +1,2 @@ +prependdir GUILE_LOAD_PATH=$INSTALLER_PREFIX/share/guile/2.2 +prependdir GUILE_LOAD_COMPILED_PATH=$INSTALLER_PREFIX/lib/guile/2.2/ccache diff --git a/lilypond-2.24.2/etc/relocate/libexec.reloc b/lilypond-2.24.2/etc/relocate/libexec.reloc new file mode 100644 index 0000000000000000000000000000000000000000..9b2b0f25361d64d4ce8b05c045d0903761e9f136 --- /dev/null +++ b/lilypond-2.24.2/etc/relocate/libexec.reloc @@ -0,0 +1 @@ +prependdir PATH=$INSTALLER_PREFIX/libexec diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/and-let-star.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/and-let-star.go new file mode 100644 index 0000000000000000000000000000000000000000..9ec2e48045f8fde5ab14abf2d295e66634994d79 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/and-let-star.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/arrays.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/arrays.go new file mode 100644 index 0000000000000000000000000000000000000000..9ec568a21d320b91dc2df7c867ebc58773d7f8d1 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/arrays.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/atomic.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/atomic.go new file mode 100644 index 0000000000000000000000000000000000000000..aefc0fe5b9e0c98dfa10bb5852f12508e8d8d3c0 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/atomic.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/binary-ports.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/binary-ports.go new file mode 100644 index 0000000000000000000000000000000000000000..e78a39363498e421d68d1b5b7a29caa60bd4d222 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/binary-ports.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/boot-9.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/boot-9.go new file mode 100644 index 0000000000000000000000000000000000000000..3b9ad766d8e204a335878eb4506b513e00af4eab Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/boot-9.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/buffered-input.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/buffered-input.go new file mode 100644 index 0000000000000000000000000000000000000000..113190447a9ba3e40beccb89da32d18ad34a57aa Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/buffered-input.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/calling.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/calling.go new file mode 100644 index 0000000000000000000000000000000000000000..32c01fe81d7f3a29cfc3222f6f77d7e58820920d Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/calling.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/channel.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/channel.go new file mode 100644 index 0000000000000000000000000000000000000000..5496ae7e93166ad7e46820ee77314762983fbeee Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/channel.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/command-line.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/command-line.go new file mode 100644 index 0000000000000000000000000000000000000000..18a612c69eebaa670704498e3629bba774f18fd6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/command-line.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/common-list.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/common-list.go new file mode 100644 index 0000000000000000000000000000000000000000..d85d4e9009ccb29cef5bcf0ba1b5865b0d9af860 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/common-list.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/control.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/control.go new file mode 100644 index 0000000000000000000000000000000000000000..69039befe7589f80e6a2e859e724aaf30bc62971 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/control.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/curried-definitions.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/curried-definitions.go new file mode 100644 index 0000000000000000000000000000000000000000..d3c95738909f2f5ae484cea994a8dbea92ea7afb Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/curried-definitions.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/debug.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/debug.go new file mode 100644 index 0000000000000000000000000000000000000000..144b588c51b385b9900c9041da4ba20d76c4d8e9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/debug.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/deprecated.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/deprecated.go new file mode 100644 index 0000000000000000000000000000000000000000..6562569a297d337de7ccb04f6f2cdd6c52dfe90b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/deprecated.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/documentation.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/documentation.go new file mode 100644 index 0000000000000000000000000000000000000000..7d45c2e8deebba54e3a1fcc0ac82bba8a8f47d57 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/documentation.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/eval-string.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/eval-string.go new file mode 100644 index 0000000000000000000000000000000000000000..a182dc56801b0c56c88d3a79e9fb583904ac13a1 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/eval-string.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/eval.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/eval.go new file mode 100644 index 0000000000000000000000000000000000000000..e436b4f0603ea02fa220b4dea04f888e79329bf6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/eval.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/expect.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/expect.go new file mode 100644 index 0000000000000000000000000000000000000000..4f1abafa292eab9c4dbe5fd16a2ed565f9a034a6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/expect.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/fdes-finalizers.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/fdes-finalizers.go new file mode 100644 index 0000000000000000000000000000000000000000..9f558a42274f565e41f7156238c731386c23b4c9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/fdes-finalizers.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/format.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/format.go new file mode 100644 index 0000000000000000000000000000000000000000..aec20c87dd94757b7872ec546c99e22b87773805 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/format.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ftw.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ftw.go new file mode 100644 index 0000000000000000000000000000000000000000..59057b41ae026c8aae1abdc4961f2bcfee6184ad Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ftw.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/futures.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/futures.go new file mode 100644 index 0000000000000000000000000000000000000000..76328efec61b95d2a55b30930182aa9f3ad5a337 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/futures.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/gap-buffer.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/gap-buffer.go new file mode 100644 index 0000000000000000000000000000000000000000..02692c462779ec40201c14d6ef3b2e2b8b0ae986 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/gap-buffer.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/getopt-long.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/getopt-long.go new file mode 100644 index 0000000000000000000000000000000000000000..c37bd1a29f838a901cd00be79986682a9aa8dcab Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/getopt-long.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/hash-table.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/hash-table.go new file mode 100644 index 0000000000000000000000000000000000000000..43a9213215041704537553f5b95770f315f1b380 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/hash-table.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/hcons.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/hcons.go new file mode 100644 index 0000000000000000000000000000000000000000..9b77618e71cfda25e14aa4364d96332aa25bcd1f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/hcons.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/history.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/history.go new file mode 100644 index 0000000000000000000000000000000000000000..287961a8db05106d3faab5f9d5b72ab81ddbb854 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/history.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/i18n.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/i18n.go new file mode 100644 index 0000000000000000000000000000000000000000..3dcbc17d644513474e17ef934b2fea72b39da5d6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/i18n.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/iconv.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/iconv.go new file mode 100644 index 0000000000000000000000000000000000000000..4650e2c14d8debca8a22e71f377f19389245c2c3 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/iconv.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/lineio.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/lineio.go new file mode 100644 index 0000000000000000000000000000000000000000..0e7e67a10f9b74557f581e812901e118361d6d4a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/lineio.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/list.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/list.go new file mode 100644 index 0000000000000000000000000000000000000000..4a120bfda0b2de2553b8d9b20559417f2951fe5d Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/list.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/local-eval.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/local-eval.go new file mode 100644 index 0000000000000000000000000000000000000000..1dab71f8911d6b5f3f07d37d7a0c6273b61a3b2a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/local-eval.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ls.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ls.go new file mode 100644 index 0000000000000000000000000000000000000000..94eb315ec1c93400d3be0cf4acd8d888f0a96584 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ls.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/mapping.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/mapping.go new file mode 100644 index 0000000000000000000000000000000000000000..75c73d9f010c2a2ee974593f75208232d12e8ad0 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/mapping.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/match.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/match.go new file mode 100644 index 0000000000000000000000000000000000000000..055055f7cac7dc26816ea92b9f5a8eee311d13e9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/match.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/networking.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/networking.go new file mode 100644 index 0000000000000000000000000000000000000000..7e64d58ef56bcf6047e8b6169fbcf1960fa4cd65 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/networking.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/null.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/null.go new file mode 100644 index 0000000000000000000000000000000000000000..a2a40512d22471326d52f8b5d0d36f3ebed2d214 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/null.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/occam-channel.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/occam-channel.go new file mode 100644 index 0000000000000000000000000000000000000000..9d01f078769e5a47cecd8a1843130fb9591e5241 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/occam-channel.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/optargs.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/optargs.go new file mode 100644 index 0000000000000000000000000000000000000000..9c51cff705da039d905a09463dcb775074c9799e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/optargs.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg.go new file mode 100644 index 0000000000000000000000000000000000000000..c65685bc87b1e124660fedc845b7415e3dde95a2 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/cache.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/cache.go new file mode 100644 index 0000000000000000000000000000000000000000..f1b94a3ff03fa88d525a9f8deff1b4f90f50e7b6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/cache.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/codegen.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/codegen.go new file mode 100644 index 0000000000000000000000000000000000000000..dac6e49b5a47ffd73e9166f9fafd7d5939dc20ca Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/codegen.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/simplify-tree.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/simplify-tree.go new file mode 100644 index 0000000000000000000000000000000000000000..f72380ebd17599e7069e69c124044e26923bcf75 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/simplify-tree.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/string-peg.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/string-peg.go new file mode 100644 index 0000000000000000000000000000000000000000..5b3c001c68f5a1db6aad159811647c15ef4e8f55 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/string-peg.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/using-parsers.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/using-parsers.go new file mode 100644 index 0000000000000000000000000000000000000000..c963a6a4622b000ea63f6fa3f3d3a865e5579bd6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/peg/using-parsers.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/poe.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/poe.go new file mode 100644 index 0000000000000000000000000000000000000000..7a489c72a9ba43438a5c43ce333c88d9f5a2edaf Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/poe.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/poll.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/poll.go new file mode 100644 index 0000000000000000000000000000000000000000..930137f8af294233bbbe8239f58ddb211d1db2b7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/poll.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/popen.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/popen.go new file mode 100644 index 0000000000000000000000000000000000000000..d3b9b8a1891fac8bf56e1ca6544124fed4ec12c0 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/popen.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ports.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ports.go new file mode 100644 index 0000000000000000000000000000000000000000..710c178d7fc2a3ea2b1784f7a1a6c3e14e64e5a7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/ports.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/posix.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/posix.go new file mode 100644 index 0000000000000000000000000000000000000000..9aa6eb8fc07eb6bd1976474f9048a74f0b67c658 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/posix.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/pretty-print.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/pretty-print.go new file mode 100644 index 0000000000000000000000000000000000000000..40161192be3f4ea1094f30a0a35a1ca3540f3ac9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/pretty-print.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/psyntax-pp.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/psyntax-pp.go new file mode 100644 index 0000000000000000000000000000000000000000..cd82a0109bddc07886acb82b5cd5c600b76100d5 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/psyntax-pp.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/q.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/q.go new file mode 100644 index 0000000000000000000000000000000000000000..8796d365dac64e9492b9a4a5ee3bc0576d1e4458 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/q.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/r5rs.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/r5rs.go new file mode 100644 index 0000000000000000000000000000000000000000..1fced0e0169555eb9aaf7ec8f6f942442e25c58f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/r5rs.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/rdelim.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/rdelim.go new file mode 100644 index 0000000000000000000000000000000000000000..80385f850b2779f3b8f4df654d638bde17d36efe Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/rdelim.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/receive.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/receive.go new file mode 100644 index 0000000000000000000000000000000000000000..7ebaa9ee2611b120d06c5a99ea2871f36c1ed7be Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/receive.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/regex.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/regex.go new file mode 100644 index 0000000000000000000000000000000000000000..e4ace196984d0ad03e25265a2fa0449f5bafc228 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/regex.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/runq.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/runq.go new file mode 100644 index 0000000000000000000000000000000000000000..a5eb40984342b818728ae710f73c39b23c36b590 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/runq.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/rw.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/rw.go new file mode 100644 index 0000000000000000000000000000000000000000..b1134f7ff475b91c798bd6ba683303324e4e6b91 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/rw.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/safe-r5rs.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/safe-r5rs.go new file mode 100644 index 0000000000000000000000000000000000000000..24f566b0f1661521e1ae120bfa6a64807dd8b986 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/safe-r5rs.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/safe.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/safe.go new file mode 100644 index 0000000000000000000000000000000000000000..2cf46ff782aae3d5d90ec26a28ebc694b4d80506 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/safe.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/sandbox.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/sandbox.go new file mode 100644 index 0000000000000000000000000000000000000000..f50b7cb09ce5d31440d6284ed3ef68e309e9d59a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/sandbox.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/save-stack.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/save-stack.go new file mode 100644 index 0000000000000000000000000000000000000000..2e7716cc20c04af923d79225de372a841d8ae664 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/save-stack.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/scm-style-repl.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/scm-style-repl.go new file mode 100644 index 0000000000000000000000000000000000000000..17b188a815fc78cecb5e5346a68f4a4a39578f2b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/scm-style-repl.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/serialize.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/serialize.go new file mode 100644 index 0000000000000000000000000000000000000000..bf9448ce41c274fe7c060d4cc7bac6c7013e7bd4 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/serialize.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/session.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/session.go new file mode 100644 index 0000000000000000000000000000000000000000..945fe270dd35c2d3b4c9e0ad4330f6eb9dd06bbf Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/session.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/slib.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/slib.go new file mode 100644 index 0000000000000000000000000000000000000000..528253e0317e5704e472ef74b4842fd03b41f9f8 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/slib.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/stack-catch.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/stack-catch.go new file mode 100644 index 0000000000000000000000000000000000000000..44b7b2c31d9b0802211296071e0e17dd1a015309 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/stack-catch.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/streams.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/streams.go new file mode 100644 index 0000000000000000000000000000000000000000..755e602a37ff2ccc217078f4688fb53389d29104 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/streams.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/string-fun.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/string-fun.go new file mode 100644 index 0000000000000000000000000000000000000000..aff9766bd38d2963746fea47f850e0c0201dad87 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/string-fun.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/suspendable-ports.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/suspendable-ports.go new file mode 100644 index 0000000000000000000000000000000000000000..d5b6eda7168a8e3a0b3b3a4286f2da0795b82655 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/suspendable-ports.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/syncase.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/syncase.go new file mode 100644 index 0000000000000000000000000000000000000000..7335cb1102079cee68201de9c5f185c42197830c Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/syncase.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/textual-ports.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/textual-ports.go new file mode 100644 index 0000000000000000000000000000000000000000..ac5db22baec34bf3772c1064add6796270c7f720 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/textual-ports.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/threads.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/threads.go new file mode 100644 index 0000000000000000000000000000000000000000..e0a579cbf5d836d32bab287d9428025c9f26e572 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/threads.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/time.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/time.go new file mode 100644 index 0000000000000000000000000000000000000000..0a0d8a253f4f19c327a53244181e7174605c7680 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/time.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/top-repl.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/top-repl.go new file mode 100644 index 0000000000000000000000000000000000000000..469885b7e271499c43931f637a46fad74d21b5f9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/top-repl.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/unicode.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/unicode.go new file mode 100644 index 0000000000000000000000000000000000000000..e9ce3cca0d64be6adcbe832ad965c593429bdd97 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/unicode.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/vlist.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/vlist.go new file mode 100644 index 0000000000000000000000000000000000000000..a7755e9db203e03f182dc861a1f6adccc5fba22c Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/vlist.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/weak-vector.go b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/weak-vector.go new file mode 100644 index 0000000000000000000000000000000000000000..07615e8939aab5e7a5560932f89716c88868515e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/weak-vector.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/compile-scheme.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/compile-scheme.go new file mode 100644 index 0000000000000000000000000000000000000000..87b05926e01b3c85f2ada6618bf6bdccf140e3ee Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/compile-scheme.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/compile-tree-il.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/compile-tree-il.go new file mode 100644 index 0000000000000000000000000000000000000000..86d0483d85fb532866a314a9e81d5406d85a4fd5 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/compile-tree-il.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/parse.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/parse.go new file mode 100644 index 0000000000000000000000000000000000000000..2a1c0bd0b9f1b9d2dbbf2f1499a9d357f4c6a7ee Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/parse.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/spec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/spec.go new file mode 100644 index 0000000000000000000000000000000000000000..f5d578ed67304b5bbc41b5c23ff7240850f8f170 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/brainfuck/spec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/bytecode.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/bytecode.go new file mode 100644 index 0000000000000000000000000000000000000000..8bdae1c77355c7517736a5ab19f7fc7c60b8ca84 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/bytecode.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/bytecode/spec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/bytecode/spec.go new file mode 100644 index 0000000000000000000000000000000000000000..0c254f5632e39dd989bfa6e537565b27e4315a64 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/bytecode/spec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps.go new file mode 100644 index 0000000000000000000000000000000000000000..d8a800f5e72ecdf60229252c60c4589cd522bdea Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/closure-conversion.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/closure-conversion.go new file mode 100644 index 0000000000000000000000000000000000000000..d59880174ad996d9c2d1920b3a4f2e978fef3e7a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/closure-conversion.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/compile-bytecode.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/compile-bytecode.go new file mode 100644 index 0000000000000000000000000000000000000000..27710a6d7e99d7db9120ccb16518be902b7abf84 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/compile-bytecode.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/constructors.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/constructors.go new file mode 100644 index 0000000000000000000000000000000000000000..c4524509cf598a0f1aa0920ca0b5ce696f340eeb Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/constructors.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/contification.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/contification.go new file mode 100644 index 0000000000000000000000000000000000000000..b74d4aef258742bf76018cfc2804d18c8f2bd83b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/contification.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/cse.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/cse.go new file mode 100644 index 0000000000000000000000000000000000000000..67a865692358a2ed61b3edcd9f9ca3663ac0eab1 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/cse.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/dce.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/dce.go new file mode 100644 index 0000000000000000000000000000000000000000..a3edfc71499c6824d13d3a51921bbc930602bd43 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/dce.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/effects-analysis.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/effects-analysis.go new file mode 100644 index 0000000000000000000000000000000000000000..b2984666622b8ea8f9c28498fdc31a60788bec0d Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/effects-analysis.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/elide-values.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/elide-values.go new file mode 100644 index 0000000000000000000000000000000000000000..d7a398900d5f5cec091b00ceb31e251cc2179344 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/elide-values.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/handle-interrupts.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/handle-interrupts.go new file mode 100644 index 0000000000000000000000000000000000000000..a7ffee0c08b6186edd053b13a3aa99b3eff06c07 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/handle-interrupts.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/intmap.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/intmap.go new file mode 100644 index 0000000000000000000000000000000000000000..7e7d5707bad08a8b3f0f16c74296db8c9ab966c3 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/intmap.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/intset.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/intset.go new file mode 100644 index 0000000000000000000000000000000000000000..45c674543dac103a4d69d79e47e87e7a3465d251 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/intset.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/licm.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/licm.go new file mode 100644 index 0000000000000000000000000000000000000000..a6770b3c645cd4a081b58b076559299e3a3551c8 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/licm.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/optimize.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/optimize.go new file mode 100644 index 0000000000000000000000000000000000000000..a352184739e49a9daf82c3c07e619541ca7d0c47 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/optimize.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/peel-loops.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/peel-loops.go new file mode 100644 index 0000000000000000000000000000000000000000..6df9bbdcbd362ed89df1bc41de091c8076fa5fdd Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/peel-loops.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/primitives.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/primitives.go new file mode 100644 index 0000000000000000000000000000000000000000..b3e13b6d21915318e8a5118b745405944917b36e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/primitives.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/prune-bailouts.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/prune-bailouts.go new file mode 100644 index 0000000000000000000000000000000000000000..ca2194e3c69cf9b789f8243a7683e9f62774fc8b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/prune-bailouts.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/prune-top-level-scopes.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/prune-top-level-scopes.go new file mode 100644 index 0000000000000000000000000000000000000000..f0fce6196c733a207c1d4a135191c1e77e0c0654 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/prune-top-level-scopes.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/reify-primitives.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/reify-primitives.go new file mode 100644 index 0000000000000000000000000000000000000000..06220995a70396f38f1dd15ec8f2888ab7f8e7ff Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/reify-primitives.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/renumber.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/renumber.go new file mode 100644 index 0000000000000000000000000000000000000000..07b44f86333637550029a43fb8abe774fdb55e22 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/renumber.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/rotate-loops.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/rotate-loops.go new file mode 100644 index 0000000000000000000000000000000000000000..6064feadead21fdccbaf3c54b3bf0223b36fa5c3 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/rotate-loops.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/self-references.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/self-references.go new file mode 100644 index 0000000000000000000000000000000000000000..98bb1c1b69ef6b8e2527feacd43ecba1c5a28a02 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/self-references.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/simplify.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/simplify.go new file mode 100644 index 0000000000000000000000000000000000000000..19bec774f13fe9a17e5596cb06eef3fceed0e504 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/simplify.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/slot-allocation.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/slot-allocation.go new file mode 100644 index 0000000000000000000000000000000000000000..816cded86fd891adcabfc90f0f59d787557ca06b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/slot-allocation.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/spec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/spec.go new file mode 100644 index 0000000000000000000000000000000000000000..8759207a58320d058b64b2333388807d13f66cc7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/spec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/specialize-numbers.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/specialize-numbers.go new file mode 100644 index 0000000000000000000000000000000000000000..5a3b5134115a7babd98dd7f39593fd783ef43449 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/specialize-numbers.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/specialize-primcalls.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/specialize-primcalls.go new file mode 100644 index 0000000000000000000000000000000000000000..b05eb19cea80a9c848af4e33022313dd1205a64c Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/specialize-primcalls.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/split-rec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/split-rec.go new file mode 100644 index 0000000000000000000000000000000000000000..f688d2dd138bad5d5967a60338a85d4417f9f354 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/split-rec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/type-checks.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/type-checks.go new file mode 100644 index 0000000000000000000000000000000000000000..c969489dd5d34301700783186f9ef283d4f62a1a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/type-checks.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/type-fold.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/type-fold.go new file mode 100644 index 0000000000000000000000000000000000000000..0662bf540894331a47477f07d5cb039d64d34db6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/type-fold.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/types.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/types.go new file mode 100644 index 0000000000000000000000000000000000000000..f5e1cabb2ca9b86a0e443d4ec2c3dc29ca913572 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/types.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/utils.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/utils.go new file mode 100644 index 0000000000000000000000000000000000000000..e3c7cc2f88895117a481ce1d02e5962441bb8355 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/utils.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/verify.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/verify.go new file mode 100644 index 0000000000000000000000000000000000000000..a05533290e7115bd0db5452e3c0da20c9e80e3e2 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/verify.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/with-cps.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/with-cps.go new file mode 100644 index 0000000000000000000000000000000000000000..55fdef5fe4913b817f5939755d449ae629806f8c Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/cps/with-cps.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/array.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/array.go new file mode 100644 index 0000000000000000000000000000000000000000..5183c91f093483604fbf28599ce2832e910fe7c8 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/array.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/base.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/base.go new file mode 100644 index 0000000000000000000000000000000000000000..7dec5c942886a392339592fa5c8165b82c0191d7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/base.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/compile-tree-il.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/compile-tree-il.go new file mode 100644 index 0000000000000000000000000000000000000000..d0b55ebffcf268a12003962017f7db85d34e4e14 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/compile-tree-il.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/function.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/function.go new file mode 100644 index 0000000000000000000000000000000000000000..52c93bb9c755ed2f7b80baf9a86c056947fbbfef Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/function.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/impl.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/impl.go new file mode 100644 index 0000000000000000000000000000000000000000..dab913756d3ca318ff94d8b4353890bc63db45b5 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/impl.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/parse.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/parse.go new file mode 100644 index 0000000000000000000000000000000000000000..2315876e09aabe73c45c220240d7cc0586e0b777 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/parse.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/spec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/spec.go new file mode 100644 index 0000000000000000000000000000000000000000..ddd12cbe2e5faa5fcbd1ee5ca41bae128de6f7a3 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/spec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/tokenize.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/tokenize.go new file mode 100644 index 0000000000000000000000000000000000000000..472bf019713bf430bc03dbe0f7740ea9918a76a6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/ecmascript/tokenize.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/bindings.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/bindings.go new file mode 100644 index 0000000000000000000000000000000000000000..fbe8101c9fac9707251087e7f21d2661fd488d37 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/bindings.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/boot.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/boot.go new file mode 100644 index 0000000000000000000000000000000000000000..66d9fac81915f4b2e9c7144a7109e866e33e3e0b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/boot.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/compile-tree-il.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/compile-tree-il.go new file mode 100644 index 0000000000000000000000000000000000000000..ebd9034ade2371d1ebdb37d094ecd457f50ac67a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/compile-tree-il.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/falias.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/falias.go new file mode 100644 index 0000000000000000000000000000000000000000..fac59a61b17bfc990de383a855c8f46e41f3414f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/falias.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/lexer.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/lexer.go new file mode 100644 index 0000000000000000000000000000000000000000..2b0431d0409574a7b3e23f732815957d76c9af6a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/lexer.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/parser.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/parser.go new file mode 100644 index 0000000000000000000000000000000000000000..379fef982b440ee7d238efeacf0ef848e7ac122b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/parser.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime.go new file mode 100644 index 0000000000000000000000000000000000000000..f51bb7b6d72d580933ee4f4f42654c34a491a3e9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime/function-slot.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime/function-slot.go new file mode 100644 index 0000000000000000000000000000000000000000..ecc01bfe2bfe67866d15d086e4b3b8405a241df6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime/function-slot.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime/value-slot.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime/value-slot.go new file mode 100644 index 0000000000000000000000000000000000000000..07db7d56b929c4d2a8aac76b023715a56488406b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/runtime/value-slot.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/spec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/spec.go new file mode 100644 index 0000000000000000000000000000000000000000..f7feb45b8415e001a46bd7632bbdcf1d594cf163 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/elisp/spec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/compile-tree-il.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/compile-tree-il.go new file mode 100644 index 0000000000000000000000000000000000000000..4e87b824ce6eeec57ef419a331975aa98db999de Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/compile-tree-il.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/decompile-tree-il.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/decompile-tree-il.go new file mode 100644 index 0000000000000000000000000000000000000000..999169fd02a08164c513ec9c0f31da19c34bb368 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/decompile-tree-il.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/spec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/spec.go new file mode 100644 index 0000000000000000000000000000000000000000..841981867de295342b455efd4150a6b245c38b27 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/scheme/spec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il.go new file mode 100644 index 0000000000000000000000000000000000000000..b018cb4613e908b8784c02374e1ff8acea07bff5 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/analyze.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/analyze.go new file mode 100644 index 0000000000000000000000000000000000000000..32077350c903fc3e49137d70b9d51929b45b0938 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/analyze.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/canonicalize.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/canonicalize.go new file mode 100644 index 0000000000000000000000000000000000000000..a0a0b4d013faad882874a2ae61ae51534e6d36fd Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/canonicalize.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/compile-cps.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/compile-cps.go new file mode 100644 index 0000000000000000000000000000000000000000..19efdadaf900308cd0476bee1f0d5fd2bd83befc Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/compile-cps.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/debug.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/debug.go new file mode 100644 index 0000000000000000000000000000000000000000..4ddb5ddadea404bea8690cbbba1c29707eca15bc Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/debug.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/effects.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/effects.go new file mode 100644 index 0000000000000000000000000000000000000000..5ff0221c3dc8c17b14929c2d02bf8735dc819189 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/effects.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/fix-letrec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/fix-letrec.go new file mode 100644 index 0000000000000000000000000000000000000000..0d5f6d224c8fc567dc43a037fc1f27cc14e00a3e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/fix-letrec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/optimize.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/optimize.go new file mode 100644 index 0000000000000000000000000000000000000000..8ce3e87d73df39e3cf8873594bc7927400b47751 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/optimize.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/peval.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/peval.go new file mode 100644 index 0000000000000000000000000000000000000000..11fca9d2cb14cffcc96482f3afbb51c49b8a8ab6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/peval.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/primitives.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/primitives.go new file mode 100644 index 0000000000000000000000000000000000000000..270f1a9e89f8ecbc7ce50b24febd00ef86393894 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/primitives.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/spec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/spec.go new file mode 100644 index 0000000000000000000000000000000000000000..4758312c5ccade8823204915ca7d715b2e820fd9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/tree-il/spec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/language/value/spec.go b/lilypond-2.24.2/lib/guile/2.2/ccache/language/value/spec.go new file mode 100644 index 0000000000000000000000000000000000000000..238d3d4d976822950bcfdca81190566b4a2f3b94 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/language/value/spec.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops.go new file mode 100644 index 0000000000000000000000000000000000000000..35561d5f0f76889bc76718070c18e87749e7ca07 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/accessors.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/accessors.go new file mode 100644 index 0000000000000000000000000000000000000000..686bbf12b40a02ece76271110db403a0f94f1c25 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/accessors.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/active-slot.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/active-slot.go new file mode 100644 index 0000000000000000000000000000000000000000..84a084244f278700bb468bf920290d17f20ee160 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/active-slot.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/composite-slot.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/composite-slot.go new file mode 100644 index 0000000000000000000000000000000000000000..8fb46037d33380d4234eb5b4368de115b42cbbb6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/composite-slot.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/describe.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/describe.go new file mode 100644 index 0000000000000000000000000000000000000000..db4e439e979cda6b88e8116da8e5e61cdf221c62 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/describe.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/internal.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/internal.go new file mode 100644 index 0000000000000000000000000000000000000000..b1cbf5c0ddd70695c4ff71b576aa4f4b418eff61 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/internal.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/save.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/save.go new file mode 100644 index 0000000000000000000000000000000000000000..d885c7f099a2746cd92d409cd461e1b64c95a1d7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/save.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/simple.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/simple.go new file mode 100644 index 0000000000000000000000000000000000000000..c0924c7e7dc1d3bb5068f27b2ee318acf499647f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/simple.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/stklos.go b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/stklos.go new file mode 100644 index 0000000000000000000000000000000000000000..b505246b424be5e23af87fe241f2de2f2fff2022 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/oop/goops/stklos.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs.go new file mode 100644 index 0000000000000000000000000000000000000000..f3fb4fb9e40dc90b851eed5189ba044f57d32033 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/bitwise.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/bitwise.go new file mode 100644 index 0000000000000000000000000000000000000000..e0d597379524260f719656c882bffea9d326feb0 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/bitwise.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/fixnums.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/fixnums.go new file mode 100644 index 0000000000000000000000000000000000000000..6640e05e6bef0cc2439cce39f2c46d9c162e7719 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/fixnums.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/flonums.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/flonums.go new file mode 100644 index 0000000000000000000000000000000000000000..b0d12746c49bfc960fb1e712f88b138f6aa0adf5 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/arithmetic/flonums.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/base.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/base.go new file mode 100644 index 0000000000000000000000000000000000000000..3c578c35f139ded47540d79206ab034ffe9c9878 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/base.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/bytevectors.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/bytevectors.go new file mode 100644 index 0000000000000000000000000000000000000000..76fb555b727336762d172abf3d91380984411e5d Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/bytevectors.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/conditions.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/conditions.go new file mode 100644 index 0000000000000000000000000000000000000000..870702c3c9666671fd53199eb91d5e5ba8ab4204 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/conditions.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/control.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/control.go new file mode 100644 index 0000000000000000000000000000000000000000..1c4ef48cd463bc44bedd546af4f5cf8770761eca Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/control.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/enums.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/enums.go new file mode 100644 index 0000000000000000000000000000000000000000..06097ed4656fbeba855258ef8cf484ba774fb7cf Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/enums.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/eval.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/eval.go new file mode 100644 index 0000000000000000000000000000000000000000..7e3485ceec03fba58299baa71b47d957e5932980 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/eval.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/exceptions.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/exceptions.go new file mode 100644 index 0000000000000000000000000000000000000000..ac6a8d3a0e76118382774d048639332a38b33dd5 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/exceptions.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/files.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/files.go new file mode 100644 index 0000000000000000000000000000000000000000..508974bfd9d8e6680b311ceb80ebd29f418e126c Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/files.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/hashtables.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/hashtables.go new file mode 100644 index 0000000000000000000000000000000000000000..817944d54447c7a69162d131dd97e6485eef7e83 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/hashtables.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/io/ports.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/io/ports.go new file mode 100644 index 0000000000000000000000000000000000000000..b1703af297a8fd4fbba850cd2f46b6e6cd0b0246 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/io/ports.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/io/simple.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/io/simple.go new file mode 100644 index 0000000000000000000000000000000000000000..0c173880fa5b52ed4af67987089309f0641f1320 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/io/simple.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/lists.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/lists.go new file mode 100644 index 0000000000000000000000000000000000000000..53c499db4fe5fa929ba045fad76e16e7b0d4058e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/lists.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/mutable-pairs.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/mutable-pairs.go new file mode 100644 index 0000000000000000000000000000000000000000..3260d9b81a7af3deb6e573e4391072802631dbc4 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/mutable-pairs.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/mutable-strings.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/mutable-strings.go new file mode 100644 index 0000000000000000000000000000000000000000..928f634ba07385363eee71732428d339d5204d3f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/mutable-strings.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/programs.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/programs.go new file mode 100644 index 0000000000000000000000000000000000000000..b7790bc4e11cd44424d14ebf3d6af472be1b827b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/programs.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/r5rs.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/r5rs.go new file mode 100644 index 0000000000000000000000000000000000000000..204952e149882d1f014ecb5a7dbc4ef1898bca8a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/r5rs.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/inspection.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/inspection.go new file mode 100644 index 0000000000000000000000000000000000000000..c13b33a2bbd7557646d4096dcd1a620dcf4a963e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/inspection.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/procedural.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/procedural.go new file mode 100644 index 0000000000000000000000000000000000000000..d5f062339842aab44585aad517c7db60e196fed3 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/procedural.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/syntactic.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/syntactic.go new file mode 100644 index 0000000000000000000000000000000000000000..afa70fe2020917d2a11ccb5ac41def20f4e8b530 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/records/syntactic.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/sorting.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/sorting.go new file mode 100644 index 0000000000000000000000000000000000000000..3f9080e420189f3c61a0014b760ca447ecb7814f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/sorting.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/syntax-case.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/syntax-case.go new file mode 100644 index 0000000000000000000000000000000000000000..580d0bdb9ccc4caa50f8e14a3a74623a8ca464bb Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/syntax-case.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/unicode.go b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/unicode.go new file mode 100644 index 0000000000000000000000000000000000000000..31d61eb0be395d03e0c956e84638413b9097ae29 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/rnrs/unicode.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/api-diff.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/api-diff.go new file mode 100644 index 0000000000000000000000000000000000000000..238f7fe6ac3be5e916001cc56db431278e57e030 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/api-diff.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/autofrisk.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/autofrisk.go new file mode 100644 index 0000000000000000000000000000000000000000..d694571d0c5c78d538e8988ec6795d1ab9a3c5c4 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/autofrisk.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/compile.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/compile.go new file mode 100644 index 0000000000000000000000000000000000000000..8b0ed33c3045f08cb5e85a100a3a5639b2a5aea6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/compile.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/disassemble.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/disassemble.go new file mode 100644 index 0000000000000000000000000000000000000000..19f5842dcf2ee20d7288f3d8aee6a70d86d09af0 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/disassemble.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/display-commentary.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/display-commentary.go new file mode 100644 index 0000000000000000000000000000000000000000..2718d7c472a4f263f306a14021faa4c491090c44 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/display-commentary.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/doc-snarf.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/doc-snarf.go new file mode 100644 index 0000000000000000000000000000000000000000..812ef5cd36ee9be2ee5a330d1df9d95cf6e979ac Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/doc-snarf.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/frisk.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/frisk.go new file mode 100644 index 0000000000000000000000000000000000000000..02ef0c8fb47e2257cb8a355a89c56c094e82200b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/frisk.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/generate-autoload.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/generate-autoload.go new file mode 100644 index 0000000000000000000000000000000000000000..9cfb2a0f1aaddf16d1ca7566585ef7b8fb048dfd Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/generate-autoload.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/help.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/help.go new file mode 100644 index 0000000000000000000000000000000000000000..2863d8e1a2e6b7b75cdd30ccb3e1f0bcf9645d0f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/help.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/lint.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/lint.go new file mode 100644 index 0000000000000000000000000000000000000000..1a0ddb7a4d30cae719c6f867b15b860895f1232b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/lint.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/list.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/list.go new file mode 100644 index 0000000000000000000000000000000000000000..ae1e8680c245eec3f03acfad6babdaa6058cd3c7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/list.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/punify.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/punify.go new file mode 100644 index 0000000000000000000000000000000000000000..eeb847548ced83cc4bfeb24c03c8685ee1f82762 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/punify.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-rfc822.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-rfc822.go new file mode 100644 index 0000000000000000000000000000000000000000..b46cfa8837d96d21960b6b9c67a2e7568adc9dcb Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-rfc822.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-scheme-source.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-scheme-source.go new file mode 100644 index 0000000000000000000000000000000000000000..a3e1c417e8829e4f486161fc206bd51f82add790 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-scheme-source.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-text-outline.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-text-outline.go new file mode 100644 index 0000000000000000000000000000000000000000..ea32773d28ba991e1b9eeea4376fa49f0176f255 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/read-text-outline.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/scan-api.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/scan-api.go new file mode 100644 index 0000000000000000000000000000000000000000..282ffde8a48dde653887554754a382a74cab26b7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/scan-api.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/snarf-check-and-output-texi.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/snarf-check-and-output-texi.go new file mode 100644 index 0000000000000000000000000000000000000000..5f58485665808c2cbf104dc3edcefb25ab424fb0 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/snarf-check-and-output-texi.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/snarf-guile-m4-docs.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/snarf-guile-m4-docs.go new file mode 100644 index 0000000000000000000000000000000000000000..4d5c44bfa964c2c5ecd88701fe557201c2a03f2b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/snarf-guile-m4-docs.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/summarize-guile-TODO.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/summarize-guile-TODO.go new file mode 100644 index 0000000000000000000000000000000000000000..2e14976717b377cb78a3c7f15841f005fbe9f77e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/summarize-guile-TODO.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/use2dot.go b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/use2dot.go new file mode 100644 index 0000000000000000000000000000000000000000..0c6b931f49d53c226055e06a275eff3e924546ae Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/scripts/use2dot.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-1.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-1.go new file mode 100644 index 0000000000000000000000000000000000000000..8d889580cf6b453c0ddfc58af6bc70bc52ccc516 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-1.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-10.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-10.go new file mode 100644 index 0000000000000000000000000000000000000000..a94cc8a9546c83a89c5d8659bcc1688471943769 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-10.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-11.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-11.go new file mode 100644 index 0000000000000000000000000000000000000000..71e8da526677da5beb31225e15b1ba721a52f3e2 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-11.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-111.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-111.go new file mode 100644 index 0000000000000000000000000000000000000000..a3194cd912525493d9a021f7c7d61737277f77ed Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-111.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-13.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-13.go new file mode 100644 index 0000000000000000000000000000000000000000..b70563da6b0892d4e5f7ea039e77f8450155e446 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-13.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-14.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-14.go new file mode 100644 index 0000000000000000000000000000000000000000..04994de6193e2631a87d8820de0c2b19ce4b4dc9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-14.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-16.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-16.go new file mode 100644 index 0000000000000000000000000000000000000000..9abb91b15a72f5c312be7ebfbcb35aebc4bf805f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-16.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-17.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-17.go new file mode 100644 index 0000000000000000000000000000000000000000..9ee82cfb524166a9822b4a39183fcafe3051c8c9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-17.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-18.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-18.go new file mode 100644 index 0000000000000000000000000000000000000000..3e03718966b216cd1301b7445029ce9d79bff738 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-18.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-19.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-19.go new file mode 100644 index 0000000000000000000000000000000000000000..3d2ed32bc30d3cf99edca92730925ed2f56e0976 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-19.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-2.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-2.go new file mode 100644 index 0000000000000000000000000000000000000000..07a913e79669820d80213865fdba7e0a18bfbc09 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-2.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-26.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-26.go new file mode 100644 index 0000000000000000000000000000000000000000..a0741d289f64b444609e098d9cf24f5b8063ddc6 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-26.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-27.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-27.go new file mode 100644 index 0000000000000000000000000000000000000000..2491b523a9cea9797490d6b36101e50341c9c03c Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-27.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-28.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-28.go new file mode 100644 index 0000000000000000000000000000000000000000..f5a7db5bfaacc10c20584f22dc3524c2ea3c53b4 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-28.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-31.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-31.go new file mode 100644 index 0000000000000000000000000000000000000000..031dd60ec4a03a419279dd46f1f555f6c59f337e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-31.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-34.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-34.go new file mode 100644 index 0000000000000000000000000000000000000000..9c70d77c99eb7cdb3fe15cced482bd3ecbcdb393 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-34.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-35.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-35.go new file mode 100644 index 0000000000000000000000000000000000000000..fd927669a7828bbfe6150e29f415c79500da535e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-35.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-37.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-37.go new file mode 100644 index 0000000000000000000000000000000000000000..3a3aaff104070da0425060d95e5ddcdfe1000cde Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-37.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-38.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-38.go new file mode 100644 index 0000000000000000000000000000000000000000..926dad083b7d4073440d556377d8f3df9720b1b2 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-38.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-39.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-39.go new file mode 100644 index 0000000000000000000000000000000000000000..8bc68efc5f0a5f2252178105a8eac563fc51c890 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-39.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-4.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-4.go new file mode 100644 index 0000000000000000000000000000000000000000..dc03e362b957083bfe3077cfb8fc26c82f083c9e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-4.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-4/gnu.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-4/gnu.go new file mode 100644 index 0000000000000000000000000000000000000000..756c1a3c9caaa353e9b20c8dba10a7ff82e3563a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-4/gnu.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-41.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-41.go new file mode 100644 index 0000000000000000000000000000000000000000..569a69df3b61de094570a40904dd1de8aedf160e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-41.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-42.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-42.go new file mode 100644 index 0000000000000000000000000000000000000000..256e5172b51b2e02daaa5a513045dae3cf0742c8 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-42.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-43.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-43.go new file mode 100644 index 0000000000000000000000000000000000000000..5cfd64d8421f8fca7f193228297f94506e71646a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-43.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-45.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-45.go new file mode 100644 index 0000000000000000000000000000000000000000..59c0f89cb13d93234b732bf35c5c3105c2f66be8 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-45.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-6.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-6.go new file mode 100644 index 0000000000000000000000000000000000000000..72e40bfe2b1fc892fa32adc0682ce5b858963875 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-6.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-60.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-60.go new file mode 100644 index 0000000000000000000000000000000000000000..346acd81a76fd816759258e3bcf7661e4b0f7db7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-60.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-64.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-64.go new file mode 100644 index 0000000000000000000000000000000000000000..9ffdfa85c86126672701cb8c4b7fdd229a058452 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-64.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-67.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-67.go new file mode 100644 index 0000000000000000000000000000000000000000..57a54fa5110d89aabac416a4b30a171399d58f9a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-67.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-69.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-69.go new file mode 100644 index 0000000000000000000000000000000000000000..8f1d782ff6145f2a01ac109f44c26ec7ad87a020 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-69.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-71.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-71.go new file mode 100644 index 0000000000000000000000000000000000000000..e6aa03127a174175efe117c162663edf58036ad5 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-71.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-8.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-8.go new file mode 100644 index 0000000000000000000000000000000000000000..52ea17c924568633638cb4e62b8e38f9a9d7aadb Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-8.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-88.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-88.go new file mode 100644 index 0000000000000000000000000000000000000000..47e42403bb95ce250901f303ec7efba7c8f1575f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-88.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-9.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-9.go new file mode 100644 index 0000000000000000000000000000000000000000..471355593b44403adc25d650b9f5b48509e7b832 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-9.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-9/gnu.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-9/gnu.go new file mode 100644 index 0000000000000000000000000000000000000000..d200e62c9fe5ce0bf9ada3f46157fce8ff8b4954 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-9/gnu.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-98.go b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-98.go new file mode 100644 index 0000000000000000000000000000000000000000..f22eabe2d73a286dfe42d6056c97676aca52d15a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/srfi/srfi-98.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/statprof.go b/lilypond-2.24.2/lib/guile/2.2/ccache/statprof.go new file mode 100644 index 0000000000000000000000000000000000000000..09cd5d48f6f669035549aa43cb22aed56e18d921 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/statprof.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/apply-templates.go b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/apply-templates.go new file mode 100644 index 0000000000000000000000000000000000000000..2147d855574c1178b48ab41bbfdeeb98fc5688aa Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/apply-templates.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/fold.go b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/fold.go new file mode 100644 index 0000000000000000000000000000000000000000..140b3302098c40c7ac52770487268c6c507410f9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/fold.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/match.go b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/match.go new file mode 100644 index 0000000000000000000000000000000000000000..25832f4ebeeb7dd6076de6fa94eb8f3f7c935bb9 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/match.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/simple.go b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/simple.go new file mode 100644 index 0000000000000000000000000000000000000000..f33e17f8a5a341ef4e3a22a9ae8732068ce679c7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/simple.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/ssax.go b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/ssax.go new file mode 100644 index 0000000000000000000000000000000000000000..22746e74086d4b3179ef998de621f25e1c78409d Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/ssax.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/ssax/input-parse.go b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/ssax/input-parse.go new file mode 100644 index 0000000000000000000000000000000000000000..85435720da17afcb250768fd5cf41d1c8ca998dd Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/ssax/input-parse.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/transform.go b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/transform.go new file mode 100644 index 0000000000000000000000000000000000000000..87bd2df9c139c4a9bde78a7ec84753b0de3a8068 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/transform.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/xpath.go b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/xpath.go new file mode 100644 index 0000000000000000000000000000000000000000..2cbd0ee4478b18468148656d412af0a336dc42d0 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/sxml/xpath.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/ck.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/ck.go new file mode 100644 index 0000000000000000000000000000000000000000..1138b80240c03e553eb1152f0b70cf72c05eda20 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/ck.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/compile.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/compile.go new file mode 100644 index 0000000000000000000000000000000000000000..49e1f059ad965eeb2606f732a03aaf1617e28a8a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/compile.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/lalr.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/lalr.go new file mode 100644 index 0000000000000000000000000000000000000000..4058ed3fd852e3b430d6a564fc2b0f02db9dc714 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/lalr.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/language.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/language.go new file mode 100644 index 0000000000000000000000000000000000000000..72470be9c188ef63f31eb941012abc69e19f9be7 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/language.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/message.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/message.go new file mode 100644 index 0000000000000000000000000000000000000000..e1d828812e82b6065d0455e6fff2748037729232 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/message.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/pmatch.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/pmatch.go new file mode 100644 index 0000000000000000000000000000000000000000..3f048637be52641d10cc7cee13c148261dd74df5 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/pmatch.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/syntax.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/syntax.go new file mode 100644 index 0000000000000000000000000000000000000000..ee64f37c6e5c98e87151f8175ef2bc1f43a6d256 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/syntax.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/target.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/target.go new file mode 100644 index 0000000000000000000000000000000000000000..68a679219a176dd65c1f8ed91c98511accbcffde Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/target.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/types.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/types.go new file mode 100644 index 0000000000000000000000000000000000000000..3b085a4931383dfcce99d689db99156ef663d379 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/base/types.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/foreign-object.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/foreign-object.go new file mode 100644 index 0000000000000000000000000000000000000000..005d2dfab932c403bb0c7c0f39e341b14a53e731 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/foreign-object.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/foreign.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/foreign.go new file mode 100644 index 0000000000000000000000000000000000000000..f067f75bd09f03ec9b68913697e63e13e04e3b2e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/foreign.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/command.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/command.go new file mode 100644 index 0000000000000000000000000000000000000000..778ef197e7774dfd0d54457d6737a0ad9a8ab667 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/command.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/common.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/common.go new file mode 100644 index 0000000000000000000000000000000000000000..da9919eb318a2543154d3ee94535b64feddb7659 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/common.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/coop-server.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/coop-server.go new file mode 100644 index 0000000000000000000000000000000000000000..39ea0a63fd23c3f6112c44e1286f5794982e97c3 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/coop-server.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/debug.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/debug.go new file mode 100644 index 0000000000000000000000000000000000000000..c5b5c03f80901abda12dd20cbe2addbc4457c568 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/debug.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/error-handling.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/error-handling.go new file mode 100644 index 0000000000000000000000000000000000000000..d91cb4d4bbd706eea89f3652e0f011eee4592392 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/error-handling.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/repl.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/repl.go new file mode 100644 index 0000000000000000000000000000000000000000..57ae509a0c979c0eb67658b53975fa77dd17fdba Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/repl.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/server.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/server.go new file mode 100644 index 0000000000000000000000000000000000000000..ed760c0091a4b0e9ec2becd5b4aff5f54eb1194d Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/repl/server.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/syntax.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/syntax.go new file mode 100644 index 0000000000000000000000000000000000000000..88852b4da27b0f085681d1bb099a8ae3cbc08edf Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/syntax.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/assembler.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/assembler.go new file mode 100644 index 0000000000000000000000000000000000000000..2894767d3ff568d8dc7ccf0cc211c525f662866b --- /dev/null +++ b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/assembler.go @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fb7d9858294c538a03b1334af8b23a2eb71535c9a87d8caa3212e03bf93b46e +size 1004397 diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/coverage.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/coverage.go new file mode 100644 index 0000000000000000000000000000000000000000..8248f104cb5b5639fec27f638d80478220671371 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/coverage.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/debug.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/debug.go new file mode 100644 index 0000000000000000000000000000000000000000..62667ae5dcc3b0259197b6582729d0407490a94e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/debug.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/disassembler.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/disassembler.go new file mode 100644 index 0000000000000000000000000000000000000000..33f5ce6d4cbfff9d9c8abec3f4d6fe65492d6dcb Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/disassembler.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/dwarf.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/dwarf.go new file mode 100644 index 0000000000000000000000000000000000000000..46bf9a4eae67971838c7b6a4a26b17d630195575 --- /dev/null +++ b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/dwarf.go @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34e32ed0bbbfc3abe88444d0fe4c1c5aa292581ce9fea4629ddd1e7685fd6799 +size 1142437 diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/elf.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/elf.go new file mode 100644 index 0000000000000000000000000000000000000000..6c2d54bb4d366ed6a4804f8ddf9ac0eb29fbb060 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/elf.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/frame.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/frame.go new file mode 100644 index 0000000000000000000000000000000000000000..77576aedd9af656f07c87bd5ee085e7194f6a5a3 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/frame.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/inspect.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/inspect.go new file mode 100644 index 0000000000000000000000000000000000000000..fc8177daf217639073d8be000aea1dad456d69ca Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/inspect.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/linker.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/linker.go new file mode 100644 index 0000000000000000000000000000000000000000..90607945fec12c07372adf9a3e1b15396461941a Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/linker.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/loader.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/loader.go new file mode 100644 index 0000000000000000000000000000000000000000..0487552ef1a93e0273b15362d0c3a46702321172 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/loader.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/program.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/program.go new file mode 100644 index 0000000000000000000000000000000000000000..ef4158c9f392347220d8eaba6a056cfe50483160 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/program.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/trace.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/trace.go new file mode 100644 index 0000000000000000000000000000000000000000..c7df51fae61bbedf43545367a744dc8b1ad73e21 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/trace.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/trap-state.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/trap-state.go new file mode 100644 index 0000000000000000000000000000000000000000..95da72ed2bc53a6bae2d98f15835c96cc3fbb1d2 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/trap-state.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/traps.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/traps.go new file mode 100644 index 0000000000000000000000000000000000000000..568d2c26298879f5722bf4562fd9717df23cda8b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/traps.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/vm.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/vm.go new file mode 100644 index 0000000000000000000000000000000000000000..6b7d8c6201e88eaa6c5f5f309a9f47a1c2da09a2 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/vm/vm.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/system/xref.go b/lilypond-2.24.2/lib/guile/2.2/ccache/system/xref.go new file mode 100644 index 0000000000000000000000000000000000000000..67c4d3e71a7b0659bacd3b146df778ceeae626bc Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/system/xref.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo.go b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo.go new file mode 100644 index 0000000000000000000000000000000000000000..ad2192f0af78c989c3b8b12b95bd8ce45b7d27b2 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/docbook.go b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/docbook.go new file mode 100644 index 0000000000000000000000000000000000000000..2b0efad54e277c276bdcfb7090b2397b2d4da696 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/docbook.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/html.go b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/html.go new file mode 100644 index 0000000000000000000000000000000000000000..293d328e31d72a93ac9d89154c3dab61c2db9c5b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/html.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/indexing.go b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/indexing.go new file mode 100644 index 0000000000000000000000000000000000000000..66883122d6d1d8e55e1dbb9ebcbe9288dcbf5af8 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/indexing.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/plain-text.go b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/plain-text.go new file mode 100644 index 0000000000000000000000000000000000000000..0dca2aa58013e76063362ac88ed2fc0a703d066e Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/plain-text.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/reflection.go b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/reflection.go new file mode 100644 index 0000000000000000000000000000000000000000..a3f6339b485cf80129379dde76ca804c592f9746 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/reflection.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/serialize.go b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/serialize.go new file mode 100644 index 0000000000000000000000000000000000000000..e0bce139eac527c0a5c73b31ee6ebf70ef889957 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/serialize.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/string-utils.go b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/string-utils.go new file mode 100644 index 0000000000000000000000000000000000000000..2cc6a2567e6d41d2884eb605b82754035f95d021 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/texinfo/string-utils.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/web/client.go b/lilypond-2.24.2/lib/guile/2.2/ccache/web/client.go new file mode 100644 index 0000000000000000000000000000000000000000..fcef9dbe28603492d1662a18d4916eff3acf3d38 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/web/client.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/web/http.go b/lilypond-2.24.2/lib/guile/2.2/ccache/web/http.go new file mode 100644 index 0000000000000000000000000000000000000000..5bbf98b07140775e773c8ab85fbf2349a5c2ed5b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/web/http.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/web/request.go b/lilypond-2.24.2/lib/guile/2.2/ccache/web/request.go new file mode 100644 index 0000000000000000000000000000000000000000..61603ca363996ad3fa79ee0e9bcfb6a9d52d561f Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/web/request.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/web/response.go b/lilypond-2.24.2/lib/guile/2.2/ccache/web/response.go new file mode 100644 index 0000000000000000000000000000000000000000..a41c98abb3cfd80f0826937c775fa5abd5d833ef Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/web/response.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/web/server.go b/lilypond-2.24.2/lib/guile/2.2/ccache/web/server.go new file mode 100644 index 0000000000000000000000000000000000000000..ea2943c29d2f2801e4d45486aa16964a21ab3ebc Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/web/server.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/web/server/http.go b/lilypond-2.24.2/lib/guile/2.2/ccache/web/server/http.go new file mode 100644 index 0000000000000000000000000000000000000000..6123a00324e3caf381e8121f93394abe25933513 Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/web/server/http.go differ diff --git a/lilypond-2.24.2/lib/guile/2.2/ccache/web/uri.go b/lilypond-2.24.2/lib/guile/2.2/ccache/web/uri.go new file mode 100644 index 0000000000000000000000000000000000000000..ae68b3de9e082961de57dcf1a9a5f6e61230723b Binary files /dev/null and b/lilypond-2.24.2/lib/guile/2.2/ccache/web/uri.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/accreg.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/accreg.go new file mode 100644 index 0000000000000000000000000000000000000000..9ce4e12c4169f446c40afad5780d6895d478daca Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/accreg.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/auto-beam.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/auto-beam.go new file mode 100644 index 0000000000000000000000000000000000000000..7f1b6d514703df873a07a292ebc64914794fc71c Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/auto-beam.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/autochange.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/autochange.go new file mode 100644 index 0000000000000000000000000000000000000000..0021ca197157e06caa801783259475d1483f9b4d Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/autochange.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/backend-library.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/backend-library.go new file mode 100644 index 0000000000000000000000000000000000000000..fa1ef53a9f5b335a85ec88d11598371ea95ca313 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/backend-library.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/bar-line.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/bar-line.go new file mode 100644 index 0000000000000000000000000000000000000000..f8bffd4faed63ee438a5493c238cec815d410e55 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/bar-line.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/breath.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/breath.go new file mode 100644 index 0000000000000000000000000000000000000000..bc3ae75b362f4cb30363409ba887119c8810c51f Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/breath.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/c++.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/c++.go new file mode 100644 index 0000000000000000000000000000000000000000..75ae584c7a56dcddb9385edebad18a52e8d7702e Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/c++.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-entry.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-entry.go new file mode 100644 index 0000000000000000000000000000000000000000..a335f09c8edaf7781bf70e935cab71412320cc0d Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-entry.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-ignatzek-names.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-ignatzek-names.go new file mode 100644 index 0000000000000000000000000000000000000000..0c5f8e0091e98963e39cedca2d7d3377d03926ed Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-ignatzek-names.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-name.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-name.go new file mode 100644 index 0000000000000000000000000000000000000000..39c5a55a7837fb64e20dddbfbbac936b0a285f56 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/chord-name.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/clip-region.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/clip-region.go new file mode 100644 index 0000000000000000000000000000000000000000..7c09d47628f268504e95e9a6dfa276daddad59b8 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/clip-region.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/color.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/color.go new file mode 100644 index 0000000000000000000000000000000000000000..9f2972a5457284ff0ac6d917aaf0dfc01c2f6e5f Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/color.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/curried-definitions.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/curried-definitions.go new file mode 100644 index 0000000000000000000000000000000000000000..36cdd4aeacc574e027d87b529b6c0241a1364a11 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/curried-definitions.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-context-properties.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-context-properties.go new file mode 100644 index 0000000000000000000000000000000000000000..022afe144c24eff3ae2d7f1a10119390ff52b15f Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-context-properties.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-event-classes.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-event-classes.go new file mode 100644 index 0000000000000000000000000000000000000000..af31d127b91e8c4cfa482351b564f1ee87eee9bb Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-event-classes.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grob-interfaces.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grob-interfaces.go new file mode 100644 index 0000000000000000000000000000000000000000..b8c9a687394cdf4050cb7f7d207efff638adb6fc Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grob-interfaces.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grob-properties.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grob-properties.go new file mode 100644 index 0000000000000000000000000000000000000000..3f71c1e4545b166486df0182b1579c1f68587d3b Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grob-properties.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grobs.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grobs.go new file mode 100644 index 0000000000000000000000000000000000000000..14e21a79c79db105a2d5046eeae6456311d7b6a7 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-grobs.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-markup-commands.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-markup-commands.go new file mode 100644 index 0000000000000000000000000000000000000000..92fa16c36e55d84e6a957692b8fd45ea5d3d64db Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-markup-commands.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-callbacks.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-callbacks.go new file mode 100644 index 0000000000000000000000000000000000000000..0b27962c5a8207cb1a8f4f73c96c982dc94998dd Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-callbacks.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-display-methods.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-display-methods.go new file mode 100644 index 0000000000000000000000000000000000000000..556c30b30f5bca87e6d88d04770f0078115534ec Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-display-methods.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-properties.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-properties.go new file mode 100644 index 0000000000000000000000000000000000000000..4696035305f316642a62be6952a67ccd045e9fcf Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-properties.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-types.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-types.go new file mode 100644 index 0000000000000000000000000000000000000000..a00b13cb4a5c35f62e816b5f1203ca2850451b33 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-music-types.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-note-names.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-note-names.go new file mode 100644 index 0000000000000000000000000000000000000000..c79e1019a5e53e3aed1ece7eeb29865999bbe3b7 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-note-names.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-stencil-commands.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-stencil-commands.go new file mode 100644 index 0000000000000000000000000000000000000000..13ca79dc887ac544dbdd0281718944b5d795a3b2 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-stencil-commands.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-woodwind-diagrams.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-woodwind-diagrams.go new file mode 100644 index 0000000000000000000000000000000000000000..e7da151e485b9f709ef11b824b4ecdad6b318a2d Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/define-woodwind-diagrams.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/display-lily.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/display-lily.go new file mode 100644 index 0000000000000000000000000000000000000000..5bd380bd9dcad051ebbbdac090940d2838af54f5 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/display-lily.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/display-woodwind-diagrams.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/display-woodwind-diagrams.go new file mode 100644 index 0000000000000000000000000000000000000000..460784ccfa04576d4d703eb6d0eba03eabafe661 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/display-woodwind-diagrams.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/file-cache.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/file-cache.go new file mode 100644 index 0000000000000000000000000000000000000000..052b454be5ec00dd8a70328d9b808efd95d4366c Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/file-cache.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/flag-styles.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/flag-styles.go new file mode 100644 index 0000000000000000000000000000000000000000..7fa1c498e239cc0ef0aec688d66d04587fb34146 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/flag-styles.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/font-encodings.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/font-encodings.go new file mode 100644 index 0000000000000000000000000000000000000000..825c989540a5a15236795b85e29fdce7b8f4af7e Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/font-encodings.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/font.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/font.go new file mode 100644 index 0000000000000000000000000000000000000000..e51a40f8c9eb274958a05f8baf0652b46700d4f8 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/font.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-cairo.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-cairo.go new file mode 100644 index 0000000000000000000000000000000000000000..6c3b72cb2f399fe3a144b9785dfa915a133344a9 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-cairo.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-ps.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-ps.go new file mode 100644 index 0000000000000000000000000000000000000000..ef818bec18af160716afeeee0c27a380ac85892a Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-ps.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-svg.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-svg.go new file mode 100644 index 0000000000000000000000000000000000000000..f00fa63ca12558e797a028884e5d0a198169ca44 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/framework-svg.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/fret-diagrams.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/fret-diagrams.go new file mode 100644 index 0000000000000000000000000000000000000000..6b47df718eb2eedaaa9fb1a37204830847a00bf9 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/fret-diagrams.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/graphviz.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/graphviz.go new file mode 100644 index 0000000000000000000000000000000000000000..c5825d0ed0cacf10f5e588e250efc52412afa333 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/graphviz.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/harp-pedals.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/harp-pedals.go new file mode 100644 index 0000000000000000000000000000000000000000..e5e9b866001e6d5b8a12c26754fdd998ef3e2e2f Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/harp-pedals.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/layout-beam.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/layout-beam.go new file mode 100644 index 0000000000000000000000000000000000000000..17a86a9a911ea5e98c30f9a9de9f0b4a9d83bcdd Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/layout-beam.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/layout-slur.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/layout-slur.go new file mode 100644 index 0000000000000000000000000000000000000000..5d75522aca64a0e4eaf874b3129cf83ab7f68eb2 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/layout-slur.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/lily-library.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/lily-library.go new file mode 100644 index 0000000000000000000000000000000000000000..a5040da43171832c9df2e22122ccd0d90aedb665 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/lily-library.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/lily.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/lily.go new file mode 100644 index 0000000000000000000000000000000000000000..031c4b8973d79c377e10417f0b8f7f9fe360420e Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/lily.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/ly-syntax-constructors.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/ly-syntax-constructors.go new file mode 100644 index 0000000000000000000000000000000000000000..ad1ec9d26eae1e3c4005337bc2bf47b5297f15b4 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/ly-syntax-constructors.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/markup-macros.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/markup-macros.go new file mode 100644 index 0000000000000000000000000000000000000000..1412e5dfb5a069c4615c139859e1b74114e75b29 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/markup-macros.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/markup.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/markup.go new file mode 100644 index 0000000000000000000000000000000000000000..2d5eaafcf080e0aa232b962b3be37c4681f1ee5e Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/markup.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/midi.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/midi.go new file mode 100644 index 0000000000000000000000000000000000000000..5b8022056b8cd97aea566b0f43c715008d0f7e78 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/midi.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/modal-transforms.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/modal-transforms.go new file mode 100644 index 0000000000000000000000000000000000000000..2ef44a69600f29cc6a823b97356b4f84aa3aee2f Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/modal-transforms.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/music-functions.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/music-functions.go new file mode 100644 index 0000000000000000000000000000000000000000..1fdf7eab321367d018fbf73ba939acf52088ab16 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/music-functions.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-lib.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-lib.go new file mode 100644 index 0000000000000000000000000000000000000000..ac916ce068641e6dd71ebf0e13d85c89bd484b8b Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-lib.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-ps.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-ps.go new file mode 100644 index 0000000000000000000000000000000000000000..c95823f729378e2e0ddbe3132380a4bd593d517a Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-ps.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-svg.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-svg.go new file mode 100644 index 0000000000000000000000000000000000000000..fcadfdafba4ba2690da31243efa964f1fb1a9961 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/output-svg.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/page.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/page.go new file mode 100644 index 0000000000000000000000000000000000000000..cf3ab247ef5c2c773e4afac0c95f5cb72e585e66 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/page.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/paper-system.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/paper-system.go new file mode 100644 index 0000000000000000000000000000000000000000..81903c0e3f03a3378737e90bee49d084074a963a Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/paper-system.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/paper.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/paper.go new file mode 100644 index 0000000000000000000000000000000000000000..0544660f00007d29b4a3b6970627a533283e7271 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/paper.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/parser-clef.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/parser-clef.go new file mode 100644 index 0000000000000000000000000000000000000000..273e776e3d00d7d61bc133fe16b22d7daa59662c Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/parser-clef.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/parser-ly-from-scheme.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/parser-ly-from-scheme.go new file mode 100644 index 0000000000000000000000000000000000000000..147bc8196e09e3033c3d62d8780182732ed86d6b Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/parser-ly-from-scheme.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/part-combiner.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/part-combiner.go new file mode 100644 index 0000000000000000000000000000000000000000..4af2bfb88fdff99f90d262570a13b8d5186de919 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/part-combiner.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/predefined-fretboards.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/predefined-fretboards.go new file mode 100644 index 0000000000000000000000000000000000000000..518b86cbffb883108fd76ab3aa958833893e4f5b Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/predefined-fretboards.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/ps-to-png.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/ps-to-png.go new file mode 100644 index 0000000000000000000000000000000000000000..3e25f42637448a8f457b3b04a0958d30383cf4c4 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/ps-to-png.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/scheme-engravers.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/scheme-engravers.go new file mode 100644 index 0000000000000000000000000000000000000000..05887960434b7609354e868734dd6816220b65c8 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/scheme-engravers.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/scheme-performers.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/scheme-performers.go new file mode 100644 index 0000000000000000000000000000000000000000..0a4b06e3ed26e7153bbc02ed5012a6464d0439b5 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/scheme-performers.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/script.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/script.go new file mode 100644 index 0000000000000000000000000000000000000000..d0fabae8f2ba8a62e073a2f87d84c869d5ba714e Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/script.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/skyline.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/skyline.go new file mode 100644 index 0000000000000000000000000000000000000000..4c0ecc5d03a2366aec32d5c5b2395d32ebf06268 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/skyline.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/song-util.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/song-util.go new file mode 100644 index 0000000000000000000000000000000000000000..bbc98b125caf392b4397516fdd02b486cda73484 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/song-util.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/song.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/song.go new file mode 100644 index 0000000000000000000000000000000000000000..3bf7508721f0009ebed1295ece3af6c4319668c6 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/song.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/stencil.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/stencil.go new file mode 100644 index 0000000000000000000000000000000000000000..67b3e8d32c9c979c5945aef3d81eb7d118b0bed1 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/stencil.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/tablature.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/tablature.go new file mode 100644 index 0000000000000000000000000000000000000000..3752e404a69ae24097be909740b38de7ae8975f3 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/tablature.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/time-signature-settings.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/time-signature-settings.go new file mode 100644 index 0000000000000000000000000000000000000000..f4a21d485b971ed45edf874593ae12099a479aa7 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/time-signature-settings.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/time-signature.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/time-signature.go new file mode 100644 index 0000000000000000000000000000000000000000..8f6e5392b439d485dc8f57b431b7bc9e52e5087a Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/time-signature.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/titling.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/titling.go new file mode 100644 index 0000000000000000000000000000000000000000..23d03990836abdf947de41b1ae869dc227526b22 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/titling.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/to-xml.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/to-xml.go new file mode 100644 index 0000000000000000000000000000000000000000..58814d8f884f0369302cdc9d0cdec6df5269136d Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/to-xml.go differ diff --git a/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/translation-functions.go b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/translation-functions.go new file mode 100644 index 0000000000000000000000000000000000000000..a39e993ccbf7dd8ad5a6e49ec0030ba5c2fec079 Binary files /dev/null and b/lilypond-2.24.2/lib/lilypond/2.24.2/ccache/lily/translation-functions.go differ diff --git a/lilypond-2.24.2/libexec/gs.exe b/lilypond-2.24.2/libexec/gs.exe new file mode 100644 index 0000000000000000000000000000000000000000..6fb46c0996553e68a8f301d0b8a85ae97b1105be --- /dev/null +++ b/lilypond-2.24.2/libexec/gs.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:deb706b1058757645a9ee49a52f4d1d79ddd3c88666f560bfac78af796c0bcc2 +size 18593280 diff --git a/lilypond-2.24.2/licenses/cairo-1.16.0.COPYING b/lilypond-2.24.2/licenses/cairo-1.16.0.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..f54969f1c9472aba9004394e46fa4355aa4d77a7 --- /dev/null +++ b/lilypond-2.24.2/licenses/cairo-1.16.0.COPYING @@ -0,0 +1,33 @@ +Cairo is free software. + +Every source file in the implementation[*] of cairo is available to be +redistributed and/or modified under the terms of either the GNU Lesser +General Public License (LGPL) version 2.1 or the Mozilla Public +License (MPL) version 1.1. Some files are available under more +liberal terms, but we believe that in all cases, each file may be used +under either the LGPL or the MPL. + +See the following files in this directory for the precise terms and +conditions of either license: + + COPYING-LGPL-2.1 + COPYING-MPL-1.1 + +Please see each file in the implementation for copyright and licensing +information, (in the opening comment of each file). + +[*] The implementation of cairo is contained entirely within the "src" +directory of the cairo source distribution. There are other components +of the cairo source distribution (such as the "test", "util", and "perf") +that are auxiliary to the library itself. None of the source code in these +directories contributes to a build of the cairo library itself, (libcairo.so +or cairo.dll or similar). + +These auxiliary components are also free software, but may be under +different license terms than cairo itself. For example, most of the +test cases in the perf and test directories are made available under +an MIT license to simplify any use of this code for reference purposes +in using cairo itself. Other files might be available under the GNU +General Public License (GPL), for example. Again, please see the COPYING +file under each directory and the opening comment of each file for copyright +and licensing information. diff --git a/lilypond-2.24.2/licenses/expat-2.4.9.COPYING b/lilypond-2.24.2/licenses/expat-2.4.9.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..ce9e5939291e45f9633f540efc6ae58a26c041ef --- /dev/null +++ b/lilypond-2.24.2/licenses/expat-2.4.9.COPYING @@ -0,0 +1,21 @@ +Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper +Copyright (c) 2001-2022 Expat maintainers + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lilypond-2.24.2/licenses/fontconfig-2.14.2.COPYING b/lilypond-2.24.2/licenses/fontconfig-2.14.2.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..cd5fca1a03b03a815bfb8c4e8ea40a022b38507d --- /dev/null +++ b/lilypond-2.24.2/licenses/fontconfig-2.14.2.COPYING @@ -0,0 +1,200 @@ +fontconfig/COPYING + +Copyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard +Copyright © 2005 Patrick Lam +Copyright © 2007 Dwayne Bailey and Translate.org.za +Copyright © 2009 Roozbeh Pournader +Copyright © 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 Red Hat, Inc. +Copyright © 2008 Danilo Šegan +Copyright © 2012 Google, Inc. + + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of the author(s) not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. The authors make no +representations about the suitability of this software for any purpose. It +is provided "as is" without express or implied warranty. + +THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + + +-------------------------------------------------------------------------------- +fontconfig/fc-case/CaseFolding.txt + +© 2019 Unicode®, Inc. +Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. +For terms of use, see http://www.unicode.org/terms_of_use.html + + +-------------------------------------------------------------------------------- +fontconfig/src/fcatomic.h + +/* + * Mutex operations. Originally copied from HarfBuzz. + * + * Copyright © 2007 Chris Wilson + * Copyright © 2009,2010 Red Hat, Inc. + * Copyright © 2011,2012,2013 Google, Inc. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Contributor(s): + * Chris Wilson + * Red Hat Author(s): Behdad Esfahbod + * Google Author(s): Behdad Esfahbod + */ + + +-------------------------------------------------------------------------------- +fontconfig/src/fcfoundry.h + +/* + Copyright © 2002-2003 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + + +-------------------------------------------------------------------------------- +fontconfig/src/fcmd5.h + +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ + + +-------------------------------------------------------------------------------- +fontconfig/src/fcmutex.h + +/* + * Atomic int and pointer operations. Originally copied from HarfBuzz. + * + * Copyright © 2007 Chris Wilson + * Copyright © 2009,2010 Red Hat, Inc. + * Copyright © 2011,2012,2013 Google, Inc. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Contributor(s): + * Chris Wilson + * Red Hat Author(s): Behdad Esfahbod + * Google Author(s): Behdad Esfahbod + */ + + +-------------------------------------------------------------------------------- +fontconfig/src/ftglue.[ch] + +/* ftglue.c: Glue code for compiling the OpenType code from + * FreeType 1 using only the public API of FreeType 2 + * + * By David Turner, The FreeType Project (www.freetype.org) + * + * This code is explicitely put in the public domain + * + * ========================================================================== + * + * the OpenType parser codes was originally written as an extension to + * FreeType 1.x. As such, its source code was embedded within the library, + * and used many internal FreeType functions to deal with memory and + * stream i/o. + * + * When it was 'salvaged' for Pango and Qt, the code was "ported" to FreeType 2, + * which basically means that some macro tricks were performed in order to + * directly access FT2 _internal_ functions. + * + * these functions were never part of FT2 public API, and _did_ change between + * various releases. This created chaos for many users: when they upgraded the + * FreeType library on their system, they couldn't run Gnome anymore since + * Pango refused to link. + * + * Very fortunately, it's possible to completely avoid this problem because + * the FT_StreamRec and FT_MemoryRec structure types, which describe how + * memory and stream implementations interface with the rest of the font + * library, have always been part of the public API, and never changed. + * + * What we do thus is re-implement, within the OpenType parser, the few + * functions that depend on them. This only adds one or two kilobytes of + * code, and ensures that the parser can work with _any_ version + * of FreeType installed on your system. How sweet... ! + * + * Note that we assume that Pango doesn't use any other internal functions + * from FreeType. It used to in old versions, but this should no longer + * be the case. (crossing my fingers). + * + * - David Turner + * - The FreeType Project (www.freetype.org) + * + * PS: This "glue" code is explicitely put in the public domain + */ diff --git a/lilypond-2.24.2/licenses/freetype-2.12.1.GPLv2.TXT b/lilypond-2.24.2/licenses/freetype-2.12.1.GPLv2.TXT new file mode 100644 index 0000000000000000000000000000000000000000..b2fe7b6af3535ebc1e018dd2fe6c993330c031fa --- /dev/null +++ b/lilypond-2.24.2/licenses/freetype-2.12.1.GPLv2.TXT @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/lilypond-2.24.2/licenses/freetype-2.12.1.LICENSE.TXT b/lilypond-2.24.2/licenses/freetype-2.12.1.LICENSE.TXT new file mode 100644 index 0000000000000000000000000000000000000000..b1def65dd62e60f82f1fea8681ac659bf45e4669 --- /dev/null +++ b/lilypond-2.24.2/licenses/freetype-2.12.1.LICENSE.TXT @@ -0,0 +1,42 @@ +FREETYPE LICENSES +----------------- + +The FreeType 2 font engine is copyrighted work and cannot be used +legally without a software license. In order to make this project +usable to a vast majority of developers, we distribute it under two +mutually exclusive open-source licenses. + +This means that *you* must choose *one* of the two licenses described +below, then obey all its terms and conditions when using FreeType 2 in +any of your projects or products. + + - The FreeType License, found in the file `docs/FTL.TXT`, which is + similar to the original BSD license *with* an advertising clause + that forces you to explicitly cite the FreeType project in your + product's documentation. All details are in the license file. + This license is suited to products which don't use the GNU General + Public License. + + Note that this license is compatible to the GNU General Public + License version 3, but not version 2. + + - The GNU General Public License version 2, found in + `docs/GPLv2.TXT` (any later version can be used also), for + programs which already use the GPL. Note that the FTL is + incompatible with GPLv2 due to its advertisement clause. + +The contributed BDF and PCF drivers come with a license similar to +that of the X Window System. It is compatible to the above two +licenses (see files `src/bdf/README` and `src/pcf/README`). The same +holds for the source code files `src/base/fthash.c` and +`include/freetype/internal/fthash.h`; they wer part of the BDF driver +in earlier FreeType versions. + +The gzip module uses the zlib license (see `src/gzip/zlib.h`) which +too is compatible to the above two licenses. + +The MD5 checksum support (only used for debugging in development +builds) is in the public domain. + + +--- end of LICENSE.TXT --- diff --git a/lilypond-2.24.2/licenses/fribidi-1.0.12.COPYING b/lilypond-2.24.2/licenses/fribidi-1.0.12.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..ae23fcfda2da8599b52baff4c257847205d78c56 --- /dev/null +++ b/lilypond-2.24.2/licenses/fribidi-1.0.12.COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/lilypond-2.24.2/licenses/gc-8.2.4.README b/lilypond-2.24.2/licenses/gc-8.2.4.README new file mode 100644 index 0000000000000000000000000000000000000000..eb1017834afadaa712e81ee97e834dbdb660d847 --- /dev/null +++ b/lilypond-2.24.2/licenses/gc-8.2.4.README @@ -0,0 +1,48 @@ + * Copyright (c) 1988, 1989 Hans-J. Boehm, Alan J. Demers + * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved. + * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. + * Copyright (c) 1999-2011 by Hewlett-Packard Development Company. + * Copyright (c) 2008-2021 Ivan Maidanski + +The files pthread_stop_world.c, pthread_support.c and some others are also + + * Copyright (c) 1998 by Fergus Henderson. All rights reserved. + +The file include/gc.h is also + + * Copyright (c) 2007 Free Software Foundation, Inc + +The files Makefile.am and configure.ac are + + * Copyright (c) 2001 by Red Hat Inc. All rights reserved. + +The files extra/msvc_dbg.c and include/private/msvc_dbg.h are + + * Copyright (c) 2004-2005 Andrei Polushin + +The file tests/initsecondarythread.c is + + * Copyright (c) 2011 Ludovic Courtes + +The file tests/disclaim_weakmap_test.c is + + * Copyright (c) 2018 Petter A. Urkedal + +Several files supporting GNU-style builds are copyrighted by the Free +Software Foundation, and carry a different license from that given +below. + +THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED +OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + +Permission is hereby granted to use or copy this program +for any purpose, provided the above notices are retained on all copies. +Permission to modify the code and to distribute modified code is granted, +provided the above notices are retained, and a notice that the code was +modified is included with the above copyright notice. + +A few of the files needed to use the GNU-style build procedure come with +slightly different licenses, though they are all similar in spirit. A few +are GPL'ed, but with an exception that should cover all uses in the +collector. (If you are concerned about such things, I recommend you look +at the notice in config.guess or ltmain.sh.) diff --git a/lilypond-2.24.2/licenses/gettext-0.21.1.COPYING b/lilypond-2.24.2/licenses/gettext-0.21.1.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..9045d4cd3fdc2f192776f6663ff5411ded29f8a1 --- /dev/null +++ b/lilypond-2.24.2/licenses/gettext-0.21.1.COPYING @@ -0,0 +1,13 @@ +The gettext-runtime package is partially under the LGPL and partially under +the GPL. + +The following parts are under the LGPL, see file intl/COPYING.LIB: + - the libintl and libasprintf libraries and their header files, + - the libintl.jar Java library, + - the GNU.Gettext.dll C# library, + - the gettext.sh shells script function library. + +The following parts are under the GPL, see file COPYING in the toplevel +directory: + - the _programs_ gettext, ngettext, envsubst, + - the documentation. diff --git a/lilypond-2.24.2/licenses/gettext-0.21.1.COPYING.LIB b/lilypond-2.24.2/licenses/gettext-0.21.1.COPYING.LIB new file mode 100644 index 0000000000000000000000000000000000000000..c2c87d69256345eb6a287aaac5645fc6185ea885 --- /dev/null +++ b/lilypond-2.24.2/licenses/gettext-0.21.1.COPYING.LIB @@ -0,0 +1,516 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. +^L + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. +^L + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. +^L + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. +^L + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. +^L + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. +^L + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. +^L + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS +^L + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. + + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA + +Also add information on how to contact you by electronic and paper +mail. + +You should also get your employer (if you work as a programmer) or +your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James +Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/lilypond-2.24.2/licenses/ghostscript-9.56.1.COPYING b/lilypond-2.24.2/licenses/ghostscript-9.56.1.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..dba13ed2ddf783ee8118c6a581dbf75305f816a3 --- /dev/null +++ b/lilypond-2.24.2/licenses/ghostscript-9.56.1.COPYING @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/lilypond-2.24.2/licenses/ghostscript-9.56.1.LICENSE b/lilypond-2.24.2/licenses/ghostscript-9.56.1.LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..52e83a2ac365dba3fb6aa5b677625504fa3004ae --- /dev/null +++ b/lilypond-2.24.2/licenses/ghostscript-9.56.1.LICENSE @@ -0,0 +1,41 @@ +The files in the base, psi, lib, toolbin, examples, doc, man and +iccprofiles directories (folders), and pcl, xps and gpdl +directories (folders), if included, and any subdirectories +(sub-folders) thereof are part of GPL Ghostscript. + +The files in the Resource directory and any subdirectories thereof +are also part of GPL Ghostscript, with the explicit exception of +the files in the CMap subdirectory (except "Identity-UTF16-H", +which is part of GPL Ghostscript). The CMap files are copyright +Adobe Systems Incorporated and covered by a separate, Affero GPL +compatible license. + +Additionally, the font files (in Resource/Font) are distributed +under the AGPL with the following exemption: + +As a special exception, permission is granted to include these font +programs in a Postscript or PDF file that consists of a document that +contains text to be displayed or printed using this font, regardless +of the conditions or license applying to the document itself. + + +The files under the jpegxr directory and any subdirectories +thereof are distributed under a no cost, open source license +granted by the ITU/ISO/IEC but it is not Affero GPL +compatible - see jpegxr/COPYRIGHT.txt for details. + +GPL Ghostscript is free software; you can redistribute it and/or +modify it under the terms of the GNU Affero General Public License +as published by the Free Software Foundation, either version 3 +of the License, or (at your option) any later version. + +GPL Ghostscript is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public +License along with this program so you can know your rights and +responsibilities. It should be in a file named doc/COPYING. If not, +write to the Free Software Foundation, Inc., 59 Temple Place Suite +330, Boston, MA 02111-1307, USA. diff --git a/lilypond-2.24.2/licenses/glib-2.72.4.COPYING b/lilypond-2.24.2/licenses/glib-2.72.4.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..4362b49151d7b34ef83b3067a8f9c9f877d72a0e --- /dev/null +++ b/lilypond-2.24.2/licenses/glib-2.72.4.COPYING @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/lilypond-2.24.2/licenses/gmp-6.2.1.COPYING.LESSERv3 b/lilypond-2.24.2/licenses/gmp-6.2.1.COPYING.LESSERv3 new file mode 100644 index 0000000000000000000000000000000000000000..fc8a5de7edf437cdc98a216370faf7c757279bcb --- /dev/null +++ b/lilypond-2.24.2/licenses/gmp-6.2.1.COPYING.LESSERv3 @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/lilypond-2.24.2/licenses/gmp-6.2.1.README b/lilypond-2.24.2/licenses/gmp-6.2.1.README new file mode 100644 index 0000000000000000000000000000000000000000..1946c6e493d9108553d49b301ce41f6c48924d38 --- /dev/null +++ b/lilypond-2.24.2/licenses/gmp-6.2.1.README @@ -0,0 +1,27 @@ +Copyright 1991, 1996, 1999, 2000, 2007 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + +or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + +or both in parallel, as here. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received copies of the GNU General Public License and the +GNU Lesser General Public License along with the GNU MP Library. If not, +see https://www.gnu.org/licenses/. diff --git a/lilypond-2.24.2/licenses/guile-2.2.7.COPYING.LESSER b/lilypond-2.24.2/licenses/guile-2.2.7.COPYING.LESSER new file mode 100644 index 0000000000000000000000000000000000000000..cca7fc278f5c81ce23a2687208f0d63a6ea44009 --- /dev/null +++ b/lilypond-2.24.2/licenses/guile-2.2.7.COPYING.LESSER @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/lilypond-2.24.2/licenses/guile-2.2.7.LICENSE b/lilypond-2.24.2/licenses/guile-2.2.7.LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..3961579b8240cda85feab9e392d234febe3157f9 --- /dev/null +++ b/lilypond-2.24.2/licenses/guile-2.2.7.LICENSE @@ -0,0 +1,2 @@ +Guile is covered under the terms of the GNU Lesser General Public +License, version 3 or later. See COPYING.LESSER and COPYING. diff --git a/lilypond-2.24.2/licenses/harfbuzz-4.4.1.COPYING b/lilypond-2.24.2/licenses/harfbuzz-4.4.1.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..48d1b30f90dc3c3d72e0293d60a313f7b046ee24 --- /dev/null +++ b/lilypond-2.24.2/licenses/harfbuzz-4.4.1.COPYING @@ -0,0 +1,38 @@ +HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. +For parts of HarfBuzz that are licensed under different licenses see individual +files names COPYING in subdirectories where applicable. + +Copyright © 2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 Google, Inc. +Copyright © 2018,2019,2020 Ebrahim Byagowi +Copyright © 2019,2020 Facebook, Inc. +Copyright © 2012 Mozilla Foundation +Copyright © 2011 Codethink Limited +Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies) +Copyright © 2009 Keith Stribley +Copyright © 2009 Martin Hosken and SIL International +Copyright © 2007 Chris Wilson +Copyright © 2005,2006,2020,2021 Behdad Esfahbod +Copyright © 2005 David Turner +Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc. +Copyright © 1998-2004 David Turner and Werner Lemberg + +For full copyright notices consult the individual files in the package. + + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. diff --git a/lilypond-2.24.2/licenses/libffi-3.4.3.LICENSE b/lilypond-2.24.2/licenses/libffi-3.4.3.LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..75d1bce11f9118ccfd96b24a2e49af078da1b469 --- /dev/null +++ b/lilypond-2.24.2/licenses/libffi-3.4.3.LICENSE @@ -0,0 +1,21 @@ +libffi - Copyright (c) 1996-2022 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lilypond-2.24.2/licenses/libiconv-1.17.COPYING b/lilypond-2.24.2/licenses/libiconv-1.17.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..94a9ed024d3859793618152ea559a168bbcbb5e2 --- /dev/null +++ b/lilypond-2.24.2/licenses/libiconv-1.17.COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/lilypond-2.24.2/licenses/libpng-1.6.38.LICENSE b/lilypond-2.24.2/licenses/libpng-1.6.38.LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..c8ad24eecf7a825b035c761e4bfca9acaa36864c --- /dev/null +++ b/lilypond-2.24.2/licenses/libpng-1.6.38.LICENSE @@ -0,0 +1,134 @@ +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= + +PNG Reference Library License version 2 +--------------------------------------- + + * Copyright (c) 1995-2022 The PNG Reference Library Authors. + * Copyright (c) 2018-2022 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no event shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. + +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- + +libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are +Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are +derived from libpng-1.0.6, and are distributed according to the same +disclaimer and license as libpng-1.0.6 with the following individuals +added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. + +Some files in the "contrib" directory and some configure-generated +files that are distributed with libpng have other copyright owners, and +are released under other open source licenses. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from +libpng-0.96, and are distributed according to the same disclaimer and +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, +and are distributed according to the same disclaimer and license as +libpng-0.88, with the following individuals added to the list of +Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +Some files in the "scripts" directory have other copyright owners, +but are released under this license. + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + + 1. The origin of this source code must not be misrepresented. + + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. diff --git a/lilypond-2.24.2/licenses/libtool-2.4.7.COPYING b/lilypond-2.24.2/licenses/libtool-2.4.7.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..d159169d1050894d3ea3b98e1c965c4058208fe1 --- /dev/null +++ b/lilypond-2.24.2/licenses/libtool-2.4.7.COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/lilypond-2.24.2/licenses/libunistring-1.0.COPYING.LIB b/lilypond-2.24.2/licenses/libunistring-1.0.COPYING.LIB new file mode 100644 index 0000000000000000000000000000000000000000..fc8a5de7edf437cdc98a216370faf7c757279bcb --- /dev/null +++ b/lilypond-2.24.2/licenses/libunistring-1.0.COPYING.LIB @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/lilypond-2.24.2/licenses/libunistring-1.0.README b/lilypond-2.24.2/licenses/libunistring-1.0.README new file mode 100644 index 0000000000000000000000000000000000000000..5424bd9a94b745defbb8c445b7dc2f61933fc3fb --- /dev/null +++ b/lilypond-2.24.2/licenses/libunistring-1.0.README @@ -0,0 +1,16 @@ +The libunistring library and its header files are dual-licensed under +"the GNU LGPLv3+ or the GNU GPLv2+". This means, you can use it under either + - the terms of the GNU Lesser General Public License (LGPL) version 3 or + (at your option) any later version, or + - the terms of the GNU General Public License (GPL) version 2 or + (at your option) any later version, or + - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+". + +You find the GNU LGPL version 3 in the file COPYING.LIB. This license is +based on the GNU GPL version 3, see file COPYING. + +You can find the GNU GPL version 2 at +. + +Note: This dual license makes it possible for the libunistring library +to be used by packages under GPLv2 or GPLv2+ licenses, in particular. See diff --git a/lilypond-2.24.2/licenses/lilypond-2.24.2.COPYING b/lilypond-2.24.2/licenses/lilypond-2.24.2.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..94a9ed024d3859793618152ea559a168bbcbb5e2 --- /dev/null +++ b/lilypond-2.24.2/licenses/lilypond-2.24.2.COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/lilypond-2.24.2/licenses/pango-1.50.11.COPYING b/lilypond-2.24.2/licenses/pango-1.50.11.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..bf50f20de6ef55b52fe7832d3a4ed05f0c69d452 --- /dev/null +++ b/lilypond-2.24.2/licenses/pango-1.50.11.COPYING @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307 USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/lilypond-2.24.2/licenses/pcre-8.45.LICENCE b/lilypond-2.24.2/licenses/pcre-8.45.LICENCE new file mode 100644 index 0000000000000000000000000000000000000000..803b4119e50fb5f4ce36949e855e5daeef453cc0 --- /dev/null +++ b/lilypond-2.24.2/licenses/pcre-8.45.LICENCE @@ -0,0 +1,93 @@ +PCRE LICENCE +------------ + +PCRE is a library of functions to support regular expressions whose syntax +and semantics are as close as possible to those of the Perl 5 language. + +Release 8 of PCRE is distributed under the terms of the "BSD" licence, as +specified below. The documentation for PCRE, supplied in the "doc" +directory, is distributed under the same terms as the software itself. The data +in the testdata directory is not copyrighted and is in the public domain. + +The basic library functions are written in C and are freestanding. Also +included in the distribution is a set of C++ wrapper functions, and a +just-in-time compiler that can be used to optimize pattern matching. These +are both optional features that can be omitted when the library is built. + + +THE BASIC LIBRARY FUNCTIONS +--------------------------- + +Written by: Philip Hazel +Email local part: Philip.Hazel +Email domain: gmail.com + +University of Cambridge Computing Service, +Cambridge, England. + +Copyright (c) 1997-2021 University of Cambridge +All rights reserved. + + +PCRE JUST-IN-TIME COMPILATION SUPPORT +------------------------------------- + +Written by: Zoltan Herczeg +Email local part: hzmester +Email domain: freemail.hu + +Copyright(c) 2010-2021 Zoltan Herczeg +All rights reserved. + + +STACK-LESS JUST-IN-TIME COMPILER +-------------------------------- + +Written by: Zoltan Herczeg +Email local part: hzmester +Email domain: freemail.hu + +Copyright(c) 2009-2021 Zoltan Herczeg +All rights reserved. + + +THE C++ WRAPPER FUNCTIONS +------------------------- + +Contributed by: Google Inc. + +Copyright (c) 2007-2012, Google Inc. +All rights reserved. + + +THE "BSD" LICENCE +----------------- + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the University of Cambridge nor the name of Google + Inc. nor the names of their contributors may be used to endorse or + promote products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +End diff --git a/lilypond-2.24.2/licenses/pixman-0.40.0.COPYING b/lilypond-2.24.2/licenses/pixman-0.40.0.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..6168dea56f386e79f99313c26fb0ab320e992854 --- /dev/null +++ b/lilypond-2.24.2/licenses/pixman-0.40.0.COPYING @@ -0,0 +1,42 @@ +The following is the MIT license, agreed upon by most contributors. +Copyright holders of new code should use this license statement where +possible. They may also add themselves to the list below. + +/* + * Copyright 1987, 1988, 1989, 1998 The Open Group + * Copyright 1987, 1988, 1989 Digital Equipment Corporation + * Copyright 1999, 2004, 2008 Keith Packard + * Copyright 2000 SuSE, Inc. + * Copyright 2000 Keith Packard, member of The XFree86 Project, Inc. + * Copyright 2004, 2005, 2007, 2008, 2009, 2010 Red Hat, Inc. + * Copyright 2004 Nicholas Miell + * Copyright 2005 Lars Knoll & Zack Rusin, Trolltech + * Copyright 2005 Trolltech AS + * Copyright 2007 Luca Barbato + * Copyright 2008 Aaron Plattner, NVIDIA Corporation + * Copyright 2008 Rodrigo Kumpera + * Copyright 2008 André Tupinambá + * Copyright 2008 Mozilla Corporation + * Copyright 2008 Frederic Plourde + * Copyright 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright 2009, 2010 Nokia Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ diff --git a/lilypond-2.24.2/licenses/python-3.10.8-embed-amd64.LICENSE.txt b/lilypond-2.24.2/licenses/python-3.10.8-embed-amd64.LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..4662ad70b74bec0d4530ca6ce00faf2e4af27523 --- /dev/null +++ b/lilypond-2.24.2/licenses/python-3.10.8-embed-amd64.LICENSE.txt @@ -0,0 +1,650 @@ +A. HISTORY OF THE SOFTWARE +========================== + +Python was created in the early 1990s by Guido van Rossum at Stichting +Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands +as a successor of a language called ABC. Guido remains Python's +principal author, although it includes many contributions from others. + +In 1995, Guido continued his work on Python at the Corporation for +National Research Initiatives (CNRI, see https://www.cnri.reston.va.us) +in Reston, Virginia where he released several versions of the +software. + +In May 2000, Guido and the Python core development team moved to +BeOpen.com to form the BeOpen PythonLabs team. In October of the same +year, the PythonLabs team moved to Digital Creations, which became +Zope Corporation. In 2001, the Python Software Foundation (PSF, see +https://www.python.org/psf/) was formed, a non-profit organization +created specifically to own Python-related Intellectual Property. +Zope Corporation was a sponsoring member of the PSF. + +All Python releases are Open Source (see https://opensource.org for +the Open Source Definition). Historically, most, but not all, Python +releases have also been GPL-compatible; the table below summarizes +the various releases. + + Release Derived Year Owner GPL- + from compatible? (1) + + 0.9.0 thru 1.2 1991-1995 CWI yes + 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes + 1.6 1.5.2 2000 CNRI no + 2.0 1.6 2000 BeOpen.com no + 1.6.1 1.6 2001 CNRI yes (2) + 2.1 2.0+1.6.1 2001 PSF no + 2.0.1 2.0+1.6.1 2001 PSF yes + 2.1.1 2.1+2.0.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes + 2.2 and above 2.1.1 2001-now PSF yes + +Footnotes: + +(1) GPL-compatible doesn't mean that we're distributing Python under + the GPL. All Python licenses, unlike the GPL, let you distribute + a modified version without making your changes open source. The + GPL-compatible licenses make it possible to combine Python with + other software that is released under the GPL; the others don't. + +(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, + because its license has a choice of law clause. According to + CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 + is "not incompatible" with the GPL. + +Thanks to the many outside volunteers who have worked under Guido's +direction to make these releases possible. + + +B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON +=============================================================== + +Python software and documentation are licensed under the +Python Software Foundation License Version 2. + +Starting with Python 3.8.6, examples, recipes, and other code in +the documentation are dual licensed under the PSF License Version 2 +and the Zero-Clause BSD license. + +Some software incorporated into Python is under different licenses. +The licenses are listed with code falling under that license. + + +PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 +-------------------------------------------- + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using this software ("Python") in source or binary form and +its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF hereby +grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, +analyze, test, perform and/or display publicly, prepare derivative works, +distribute, and otherwise use Python alone or in any derivative version, +provided, however, that PSF's License Agreement and PSF's notice of copyright, +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Python Software Foundation; +All Rights Reserved" are retained in Python alone or in any derivative version +prepared by Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python. + +4. PSF is making Python available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 +------------------------------------------- + +BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 + +1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an +office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the +Individual or Organization ("Licensee") accessing and otherwise using +this software in source or binary form and its associated +documentation ("the Software"). + +2. Subject to the terms and conditions of this BeOpen Python License +Agreement, BeOpen hereby grants Licensee a non-exclusive, +royalty-free, world-wide license to reproduce, analyze, test, perform +and/or display publicly, prepare derivative works, distribute, and +otherwise use the Software alone or in any derivative version, +provided, however, that the BeOpen Python License is retained in the +Software, alone or in any derivative version prepared by Licensee. + +3. BeOpen is making the Software available to Licensee on an "AS IS" +basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE +SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS +AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY +DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +5. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +6. This License Agreement shall be governed by and interpreted in all +respects by the law of the State of California, excluding conflict of +law provisions. Nothing in this License Agreement shall be deemed to +create any relationship of agency, partnership, or joint venture +between BeOpen and Licensee. This License Agreement does not grant +permission to use BeOpen trademarks or trade names in a trademark +sense to endorse or promote products or services of Licensee, or any +third party. As an exception, the "BeOpen Python" logos available at +http://www.pythonlabs.com/logos.html may be used according to the +permissions granted on that web page. + +7. By copying, installing or otherwise using the software, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 +--------------------------------------- + +1. This LICENSE AGREEMENT is between the Corporation for National +Research Initiatives, having an office at 1895 Preston White Drive, +Reston, VA 20191 ("CNRI"), and the Individual or Organization +("Licensee") accessing and otherwise using Python 1.6.1 software in +source or binary form and its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, CNRI +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 1.6.1 +alone or in any derivative version, provided, however, that CNRI's +License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) +1995-2001 Corporation for National Research Initiatives; All Rights +Reserved" are retained in Python 1.6.1 alone or in any derivative +version prepared by Licensee. Alternately, in lieu of CNRI's License +Agreement, Licensee may substitute the following text (omitting the +quotes): "Python 1.6.1 is made available subject to the terms and +conditions in CNRI's License Agreement. This Agreement together with +Python 1.6.1 may be located on the internet using the following +unique, persistent identifier (known as a handle): 1895.22/1013. This +Agreement may also be obtained from a proxy server on the internet +using the following URL: http://hdl.handle.net/1895.22/1013". + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 1.6.1 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 1.6.1. + +4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" +basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. This License Agreement shall be governed by the federal +intellectual property law of the United States, including without +limitation the federal copyright law, and, to the extent such +U.S. federal law does not apply, by the law of the Commonwealth of +Virginia, excluding Virginia's conflict of law provisions. +Notwithstanding the foregoing, with regard to derivative works based +on Python 1.6.1 that incorporate non-separable material that was +previously distributed under the GNU General Public License (GPL), the +law of the Commonwealth of Virginia shall govern this License +Agreement only as to issues arising under or with respect to +Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this +License Agreement shall be deemed to create any relationship of +agency, partnership, or joint venture between CNRI and Licensee. This +License Agreement does not grant permission to use CNRI trademarks or +trade name in a trademark sense to endorse or promote products or +services of Licensee, or any third party. + +8. By clicking on the "ACCEPT" button where indicated, or by copying, +installing or otherwise using Python 1.6.1, Licensee agrees to be +bound by the terms and conditions of this License Agreement. + + ACCEPT + + +CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 +-------------------------------------------------- + +Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, +The Netherlands. All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION +---------------------------------------------------------------------- + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + + + +Additional Conditions for this Windows binary build +--------------------------------------------------- + +This program is linked with and uses Microsoft Distributable Code, +copyrighted by Microsoft Corporation. The Microsoft Distributable Code +is embedded in each .exe, .dll and .pyd file as a result of running +the code through a linker. + +If you further distribute programs that include the Microsoft +Distributable Code, you must comply with the restrictions on +distribution specified by Microsoft. In particular, you must require +distributors and external end users to agree to terms that protect the +Microsoft Distributable Code at least as much as Microsoft's own +requirements for the Distributable Code. See Microsoft's documentation +(included in its developer tools and on its website at microsoft.com) +for specific details. + +Redistribution of the Windows binary build of the Python interpreter +complies with this agreement, provided that you do not: + +- alter any copyright, trademark or patent notice in Microsoft's +Distributable Code; + +- use Microsoft's trademarks in your programs' names or in a way that +suggests your programs come from or are endorsed by Microsoft; + +- distribute Microsoft's Distributable Code to run on a platform other +than Microsoft operating systems, run-time technologies or application +platforms; or + +- include Microsoft Distributable Code in malicious, deceptive or +unlawful programs. + +These restrictions apply only to the Microsoft Distributable Code as +defined above, not to Python itself or any programs running on the +Python interpreter. The redistribution of the Python interpreter and +libraries is governed by the Python Software License included with this +file, or by other licenses as marked. + + + +-------------------------------------------------------------------------- + +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2019 Julian R Seward. All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward@acm.org +bzip2/libbzip2 version 1.0.8 of 13 July 2019 + +-------------------------------------------------------------------------- + + + LICENSE ISSUES + ============== + + The OpenSSL toolkit stays under a double license, i.e. both the conditions of + the OpenSSL License and the original SSLeay license apply to the toolkit. + See below for the actual license texts. + + OpenSSL License + --------------- + +/* ==================================================================== + * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + + Original SSLeay License + ----------------------- + +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + + +libffi - Copyright (c) 1996-2014 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +This software is copyrighted by the Regents of the University of +California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState +Corporation and other parties. The following terms apply to all files +associated with the software unless explicitly disclaimed in +individual files. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. + +GOVERNMENT USE: If you are acquiring this software on behalf of the +U.S. government, the Government shall have only "Restricted Rights" +in the software and related documentation as defined in the Federal +Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you +are acquiring the software on behalf of the Department of Defense, the +software shall be classified as "Commercial Computer Software" and the +Government shall have only "Restricted Rights" as defined in Clause +252.227-7014 (b) (3) of DFARs. Notwithstanding the foregoing, the +authors grant the U.S. Government and others acting in its behalf +permission to use and distribute the software in accordance with the +terms specified in this license. + +This software is copyrighted by the Regents of the University of +California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState +Corporation, Apple Inc. and other parties. The following terms apply to +all files associated with the software unless explicitly disclaimed in +individual files. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. + +GOVERNMENT USE: If you are acquiring this software on behalf of the +U.S. government, the Government shall have only "Restricted Rights" +in the software and related documentation as defined in the Federal +Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you +are acquiring the software on behalf of the Department of Defense, the +software shall be classified as "Commercial Computer Software" and the +Government shall have only "Restricted Rights" as defined in Clause +252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the +authors grant the U.S. Government and others acting in its behalf +permission to use and distribute the software in accordance with the +terms specified in this license. + +Copyright (c) 1993-1999 Ioi Kim Lam. +Copyright (c) 2000-2001 Tix Project Group. +Copyright (c) 2004 ActiveState + +This software is copyrighted by the above entities +and other parties. The following terms apply to all files associated +with the software unless explicitly disclaimed in individual files. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. + +GOVERNMENT USE: If you are acquiring this software on behalf of the +U.S. government, the Government shall have only "Restricted Rights" +in the software and related documentation as defined in the Federal +Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you +are acquiring the software on behalf of the Department of Defense, the +software shall be classified as "Commercial Computer Software" and the +Government shall have only "Restricted Rights" as defined in Clause +252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the +authors grant the U.S. Government and others acting in its behalf +permission to use and distribute the software in accordance with the +terms specified in this license. + +---------------------------------------------------------------------- + +Parts of this software are based on the Tcl/Tk software copyrighted by +the Regents of the University of California, Sun Microsystems, Inc., +and other parties. The original license terms of the Tcl/Tk software +distribution is included in the file docs/license.tcltk. + +Parts of this software are based on the HTML Library software +copyrighted by Sun Microsystems, Inc. The original license terms of +the HTML Library software distribution is included in the file +docs/license.html_lib. + diff --git a/lilypond-2.24.2/licenses/tg2_501otf.GUST-FONT-LICENSE.txt b/lilypond-2.24.2/licenses/tg2_501otf.GUST-FONT-LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..507a26d3b2bedefbd578e916cd4afb95cb1b3e30 --- /dev/null +++ b/lilypond-2.24.2/licenses/tg2_501otf.GUST-FONT-LICENSE.txt @@ -0,0 +1,29 @@ +% This is version 1.0, dated 22 June 2009, of the GUST Font License. +% (GUST is the Polish TeX Users Group, http://www.gust.org.pl) +% +% For the most recent version of this license see +% http://www.gust.org.pl/fonts/licenses/GUST-FONT-LICENSE.txt +% or +% http://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt +% +% This work may be distributed and/or modified under the conditions +% of the LaTeX Project Public License, either version 1.3c of this +% license or (at your option) any later version. +% +% Please also observe the following clause: +% 1) it is requested, but not legally required, that derived works be +% distributed only after changing the names of the fonts comprising this +% work and given in an accompanying "manifest", and that the +% files comprising the Work, as listed in the manifest, also be given +% new names. Any exceptions to this request are also given in the +% manifest. +% +% We recommend the manifest be given in a separate file named +% MANIFEST-.txt, where is some unique identification +% of the font family. If a separate "readme" file accompanies the Work, +% we recommend a name of the form README-.txt. +% +% The latest version of the LaTeX Project Public License is in +% http://www.latex-project.org/lppl.txt and version 1.3c or later +% is part of all distributions of LaTeX version 2006/05/20 or later. + diff --git a/lilypond-2.24.2/licenses/urw-base35-fonts-20200910.COPYING b/lilypond-2.24.2/licenses/urw-base35-fonts-20200910.COPYING new file mode 100644 index 0000000000000000000000000000000000000000..dba13ed2ddf783ee8118c6a581dbf75305f816a3 --- /dev/null +++ b/lilypond-2.24.2/licenses/urw-base35-fonts-20200910.COPYING @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/lilypond-2.24.2/licenses/urw-base35-fonts-20200910.LICENSE b/lilypond-2.24.2/licenses/urw-base35-fonts-20200910.LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..be2a63ec4dead6b480b6de5fac58c74f88629695 --- /dev/null +++ b/lilypond-2.24.2/licenses/urw-base35-fonts-20200910.LICENSE @@ -0,0 +1,9 @@ +The font and related files in this directory are distributed under the +GNU AFFERO GENERAL PUBLIC LICENSE Version 3 (see the file COPYING), with +the following exemption: + +As a special exception, permission is granted to include these font +programs in a Postscript or PDF file that consists of a document that +contains text to be displayed or printed using this font, regardless +of the conditions or license applying to the document itself. + diff --git a/lilypond-2.24.2/licenses/zlib-1.2.13.README b/lilypond-2.24.2/licenses/zlib-1.2.13.README new file mode 100644 index 0000000000000000000000000000000000000000..97daf56c24ce6cb78fc07fa7a029f17a7b6c2850 --- /dev/null +++ b/lilypond-2.24.2/licenses/zlib-1.2.13.README @@ -0,0 +1,38 @@ + zlib specifications were written by L. Peter Deutsch. Thanks to all the + people who reported problems and suggested various improvements in zlib; they + are too numerous to cite here. + +Copyright notice: + + (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. We make all +contributions to and distributions of this project solely in our personal +capacity, and are not conveying any rights to any intellectual property of +any third parties. + +If you redistribute modified sources, we would appreciate that you include in +the file ChangeLog history information documenting your changes. Please read +the FAQ for more information on the distribution of modified source versions. diff --git a/lilypond-2.24.2/share/emacs/site-lisp/lilypond-font-lock.el b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-font-lock.el new file mode 100644 index 0000000000000000000000000000000000000000..3beb20ff1a7814657da336cb2cf80cdf7970bf24 --- /dev/null +++ b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-font-lock.el @@ -0,0 +1,208 @@ +;;;; lilypond-font-lock.el --- syntax coloring for LilyPond mode +;;;; +;;;; This file is part of LilyPond, the GNU music typesetter. +;;;; +;;;; Copyright (C) 1997--2022 Han-Wen Nienhuys , +;;;; 2001--2006 Heikki Junes +;;;; +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. +;;;; +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . +;; +;; Author: 2001-2006: Heikki Junes +;; * Emacs-mode: new keywords, reserved words, identifiers, notenames, +;; some dynamics and brackets are font-lock-keywords +;; * context-dependent syntax-tables +;; Author: 1997: Han-Wen Nienhuys +;; Author: 1995-1996 Barry A. Warsaw +;; 1992-1994 Tim Peters +;; Created: Feb 1992 +;; Version: 2.9.29 +;; Last Modified: 11NOV2006 +;; Keywords: lilypond languages music notation + +;; This started out as a cannabalised version of python-mode.el, by hwn +;; For changes see the LilyPond ChangeLog +;; + +;; TODO: +;; - handle lexer modes (\header, \melodic) etc. + +(defconst LilyPond-font-lock-keywords + (let* ((kwregex (mapconcat (lambda (x) (concat "\\" x)) LilyPond-keywords "\\|")) + (iregex (mapconcat (lambda (x) (concat "\\" x)) LilyPond-identifiers "\\|")) + (ncrwregex (mapconcat (lambda (x) (concat "" x)) LilyPond-non-capitalized-reserved-words "\\|")) + (rwregex (mapconcat (lambda (x) (concat "" x)) LilyPond-Capitalized-Reserved-Words "\\|")) + (duration "\\([ \t]*\\(128\\|6?4\\|3?2\\|16?\\|8\\)[.]*\\([ \t]*[*][ \t]*[0-9]+\\(/[1-9][0-9]*\\)?\\)?\\)") + (longduration "\\([ \t]*\\(\\\\\\(longa\\|breve\\|maxima\\)\\)[.]*\\([ \t]*[*][ \t]*[0-9]+\\(/[1-9][0-9]*\\)?\\)?\\)") +) + + (list +;; Fonts in use (from GNU Emacs Lisp Reference Manual, elisp.ps): +;; font-lock- (c)omment / (s)tring / (k)eyword / (b)uiltin / (f)unction-name / +;; (v)ariable-name / (t)ype / co(n)stant / (w)arning -face + +;; The order below is designed so that proofreading would be possible. + +;; Fontify... +;; ... (f) identifiers and (k) keywords. +;; ... (n) user defined indetifiers +;; ... (v) the right and the left side of '='-marks. +;; ... (v) reserved words, e.g., FiguredBass. +;; ... (t) notes and rests +;; "on top", ... (s) lyrics-mode +;; "on top", ... (w) horizontal grouping +;; "on top", ... (f) vertical grouping +;; "on top", ... (b) expressional grouping +;; "on top", ... (s) (multiline-)scheme; urgh. one should count the slurs +;; "on top", ... (s) strings +;; "on top", ... (c) (multiline-)comments + +;; One should note 'font-lock-multiline' has been possible since Emacs 21.1. +;; See, e.g., text in "http://emacs.kldp.org/emacs-21.1/etc/NEWS". + +;; ... identifiers (defined above, see iregex) + (cons (concat "\\(\\([_^-]?\\(" iregex "\\)\\)+\\)\\($\\|[] \t(~{}>\\\\_()^*-]\\)") '(1 font-lock-function-name-face)) + +;; ... keywords (defined above, see kwregex) + (cons (concat "\\(\\([_^-]?\\(" kwregex "\\)\\)+\\)\\($\\|[] \t(~{}>\\\\_()^*-]\\)") '(1 font-lock-keyword-face)) + +;; ... user defined identifiers, roughly \[a-zA-Z]+ with single - or _ in between. + '("\\([_^-]?\\\\\\([a-zA-Z[:nonascii:]]\\(?:[-_]?[a-zA-Z[:nonascii:]]\\)*\\)\\)" 1 font-lock-constant-face) + +;; ... the left side of '=' -mark + '("\\([_a-zA-Z.0-9-]+\\)[ \t]*=[ \t]*" 1 font-lock-variable-name-face) + +;; ... the right side of '=' -mark + '("[ \t]*=[ \t]*\\([_a-zA-Z.0-9-]+\\)" 1 font-lock-variable-name-face) + +;; ... reserved words (defined above, see rwregex) + (cons (concat "\\(" rwregex "\\)") 'font-lock-variable-name-face) + +;; ... note or rest with (an accidental and) a duration, e.g., b,?16.*3/4 + (cons (concat "\\(^\\|[ <\{[/~(!)\t\\\|]\\)\\(\\(\\(" ncrwregex "\\)[,']*[?!]?\\|[srR]\\)" duration "?\\)") '(2 font-lock-type-face)) + +;; "on top", ... notes and rests with a long duration + (cons (concat "\\(^\\|[ <\{[/~(!)\t\\\|]\\)\\(\\(\\(" ncrwregex "\\)[,']*[?!]?\\|[srR]\\)" longduration "\\)") '(2 font-lock-type-face t)) + +;; "on top", ... lyrics-mode: fontify everything between '<'...'>' or '{'...'}' +; URGH, does not know anything about inner brackets. +; Multiple lines may need refontifying (C-c f). + '("\\(\\\\lyrics[^{<]*\\)\\({[^}]*\\|<[^>]*\\)" 2 font-lock-string-face t) + +;; "on top", ... horizontal grouping, also as postfix syntax '-*': +;; - brackets '{[]}' +;; - ties '~' +;; - ligatures \[, \] + '("\\(-?[][~}{]\\|\\\\[][]\\)" 0 font-lock-constant-face t) + +;; "on top", ... vertical grouping: +;; - '<>'-chord brackets with '\\'-voice sep., not marcato '->' +;; - '<< a b >>8' -chords + (cons (concat "\\(\\(-.\\)+\\|[^-^_]\\)\\([<>]+\\(" duration "\\|" longduration "\\)?\\|\\\\\\\\\\)") '(3 font-lock-function-name-face t)) + +;; "on top", ... expressional grouping, also as postfix syntax '-*': +;; - slurs ( ), \( \), [-^_][()] +;; - hairpins \<, \>, \! + '("\\(-?\\\\[()]\\|[-^_]?[()]\\)" 0 font-lock-builtin-face t) + +;; "on top", ... (multiline-)scheme: try find slurs up to 7th + '("[_^-]?#\\(#[ft]\\|-?[0-9.]+\\|\"[^\"]*\"\\|['`]?[a-zA-Z:-]+\\|['`]?([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^()]*\\(([^)]*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*)[^()]*\\)*[^)]*)\\)" 0 font-lock-string-face t) + +;; "on top", ... strings, match also unending strings at eof: +;; if '\n' was not found, it must be '$' which is eof (?). + '("\\([_^-]?\"\\([^\"\\\\]\\|\\\\.\\|\\\\\n\\)*\\(\"\\|$\\)\\)" 0 font-lock-string-face t) + +;; "on top", ... (multiline-)comments + '("\\(%\\({[^%]*%\\(}\\|\\([^}][^%]*%\\)+}\\)\\|.*\\)\\)" 0 font-lock-comment-face t) + + ) + ) + "Additional expressions to fontify in LilyPond mode.") + +;; define a mode-specific abbrev table for those who use such things +(defvar LilyPond-mode-abbrev-table nil + "Abbrev table in use in `LilyPond-mode' buffers.") + +(define-abbrev-table 'LilyPond-mode-abbrev-table nil) + +(defvar LilyPond-mode-syntax-table nil + "Syntax table used in `LilyPond-mode' buffers.") + +(defun LilyPond-mode-set-syntax-table (&optional not-punct) + "Change syntax table according to the argument `not-punct' which contains characters which are given a context dependent non-punctuation syntax: parentheses may be set to parenthesis syntax and characters `-', `^' and `_' may be set to escape syntax." + (if (not not-punct) (setq not-punct '())) + (setq LilyPond-mode-syntax-table (make-syntax-table)) + (let ((defaults + '( + ;; NOTE: Emacs knows only "13"-style (used), XEmacs knows also "1b3b", etc. + ( ?\% . "< 13" ) ; comment starter, 1st char in block-comments + ( ?\n . ">") ; newline: comment ender + ( ?\r . ">") ; formfeed: comment ender + ( ?\\ . "\\" ) ; escape characters (as '\n' in strings) + ( ?\" . "\"" ) ; string quote characters + ;; word constituents (e.g., belonging to a note) + ( ?\' . "w") ( ?\, . "w") ; transposing octaves + ;; punctuation characters (separate symbols from another) + ( ?\$ . "." ) ( ?\& . "." ) + ( ?\* . "." ) ( ?\+ . "." ) ( ?\/ . "." ) ( ?\= . "." ) + ( ?\| . "." ) ; bar line + ))) + ;; all the paren characters are now handled by lily-specific indenting/matching code in lilypond-indent.el + (if (or (memq ?\{ not-punct) (memq ?\} not-punct)) + (setq defaults (cons '( ?\{ . "(} 2" ) (cons '( ?\} . "){ 4" ) defaults))) ; begin and end of a block-comment + (setq defaults (cons '( ?\{ . ". 2" ) (cons '( ?\} . ". 4" ) defaults)))) ; begin and end of a block-comment + (if (or (memq ?\[ not-punct) (memq ?\] not-punct)) + (setq defaults (cons '( ?\[ . "(]" ) (cons '( ?\] . ")[" ) defaults))) + (setq defaults (cons '( ?\[ . "." ) (cons '( ?\] . "." ) defaults)))) + (if (or (memq ?\< not-punct) (memq ?\> not-punct)) + (setq defaults (cons '( ?\< . "(>" ) (cons '( ?\> . ")<" ) defaults))) + (setq defaults (cons '( ?\< . "." ) (cons '( ?\> . "." ) defaults)))) + (if (or (memq ?\( not-punct) (memq ?\) not-punct)) + (setq defaults (cons '( ?\( . "()" ) (cons '( ?\) . ")(" ) defaults))) + (setq defaults (cons '( ?\( . "." ) (cons '( ?\) . "." ) defaults)))) + ;; In LilyPond the following chars serve as escape chars, e.g., c^> d-) e_( , + ;; but they may be set to punctuation chars, since inside strings they should not act as escape chars + (setq defaults (cons (if (memq ?- not-punct) '( ?\- . "\\" ) '( ?\- . "." ) ) defaults)) + (setq defaults (cons (if (memq ?^ not-punct) '( ?^ . "\\" ) '( ?^ . "." ) ) defaults)) + (setq defaults (cons (if (memq ?\_ not-punct) '( ?\_ . "\\" ) '( ?\_ . "." ) ) defaults)) + (mapcar (function + (lambda (x) (modify-syntax-entry + (car x) (cdr x) LilyPond-mode-syntax-table))) + defaults) + (set-syntax-table LilyPond-mode-syntax-table))) + +(defun LilyPond-mode-context-set-syntax-table () + "Change syntax table according to current context." + (interactive) + ;; default syntax table sets parentheses to punctuation characters + (LilyPond-mode-set-syntax-table) + ;; find current context + (setq context (parse-partial-sexp (point-min) (point))) + (cond ((nth 3 context)) ; inside string + ((nth 4 context)) ; inside a comment + ((eq (char-syntax (or (char-before (point)) 0)) ?\\)) ; found escape-char + ((and (eq (char-syntax (or (char-before (- (point) 1)) 0)) ?\\) + (memq (char-before (point)) '( ?\) ?\] )))) ; found escape-char + ((memq (char-before (point)) '( ?\) )) + (LilyPond-mode-set-syntax-table '( ?\( ?\) ))) + ((memq (char-before (point)) '( ?\] )) + (LilyPond-mode-set-syntax-table '( ?\[ ?\] ))) + ((memq (char-before (point)) '( ?\> ?\} )) + (LilyPond-mode-set-syntax-table '( ?\< ?\> ?\{ ?\} ?\^ ?\- ?\_ ))) + ((memq (char-after (point)) '( ?\( )) + (LilyPond-mode-set-syntax-table '( ?\( ?\) ))) + ((memq (char-after (point)) '( ?\[ )) + (LilyPond-mode-set-syntax-table '( ?\[ ?\] ))) + ((memq (char-after (point)) '( ?\< ?\{ )) + (LilyPond-mode-set-syntax-table '( ?\< ?\> ?\{ ?\} ?\^ ?\- ?\_ ))) + )) diff --git a/lilypond-2.24.2/share/emacs/site-lisp/lilypond-indent.el b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-indent.el new file mode 100644 index 0000000000000000000000000000000000000000..974baec9718aeea3d98f98eeef473d07f7bcc83c --- /dev/null +++ b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-indent.el @@ -0,0 +1,605 @@ +;;; lilypond-indent.el --- Auto-indentation for lilypond code +;;;; +;;;; This file is part of LilyPond, the GNU music typesetter. +;;;; +;;;; Copyright (C) 2002--2022 Han-Wen Nienhuys , +;;;; 2003--2004 Heikki Junes +;;;; +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. +;;;; +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . +;;; +;;; Heikki Junes +;;; * ond-char paren matching is handled by context dependent syntax tables +;;; * match two-char slurs '\( ... \)' and '\[ ... \]' separately. +;;; * adopt Emacs' f90-comment-region + +;;; Chris Jackson +;;; some code is taken from ESS (Emacs Speaks Statistics) S-mode by A.J.Rossini + +;;; Variables for customising indentation style + +;;; TODO: +;;; * currently, in bracket matching one may need a non-bracket +;;; chararacter between the bracket characters, like ( ( ) ) + +(defcustom LilyPond-indent-level 2 + "*Indentation of lilypond statements with respect to containing block." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-brace-offset 0 + "*Extra indentation for open braces. +Compares with other text in same context." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-angle-offset 0 + "*Extra indentation for open angled brackets. +Compares with other text in same context." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-square-offset 0 + "*Extra indentation for open square brackets. +Compares with other text in same context." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-scheme-paren-offset 0 + "*Extra indentation for open scheme parens. +Compares with other text in same context." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-close-brace-offset 0 + "*Extra indentation for closing braces." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-close-angle-offset 0 + "*Extra indentation for closing angle brackets." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-close-square-offset 0 + "*Extra indentation for closing square brackets." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-close-scheme-paren-offset 0 + "*Extra indentation for closing scheme parens." + :group 'LilyPond + :type 'integer) + +(defcustom LilyPond-fancy-comments t + "*Non-nil means distiguish between %, %%, and %%% for indentation." + :group 'LilyPond + :type 'boolean) + +(defcustom LilyPond-comment-region "%%%" + "*String inserted by \\[LilyPond-comment-region]\ + at start of each line in region." + :group 'LilyPond + :type 'string) + +(defun LilyPond-comment-region (beg-region end-region) + "Comment/uncomment every line in the region. +Insert LilyPond-comment-region at the beginning of every line in the region +or, if already present, remove it." + (interactive "*r") + (let ((end (make-marker))) + (set-marker end end-region) + (goto-char beg-region) + (beginning-of-line) + (if (looking-at (regexp-quote LilyPond-comment-region)) + (delete-region (point) (match-end 0)) + (insert LilyPond-comment-region)) + (while (and (zerop (forward-line 1)) + (< (point) (marker-position end))) + (if (looking-at (regexp-quote LilyPond-comment-region)) + (delete-region (point) (match-end 0)) + (insert LilyPond-comment-region))) + (set-marker end nil))) + +(defun LilyPond-calculate-indent () + "Return appropriate indentation for current line as lilypond code. +In usual case returns an integer: the column to indent to. +Returns nil if line starts inside a string" + (save-excursion + (beginning-of-line) + (let ((indent-point (point)) + (case-fold-search nil) + state) + (setq containing-sexp (save-excursion (LilyPond-scan-containing-sexp))) + (beginning-of-defun) + (while (< (point) indent-point) + (setq state (parse-partial-sexp (point) indent-point 0))) + ;; (setq containing-sexp (car (cdr state))) is the traditional way for languages + ;; with simpler parenthesis delimiters + (cond ((nth 3 state) + ;; point is in the middle of a string + nil) + ((nth 4 state) + ;; point is in the middle of a block comment + (LilyPond-calculate-indent-within-blockcomment)) + ((null containing-sexp) + ;; Line is at top level - no indent + (beginning-of-line) + 0) + (t + ;; Find previous non-comment character. + (goto-char indent-point) + (LilyPond-backward-to-noncomment containing-sexp) + ;; Now we get the answer. + ;; Position following last unclosed open. + (goto-char containing-sexp) + (or + ;; Is line first statement after an open brace or bracket? + ;; If no, find that first statement and indent like it. + (save-excursion + (forward-char 1) + ;; Skip over comments following open brace. + (skip-chars-forward " \t\n") + (cond ((looking-at "%{") + (while (progn + (and (not (looking-at "%}")) + (< (point) (point-max)))) + (forward-line 1) + (skip-chars-forward " \t\n")) + (forward-line 1) + (skip-chars-forward " \t\n")) + ((looking-at "%") + (while (progn (skip-chars-forward " \t\n") + (looking-at "%")) + (forward-line 1)))) + ;; The first following code counts + ;; if it is before the line we want to indent. + (and (< (point) indent-point) + (current-column))) + ;; If no previous statement, + ;; indent it relative to line brace is on. + ;; For open brace in column zero, don't let statement + ;; start there too. If LilyPond-indent-level is zero, use + ;; LilyPond-brace-offset instead + (+ (if (and (bolp) (zerop LilyPond-indent-level)) + (cond ((= (following-char) ?{) + LilyPond-brace-offset) + ((= (following-char) ?<) + LilyPond-angle-offset) + ((= (following-char) ?\[) + LilyPond-square-offset) + ((= (following-char) ?\)) + LilyPond-scheme-paren-offset) + (t + 0)) + LilyPond-indent-level) + (progn + (skip-chars-backward " \t") + (current-indentation))))))))) + + +(defun LilyPond-indent-line () + "Indent current line as lilypond code. +Return the amount the indentation changed by." + (let ((indent (LilyPond-calculate-indent)) + beg shift-amt + (case-fold-search nil) + (pos (- (point-max) (point)))) + (beginning-of-line) + (setq beg (point)) + (cond ((eq indent nil) + (setq indent (current-indentation))) + (t + (skip-chars-forward " \t") + (if (and LilyPond-fancy-comments (looking-at "%%%\\|%{\\|%}")) + (setq indent 0)) + (if (and LilyPond-fancy-comments + (looking-at "%") + (not (looking-at "%%\\|%{\\|%}"))) + (setq indent comment-column) + (if (eq indent t) (setq indent 0)) + (if (listp indent) (setq indent (car indent))) + (cond + ((= (following-char) ?}) + (setq indent (+ indent (- LilyPond-close-brace-offset LilyPond-indent-level)))) + ((= (following-char) ?>) + (setq indent (+ indent (- LilyPond-close-angle-offset LilyPond-indent-level)))) + ((= (following-char) ?\]) + (setq indent (+ indent (- LilyPond-close-square-offset LilyPond-indent-level)))) + ((and (= (following-char) ?\)) (LilyPond-inside-scheme-p)) + (setq indent (+ indent (- LilyPond-close-scheme-paren-offset LilyPond-indent-level)))) + ((= (following-char) ?{) + (setq indent (+ indent LilyPond-brace-offset))) + ((= (following-char) ?<) + (setq indent (+ indent LilyPond-angle-offset))) + ((= (following-char) ?\[) + (setq indent (+ indent LilyPond-square-offset))) + ((and (= (following-char) ?\() (LilyPond-inside-scheme-p)) + (setq indent (+ indent LilyPond-scheme-paren-offset))) + )))) + (skip-chars-forward " \t") + (setq shift-amt (- indent (current-column))) + (if (zerop shift-amt) + (if (> (- (point-max) pos) (point)) + (goto-char (- (point-max) pos))) + (delete-region beg (point)) + (indent-to indent) + ;; If initial point was within line's indentation, + ;; position after the indentation. + ;; Else stay at same point in text. + (if (> (- (point-max) pos) (point)) + (goto-char (- (point-max) pos)))) + shift-amt)) + + +(defun LilyPond-inside-comment-p () + "Return non-nil if point is inside a line or block comment" + (setq this-point (point)) + (or (save-excursion (beginning-of-line) + (skip-chars-forward " \t") + (looking-at "%")) + (save-excursion + ;; point is in the middle of a block comment + (setq lastopen (save-excursion (re-search-backward "%{[ \\t]*" (point-min) t))) + (setq lastclose (save-excursion (re-search-backward "%}[ \\t]*" (point-min) t))) + (if (or (and (= (char-before) ?%) (= (char-after) ?{)) + (and (= (char-after) ?%) (= (char-after (1+ (point))) ?{))) + (setq lastopen (save-excursion (backward-char) (point)))) + (and + lastopen + (or (not lastclose) + (<= lastclose lastopen)))) + )) + + +(defun LilyPond-inside-string-or-comment-p () + "Test if point is inside a string or a comment" + (setq this-point (point)) + (or (save-excursion (beginning-of-line) + (skip-chars-forward " \t") + (looking-at "%")) + (save-excursion + (beginning-of-defun) + (while (< (point) this-point) + (setq state (parse-partial-sexp (point) this-point 0))) + (cond ((nth 3 state) + ;; point is in the middle of a string + t ) + ((nth 4 state) + ;; point is in the middle of a block comment + t ) + (t + nil))))) + + +(defun LilyPond-backward-over-blockcomments (lim) + "Move point back to closest non-whitespace character not part of a block comment" + (setq lastopen (save-excursion (re-search-backward "%{[ \\t]*" lim t))) + (setq lastclose (save-excursion (re-search-backward "%}[ \\t]*" lim t))) + (if lastopen + (if lastclose + (if (<= lastclose lastopen) + (goto-char lastopen)) + (goto-char lastopen))) + (skip-chars-backward " %\t\n\f")) + + +(defun LilyPond-backward-over-linecomments (lim) + "Move point back to the closest non-whitespace character not part of a line comment. +Argument LIM limit." + (let (opoint stop) + (while (not stop) + (skip-chars-backward " \t\n\f" lim) + (setq opoint (point)) + (beginning-of-line) + (search-forward "%" opoint 'move) + (skip-chars-backward " \t%") + (setq stop (or (/= (preceding-char) ?\n) (<= (point) lim))) + (if stop (point) + (beginning-of-line))))) + + +(defun LilyPond-backward-to-noncomment (lim) + "Move point back to closest non-whitespace character not part of a comment" + (LilyPond-backward-over-linecomments lim) + (LilyPond-backward-over-blockcomments lim)) + + +(defun LilyPond-calculate-indent-within-blockcomment () + "Return the indentation amount for line inside a block comment." + (let (end percent-start) + (save-excursion + (beginning-of-line) + (skip-chars-forward " \t") + (skip-chars-backward " \t\n") + (setq end (point)) + (beginning-of-line) + (skip-chars-forward " \t") + (and (re-search-forward "%{[ \t]*" end t) + (goto-char (1+ (match-beginning 0)))) + (if (and (looking-at "[ \t]*$") (= (preceding-char) ?\%)) + (1+ (current-column)) + (current-column))))) + + +;; Key: Type of bracket (character). +;; Value: Pair of regexps representing the corresponding open and close bracket +;; () are treated specially (need to indent in Scheme but not in music) + +(defconst LilyPond-parens-regexp-alist + `( ( ?> . ("\\([^\\]\\|^\\)<" . "\\([^ \\n\\t_^-]\\|[_^-][-^]\\|\\s-\\)\\s-*>")) + ;; a b c->, a b c^> and a b c_> are not close-angle-brackets, they're accents + ;; but a b c^-> and a b c^^> are close brackets with tenuto/marcato before them + ;; also \> and \< are hairpins + ;; duh .. a single '>', as in chords '<< ... >>', was not matched here + ( ?} . ("{" . "}")) + ;; ligatures '\[ ... \]' are skipped in the following expression + ( ?\] . ("\\([^\\]\\([\\][\\]\\)*\\|^\\)[[]" . "\\([^\\]\\([\\][\\]\\)*\\|^\\)[]]")) + ( "\\]" . ("\\([^\\]\\|^\\)\\([\\][\\]\\)*[\\][[]" . "\\([^\\]\\|^\\)\\([\\][\\]\\)*[\\][]]")) + ( "\\)" . ("\\([^\\]\\|^\\)\\([\\][\\]\\)*[\\][(]" . "\\([^\\]\\|^\\)\\([\\][\\]\\)*[\\][)]")) + )) + + +(defconst LilyPond-parens-alist + `( ( ?< . ?> ) + ( ?{ . ?} ) + ( ?\[ . ?\] ) + ( "\\[" . "\\]" ) + ( ?\( . ?\) ) + ( "\\(" . "\\)" ) + )) + + +(defun LilyPond-matching-paren (bracket-type) + "Returns the open corresponding to the close specified by bracket-type, or vice versa" + (cond ( (member bracket-type (mapcar 'car LilyPond-parens-alist)) + (cdr (assoc bracket-type LilyPond-parens-alist)) ) + ( (member bracket-type (mapcar 'cdr LilyPond-parens-alist)) + (car (rassoc bracket-type LilyPond-parens-alist)) ) + nil)) + + +(defun LilyPond-scan-containing-sexp (&optional bracket-type slur-paren-p dir) + "Move point to the beginning of the deepest parenthesis pair enclosing point. + +If the optional argument bracket-type, a character representing a +close bracket such as ) or }, is specified, then the parenthesis pairs +searched are limited to this type. + +If the optional argument slur-paren-p is non-nil, then slur +parentheses () are considered as matching pairs. Otherwise Scheme +parentheses are considered to be matching pairs, but slurs are not. +slur-paren-p defaults to nil. +" +;;; An user does not call this function directly, or by a key sequence. + ;; (interactive) + (let ( (level (if (not (eq dir 1)) 1 -1)) + (regexp-alist LilyPond-parens-regexp-alist) + (oldpos (point)) + (assoc-bracket-type (if (not (eq dir 1)) bracket-type (LilyPond-matching-paren bracket-type)))) + + (if (LilyPond-inside-scheme-p) + (setq paren-regexp "(\\|)") + (if slur-paren-p + ;; expressional slurs '\( ... \)' are not taken into account + (setq regexp-alist (cons '( ?\) . ("\\([^\\]\\([\\][\\]\\)*\\|^\\)(" . "\\([^\\]\\([\\][\\]\\)*\\|^\\))")) regexp-alist))) + (if (member assoc-bracket-type (mapcar 'car regexp-alist)) + (progn (setq paren-regexp (cdr (assoc assoc-bracket-type regexp-alist))) + (setq paren-regexp (concat (car paren-regexp) "\\|" (cdr paren-regexp)))) + (setq paren-regexp (concat (mapconcat 'car (mapcar 'cdr regexp-alist) "\\|") "\\|" + (mapconcat 'cdr (mapcar 'cdr regexp-alist) "\\|"))))) + ;; match concurrent one-char opening and closing slurs + (if (and (eq dir 1) + (not (sequencep bracket-type)) + (eq (char-syntax (or (char-after oldpos) 0)) ?\() + (not (eq (char-after oldpos) ?<))) + ;; anyway do not count open slur, since already level = -1 + (progn (forward-char 1) + (if (eq (following-char) + (LilyPond-matching-paren (char-after oldpos))) + ;; matching char found, go after it and set level = 0 + (progn (forward-char 1) + (setq level 0))))) + ;; browse the code until matching slur is found, or report mismatch + (while (and (if (not (eq dir 1)) + (> level 0) + (< level 0)) + ;; dir tells whether to search backward or forward + (if (not (eq dir 1)) + (re-search-backward paren-regexp nil t) + (re-search-forward paren-regexp nil t)) + ;; note: in case of two-char bracket only latter is compared + (setq match (char-before (match-end 0)))) +;;; (message "%d" level) (sit-for 0 300) + (if (not (save-excursion (goto-char (match-end 0)) + ;; skip over strings and comments + (LilyPond-inside-string-or-comment-p))) + (if (memq match '(?} ?> ?\] ?\))) + ;; count closing brackets + (progn (setq level (1+ level)) + ;; slurs may be close to each other, e.g., + ;; a single '>' was not matched .. need to be corrected + (if (and (eq dir 1) (eq (char-after (match-end 0)) match)) + (if (/= level 0) + (progn + (setq level (1+ level)) + (forward-char 1)))) +;;; (message "%d %c" level match) (sit-for 0 300) + ;; hmm.. + (if (and (= match ?>) + (looking-at ".\\s-+>\\|\\({\\|}\\|<\\|>\\|(\\|)\\|[][]\\)>")) + (forward-char 1))) + ;; count opening brackets + (progn (setq level (1- level)) +;;; (message "%d %c" level match) (sit-for 0 300) + ;; hmm.. + (if (and (= match ?<) + (looking-at ".\\s-+<\\|\\({\\|}\\|<\\|>\\|(\\|)\\|[][]\\)<")) + (forward-char 1)))))) + ;; jump to the matching slur + (if (not (eq dir 1)) + (progn + (if (sequencep bracket-type) + ;; match the latter char in two-char brackets + (if (looking-at "..[][)(]") (forward-char 1))) + ;; if the following char is not already a slur + (if (and (not (looking-at "[)(]")) + ;; match the slur which follows + (looking-at ".[][><)(]")) (forward-char 1))) + (backward-char 1)) + (if (= level 0) + (point) + (progn (goto-char oldpos) + nil)))) + + +(defun LilyPond-inside-scheme-p () + "Tests if point is inside embedded Scheme code" +;;; An user does not call this function directly, or by a key sequence. + ;; (interactive) + (let ( (test-point (point)) + (level 0) ) + (save-excursion + (if (or (and (eq (char-after (point)) ?\() + (save-excursion + (skip-chars-backward "'`") + (memq (char-before) '(?# ?$)))) + (and (re-search-backward "[#$][`']?(" nil t) + (progn + (search-forward "(") + (setq level 1) + (while (and (> level 0) + (re-search-forward "[()]" test-point t) + (setq match (char-after (match-beginning 0))) + (<= (point) test-point)) + (if (= match ?\() + (setq level (1+ level)) + (setq level (1- level)))) + (> level 0)))) + t + nil)))) + + +;;; Largely taken from the 'blink-matching-open' in lisp/simple.el in +;;; the Emacs distribution. + +(defun LilyPond-blink-matching-paren (&optional dir) + "Move cursor momentarily to the beginning of the sexp before +point. In lilypond files this is used for closing ), ], } and >, whereas the +builtin 'blink-matching-open' is not used. In syntax table, see +`lilypond-font-lock.el', all brackets are punctuation characters." +;;; An user does not call this function directly, or by a key sequence. + ;; (interactive) + (let ( (oldpos (point)) + (level 0) + (mismatch) ) + (if (not (or (equal this-command 'LilyPond-electric-close-paren) + (eq dir 1))) + (goto-char (setq oldpos (- oldpos 1)))) + ;; Test if a ligature \] or expressional slur \) was encountered + (setq bracket-type (char-after (point))) + (setq char-before-bracket-type nil) + (if (memq bracket-type '(?\] ?\) ?\[ ?\()) + (progn + (setq np -1) + (while (eq (char-before (- (point) (setq np (+ np 1)))) ?\\) + (setq char-before-bracket-type (if char-before-bracket-type nil ?\\))) + (if (eq char-before-bracket-type ?\\) + (setq bracket-type (string char-before-bracket-type bracket-type))))) + (when blink-matching-paren-distance + (narrow-to-region + (max (point-min) (- (point) blink-matching-paren-distance)) + (min (point-max) (+ (point) blink-matching-paren-distance)))) + (if (and (equal this-command 'LilyPond-electric-close-paren) + (memq bracket-type '(?> ?} ?< ?{))) + ;; < { need to be mutually balanced and nested, so search backwards for both of these bracket types + (LilyPond-scan-containing-sexp nil nil dir) + ;; whereas ( ) slurs within music don't, so only need to search for ( ) + ;; use same mechanism for [ ] slurs + (LilyPond-scan-containing-sexp bracket-type t dir)) + (setq blinkpos (point)) + (setq mismatch + (or (null (LilyPond-matching-paren (char-after blinkpos))) + (/= (char-after oldpos) + (LilyPond-matching-paren (char-after blinkpos))))) + (if mismatch (progn (setq blinkpos nil) + (message "Mismatched parentheses"))) + (if (and blinkpos + (equal this-command 'LilyPond-electric-close-paren)) + (if (pos-visible-in-window-p) + (and blink-matching-paren-on-screen + (sit-for blink-matching-delay)) + (message + "Matches %s" + ;; Show what precedes the open in its line, if anything. + (if (save-excursion + (skip-chars-backward " \t") + (not (bolp))) + (buffer-substring (progn (beginning-of-line) (point)) + (1+ blinkpos)) + ;; Show what follows the open in its line, if anything. + (if (save-excursion + (forward-char 1) + (skip-chars-forward " \t") + (not (eolp))) + (buffer-substring blinkpos + (progn (end-of-line) (point))) + ;; Otherwise show the previous nonblank line, + ;; if there is one. + (if (save-excursion + (skip-chars-backward "\n \t") + (not (bobp))) + (concat + (buffer-substring (progn + (skip-chars-backward "\n \t") + (beginning-of-line) + (point)) + (progn (end-of-line) + (skip-chars-backward " \t") + (point))) + ;; Replace the newline and other whitespace with `...'. + "..." + (buffer-substring blinkpos (1+ blinkpos))) + ;; There is nothing to show except the char itself. + (buffer-substring blinkpos (1+ blinkpos)))))))) + (if (not (equal this-command 'LilyPond-electric-close-paren)) + (goto-char (setq oldpos (+ oldpos 1))) + (goto-char oldpos)) + (if (not (eq dir 1)) + blinkpos + (+ blinkpos 1)))) + + +(defun LilyPond-electric-close-paren () + "Blink on the matching open paren when a >, ), } or ] is inserted" + (interactive) + (let ((oldpos (point))) + (self-insert-command 1) + ;; Refontify buffer if a block-comment-ender '%}' is inserted + (if (and (eq (char-before (point)) ?}) + (eq (char-before (- (point) 1)) ?%)) + (font-lock-fontify-buffer) + ;; Match paren if the cursor is not inside string or comment. + (if (and blink-matching-paren + (not (LilyPond-inside-string-or-comment-p)) + (save-excursion (re-search-backward + (concat (mapconcat 'cdr (mapcar 'cdr LilyPond-parens-regexp-alist) "\\|") "\\|)") nil t) + (eq oldpos (1- (match-end 0))))) + (progn (backward-char 1) + (LilyPond-blink-matching-paren) + (forward-char 1)))))) + +(defun LilyPond-scan-sexps (pos dir) + "This function is redefined to be used in Emacs' show-paren-function and +in XEmacs' paren-highlight." + (LilyPond-blink-matching-paren dir)) diff --git a/lilypond-2.24.2/share/emacs/site-lisp/lilypond-init.el b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-init.el new file mode 100644 index 0000000000000000000000000000000000000000..57b2f847a74a704edab95534784ecf4a212f9736 --- /dev/null +++ b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-init.el @@ -0,0 +1,21 @@ +;;; lilypond-init.el --- Startup code for LilyPond mode +;; +;; Instructions, extracted from Documentation/topdocs/INSTALL.texi: + +;; Emacs mode for entering music and running LilyPond is contained in +;; the source archive as `lilypond-mode.el', `lilypond-indent.el', +;; `lilypond-font-lock.el' and `lilypond-words.el'. You should install +;; these files to a directory included in your `load-path'. +;; File `lilypond-init.el' should be placed to `load-path/site-start.d/' +;; or appended to your `~/.emacs' or `~/.emacs.el'. + +;; As a user, you may want add your source path or, e.g., `~/site-lisp/' to +;; your `load-path'. Append the following line (modified) to your `~/.emacs': + +;(setq load-path (append (list (expand-file-name "~/site-lisp")) load-path)) + +(autoload 'LilyPond-mode "lilypond-mode" "LilyPond Editing Mode" t) +(add-to-list 'auto-mode-alist '("\\.ly\\'" . LilyPond-mode)) +(add-to-list 'auto-mode-alist '("\\.ily\\'" . LilyPond-mode)) +(add-hook 'LilyPond-mode-hook (lambda () (turn-on-font-lock))) + diff --git a/lilypond-2.24.2/share/emacs/site-lisp/lilypond-mode.el b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-mode.el new file mode 100644 index 0000000000000000000000000000000000000000..4f5867268422519430ef8391c6ad07dd3080da6f --- /dev/null +++ b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-mode.el @@ -0,0 +1,1204 @@ +;;;; lilypond-mode.el -- Major mode for editing GNU LilyPond music scores +;;;; This file is part of LilyPond, the GNU music typesetter. +;;;; +;;;; Copyright (C) 1999--2022 Jan Nieuwenhuizen +;;;; Changed 2001--2003 Heikki Junes +;;;; * Add PS-compilation, PS-viewing and MIDI-play (29th Aug 2001) +;;;; * Keyboard shortcuts (12th Sep 2001) +;;;; * Inserting tags, inspired on sgml-mode (11th Oct 2001) +;;;; * Autocompletion & Info (23rd Nov 2002) +;;;; +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. +;;;; +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . + + +;;; Inspired on auctex + +;;; Look lilypond-init.el or Documentation/topdocs/INSTALL.texi +;;; for installing instructions. + +(require 'easymenu) +(require 'compile) + +(defconst LilyPond-version "2.5.20" + "`LilyPond-mode' version number.") + +(defconst LilyPond-help-address "bug-lilypond@gnu.org" + "Address accepting submission of bug reports.") + +(defvar LilyPond-mode-hook nil + "*Hook called by `LilyPond-mode'.") + +(defvar LilyPond-region-file-prefix "emacs-lily" + "File prefix for commands on buffer or region.") + +(defvar LilyPond-master-file nil + "Master file that LilyPond will be run on.") + +;; FIXME: find ``\score'' in buffers / make settable? +(defun LilyPond-get-master-file () + (or LilyPond-master-file + (buffer-file-name))) + +(defvar LilyPond-kick-xdvi nil + "If true, no simultaneous xdvi's are started, but reload signal is sent.") + +(defvar LilyPond-command-history nil + "Command history list.") + +(defvar LilyPond-regexp-alist + '(("\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2)) + "Regexp used to match LilyPond errors. See `compilation-error-regexp-alist'.") + +(defvar LilyPond-imenu nil + "A flag to tell whether LilyPond-imenu is turned on.") +(make-variable-buffer-local 'LilyPond-imenu) + +(defcustom LilyPond-include-path ".:/tmp" + "* LilyPond include path." + :type 'string + :group 'LilyPond) + +(defun LilyPond-words-filename () + "The file containing LilyPond \keywords \Identifiers and ReservedWords. +Finds file lilypond-words.el from load-path." + (let ((fn nil) + (lp load-path) + (words-file "lilypond-words.el")) + (while (and (> (length lp) 0) (not fn)) + (setq fn (concat (car lp) "/" words-file)) + (if (not (file-readable-p fn)) + (progn (setq fn nil) (setq lp (cdr lp))))) + (if (not fn) + (progn (message "Warning: `lilypond-words.el' not found in `load-path'. See `lilypond-init.el'.") + (sit-for 5 0))) + fn)) + +(defun LilyPond-add-dictionary-word (x) + "Contains all words: \keywords \Identifiers and ReservedWords." + (nconc '(("" . 1)) x)) + +(if (> emacs-major-version 20) + (defun get-buffer-size (b) (buffer-size b)) + (defun get-buffer-size (b) + (let (size (current-buffer (current-buffer))) + (set-buffer b) + (setq size (buffer-size)) + (set-buffer current-buffer) + size + ))) + +;; creates dictionary if empty +(if (and (eq (length (LilyPond-add-dictionary-word ())) 1) + (not (eq (LilyPond-words-filename) nil))) + (progn + (setq b (find-file-noselect (LilyPond-words-filename) t t)) + (setq m (set-marker (make-marker) 1 (get-buffer b))) + (setq i 1) + (while (> (get-buffer-size b) (marker-position m)) + (setq i (+ i 1)) + (setq copy (copy-alist (list (eval (symbol-name (read m)))))) + (setcdr copy i) + (LilyPond-add-dictionary-word (list copy))) + (kill-buffer b))) + +(defvar LilyPond-insert-tag-current "" + "The last command selected from the LilyPond-Insert -menu.") + +(defconst LilyPond-menu-keywords + (let ((wordlist '()) + (co (all-completions "" (LilyPond-add-dictionary-word ()))) + (currword "")) + (progn + (while (> (length co) 0) + (setq currword (car co)) + (if (string-equal "-" (car (setq co (cdr co)))) + (progn + (add-to-list 'wordlist currword) + (while (and (> (length co) 0) + (not (string-equal "-" (car (setq co (cdr co)))))))))) + (reverse wordlist))) + "Keywords inserted from LilyPond-Insert-menu.") + +(defconst LilyPond-keywords + (let ((wordlist '("\\score")) + (co (all-completions "" (LilyPond-add-dictionary-word ()))) + (currword "")) + (progn + (while (> (length co) 0) + (setq currword (car co)) + (if (> (length currword) 1) + (if (and (string-equal "\\" (substring currword 0 1)) + (string-match "[a-z-]+" currword) + (= (match-beginning 0) 1) + (= (match-end 0) (length currword)) + (not (string-equal "\\longa" currword)) + (not (string-equal "\\breve" currword)) + (not (string-equal "\\maxima" currword)) + (string-equal (downcase currword) currword)) + (add-to-list 'wordlist currword))) + (if (string-equal "-" (car (setq co (cdr co)))) + (while (and (> (length co) 0) + (not (string-equal "-" (car (setq co (cdr co))))))))) + (reverse wordlist))) + "LilyPond \\keywords") + +(defconst LilyPond-identifiers + (let ((wordlist '("\\voiceOne")) + (co (all-completions "" (LilyPond-add-dictionary-word ())))) + (progn + (while (> (length co) 0) + (setq currword (car co)) + (if (> (length currword) 1) + (if (and (string-equal "\\" (substring currword 0 1)) + (string-match "[a-zA-Z-]+" currword) + (= (match-beginning 0) 1) + (= (match-end 0) (length currword)) + (not (string-equal (downcase currword) currword))) + (add-to-list 'wordlist currword))) + (if (string-equal "-" (car (setq co (cdr co)))) + (while (and (> (length co) 0) + (not (string-equal "-" (car (setq co (cdr co))))))))) + (reverse wordlist))) + "LilyPond \\Identifiers") + +(defconst LilyPond-Capitalized-Reserved-Words + (let ((wordlist '("StaffContext")) + (co (all-completions "" (LilyPond-add-dictionary-word ())))) + (progn + (while (> (length co) 0) + (setq currword (car co)) + (if (> (length currword) 0) + (if (and (string-match "[a-zA-Z_]+" currword) + (= (match-beginning 0) 0) + (= (match-end 0) (length currword)) + (not (string-equal (downcase currword) currword))) + (add-to-list 'wordlist currword))) + (if (string-equal "-" (car (setq co (cdr co)))) + (while (and (> (length co) 0) + (not (string-equal "-" (car (setq co (cdr co))))))))) + (reverse wordlist))) + "LilyPond ReservedWords") + +(defconst LilyPond-non-capitalized-reserved-words + (let ((wordlist '("cessess")) + (co (all-completions "" (LilyPond-add-dictionary-word ())))) + (progn + (while (> (length co) 0) + (setq currword (car co)) + (if (> (length currword) 0) + (if (and (string-match "[a-z]+" currword) + (= (match-beginning 0) 0) + (= (match-end 0) (length currword)) + (string-equal (downcase currword) currword)) + (add-to-list 'wordlist currword))) + (if (string-equal "-" (car (setq co (cdr co)))) + (while (and (> (length co) 0) + (not (string-equal "-" (car (setq co (cdr co))))))))) + (reverse wordlist))) + "LilyPond notenames") + +(defun LilyPond-check-files (derived originals extensions) + "Check that DERIVED is newer than any of the ORIGINALS. +Try each original with each member of EXTENSIONS, in all directories +in LilyPond-include-path." + (let ((found nil) + (regexp (concat "\\`\\(" + (mapconcat (function (lambda (dir) + (regexp-quote (expand-file-name dir)))) + LilyPond-include-path "\\|") + "\\).*\\(" + (mapconcat 'regexp-quote originals "\\|") + "\\)\\.\\(" + (mapconcat 'regexp-quote extensions "\\|") + "\\)\\'")) + (buffers (buffer-list))) + (while buffers + (let* ((buffer (car buffers)) + (name (buffer-file-name buffer))) + (setq buffers (cdr buffers)) + (if (and name (string-match regexp name)) + (progn + (and (buffer-modified-p buffer) + (or (not LilyPond-save-query) + (y-or-n-p (concat "Save file " + (buffer-file-name buffer) + "? "))) + (save-excursion (set-buffer buffer) (save-buffer))) + (if (file-newer-than-file-p name derived) + (setq found t)))))) + found)) + +(defun LilyPond-running () + "Check the currently running LilyPond compiling jobs." + (let ((process-names (list "lilypond" "tex" "2ps" "2midi" + "book" "latex")) + (running nil)) + (while (setq process-name (pop process-names)) + (setq process (get-process process-name)) + (if (and process + (eq (process-status process) 'run)) + (push process-name running))) + running)) ; return the running jobs + +(defun LilyPond-midi-running () + "Check the currently running Midi processes." + (let ((process-names (list "midi" "midiall")) + (running nil)) + (while (setq process-name (pop process-names)) + (setq process (get-process process-name)) + (if (and process + (eq (process-status process) 'run)) + (push process-name running))) + running)) ; return the running jobs + +(defun LilyPond-kill-jobs () + "Kill the currently running LilyPond compiling jobs." + (interactive) + (let ((process-names (LilyPond-running)) + (killed nil)) + (while (setq process-name (pop process-names)) + (quit-process (get-process process-name) t) + (push process-name killed)) + killed)) ; return the killed jobs + +(defun LilyPond-kill-midi () + "Kill the currently running midi processes." + (let ((process-names (LilyPond-midi-running)) + (killed nil)) + (while (setq process-name (pop process-names)) + (quit-process (get-process process-name) t) + (push process-name killed)) + killed)) ; return the killed jobs + +;; URG, should only run LilyPond-compile for LilyPond +;; not for tex,xdvi (lilypond?) +(defun LilyPond-compile-file (command name) + ;; We maybe should know what we run here (Lily, lilypond, tex) + ;; and adjust our error-matching regex ? + (compilation-start + (if (eq LilyPond-command-current 'LilyPond-command-master) + command + ;; use temporary directory for Commands on Buffer/Region + ;; hm.. the directory is set twice, first to default-dir + (concat "cd " (LilyPond-temp-directory) "; " command)))) + +;; do we still need this, now that we're using compilation-start? +(defun LilyPond-save-buffer () + "Save buffer and set default command for compiling." + (interactive) + (if (buffer-modified-p) + (progn (save-buffer) + (setq LilyPond-command-next LilyPond-command-default)))) + +;;; return (dir base ext) +(defun split-file-name (name) + (let* ((i (string-match "[^/]*$" name)) + (dir (if (> i 0) (substring name 0 i) "./")) + (file (substring name i (length name))) + (i (string-match "[^.]*$" file))) + (if (and + (> i 0) + (< i (length file))) + (list dir (substring file 0 (- i 1)) (substring file i (length file))) + (list dir file "")))) + + +;; Should check whether in command-alist? +(defcustom LilyPond-command-default "LilyPond" + "Default command. Must identify a member of LilyPond-command-alist." + + :group 'LilyPond + :type 'string) +;;;(make-variable-buffer-local 'LilyPond-command-last) + +(defvar LilyPond-command-next LilyPond-command-default) + +(defvar LilyPond-command-current 'LilyPond-command-master) +;;;(make-variable-buffer-local 'LilyPond-command-master) + + +;; If non-nil, LilyPond-command-query will return the value of this +;; variable instead of querying the user. +(defvar LilyPond-command-force nil) + +(defcustom LilyPond-lilypond-command "lilypond" + "Command used to compile LY files." + :group 'LilyPond + :type 'string) + +(defcustom LilyPond-ps-command "gv --watch" + "Command used to display PS files." + + :group 'LilyPond + :type 'string) + +(defcustom LilyPond-pdf-command "xpdf" + "Command used to display PDF files." + + :group 'LilyPond + :type 'string) + +(defcustom LilyPond-midi-command "timidity" + "Command used to play MIDI files." + + :group 'LilyPond + :type 'string) + +(defcustom LilyPond-all-midi-command "timidity -ia" + "Command used to play MIDI files." + + :group 'LilyPond + :type 'string) + +(defun LilyPond-command-current-midi () + "Play midi corresponding to the current document." + (interactive) + (LilyPond-command (LilyPond-command-menu "Midi") 'LilyPond-get-master-file)) + +(defun LilyPond-command-all-midi () + "Play midi corresponding to the current document." + (interactive) + (LilyPond-command (LilyPond-command-menu "MidiAll") 'LilyPond-get-master-file)) + +(defun count-matches-as-number (re) + "Count-matches in emacs 22 backwards-incompatibly returns a number" + (let ((result (count-matches re))) + (if (stringp result) + (string-to-number result) + result))) + +(defun count-rexp (start end rexp) + "Print number of found regular expressions in the region." + (interactive "r") + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (count-matches-as-number rexp)))) + +(defun count-midi-words () + "Check number of midi-scores before the curser." + (if (eq LilyPond-command-current 'LilyPond-command-region) + (count-rexp (mark t) (point) "\\\\midi") + (count-rexp (point-min) (point-max) "\\\\midi"))) + +(defun count-midi-words-backwards () + "Check number of midi-scores before the curser." + (if (eq LilyPond-command-current 'LilyPond-command-region) + (count-rexp (mark t) (point) "\\\\midi") + (count-rexp (point-min) (point) "\\\\midi"))) + +(defun LilyPond-string-current-midi () + "Check the midi file of the following midi-score in the current document." + (let ((fnameprefix (if (eq LilyPond-command-current 'LilyPond-command-master) + (substring (LilyPond-get-master-file) 0 -3); suppose ".ly" + LilyPond-region-file-prefix)) + (allcount (count-midi-words)) + (count (count-midi-words-backwards))) + (concat fnameprefix + (if (and (> allcount 1) (> count 0)) ; not first score + (if (eq count allcount) ; last score + (concat "-" (number-to-string (+ count -1))) + (concat "-" (number-to-string count)))) + ".midi"))) + +(defun LilyPond-string-all-midi () + "Return the midi files of the current document in ascending order." + (let ((fnameprefix (if (eq LilyPond-command-current 'LilyPond-command-master) + (substring (LilyPond-get-master-file) 0 -3); suppose ".ly" + LilyPond-region-file-prefix)) + (allcount (count-midi-words))) + (concat (if (> allcount 0) ; at least one midi-score + (concat fnameprefix ".midi ")) + (if (> allcount 1) ; more than one midi-score + (concat fnameprefix "-[1-9].midi ")) + (if (> allcount 9) ; etc. + (concat fnameprefix "-[1-9][0-9].midi")) + (if (> allcount 99) ; not first score + (concat fnameprefix "-[1-9][0-9][0-9].midi"))))) + +;; This is the major configuration variable. +(defcustom LilyPond-command-alist + ;; Should expand this to include possible keyboard shortcuts which + ;; could then be mapped to define-key and menu. + '( + ("LilyPond" . ((LilyPond-lilypond-command " %s") "%s" "%l" "View")) + ("2PS" . ((LilyPond-lilypond-command " -f ps %s") "%s" "%p" "ViewPS")) + ("Book" . ("lilypond-book %x" "%x" "%l" "LaTeX")) + ("LaTeX" . ("latex '\\nonstopmode\\input %l'" "%l" "%d" "ViewDVI")) + + ;; refreshes when kicked USR1 + ("View" . ((LilyPond-pdf-command " %f"))) + ("ViewPDF" . ((LilyPond-pdf-command " %f"))) + ("ViewPS" . ((LilyPond-ps-command " %p"))) + + ;; The following are refreshed in LilyPond-command: + ;; - current-midi depends on cursor position and + ("Midi" . ("")) ; + ;; - all-midi depends on number of midi-score. + ("MidiAll" . ("")) + ) + + "AList of commands to execute on the current document. + +The key is the name of the command as it will be presented to the +user, the value is a cons of the command string handed to the shell +after being expanded, and the next command to be executed upon +success. The expansion is done using the information found in +LilyPond-expand-list. +" + :group 'LilyPond + :type '(repeat (cons :tag "Command Item" + (string :tag "Key") + (cons :tag "How" + (string :tag "Command") + (string :tag "Next Key"))))) + +;; drop this? +(defcustom LilyPond-file-extension ".ly" + "*File extension used in LilyPond sources." + :group 'LilyPond + :type 'string) + + +(defcustom LilyPond-expand-alist + '( + ("%s" . ".ly") + ("%t" . ".tex") + ("%d" . ".dvi") + ("%f" . ".pdf") + ("%p" . ".ps") + ("%l" . ".tex") + ("%x" . ".tely") + ("%m" . ".midi") + ) + + "Alist of expansion strings for LilyPond command names." + :group 'LilyPond + :type '(repeat (cons :tag "Alist item" + (string :tag "Symbol") + (string :tag "Expansion")))) + + +(defcustom LilyPond-command-Show "View" + "*The default command to show (view or print) a LilyPond file. +Must be the car of an entry in `LilyPond-command-alist'." + :group 'LilyPond + :type 'string) + (make-variable-buffer-local 'LilyPond-command-Show) + +(defcustom LilyPond-command-Print "Print" + "The name of the Print entry in LilyPond-command-Print." + :group 'LilyPond + :type 'string) + +(defun LilyPond-find-required-command (command file) + "Find the first command in the chain that is needed to run + (input file is newer than the output file)" + (let* ((entry (cdr (assoc command LilyPond-command-alist))) + (next-command (nth 3 entry))) + (if (null next-command) + command + (let* ((src-string (nth 1 entry)) + (input (LilyPond-command-expand src-string file)) + (output (LilyPond-command-expand (nth 2 entry) file))) + (if (or (file-newer-than-file-p input output) + (and (equal "%s" src-string) + (not (equal (buffer-name) file)) + (file-newer-than-file-p (buffer-name) + output))) + command + (LilyPond-find-required-command next-command file)))))) + +(defun LilyPond-command-query (name) + "Query the user for what LilyPond command to use." + (cond ((string-equal name LilyPond-region-file-prefix) + (LilyPond-check-files (concat name ".tex") + (list name) + (list LilyPond-file-extension))) + ((verify-visited-file-modtime (current-buffer)) + (and (buffer-modified-p) + (y-or-n-p "Save buffer before next command? ") + (LilyPond-save-buffer))) + ((y-or-n-p "The command will be invoked to an already saved buffer. Revert it? ") + (revert-buffer t t))) + + (let* ((default (LilyPond-find-required-command LilyPond-command-next name)) + (completion-ignore-case t) + (answer (or LilyPond-command-force + (completing-read + (concat "Command: (default " default ") ") + LilyPond-command-alist nil t nil 'LilyPond-command-history)))) + + ;; If the answer is "LilyPond" it will not be expanded to "LilyPond" + (let ((answer (car-safe (assoc answer LilyPond-command-alist)))) + (if (and answer + (not (string-equal answer ""))) + answer + default)))) + +(defun LilyPond-command-master () + "Run command on the current document." + (interactive) + (LilyPond-command-select-master) + (LilyPond-command (LilyPond-command-query (LilyPond-get-master-file)) + 'LilyPond-get-master-file)) + +(defun LilyPond-command-lilypond () + "Run lilypond for the current document." + (interactive) + (LilyPond-command (LilyPond-command-menu "LilyPond") 'LilyPond-get-master-file) +) + +(defun LilyPond-command-formatps () + "Format the ps output of the current document." + (interactive) + (LilyPond-command (LilyPond-command-menu "2PS") 'LilyPond-get-master-file) +) + +(defun LilyPond-command-formatmidi () + "Format the midi output of the current document." + (interactive) + (LilyPond-command (LilyPond-command-menu "2Midi") 'LilyPond-get-master-file)) + +(defun LilyPond-command-view () + "View the output of current document." + (interactive) + (LilyPond-command-viewpdf)) + +(defun LilyPond-command-viewpdf () + "View the ps output of current document." + (interactive) + (LilyPond-command (LilyPond-command-menu "ViewPDF") 'LilyPond-get-master-file)) + +(defun LilyPond-command-viewps () + "View the ps output of current document." + (interactive) + (LilyPond-command (LilyPond-command-menu "ViewPS") 'LilyPond-get-master-file)) + +;; FIXME, this is broken +(defun LilyPond-region-file (begin end) + (let ( + ;; (dir "./") + (dir (LilyPond-temp-directory)) + (base LilyPond-region-file-prefix) + (ext LilyPond-file-extension)) + (concat dir base ext))) + +;;; Commands on Region work if there is an appropriate '\score'. +(defun LilyPond-command-region (begin end) + "Run LilyPond on the current region." + (interactive "r") + (if (or (> begin (point-min)) (< end (point-max))) + (LilyPond-command-select-region)) + (write-region begin end (LilyPond-region-file begin end) nil 'nomsg) + (LilyPond-command (LilyPond-command-query + (LilyPond-region-file begin end)) + '(lambda () (LilyPond-region-file begin end))) + ;; Region may deactivate even if buffer was intact, reactivate? + ;; Currently, also deactived regions are used. + ) + +(defun LilyPond-command-buffer () + "Run LilyPond on buffer." + (interactive) + (LilyPond-command-select-buffer) + (LilyPond-command-region (point-min) (point-max))) + +(defun LilyPond-command-expand (arg file) + (cond + ((listp arg) + (mapconcat (lambda (arg) (LilyPond-command-expand arg file)) + arg + "")) + ((and (symbolp arg) (boundp arg) + ;; Avoid self-quoting symbols + (not (eq (symbol-value arg) arg))) + (LilyPond-command-expand (symbol-value arg) file)) + ((stringp arg) + (let ((case-fold-search nil)) + (if (string-match "%" arg) + (let* ((b (match-beginning 0)) + (e (+ b 2)) + (l (split-file-name file)) + (dir (car l)) + (base (cadr l))) + (concat (substring arg 0 b) + (shell-quote-argument (concat dir base)) + (LilyPond-command-expand + (concat + (let ((entry (assoc (substring arg b e) + LilyPond-expand-alist))) + (if entry (cdr entry) "")) + (substring arg e)) + file))) + arg))) + (t (error "Bad expansion `%S'" arg)))) + +(defun LilyPond-shell-process (name buffer command) + (let ((old (current-buffer))) + (switch-to-buffer-other-window buffer) + ;; If we empty the buffer don't see messages scroll by. + ;; (erase-buffer) + + (start-process-shell-command name buffer command) + (switch-to-buffer-other-window old))) + + +(defun LilyPond-command (name file) + "Run command NAME on the file you get by calling FILE. + +FILE is a function return a file name. It has one optional argument, +the extension to use on the file. + +Use the information in LilyPond-command-alist to determine how to run the +command." + + (let ((entry (assoc name LilyPond-command-alist))) + (if entry + (let ((command (LilyPond-command-expand (cadr entry) + (apply file nil))) + (jobs nil) + (job-string "no jobs")) + (if (member name (list "View" "ViewPS")) + ;; is USR1 a right signal for viewps? + (let ((buffer-xdvi (get-buffer-create (concat "*" name "*")))) + ;; what if XEDITOR is set to gedit or so, should we steal it? + (if (not (getenv "XEDITOR")) + (setenv "XEDITOR" "emacsclient --no-wait +%l:%c %f")) + (if LilyPond-kick-xdvi + (let ((process-xdvi (get-buffer-process buffer-xdvi))) + (if process-xdvi + (signal-process (process-id process-xdvi) 'SIGUSR1) + (LilyPond-shell-process name buffer-xdvi command))) + (LilyPond-shell-process name buffer-xdvi command))) + (progn + (if (string-equal name "Midi") + (progn + (setq command (concat LilyPond-midi-command " " (LilyPond-string-current-midi))) + (if (LilyPond-kill-midi) + (setq job-string nil)))) ; either stop or start playing + (if (string-equal name "MidiAll") + (progn + (setq command (concat LilyPond-all-midi-command " " (LilyPond-string-all-midi))) + (LilyPond-kill-midi))) ; stop and start playing + (if (and (member name (list "Midi" "MidiAll")) job-string) + (if (file-newer-than-file-p + (LilyPond-get-master-file) + (concat (substring (LilyPond-get-master-file) 0 -3) ".midi")) + (if (y-or-n-p "Midi older than source. Reformat midi?") + (progn + (LilyPond-command-formatmidi) + (while (LilyPond-running) + (message "Starts playing midi once it is built.") + (sit-for 0 100)))))) + (if (member name (list "LilyPond" "TeX" "2Midi" "2PS" + "Book" "LaTeX")) + (if (setq jobs (LilyPond-running)) + (progn + (setq job-string "Process") ; could also suggest compiling after process has ended + (while jobs + (setq job-string (concat job-string " \"" (pop jobs) "\""))) + (setq job-string (concat job-string " is already running; kill it to proceed ")) + (if (y-or-n-p job-string) + (progn + (setq job-string "no jobs") + (LilyPond-kill-jobs) + (while (LilyPond-running) + (sit-for 0 100))) + (setq job-string nil))))) + + (setq LilyPond-command-next + (let* ((entry (assoc name LilyPond-command-alist)) + (next-command (nth 3 (cdr entry)))) + (or next-command + LilyPond-command-default))) + + (if (string-equal job-string "no jobs") + (LilyPond-compile-file command name)))))))) + +(defun LilyPond-mark-active () + "Check if there is an active mark." + (and transient-mark-mode + (if (string-match "XEmacs\\|Lucid" emacs-version) (mark) mark-active))) + +(defun LilyPond-temp-directory () + "Temporary file directory for Commands on Region." + (interactive) + (if (string-match "XEmacs\\|Lucid" emacs-version) + (concat (temp-directory) "/") + temporary-file-directory)) + +;;; Keymap + +(defvar LilyPond-mode-map () + "Keymap used in `LilyPond-mode' buffers.") + +;; Note: if you make changes to the map, you must do +;; M-x set-variable LilyPond-mode-map nil +;; M-x eval-buffer +;; M-x LilyPond-mode +;; to let the changest take effect + +(if LilyPond-mode-map + () + (setq LilyPond-mode-map (make-sparse-keymap)) + ;; Put keys to LilyPond-command-alist and fetch them from there somehow. + (define-key LilyPond-mode-map "\C-c\C-l" 'LilyPond-command-lilypond) + (define-key LilyPond-mode-map "\C-c\C-r" 'LilyPond-command-region) + (define-key LilyPond-mode-map "\C-c\C-b" 'LilyPond-command-buffer) + (define-key LilyPond-mode-map "\C-c\C-k" 'LilyPond-kill-jobs) + (define-key LilyPond-mode-map "\C-c\C-c" 'LilyPond-command-master) + (define-key LilyPond-mode-map "\C-cm" 'LilyPond-command-formatmidi) + (define-key LilyPond-mode-map "\C-c\C-f" 'LilyPond-command-formatps) + (define-key LilyPond-mode-map "\C-c\C-s" 'LilyPond-command-view) + (define-key LilyPond-mode-map "\C-c\C-p" 'LilyPond-command-viewps) + (define-key LilyPond-mode-map [(control c) return] 'LilyPond-command-current-midi) + (define-key LilyPond-mode-map [(control c) (control return)] 'LilyPond-command-all-midi) + (define-key LilyPond-mode-map "\C-x\C-s" 'LilyPond-save-buffer) + (define-key LilyPond-mode-map "\C-cb" 'LilyPond-what-beat) + (define-key LilyPond-mode-map "\C-cf" 'font-lock-fontify-buffer) + (define-key LilyPond-mode-map "\C-ci" 'LilyPond-insert-tag-current) + ;; the following will should be overridden by LilyPond Quick Insert Mode + (define-key LilyPond-mode-map "\C-cq" 'LilyPond-quick-insert-mode) + (define-key LilyPond-mode-map "\C-c;" 'LilyPond-comment-region) + (define-key LilyPond-mode-map ")" 'LilyPond-electric-close-paren) + (define-key LilyPond-mode-map ">" 'LilyPond-electric-close-paren) + (define-key LilyPond-mode-map "}" 'LilyPond-electric-close-paren) + (define-key LilyPond-mode-map "]" 'LilyPond-electric-close-paren) + (define-key LilyPond-mode-map "|" 'LilyPond-electric-bar) + (if (string-match "XEmacs\\|Lucid" emacs-version) + (define-key LilyPond-mode-map [iso-left-tab] 'LilyPond-autocompletion) + (define-key LilyPond-mode-map [(shift iso-lefttab)] 'LilyPond-autocompletion)) + (define-key LilyPond-mode-map "\C-c\t" 'LilyPond-info-index-search) + ) + +;;; Menu Support + +;;; This mode was originally LilyPond-quick-note-insert by Heikki Junes. +;;; The original version has been junked since CVS-1.97, +;;; in order to merge the efforts done by Nicolas Sceaux. +;;; LilyPond Quick Insert Mode is a major mode, toggled by C-c q. +(defun LilyPond-quick-insert-mode () + "Insert notes with fewer key strokes by using a simple keyboard piano." + (interactive) + (progn + (message "Invoke (C-c q) from keyboard. If you still see this message,") (sit-for 5 0) + (message "then you have not installed LilyPond Quick Insert Mode (lyqi).") (sit-for 5 0) + (message "Download lyqi from http://nicolas.sceaux.free.fr/lilypond/lyqi.html,") (sit-for 5 0) + (message "see installation instructions from lyqi's README -file.") (sit-for 5 0) + (message "You need also eieio (Enhanced Integration of Emacs Interpreted Objects).") (sit-for 5 0) + (message "Download eieio from http://cedet.sourceforge.net/eieio.shtml,") (sit-for 5 0) + (message "see installation instructions from eieio's INSTALL -file.") (sit-for 5 0) + (message "") + )) + +(defun LilyPond-pre-word-search () + "Fetch the alphabetic characters and \\ in front of the cursor." + (let ((pre "") + (prelen 0) + (ch (char-before (- (point) 0)))) + (while (and ch (or (and (>= ch 65) (<= ch 90)) ; not bolp, A-Z + (and (>= ch 97) (<= ch 122)) ; a-z + (= ch 92))) ; \\ + (setq pre (concat (char-to-string ch) pre)) + (setq prelen (+ prelen 1)) + (setq ch (char-before (- (point) prelen)))) + pre)) + +(defun LilyPond-post-word-search () + "Fetch the alphabetic characters behind the cursor." + (let ((post "") + (postlen 0) + (ch (char-after (+ (point) 0)))) + (while (and ch (or (and (>= ch 65) (<= ch 90)) ; not eolp, A-Z + (and (>= ch 97) (<= ch 122)))) ; a-z + (setq post (concat post (char-to-string ch))) + (setq postlen (+ postlen 1)) + (setq ch (char-after (+ (point) postlen)))) + post)) + +(defun LilyPond-autocompletion () + "Show completions in mini-buffer for the given word." + (interactive) + (let ((pre (LilyPond-pre-word-search)) + (post (LilyPond-post-word-search)) + (compsstr "")) + ;; insert try-completion and show all-completions + (if (> (length pre) 0) + (progn + (setq trycomp (try-completion pre (LilyPond-add-dictionary-word ()))) + (if (char-or-string-p trycomp) + (if (string-equal (concat pre post) trycomp) + (goto-char (+ (point) (length post))) + (progn + (delete-region (point) (+ (point) (length post))) + (insert (substring trycomp (length pre) nil)))) + (progn + (delete-region (point) (+ (point) (length post))) + (font-lock-fontify-buffer))) ; only inserting fontifies + + (setq complist (all-completions pre (LilyPond-add-dictionary-word ()))) + (while (> (length complist) 0) + (setq compsstr (concat compsstr "\"" (car complist) "\" ")) + (setq complist (cdr complist))) + (message compsstr) + (sit-for 0 100))))) + +(defun LilyPond-info () + "Launch Info for lilypond." + (interactive) + (info "lilypond-notation")) + +(defun LilyPond-music-glossary-info () + "Launch Info for music-glossary." + (interactive) + (info "music-glossary")) + +(defun LilyPond-internals-info () + "Launch Info for lilypond-internals." + (interactive) + (info "lilypond-internals")) + +(defun LilyPond-info-index-search () + "In `*info*'-buffer, launch `info lilypond --index-search word-under-cursor'" + (interactive) + (let ((str (concat (LilyPond-pre-word-search) (LilyPond-post-word-search)))) + (if (and (> (length str) 0) + (string-equal (substring str 0 1) "\\")) + (setq str (substring str 1 nil))) + (LilyPond-info) + (Info-index str))) + +(defun LilyPond-insert-tag-current (&optional word) + "Set the current tag to be inserted." + (interactive) + (if word + (setq LilyPond-insert-tag-current word)) + (if (memq LilyPond-insert-tag-current LilyPond-menu-keywords) + (LilyPond-insert-tag) + (message "No tag was selected from LilyPond->Insert tag-menu."))) + +(defun LilyPond-insert-tag () + "Insert syntax for given tag. The definitions are in LilyPond-words-filename." + (interactive) + (setq b (find-file-noselect (LilyPond-words-filename) t t)) + (let ((word LilyPond-insert-tag-current) + (found nil) + (p nil) + (query nil) + (m (set-marker (make-marker) 1 (get-buffer b))) + (distance (if (LilyPond-mark-active) + (abs (- (mark-marker) (point-marker))) 0)) + ) + ;; find the place first + (if (LilyPond-mark-active) + (goto-char (min (mark-marker) (point-marker)))) + (while (and (not found) (> (get-buffer-size b) (marker-position m))) + (setq copy (car (copy-alist (list (eval (symbol-name (read m))))))) + (if (string-equal word copy) (setq found t))) + (if found (insert word)) + (if (> (get-buffer-size b) (marker-position m)) + (setq copy (car (copy-alist (list (eval (symbol-name (read m)))))))) + (if (not (string-equal "-" copy)) + (setq found nil)) + (while (and found (> (get-buffer-size b) (marker-position m))) + ;; find next symbol + (setq copy (car (copy-alist (list (eval (symbol-name (read m))))))) + ;; check whether it is the word, or the word has been found + (cond + ((string-equal "-" copy) (setq found nil)) + ((string-equal "%" copy) (insert " " (read-string "Give Arguments: "))) + ((string-equal "_" copy) + (progn + (setq p (point)) + (goto-char (+ p distance)))) + ((string-equal "\?" copy) (setq query t)) + ((string-equal "\!" copy) (setq query nil)) + ((string-equal "\\n" copy) + (if (not query) + (progn (LilyPond-indent-line) (insert "\n") (LilyPond-indent-line)))) + ((string-equal "{" copy) + (if (not query) + (progn (insert " { ")))) + ((string-equal "}" copy) + (if (not query) + (progn (insert " } ") (setq query nil) ))) + ((not query) + (insert copy)) + (query + (if (y-or-n-p (concat "Proceed with `" copy "'? ")) + (progn (insert copy) (setq query nil)))) + )) + (if p (goto-char p)) + (kill-buffer b)) +) + +(defun LilyPond-command-menu-entry (entry) + ;; Return LilyPond-command-alist ENTRY as a menu item. + (let ((name (car entry))) + (cond ((and (string-equal name LilyPond-command-Print) + LilyPond-printer-list) + (let ((command LilyPond-print-command) + (lookup 1)) + (append (list LilyPond-command-Print) + (mapcar 'LilyPond-command-menu-printer-entry + LilyPond-printer-list)))) + (t + (vector name (list 'LilyPond-command-menu name) t))))) + + +(easy-menu-define LilyPond-command-menu + LilyPond-mode-map + "Menu used in LilyPond mode." + (append '("Command") + '(("Command on" + [ "Master File" LilyPond-command-select-master + :keys "C-c C-c" :style radio + :selected (eq LilyPond-command-current 'LilyPond-command-master) ] + [ "Buffer" LilyPond-command-select-buffer + :keys "C-c C-b" :style radio + :selected (eq LilyPond-command-current 'LilyPond-command-buffer) ] + [ "Region" LilyPond-command-select-region + :keys "C-c C-r" :style radio + :selected (eq LilyPond-command-current 'LilyPond-command-region) ])) +;;; (let ((file 'LilyPond-command-on-current)) +;;; (mapcar 'LilyPond-command-menu-entry LilyPond-command-alist)) +;;; Some kind of mapping which includes :keys might be more elegant +;;; Put keys to LilyPond-command-alist and fetch them from there somehow. + '([ "LilyPond" LilyPond-command-lilypond t]) + '([ "2PS" LilyPond-command-formatps t]) + '([ "2Midi" LilyPond-command-formatmidi t]) + '([ "Book" (LilyPond-command (LilyPond-command-menu "Book") 'LilyPond-get-master-file) ]) + '([ "LaTeX" (LilyPond-command (LilyPond-command-menu "LaTeX") 'LilyPond-get-master-file) ]) + '([ "Kill jobs" LilyPond-kill-jobs t]) + '("-----") + '([ "View" LilyPond-command-view t]) + '([ "ViewPS" LilyPond-command-viewps t]) + '("-----") + '([ "Midi (toggle)" LilyPond-command-current-midi t]) + '([ "Midi all" LilyPond-command-all-midi t]) + )) + +(defun LilyPond-menu-keywords-item (arg) + "Make vector for LilyPond-mode-keywords." + (vector arg (list 'LilyPond-insert-tag-current arg) :style 'radio :selected (list 'eq 'LilyPond-insert-tag-current arg))) + +(defun LilyPond-menu-keywords () + "Make Insert Tag menu. + +The Insert Tag -menu is split into parts if it is long enough." + + (let ((li (mapcar 'LilyPond-menu-keywords-item LilyPond-menu-keywords)) + (w (round (sqrt (length LilyPond-menu-keywords)))) + (split '()) + (imin 0) imax lw rw) + (while (< imin (length LilyPond-menu-keywords)) + (setq imax (- (min (+ imin w) (length LilyPond-menu-keywords)) 1)) + (setq lw (nth imin LilyPond-menu-keywords)) + (setq rw (nth imax LilyPond-menu-keywords)) + (add-to-list 'split + (let ((l (list (concat (substring lw 0 (min 7 (length lw))) + " ... " + (substring rw 0 (min 7 (length rw))))))) + (while (<= imin imax) + (add-to-list 'l (nth imin li)) + (setq imin (1+ imin))) + (reverse l)))) + (if (> (length LilyPond-menu-keywords) 12) (reverse split) li))) + +;;; LilyPond-mode-menu should not be interactive, via "M-x LilyPond-" +(easy-menu-define LilyPond-mode-menu + LilyPond-mode-map + "Menu used in LilyPond mode." + (append '("LilyPond") + '(["Add index menu" LilyPond-add-imenu-menu]) + (list (cons "Insert tag" + (cons ["Previously selected" LilyPond-insert-tag-current t] + (cons "-----" + (LilyPond-menu-keywords))))) + '(("Miscellaneous" + ["Autocompletion" LilyPond-autocompletion t] + ["(Un)comment Region" LilyPond-comment-region t] + ["Refontify buffer" font-lock-fontify-buffer t] + "-----" + ["Quick Insert Mode" LilyPond-quick-insert-mode :keys "C-c q"] + )) + '(("Info" + ["LilyPond" LilyPond-info t] + ["LilyPond index-search" LilyPond-info-index-search t] + ["Music Glossary" LilyPond-music-glossary-info t] + ["LilyPond internals" LilyPond-internals-info t] + )) + )) + +(defconst LilyPond-imenu-generic-re "^\\([a-zA-Z]+\\) *=" + "Regexp matching Identifier definitions.") + +(defvar LilyPond-imenu-generic-expression + (list (list nil LilyPond-imenu-generic-re 1)) + "Expression for imenu") + +(defun LilyPond-command-select-master () + (interactive) + (message "Next command will be on the master file") + (setq LilyPond-command-current 'LilyPond-command-master)) + +(defun LilyPond-command-select-buffer () + (interactive) + (message "Next command will be on the buffer") + (setq LilyPond-command-current 'LilyPond-command-buffer)) + +(defun LilyPond-command-select-region () + (interactive) + (message "Next command will be on the region") + (setq LilyPond-command-current 'LilyPond-command-region)) + +(defun LilyPond-command-menu (name) + ;; Execute LilyPond-command-alist NAME from a menu. + (let ((LilyPond-command-force name)) + (if (eq LilyPond-command-current 'LilyPond-command-region) + (if (eq (mark t) nil) + (progn (message "The mark is not set now") (sit-for 0 500)) + (progn (if (not (not (LilyPond-mark-active))) + (progn (message "Region is not active, using region between inactive mark and current point.") (sit-for 0 500))) + (LilyPond-command-region (mark t) (point)))) + (funcall LilyPond-command-current)))) + +(defun LilyPond-add-imenu-menu () + (interactive) + "Add an imenu menu to the menubar." + (if (not LilyPond-imenu) + (progn + (imenu-add-to-menubar "Index") + (redraw-frame (selected-frame)) + (setq LilyPond-imenu t)) + (message "%s" "LilyPond-imenu already exists."))) +(put 'LilyPond-add-imenu-menu 'menu-enable '(not LilyPond-imenu)) + +(define-derived-mode LilyPond-mode prog-mode "LilyPond-mode" + "Major mode for editing LilyPond music files. + +This mode knows about LilyPond keywords and line comments, not about +indentation or block comments. It features easy compilation, error +finding and viewing of a LilyPond source buffer or region. + +COMMANDS +\\{LilyPond-mode-map} +VARIABLES + +LilyPond-command-alist\t\talist from name to command" + ;; set up local variables + (kill-all-local-variables) + + (make-local-variable 'font-lock-defaults) + (setq font-lock-defaults '(LilyPond-font-lock-keywords)) + + ;; string and comments are fontified explicitly + (make-local-variable 'font-lock-keywords-only) + (setq font-lock-keywords-only t) + + ;; Multi-line font-locking needs Emacs 21.1 or newer. + ;; For older versions there is hotkey "C-c f". + (make-local-variable 'font-lock-multiline) + (setq font-lock-multiline t) + + (make-local-variable 'paragraph-separate) + (setq paragraph-separate "^[ \t]*$") + + (make-local-variable 'paragraph-start) + (setq paragraph-start "^[ \t]*$") + + (make-local-variable 'comment-start) + (setq comment-start "%") + + (make-local-variable 'comment-start-skip) + (setq comment-start-skip "%{? *") + + (make-local-variable 'comment-end) + (setq comment-end "") + + (make-local-variable 'block-comment-start) + (setq block-comment-start "%{") + + (make-local-variable 'block-comment-end) + (setq block-comment-end "%}") + + (make-local-variable 'indent-line-function) + (setq indent-line-function 'LilyPond-indent-line) + + (LilyPond-mode-set-syntax-table '(?\< ?\> ?\{ ?\})) + (setq major-mode 'LilyPond-mode) + (setq mode-name "LilyPond") + (setq local-abbrev-table LilyPond-mode-abbrev-table) + (use-local-map LilyPond-mode-map) + + ;; In XEmacs imenu was synched up with: FSF 20.4 + (make-local-variable 'imenu-generic-expression) + (setq imenu-generic-expression LilyPond-imenu-generic-expression) + ;; (imenu-add-to-menubar "Index") ; see LilyPond-add-imenu-menu + + ;; In XEmacs one needs to use 'easy-menu-add'. + (if (string-match "XEmacs\\|Lucid" emacs-version) + (progn + (easy-menu-add LilyPond-mode-menu) + (easy-menu-add LilyPond-command-menu))) + + ;; Use Command on Region even for inactive mark (region). + (if (string-match "XEmacs\\|Lucid" emacs-version) + (progn + (setq zmacs-regions nil) + (make-local-hook 'post-command-hook)) ; XEmacs requires + (setq mark-even-if-inactive t)) + + ;; Context dependent syntax tables in LilyPond-mode + (add-hook 'post-command-hook 'LilyPond-mode-context-set-syntax-table nil t) + + ;; Turn on paren-mode buffer-locally, i.e., in LilyPond-mode + (if (string-match "XEmacs\\|Lucid" emacs-version) + (progn + (make-local-variable 'paren-mode) + (paren-set-mode 'paren) + (make-local-variable 'blink-matching-paren) + (setq blink-matching-paren t) + ) + (progn + (make-local-variable 'blink-matching-paren-on-screen) + (setq blink-matching-paren-on-screen t) + )) + + ;; run the mode hook. LilyPond-mode-hook use is deprecated + (run-hooks 'LilyPond-mode-hook)) + +(defun LilyPond-version () + "Echo the current version of `LilyPond-mode' in the minibuffer." + (interactive) + (message "Using `LilyPond-mode' version %s" LilyPond-version)) + +(load-library "lilypond-font-lock") +(load-library "lilypond-indent") +(load-library "lilypond-what-beat") + +(defun LilyPond-guile () + (interactive) + (require 'ilisp) + (guile "lilyguile" (LilyPond-command-expand (cadr (assoc "LilyPond" LilyPond-command-alist)) + (funcall 'LilyPond-get-master-file))) + (comint-default-send (ilisp-process) "(define-module (*anonymous-ly-0*))") + (comint-default-send (ilisp-process) "(set! %load-path (cons \"/usr/share/ilisp/\" %load-path))") + (comint-default-send (ilisp-process) "(use-modules (guile-user) (guile-ilisp))") + (comint-default-send (ilisp-process) "(newline)")) + +(provide 'lilypond-mode) +;;; lilypond-mode.el ends here diff --git a/lilypond-2.24.2/share/emacs/site-lisp/lilypond-song.el b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-song.el new file mode 100644 index 0000000000000000000000000000000000000000..e792bb17c53a373a67d6db7841669062684b64d4 --- /dev/null +++ b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-song.el @@ -0,0 +1,556 @@ +;;;; lilypond-song.el --- Emacs support for LilyPond singing +;;;; +;;;; This file is part of LilyPond, the GNU music typesetter. +;;;; +;;;; Copyright (C) 2006--2022 Brailcom, o.p.s. +;;;; Author: Milan Zamazal +;;;; +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. +;;;; +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . + +;;; Commentary: + +;; This file adds Emacs support for singing lyrics of LilyPond files. +;; It extends lilypond-mode with the following commands (see their +;; documentation for more information): +;; +;; - M-x LilyPond-command-sing (C-c C-a) +;; - M-x LilyPond-command-sing-and-play (C-c C-q) +;; - M-x LilyPond-command-sing-last (C-c C-z) +;; +;; Note these commands are not available from the standard LilyPond mode +;; command menus. + +;;; Code: + + +(require 'cl) +(require 'lilypond-mode) + +(ignore-errors (require 'ecasound)) + + +;;; User options + + +(defcustom LilyPond-synthesize-command "lilysong" + "Command used to sing LilyPond files." + :group 'LilyPond + :type 'string) + +(defcustom LilyPond-play-command (or (executable-find "ecaplay") "play") + "Command used to play WAV files." + :group 'LilyPond + :type 'string) + +;; In case you would like to use fluidsynth (not recommended as fluidsynth +;; can perform wave file synthesis only in real time), you can use the +;; following setting: +;; (setq LilyPond-midi->wav-command "fluidsynth -nil -a file soundfont.sf2 '%s' && sox -t raw -s -r 44100 -w -c 2 fluidsynth.raw '%t'") +(defcustom LilyPond-midi->wav-command "timidity -Ow %m -s %r -o '%t' '%s'" + "Command used to make a WAV file from a MIDI file. +%s in the string is replaced with the source MIDI file name, +%t is replaced with the target WAV file name. +%r is replaced with rate. +%m is replaced with lilymidi call." + :group 'LilyPond + :type 'string) + +(defcustom LilyPond-voice-rates + '((".*czech.*" . 44100) + (".*\\\\|nnish\\).*" . 22050) + (".*" . 16000)) + "Alist of regexps matching voices and the corresponding voice rates. +It may be necessary to define proper voice rates here in order to +avoid ecasound resampling problems." + :group 'LilyPond + :type '(alist :key-type regexp :value-type integer)) + +(defcustom LilyPond-use-ecasound (and (featurep 'ecasound) + (executable-find "ecasound") + t) + "If non-nil, use ecasound for mixing and playing songs." + :group 'LilyPond + :type 'boolean) + +(defcustom LilyPond-voice-track-regexp "voice" + "Perl regexp matching names of MIDI tracks to be ignored on sing&play." + :group 'LilyPond + :type 'string) + +(defcustom LilyPond-lilymidi-command "\"`lilymidi --prefix-tracks -Q --filter-tracks '%s' '%f'`\"" + "Command to insert into LilyPond-midi->wav-command calls. +%f is replaced with the corresponding MIDI file name. +%s is replaced with `LilyPond-voice-track-regexp'." + :group 'LilyPond + :type 'string) + + +;;; Lyrics language handling + + +(defvar lilysong-language nil) +(make-variable-buffer-local 'lilysong-language) + +(defvar lilysong-last-language nil) +(make-variable-buffer-local 'lilysong-last-language) + +(defvar lilysong-languages '("cs" "en")) + +(defvar lilysong-voices nil) + +(defun lilysong-voices () + (or lilysong-voices + (with-temp-buffer + (call-process "lilysong" nil t nil "--list-voices") + (call-process "lilysong" nil t nil "--list-languages") + (goto-char (point-min)) + (while (not (eobp)) + (push (buffer-substring-no-properties + (line-beginning-position) (line-end-position)) + lilysong-voices) + (forward-line)) + lilysong-voices))) + +(defun lilysong-change-language () + "Change synthesis language or voice of the current document." + (interactive) + (setq lilysong-language + (completing-read "Lyrics language or voice: " + (mapcar 'list (lilysong-voices))))) + +(defun lilysong-update-language () + (unless lilysong-language + (lilysong-change-language))) + + +;;; Looking for \festival* and \midi commands + + +(defun lilysong-document-files () + (let ((resulting-files ()) + (stack (list (LilyPond-get-master-file)))) + (while (not (null stack)) + (let ((file (expand-file-name (pop stack)))) + (when (and (file-exists-p file) + (not (member file resulting-files))) + (push file resulting-files) + (save-excursion + (save-restriction + (set-buffer (find-file-noselect file nil)) + (widen) + (goto-char (point-min)) + (while (re-search-forward "^[^%\n]*\\\\include +\"\\([^\"]+\\)\"" nil t) + (push (match-string 1) stack))))))) + (nreverse resulting-files))) + +(defvar lilysong-festival-command-regexp + "^[^%\n]*\\\\festival\\(syl\\)? +#\"\\([^\"]+\\)\"") + +(defun lilysong-find-song (direction) + "Find XML file name of the nearest Festival command in the given DIRECTION. +DIRECTION is one of the symbols `forward' or `backward'. +If no Festival command is found in the current buffer, return nil. +The point is left at the position where the command occurrence was found." + (save-match-data + (when (funcall (if (eq direction 'backward) + 're-search-backward + 're-search-forward) + lilysong-festival-command-regexp nil t) + (match-string-no-properties 2)))) + +(defun lilysong-current-song () + "Return the XML file name corresponding to the song around current point. +If there is none, return nil." + (save-excursion + (or (progn (end-of-line) (lilysong-find-song 'backward)) + (progn (beginning-of-line) (lilysong-find-song 'forward))))) + +(defun lilysong-all-songs (&optional limit-to-region) + "Return list of XML file names of the song commands in the current buffer. +If there are none, return an empty list. +If LIMIT-TO-REGION is non-nil, look for the commands in the current region +only." + (let ((result '()) + (current nil)) + (save-excursion + (save-restriction + (when limit-to-region + (narrow-to-region (or (mark) (point)) (point))) + (goto-char (point-min)) + (while (setq current (lilysong-find-song 'forward)) + (push current result)))) + (nreverse result))) + +(defun lilysong-walk-files (collector) + (save-excursion + (mapcar (lambda (f) + (set-buffer (find-file-noselect f)) + (funcall collector)) + (lilysong-document-files)))) + +(defun lilysong-all-songs* () + "Return list of XML file names of the song commands in the current document." + (remove-duplicates (apply #'append (lilysong-walk-files #'lilysong-all-songs)) + :test #'equal)) + +(defvar lilysong-song-history nil) +(make-variable-buffer-local 'lilysong-song-history) + +(defvar lilysong-last-song-list nil) +(make-variable-buffer-local 'lilysong-last-song-list) + +(defvar lilysong-last-command-args nil) +(make-variable-buffer-local 'lilysong-last-command-args) + +(defun lilysong-song-list (multi) + (cond + ((eq multi 'all) + (lilysong-all-songs*)) + (multi + (lilysong-select-songs)) + (t + (lilysong-select-single-song)))) + +(defun lilysong-select-single-song () + (let ((song (lilysong-current-song))) + (if song + (list song) + (error "No song found")))) + +(defun lilysong-select-songs () + (let* ((all-songs (lilysong-all-songs*)) + (available-songs all-songs) + (initial-songs (if (or (not lilysong-last-song-list) + (eq LilyPond-command-current + 'LilyPond-command-region)) + (lilysong-all-songs t) + lilysong-last-song-list)) + (last-input (completing-read + (format "Sing file%s: " + (if initial-songs + (format " (default `%s')" + (mapconcat 'identity initial-songs + ", ")) + "")) + (mapcar 'list all-songs) + nil t nil + 'lilysong-song-history))) + (if (equal last-input "") + initial-songs + (let ((song-list '()) + default-input) + (while (not (equal last-input "")) + (push last-input song-list) + (setq default-input (second (member last-input available-songs))) + (setq available-songs (remove last-input available-songs)) + (setq last-input (completing-read "Sing file: " + (mapcar #'list available-songs) + nil t default-input + 'lilysong-song-history))) + (setq lilysong-last-song-list (nreverse song-list)))))) + +(defun lilysong-count-midi-words () + (count-rexp (point-min) (point-max) "^[^%]*\\\\midi")) + +(defun lilysong-midi-list (multi) + (if multi + (let ((basename (file-name-sans-extension (buffer-file-name))) + (count (apply #'+ (save-match-data + (lilysong-walk-files #'lilysong-count-midi-words)))) + (midi-files '())) + (while (> count 0) + (setq count (1- count)) + (if (= count 0) + (push (concat basename ".midi") midi-files) + (push (format "%s-%d.midi" basename count) midi-files))) + midi-files) + (list (LilyPond-string-current-midi)))) + + +;;; Compilation + + +(defun lilysong-file->wav (filename &optional extension) + (format "%s.%s" (save-match-data + (if (string-match "\\.midi$" filename) + filename + (file-name-sans-extension filename))) + (or extension "wav"))) + +(defun lilysong-file->ewf (filename) + (lilysong-file->wav filename "ewf")) + +(defstruct lilysong-compilation-data + command + makefile + buffer + songs + midi + in-parallel) +(defvar lilysong-compilation-data nil) +(defun lilysong-sing (songs &optional midi-files in-parallel) + (setq lilysong-last-command-args (list songs midi-files in-parallel)) + (lilysong-update-language) + (add-to-list 'compilation-finish-functions 'lilysong-after-compilation) + (setq songs (mapcar #'expand-file-name songs)) + (let* ((makefile (lilysong-makefile (current-buffer) songs midi-files)) + (command (format "make -f %s" makefile))) + (setq lilysong-compilation-data + (make-lilysong-compilation-data + :command command + :makefile makefile + :buffer (current-buffer) + :songs songs + :midi midi-files + :in-parallel in-parallel)) + (save-some-buffers (not compilation-ask-about-save)) + (unless (equal lilysong-language lilysong-last-language) + (mapc #'(lambda (f) (when (file-exists-p f) (delete-file f))) + (append songs (mapcar 'lilysong-file->wav midi-files)))) + (if (lilysong-up-to-date-p makefile) + (lilysong-process-generated-files lilysong-compilation-data) + (compile command)))) + +(defun lilysong-up-to-date-p (makefile) + (equal (call-process "make" nil nil nil "-f" makefile "-q") 0)) + +(defun lilysong-makefile (buffer songs midi-files) + (let ((temp-file (make-temp-file "Makefile.lilysong-el")) + (language lilysong-language)) + (with-temp-file temp-file + (let ((source-files (save-excursion + (set-buffer buffer) + (lilysong-document-files))) + (master-file (save-excursion + (set-buffer buffer) + (LilyPond-get-master-file))) + (lilyfiles (append songs midi-files))) + (insert "all:") + (dolist (f (mapcar 'lilysong-file->wav (append songs midi-files))) + (insert " " f)) + (insert "\n") + (when lilyfiles + (dolist (f songs) + (insert f " ")) + (when midi-files + (dolist (f midi-files) + (insert f " "))) + (insert ": " master-file "\n") + (insert "\t" LilyPond-lilypond-command " " master-file "\n") + (dolist (f songs) + (insert (lilysong-file->wav f) ": " f "\n") + (insert "\t" LilyPond-synthesize-command " $< " (or language "") "\n")) + ;; We can't use midi files in ecasound directly, because setpos + ;; doesn't work on them. + (let ((lilymidi LilyPond-lilymidi-command) + (voice-rate (format "%d" (or (cdr (assoc-if (lambda (key) (string-match key language)) + LilyPond-voice-rates)) + 16000)))) + (when (string-match "%s" lilymidi) + (setq lilymidi (replace-match LilyPond-voice-track-regexp nil nil lilymidi))) + (dolist (f midi-files) + (insert (lilysong-file->wav f) ": " f "\n") + (let ((command LilyPond-midi->wav-command) + (lilymidi* lilymidi)) + (when (string-match "%s" command) + (setq command (replace-match f nil nil command))) + (when (string-match "%t" command) + (setq command (replace-match (lilysong-file->wav f) nil nil command))) + (when (string-match "%r" command) + (setq command (replace-match voice-rate nil nil command))) + (when (string-match "%f" lilymidi*) + (setq lilymidi (replace-match f nil nil lilymidi*))) + (when (string-match "%m" command) + (setq command (replace-match lilymidi nil nil command))) + (insert "\t" command "\n"))) + )))) + temp-file)) + +(defun lilysong-after-compilation (buffer message) + (let ((data lilysong-compilation-data)) + (when (and data + (equal compile-command + (lilysong-compilation-data-command data))) + (unwind-protect + (when (lilysong-up-to-date-p (lilysong-compilation-data-makefile data)) + (lilysong-process-generated-files data)) + (delete-file (lilysong-compilation-data-makefile data)))))) + +(defun lilysong-process-generated-files (data) + (with-current-buffer (lilysong-compilation-data-buffer data) + (setq lilysong-last-language lilysong-language)) + (lilysong-play-files (lilysong-compilation-data-in-parallel data) + (lilysong-compilation-data-songs data) + (lilysong-compilation-data-midi data))) + + +;;; Playing files + + +(defun lilysong-play-files (in-parallel songs midi-files) + (funcall (if LilyPond-use-ecasound + 'lilysong-play-with-ecasound + 'lilysong-play-with-play) + in-parallel songs midi-files)) + +(defun lilysong-call-play (files) + (apply 'start-process "lilysong-el" nil LilyPond-play-command files)) + +(defun lilysong-play-with-play (in-parallel songs midi-files) + (let ((files (mapcar 'lilysong-file->wav (append songs midi-files)))) + (if in-parallel + (dolist (f files) + (lilysong-call-play (list f))) + (lilysong-call-play files)))) + +(defun lilysong-make-ewf-files (files) + (let ((offset 0.0)) + (dolist (f files) + (let* ((wav-file (lilysong-file->wav f)) + (length (with-temp-buffer + (call-process "ecalength" nil t nil "-s" wav-file) + (goto-char (point-max)) + (forward-line -1) + (read (current-buffer))))) + (with-temp-file (lilysong-file->ewf f) + (insert "source = " wav-file "\n") + (insert (format "offset = %s\n" offset)) + (insert "start-position = 0.0\n") + (insert (format "length = %s\n" length)) + (insert "looping = false\n")) + (setq offset (+ offset length)))))) + +(when (and (featurep 'ecasound) + (not (fboundp 'eci-cs-set-param))) + (defeci cs-set-param ((parameter "sChainsetup option: " "%s")))) + +(defun lilysong-play-with-ecasound (in-parallel songs midi-files) + (ecasound) + (eci-cs-add "lilysong-el") + (eci-cs-select "lilysong-el") + (eci-cs-remove) + (eci-cs-add "lilysong-el") + (eci-cs-select "lilysong-el") + (eci-cs-set-param "-z:mixmode,sum") + (unless in-parallel + (lilysong-make-ewf-files songs) + ;; MIDI files should actually start with each of the songs + (mapc 'lilysong-make-ewf-files (mapcar 'list midi-files))) + (let* ((file->wav (if in-parallel 'lilysong-file->wav 'lilysong-file->ewf)) + (files (mapcar file->wav (append songs midi-files)))) + (dolist (f files) + (eci-c-add f) + (eci-c-select f) + (eci-ai-add f)) + (eci-c-select-all) + (eci-ao-add-default) + (let* ((n (length songs)) + (right (if (<= n 1) 50 0)) + (step (if (<= n 1) 0 (/ 100.0 (1- n))))) + (dolist (f songs) + (let ((chain (funcall file->wav f))) + (eci-c-select chain) + (eci-cop-add "-erc:1,2") + (eci-cop-add (format "-epp:%f" (min right 100))) + (incf right step)))) + (eci-start))) + + +;;; User commands + + +(defun lilysong-arg->multi (arg) + (cond + ((not arg) + nil) + ((or + (numberp arg) + (equal arg '(4))) + t) + (t + 'all))) + +(defun lilysong-command (arg play-midi?) + (let* ((multi (lilysong-arg->multi arg)) + (song-list (lilysong-song-list multi)) + (midi-list (if play-midi? (lilysong-midi-list multi)))) + (message "Singing %s" (mapconcat 'identity song-list ", ")) + (lilysong-sing song-list midi-list (if play-midi? t (listp arg))))) + +(defun LilyPond-command-sing (&optional arg) + "Sing lyrics of the current LilyPond buffer. +Without any prefix argument, sing current \\festival* command. +With the universal prefix argument, ask which parts to sing. +With a double universal prefix argument, sing all the parts. +With a numeric prefix argument, ask which parts to sing and sing them +sequentially rather than in parallel." + (interactive "P") + (lilysong-command arg nil)) + +(defun LilyPond-command-sing-and-play (&optional arg) + "Sing lyrics and play midi of the current LilyPond buffer. +Without any prefix argument, sing and play current \\festival* and \\midi +commands. +With the universal prefix argument, ask which parts to sing and play. +With a double universal prefix argument, sing and play all the parts." + (interactive "P") + (lilysong-command arg t)) + +(defun LilyPond-command-sing-last () + "Repeat last LilyPond singing command." + (interactive) + (if lilysong-last-command-args + (apply 'lilysong-sing lilysong-last-command-args) + (error "No previous singing command"))) + +(defun LilyPond-command-clean () + "Remove generated *.xml and *.wav files used for singing." + (interactive) + (flet ((delete-file* (file) + (when (file-exists-p file) + (delete-file file)))) + (dolist (xml-file (lilysong-song-list 'all)) + (delete-file* xml-file) + (delete-file* (lilysong-file->wav xml-file))) + (mapc 'delete-file* (mapcar 'lilysong-file->wav (lilysong-midi-list 'all))))) + +(define-key LilyPond-mode-map "\C-c\C-a" 'LilyPond-command-sing) +(define-key LilyPond-mode-map "\C-c\C-q" 'LilyPond-command-sing-and-play) +(define-key LilyPond-mode-map "\C-c\C-x" 'LilyPond-command-clean) +(define-key LilyPond-mode-map "\C-c\C-z" 'LilyPond-command-sing-last) + +(easy-menu-add-item LilyPond-command-menu nil + ["Sing Current" LilyPond-command-sing t]) +(easy-menu-add-item LilyPond-command-menu nil + ["Sing Selected" (LilyPond-command-sing '(4)) t]) +(easy-menu-add-item LilyPond-command-menu nil + ["Sing All" (LilyPond-command-sing '(16)) t]) +(easy-menu-add-item LilyPond-command-menu nil + ["Sing Selected Sequentially" (LilyPond-command-sing 1) t]) +(easy-menu-add-item LilyPond-command-menu nil + ["Sing and Play Current" LilyPond-command-sing-and-play t]) +(easy-menu-add-item LilyPond-command-menu nil + ["Sing and Play Selected" (LilyPond-command-sing-and-play '(4)) t]) +(easy-menu-add-item LilyPond-command-menu nil + ["Sing and Play All" (LilyPond-command-sing-and-play '(16)) t]) +(easy-menu-add-item LilyPond-command-menu nil + ["Sing Last" LilyPond-command-sing-last t]) + + +;;; Announce + +(provide 'lilypond-song) + + +;;; lilypond-song.el ends here diff --git a/lilypond-2.24.2/share/emacs/site-lisp/lilypond-what-beat.el b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-what-beat.el new file mode 100644 index 0000000000000000000000000000000000000000..5846b19d32d27747d9e32332cd93e7c042d1ac9e --- /dev/null +++ b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-what-beat.el @@ -0,0 +1,279 @@ +;;;; lilypond-what-beat.el --- Emacs support for checking beats and bar checks. +;;;; +;;;; This file is part of LilyPond, the GNU music typesetter. +;;;; +;;;; Copyright (C) 2011--2022 Trevor Daniels +;;;; +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. +;;;; +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . +; +; Features: +; +; -> Counts number of notes between last | and point. Adds durations of +; each note up, and returns result. +; +; -> Works well on notes and chords. +; +; -> Ignores most keywords, like \override +; +; -> Is aware of certain keywords which often contain parameters that +; look like notes, but should not be counted. +; | a \key b \minor c % b is not counted, but a and c are. +; +; -> Ignores Scheme expressions, which start with # +; +; -> Doesn't ignore the \times keyword. Intelligently handles triplets. +; +; +; Caveats: +; +; -> Doesn't work on regions that aren't preceded by a |. This is because such +; notes are only delimited by a {, and what-beat can't distinguish a { that +; opens a set of notes from an internal { (say from a triplet) +; +; -> Doesn't work with << >> expressions or nested {} expressions (unless +; {} is part of a keyword like \times) +; +; -> Keywords abutted against a note are not visible to what-beat, and +; can therefore surreptitiosly sneak fake notes into what-beat. +; | c\glissando f <- BAD: the f gets counted, but shouldn't +; | c \glissando f <- GOOD: the f gets ignored +; +; -> Does not look outside notes context. Derivation rules don't work: +; str = \notes { a8 b c d } +; \score { \notes { | e4 %{ gets counted }% \str %{gets ignored}% +; +; -> Does not handle repeats. +; +; -> Ignores \bar commands (and does not get confused by a | inside a \bar) +; + +; Recognizes pitch & octave +(setq pitch-regex "\\([a-z]+[,']*\\|<[^>]*>\\)\\(=[,']*\\)?") +; Recognizes duration +(setq duration-regex "[ \t\n]*\\(\\(\\(128\\|6?4\\|3?2\\|16?\\|8\\)\\([.]*\\)\\)\\([ \t]*[*][ \t]*\\([0-9]+\\)\\(/\\([1-9][0-9]*\\)\\)?\\)?\\)") + +; These keywords precede notes that should not be counted during beats +(setq Parm-Keywords '("key" "clef" "appoggiatura" "acciaccatura" "grace" + "override" "revert" "glissando")) + + +(defun extract-match (string match-num) + (if (null (match-beginning match-num)) + nil + (substring string (match-beginning match-num) (match-end match-num)))) + + +(defun add-fractions (f1 f2) + "Adds two fractions, both are (numerator denominator)" + (setq result (list (+ (* (car f1) (cadr f2)) (* (car f2) (cadr f1))) + (* (cadr f1) (cadr f2)))) + (setq result (reduce-fraction result 2)) + (setq result (reduce-fraction result 3)) + (setq result (reduce-fraction result 5)) + (setq result (reduce-fraction result 7)) +) + + +(defun reduce-fraction (f divisor) + "Eliminates divisor from fraction if present" + (while (and (= 0 (% (car result) divisor)) + (= 0 (% (cadr result) divisor)) + (< 1 (cadr result)) + (< 0 (car result))) + (setq result (list (/ (car result) divisor) (/ (cadr result) divisor)))) + result +) + + +(defun parse-duration (duration) + "Returns a duration string parsed as '(numerator denominator)" + (string-match duration-regex duration) + (let ((result (list 1 (string-to-number (extract-match duration 2)))) + (dots (extract-match duration 4)) + (numerator (or (extract-match duration 6) "1")) + (denominator (or (extract-match duration 8) "1"))) + (if (and (not (null dots)) (< 0 (string-width dots))) + (dotimes (dummy (string-width dots)) + (setq result (list (1+ (* 2 (car result))) (* 2 (cadr result)))))) + (list (* (string-to-number numerator) (car result)) + (* (string-to-number denominator) (cadr result))) +)) + +(defun walk-note-duration () + "Returns duration of next note, moving point past note. +If point is not before a note, returns nil +If next note has no duration, returns t" + (let ((have-pitch (looking-at pitch-regex))) + (if have-pitch (goto-char (match-end 0))) + (if (not (looking-at duration-regex)) + have-pitch + (goto-char (match-end 0)) + (parse-duration (match-string 0))))) + +; returns nil if not at a comment +(defun skip-comment () + (if (not (char-equal ?\% (following-char))) + nil + (progn + (forward-char) + (if (char-equal ?\{ (following-char)) + (re-search-forward "}%" nil t) + (progn + (skip-chars-forward "^\n") + (forward-char))) + t +))) + +; returns nil if not at a quotation +(defun skip-quotation () + (if (not (char-equal ?\" (following-char))) + nil + (progn + (forward-char) + (skip-chars-forward "^\"") + (forward-char) + t +))) + +; returns nil if not at a sexp +(defun skip-sexp () + (interactive) + (if (not (char-equal ?\# (following-char))) + nil + (progn + (forward-char) + (if (char-equal ?\' (following-char)) + (forward-char)) + (if (not (char-equal ?\( (following-char))) + (skip-chars-forward "^ \t\n") + (progn + (let ((paren 1)) + (while (< 0 paren) + (forward-char) + (cond ((char-equal ?\( (following-char)) + (setq paren (1+ paren))) + ((char-equal ?\) (following-char)) + (setq paren (1- paren))))) + (forward-char) + t +)))))) + +(defun goto-note-begin () + (interactive) + ; skip anything that is not ws. And skip any comments or quotations + (while (or (< 0 (skip-chars-forward "^ \t\n~%#\"")) + (skip-comment) + (skip-quotation) + (skip-sexp))) + ; Now skip anything that isn't alphanum or \. And skip comments or quotations + (while (or (< 0 (skip-chars-forward "^A-Za-z1-9<%}#=\"")) + (skip-comment) + (skip-quotation) + (skip-sexp))) + ; (skip-chars-forward "^\\") Why doesn't this work?!! + (if (char-equal ?\\ (preceding-char)) + (backward-char)) +) + + +(defun skip-good-keywords () + (if (looking-at "\\\\\\([a-z]*\\)") + (progn + (goto-char (match-end 0)) + (if (member (match-string 1) Parm-Keywords) + (progn + (if (looking-at "[ \t\n]*?\\([a-z0-9_]+\\|{[^}]*}\\|\"[^\"]*\"\\)") + (goto-char (match-end 0)) + (error "Improper regex match:") + (error "Unknown text: %s") +)))))) + +(defun find-measure-start () + (let ((start (re-search-backward "\|" 0 t))) + (if (null start) + -1 + (if (looking-at "[^ \n\t]*\"") + (find-measure-start) + (point) +)))) + +(defun get-beat () + (save-excursion + (save-restriction + (let* ((end (point)) + (measure-start (find-measure-start)) + (last-dur (or (re-search-backward duration-regex 0 t) -1)) + (duration (if (= -1 last-dur) 0 (parse-duration (match-string 0)))) + (result '(0 1))) ; 0 in fraction form + (if (= measure-start -1) + (message "No | before point") + (goto-char (1+ measure-start)) + (goto-note-begin) + (while (< (point) end) + (let ((new-duration (walk-note-duration))) + (if (null new-duration) + (if (not (looking-at + (concat "\\\\t\\(?:\\(imes\\)\\|uplet\\)[ \t]*\\([0-9]+\\)/\\([0-9]+\\)\\(?:[ \t\n]" + duration-regex "\\)?[ \t\n]*{"))) + (skip-good-keywords) + + ; handle \times/\tuplet specially + (let* ((times-p (match-beginning 1)) + (numerator (string-to-number (match-string (if times-p 2 3)))) + (denominator (string-to-number (match-string (if times-p 3 2))))) + (goto-char (match-end 0)) + (goto-note-begin) + (while (and (not (looking-at "}")) + (< (point) end)) + (setq new-duration (walk-note-duration)) + (if (null new-duration) + (if (looking-at "\\\\[a-z]*[ \t]*[a-z]*") + (goto-char (match-end 0)) + (error "Unknown text: %S %s" result(buffer-substring (point) end)))) + (if (not (eq new-duration t)) + (setq duration new-duration)) + (setq result (add-fractions result + (list (* numerator (car duration)) + (* denominator (cadr duration))))) + (goto-note-begin)) + (if (< (point) end) + (forward-char 1)))) ; skip } + + (if (not (eq new-duration t)) + (setq duration new-duration)) + (setq result (add-fractions result duration))) + (goto-note-begin))) + + result))))) + +(defun LilyPond-what-beat () + "Returns how much of a measure lies between last measaure '|' and point. +Recognizes chords, and triples." + (interactive) + (let ((beat (get-beat))) + (message "Beat: %d/%d" (car beat) (cadr beat))) +) + +(defun LilyPond-electric-bar () + "Indicate the number of beats in last measure when a | is inserted" + (interactive) + (self-insert-command 1) + (save-excursion + (save-restriction + (backward-char) + (LilyPond-what-beat) + (forward-char) +))) + + diff --git a/lilypond-2.24.2/share/emacs/site-lisp/lilypond-words.el b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-words.el new file mode 100644 index 0000000000000000000000000000000000000000..6e261ec6aab26b1d30c01d1a84c002df4603eede --- /dev/null +++ b/lilypond-2.24.2/share/emacs/site-lisp/lilypond-words.el @@ -0,0 +1,1428 @@ +\\xNotesOn +\\xNotesOff +\\xNote +\\wordwrap-string-internal +\\wordwrap-string +\\wordwrap-lines +\\wordwrap-internal +\\wordwrap-field +\\wordwrap +\\withMusicProperty +\\with-url +\\with-true-dimensions +\\with-true-dimension +\\with-string-transformer +\\with-outline +\\with-link +\\with-dimensions-from +\\with-dimensions +\\with-dimension-from +\\with-dimension +\\with-color +\\whiteout +\\whiteTriangleMarkup +\\whiteCircleMarkup +\\walkerHeadsMinor +\\walkerHeads +\\vspace +\\vshape +\\vowelTransition +\\volta +\\void +\\voices +\\voiceTwoStyle +\\voiceTwo +\\voiceThreeStyle +\\voiceThree +\\voiceOneStyle +\\voiceOne +\\voiceNeutralStyle +\\voiceFourStyle +\\voiceFour +\\virgula +\\virga +\\veryshortfermata +\\verylongfermata +\\versus +\\version +\\verbatim-file +\\vcenter +\\varcoda +\\upright +\\upprall +\\upmordent +\\upbow +\\up +\\unset +\\unless +\\unit +\\unfolded +\\unfoldRepeats +\\undo +\\undertie +\\underlyingRepeatBarType +\\underline +\\unaCorda +\\unHideNotes +\\typewriter +\\type +\\tweak +\\turn +\\tupletUp +\\tupletSpan +\\tupletNeutral +\\tupletDown +\\tuplet +\\trill +\\triangle +\\treCorde +\\transposition +\\transposedCueDuring +\\transpose +\\transparent +\\translate-scaled +\\translate +\\topLevelAlignment +\\tocTitleMarkup +\\tocItemWithDotsMarkup +\\tocItemMarkup +\\tocItem +\\tocIndentMarkup +\\tocFormatMarkup +\\tiny +\\timing +\\times +\\timeSignatureSettings +\\timeSignatureFraction +\\time +\\tied-lyric +\\tieWaitForNote +\\tieUp +\\tieSolid +\\tieNeutral +\\tieHalfSolid +\\tieHalfDashed +\\tieDown +\\tieDotted +\\tieDashed +\\tieDashPattern +\\tie +\\thumb +\\textSpannerUp +\\textSpannerNeutral +\\textSpannerDown +\\textMark +\\textLengthOn +\\textLengthOff +\\textEndMark +\\text +\\tenuto +\\temporary +\\tempoWholesPerMinute +\\tempo +\\teeny +\\tagGroup +\\tag +\\table-of-contents +\\table +\\tablatureFormat +\\tabStaffLineLayoutFunction +\\tabFullNotation +\\systemStartDelimiter +\\sustainOn +\\sustainOff +\\suspendMelodyDecisions +\\super +\\subdivideBeams +\\sub +\\styledNoteHeads +\\strut +\\stropha +\\strokeFingerOrientations +\\stringTunings +\\stringOneTopmost +\\stringNumberOrientations +\\string-lines +\\stopped +\\stopTrillSpan +\\stopTextSpan +\\stopStaffHighlight +\\stopStaff +\\stopSlashedGraceMusic +\\stopMeasureSpanner +\\stopMeasureCount +\\stopGroup +\\stopGraceSlur +\\stopGraceMusic +\\stopAppoggiaturaMusic +\\stopAcciaccaturaMusic +\\stop +\\stencil +\\stemUp +\\stemNeutral +\\stemDown +\\startTrillSpan +\\startTextSpan +\\startStaff +\\startSlashedGraceMusic +\\startRepeatSegnoBarType +\\startRepeatBarType +\\startMeasureSpanner +\\startMeasureCount +\\startGroup +\\startGraceSlur +\\startGraceMusic +\\startAppoggiaturaMusic +\\startAcciaccaturaMusic +\\start +\\staffHighlight +\\staccato +\\staccatissimo +\\squashedPosition +\\spp +\\sp +\\southernHarmonyHeadsMinor +\\southernHarmonyHeads +\\sostenutoOn +\\sostenutoOff +\\soloText +\\soloIIText +\\snappizzicato +\\smaller +\\smallCaps +\\small +\\slurUp +\\slurSolid +\\slurNeutral +\\slurHalfSolid +\\slurHalfDashed +\\slurDown +\\slurDotted +\\slurDashed +\\slurDashPattern +\\slashturn +\\slashedGrace +\\slashed-digit +\\slashChordSeparator +\\skipTypesetting +\\skipNCs +\\skipNC +\\skip +\\single +\\simultaneous +\\simple +\\signumcongruentiae +\\showStaffSwitch +\\showSplitTiedTabNotes +\\shortfermata +\\shortInstrumentName +\\shiftOnnn +\\shiftOnn +\\shiftOn +\\shiftOff +\\shiftDurations +\\sharp +\\shape +\\sfz +\\sfp +\\sff +\\sf +\\settingsFrom +\\setDefaultDurationToQuarter +\\set +\\sesquisharp +\\sesquiflat +\\sequential +\\semisharp +\\semiflat +\\semicirculus +\\semiGermanChords +\\segnoStyle +\\segnoMarkFormatter +\\segnoMark +\\segnoBarType +\\segno +\\sectionLabel +\\sectionBarType +\\section +\\searchForVoice +\\scriptDefinitions +\\score-lines +\\score +\\scaleDurations +\\scale +\\sans +\\sacredHarpHeadsMinor +\\sacredHarpHeads +\\rtoe +\\rounded-box +\\rotate +\\romanStringNumbers +\\roman +\\rightHandFinger +\\right-column +\\right-brace +\\right-align +\\right +\\rhythm +\\rheel +\\rfz +\\revertTimeSignatureSettings +\\revert +\\reverseturn +\\retrograde +\\restrainOpenStrings +\\restNumberThreshold +\\rest-by-number +\\rest +\\responsum +\\resetRelativeOctave +\\replace +\\repeatTie +\\repeatCountVisibility +\\repeat +\\removeWithTag +\\remove +\\relative +\\rehearsalMarkFormatter +\\rehearsalMark +\\reduceChords +\\raiseNote +\\raise +\\quotedEventTypes +\\quotedCueEventTypes +\\quoteDuring +\\quilisma +\\put-adjacent +\\pushToTag +\\pt +\\proportionalNotationDuration +\\propertyUnset +\\propertyTweak +\\propertySet +\\propertyRevert +\\propertyOverride +\\property-recursive +\\printPartCombineTexts +\\printOctaveNames +\\printKeyCancellation +\\printAccidentalNames +\\predefinedFretboardsOn +\\predefinedFretboardsOff +\\predefinedDiagramTable +\\preBendHold +\\preBend +\\prallup +\\prallprall +\\prallmordent +\\pralldown +\\prall +\\ppppp +\\pppp +\\ppp +\\pp +\\postscript +\\portato +\\polygon +\\pointAndClickTypes +\\pointAndClickOn +\\pointAndClickOff +\\pitchedTrill +\\phrygian +\\phrasingSlurUp +\\phrasingSlurSolid +\\phrasingSlurNeutral +\\phrasingSlurHalfSolid +\\phrasingSlurHalfDashed +\\phrasingSlurDown +\\phrasingSlurDotted +\\phrasingSlurDashed +\\phrasingSlurDashPattern +\\pes +\\pedalUnaCordaStyle +\\pedalUnaCordaStrings +\\pedalSustainStyle +\\pedalSustainStrings +\\pedalSostenutoStyle +\\pedalSostenutoStrings +\\pattern +\\path +\\partial +\\partCombineUp +\\partCombineUnisono +\\partCombineTextsOnNote +\\partCombineSoloII +\\partCombineSoloI +\\partCombineListener +\\partCombineForce +\\partCombineDown +\\partCombineChords +\\partCombineAutomatic +\\partCombineApart +\\partCombine +\\parenthesize +\\parallelMusic +\\paper +\\palmMuteOn +\\palmMuteOff +\\palmMute +\\pageTurn +\\pageBreak +\\page-ref +\\page-link +\\pad-x +\\pad-to-box +\\pad-markup +\\pad-around +\\p +\\overtie +\\overrideTimeSignatureSettings +\\overrideProperty +\\override-lines +\\override +\\overlay +\\oval +\\ottavationMarkups +\\ottava +\\oriscus +\\open +\\oneVoice +\\once +\\on-the-fly +\\omit +\\offset +\\octaveCheck +\\numericTimeSignature +\\number +\\nullAccidentals +\\null +\\notemode +\\noteToFretFunction +\\noteNameSeparator +\\noteNameFunction +\\note-by-number +\\note +\\normalsize +\\normal-text +\\normal-size-super +\\normal-size-sub +\\noPageTurn +\\noPageBreak +\\noChordSymbol +\\noBreak +\\noBeam +\\newSpacingSection +\\new +\\neumeDemoLayout +\\natural +\\name +\\n +\\musicglyph +\\musicMap +\\multi-measure-rest-by-number +\\mp +\\mordent +\\modalTranspose +\\modalInversion +\\mm +\\mixolydian +\\minorChordModifier +\\minor +\\midiInstrument +\\midiChannelMapping +\\midi +\\middleCPosition +\\middleCClefPosition +\\mf +\\metronomeMarkFormatter +\\mergeDifferentlyHeadedOn +\\mergeDifferentlyHeadedOff +\\mergeDifferentlyDottedOn +\\mergeDifferentlyDottedOff +\\melismaEnd +\\melismaBusyProperties +\\melisma +\\medium +\\medianChordGridStyle +\\measurePosition +\\measureBarType +\\maxima +\\markuplist +\\markupMap +\\markup +\\markletter +\\markalphabet +\\markLengthOn +\\markLengthOff +\\mark +\\marcato +\\map-markup-commands +\\makeClusters +\\majorSevenSymbol +\\major +\\maininput +\\magnifyStaff +\\magnifyMusic +\\magnify +\\lyricsto +\\lyrics +\\lyricmode +\\lyricRepeatCountFormatter +\\lyricMelismaAlignment +\\lydian +\\ltoe +\\lower +\\lookup +\\longfermata +\\longa +\\locrian +\\localAlterations +\\lineprall +\\linea +\\line +\\ligature +\\lheel +\\left-column +\\left-brace +\\left-align +\\left +\\layout +\\larger +\\large +\\languageSaveAndChange +\\languageRestore +\\language +\\laissezVibrer +\\label +\\killCues +\\kievanOn +\\kievanOff +\\keyAlterationOrder +\\key +\\keepWithTag +\\keepAliveInterfaces +\\justify-string +\\justify-line +\\justify-field +\\justify +\\justified-lines +\\jump +\\italic +\\italianChords +\\ionian +\\invertChords +\\inversion +\\instrumentTransposition +\\instrumentSwitch +\\instrumentName +\\instrumentEqualizer +\\initialTimeSignatureVisibility +\\indent +\\include +\\inclinatum +\\incipit +\\inStaffSegno +\\in +\\improvisationOn +\\improvisationOff +\\ij +\\iij +\\ignoreFiguredBassRest +\\ignoreBarNumberChecks +\\ignoreBarChecks +\\ignatzekExceptions +\\ignatzekExceptionMusic +\\if +\\ictus +\\huge +\\hspace +\\highStringOne +\\hideStaffSwitch +\\hideSplitTiedTabNotes +\\hideNotes +\\hide +\\henzeshortfermata +\\henzelongfermata +\\header +\\hcenter-in +\\hbracket +\\haydnturn +\\harp-pedal +\\harmonicsOn +\\harmonicsOff +\\harmonicNote +\\harmonicByRatio +\\harmonicByFret +\\harmonicAccidentals +\\harmonic +\\handleNegativeFrets +\\halign +\\halfopen +\\grobdescriptions +\\graceSettings +\\grace +\\glissando +\\glide +\\germanChords +\\general-align +\\fz +\\funkHeadsMinor +\\funkHeads +\\fromproperty +\\fret-diagram-verbose +\\fret-diagram-terse +\\fret-diagram +\\frenchChords +\\fraction +\\fp +\\forbidBreakBetweenBarLines +\\footnote +\\fontsize +\\fontSize +\\fontCaps +\\flexa +\\flat +\\flageolet +\\fixed +\\firstClef +\\first-visible +\\fingeringOrientations +\\finger +\\fineText +\\fineStartRepeatSegnoBarType +\\fineSegnoBarType +\\fineBarType +\\fine +\\finalis +\\filled-box +\\fill-with-pattern +\\fill-line +\\figures +\\figuremode +\\figuredBassPlusStrokedAlist +\\figuredBassPlusDirection +\\figuredBassLargeNumberAlignment +\\figuredBassFormatter +\\figuredBassAlterationDirection +\\figured-bass +\\fffff +\\ffff +\\fff +\\ff +\\fermata +\\featherDurations +\\f +\\eyeglasses +\\extraNatural +\\extendersOverRests +\\explicitKeySignatureVisibility +\\explicitCueClefVisibility +\\explicitClefVisibility +\\expandEmptyMeasures +\\eventChords +\\etc +\\espressivo +\\epsfile +\\episemInitium +\\episemFinis +\\enddim +\\enddecresc +\\enddecr +\\endcresc +\\endcr +\\endSpanners +\\endSkipNCs +\\endRepeatSegnoBarType +\\endRepeatBarType +\\ellipse +\\easyHeadsOn +\\easyHeadsOff +\\dynamicUp +\\dynamicNeutral +\\dynamicDown +\\dynamicAbsoluteVolumeFunction +\\dynamic +\\drums +\\drummode +\\drumStyleTable +\\drumPitchTable +\\dropNote +\\draw-squiggle-line +\\draw-line +\\draw-hline +\\draw-dotted-line +\\draw-dashed-line +\\draw-circle +\\downprall +\\downmordent +\\downbow +\\down +\\doublesharp +\\doubleflat +\\doubleRepeatSegnoBarType +\\doubleRepeatBarType +\\dotsUp +\\dotsNeutral +\\dotsDown +\\dorian +\\divisioMinima +\\divisioMaxima +\\divisioMaior +\\displayScheme +\\displayMusic +\\displayLilyMusic +\\dir-column +\\dimTextDim +\\dimTextDecresc +\\dimTextDecr +\\dimHairpin +\\dim +\\description +\\descendens +\\deprecatedenddim +\\deprecatedendcresc +\\deprecateddim +\\deprecatedcresc +\\denies +\\deminutum +\\defineBarLine +\\defaultchild +\\defaultTimeSignature +\\defaultNoteHeads +\\default +\\decrescendoSpanner +\\decresc +\\decr +\\deadNotesOn +\\deadNotesOff +\\deadNote +\\dashUnderscore +\\dashPlus +\\dashLarger +\\dashHat +\\dashDot +\\dashDash +\\dashBang +\\dalSegnoTextFormatter +\\cueDuringWithClef +\\cueDuring +\\cueClefUnset +\\cueClefTranspositionFormatter +\\cueClef +\\crossStaff +\\crescendoSpanner +\\crescTextCresc +\\crescHairpin +\\cresc +\\createSpacing +\\cr +\\context +\\consists +\\concat +\\compressMMRests +\\compressEmptyMeasures +\\compoundMeter +\\completionFactor +\\command-name +\\combine +\\column-lines +\\column +\\codaMarkFormatter +\\codaMark +\\coda +\\cm +\\clefTranspositionFormatter +\\clefTransposition +\\clefPosition +\\clefGlyph +\\clef +\\circulus +\\circle +\\chords +\\chordmodifiers +\\chordmode +\\chordRootNamer +\\chordPrefixSpacer +\\chordNoteNamer +\\chordNameSeparator +\\chordNameLowercaseMinor +\\chordNameFunction +\\chordNameExceptions +\\char +\\change +\\centerBarNumbers +\\center-column +\\center-align +\\center +\\cavum +\\caps +\\caesuraTypeTransform +\\caesuraType +\\caesura +\\cadenzaOn +\\cadenzaOff +\\breve +\\breathe +\\breathMarkType +\\breathMarkDefinitions +\\breakDynamicSpan +\\break +\\bracket +\\bp +\\box +\\bookpart +\\bookOutputSuffix +\\bookOutputName +\\book +\\bold +\\blackTriangleMarkup +\\bigger +\\bendStartLevel +\\bendHold +\\bendAfter +\\beamHalfMeasure +\\beamExceptions +\\beam +\\bassFigureStaffAlignmentUp +\\bassFigureStaffAlignmentNeutral +\\bassFigureStaffAlignmentDown +\\bassFigureExtendersOn +\\bassFigureExtendersOff +\\barNumberVisibility +\\barNumberFormatter +\\barNumberCheck +\\barCheckSynchronize +\\bar +\\balloonText +\\balloonLengthOn +\\balloonLengthOff +\\balloonGrobText +\\backslashed-digit +\\autoPageBreaksOn +\\autoPageBreaksOff +\\autoLineBreaksOn +\\autoLineBreaksOff +\\autoChange +\\autoCautionaries +\\autoBreaksOn +\\autoBreaksOff +\\autoBeaming +\\autoBeamOn +\\autoBeamOff +\\autoBeamCheck +\\autoAccidentals +\\auto-footnote +\\augmentum +\\auctum +\\associatedVoiceType +\\assertBeamSlope +\\assertBeamQuant +\\ascendens +\\arrow-head +\\arpeggioParenthesisDashed +\\arpeggioParenthesis +\\arpeggioNormal +\\arpeggioBracket +\\arpeggioArrowUp +\\arpeggioArrowDown +\\arpeggio +\\arabicStringNumbers +\\appoggiatura +\\applyOutput +\\applyMusic +\\applyContext +\\appendToTag +\\ambitusAfter +\\alternativeRestores +\\alternative +\\alterationGlyphs +\\alterBroken +\\allowVoltaHook +\\allowPageTurn +\\allowBreak +\\align-on-other +\\alias +\\aikenThinHeadsMinor +\\aikenThinHeads +\\aikenHeadsMinor +\\aikenHeads +\\afterGraceFraction +\\afterGrace +\\after +\\aeolian +\\addlyrics +\\additionalPitchPrefix +\\addQuote +\\addInstrumentDefinition +\\accidentalStyle +\\accidental +\\acciaccatura +\\accepts +\\accentus +\\accent +\\absolute +\\abs-fontsize +\\aDueText +\\IJ +\\IIJ +\\C +\\B +\\A +staff +spacing +signature +routine +notes +handler +corrected +beams +arpeggios +Voice +VaticanaVoice +VaticanaStaff +VaticanaLyrics +Time_signature_engraver +TabVoice +TabStaff +System_start_delimiter_engraver +StandaloneRhythmVoice +StandaloneRhythmStaff +StandaloneRhythmScore +StaffGroup +Staff +Score +RhythmicStaff +PianoStaff +PetrucciVoice +PetrucciStaff +OneStaff +NullVoice +NoteNames +NoteHead +MensuralVoice +MensuralStaff +Lyrics +KievanVoice +KievanStaff +InternalGregorianStaff +GregorianTranscriptionVoice +GregorianTranscriptionStaff +GregorianTranscriptionLyrics +GrandStaff +Global +FretBoards +FiguredBass +Dynamics +DrumVoice +DrumStaff +Devnull +CueVoice +ChordNames +ChordGridScore +ChordGrid +ChoirStaff +BarLine +Axis_group_engraver +Alteration_glyph_engraver +solx +soltqs +soltqd +soltqb +soltcs +soltcb +solstqt +solss +solsqt +solsd +solsb +sols +solqs +solqd +solqb +solkk +solkhk +solk +solhk +solhb +soldsd +soldd +sold +solcs +solcb +solbtqt +solbsb +solbqt +solbhb +solbb +solb +sol +six +sitqs +sitqd +sitqb +sitcs +sitcb +sistqt +siss +sisqt +sisd +sisb +sis +siqs +siqd +siqb +sikk +sikhk +sik +sihk +sihb +sidsd +sidd +sid +sics +sicb +sibtqt +sibsb +sibqt +sibhb +sibb +sib +si +rex +retqs +retqd +retqb +retcs +retcb +restqt +ress +resqt +resd +resb +res +reqs +reqd +reqb +rekk +rekhk +rek +rehk +rehb +redsd +redd +red +recs +recb +rebtqt +rebsb +rebqt +rebhb +rebb +reb +re +mix +mitqs +mitqd +mitqb +mitcs +mitcb +mistqt +miss +misqt +misd +misb +mis +miqs +miqd +miqb +mikk +mikhk +mik +mihk +mihb +midsd +midd +mid +mics +micb +mibtqt +mibsb +mibqt +mibhb +mibb +mib +mi +lax +latqs +latqd +latqb +latcs +latcb +lastqt +lass +lasqt +lasd +lasb +las +laqs +laqd +laqb +lakk +lakhk +lak +lahk +lahb +ladsd +ladd +lad +lacs +lacb +labtqt +labsb +labqt +labhb +labb +lab +la +hississ +hissih +hiss +hisis +hisih +his +hih +hessess +hesseh +heses +heseh +heh +h +gx +gtqs +gtqf +gtqd +gtqb +gss +gshd +gshb +gs +gqs +gqf +gississ +gissih +giss +gisis +gisih +gis +gih +gfhd +gfhb +gff +gf +gessess +gesseh +gess +geses +geseh +ges +geh +gdd +gdb +gd +gb +g +fx +ftqs +ftqf +ftqd +ftqb +fss +fshd +fshb +fs +fqs +fqf +fississ +fissih +fiss +fisis +fisih +fis +fih +ffhd +ffhb +fff +ff +fessess +fesseh +fess +feses +feseh +fes +feh +fdd +fdb +fd +fb +fax +fatqs +fatqd +fatqb +fatcs +fatcb +fastqt +fass +fasqt +fasd +fasb +fas +faqs +faqd +faqb +fakk +fakhk +fak +fahk +fahb +fadsd +fadd +fad +facs +facb +fabtqt +fabsb +fabqt +fabhb +fabb +fab +fa +f +ex +etqs +etqf +etqd +etqb +essess +esseh +ess +eshd +eshb +eses +eseh +es +eqs +eqf +eississ +eissih +eiss +eisis +eisih +eis +eih +eh +efhd +efhb +eff +ef +eessess +eesseh +eess +eeses +eeseh +ees +eeh +edd +edb +ed +eb +e +dx +dtqs +dtqf +dtqd +dtqb +dss +dshd +dshb +ds +dqs +dqf +dox +dotqs +dotqd +dotqb +dotcs +dotcb +dostqt +doss +dosqt +dosd +dosb +dos +doqs +doqd +doqb +dokk +dokhk +dok +dohk +dohb +dodsd +dodd +dod +docs +docb +dobtqt +dobsb +dobqt +dobhb +dobb +dob +do +dississ +dissih +diss +disis +disih +dis +dih +dfhd +dfhb +dff +df +dessess +desseh +dess +deses +deseh +des +deh +ddd +ddb +dd +db +d +cx +ctqs +ctqf +ctqd +ctqb +css +cshd +cshb +cs +cqs +cqf +cississ +cissih +ciss +cisis +cisih +cis +cih +cfhd +cfhb +cff +cf +cessess +cesseh +cess +ceses +ceseh +ces +ceh +cdd +cdb +cd +cb +c +bx +btqs +btqf +btqd +btqb +bss +bshd +bshb +bs +bqs +bqf +bisis +bisih +bis +bih +bfhd +bfhb +bff +bf +bess +beses +beseh +bes +beh +bdd +bdb +bd +bb +b +ax +atqs +atqf +atqd +atqb +assess +asseh +ass +ashd +ashb +ases +aseh +asas +asah +as +aqs +aqf +aississ +aissih +aiss +aisis +aisih +ais +aih +ah +afhd +afhb +aff +af +aessess +aesseh +aess +aeses +aeseh +aes +aeh +add +adb +ad +ab +a +\( - _ \) - +\[ - _ \] - +< - _ > - +<< - _ >> - +\\\( - _ \\\) - +\\\[ - _ \\\] - +\\\< - _ \\\! - +\\\> - _ \\\! - +\\center - \ << _ >> - +\\column - \ << _ >> - +\\context\ Staff\ = - % { _ } - +\\context\ Voice\ = - % { _ } - +\\markup - { _ } - +\\notes - { _ } - +\\relative - % { _ } - +\\score - { \\n \? \\simultaneous { \\n _ \\n } \! \\n \\layout { } \\n \? \\midi { } \\n \! } \\n - +\\simultaneous - { _ } - +\\sustainOn - _ \\sustainOff - +\\times - % { _ } - +\\transpose - % { _ } - diff --git a/lilypond-2.24.2/share/guile/2.2/guile-procedures.txt b/lilypond-2.24.2/share/guile/2.2/guile-procedures.txt new file mode 100644 index 0000000000000000000000000000000000000000..7705c379d9c06ec8ec2351f913d672a70539f2b0 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/guile-procedures.txt @@ -0,0 +1,8479 @@ +Produced by GNU Guile 2.2.7 from `./libguile/guile-procedures.texi'. + + acons + +- Scheme Procedure: acons key value alist + Add a new key-value pair to ALIST. A new pair is created whose car + is KEY and whose cdr is VALUE, and the pair is consed onto ALIST, + and the new list is returned. This function is _not_ destructive; + ALIST is not modified. + + sloppy-assq + +- Scheme Procedure: sloppy-assq key alist + Behaves like `assq' but does not do any error checking. Recommended + only for use in Guile internals. + + sloppy-assv + +- Scheme Procedure: sloppy-assv key alist + Behaves like `assv' but does not do any error checking. Recommended + only for use in Guile internals. + + sloppy-assoc + +- Scheme Procedure: sloppy-assoc key alist + Behaves like `assoc' but does not do any error checking. + Recommended only for use in Guile internals. + + assq + +- Scheme Procedure: assq key alist + + + + + Fetch the entry in ALIST that is associated with KEY. To decide + whether the argument KEY matches a particular entry in ALIST, + `assq' compares keys with `eq?', `assv' uses `eqv?' and `assoc' + uses `equal?'. If KEY cannot be found in ALIST (according to + whichever equality predicate is in use), then return `#f'. These + functions return the entire alist entry found (i.e. both the key + and the value). + + assv + +- Scheme Procedure: assv key alist + Behaves like `assq' but uses `eqv?' for key comparison. + + assoc + +- Scheme Procedure: assoc key alist + Behaves like `assq' but uses `equal?' for key comparison. + + assq-ref + +- Scheme Procedure: assq-ref alist key + + + + + Like `assq', `assv' and `assoc', except that only the value + associated with KEY in ALIST is returned. These functions are + equivalent to + + (let ((ent (ASSOCIATOR KEY ALIST))) + (and ent (cdr ent))) + + where ASSOCIATOR is one of `assq', `assv' or `assoc'. + + assv-ref + +- Scheme Procedure: assv-ref alist key + Behaves like `assq-ref' but uses `eqv?' for key comparison. + + assoc-ref + +- Scheme Procedure: assoc-ref alist key + Behaves like `assq-ref' but uses `equal?' for key comparison. + + assq-set! + +- Scheme Procedure: assq-set! alist key val + + + + + Reassociate KEY in ALIST with VAL: find any existing ALIST entry + for KEY and associate it with the new VAL. If ALIST does not + contain an entry for KEY, add a new one. Return the (possibly new) + alist. + + These functions do not attempt to verify the structure of ALIST, + and so may cause unusual results if passed an object that is not an + association list. + + assv-set! + +- Scheme Procedure: assv-set! alist key val + Behaves like `assq-set!' but uses `eqv?' for key comparison. + + assoc-set! + +- Scheme Procedure: assoc-set! alist key val + Behaves like `assq-set!' but uses `equal?' for key comparison. + + assq-remove! + +- Scheme Procedure: assq-remove! alist key + + + + + Delete the first entry in ALIST associated with KEY, and return the + resulting alist. + + assv-remove! + +- Scheme Procedure: assv-remove! alist key + Behaves like `assq-remove!' but uses `eqv?' for key comparison. + + assoc-remove! + +- Scheme Procedure: assoc-remove! alist key + Behaves like `assq-remove!' but uses `equal?' for key comparison. + + array-fill! + +- Scheme Procedure: array-fill! ra fill + Store FILL in every element of array RA. The value returned is + unspecified. + + array-copy-in-order! + +- Scheme Procedure: array-copy-in-order! + implemented by the C function "scm_array_copy_x" + + array-copy! + +- Scheme Procedure: array-copy! src dst + + + Copy every element from vector or array SRC to the corresponding + element of DST. DST must have the same rank as SRC, and be at + least as large in each dimension. The order is unspecified. + + array-map-in-order! + +- Scheme Procedure: array-map-in-order! + implemented by the C function "scm_array_map_x" + + array-map! + +- Scheme Procedure: array-map! ra0 proc . lra + + + ARRAY1, ... must have the same number of dimensions as RA0 and have + a range for each index which includes the range for the + corresponding index in RA0. PROC is applied to each tuple of + elements of ARRAY1, ... and the result is stored as the + corresponding element in RA0. The value returned is unspecified. + The order of application is unspecified. + + array-for-each + +- Scheme Procedure: array-for-each proc ra0 . lra + Apply PROC to each tuple of elements of RA0 ... in row-major order. + The value returned is unspecified. + + array-index-map! + +- Scheme Procedure: array-index-map! ra proc + Apply PROC to the indices of each element of RA in turn, storing + the result in the corresponding element. The value returned and + the order of application are unspecified. + + One can implement ARRAY-INDEXES as + + (define (array-indexes array) + (let ((ra (apply make-array #f (array-shape array)))) + (array-index-map! ra (lambda x x)) + ra)) + + Another example: + + (define (apl:index-generator n) + (let ((v (make-uniform-vector n 1))) + (array-index-map! v (lambda (i) i)) + v)) + + array-equal? + +- Scheme Procedure: array-equal? [ra0 [ra1 . rest]] + Return `#t' iff all arguments are arrays with the same shape, the + same type, and have corresponding elements which are either + `equal?' or `array-equal?'. This function differs from `equal?' in + that all arguments must be arrays. + + array-slice-for-each + +- Scheme Procedure: array-slice-for-each frame_rank op . args + Apply OP to each of the cells of rank rank(ARG)-FRAME_RANK of the + arrays ARGS, in unspecified order. The first FRAME_RANK dimensions + of each ARG must match. Rank-0 cells are passed as rank-0 arrays. + + The value returned is unspecified. + + For example: + + ;; Sort the rows of rank-2 array A. + + (array-slice-for-each 1 (lambda (x) (sort! x <)) a) + + ;; Compute the arguments of the (x y) vectors in the rows of rank-2 + ;; array XYS and store them in rank-1 array ANGLES. Inside OP, + ;; XY is a rank-1 (2-1) array, and ANGLE is a rank-0 (1-1) array. + + (array-slice-for-each 1 + (lambda (xy angle) + (array-set! angle (atan (array-ref xy 1) (array-ref xy 0)))) + xys angles) + + array-slice-for-each-in-order + +- Scheme Procedure: array-slice-for-each-in-order frank op . a + Same as array-slice-for-each, but visit the cells sequentially and + in row-major order. + + array-rank + +- Scheme Procedure: array-rank array + Return the number of dimensions of the array ARRAY. + + shared-array-root + +- Scheme Procedure: shared-array-root ra + Return the root vector of a shared array. + + shared-array-offset + +- Scheme Procedure: shared-array-offset ra + Return the root vector index of the first element in the array. + + shared-array-increments + +- Scheme Procedure: shared-array-increments ra + For each dimension, return the distance between elements in the + root vector. + + make-typed-array + +- Scheme Procedure: make-typed-array type fill . bounds + Create and return an array of type TYPE. + + make-array + +- Scheme Procedure: make-array fill . bounds + Create and return an array. + + make-shared-array + +- Scheme Procedure: make-shared-array oldra mapfunc . dims + `make-shared-array' can be used to create shared subarrays of other + arrays. The MAPFUNC is a function that translates coordinates in + the new array into coordinates in the old array. A MAPFUNC must be + linear, and its range must stay within the bounds of the old array, + but it can be otherwise arbitrary. A simple example: + + (define fred (make-array #f 8 8)) + (define freds-diagonal + (make-shared-array fred (lambda (i) (list i i)) 8)) + (array-set! freds-diagonal 'foo 3) + (array-ref fred 3 3) ==> foo + (define freds-center + (make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2)) + (array-ref freds-center 0 0) ==> foo + + array-slice + +- Scheme Procedure: array-slice ra . indices + Return the array slice RA[INDICES ..., ...] The rank of RA must + equal to the number of indices or larger. + + See also `array-ref', `array-cell-ref', `array-cell-set!'. + + `array-slice' may return a rank-0 array. For example: + + (array-slice #2((1 2 3) (4 5 6)) 1 1) ==> #0(5) + (array-slice #2((1 2 3) (4 5 6)) 1) ==> #(4 5 6) + (array-slice #2((1 2 3) (4 5 6))) ==> #2((1 2 3) (4 5 6)) + (array-slice #0(5) ==> #0(5). + + array-cell-ref + +- Scheme Procedure: array-cell-ref ra . indices + Return the element at the `(INDICES ...)' position in array RA, or + the array slice RA[INDICES ..., ...] if the rank of RA is larger + than the number of indices. + + See also `array-ref', `array-slice', `array-cell-set!'. + + `array-cell-ref' never returns a rank 0 array. For example: + + (array-cell-ref #2((1 2 3) (4 5 6)) 1 1) ==> 5 + (array-cell-ref #2((1 2 3) (4 5 6)) 1) ==> #(4 5 6) + (array-cell-ref #2((1 2 3) (4 5 6))) ==> #2((1 2 3) (4 5 6)) + (array-cell-ref #0(5) ==> 5. + + array-cell-set! + +- Scheme Procedure: array-cell-set! ra b . indices + Set the array slice RA[INDICES ..., ...] to B .Equivalent to + `(array-copy! B (apply array-cell-ref RA INDICES))' if the number + of indices is smaller than the rank of RA; otherwise equivalent to + `(apply array-set! RA B INDICES)'. This function returns the + modified array RA. + + See also `array-ref', `array-cell-ref', `array-slice'. + + For example: + + (define A (list->array 2 '((1 2 3) (4 5 6)))) + (array-cell-set! A #0(99) 1 1) ==> #2((1 2 3) (4 #0(99) 6)) + (array-cell-set! A 99 1 1) ==> #2((1 2 3) (4 99 6)) + (array-cell-set! A #(a b c) 0) ==> #2((a b c) (4 99 6)) + (array-cell-set! A #2((x y z) (9 8 7))) ==> #2((x y z) (9 8 7)) + + (define B (make-array 0)) + (array-cell-set! B 15) ==> #0(15) + + transpose-array + +- Scheme Procedure: transpose-array ra . args + Return an array sharing contents with RA, but with dimensions + arranged in a different order. There must be one DIM argument for + each dimension of RA. DIM0, DIM1, ... should be integers between 0 + and the rank of the array to be returned. Each integer in that + range must appear at least once in the argument list. + + The values of DIM0, DIM1, ... correspond to dimensions in the array + to be returned, their positions in the argument list to dimensions + of RA. Several DIMs may have the same value, in which case the + returned array will have smaller rank than RA. + + (transpose-array '#2((a b) (c d)) 1 0) ==> #2((a c) (b d)) + (transpose-array '#2((a b) (c d)) 0 0) ==> #1(a d) + (transpose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) ==> + #2((a 4) (b 5) (c 6)) + + array-contents + +- Scheme Procedure: array-contents ra [strict] + If RA may be "unrolled" into a one dimensional shared array without + changing their order (last subscript changing fastest), then + `array-contents' returns that shared array, otherwise it returns + `#f'. All arrays made by `make-array' and `make-uniform-array' may + be unrolled, some arrays made by `make-shared-array' may not be. If + the optional argument STRICT is provided, a shared array will be + returned only if its elements are stored contiguously in memory. + + list->typed-array + +- Scheme Procedure: list->typed-array type shape lst + Return an array of the type TYPE with elements the same as those of + LST. + + The argument SHAPE determines the number of dimensions of the array + and their shape. It is either an exact integer, giving the number + of dimensions directly, or a list whose length specifies the number + of dimensions and each element specified the lower and optionally + the upper bound of the corresponding dimension. When the element + is list of two elements, these elements give the lower and upper + bounds. When it is an exact integer, it gives only the lower + bound. + + list->array + +- Scheme Procedure: list->array ndim lst + Return an array with elements the same as those of LST. + + system-async-mark + +- Scheme Procedure: system-async-mark proc [thread] + Mark PROC (a procedure with zero arguments) for future execution in + THREAD. If PROC has already been marked for THREAD but has not + been executed yet, this call has no effect. If THREAD is omitted, + the thread that called `system-async-mark' is used. + + This procedure is not safe to be called from C signal handlers. Use + `scm_sigaction' or `scm_sigaction_for_thread' to install signal + handlers. + + noop + +- Scheme Procedure: noop . args + Do nothing. When called without arguments, return `#f', otherwise + return the first argument. + + call-with-blocked-asyncs + +- Scheme Procedure: call-with-blocked-asyncs proc + Call PROC with no arguments and block the execution of system + asyncs by one level for the current thread while it is running. + Return the value returned by PROC. + + call-with-unblocked-asyncs + +- Scheme Procedure: call-with-unblocked-asyncs proc + Call PROC with no arguments and unblock the execution of system + asyncs by one level for the current thread while it is running. + Return the value returned by PROC. + + make-atomic-box + +- Scheme Procedure: make-atomic-box init + Return an atomic box initialized to value INIT. + + atomic-box? + +- Scheme Procedure: atomic-box? obj + Return `#t' if OBJ is an atomic-box object, else return `#f'. + + atomic-box-ref + +- Scheme Procedure: atomic-box-ref box + Fetch the value stored in the atomic box BOX and return it. + + atomic-box-set! + +- Scheme Procedure: atomic-box-set! box val + Store VAL into the atomic box BOX. + + atomic-box-swap! + +- Scheme Procedure: atomic-box-swap! box val + Store VAL into the atomic box BOX, and return the value that was + previously stored in the box. + + atomic-box-compare-and-swap! + +- Scheme Procedure: atomic-box-compare-and-swap! box expected desired + If the value of the atomic box BOX is the same as, EXPECTED (in the + sense of `eq?'), replace the contents of the box with DESIRED. + Otherwise does not update the box. Returns the previous value of + the box in either case, so you can know if the swap worked by + checking if the return value is `eq?' to EXPECTED. + + display-error + +- Scheme Procedure: display-error frame port subr message args rest + Display an error message to the output port PORT. FRAME is the + frame in which the error occurred, SUBR is the name of the + procedure in which the error occurred and MESSAGE is the actual + error message, which may contain formatting instructions. These + will format the arguments in the list ARGS accordingly. REST is + currently ignored. + + display-application + +- Scheme Procedure: display-application frame [port [indent]] + Display a procedure application FRAME to the output port PORT. + INDENT specifies the indentation of the output. + + display-backtrace + +- Scheme Procedure: display-backtrace stack port [first [depth +[highlights]]] + Display a backtrace to the output port PORT. STACK is the stack to + take the backtrace from, FIRST specifies where in the stack to + start and DEPTH how many frames to display. FIRST and DEPTH can be + `#f', which means that default values will be used. If HIGHLIGHTS + is given it should be a list; the elements of this list will be + highlighted wherever they appear in the backtrace. + + backtrace + +- Scheme Procedure: backtrace [highlights] + Display a backtrace of the current stack to the current output + port. If HIGHLIGHTS is given, it should be a list; the elements of + this list will be highlighted wherever they appear in the + backtrace. + + not + +- Scheme Procedure: not x + Return `#t' iff X is false, else return `#f'. + + nil? + +- Scheme Procedure: nil? x + Return `#t' if X would be interpreted as `nil' by Emacs Lisp code, + else return `#f'. + + (nil? #nil) ==> #t + (nil? #f) ==> #t + (nil? '()) ==> #t + (nil? 3) ==> #f + + boolean? + +- Scheme Procedure: boolean? obj + Return `#t' iff OBJ is `#t' or false. + + bitvector? + +- Scheme Procedure: bitvector? obj + Return `#t' when OBJ is a bitvector, else return `#f'. + + make-bitvector + +- Scheme Procedure: make-bitvector len [fill] + Create a new bitvector of length LEN and optionally initialize all + elements to FILL. + + bitvector + +- Scheme Procedure: bitvector . bits + Create a new bitvector with the arguments as elements. + + bitvector-length + +- Scheme Procedure: bitvector-length vec + Return the length of the bitvector VEC. + + bitvector-ref + +- Scheme Procedure: bitvector-ref vec idx + Return the element at index IDX of the bitvector VEC. + + bitvector-set! + +- Scheme Procedure: bitvector-set! vec idx val + Set the element at index IDX of the bitvector VEC when VAL is true, + else clear it. + + bitvector-fill! + +- Scheme Procedure: bitvector-fill! vec val + Set all elements of the bitvector VEC when VAL is true, else clear + them. + + list->bitvector + +- Scheme Procedure: list->bitvector list + Return a new bitvector initialized with the elements of LIST. + + bitvector->list + +- Scheme Procedure: bitvector->list vec + Return a new list initialized with the elements of the bitvector + VEC. + + bit-count + +- Scheme Procedure: bit-count b bitvector + Return the number of occurrences of the boolean B in BITVECTOR. + + bit-position + +- Scheme Procedure: bit-position item v k + Return the index of the first occurrence of ITEM in bit vector V, + starting from K. If there is no ITEM entry between K and the end + of V, then return `#f'. For example, + + (bit-position #t #*000101 0) ==> 3 + (bit-position #f #*0001111 3) ==> #f + + bit-set*! + +- Scheme Procedure: bit-set*! v kv obj + Set entries of bit vector V to OBJ, with KV selecting the entries + to change. The return value is unspecified. + + If KV is a bit vector, then those entries where it has `#t' are the + ones in V which are set to OBJ. V must be at least as long as KV. + When OBJ is `#t' it's like KV is OR'ed into V. Or when OBJ is `#f' + it can be seen as an ANDNOT. + + (define bv #*01000010) + (bit-set*! bv #*10010001 #t) + bv + ==> #*11010011 + + If KV is a u32vector, then its elements are indices into V which + are set to OBJ. + + (define bv #*01000010) + (bit-set*! bv #u32(5 2 7) #t) + bv + ==> #*01100111 + + bit-count* + +- Scheme Procedure: bit-count* v kv obj + Return a count of how many entries in bit vector V are equal to + OBJ, with KV selecting the entries to consider. + + If KV is a bit vector, then those entries where it has `#t' are the + ones in V which are considered. KV and V must be the same length. + + If KV is a u32vector, then it contains the indexes in V to + consider. + + For example, + + (bit-count* #*01110111 #*11001101 #t) ==> 3 + (bit-count* #*01110111 #u32(7 0 4) #f) ==> 2 + + bit-invert! + +- Scheme Procedure: bit-invert! v + Modify the bit vector V by replacing each element with its + negation. + + native-endianness + +- Scheme Procedure: native-endianness + Return a symbol denoting the machine's native endianness. + + bytevector? + +- Scheme Procedure: bytevector? obj + Return true if OBJ is a bytevector. + + make-bytevector + +- Scheme Procedure: make-bytevector len [fill] + Return a newly allocated bytevector of LEN bytes, optionally filled + with FILL. + + bytevector-length + +- Scheme Procedure: bytevector-length bv + Return the length (in bytes) of BV. + + bytevector=? + +- Scheme Procedure: bytevector=? bv1 bv2 + Return is BV1 equals to BV2---i.e., if they have the same length + and contents. + + bytevector-fill! + +- Scheme Procedure: bytevector-fill! bv fill + Fill bytevector BV with FILL, a byte. + + bytevector-copy! + +- Scheme Procedure: bytevector-copy! source source_start target +target_start len + Copy LEN bytes from SOURCE into TARGET, starting reading from + SOURCE_START (a positive index within SOURCE) and start writing at + TARGET_START. + + bytevector-copy + +- Scheme Procedure: bytevector-copy bv + Return a newly allocated copy of BV. + + uniform-array->bytevector + +- Scheme Procedure: uniform-array->bytevector array + Return a newly allocated bytevector whose contents will be copied + from the uniform array ARRAY. + + bytevector-u8-ref + +- Scheme Procedure: bytevector-u8-ref bv index + Return the octet located at INDEX in BV. + + bytevector-s8-ref + +- Scheme Procedure: bytevector-s8-ref bv index + Return the byte located at INDEX in BV. + + bytevector-u8-set! + +- Scheme Procedure: bytevector-u8-set! bv index value + Return the octet located at INDEX in BV. + + bytevector-s8-set! + +- Scheme Procedure: bytevector-s8-set! bv index value + Return the octet located at INDEX in BV. + + bytevector->u8-list + +- Scheme Procedure: bytevector->u8-list bv + Return a newly allocated list of octets containing the contents of + BV. + + u8-list->bytevector + +- Scheme Procedure: u8-list->bytevector lst + Turn LST, a list of octets, into a bytevector. + + bytevector-uint-ref + +- Scheme Procedure: bytevector-uint-ref bv index endianness size + Return the SIZE-octet long unsigned integer at index INDEX in BV. + + bytevector-sint-ref + +- Scheme Procedure: bytevector-sint-ref bv index endianness size + Return the SIZE-octet long unsigned integer at index INDEX in BV. + + bytevector-uint-set! + +- Scheme Procedure: bytevector-uint-set! bv index value endianness size + Set the SIZE-octet long unsigned integer at INDEX to VALUE. + + bytevector-sint-set! + +- Scheme Procedure: bytevector-sint-set! bv index value endianness size + Set the SIZE-octet long signed integer at INDEX to VALUE. + + bytevector->sint-list + +- Scheme Procedure: bytevector->sint-list bv endianness size + Return a list of signed integers of SIZE octets representing the + contents of BV. + + bytevector->uint-list + +- Scheme Procedure: bytevector->uint-list bv endianness size + Return a list of unsigned integers of SIZE octets representing the + contents of BV. + + uint-list->bytevector + +- Scheme Procedure: uint-list->bytevector lst endianness size + Return a bytevector containing the unsigned integers listed in LST + and encoded on SIZE octets according to ENDIANNESS. + + sint-list->bytevector + +- Scheme Procedure: sint-list->bytevector lst endianness size + Return a bytevector containing the signed integers listed in LST + and encoded on SIZE octets according to ENDIANNESS. + + bytevector-u16-ref + +- Scheme Procedure: bytevector-u16-ref bv index endianness + Return the unsigned 16-bit integer from BV at INDEX. + + bytevector-s16-ref + +- Scheme Procedure: bytevector-s16-ref bv index endianness + Return the signed 16-bit integer from BV at INDEX. + + bytevector-u16-native-ref + +- Scheme Procedure: bytevector-u16-native-ref bv index + Return the unsigned 16-bit integer from BV at INDEX using the + native endianness. + + bytevector-s16-native-ref + +- Scheme Procedure: bytevector-s16-native-ref bv index + Return the unsigned 16-bit integer from BV at INDEX using the + native endianness. + + bytevector-u16-set! + +- Scheme Procedure: bytevector-u16-set! bv index value endianness + Store VALUE in BV at INDEX according to ENDIANNESS. + + bytevector-s16-set! + +- Scheme Procedure: bytevector-s16-set! bv index value endianness + Store VALUE in BV at INDEX according to ENDIANNESS. + + bytevector-u16-native-set! + +- Scheme Procedure: bytevector-u16-native-set! bv index value + Store the unsigned integer VALUE at index INDEX of BV using the + native endianness. + + bytevector-s16-native-set! + +- Scheme Procedure: bytevector-s16-native-set! bv index value + Store the signed integer VALUE at index INDEX of BV using the + native endianness. + + bytevector-u32-ref + +- Scheme Procedure: bytevector-u32-ref bv index endianness + Return the unsigned 32-bit integer from BV at INDEX. + + bytevector-s32-ref + +- Scheme Procedure: bytevector-s32-ref bv index endianness + Return the signed 32-bit integer from BV at INDEX. + + bytevector-u32-native-ref + +- Scheme Procedure: bytevector-u32-native-ref bv index + Return the unsigned 32-bit integer from BV at INDEX using the + native endianness. + + bytevector-s32-native-ref + +- Scheme Procedure: bytevector-s32-native-ref bv index + Return the unsigned 32-bit integer from BV at INDEX using the + native endianness. + + bytevector-u32-set! + +- Scheme Procedure: bytevector-u32-set! bv index value endianness + Store VALUE in BV at INDEX according to ENDIANNESS. + + bytevector-s32-set! + +- Scheme Procedure: bytevector-s32-set! bv index value endianness + Store VALUE in BV at INDEX according to ENDIANNESS. + + bytevector-u32-native-set! + +- Scheme Procedure: bytevector-u32-native-set! bv index value + Store the unsigned integer VALUE at index INDEX of BV using the + native endianness. + + bytevector-s32-native-set! + +- Scheme Procedure: bytevector-s32-native-set! bv index value + Store the signed integer VALUE at index INDEX of BV using the + native endianness. + + bytevector-u64-ref + +- Scheme Procedure: bytevector-u64-ref bv index endianness + Return the unsigned 64-bit integer from BV at INDEX. + + bytevector-s64-ref + +- Scheme Procedure: bytevector-s64-ref bv index endianness + Return the signed 64-bit integer from BV at INDEX. + + bytevector-u64-native-ref + +- Scheme Procedure: bytevector-u64-native-ref bv index + Return the unsigned 64-bit integer from BV at INDEX using the + native endianness. + + bytevector-s64-native-ref + +- Scheme Procedure: bytevector-s64-native-ref bv index + Return the unsigned 64-bit integer from BV at INDEX using the + native endianness. + + bytevector-u64-set! + +- Scheme Procedure: bytevector-u64-set! bv index value endianness + Store VALUE in BV at INDEX according to ENDIANNESS. + + bytevector-s64-set! + +- Scheme Procedure: bytevector-s64-set! bv index value endianness + Store VALUE in BV at INDEX according to ENDIANNESS. + + bytevector-u64-native-set! + +- Scheme Procedure: bytevector-u64-native-set! bv index value + Store the unsigned integer VALUE at index INDEX of BV using the + native endianness. + + bytevector-s64-native-set! + +- Scheme Procedure: bytevector-s64-native-set! bv index value + Store the signed integer VALUE at index INDEX of BV using the + native endianness. + + bytevector-ieee-single-ref + +- Scheme Procedure: bytevector-ieee-single-ref bv index endianness + Return the IEEE-754 single from BV at INDEX. + + bytevector-ieee-single-native-ref + +- Scheme Procedure: bytevector-ieee-single-native-ref bv index + Return the IEEE-754 single from BV at INDEX using the native + endianness. + + bytevector-ieee-single-set! + +- Scheme Procedure: bytevector-ieee-single-set! bv index value +endianness + Store real VALUE in BV at INDEX according to ENDIANNESS. + + bytevector-ieee-single-native-set! + +- Scheme Procedure: bytevector-ieee-single-native-set! bv index value + Store the real VALUE at index INDEX of BV using the native + endianness. + + bytevector-ieee-double-ref + +- Scheme Procedure: bytevector-ieee-double-ref bv index endianness + Return the IEEE-754 double from BV at INDEX. + + bytevector-ieee-double-native-ref + +- Scheme Procedure: bytevector-ieee-double-native-ref bv index + Return the IEEE-754 double from BV at INDEX using the native + endianness. + + bytevector-ieee-double-set! + +- Scheme Procedure: bytevector-ieee-double-set! bv index value +endianness + Store real VALUE in BV at INDEX according to ENDIANNESS. + + bytevector-ieee-double-native-set! + +- Scheme Procedure: bytevector-ieee-double-native-set! bv index value + Store the real VALUE at index INDEX of BV using the native + endianness. + + string->utf8 + +- Scheme Procedure: string->utf8 str + Return a newly allocated bytevector that contains the UTF-8 + encoding of STR. + + string->utf16 + +- Scheme Procedure: string->utf16 str [endianness] + Return a newly allocated bytevector that contains the UTF-16 + encoding of STR. + + string->utf32 + +- Scheme Procedure: string->utf32 str [endianness] + Return a newly allocated bytevector that contains the UTF-32 + encoding of STR. + + utf8->string + +- Scheme Procedure: utf8->string utf + Return a newly allocate string that contains from the UTF-8-encoded + contents of bytevector UTF. + + utf16->string + +- Scheme Procedure: utf16->string utf [endianness] + Return a newly allocate string that contains from the + UTF-16-encoded contents of bytevector UTF. + + utf32->string + +- Scheme Procedure: utf32->string utf [endianness] + Return a newly allocate string that contains from the + UTF-32-encoded contents of bytevector UTF. + + char? + +- Scheme Procedure: char? x + Return `#t' iff X is a character, else `#f'. + + char=? + +- Scheme Procedure: char=? [x [y . rest]] + Return `#t' if the Unicode code point of X is equal to the code + point of Y, else `#f'. + + char? + +- Scheme Procedure: char>? [x [y . rest]] + Return `#t' if the Unicode code point of X is greater than the code + point of Y, else `#f'. + + char>=? + +- Scheme Procedure: char>=? [x [y . rest]] + Return `#t' if the Unicode code point of X is greater than or equal + to the code point of Y, else `#f'. + + char-ci=? + +- Scheme Procedure: char-ci=? [x [y . rest]] + Return `#t' if the case-folded Unicode code point of X is the same + as the case-folded code point of Y, else `#f'. + + char-ci? + +- Scheme Procedure: char-ci>? [x [y . rest]] + Return `#t' iff the case-folded code point of X is greater than the + case-folded code point of Y, else `#f'. + + char-ci>=? + +- Scheme Procedure: char-ci>=? [x [y . rest]] + Return `#t' iff the case-folded Unicode code point of X is greater + than or equal to the case-folded code point of Y, else `#f'. + + char-alphabetic? + +- Scheme Procedure: char-alphabetic? chr + Return `#t' iff CHR is alphabetic, else `#f'. + + char-numeric? + +- Scheme Procedure: char-numeric? chr + Return `#t' iff CHR is numeric, else `#f'. + + char-whitespace? + +- Scheme Procedure: char-whitespace? chr + Return `#t' iff CHR is whitespace, else `#f'. + + char-upper-case? + +- Scheme Procedure: char-upper-case? chr + Return `#t' iff CHR is uppercase, else `#f'. + + char-lower-case? + +- Scheme Procedure: char-lower-case? chr + Return `#t' iff CHR is lowercase, else `#f'. + + char-is-both? + +- Scheme Procedure: char-is-both? chr + Return `#t' iff CHR is either uppercase or lowercase, else `#f'. + + char->integer + +- Scheme Procedure: char->integer chr + Return the Unicode code point of CHR. + + integer->char + +- Scheme Procedure: integer->char n + Return the character that has Unicode code point N. The integer N + must be a valid code point. Valid code points are in the ranges 0 + to `#xD7FF' inclusive or `#xE000' to `#x10FFFF' inclusive. + + char-upcase + +- Scheme Procedure: char-upcase chr + Return the uppercase character version of CHR. + + char-downcase + +- Scheme Procedure: char-downcase chr + Return the lowercase character version of CHR. + + char-titlecase + +- Scheme Procedure: char-titlecase chr + Return the titlecase character version of CHR. + + char-general-category + +- Scheme Procedure: char-general-category chr + Return a symbol representing the Unicode general category of CHR or + `#f' if a named category cannot be found. + + abort-to-prompt* + +- Scheme Procedure: abort-to-prompt* tag args + Abort to the nearest prompt with tag TAG, yielding the values in + the list, ARGS. + + with-continuation-barrier + +- Scheme Procedure: with-continuation-barrier proc + Call PROC and return its result. Do not allow the invocation of + continuations that would leave or enter the dynamic extent of the + call to `with-continuation-barrier'. Such an attempt causes an + error to be signaled. + + Throws (such as errors) that are not caught from within PROC are + caught by `with-continuation-barrier'. In that case, a short + message is printed to the current error port and `#f' is returned. + + Thus, `with-continuation-barrier' returns exactly once. + + debug-options-interface + +- Scheme Procedure: debug-options-interface [setting] + Option interface for the debug options. Instead of using this + procedure directly, use the procedures `debug-enable', + `debug-disable', `debug-set!' and `debug-options'. + + make-arbiter + +- Scheme Procedure: make-arbiter name + Return an arbiter object, initially unlocked. Currently NAME is + only used for diagnostic output. + + try-arbiter + +- Scheme Procedure: try-arbiter arb + If ARB is unlocked, then lock it and return `#t'. If ARB is + already locked, then do nothing and return `#f'. + + release-arbiter + +- Scheme Procedure: release-arbiter arb + If ARB is locked, then unlock it and return `#t'. If ARB is + already unlocked, then do nothing and return `#f'. + + Typical usage is for the thread which locked an arbiter to later + release it, but that's not required, any thread can release it. + + async + +- Scheme Procedure: async thunk + Create a new async for the procedure THUNK. + + async-mark + +- Scheme Procedure: async-mark a + Mark the async A for future execution. + + run-asyncs + +- Scheme Procedure: run-asyncs list_of_a + Execute all thunks from the asyncs of the list LIST_OF_A. + + call-with-dynamic-root + +- Scheme Procedure: call-with-dynamic-root thunk handler + Call THUNK with a new dynamic state and within a continuation + barrier. The HANDLER catches all otherwise uncaught throws and + executes within the same dynamic context as THUNK. + + dynamic-root + +- Scheme Procedure: dynamic-root + Return an object representing the current dynamic root. + + These objects are only useful for comparison using `eq?'. + + make-struct + +- Scheme Procedure: make-struct vtable tail_array_size . init + Create a new structure. + + VTABLE must be a vtable structure (see Vtables). + + TAIL_ARRAY_SIZE must be a non-negative integer. If the layout + specification indicated by VTABLE includes a tail-array, this is + the number of elements allocated to that array. + + The INIT1, ... are optional arguments describing how successive + fields of the structure should be initialized. Only fields with + protection 'r' or 'w' can be initialized, except for fields of type + 's', which are automatically initialized to point to the new + structure itself. Fields with protection 'o' can not be + initialized by Scheme programs. + + If fewer optional arguments than initializable fields are supplied, + fields of type 'p' get default value #f while fields of type 'u' + are initialized to 0. + + issue-deprecation-warning + +- Scheme Procedure: issue-deprecation-warning . msgs + Output MSGS to `(current-error-port)' when this is the first call + to `issue-deprecation-warning' with this specific MSGS. Do nothing + otherwise. The argument MSGS should be a list of strings; they are + printed in turn, each one followed by a newline. + + include-deprecated-features + +- Scheme Procedure: include-deprecated-features + Return `#t' iff deprecated features should be included in public + interfaces. + + dynamic-link + +- Scheme Procedure: dynamic-link [filename] + Find the shared object (shared library) denoted by FILENAME and + link it into the running Guile application. The returned scheme + object is a ``handle'' for the library which can be passed to + `dynamic-func', `dynamic-call' etc. + + Searching for object files is system dependent. Normally, if + FILENAME does have an explicit directory it will be searched for in + locations such as `/usr/lib' and `/usr/local/lib'. + + When FILENAME is omitted, a "global symbol handle" is returned. + This handle provides access to the symbols available to the program + at run-time, including those exported by the program itself and the + shared libraries already loaded. + + dynamic-object? + +- Scheme Procedure: dynamic-object? obj + Return `#t' if OBJ is a dynamic object handle, or `#f' otherwise. + + dynamic-unlink + +- Scheme Procedure: dynamic-unlink dobj + Unlink a dynamic object from the application, if possible. The + object must have been linked by `dynamic-link', with DOBJ the + corresponding handle. After this procedure is called, the handle + can no longer be used to access the object. + + dynamic-pointer + +- Scheme Procedure: dynamic-pointer name dobj + Return a ``wrapped pointer'' to the symbol NAME in the shared + object referred to by DOBJ. The returned pointer points to a C + object. + + Regardless whether your C compiler prepends an underscore `_' to + the global names in a program, you should *not* include this + underscore in NAME since it will be added automatically when + necessary. + + dynamic-func + +- Scheme Procedure: dynamic-func name dobj + Return a ``handle'' for the function NAME in the shared object + referred to by DOBJ. The handle can be passed to `dynamic-call' to + actually call the function. + + Regardless whether your C compiler prepends an underscore `_' to + the global names in a program, you should *not* include this + underscore in NAME since it will be added automatically when + necessary. + + dynamic-call + +- Scheme Procedure: dynamic-call func dobj + Call a C function in a dynamic object. Two styles of invocation + are supported: + + * FUNC can be a function handle returned by `dynamic-func'. In + this case DOBJ is ignored + + * FUNC can be a string with the name of the function to call, + with DOBJ the handle of the dynamic object in which to find + the function. This is equivalent to + + + (dynamic-call (dynamic-func FUNC DOBJ) #f) + + In either case, the function is passed no arguments and its return + value is ignored. + + eq? + +- Scheme Procedure: eq? [x [y . rest]] + Return `#t' if X and Y are the same object, except for numbers and + characters. For example, + + (define x (vector 1 2 3)) + (define y (vector 1 2 3)) + + (eq? x x) ==> #t + (eq? x y) ==> #f + + Numbers and characters are not equal to any other object, but the + problem is they're not necessarily `eq?' to themselves either. This + is even so when the number comes directly from a variable, + + (let ((n (+ 2 3))) + (eq? n n)) ==> *unspecified* + + Generally `eqv?' should be used when comparing numbers or + characters. `=' or `char=?' can be used too. + + It's worth noting that end-of-list `()', `#t', `#f', a symbol of a + given name, and a keyword of a given name, are unique objects. + There's just one of each, so for instance no matter how `()' arises + in a program, it's the same object and can be compared with `eq?', + + (define x (cdr '(123))) + (define y (cdr '(456))) + (eq? x y) ==> #t + + (define x (string->symbol "foo")) + (eq? x 'foo) ==> #t + + eqv? + +- Scheme Procedure: eqv? [x [y . rest]] + Return `#t' if X and Y are the same object, or for characters and + numbers the same value. + + On objects except characters and numbers, `eqv?' is the same as + `eq?', it's true if X and Y are the same object. + + If X and Y are numbers or characters, `eqv?' compares their type + and value. An exact number is not `eqv?' to an inexact number + (even if their value is the same). + + (eqv? 3 (+ 1 2)) ==> #t + (eqv? 1 1.0) ==> #f + + equal? + +- Scheme Procedure: equal? [x [y . rest]] + Return `#t' if X and Y are the same type, and their contents or + value are equal. + + For a pair, string, vector or array, `equal?' compares the + contents, and does so using using the same `equal?' recursively, so + a deep structure can be traversed. + + (equal? (list 1 2 3) (list 1 2 3)) ==> #t + (equal? (list 1 2 3) (vector 1 2 3)) ==> #f + + For other objects, `equal?' compares as per `eqv?', which means + characters and numbers are compared by type and value (and like + `eqv?', exact and inexact numbers are not `equal?', even if their + value is the same). + + (equal? 3 (+ 1 2)) ==> #t + (equal? 1 1.0) ==> #f + + Hash tables are currently only compared as per `eq?', so two + different tables are not `equal?', even if their contents are the + same. + + `equal?' does not support circular data structures, it may go into + an infinite loop if asked to compare two circular lists or similar. + + New application-defined object types (Smobs) have an `equalp' + handler which is called by `equal?'. This lets an application + traverse the contents or control what is considered `equal?' for + two such objects. If there's no handler, the default is to just + compare as per `eq?'. + + scm-error + +- Scheme Procedure: scm-error key subr message args data + Raise an error with key KEY. SUBR can be a string naming the + procedure associated with the error, or `#f'. MESSAGE is the error + message string, possibly containing `~S' and `~A' escapes. When an + error is reported, these are replaced by formatting the + corresponding members of ARGS: `~A' (was `%s' in older versions of + Guile) formats using `display' and `~S' (was `%S') formats using + `write'. DATA is a list or `#f' depending on KEY: if KEY is + `system-error' then it should be a list containing the Unix `errno' + value; If KEY is `signal' then it should be a list containing the + Unix signal number; If KEY is `out-of-range', `wrong-type-arg', or + `keyword-argument-error', it is a list containing the bad value; + otherwise it will usually be `#f'. + + strerror + +- Scheme Procedure: strerror err + Return the Unix error message corresponding to ERR, which must be + an integer value. + + eval + +- Scheme Procedure: eval exp module_or_state + Evaluate EXP, a list representing a Scheme expression, in the + top-level environment specified by MODULE_OR_STATE. While EXP is + evaluated (using `primitive-eval'), MODULE_OR_STATE is made the + current module when it is a module, or the current dynamic state + when it is a dynamic state.Example: (eval '(+ 1 2) + (interaction-environment)) + + defined? + +- Scheme Procedure: defined? sym [module] + Return `#t' if SYM is defined in the module MODULE or the current + module when MODULE is notspecified. + + self-evaluating? + +- Scheme Procedure: self-evaluating? obj + Return #t for objects which Guile considers self-evaluating + + macroexpand + +- Scheme Procedure: macroexpand exp + Expand the expression EXP. + + macroexpanded? + +- Scheme Procedure: macroexpanded? exp + Return `#t' if EXP is an expanded expression. + + load-extension + +- Scheme Procedure: load-extension lib init + Load and initialize the extension designated by LIB and INIT. When + there is no pre-registered function for LIB/INIT, this is + equivalent to + + (dynamic-call INIT (dynamic-link LIB)) + + When there is a pre-registered function, that function is called + instead. + + Normally, there is no pre-registered function. This option exists + only for situations where dynamic linking is unavailable or + unwanted. In that case, you would statically link your program + with the desired library, and register its init function right + after Guile has been initialized. + + LIB should be a string denoting a shared library without any file + type suffix such as ".so". The suffix is provided automatically. + It should also not contain any directory components. Libraries + that implement Guile Extensions should be put into the normal + locations for shared libraries. We recommend to use the naming + convention libguile-bla-blum for a extension related to a module + `(bla blum)'. + + The normal way for a extension to be used is to write a small + Scheme file that defines a module, and to load the extension into + this module. When the module is auto-loaded, the extension is + loaded as well. For example, + + (define-module (bla blum)) + + (load-extension "libguile-bla-blum" "bla_init_blum") + + add-fdes-finalizer! + +- Scheme Procedure: add-fdes-finalizer! fd finalizer + Add a finalizer that will be called when FD is closed. + + remove-fdes-finalizer! + +- Scheme Procedure: remove-fdes-finalizer! fd finalizer + Remove a finalizer that was previously added to the file descriptor + FD. + + program-arguments + +- Scheme Procedure: program-arguments + + + Return the list of command line arguments passed to Guile, as a + list of strings. The list includes the invoked program name, which + is usually `"guile"', but excludes switches and parameters for + command line options like `-e' and `-l'. + + set-program-arguments + +- Scheme Procedure: set-program-arguments lst + Set the command line arguments to be returned by + `program-arguments' (and `command-line'). LST should be a list of + strings, the first of which is the program name (either a script + name, or just `"guile"'). + + Program arguments are held in a fluid and therefore have a separate + value in each Guile thread. Neither the list nor the strings + within it are copied, so should not be modified later. + + open-fdes + +- Scheme Procedure: open-fdes path flags [mode] + Similar to `open' but return a file descriptor instead of a port. + + open + +- Scheme Procedure: open path flags [mode] + Open the file named by PATH for reading and/or writing. FLAGS is + an integer specifying how the file should be opened. MODE is an + integer specifying the permission bits of the file, if it needs to + be created, before the umask is applied. The default is 666 (Unix + itself has no default). + + FLAGS can be constructed by combining variables using `logior'. + Basic flags are: + + - Variable: O_RDONLY + Open the file read-only. + + - Variable: O_WRONLY + Open the file write-only. + + - Variable: O_RDWR + Open the file read/write. + + - Variable: O_APPEND + Append to the file instead of truncating. + + - Variable: O_CREAT + Create the file if it does not already exist. + + See the Unix documentation of the `open' system call for additional + flags. + + close + +- Scheme Procedure: close fd_or_port + Similar to close-port (see close-port), but also works on file + descriptors. A side effect of closing a file descriptor is that + any ports using that file descriptor are moved to a different file + descriptor and have their revealed counts set to zero. + + close-fdes + +- Scheme Procedure: close-fdes fd + A simple wrapper for the `close' system call. Close file + descriptor FD, which must be an integer. Unlike close (see close), + the file descriptor will be closed even if a port is using it. The + return value is unspecified. + + stat + +- Scheme Procedure: stat object [exception_on_error] + Return an object containing various information about the file + determined by OBJECT. OBJECT can be a string containing a file + name or a port or integer file descriptor which is open on a file + (in which case `fstat' is used as the underlying system call). + + If the optional EXCEPTION_ON_ERROR argument is true, which is the + default, an exception will be raised if the underlying system call + returns an error, for example if the file is not found or is not + readable. Otherwise, an error will cause `stat' to return `#f'. + The object returned by a successful call to `stat' can be passed as + a single parameter to the following procedures, all of which return + integers: + + stat:dev + The device containing the file. + + stat:ino + The file serial number, which distinguishes this file from all + other files on the same device. + + stat:mode + The mode of the file. This includes file type information and + the file permission bits. See `stat:type' and `stat:perms' + below. + + stat:nlink + The number of hard links to the file. + + stat:uid + The user ID of the file's owner. + + stat:gid + The group ID of the file. + + stat:rdev + Device ID; this entry is defined only for character or block + special files. + + stat:size + The size of a regular file in bytes. + + stat:atime + The last access time for the file. + + stat:mtime + The last modification time for the file. + + stat:ctime + The last modification time for the attributes of the file. + + stat:blksize + The optimal block size for reading or writing the file, in + bytes. + + stat:blocks + The amount of disk space that the file occupies measured in + units of 512 byte blocks. + + In addition, the following procedures return the information from + stat:mode in a more convenient form: + + stat:type + A symbol representing the type of file. Possible values are + regular, directory, symlink, block-special, char-special, + fifo, socket and unknown + + stat:perms + An integer representing the access permission bits. + + lstat + +- Scheme Procedure: lstat str + Similar to `stat', but does not follow symbolic links, i.e., it + will return information about a symbolic link itself, not the file + it points to. STR must be a string. + + link + +- Scheme Procedure: link oldpath newpath + Creates a new name NEWPATH in the file system for the file named by + OLDPATH. If OLDPATH is a symbolic link, the link may or may not be + followed depending on the system. + + chdir + +- Scheme Procedure: chdir str + Change the current working directory to STR. The return value is + unspecified. + + select + +- Scheme Procedure: select reads writes excepts [secs [usecs]] + This procedure has a variety of uses: waiting for the ability to + provide input, accept output, or the existence of exceptional + conditions on a collection of ports or file descriptors, or waiting + for a timeout to occur. + + When an error occurs, this procedure throws a `system-error' + exception (see `system-error'). + + READS, WRITES and EXCEPTS can be lists or vectors, with each member + a port or a file descriptor. The value returned is a list of three + corresponding lists or vectors containing only the members which + meet the specified requirement. The ability of port buffers to + provide input or accept output is taken into account. Ordering of + the input lists or vectors is not preserved. + + The optional arguments SECS and USECS specify the timeout. Either + SECS can be specified alone, as either an integer or a real number, + or both SECS and USECS can be specified as integers, in which case + USECS is an additional timeout expressed in microseconds. If SECS + is omitted or is `#f' then select will wait for as long as it takes + for one of the other conditions to be satisfied. + + The scsh version of `select' differs as follows: Only vectors are + accepted for the first three arguments. The USECS argument is not + supported. Multiple values are returned instead of a list. + Duplicates in the input vectors appear only once in output. An + additional `select!' interface is provided. + + fsync + +- Scheme Procedure: fsync object + Copies any unwritten data for the specified output file descriptor + to disk. If OBJECT is a port, its buffer is flushed before the + underlying file descriptor is fsync'd. The return value is + unspecified. + + readlink + +- Scheme Procedure: readlink path + Return the value of the symbolic link named by PATH (a string), + i.e., the file that the link points to. + + copy-file + +- Scheme Procedure: copy-file oldfile newfile + Copy the file specified by OLDFILE to NEWFILE. The return value is + unspecified. + + sendfile + +- Scheme Procedure: sendfile out in count [offset] + Send COUNT bytes from IN to OUT, both of which must be either open + file ports or file descriptors. When OFFSET is omitted, start + reading from IN's current position; otherwise, start reading at + OFFSET. Return the number of bytes actually sent. + + getcwd + +- Scheme Procedure: getcwd + Return the name of the current working directory. + + mkdir + +- Scheme Procedure: mkdir path [mode] + Create a new directory named by PATH. If MODE is omitted then the + permissions of the directory are set to `#o777' masked with the + current umask (see `umask'). Otherwise they are set to the value + specified with MODE. The return value is unspecified. + + rmdir + +- Scheme Procedure: rmdir path + Remove the existing directory named by PATH. The directory must be + empty for this to succeed. The return value is unspecified. + + rename-file + +- Scheme Procedure: rename-file oldname newname + Renames the file specified by OLDNAME to NEWNAME. The return value + is unspecified. + + delete-file + +- Scheme Procedure: delete-file str + Deletes (or "unlinks") the file specified by STR. + + access? + +- Scheme Procedure: access? path how + Test accessibility of a file under the real UID and GID of the + calling process. The return is `#t' if PATH exists and the + permissions requested by HOW are all allowed, or `#f' if not. + + HOW is an integer which is one of the following values, or a + bitwise-OR (`logior') of multiple values. + + - Variable: R_OK + Test for read permission. + + - Variable: W_OK + Test for write permission. + + - Variable: X_OK + Test for execute permission. + + - Variable: F_OK + Test for existence of the file. This is implied by each of + the other tests, so there's no need to combine it with them. + + It's important to note that `access?' does not simply indicate what + will happen on attempting to read or write a file. In normal + circumstances it does, but in a set-UID or set-GID program it + doesn't because `access?' tests the real ID, whereas an open or + execute attempt uses the effective ID. + + A program which will never run set-UID/GID can ignore the + difference between real and effective IDs, but for maximum + generality, especially in library functions, it's best not to use + `access?' to predict the result of an open or execute, instead + simply attempt that and catch any exception. + + The main use for `access?' is to let a set-UID/GID program + determine what the invoking user would have been allowed to do, + without the greater (or perhaps lesser) privileges afforded by the + effective ID. For more on this, see ``Testing File Access'' in The + GNU C Library Reference Manual. + + chmod + +- Scheme Procedure: chmod object mode + Changes the permissions of the file referred to by OBJECT. OBJECT + can be a string containing a file name or a port or integer file + descriptor which is open on a file (in which case `fchmod' is used + as the underlying system call). MODE specifies the new permissions + as a decimal number, e.g., `(chmod "foo" #o755)'. The return value + is unspecified. + + umask + +- Scheme Procedure: umask [mode] + If MODE is omitted, returns a decimal number representing the + current file creation mask. Otherwise the file creation mask is + set to MODE and the previous value is returned. + + E.g., `(umask #o022)' sets the mask to octal 22, decimal 18. + + mkstemp! + +- Scheme Procedure: mkstemp! tmpl [mode] + Create a new unique file in the file system and return a new + buffered port open for reading and writing to the file. + + TMPL is a string specifying where the file should be created: it + must end with `XXXXXX' and those `X's will be changed in the string + to return the name of the file. (`port-filename' on the port also + gives the name.) + + POSIX doesn't specify the permissions mode of the file, on GNU and + most systems it's `#o600'. An application can use `chmod' to relax + that if desired. For example `#o666' less `umask', which is usual + for ordinary file creation, + + (let ((port (mkstemp! (string-copy "/tmp/myfile-XXXXXX")))) + (chmod port (logand #o666 (lognot (umask)))) + ...) + + The optional MODE argument specifies a mode, as a string in the + same format that `open-file' takes. It defaults to `"w+"'. + + system-file-name-convention + +- Scheme Procedure: system-file-name-convention + Return either `posix' or `windows', depending on what kind of + system this Guile is running on. + + dirname + +- Scheme Procedure: dirname filename + Return the directory name component of the file name FILENAME. If + FILENAME does not contain a directory component, `.' is returned. + + basename + +- Scheme Procedure: basename filename [suffix] + Return the base name of the file name FILENAME. The base name is + the file name without any directory components. If SUFFIX is + provided, and is equal to the end of FILENAME, it is removed also. + + canonicalize-path + +- Scheme Procedure: canonicalize-path path + Return the canonical path of PATH. A canonical path has no `.' or + `..' components, nor any repeated path separators (`/') nor + symlinks. + + Raises an error if any component of PATH does not exist. + + directory-stream? + +- Scheme Procedure: directory-stream? obj + Return a boolean indicating whether OBJ is a directory stream as + returned by `opendir'. + + opendir + +- Scheme Procedure: opendir dirname + Open the directory specified by DIRNAME and return a directory + stream. + + readdir + +- Scheme Procedure: readdir port + Return (as a string) the next directory entry from the directory + stream PORT. If there is no remaining entry to be read then the + end of file object is returned. + + rewinddir + +- Scheme Procedure: rewinddir port + Reset the directory port PORT so that the next call to `readdir' + will return the first directory entry. + + closedir + +- Scheme Procedure: closedir port + Close the directory stream PORT. The return value is unspecified. + + make-fluid + +- Scheme Procedure: make-fluid [dflt] + Return a newly created fluid, whose initial value is DFLT, or `#f' + if DFLT is not given. Fluids are objects that can hold one value + per dynamic state. That is, modifications to this value are only + visible to code that executes with the same dynamic state as the + modifying code. When a new dynamic state is constructed, it + inherits the values from its parent. Because each thread normally + executes with its own dynamic state, you can use fluids for thread + local storage. + + make-unbound-fluid + +- Scheme Procedure: make-unbound-fluid + Make a fluid that is initially unbound. + + make-thread-local-fluid + +- Scheme Procedure: make-thread-local-fluid [dflt] + Return a newly created fluid, whose initial value is DFLT, or `#f' + if DFLT is not given. Unlike fluids made with `make-fluid', thread + local fluids are not captured by `make-dynamic-state'. Similarly, + a newly spawned child thread does not inherit thread-local fluid + values from the parent thread. + + fluid? + +- Scheme Procedure: fluid? obj + Return `#t' iff OBJ is a fluid; otherwise, return `#f'. + + fluid-thread-local? + +- Scheme Procedure: fluid-thread-local? fluid + Return `#t' if the fluid FLUID is is thread local, or `#f' + otherwise. + + fluid-ref + +- Scheme Procedure: fluid-ref fluid + Return the value associated with FLUID in the current dynamic root. + If FLUID has not been set, then return its default value. + + fluid-ref* + +- Scheme Procedure: fluid-ref* fluid depth + Return the DEPTHth oldest value associated with FLUID in the + current thread. If DEPTH equals or exceeds the number of values + that have been assigned to FLUID, return the default value of the + fluid. + + fluid-set! + +- Scheme Procedure: fluid-set! fluid value + Set the value associated with FLUID in the current dynamic root. + + fluid-unset! + +- Scheme Procedure: fluid-unset! fluid + Unset the value associated with FLUID. + + fluid-bound? + +- Scheme Procedure: fluid-bound? fluid + Return `#t' iff FLUID is bound to a value. Throw an error if FLUID + is not a fluid. + + with-fluids* + +- Scheme Procedure: with-fluids* fluids values thunk + Set FLUIDS to VALUES temporary, and call THUNK. FLUIDS must be a + list of fluids and VALUES must be the same number of their values + to be applied. Each substitution is done one after another. THUNK + must be a procedure with no argument. + + dynamic-state? + +- Scheme Procedure: dynamic-state? obj + Return `#t' if OBJ is a dynamic state object; return `#f' otherwise + + current-dynamic-state + +- Scheme Procedure: current-dynamic-state + Return a snapshot of the current fluid-value associations as a + fresh dynamic state object. + + set-current-dynamic-state + +- Scheme Procedure: set-current-dynamic-state state + Set the current dynamic state object to STATE and return the + previous current dynamic state object. + + with-dynamic-state + +- Scheme Procedure: with-dynamic-state state proc + Call PROC while STATE is the current dynamic state object. + + pointer? + +- Scheme Procedure: pointer? obj + Return `#t' if OBJ is a pointer object, `#f' otherwise. + + make-pointer + +- Scheme Procedure: make-pointer address [finalizer] + Return a foreign pointer object pointing to ADDRESS. If FINALIZER + is passed, it should be a pointer to a one-argument C function that + will be called when the pointer object becomes unreachable. + + pointer-address + +- Scheme Procedure: pointer-address pointer + Return the numerical value of POINTER. + + pointer->scm + +- Scheme Procedure: pointer->scm pointer + Unsafely cast POINTER to a Scheme object. Cross your fingers! + + scm->pointer + +- Scheme Procedure: scm->pointer scm + Return a foreign pointer object with the `object-address' of SCM. + + pointer->bytevector + +- Scheme Procedure: pointer->bytevector pointer len [offset [uvec_type]] + Return a bytevector aliasing the LEN bytes pointed to by POINTER. + + The user may specify an alternate default interpretation for the + memory by passing the UVEC_TYPE argument, to indicate that the + memory is an array of elements of that type. UVEC_TYPE should be + something that `uniform-vector-element-type' would return, like + `f32' or `s16'. + + When OFFSET is passed, it specifies the offset in bytes relative to + POINTER of the memory region aliased by the returned bytevector. + + bytevector->pointer + +- Scheme Procedure: bytevector->pointer bv [offset] + Return a pointer pointer aliasing the memory pointed to by BV or + OFFSET bytes after BV when OFFSET is passed. + + set-pointer-finalizer! + +- Scheme Procedure: set-pointer-finalizer! pointer finalizer + Arrange for the C procedure wrapped by FINALIZER to be called on + the pointer wrapped by POINTER when POINTER becomes unreachable. + Note: the C procedure should not call into Scheme. If you need a + Scheme finalizer, use guardians. + + dereference-pointer + +- Scheme Procedure: dereference-pointer pointer + Assuming POINTER points to a memory region that holds a pointer, + return this pointer. + + string->pointer + +- Scheme Procedure: string->pointer string [encoding] + Return a foreign pointer to a nul-terminated copy of STRING in the + given ENCODING, defaulting to the current locale encoding. The C + string is freed when the returned foreign pointer becomes + unreachable. + + This is the Scheme equivalent of `scm_to_stringn'. + + pointer->string + +- Scheme Procedure: pointer->string pointer [length [encoding]] + Return the string representing the C string pointed to by POINTER. + If LENGTH is omitted or `-1', the string is assumed to be + nul-terminated. Otherwise LENGTH is the number of bytes in memory + pointed to by POINTER. The C string is assumed to be in the given + ENCODING, defaulting to the current locale encoding. + + This is the Scheme equivalent of `scm_from_stringn'. + + alignof + +- Scheme Procedure: alignof type + Return the alignment of TYPE, in bytes. + + TYPE should be a valid C type, like `int'. Alternately TYPE may be + the symbol `*', in which case the alignment of a pointer is + returned. TYPE may also be a list of types, in which case the + alignment of a `struct' with ABI-conventional packing is returned. + + sizeof + +- Scheme Procedure: sizeof type + Return the size of TYPE, in bytes. + + TYPE should be a valid C type, like `int'. Alternately TYPE may be + the symbol `*', in which case the size of a pointer is returned. + TYPE may also be a list of types, in which case the size of a + `struct' with ABI-conventional packing is returned. + + pointer->procedure + +- Scheme Procedure: pointer->procedure return_type func_ptr arg_types . +keyword_args + Make a foreign function. + + Given the foreign void pointer FUNC_PTR, its argument and return + types ARG_TYPES and RETURN_TYPE, return a procedure that will pass + arguments to the foreign function and return appropriate values. + + ARG_TYPES should be a list of foreign types. `return_type' should + be a foreign type. If the `#:return-errno?' keyword argument is + provided and its value is true, then the returned procedure will + return two values, with `errno' as the second value. + + procedure->pointer + +- Scheme Procedure: procedure->pointer return_type proc arg_types + Return a pointer to a C function of type RETURN_TYPE taking + arguments of types ARG_TYPES (a list) and behaving as a proxy to + procedure PROC. Thus PROC's arity, supported argument types, and + return type should match RETURN_TYPE and ARG_TYPES. + + file-port? + +- Scheme Procedure: file-port? obj + Determine whether OBJ is a port that is related to a file. + + open-file + +- Scheme Procedure: open-file filename mode . keyword_args + Open the file whose name is FILENAME, and return a port + representing that file. The attributes of the port are determined + by the MODE string. The way in which this is interpreted is + similar to C stdio. The first character must be one of the + following: + + r + Open an existing file for input. + + w + Open a file for output, creating it if it doesn't already + exist or removing its contents if it does. + + a + Open a file for output, creating it if it doesn't already + exist. All writes to the port will go to the end of the file. + The "append mode" can be turned off while the port is in use + see fcntl + + The following additional characters can be appended: + + b + Open the underlying file in binary mode, if supported by the + system. Also, open the file using the binary-compatible + character encoding "ISO-8859-1", ignoring the default port + encoding. + + + + Open the port for both input and output. E.g., `r+': open an + existing file for both input and output. + + 0 + Create an "unbuffered" port. In this case input and output + operations are passed directly to the underlying port + implementation without additional buffering. This is likely + to slow down I/O operations. The buffering mode can be + changed while a port is in use see setvbuf + + l + Add line-buffering to the port. The port output buffer will + be automatically flushed whenever a newline character is + written. + + In theory we could create read/write ports which were buffered in + one direction only. However this isn't included in the current + interfaces. If a file cannot be opened with the access requested, + `open-file' throws an exception. + + port-revealed + +- Scheme Procedure: port-revealed port + Return the revealed count for PORT. + + set-port-revealed! + +- Scheme Procedure: set-port-revealed! port rcount + Sets the revealed count for a port to a given value. The return + value is unspecified. + + adjust-port-revealed! + +- Scheme Procedure: adjust-port-revealed! port addend + Add ADDEND to the revealed count of PORT. The return value is + unspecified. + + gc-stats + +- Scheme Procedure: gc-stats + Return an association list of statistics about Guile's current use + of storage. + + gc-dump + +- Scheme Procedure: gc-dump + Dump information about the garbage collector's internal data + structures and memory usage to the standard output. + + object-address + +- Scheme Procedure: object-address obj + Return an integer that for the lifetime of OBJ is uniquely returned + by this function for OBJ + + gc-disable + +- Scheme Procedure: gc-disable + Disables the garbage collector. Nested calls are permitted. GC is + re-enabled once `gc-enable' has been called the same number of + times `gc-disable' was called. + + gc-enable + +- Scheme Procedure: gc-enable + Enables the garbage collector. + + gc + +- Scheme Procedure: gc + Scans all of SCM objects and reclaims for further use those that + are no longer accessible. + + gettext + +- Scheme Procedure: gettext msgid [domain [category]] + Return the translation of MSGID in the message domain DOMAIN. + DOMAIN is optional and defaults to the domain set through + (textdomain). CATEGORY is optional and defaults to LC_MESSAGES. + + ngettext + +- Scheme Procedure: ngettext msgid msgid_plural n [domain [category]] + Return the translation of MSGID/MSGID_PLURAL in the message domain + DOMAIN, with the plural form being chosen appropriately for the + number N. DOMAIN is optional and defaults to the domain set + through (textdomain). CATEGORY is optional and defaults to + LC_MESSAGES. + + textdomain + +- Scheme Procedure: textdomain [domainname] + If optional parameter DOMAINNAME is supplied, set the textdomain. + Return the textdomain. + + bindtextdomain + +- Scheme Procedure: bindtextdomain domainname [directory] + If optional parameter DIRECTORY is supplied, set message catalogs + to directory DIRECTORY. Return the directory bound to DOMAINNAME. + + bind-textdomain-codeset + +- Scheme Procedure: bind-textdomain-codeset domainname [encoding] + If optional parameter ENCODING is supplied, set encoding for + message catalogs of DOMAINNAME. Return the encoding of DOMAINNAME. + + array? + +- Scheme Procedure: array? obj + Return `#t' if the OBJ is an array, and `#f' if not. + + typed-array? + +- Scheme Procedure: typed-array? obj type + Return `#t' if the OBJ is an array of type TYPE, and `#f' if not. + + array-length + +- Scheme Procedure: array-length array + Return the length of an array: its first dimension. It is an error + to ask for the length of an array of rank 0. + + array-dimensions + +- Scheme Procedure: array-dimensions ra + `array-dimensions' is similar to `array-shape' but replaces + elements with a `0' minimum with one greater than the maximum. So: + + (array-dimensions (make-array 'foo '(-1 3) 5)) ==> ((-1 3) 5) + + array-type + +- Scheme Procedure: array-type ra + array-type-code + +- Scheme Procedure: array-type-code array + Return the type of the elements in ARRAY, as an integer code. + + array-in-bounds? + +- Scheme Procedure: array-in-bounds? ra . args + Return `#t' if its arguments would be acceptable to `array-ref'. + + array-ref + +- Scheme Procedure: array-ref v [idx0 [idx1 . idxN]] + Return the element at the `(idx0, idx1, idxN...)' position in array + V. + + array-set! + +- Scheme Procedure: array-set! v obj [idx0 [idx1 . idxN]] + Set the element at the `(idx0, idx1, idxN...)' position in the + array V to OBJ. The value returned by `array-set!' is unspecified. + + array->list + +- Scheme Procedure: array->list array + Return a list representation of ARRAY. + + It is easiest to specify the behavior of this function by example: + + (array->list #0(a)) ==> 1 + (array->list #1(a b)) ==> (a b) + (array->list #2((aa ab) (ba bb)) ==> ((aa ab) (ba bb)) + + make-generalized-vector + +- Scheme Procedure: make-generalized-vector type len [fill] + Make a generalized vector + + %make-vtable-vtable + +- Scheme Procedure: %make-vtable-vtable layout + %init-layout! + +- Scheme Procedure: %init-layout! class layout + class-of + +- Scheme Procedure: class-of x + Return the class of X. + + instance? + +- Scheme Procedure: instance? obj + Return `#t' if OBJ is an instance. + + generic-function-name + +- Scheme Procedure: generic-function-name obj + Return the name of the generic function OBJ. + + %clear-fields! + +- Scheme Procedure: %clear-fields! obj unbound + %modify-instance + +- Scheme Procedure: %modify-instance old new + Used by change-class to modify objects in place. + + %modify-class + +- Scheme Procedure: %modify-class old new + generic-capability? + +- Scheme Procedure: generic-capability? proc + enable-primitive-generic! + +- Scheme Procedure: enable-primitive-generic! . subrs + set-primitive-generic! + +- Scheme Procedure: set-primitive-generic! subr generic + primitive-generic-generic + +- Scheme Procedure: primitive-generic-generic subr + %goops-early-init + +- Scheme Procedure: %goops-early-init + %goops-loaded + +- Scheme Procedure: %goops-loaded + Announce that GOOPS is loaded and perform initialization on the C + level which depends on the loaded GOOPS modules. + + make-guardian + +- Scheme Procedure: make-guardian + Create a new guardian. A guardian protects a set of objects from + garbage collection, allowing a program to apply cleanup or other + actions. + + `make-guardian' returns a procedure representing the guardian. + Calling the guardian procedure with an argument adds the argument + to the guardian's set of protected objects. Calling the guardian + procedure without an argument returns one of the protected objects + which are ready for garbage collection, or `#f' if no such object + is available. Objects which are returned in this way are removed + from the guardian. + + You can put a single object into a guardian more than once and you + can put a single object into more than one guardian. The object + will then be returned multiple times by the guardian procedures. + + An object is eligible to be returned from a guardian when it is no + longer referenced from outside any guardian. + + There is no guarantee about the order in which objects are returned + from a guardian. If you want to impose an order on finalization + actions, for example, you can do that by keeping objects alive in + some global data structure until they are no longer needed for + finalizing other objects. + + Being an element in a weak vector, a key in a hash table with weak + keys, or a value in a hash table with weak value does not prevent + an object from being returned by a guardian. But as long as an + object can be returned from a guardian it will not be removed from + such a weak vector or hash table. In other words, a weak link does + not prevent an object from being considered collectable, but being + inside a guardian prevents a weak link from being broken. + + A key in a weak key hash table can be though of as having a strong + reference to its associated value as long as the key is accessible. + Consequently, when the key only accessible from within a guardian, + the reference from the key to the value is also considered to be + coming from within a guardian. Thus, if there is no other + reference to the value, it is eligible to be returned from a + guardian. + + hashq + +- Scheme Procedure: hashq key size + Determine a hash value for KEY that is suitable for lookups in a + hashtable of size SIZE, where `eq?' is used as the equality + predicate. The function returns an integer in the range 0 to SIZE + - 1. Note that `hashq' may use internal addresses. Thus two calls + to hashq where the keys are `eq?' are not guaranteed to deliver the + same value if the key object gets garbage collected in between. + This can happen, for example with symbols: `(hashq 'foo n) (gc) + (hashq 'foo n)' may produce two different values, since `foo' will + be garbage collected. + + hashv + +- Scheme Procedure: hashv key size + Determine a hash value for KEY that is suitable for lookups in a + hashtable of size SIZE, where `eqv?' is used as the equality + predicate. The function returns an integer in the range 0 to SIZE + - 1. Note that `(hashv key)' may use internal addresses. Thus two + calls to hashv where the keys are `eqv?' are not guaranteed to + deliver the same value if the key object gets garbage collected in + between. This can happen, for example with symbols: `(hashv 'foo + n) (gc) (hashv 'foo n)' may produce two different values, since + `foo' will be garbage collected. + + hash + +- Scheme Procedure: hash key size + Determine a hash value for KEY that is suitable for lookups in a + hashtable of size SIZE, where `equal?' is used as the equality + predicate. The function returns an integer in the range 0 to SIZE + - 1. + + make-hash-table + +- Scheme Procedure: make-hash-table [n] + Make a new abstract hash table object with minimum number of + buckets N + + hash-table? + +- Scheme Procedure: hash-table? obj + Return `#t' if OBJ is an abstract hash table object. + + hash-clear! + +- Scheme Procedure: hash-clear! table + Remove all items from TABLE (without triggering a resize). + + hashq-get-handle + +- Scheme Procedure: hashq-get-handle table key + This procedure returns the `(key . value)' pair from the hash + table TABLE. If TABLE does not hold an associated value for KEY, + `#f' is returned. Uses `eq?' for equality testing. + + hashq-create-handle! + +- Scheme Procedure: hashq-create-handle! table key init + This function looks up KEY in TABLE and returns its handle. If KEY + is not already present, a new handle is created which associates + KEY with INIT. + + hashq-ref + +- Scheme Procedure: hashq-ref table key [dflt] + Look up KEY in the hash table TABLE, and return the value (if any) + associated with it. If KEY is not found, return DFLT (or `#f' if + no DFLT argument is supplied). Uses `eq?' for equality testing. + + hashq-set! + +- Scheme Procedure: hashq-set! table key val + Find the entry in TABLE associated with KEY, and store VAL there. + Uses `eq?' for equality testing. + + hashq-remove! + +- Scheme Procedure: hashq-remove! table key + Remove KEY (and any value associated with it) from TABLE. Uses + `eq?' for equality tests. + + hashv-get-handle + +- Scheme Procedure: hashv-get-handle table key + This procedure returns the `(key . value)' pair from the hash + table TABLE. If TABLE does not hold an associated value for KEY, + `#f' is returned. Uses `eqv?' for equality testing. + + hashv-create-handle! + +- Scheme Procedure: hashv-create-handle! table key init + This function looks up KEY in TABLE and returns its handle. If KEY + is not already present, a new handle is created which associates + KEY with INIT. + + hashv-ref + +- Scheme Procedure: hashv-ref table key [dflt] + Look up KEY in the hash table TABLE, and return the value (if any) + associated with it. If KEY is not found, return DFLT (or `#f' if + no DFLT argument is supplied). Uses `eqv?' for equality testing. + + hashv-set! + +- Scheme Procedure: hashv-set! table key val + Find the entry in TABLE associated with KEY, and store VALUE there. + Uses `eqv?' for equality testing. + + hashv-remove! + +- Scheme Procedure: hashv-remove! table key + Remove KEY (and any value associated with it) from TABLE. Uses + `eqv?' for equality tests. + + hash-get-handle + +- Scheme Procedure: hash-get-handle table key + This procedure returns the `(key . value)' pair from the hash + table TABLE. If TABLE does not hold an associated value for KEY, + `#f' is returned. Uses `equal?' for equality testing. + + hash-create-handle! + +- Scheme Procedure: hash-create-handle! table key init + This function looks up KEY in TABLE and returns its handle. If KEY + is not already present, a new handle is created which associates + KEY with INIT. + + hash-ref + +- Scheme Procedure: hash-ref table key [dflt] + Look up KEY in the hash table TABLE, and return the value (if any) + associated with it. If KEY is not found, return DFLT (or `#f' if + no DFLT argument is supplied). Uses `equal?' for equality testing. + + hash-set! + +- Scheme Procedure: hash-set! table key val + Find the entry in TABLE associated with KEY, and store VAL there. + Uses `equal?' for equality testing. + + hash-remove! + +- Scheme Procedure: hash-remove! table key + Remove KEY (and any value associated with it) from TABLE. Uses + `equal?' for equality tests. + + hashx-get-handle + +- Scheme Procedure: hashx-get-handle hash assoc table key + This behaves the same way as the corresponding `-get-handle' + function, but uses HASH as a hash function and ASSOC to compare + keys. `hash' must be a function that takes two arguments, a key to + be hashed and a table size. `assoc' must be an associator + function, like `assoc', `assq' or `assv'. + + hashx-create-handle! + +- Scheme Procedure: hashx-create-handle! hash assoc table key init + This behaves the same way as the corresponding `-create-handle' + function, but uses HASH as a hash function and ASSOC to compare + keys. `hash' must be a function that takes two arguments, a key to + be hashed and a table size. `assoc' must be an associator + function, like `assoc', `assq' or `assv'. + + hashx-ref + +- Scheme Procedure: hashx-ref hash assoc table key [dflt] + This behaves the same way as the corresponding `ref' function, but + uses HASH as a hash function and ASSOC to compare keys. `hash' + must be a function that takes two arguments, a key to be hashed and + a table size. `assoc' must be an associator function, like + `assoc', `assq' or `assv'. + + By way of illustration, `hashq-ref table key' is equivalent to + `hashx-ref hashq assq table key'. + + hashx-set! + +- Scheme Procedure: hashx-set! hash assoc table key val + This behaves the same way as the corresponding `set!' function, but + uses HASH as a hash function and ASSOC to compare keys. `hash' + must be a function that takes two arguments, a key to be hashed and + a table size. `assoc' must be an associator function, like + `assoc', `assq' or `assv'. + + By way of illustration, `hashq-set! table key' is equivalent to + `hashx-set! hashq assq table key'. + + hashx-remove! + +- Scheme Procedure: hashx-remove! hash assoc table obj + This behaves the same way as the corresponding `remove!' function, + but uses HASH as a hash function and ASSOC to compare keys. `hash' + must be a function that takes two arguments, a key to be hashed and + a table size. `assoc' must be an associator function, like + `assoc', `assq' or `assv'. + + By way of illustration, `hashq-remove! table key' is equivalent to + `hashx-remove! hashq assq #f table key'. + + hash-fold + +- Scheme Procedure: hash-fold proc init table + An iterator over hash-table elements. Accumulates and returns a + result by applying PROC successively. The arguments to PROC are + "(key value prior-result)" where key and value are successive pairs + from the hash table TABLE, and prior-result is either INIT (for the + first application of PROC) or the return value of the previous + application of PROC. For example, `(hash-fold acons '() tab)' will + convert a hash table into an a-list of key-value pairs. + + hash-for-each + +- Scheme Procedure: hash-for-each proc table + An iterator over hash-table elements. Applies PROC successively on + all hash table items. The arguments to PROC are "(key value)" + where key and value are successive pairs from the hash table TABLE. + + hash-for-each-handle + +- Scheme Procedure: hash-for-each-handle proc table + An iterator over hash-table elements. Applies PROC successively on + all hash table handles. + + hash-map->list + +- Scheme Procedure: hash-map->list proc table + An iterator over hash-table elements. Accumulates and returns as a + list the results of applying PROC successively. The arguments to + PROC are "(key value)" where key and value are successive pairs + from the hash table TABLE. + + hash-count + +- Scheme Procedure: hash-count pred table + Return the number of elements in the given hash TABLE that cause + `(PRED KEY VALUE)' to return true. To quickly determine the total + number of elements, use `(const #t)' for PRED. + + make-hook + +- Scheme Procedure: make-hook [n_args] + Create a hook for storing procedure of arity N_ARGS. N_ARGS + defaults to zero. The returned value is a hook object to be used + with the other hook procedures. + + hook? + +- Scheme Procedure: hook? x + Return `#t' if X is a hook, `#f' otherwise. + + hook-empty? + +- Scheme Procedure: hook-empty? hook + Return `#t' if HOOK is an empty hook, `#f' otherwise. + + add-hook! + +- Scheme Procedure: add-hook! hook proc [append_p] + Add the procedure PROC to the hook HOOK. The procedure is added to + the end if APPEND_P is true, otherwise it is added to the front. + The return value of this procedure is not specified. + + remove-hook! + +- Scheme Procedure: remove-hook! hook proc + Remove the procedure PROC from the hook HOOK. The return value of + this procedure is not specified. + + reset-hook! + +- Scheme Procedure: reset-hook! hook + Remove all procedures from the hook HOOK. The return value of this + procedure is not specified. + + run-hook + +- Scheme Procedure: run-hook hook . args + Apply all procedures from the hook HOOK to the arguments ARGS. The + order of the procedure application is first to last. The return + value of this procedure is not specified. + + hook->list + +- Scheme Procedure: hook->list hook + Convert the procedure list of HOOK to a list. + + make-locale + +- Scheme Procedure: make-locale category_list locale_name [base_locale] + Return a reference to a data structure representing a set of locale + datasets. CATEGORY_LIST should be either a list of locale + categories or a single category as used with `setlocale' (see + `setlocale') and LOCALE_NAME should be the name of the locale + considered (e.g., `"sl_SI"'). Optionally, if `base_locale' is + passed, it should be a locale object denoting settings for + categories not listed in CATEGORY_LIST. + + locale? + +- Scheme Procedure: locale? obj + Return true if OBJ is a locale object. + + string-locale? + +- Scheme Procedure: string-locale>? s1 s2 [locale] + Compare strings S1 and S2 in a locale-dependent way.If LOCALE is + provided, it should be locale object (as returned by `make-locale') + and will be used to perform the comparison; otherwise, the current + system locale is used. + + string-locale-ci? + +- Scheme Procedure: string-locale-ci>? s1 s2 [locale] + Compare strings S1 and S2 in a case-insensitive, and + locale-dependent way. If LOCALE is provided, it should be locale + object (as returned by `make-locale') and will be used to perform + the comparison; otherwise, the current system locale is used. + + string-locale-ci=? + +- Scheme Procedure: string-locale-ci=? s1 s2 [locale] + Compare strings S1 and S2 in a case-insensitive, and + locale-dependent way. If LOCALE is provided, it should be locale + object (as returned by `make-locale') and will be used to perform + the comparison; otherwise, the current system locale is used. + + char-locale? + +- Scheme Procedure: char-locale>? c1 c2 [locale] + Return true if character C1 is greater than C2 according to LOCALE + or to the current locale. + + char-locale-ci? + +- Scheme Procedure: char-locale-ci>? c1 c2 [locale] + Return true if character C1 is greater than C2, in a case + insensitive way according to LOCALE or to the current locale. + + char-locale-ci=? + +- Scheme Procedure: char-locale-ci=? c1 c2 [locale] + Return true if character C1 is equal to C2, in a case insensitive + way according to LOCALE or to the current locale. + + char-locale-downcase + +- Scheme Procedure: char-locale-downcase chr [locale] + Return the lowercase character that corresponds to CHR according to + either LOCALE or the current locale. + + char-locale-upcase + +- Scheme Procedure: char-locale-upcase chr [locale] + Return the uppercase character that corresponds to CHR according to + either LOCALE or the current locale. + + char-locale-titlecase + +- Scheme Procedure: char-locale-titlecase chr [locale] + Return the titlecase character that corresponds to CHR according to + either LOCALE or the current locale. + + string-locale-upcase + +- Scheme Procedure: string-locale-upcase str [locale] + Return a new string that is the uppercase version of STR according + to either LOCALE or the current locale. + + string-locale-downcase + +- Scheme Procedure: string-locale-downcase str [locale] + Return a new string that is the down-case version of STR according + to either LOCALE or the current locale. + + string-locale-titlecase + +- Scheme Procedure: string-locale-titlecase str [locale] + Return a new string that is the title-case version of STR according + to either LOCALE or the current locale. + + locale-string->integer + +- Scheme Procedure: locale-string->integer str [base [locale]] + Convert string STR into an integer according to either LOCALE (a + locale object as returned by `make-locale') or the current process + locale. Return two values: an integer (on success) or `#f', and + the number of characters read from STR (`0' on failure). + + locale-string->inexact + +- Scheme Procedure: locale-string->inexact str [locale] + Convert string STR into an inexact number according to either + LOCALE (a locale object as returned by `make-locale') or the + current process locale. Return two values: an inexact number (on + success) or `#f', and the number of characters read from STR (`0' + on failure). + + nl-langinfo + +- Scheme Procedure: nl-langinfo item [locale] + Return a string denoting locale information for ITEM in the current + locale or that specified by LOCALE. The semantics and arguments + are the same as those of the X/Open `nl_langinfo' function (see + `nl_langinfo' in manual `nl_langinfo'The GNU C Library Reference + Manual). + + ftell + +- Scheme Procedure: ftell fd_port + Return an integer representing the current position of FD_PORT, + measured from the beginning. Equivalent to: + + (seek port 0 SEEK_CUR) + + redirect-port + +- Scheme Procedure: redirect-port old new + This procedure takes two ports and duplicates the underlying file + descriptor from OLD into NEW. The current file descriptor in NEW + will be closed. After the redirection the two ports will share a + file position and file status flags. + + The return value is unspecified. + + Unexpected behaviour can result if both ports are subsequently used + and the original and/or duplicate ports are buffered. + + This procedure does not have any side effects on other ports or + revealed counts. + + dup->fdes + +- Scheme Procedure: dup->fdes fd_or_port [fd] + Return a new integer file descriptor referring to the open file + designated by FD_OR_PORT, which must be either an open file port or + a file descriptor. + + dup2 + +- Scheme Procedure: dup2 oldfd newfd + A simple wrapper for the `dup2' system call. Copies the file + descriptor OLDFD to descriptor number NEWFD, replacing the previous + meaning of NEWFD. Both OLDFD and NEWFD must be integers. Unlike + for dup->fdes or primitive-move->fdes, no attempt is made to move + away ports which are using NEWFD. The return value is unspecified. + + fileno + +- Scheme Procedure: fileno port + Return the integer file descriptor underlying PORT. Does not + change its revealed count. + + isatty? + +- Scheme Procedure: isatty? port + Return `#t' if PORT is using a serial non--file device, otherwise + `#f'. + + fdopen + +- Scheme Procedure: fdopen fdes modes + Return a new port based on the file descriptor FDES. Modes are + given by the string MODES. The revealed count of the port is + initialized to zero. The modes string is the same as that accepted + by open-file. + + primitive-move->fdes + +- Scheme Procedure: primitive-move->fdes port fd + Moves the underlying file descriptor for PORT to the integer value + FD without changing the revealed count of PORT. Any other ports + already using this descriptor will be automatically shifted to new + descriptors and their revealed counts reset to zero. The return + value is `#f' if the file descriptor already had the required value + or `#t' if it was moved. + + fdes->ports + +- Scheme Procedure: fdes->ports fd + Return a list of existing ports which have FD as an underlying file + descriptor, without changing their revealed counts. + + keyword? + +- Scheme Procedure: keyword? obj + Return `#t' if the argument OBJ is a keyword, else `#f'. + + symbol->keyword + +- Scheme Procedure: symbol->keyword symbol + Return the keyword with the same name as SYMBOL. + + keyword->symbol + +- Scheme Procedure: keyword->symbol keyword + Return the symbol with the same name as KEYWORD. + + make-list + +- Scheme Procedure: make-list n [init] + Create a list containing of N elements, where each element is + initialized to INIT. INIT defaults to the empty list `()' if not + given. + + cons* + +- Scheme Procedure: cons* arg . rest + Like `list', but the last arg provides the tail of the constructed + list, returning `(cons ARG1 (cons ARG2 (cons ... ARGN)))'. Requires + at least one argument. If given one argument, that argument is + returned as result. This function is called `list*' in some other + Schemes and in Common LISP. + + null? + +- Scheme Procedure: null? x + Return `#t' iff X is the empty list, else `#f'. + + list? + +- Scheme Procedure: list? x + Return `#t' iff X is a proper list, else `#f'. + + length + +- Scheme Procedure: length lst + Return the number of elements in list LST. + + append + +- Scheme Procedure: append . args + Return a list consisting of the elements the lists passed as + arguments. + + (append '(x) '(y)) ==> (x y) + (append '(a) '(b c d)) ==> (a b c d) + (append '(a (b)) '((c))) ==> (a (b) (c)) + + The resulting list is always newly allocated, except that it shares + structure with the last list argument. The last argument may + actually be any object; an improper list results if the last + argument is not a proper list. + + (append '(a b) '(c . d)) ==> (a b c . d) + (append '() 'a) ==> a + + append! + +- Scheme Procedure: append! . args + A destructive version of `append' (see in manual The Revised^5 + Report on Scheme). The cdr field of each list's final pair is + changed to point to the head of the next list, so no consing is + performed. Return the mutated list. + + last-pair + +- Scheme Procedure: last-pair lst + Return the last pair in LST, signalling an error if LST is + circular. + + reverse + +- Scheme Procedure: reverse lst + Return a new list that contains the elements of LST but in reverse + order. + + reverse! + +- Scheme Procedure: reverse! lst [new_tail] + A destructive version of `reverse' (see in manual The Revised^5 + Report on Scheme). The cdr of each cell in LST is modified to + point to the previous list element. Return the reversed list. + + Caveat: because the list is modified in place, the tail of the + original list now becomes its head, and the head of the original + list now becomes the tail. Therefore, the LST symbol to which the + head of the original list was bound now points to the tail. To + ensure that the head of the modified list is not lost, it is wise + to save the return value of `reverse!' + + list-ref + +- Scheme Procedure: list-ref list k + Return the Kth element from LIST. + + list-set! + +- Scheme Procedure: list-set! list k val + Set the Kth element of LIST to VAL. + + list-cdr-ref + +- Scheme Procedure: list-cdr-ref + implemented by the C function "scm_list_tail" + + list-tail + +- Scheme Procedure: list-tail lst k + + + Return the "tail" of LST beginning with its Kth element. The first + element of the list is considered to be element 0. + + `list-tail' and `list-cdr-ref' are identical. It may help to think + of `list-cdr-ref' as accessing the Kth cdr of the list, or + returning the results of cdring K times down LST. + + list-cdr-set! + +- Scheme Procedure: list-cdr-set! list k val + Set the Kth cdr of LIST to VAL. + + list-head + +- Scheme Procedure: list-head lst k + Copy the first K elements from LST into a new list, and return it. + + list-copy + +- Scheme Procedure: list-copy lst + Return a (newly-created) copy of LST. + + list + +- Scheme Procedure: list . objs + Return a list containing OBJS, the arguments to `list'. + + memq + +- Scheme Procedure: memq x lst + Return the first sublist of LST whose car is `eq?' to X where the + sublists of LST are the non-empty lists returned by `(list-tail LST + K)' for K less than the length of LST. If X does not occur in LST, + then `#f' (not the empty list) is returned. + + memv + +- Scheme Procedure: memv x lst + Return the first sublist of LST whose car is `eqv?' to X where the + sublists of LST are the non-empty lists returned by `(list-tail LST + K)' for K less than the length of LST. If X does not occur in LST, + then `#f' (not the empty list) is returned. + + member + +- Scheme Procedure: member x lst + Return the first sublist of LST whose car is `equal?' to X where + the sublists of LST are the non-empty lists returned by `(list-tail + LST K)' for K less than the length of LST. If X does not occur in + LST, then `#f' (not the empty list) is returned. + + delq! + +- Scheme Procedure: delq! item lst + + + + + These procedures are destructive versions of `delq', `delv' and + `delete': they modify the existing LST rather than creating a new + list. Caveat evaluator: Like other destructive list functions, + these functions cannot modify the binding of LST, and so cannot be + used to delete the first element of LST destructively. + + delv! + +- Scheme Procedure: delv! item lst + Destructively remove all elements from LST that are `eqv?' to ITEM. + + delete! + +- Scheme Procedure: delete! item lst + Destructively remove all elements from LST that are `equal?' to + ITEM. + + delq + +- Scheme Procedure: delq item lst + Return a newly-created copy of LST with elements `eq?' to ITEM + removed. This procedure mirrors `memq': `delq' compares elements + of LST against ITEM with `eq?'. + + delv + +- Scheme Procedure: delv item lst + Return a newly-created copy of LST with elements `eqv?' to ITEM + removed. This procedure mirrors `memv': `delv' compares elements + of LST against ITEM with `eqv?'. + + delete + +- Scheme Procedure: delete item lst + Return a newly-created copy of LST with elements `equal?' to ITEM + removed. This procedure mirrors `member': `delete' compares + elements of LST against ITEM with `equal?'. + + delq1! + +- Scheme Procedure: delq1! item lst + Like `delq!', but only deletes the first occurrence of ITEM from + LST. Tests for equality using `eq?'. See also `delv1!' and + `delete1!'. + + delv1! + +- Scheme Procedure: delv1! item lst + Like `delv!', but only deletes the first occurrence of ITEM from + LST. Tests for equality using `eqv?'. See also `delq1!' and + `delete1!'. + + delete1! + +- Scheme Procedure: delete1! item lst + Like `delete!', but only deletes the first occurrence of ITEM from + LST. Tests for equality using `equal?'. See also `delq1!' and + `delv1!'. + + filter + +- Scheme Procedure: filter pred list + Return all the elements of 2nd arg LIST that satisfy predicate + PRED. The list is not disordered -- elements that appear in the + result list occur in the same order as they occur in the argument + list. The returned list may share a common tail with the argument + list. The dynamic order in which the various applications of pred + are made is not specified. + + (filter even? '(0 7 8 8 43 -4)) => (0 8 8 -4) + + filter! + +- Scheme Procedure: filter! pred list + Linear-update variant of `filter'. + + primitive-load + +- Scheme Procedure: primitive-load filename + Load the file named FILENAME and evaluate its contents in the + top-level environment. The load paths are not searched; FILENAME + must either be a full pathname or be a pathname relative to the + current directory. If the variable `%load-hook' is defined, it + should be bound to a procedure that will be called before any code + is loaded. See the documentation for `%load-hook' later in this + section. + + %package-data-dir + +- Scheme Procedure: %package-data-dir + Return the name of the directory where Scheme packages, modules and + libraries are kept. On most Unix systems, this will be + `/usr/local/share/guile'. + + %library-dir + +- Scheme Procedure: %library-dir + Return the directory where the Guile Scheme library files are + installed. E.g., may return "/usr/share/guile/1.3.5". + + %site-dir + +- Scheme Procedure: %site-dir + Return the directory where users should install Scheme code for use + with this version of Guile. + + E.g., may return "/usr/share/guile/site/2.2". + + %global-site-dir + +- Scheme Procedure: %global-site-dir + Return the directory where users should install Scheme code for use + with all versions of Guile. + + E.g., may return "/usr/share/guile/site". + + %site-ccache-dir + +- Scheme Procedure: %site-ccache-dir + Return the directory where users should install compiled `.go' + files for use with this version of Guile. + + E.g., may return "/usr/lib/guile/2.2/site-ccache". + + parse-path + +- Scheme Procedure: parse-path path [tail] + Parse PATH, which is expected to be a colon-separated string, into + a list and return the resulting list with TAIL appended. If PATH + is `#f', TAIL is returned. + + parse-path-with-ellipsis + +- Scheme Procedure: parse-path-with-ellipsis path base + Parse PATH, which is expected to be a colon-separated string, into + a list and return the resulting list with BASE (a list) spliced in + place of the `...' path component, if present, or else BASE is + added to the end. If PATH is `#f', BASE is returned. + + search-path + +- Scheme Procedure: search-path path filename . rest + Search PATH for a directory containing a file named FILENAME. The + file must be readable, and not a directory. If we find one, return + its full filename; otherwise, return `#f'. If FILENAME is + absolute, return it unchanged. If given, REST is a list of + extension strings; for each directory in PATH, we search for + FILENAME concatenated with each extension. + + %search-load-path + +- Scheme Procedure: %search-load-path filename + Search %LOAD-PATH for the file named FILENAME, which must be + readable by the current user. If FILENAME is found in the list of + paths to search or is an absolute pathname, return its full + pathname. Otherwise, return `#f'. Filenames may have any of the + optional extensions in the `%load-extensions' list; + `%search-load-path' will try each extension automatically. + + %warn-auto-compilation-enabled + +- Scheme Procedure: %warn-auto-compilation-enabled + primitive-load-path + +- Scheme Procedure: primitive-load-path . args + Search %LOAD-PATH for the file named FILENAME and load it into the + top-level environment. + + If FILENAME is a relative pathname and is not found in the list of + search paths, one of three things may happen, depending on the + optional second argument, EXCEPTION_ON_NOT_FOUND. If it is `#f', + `#f' will be returned. If it is a procedure, it will be called + with no arguments. Otherwise an error is signalled. + + make-syntax-transformer + +- Scheme Procedure: make-syntax-transformer name type binding + Construct a "syntax transformer". + + This function is part of Guile's low-level support for the psyntax + syntax expander. Users should not call this function. + + macro? + +- Scheme Procedure: macro? obj + Return `#t' if OBJ is a syntax transformer (an object that + transforms Scheme expressions at expansion-time). + + Macros are actually just one kind of syntax transformer; this + procedure has its name due to historical reasons. + + macro-type + +- Scheme Procedure: macro-type m + Return the type of the syntax transformer M, as passed to + `make-syntax-transformer'. If M is a primitive syntax transformer, + `#f' will be returned. + + macro-name + +- Scheme Procedure: macro-name m + Return the name of the syntax transformer M. + + macro-transformer + +- Scheme Procedure: macro-transformer m + Return the transformer procedure of the macro M. + + If M is a syntax transformer but not a macro, `#f' will be + returned. (This can happen, for example, with primitive syntax + transformers). + + macro-binding + +- Scheme Procedure: macro-binding m + Return the binding of the syntax transformer M, as passed to + `make-syntax-transformer'. If M is a primitive syntax transformer, + `#f' will be returned. + + memoize-expression + +- Scheme Procedure: memoize-expression exp + Memoize the expression EXP. + + unmemoize-expression + +- Scheme Procedure: unmemoize-expression m + Unmemoize the memoized expression M. + + memoized-typecode + +- Scheme Procedure: memoized-typecode sym + Return the memoized typecode corresponding to the symbol SYM. + + %resolve-variable + +- Scheme Procedure: %resolve-variable loc mod + Look up and return the variable for LOC. + + current-module + +- Scheme Procedure: current-module + Return the current module. + + set-current-module + +- Scheme Procedure: set-current-module module + Set the current module to MODULE and return the previous current + module. + + interaction-environment + +- Scheme Procedure: interaction-environment + Return a specifier for the environment that contains + implementation--defined bindings, typically a superset of those + listed in the report. The intent is that this procedure will + return the environment in which the implementation would evaluate + expressions dynamically typed by the user. + + module-local-variable + +- Scheme Procedure: module-local-variable module sym + Return the variable bound to SYM in MODULE. Return `#f' is SYM is + not bound locally in MODULE. + + module-variable + +- Scheme Procedure: module-variable module sym + Return the variable bound to SYM in MODULE. This may be both a + local variable or an imported variable. Return `#f' is SYM is not + bound in MODULE. + + module-transformer + +- Scheme Procedure: module-transformer module + Returns the syntax expander for the given module. + + module-import-interface + +- Scheme Procedure: module-import-interface module sym + Return the module or interface from which SYM is imported in + MODULE. If SYM is not imported (i.e., it is not defined in MODULE + or it is a module-local binding instead of an imported one), then + `#f' is returned. + + define! + +- Scheme Procedure: define! sym value + Define SYM to be VALUE in the current module.Returns the variable + itself. Note that this is a procedure, not a macro. + + module-reverse-lookup + +- Scheme Procedure: module-reverse-lookup module variable + Return the symbol under which VARIABLE is bound in MODULE or #F if + VARIABLE is not visible from MODULE. If MODULE is `#f', then the + pre-module obarray is used. + + %get-pre-modules-obarray + +- Scheme Procedure: %get-pre-modules-obarray + Return the obarray that is used for all new bindings before the + module system is booted. The first call to `set-current-module' + will boot the module system. + + exact? + +- Scheme Procedure: exact? x + Return `#t' if X is an exact number, `#f' otherwise. + + inexact? + +- Scheme Procedure: inexact? x + Return `#t' if X is an inexact number, `#f' else. + + odd? + +- Scheme Procedure: odd? n + Return `#t' if N is an odd number, `#f' otherwise. + + even? + +- Scheme Procedure: even? n + Return `#t' if N is an even number, `#f' otherwise. + + finite? + +- Scheme Procedure: finite? x + Return `#t' if the real number X is neither infinite nor a NaN, + `#f' otherwise. + + inf? + +- Scheme Procedure: inf? x + Return `#t' if the real number X is `+inf.0' or `-inf.0'. Otherwise + return `#f'. + + nan? + +- Scheme Procedure: nan? x + Return `#t' if the real number X is a NaN, or `#f' otherwise. + + inf + +- Scheme Procedure: inf + Return Inf. + + nan + +- Scheme Procedure: nan + Return NaN. + + abs + +- Scheme Procedure: abs x + Return the absolute value of X. + + quotient + +- Scheme Procedure: quotient x y + Return the quotient of the numbers X and Y. + + remainder + +- Scheme Procedure: remainder x y + Return the remainder of the numbers X and Y. + + (remainder 13 4) ==> 1 + (remainder -13 4) ==> -1 + + modulo + +- Scheme Procedure: modulo x y + Return the modulo of the numbers X and Y. + + (modulo 13 4) ==> 1 + (modulo -13 4) ==> 3 + + euclidean-quotient + +- Scheme Procedure: euclidean-quotient x y + Return the integer Q such that X = Q*Y + R where 0 <= R < abs(Y). + + (euclidean-quotient 123 10) ==> 12 + (euclidean-quotient 123 -10) ==> -12 + (euclidean-quotient -123 10) ==> -13 + (euclidean-quotient -123 -10) ==> 13 + (euclidean-quotient -123.2 -63.5) ==> 2.0 + (euclidean-quotient 16/3 -10/7) ==> -3 + + euclidean-remainder + +- Scheme Procedure: euclidean-remainder x y + Return the real number R such that 0 <= R < abs(Y) and X = Q*Y + R + for some integer Q. + + (euclidean-remainder 123 10) ==> 3 + (euclidean-remainder 123 -10) ==> 3 + (euclidean-remainder -123 10) ==> 7 + (euclidean-remainder -123 -10) ==> 7 + (euclidean-remainder -123.2 -63.5) ==> 3.8 + (euclidean-remainder 16/3 -10/7) ==> 22/21 + + euclidean/ + +- Scheme Procedure: euclidean/ x y + Return the integer Q and the real number R such that X = Q*Y + R + and 0 <= R < abs(Y). + + (euclidean/ 123 10) ==> 12 and 3 + (euclidean/ 123 -10) ==> -12 and 3 + (euclidean/ -123 10) ==> -13 and 7 + (euclidean/ -123 -10) ==> 13 and 7 + (euclidean/ -123.2 -63.5) ==> 2.0 and 3.8 + (euclidean/ 16/3 -10/7) ==> -3 and 22/21 + + floor-quotient + +- Scheme Procedure: floor-quotient x y + Return the floor of X / Y. + + (floor-quotient 123 10) ==> 12 + (floor-quotient 123 -10) ==> -13 + (floor-quotient -123 10) ==> -13 + (floor-quotient -123 -10) ==> 12 + (floor-quotient -123.2 -63.5) ==> 1.0 + (floor-quotient 16/3 -10/7) ==> -4 + + floor-remainder + +- Scheme Procedure: floor-remainder x y + Return the real number R such that X = Q*Y + R where Q = floor(X / + Y). + + (floor-remainder 123 10) ==> 3 + (floor-remainder 123 -10) ==> -7 + (floor-remainder -123 10) ==> 7 + (floor-remainder -123 -10) ==> -3 + (floor-remainder -123.2 -63.5) ==> -59.7 + (floor-remainder 16/3 -10/7) ==> -8/21 + + floor/ + +- Scheme Procedure: floor/ x y + Return the integer Q and the real number R such that X = Q*Y + R + and Q = floor(X / Y). + + (floor/ 123 10) ==> 12 and 3 + (floor/ 123 -10) ==> -13 and -7 + (floor/ -123 10) ==> -13 and 7 + (floor/ -123 -10) ==> 12 and -3 + (floor/ -123.2 -63.5) ==> 1.0 and -59.7 + (floor/ 16/3 -10/7) ==> -4 and -8/21 + + ceiling-quotient + +- Scheme Procedure: ceiling-quotient x y + Return the ceiling of X / Y. + + (ceiling-quotient 123 10) ==> 13 + (ceiling-quotient 123 -10) ==> -12 + (ceiling-quotient -123 10) ==> -12 + (ceiling-quotient -123 -10) ==> 13 + (ceiling-quotient -123.2 -63.5) ==> 2.0 + (ceiling-quotient 16/3 -10/7) ==> -3 + + ceiling-remainder + +- Scheme Procedure: ceiling-remainder x y + Return the real number R such that X = Q*Y + R where Q = ceiling(X + / Y). + + (ceiling-remainder 123 10) ==> -7 + (ceiling-remainder 123 -10) ==> 3 + (ceiling-remainder -123 10) ==> -3 + (ceiling-remainder -123 -10) ==> 7 + (ceiling-remainder -123.2 -63.5) ==> 3.8 + (ceiling-remainder 16/3 -10/7) ==> 22/21 + + ceiling/ + +- Scheme Procedure: ceiling/ x y + Return the integer Q and the real number R such that X = Q*Y + R + and Q = ceiling(X / Y). + + (ceiling/ 123 10) ==> 13 and -7 + (ceiling/ 123 -10) ==> -12 and 3 + (ceiling/ -123 10) ==> -12 and -3 + (ceiling/ -123 -10) ==> 13 and 7 + (ceiling/ -123.2 -63.5) ==> 2.0 and 3.8 + (ceiling/ 16/3 -10/7) ==> -3 and 22/21 + + truncate-quotient + +- Scheme Procedure: truncate-quotient x y + Return X / Y rounded toward zero. + + (truncate-quotient 123 10) ==> 12 + (truncate-quotient 123 -10) ==> -12 + (truncate-quotient -123 10) ==> -12 + (truncate-quotient -123 -10) ==> 12 + (truncate-quotient -123.2 -63.5) ==> 1.0 + (truncate-quotient 16/3 -10/7) ==> -3 + + truncate-remainder + +- Scheme Procedure: truncate-remainder x y + Return the real number R such that X = Q*Y + R where Q = truncate(X + / Y). + + (truncate-remainder 123 10) ==> 3 + (truncate-remainder 123 -10) ==> 3 + (truncate-remainder -123 10) ==> -3 + (truncate-remainder -123 -10) ==> -3 + (truncate-remainder -123.2 -63.5) ==> -59.7 + (truncate-remainder 16/3 -10/7) ==> 22/21 + + truncate/ + +- Scheme Procedure: truncate/ x y + Return the integer Q and the real number R such that X = Q*Y + R + and Q = truncate(X / Y). + + (truncate/ 123 10) ==> 12 and 3 + (truncate/ 123 -10) ==> -12 and 3 + (truncate/ -123 10) ==> -12 and -3 + (truncate/ -123 -10) ==> 12 and -3 + (truncate/ -123.2 -63.5) ==> 1.0 and -59.7 + (truncate/ 16/3 -10/7) ==> -3 and 22/21 + + centered-quotient + +- Scheme Procedure: centered-quotient x y + Return the integer Q such that X = Q*Y + R where -abs(Y/2) <= R < + abs(Y/2). + + (centered-quotient 123 10) ==> 12 + (centered-quotient 123 -10) ==> -12 + (centered-quotient -123 10) ==> -12 + (centered-quotient -123 -10) ==> 12 + (centered-quotient -123.2 -63.5) ==> 2.0 + (centered-quotient 16/3 -10/7) ==> -4 + + centered-remainder + +- Scheme Procedure: centered-remainder x y + Return the real number R such that -abs(Y/2) <= R < abs(Y/2) and X + = Q*Y + R for some integer Q. + + (centered-remainder 123 10) ==> 3 + (centered-remainder 123 -10) ==> 3 + (centered-remainder -123 10) ==> -3 + (centered-remainder -123 -10) ==> -3 + (centered-remainder -123.2 -63.5) ==> 3.8 + (centered-remainder 16/3 -10/7) ==> -8/21 + + centered/ + +- Scheme Procedure: centered/ x y + Return the integer Q and the real number R such that X = Q*Y + R + and -abs(Y/2) <= R < abs(Y/2). + + (centered/ 123 10) ==> 12 and 3 + (centered/ 123 -10) ==> -12 and 3 + (centered/ -123 10) ==> -12 and -3 + (centered/ -123 -10) ==> 12 and -3 + (centered/ -123.2 -63.5) ==> 2.0 and 3.8 + (centered/ 16/3 -10/7) ==> -4 and -8/21 + + round-quotient + +- Scheme Procedure: round-quotient x y + Return X / Y to the nearest integer, with ties going to the nearest + even integer. + + (round-quotient 123 10) ==> 12 + (round-quotient 123 -10) ==> -12 + (round-quotient -123 10) ==> -12 + (round-quotient -123 -10) ==> 12 + (round-quotient 125 10) ==> 12 + (round-quotient 127 10) ==> 13 + (round-quotient 135 10) ==> 14 + (round-quotient -123.2 -63.5) ==> 2.0 + (round-quotient 16/3 -10/7) ==> -4 + + round-remainder + +- Scheme Procedure: round-remainder x y + Return the real number R such that X = Q*Y + R, where Q is X / Y + rounded to the nearest integer, with ties going to the nearest even + integer. + + (round-remainder 123 10) ==> 3 + (round-remainder 123 -10) ==> 3 + (round-remainder -123 10) ==> -3 + (round-remainder -123 -10) ==> -3 + (round-remainder 125 10) ==> 5 + (round-remainder 127 10) ==> -3 + (round-remainder 135 10) ==> -5 + (round-remainder -123.2 -63.5) ==> 3.8 + (round-remainder 16/3 -10/7) ==> -8/21 + + round/ + +- Scheme Procedure: round/ x y + Return the integer Q and the real number R such that X = Q*Y + R + and Q is X / Y rounded to the nearest integer, with ties going to + the nearest even integer. + + (round/ 123 10) ==> 12 and 3 + (round/ 123 -10) ==> -12 and 3 + (round/ -123 10) ==> -12 and -3 + (round/ -123 -10) ==> 12 and -3 + (round/ 125 10) ==> 12 and 5 + (round/ 127 10) ==> 13 and -3 + (round/ 135 10) ==> 14 and -5 + (round/ -123.2 -63.5) ==> 2.0 and 3.8 + (round/ 16/3 -10/7) ==> -4 and -8/21 + + gcd + +- Scheme Procedure: gcd [x [y . rest]] + Return the greatest common divisor of all parameter values. If + called without arguments, 0 is returned. + + lcm + +- Scheme Procedure: lcm [x [y . rest]] + Return the least common multiple of the arguments. If called + without arguments, 1 is returned. + + logand + +- Scheme Procedure: logand [x [y . rest]] + Return the bitwise AND of the integer arguments. + + (logand) ==> -1 + (logand 7) ==> 7 + (logand #b111 #b011 #b001) ==> 1 + + logior + +- Scheme Procedure: logior [x [y . rest]] + Return the bitwise OR of the integer arguments. + + (logior) ==> 0 + (logior 7) ==> 7 + (logior #b000 #b001 #b011) ==> 3 + + logxor + +- Scheme Procedure: logxor [x [y . rest]] + Return the bitwise XOR of the integer arguments. A bit is set in + the result if it is set in an odd number of arguments. + + (logxor) ==> 0 + (logxor 7) ==> 7 + (logxor #b000 #b001 #b011) ==> 2 + (logxor #b000 #b001 #b011 #b011) ==> 1 + + logtest + +- Scheme Procedure: logtest j k + Test whether J and K have any 1 bits in common. This is equivalent + to `(not (zero? (logand j k)))', but without actually calculating + the `logand', just testing for non-zero. + + (logtest #b0100 #b1011) ==> #f + (logtest #b0100 #b0111) ==> #t + + logbit? + +- Scheme Procedure: logbit? index j + Test whether bit number INDEX in J is set. INDEX starts from 0 for + the least significant bit. + + (logbit? 0 #b1101) ==> #t + (logbit? 1 #b1101) ==> #f + (logbit? 2 #b1101) ==> #t + (logbit? 3 #b1101) ==> #t + (logbit? 4 #b1101) ==> #f + + lognot + +- Scheme Procedure: lognot n + Return the integer which is the ones-complement of the integer + argument. + + (number->string (lognot #b10000000) 2) + ==> "-10000001" + (number->string (lognot #b0) 2) + ==> "-1" + + modulo-expt + +- Scheme Procedure: modulo-expt n k m + Return N raised to the integer exponent K, modulo M. + + (modulo-expt 2 3 5) + ==> 3 + + integer-expt + +- Scheme Procedure: integer-expt n k + Return N raised to the power K. K must be an exact integer, N can + be any number. + + Negative K is supported, and results in 1/N^abs(K) in the usual + way. N^0 is 1, as usual, and that includes 0^0 is 1. + + (integer-expt 2 5) ==> 32 + (integer-expt -3 3) ==> -27 + (integer-expt 5 -3) ==> 1/125 + (integer-expt 0 0) ==> 1 + + ash + +- Scheme Procedure: ash n count + Return floor(N * 2^COUNT). N and COUNT must be exact integers. + + With N viewed as an infinite-precision twos-complement integer, + `ash' means a left shift introducing zero bits when COUNT is + positive, or a right shift dropping bits when COUNT is negative. + This is an ``arithmetic'' shift. + + (number->string (ash #b1 3) 2) ==> "1000" + (number->string (ash #b1010 -1) 2) ==> "101" + + ;; -23 is bits ...11101001, -6 is bits ...111010 + (ash -23 -2) ==> -6 + + round-ash + +- Scheme Procedure: round-ash n count + Return round(N * 2^COUNT). N and COUNT must be exact integers. + + With N viewed as an infinite-precision twos-complement integer, + `round-ash' means a left shift introducing zero bits when COUNT is + positive, or a right shift rounding to the nearest integer (with + ties going to the nearest even integer) when COUNT is negative. + This is a rounded ``arithmetic'' shift. + + (number->string (round-ash #b1 3) 2) ==> "1000" + (number->string (round-ash #b1010 -1) 2) ==> "101" + (number->string (round-ash #b1010 -2) 2) ==> "10" + (number->string (round-ash #b1011 -2) 2) ==> "11" + (number->string (round-ash #b1101 -2) 2) ==> "11" + (number->string (round-ash #b1110 -2) 2) ==> "100" + + bit-extract + +- Scheme Procedure: bit-extract n start end + Return the integer composed of the START (inclusive) through END + (exclusive) bits of N. The STARTth bit becomes the 0-th bit in the + result. + + (number->string (bit-extract #b1101101010 0 4) 2) + ==> "1010" + (number->string (bit-extract #b1101101010 4 9) 2) + ==> "10110" + + logcount + +- Scheme Procedure: logcount n + Return the number of bits in integer N. If integer is positive, + the 1-bits in its binary representation are counted. If negative, + the 0-bits in its two's-complement binary representation are + counted. If 0, 0 is returned. + + (logcount #b10101010) + ==> 4 + (logcount 0) + ==> 0 + (logcount -2) + ==> 1 + + integer-length + +- Scheme Procedure: integer-length n + Return the number of bits necessary to represent N. + + (integer-length #b10101010) + ==> 8 + (integer-length 0) + ==> 0 + (integer-length #b1111) + ==> 4 + + number->string + +- Scheme Procedure: number->string n [radix] + Return a string holding the external representation of the number N + in the given RADIX. If N is inexact, a radix of 10 will be used. + + string->number + +- Scheme Procedure: string->number string [radix] + Return a number of the maximally precise representation expressed + by the given STRING. RADIX must be an exact integer, either 2, 8, + 10, or 16. If supplied, RADIX is a default radix that may be + overridden by an explicit radix prefix in STRING (e.g. "#o177"). + If RADIX is not supplied, then the default radix is 10. If string + is not a syntactically valid notation for a number, then + `string->number' returns `#f'. + + number? + +- Scheme Procedure: number? x + Return `#t' if X is a number, `#f' otherwise. + + complex? + +- Scheme Procedure: complex? x + Return `#t' if X is a complex number, `#f' otherwise. Note that + the sets of real, rational and integer values form subsets of the + set of complex numbers, i. e. the predicate will also be + fulfilled if X is a real, rational or integer number. + + real? + +- Scheme Procedure: real? x + Return `#t' if X is a real number, `#f' otherwise. Note that the + set of integer values forms a subset of the set of real numbers, i. + e. the predicate will also be fulfilled if X is an integer number. + + rational? + +- Scheme Procedure: rational? x + Return `#t' if X is a rational number, `#f' otherwise. Note that + the set of integer values forms a subset of the set of rational + numbers, i. e. the predicate will also be fulfilled if X is an + integer number. + + integer? + +- Scheme Procedure: integer? x + Return `#t' if X is an integer number, else return `#f'. + + exact-integer? + +- Scheme Procedure: exact-integer? x + Return `#t' if X is an exact integer number, else return `#f'. + + = + +- Scheme Procedure: = [x [y . rest]] + Return `#t' if all parameters are numerically equal. + + < + +- Scheme Procedure: < [x [y . rest]] + Return `#t' if the list of parameters is monotonically increasing. + + > + +- Scheme Procedure: > [x [y . rest]] + Return `#t' if the list of parameters is monotonically decreasing. + + <= + +- Scheme Procedure: <= [x [y . rest]] + Return `#t' if the list of parameters is monotonically + non-decreasing. + + >= + +- Scheme Procedure: >= [x [y . rest]] + Return `#t' if the list of parameters is monotonically + non-increasing. + + zero? + +- Scheme Procedure: zero? z + Return `#t' if Z is an exact or inexact number equal to zero. + + positive? + +- Scheme Procedure: positive? x + Return `#t' if X is an exact or inexact number greater than zero. + + negative? + +- Scheme Procedure: negative? x + Return `#t' if X is an exact or inexact number less than zero. + + max + +- Scheme Procedure: max [x [y . rest]] + Return the maximum of all parameter values. + + min + +- Scheme Procedure: min [x [y . rest]] + Return the minimum of all parameter values. + + + + +- Scheme Procedure: + [x [y . rest]] + Return the sum of all parameter values. Return 0 if called without + any parameters. + + 1+ + +- Scheme Procedure: 1+ x + Return X+1. + + - + +- Scheme Procedure: - [x [y . rest]] + If called with one argument Z1, -Z1 returned. Otherwise the sum of + all but the first argument are subtracted from the first argument. + + 1- + +- Scheme Procedure: 1- x + Return X-1. + + * + +- Scheme Procedure: * [x [y . rest]] + Return the product of all arguments. If called without arguments, + 1 is returned. + + / + +- Scheme Procedure: / [x [y . rest]] + Divide the first argument by the product of the remaining + arguments. If called with one argument Z1, 1/Z1 is returned. + + truncate + +- Scheme Procedure: truncate x + Round the number X towards zero. + + round + +- Scheme Procedure: round x + Round the number X towards the nearest integer. When it is exactly + halfway between two integers, round towards the even one. + + floor + +- Scheme Procedure: floor x + Round the number X towards minus infinity. + + ceiling + +- Scheme Procedure: ceiling x + Round the number X towards infinity. + + expt + +- Scheme Procedure: expt x y + Return X raised to the power of Y. + + sin + +- Scheme Procedure: sin z + Compute the sine of Z. + + cos + +- Scheme Procedure: cos z + Compute the cosine of Z. + + tan + +- Scheme Procedure: tan z + Compute the tangent of Z. + + sinh + +- Scheme Procedure: sinh z + Compute the hyperbolic sine of Z. + + cosh + +- Scheme Procedure: cosh z + Compute the hyperbolic cosine of Z. + + tanh + +- Scheme Procedure: tanh z + Compute the hyperbolic tangent of Z. + + asin + +- Scheme Procedure: asin z + Compute the arc sine of Z. + + acos + +- Scheme Procedure: acos z + Compute the arc cosine of Z. + + atan + +- Scheme Procedure: atan z [y] + With one argument, compute the arc tangent of Z. If Y is present, + compute the arc tangent of Z/Y, using the sign of Z and Y to + determine the quadrant. + + asinh + +- Scheme Procedure: asinh z + Compute the inverse hyperbolic sine of Z. + + acosh + +- Scheme Procedure: acosh z + Compute the inverse hyperbolic cosine of Z. + + atanh + +- Scheme Procedure: atanh z + Compute the inverse hyperbolic tangent of Z. + + make-rectangular + +- Scheme Procedure: make-rectangular real_part imaginary_part + Return a complex number constructed of the given REAL_PART and + IMAGINARY_PART parts. + + make-polar + +- Scheme Procedure: make-polar mag ang + Return the complex number MAG * e^(i * ANG). + + real-part + +- Scheme Procedure: real-part z + Return the real part of the number Z. + + imag-part + +- Scheme Procedure: imag-part z + Return the imaginary part of the number Z. + + numerator + +- Scheme Procedure: numerator z + Return the numerator of the number Z. + + denominator + +- Scheme Procedure: denominator z + Return the denominator of the number Z. + + magnitude + +- Scheme Procedure: magnitude z + Return the magnitude of the number Z. This is the same as `abs' + for real arguments, but also allows complex numbers. + + angle + +- Scheme Procedure: angle z + Return the angle of the complex number Z. + + exact->inexact + +- Scheme Procedure: exact->inexact z + Convert the number Z to its inexact representation. + + inexact->exact + +- Scheme Procedure: inexact->exact z + Return an exact number that is numerically closest to Z. + + rationalize + +- Scheme Procedure: rationalize x eps + Returns the _simplest_ rational number differing from X by no more + than EPS. + + As required by R5RS, `rationalize' only returns an exact result + when both its arguments are exact. Thus, you might need to use + `inexact->exact' on the arguments. + + (rationalize (inexact->exact 1.2) 1/100) + ==> 6/5 + + log + +- Scheme Procedure: log z + Return the natural logarithm of Z. + + log10 + +- Scheme Procedure: log10 z + Return the base 10 logarithm of Z. + + exp + +- Scheme Procedure: exp z + Return e to the power of Z, where e is the base of natural + logarithms (2.71828...). + + exact-integer-sqrt + +- Scheme Procedure: exact-integer-sqrt k + Return two exact non-negative integers S and R such that K = S^2 + + R and S^2 <= K < (S + 1)^2. An error is raised if K is not an + exact non-negative integer. + + (exact-integer-sqrt 10) ==> 3 and 1 + + sqrt + +- Scheme Procedure: sqrt z + Return the square root of Z. Of the two possible roots (positive + and negative), the one with positive real part is returned, or if + that's zero then a positive imaginary part. Thus, + + (sqrt 9.0) ==> 3.0 + (sqrt -9.0) ==> 0.0+3.0i + (sqrt 1.0+1.0i) ==> 1.09868411346781+0.455089860562227i + (sqrt -1.0-1.0i) ==> 0.455089860562227-1.09868411346781i + + object-properties + +- Scheme Procedure: object-properties obj + Return OBJ's property list. + + set-object-properties! + +- Scheme Procedure: set-object-properties! obj alist + Set OBJ's property list to ALIST. + + object-property + +- Scheme Procedure: object-property obj key + Return the property of OBJ with name KEY. + + set-object-property! + +- Scheme Procedure: set-object-property! obj key value + In OBJ's property list, set the property named KEY to VALUE. + + pair? + +- Scheme Procedure: pair? x + Return `#t' if X is a pair; otherwise return `#f'. + + set-car! + +- Scheme Procedure: set-car! pair value + Stores VALUE in the car field of PAIR. The value returned by + `set-car!' is unspecified. + + set-cdr! + +- Scheme Procedure: set-cdr! pair value + Stores VALUE in the cdr field of PAIR. The value returned by + `set-cdr!' is unspecified. + + cddr + +- Scheme Procedure: cddr x + cdar + +- Scheme Procedure: cdar x + cadr + +- Scheme Procedure: cadr x + caar + +- Scheme Procedure: caar x + cdddr + +- Scheme Procedure: cdddr x + cddar + +- Scheme Procedure: cddar x + cdadr + +- Scheme Procedure: cdadr x + cdaar + +- Scheme Procedure: cdaar x + caddr + +- Scheme Procedure: caddr x + cadar + +- Scheme Procedure: cadar x + caadr + +- Scheme Procedure: caadr x + caaar + +- Scheme Procedure: caaar x + cddddr + +- Scheme Procedure: cddddr x + cdddar + +- Scheme Procedure: cdddar x + cddadr + +- Scheme Procedure: cddadr x + cddaar + +- Scheme Procedure: cddaar x + cdaddr + +- Scheme Procedure: cdaddr x + cdadar + +- Scheme Procedure: cdadar x + cdaadr + +- Scheme Procedure: cdaadr x + cdaaar + +- Scheme Procedure: cdaaar x + cadddr + +- Scheme Procedure: cadddr x + caddar + +- Scheme Procedure: caddar x + cadadr + +- Scheme Procedure: cadadr x + cadaar + +- Scheme Procedure: cadaar x + caaddr + +- Scheme Procedure: caaddr x + caadar + +- Scheme Procedure: caadar x + caaadr + +- Scheme Procedure: caaadr x + caaaar + +- Scheme Procedure: caaaar x + %port-property + +- Scheme Procedure: %port-property port key + Return the property of PORT associated with KEY. + + %set-port-property! + +- Scheme Procedure: %set-port-property! port key value + Set the property of PORT associated with KEY to VALUE. + + current-input-port + +- Scheme Procedure: current-input-port + Return the current input port. This is the default port used by + many input procedures. Initially, `current-input-port' returns the + "standard input" in Unix and C terminology. + + current-output-port + +- Scheme Procedure: current-output-port + Return the current output port. This is the default port used by + many output procedures. Initially, `current-output-port' returns + the "standard output" in Unix and C terminology. + + current-error-port + +- Scheme Procedure: current-error-port + Return the port to which errors and warnings should be sent (the + "standard error" in Unix and C terminology). + + current-warning-port + +- Scheme Procedure: current-warning-port + Return the port to which diagnostic warnings should be sent. + + current-load-port + +- Scheme Procedure: current-load-port + Return the current-load-port. The load port is used internally by + `primitive-load'. + + port-mode + +- Scheme Procedure: port-mode port + Return the port modes associated with the open port PORT. These + will not necessarily be identical to the modes used when the port + was opened, since modes such as "append" which are used only during + port creation are not retained. + + port? + +- Scheme Procedure: port? x + Return a boolean indicating whether X is a port. Equivalent to + `(or (input-port? X) (output-port? X))'. + + input-port? + +- Scheme Procedure: input-port? x + Return `#t' if X is an input port, otherwise return `#f'. Any + object satisfying this predicate also satisfies `port?'. + + output-port? + +- Scheme Procedure: output-port? x + Return `#t' if X is an output port, otherwise return `#f'. Any + object satisfying this predicate also satisfies `port?'. + + port-closed? + +- Scheme Procedure: port-closed? port + Return `#t' if PORT is closed or `#f' if it is open. + + eof-object? + +- Scheme Procedure: eof-object? x + Return `#t' if X is an end-of-file object; otherwise return `#f'. + + close-port + +- Scheme Procedure: close-port port + Close the specified port object. Return `#t' if it successfully + closes a port or `#f' if it was already closed. An exception may + be raised if an error occurs, for example when flushing buffered + output. See also close, for a procedure which can close file + descriptors. + + close-input-port + +- Scheme Procedure: close-input-port port + Close the specified input port object. The routine has no effect + if the file has already been closed. An exception may be raised if + an error occurs. The value returned is unspecified. + + See also close, for a procedure which can close file descriptors. + + close-output-port + +- Scheme Procedure: close-output-port port + Close the specified output port object. The routine has no effect + if the file has already been closed. An exception may be raised if + an error occurs. The value returned is unspecified. + + See also close, for a procedure which can close file descriptors. + + specialize-port-encoding! + +- Scheme Procedure: specialize-port-encoding! port encoding + %port-encoding + +- Scheme Procedure: %port-encoding port + Returns, as a symbol, the character encoding that PORT uses to + interpret its input and output. + + %set-port-encoding! + +- Scheme Procedure: %set-port-encoding! port enc + Sets the character encoding that will be used to interpret all port + I/O. New ports are created with the encoding appropriate for the + current locale if `setlocale' has been called or ISO-8859-1 + otherwise and this procedure can be used to modify that encoding. + + port-conversion-strategy + +- Scheme Procedure: port-conversion-strategy port + Returns the behavior of the port when handling a character that is + not representable in the port's current encoding. It returns the + symbol `error' if unrepresentable characters should cause + exceptions, `substitute' if the port should try to replace + unrepresentable characters with question marks or approximate + characters, or `escape' if unrepresentable characters should be + converted to string escapes. + + If PORT is `#f', then the current default behavior will be + returned. New ports will have this default behavior when they are + created. + + set-port-conversion-strategy! + +- Scheme Procedure: set-port-conversion-strategy! port sym + Sets the behavior of the interpreter when outputting a character + that is not representable in the port's current encoding. SYM can + be either `'error', `'substitute', or `'escape'. If it is + `'error', an error will be thrown when an unconvertible character + is encountered. If it is `'substitute', then unconvertible + characters will be replaced with approximate characters, or with + question marks if no approximately correct character is available. + If it is `'escape', it will appear as a hex escape when output. + + If PORT is an open port, the conversion error behavior is set for + that port. If it is `#f', it is set as the default behavior for + any future ports that get created in this thread. + + port-read-wait-fd + +- Scheme Procedure: port-read-wait-fd port + port-write-wait-fd + +- Scheme Procedure: port-write-wait-fd port + port-poll + +- Scheme Procedure: port-poll port events [timeout] + port-decode-char + +- Scheme Procedure: port-decode-char port bv start count + read-char + +- Scheme Procedure: read-char [port] + Return the next character available from PORT, updating PORT to + point to the following character. If no more characters are + available, the end-of-file object is returned. + + When PORT's data cannot be decoded according to its character + encoding, a `decoding-error' is raised and PORT points past the + erroneous byte sequence. + + peek-char + +- Scheme Procedure: peek-char [port] + Return the next character available from PORT, _without_ updating + PORT to point to the following character. If no more characters + are available, the end-of-file object is returned. + + The value returned by a call to `peek-char' is the same as the + value that would have been returned by a call to `read-char' on the + same port. The only difference is that the very next call to + `read-char' or `peek-char' on that PORT will return the value + returned by the preceding call to `peek-char'. In particular, a + call to `peek-char' on an interactive port will hang waiting for + input whenever a call to `read-char' would have hung. + + As for `read-char', a `decoding-error' may be raised if such a + situation occurs. However, unlike with `read-char', PORT still + points at the beginning of the erroneous byte sequence when the + error is raised. + + unread-char + +- Scheme Procedure: unread-char cobj [port] + Place character COBJ in PORT so that it will be read by the next + read operation. If called multiple times, the unread characters + will be read again in last-in first-out order. If PORT is not + supplied, the current input port is used. + + unread-string + +- Scheme Procedure: unread-string str port + Place the string STR in PORT so that its characters will be read in + subsequent read operations. If called multiple times, the unread + characters will be read again in last-in first-out order. If PORT + is not supplied, the current-input-port is used. + + setvbuf + +- Scheme Procedure: setvbuf port mode [size] + Set the buffering mode for PORT. MODE can be one of the following + symbols: + + none + no buffering + + line + line buffering + + block + block buffering, using a newly allocated buffer of SIZE bytes. + If SIZE is omitted, a default size will be used. + + Only certain types of ports are supported, most importantly file + ports. + + drain-input + +- Scheme Procedure: drain-input port + This procedure clears a port's input buffers, similar to the way + that force-output clears the output buffer. The contents of the + buffers are returned as a single string, e.g., + + (define p (open-input-file ...)) + (drain-input p) => empty string, nothing buffered yet. + (unread-char (read-char p) p) + (drain-input p) => initial chars from p, up to the buffer size. + + Draining the buffers may be useful for cleanly finishing buffered + I/O so that the file descriptor can be used directly for further + input. + + force-output + +- Scheme Procedure: force-output [port] + Flush the specified output port, or the current output port if PORT + is omitted. The current output buffer contents are passed to the + underlying port implementation (e.g., in the case of fports, the + data will be written to the file and the output buffer will be + cleared.) It has no effect on an unbuffered port. + + The return value is unspecified. + + port-clear-stream-start-for-bom-read + +- Scheme Procedure: port-clear-stream-start-for-bom-read port + port-clear-stream-start-for-bom-write + +- Scheme Procedure: port-clear-stream-start-for-bom-write port [buf] + port-random-access? + +- Scheme Procedure: port-random-access? port + Return true if the port is random-access, or false otherwise. + + port-read-buffering + +- Scheme Procedure: port-read-buffering port + Return the amount of read buffering on a port, in bytes. + + expand-port-read-buffer! + +- Scheme Procedure: expand-port-read-buffer! port size [putback_p] + Expand the read buffer of PORT to SIZE. Copy the old buffered + data, if, any, to the beginning of the new buffer, unless PUTBACK_P + is true, in which case copy it to the end instead. Return the new + buffer. + + port-read + +- Scheme Procedure: port-read port + Return the read function for an input port. + + port-write + +- Scheme Procedure: port-write port + Return the write function for an output port. + + port-read-buffer + +- Scheme Procedure: port-read-buffer port + Return the read buffer for a port. + + port-write-buffer + +- Scheme Procedure: port-write-buffer port + Return the write buffer for a port. + + port-auxiliary-write-buffer + +- Scheme Procedure: port-auxiliary-write-buffer port + Return the auxiliary write buffer for a port. + + port-line-buffered? + +- Scheme Procedure: port-line-buffered? port + Return true if the port is line buffered. + + port-encode-chars + +- Scheme Procedure: port-encode-chars port buf str start count + port-encode-char + +- Scheme Procedure: port-encode-char port buf ch + put-char + +- Scheme Procedure: put-char port ch + Encode CH to bytes, and send those bytes to PORT. + + put-string + +- Scheme Procedure: put-string port string [start [count]] + Display the COUNT characters from STRING to PORT, starting with the + character at index START. START defaults to 0, and COUNT defaults + to displaying all characters until the end of the string. + + Calling `put-string' is equivalent in all respects to calling + `put-char' on the relevant sequence of characters, except that it + will attempt to write multiple characters to the port at a time, + even if the port is unbuffered. + + char-ready? + +- Scheme Procedure: char-ready? [port] + Return `#t' if a character is ready on input PORT and return `#f' + otherwise. If `char-ready?' returns `#t' then the next `read-char' + operation on PORT is guaranteed not to hang. If PORT is a file + port at end of file then `char-ready?' returns `#t'. + + `char-ready?' exists to make it possible for a program to accept + characters from interactive ports without getting stuck waiting for + input. Any input editors associated with such ports must make sure + that characters whose existence has been asserted by `char-ready?' + cannot be rubbed out. If `char-ready?' were to return `#f' at end + of file, a port at end of file would be indistinguishable from an + interactive port that has no ready characters. + + seek + +- Scheme Procedure: seek fd_port offset whence + Sets the current position of FD_PORT to the integer OFFSET, which + is interpreted according to the value of WHENCE. + + One of the following variables should be supplied for WHENCE: + + - Variable: SEEK_SET + Seek from the beginning of the file. + + - Variable: SEEK_CUR + Seek from the current position. + + - Variable: SEEK_END + Seek from the end of the file. + + If FD_PORT is a file descriptor, the underlying system call is + `lseek'. PORT may be a string port. + + The value returned is the new position in the file. This means + that the current position of a port can be obtained using: + + (seek port 0 SEEK_CUR) + + truncate-file + +- Scheme Procedure: truncate-file object [length] + Truncate file OBJECT to LENGTH bytes. OBJECT can be a filename + string, a port object, or an integer file descriptor. The return + value is unspecified. + + For a port or file descriptor LENGTH can be omitted, in which case + the file is truncated at the current position (per `ftell' above). + + On most systems a file can be extended by giving a length greater + than the current size, but this is not mandatory in the POSIX + standard. + + port-line + +- Scheme Procedure: port-line port + Return the current line number for PORT. + + The first line of a file is 0. But you might want to add 1 when + printing line numbers, since starting from 1 is traditional in + error messages, and likely to be more natural to non-programmers. + + set-port-line! + +- Scheme Procedure: set-port-line! port line + Set the current line number for PORT to LINE. The first line of a + file is 0. + + port-column + +- Scheme Procedure: port-column port + Return the current column number of PORT. If the number is + unknown, the result is #f. Otherwise, the result is a 0-origin + integer - i.e. the first character of the first line is line 0, + column 0. (However, when you display a file position, for example + in an error message, we recommend you add 1 to get 1-origin + integers. This is because lines and column numbers traditionally + start with 1, and that is what non-programmers will find most + natural.) + + set-port-column! + +- Scheme Procedure: set-port-column! port column + Set the current column of PORT. Before reading the first character + on a line the column should be 0. + + port-filename + +- Scheme Procedure: port-filename port + Return the filename associated with PORT, or `#f' if no filename is + associated with the port. + + set-port-filename! + +- Scheme Procedure: set-port-filename! port filename + Change the filename associated with PORT, using the current input + port if none is specified. Note that this does not change the + port's source of data, but only the value that is returned by + `port-filename' and reported in diagnostic output. + + port-for-each + +- Scheme Procedure: port-for-each proc + Apply PROC to each port in the Guile port table in turn. The + return value is unspecified. More specifically, PROC is applied + exactly once to every port that exists in the system at the time + `port-for-each' is invoked. Changes to the port table while + `port-for-each' is running have no effect as far as `port-for-each' + is concerned. + + flush-all-ports + +- Scheme Procedure: flush-all-ports + Equivalent to calling `force-output' on all open output ports. The + return value is unspecified. + + %make-void-port + +- Scheme Procedure: %make-void-port mode + Create and return a new void port. A void port acts like + `/dev/null'. The MODE argument specifies the input/output modes + for this port: see the documentation for `open-file' in File Ports. + + print-options-interface + +- Scheme Procedure: print-options-interface [setting] + Option interface for the print options. Instead of using this + procedure directly, use the procedures `print-enable', + `print-disable', `print-set!' and `print-options'. + + simple-format + +- Scheme Procedure: simple-format destination message . args + Write MESSAGE to DESTINATION, defaulting to the current output + port. MESSAGE can contain `~A' (was `%s') and `~S' (was `%S') + escapes. When printed, the escapes are replaced with corresponding + members of ARGS: `~A' formats using `display' and `~S' formats + using `write'. If DESTINATION is `#t', then use the current output + port, if DESTINATION is `#f', then return a string containing the + formatted text. Does not add a trailing newline. + + newline + +- Scheme Procedure: newline [port] + Send a newline to PORT. If PORT is omitted, send to the current + output port. + + write-char + +- Scheme Procedure: write-char chr [port] + Send character CHR to PORT. + + port-with-print-state + +- Scheme Procedure: port-with-print-state port [pstate] + Create a new port which behaves like PORT, but with an included + print state PSTATE. PSTATE is optional. If PSTATE isn't supplied + and PORT already has a print state, the old print state is reused. + + get-print-state + +- Scheme Procedure: get-print-state port + Return the print state of the port PORT. If PORT has no associated + print state, `#f' is returned. + + set-procedure-minimum-arity! + +- Scheme Procedure: set-procedure-minimum-arity! proc req opt rest + procedure-minimum-arity + +- Scheme Procedure: procedure-minimum-arity proc + Return the "minimum arity" of a procedure. + + If the procedure has only one arity, that arity is returned as a + list of three values: the number of required arguments, the number + of optional arguments, and a boolean indicating whether or not the + procedure takes rest arguments. + + For a case-lambda procedure, the arity returned is the one with the + lowest minimum number of arguments, and the highest maximum number + of arguments. + + If it was not possible to determine the arity of the procedure, + `#f' is returned. + + procedure-properties + +- Scheme Procedure: procedure-properties proc + Return PROC's property list. + + set-procedure-properties! + +- Scheme Procedure: set-procedure-properties! proc alist + Set PROC's property list to ALIST. + + procedure-property + +- Scheme Procedure: procedure-property proc key + Return the property of PROC with name KEY. + + set-procedure-property! + +- Scheme Procedure: set-procedure-property! proc key val + In PROC's property list, set the property named KEY to VAL. + + procedure-name + +- Scheme Procedure: procedure-name proc + Return the name of the procedure PROC + + procedure-documentation + +- Scheme Procedure: procedure-documentation proc + Return the documentation string associated with `proc'. By + convention, if a procedure contains more than one expression and + the first expression is a string constant, that string is assumed + to contain documentation for that procedure. + + procedure-source + +- Scheme Procedure: procedure-source proc + Return the source of the procedure PROC. + + procedure? + +- Scheme Procedure: procedure? obj + Return `#t' if OBJ is a procedure. + + thunk? + +- Scheme Procedure: thunk? obj + Return `#t' if OBJ is a thunk. + + procedure-with-setter? + +- Scheme Procedure: procedure-with-setter? obj + Return `#t' if OBJ is a procedure with an associated setter + procedure. + + make-procedure-with-setter + +- Scheme Procedure: make-procedure-with-setter procedure setter + Create a new procedure which behaves like PROCEDURE, but with the + associated setter SETTER. + + procedure + +- Scheme Procedure: procedure proc + Return the procedure of PROC, which must be an applicable struct. + + setter + +- Scheme Procedure: setter proc + Return the setter of PROC, which must be an applicable struct with + a setter. + + make-promise + +- Scheme Procedure: make-promise thunk + Create a new promise object. + + `make-promise' is a procedural form of `delay'. These two + expressions are equivalent: + + (delay EXP) + (make-promise (lambda () EXP)) + + force + +- Scheme Procedure: force promise + If PROMISE has not been computed yet, compute and return PROMISE, + otherwise just return the previously computed value. + + promise? + +- Scheme Procedure: promise? obj + Return true if OBJ is a promise, i.e. a delayed computation (see + in manual The Revised^5 Report on Scheme). + + eof-object + +- Scheme Procedure: eof-object + Return the end-of-file object. + + open-bytevector-input-port + +- Scheme Procedure: open-bytevector-input-port bv [transcoder] + Return an input port whose contents are drawn from bytevector BV. + + make-custom-binary-input-port + +- Scheme Procedure: make-custom-binary-input-port id read_proc +get_position_proc set_position_proc close_proc + Return a new custom binary input port whose input is drained by + invoking READ_PROC and passing it a bytevector, an index where + octets should be written, and an octet count. + + get-u8 + +- Scheme Procedure: get-u8 port + Read an octet from PORT, a binary input port, blocking as + necessary. + + lookahead-u8 + +- Scheme Procedure: lookahead-u8 port + Like `get-u8' but does not update PORT to point past the octet. + + get-bytevector-n + +- Scheme Procedure: get-bytevector-n port count + Read COUNT octets from PORT, blocking as necessary and return a + bytevector containing the octets read. If fewer bytes are + available, a bytevector smaller than COUNT is returned. + + get-bytevector-n! + +- Scheme Procedure: get-bytevector-n! port bv start count + Read COUNT bytes from PORT and store them in BV starting at index + START. Return either the number of bytes actually read or the + end-of-file object. + + get-bytevector-some + +- Scheme Procedure: get-bytevector-some port + Read from PORT, blocking as necessary, until bytes are available or + an end-of-file is reached. Return either the end-of-file object or + a new bytevector containing some of the available bytes (at least + one), and update the port position to point just past these bytes. + + get-bytevector-some! + +- Scheme Procedure: get-bytevector-some! port bv start count + Read up to COUNT bytes from PORT, blocking as necessary until at + least one byte is available or an end-of-file is reached. Store + them in BV starting at index START. Return the number of bytes + actually read, or an end-of-file object. + + get-bytevector-all + +- Scheme Procedure: get-bytevector-all port + Read from PORT, blocking as necessary, until the end-of-file is + reached. Return either a new bytevector containing the data read + or the end-of-file object (if no data were available). + + put-u8 + +- Scheme Procedure: put-u8 port octet + Write OCTET to binary port PORT. + + put-bytevector + +- Scheme Procedure: put-bytevector port bv [start [count]] + Write the contents of BV to PORT, optionally starting at index + START and limiting to COUNT octets. + + unget-bytevector + +- Scheme Procedure: unget-bytevector port bv [start [count]] + Unget the contents of BV to PORT, optionally starting at index + START and limiting to COUNT octets. + + open-bytevector-output-port + +- Scheme Procedure: open-bytevector-output-port [transcoder] + Return two values: an output port and a procedure. The latter + should be called with zero arguments to obtain a bytevector + containing the data accumulated by the port. + + make-custom-binary-output-port + +- Scheme Procedure: make-custom-binary-output-port id write_proc +get_position_proc set_position_proc close_proc + Return a new custom binary output port whose output is drained by + invoking WRITE_PROC and passing it a bytevector, an index where + octets should be written, and an octet count. + + make-custom-binary-input/output-port + +- Scheme Procedure: make-custom-binary-input/output-port id read_proc +write_proc get_position_proc set_position_proc close_proc + Return a new custom binary input/output port. The port's input is + drained by invoking READ_PROC and passing it a bytevector, an index + where octets should be written, and an octet count. The output is + drained by invoking WRITE_PROC and passing it a bytevector, an + index where octets should be written, and an octet count. + + %make-transcoded-port + +- Scheme Procedure: %make-transcoded-port port + Return a new port which reads and writes to PORT + + get-string-n! + +- Scheme Procedure: get-string-n! port str start count + Read up to COUNT characters from PORT into STR, starting at START. + If no characters can be read before the end of file is encountered, + the end of file object is returned. Otherwise, the number of + characters read is returned. + + random + +- Scheme Procedure: random n [state] + Return a number in [0, N). + + Accepts a positive integer or real n and returns a number of the + same type between zero (inclusive) and N (exclusive). The values + returned have a uniform distribution. + + The optional argument STATE must be of the type produced by + `seed->random-state'. It defaults to the value of the variable + *RANDOM-STATE*. This object is used to maintain the state of the + pseudo-random-number generator and is altered as a side effect of + the random operation. + + copy-random-state + +- Scheme Procedure: copy-random-state [state] + Return a copy of the random state STATE. + + seed->random-state + +- Scheme Procedure: seed->random-state seed + Return a new random state using SEED. + + datum->random-state + +- Scheme Procedure: datum->random-state datum + Return a new random state using DATUM, which should have been + obtained from `random-state->datum'. + + random-state->datum + +- Scheme Procedure: random-state->datum state + Return a datum representation of STATE that may be written out and + read back with the Scheme reader. + + random:uniform + +- Scheme Procedure: random:uniform [state] + Return a uniformly distributed inexact real random number in [0,1). + + random:normal + +- Scheme Procedure: random:normal [state] + Return an inexact real in a normal distribution. The distribution + used has mean 0 and standard deviation 1. For a normal + distribution with mean m and standard deviation d use `(+ m (* d + (random:normal)))'. + + random:solid-sphere! + +- Scheme Procedure: random:solid-sphere! v [state] + Fills VECT with inexact real random numbers the sum of whose + squares is less than 1.0. Thinking of VECT as coordinates in space + of dimension N = `(vector-length VECT)', the coordinates are + uniformly distributed within the unit N-sphere. + + random:hollow-sphere! + +- Scheme Procedure: random:hollow-sphere! v [state] + Fills vect with inexact real random numbers the sum of whose + squares is equal to 1.0. Thinking of vect as coordinates in space + of dimension n = (vector-length vect), the coordinates are + uniformly distributed over the surface of the unit n-sphere. + + random:normal-vector! + +- Scheme Procedure: random:normal-vector! v [state] + Fills vect with inexact real random numbers that are independent + and standard normally distributed (i.e., with mean 0 and variance + 1). + + random:exp + +- Scheme Procedure: random:exp [state] + Return an inexact real in an exponential distribution with mean 1. + For an exponential distribution with mean u use (* u (random:exp)). + + random-state-from-platform + +- Scheme Procedure: random-state-from-platform + Construct a new random state seeded from a platform-specific source + of entropy, appropriate for use in non-security-critical + applications. + + %read-delimited! + +- Scheme Procedure: %read-delimited! delims str gobble [port [start +[end]]] + Read characters from PORT into STR until one of the characters in + the DELIMS string is encountered. If GOBBLE is true, discard the + delimiter character; otherwise, leave it in the input stream for + the next read. If PORT is not specified, use the value of + `(current-input-port)'. If START or END are specified, store data + only into the substring of STR bounded by START and END (which + default to the beginning and end of the string, respectively). + + Return a pair consisting of the delimiter that terminated the + string and the number of characters read. If reading stopped at + the end of file, the delimiter returned is the EOF-OBJECT; if the + string was filled without encountering a delimiter, this value is + `#f'. + + %read-line + +- Scheme Procedure: %read-line [port] + Read a newline-terminated line from PORT, allocating storage as + necessary. The newline terminator (if any) is removed from the + string, and a pair consisting of the line and its delimiter is + returned. The delimiter may be either a newline or the EOF-OBJECT; + if `%read-line' is called at the end of file, it returns the pair + `(# . #)'. + + write-line + +- Scheme Procedure: write-line obj [port] + Display OBJ and a newline character to PORT. If PORT is not + specified, `(current-output-port)' is used. This function is + equivalent to: + + (display obj [port]) + (newline [port]) + + read-options-interface + +- Scheme Procedure: read-options-interface [setting] + Option interface for the read options. Instead of using this + procedure directly, use the procedures `read-enable', + `read-disable', `read-set!' and `read-options'. + + read + +- Scheme Procedure: read [port] + Read an s-expression from the input port PORT, or from the current + input port if PORT is not specified. Any whitespace before the + next token is discarded. + + read-hash-extend + +- Scheme Procedure: read-hash-extend chr proc + Install the procedure PROC for reading expressions starting with + the character sequence `#' and CHR. PROC will be called with two + arguments: the character CHR and the port to read further data + from. The object returned will be the return value of `read'. + Passing `#f' for PROC will remove a previous setting. + + file-encoding + +- Scheme Procedure: file-encoding port + Scans the port for an Emacs-like character coding declaration near + the top of the contents of a port with random-accessible contents. + The coding declaration is of the form `coding: XXXXX' and must + appear in a scheme comment. + + Returns a string containing the character encoding of the file if a + declaration was found, or `#f' otherwise. + + read-string!/partial + +- Scheme Procedure: read-string!/partial str [port_or_fdes [start +[end]]] + Read characters from a port or file descriptor into a string STR. A + port must have an underlying file descriptor --- a so-called fport. + This procedure is scsh-compatible and can efficiently read large + strings. It will: + + * attempt to fill the entire string, unless the START and/or END + arguments are supplied. i.e., START defaults to 0 and END + defaults to `(string-length str)' + + * use the current input port if PORT_OR_FDES is not supplied. + + * return fewer than the requested number of characters in some + cases, e.g., on end of file, if interrupted by a signal, or if + not all the characters are immediately available. + + * wait indefinitely for some input if no characters are + currently available, unless the port is in non-blocking mode. + + * read characters from the port's input buffers if available, + instead from the underlying file descriptor. + + * return `#f' if end-of-file is encountered before reading any + characters, otherwise return the number of characters read. + + * return 0 if the port is in non-blocking mode and no characters + are immediately available. + + * return 0 if the request is for 0 bytes, with no end-of-file + check. + + write-string/partial + +- Scheme Procedure: write-string/partial str [port_or_fdes [start +[end]]] + Write characters from a string STR to a port or file descriptor. A + port must have an underlying file descriptor --- a so-called fport. + This procedure is scsh-compatible and can efficiently write large + strings. It will: + + * attempt to write the entire string, unless the START and/or + END arguments are supplied. i.e., START defaults to 0 and END + defaults to `(string-length str)' + + * use the current output port if PORT_OF_FDES is not supplied. + + * in the case of a buffered port, store the characters in the + port's output buffer, if all will fit. If they will not fit + then any existing buffered characters will be flushed before + attempting to write the new characters directly to the + underlying file descriptor. If the port is in non-blocking + mode and buffered characters can not be flushed immediately, + then an `EAGAIN' system-error exception will be raised (Note: + scsh does not support the use of non-blocking buffered ports.) + + * write fewer than the requested number of characters in some + cases, e.g., if interrupted by a signal or if not all of the + output can be accepted immediately. + + * wait indefinitely for at least one character from STR to be + accepted by the port, unless the port is in non-blocking mode. + + * return the number of characters accepted by the port. + + * return 0 if the port is in non-blocking mode and can not + accept at least one character from STR immediately + + * return 0 immediately if the request size is 0 bytes. + + sigaction + +- Scheme Procedure: sigaction signum [handler [flags [thread]]] + Install or report the signal handler for a specified signal. + + SIGNUM is the signal number, which can be specified using the value + of variables such as `SIGINT'. + + If HANDLER is omitted, `sigaction' returns a pair: the CAR is the + current signal hander, which will be either an integer with the + value `SIG_DFL' (default action) or `SIG_IGN' (ignore), or the + Scheme procedure which handles the signal, or `#f' if a non-Scheme + procedure handles the signal. The CDR contains the current + `sigaction' flags for the handler. + + If HANDLER is provided, it is installed as the new handler for + SIGNUM. HANDLER can be a Scheme procedure taking one argument, or + the value of `SIG_DFL' (default action) or `SIG_IGN' (ignore), or + `#f' to restore whatever signal handler was installed before + `sigaction' was first used. When a scheme procedure has been + specified, that procedure will run in the given THREAD. When no + thread has been given, the thread that made this call to + `sigaction' is used. Flags can optionally be specified for the new + handler. The return value is a pair with information about the old + handler as described above. + + This interface does not provide access to the "signal blocking" + facility. Maybe this is not needed, since the thread support may + provide solutions to the problem of consistent access to data + structures. + + restore-signals + +- Scheme Procedure: restore-signals + Return all signal handlers to the values they had before any call + to `sigaction' was made. The return value is unspecified. + + sleep + +- Scheme Procedure: sleep i + Wait for the given number of seconds (an integer) or until a signal + arrives. The return value is zero if the time elapses or the + number of seconds remaining otherwise. + + See also `usleep'. + + usleep + +- Scheme Procedure: usleep i + Wait the given period USECS microseconds (an integer). If a signal + arrives the wait stops and the return value is the time remaining, + in microseconds. If the period elapses with no signal the return + is zero. + + On most systems the process scheduler is not microsecond accurate + and the actual period slept by `usleep' may be rounded to a system + clock tick boundary. Traditionally such ticks were 10 milliseconds + apart, and that interval is often still used. + + See also `sleep'. + + raise + +- Scheme Procedure: raise sig + Sends a specified signal SIG to the current process, where SIG is + as described for the kill procedure. + + system + +- Scheme Procedure: system [cmd] + Execute CMD using the operating system's "command processor". Under + Unix this is usually the default shell `sh'. The value returned is + CMD's exit status as returned by `waitpid', which can be + interpreted using `status:exit-val' and friends. + + If `system' is called without arguments, return a boolean + indicating whether the command processor is available. + + getenv + +- Scheme Procedure: getenv nam + Looks up the string NAM in the current environment. The return + value is `#f' unless a string of the form `NAME=VALUE' is found, in + which case the string `VALUE' is returned. + + primitive-exit + +- Scheme Procedure: primitive-exit [status] + Terminate the current process without unwinding the Scheme stack. + The exit status is STATUS if supplied, otherwise zero. + + primitive-_exit + +- Scheme Procedure: primitive-_exit [status] + Terminate the current process using the _exit() system call and + without unwinding the Scheme stack. The exit status is STATUS if + supplied, otherwise zero. + + This function is typically useful after a fork, to ensure no Scheme + cleanups or `atexit' handlers are run (those usually belonging in + the parent rather than the child). + + restricted-vector-sort! + +- Scheme Procedure: restricted-vector-sort! vec less startpos endpos + Sort the vector VEC, using LESS for comparing the vector elements. + STARTPOS (inclusively) and ENDPOS (exclusively) delimit the range + of the vector which gets sorted. The return value is not + specified. + + sorted? + +- Scheme Procedure: sorted? items less + Return `#t' iff ITEMS is a list or vector such that, for each + element X and the next element Y of ITEMS, `(LESS Y X)' returns + `#f'. + + merge + +- Scheme Procedure: merge alist blist less + Merge two already sorted lists into one. Given two lists ALIST and + BLIST, such that `(sorted? alist less?)' and `(sorted? blist + less?)', return a new list in which the elements of ALIST and BLIST + have been stably interleaved so that `(sorted? (merge alist blist + less?) less?)'. Note: this does _not_ accept vectors. + + merge! + +- Scheme Procedure: merge! alist blist less + Takes two lists ALIST and BLIST such that `(sorted? alist less?)' + and `(sorted? blist less?)' and returns a new list in which the + elements of ALIST and BLIST have been stably interleaved so that + `(sorted? (merge alist blist less?) less?)'. This is the + destructive variant of `merge' Note: this does _not_ accept + vectors. + + sort! + +- Scheme Procedure: sort! items less + Sort the sequence ITEMS, which may be a list or a vector. LESS is + used for comparing the sequence elements. The sorting is + destructive, that means that the input sequence is modified to + produce the sorted result. This is not a stable sort. + + sort + +- Scheme Procedure: sort items less + Sort the sequence ITEMS, which may be a list or a vector. LESS is + used for comparing the sequence elements. This is not a stable + sort. + + stable-sort! + +- Scheme Procedure: stable-sort! items less + Sort the sequence ITEMS, which may be a list or a vector. LESS is + used for comparing the sequence elements. The sorting is + destructive, that means that the input sequence is modified to + produce the sorted result. This is a stable sort. + + stable-sort + +- Scheme Procedure: stable-sort items less + Sort the sequence ITEMS, which may be a list or a vector. LESS is + used for comparing the sequence elements. This is a stable sort. + + sort-list! + +- Scheme Procedure: sort-list! items less + Sort the list ITEMS, using LESS for comparing the list elements. + The sorting is destructive, that means that the input list is + modified to produce the sorted result. This is a stable sort. + + sort-list + +- Scheme Procedure: sort-list items less + Sort the list ITEMS, using LESS for comparing the list elements. + This is a stable sort. + + supports-source-properties? + +- Scheme Procedure: supports-source-properties? obj + Return #t if OBJ supports adding source properties, otherwise + return #f. + + source-properties + +- Scheme Procedure: source-properties obj + Return the source property association list of OBJ. + + set-source-properties! + +- Scheme Procedure: set-source-properties! obj alist + Install the association list ALIST as the source property list for + OBJ. + + source-property + +- Scheme Procedure: source-property obj key + Return the source property specified by KEY from OBJ's source + property list. + + set-source-property! + +- Scheme Procedure: set-source-property! obj key datum + Set the source property of object OBJ, which is specified by KEY to + DATUM. Normally, the key will be a symbol. + + cons-source + +- Scheme Procedure: cons-source xorig x y + Create and return a new pair whose car and cdr are X and Y. Any + source properties associated with XORIG are also associated with + the new pair. + + append-reverse + +- Scheme Procedure: append-reverse revhead tail + Reverse REV-HEAD, append TAIL to it, and return the result. This + is equivalent to `(append (reverse REV-HEAD) TAIL)', but its + implementation is more efficient. + + (append-reverse '(1 2 3) '(4 5 6)) ==> (3 2 1 4 5 6) + + append-reverse! + +- Scheme Procedure: append-reverse! revhead tail + Reverse REV-HEAD, append TAIL to it, and return the result. This + is equivalent to `(append! (reverse! REV-HEAD) TAIL)', but its + implementation is more efficient. + + (append-reverse! (list 1 2 3) '(4 5 6)) ==> (3 2 1 4 5 6) + + REV-HEAD may be modified in order to produce the result. + + concatenate + +- Scheme Procedure: concatenate lstlst + Construct a list by appending all lists in LSTLST. + + `concatenate' is the same as `(apply append LSTLST)'. It exists + because some Scheme implementations have a limit on the number of + arguments a function takes, which the `apply' might exceed. In + Guile there is no such limit. + + concatenate! + +- Scheme Procedure: concatenate! lstlst + Construct a list by appending all lists in LSTLST. Those lists may + be modified to produce the result. + + `concatenate!' is the same as `(apply append! LSTLST)'. It exists + because some Scheme implementations have a limit on the number of + arguments a function takes, which the `apply' might exceed. In + Guile there is no such limit. + + count + +- Scheme Procedure: count pred list1 . rest + Return a count of the number of times PRED returns true when called + on elements from the given lists. + + PRED is called with N parameters `(PRED ELEM1 ... ELEMN)', each + element being from the corresponding LIST1 ... LSTN. The first + call is with the first element of each list, the second with the + second element from each, and so on. + + Counting stops when the end of the shortest list is reached. At + least one list must be non-circular. + + delete + +- Scheme Procedure: delete x lst [pred] + Return a list containing the elements of LST but with those equal + to X deleted. The returned elements will be in the same order as + they were in LST. + + Equality is determined by PRED, or `equal?' if not given. An + equality call is made just once for each element, but the order in + which the calls are made on the elements is unspecified. + + The equality calls are always `(pred x elem)', ie.: the given X is + first. This means for instance elements greater than 5 can be + deleted with `(delete 5 lst <)'. + + LST is not modified, but the returned list might share a common + tail with LST. + + delete! + +- Scheme Procedure: delete! x lst [pred] + Return a list containing the elements of LST but with those equal + to X deleted. The returned elements will be in the same order as + they were in LST. + + Equality is determined by PRED, or `equal?' if not given. An + equality call is made just once for each element, but the order in + which the calls are made on the elements is unspecified. + + The equality calls are always `(pred x elem)', ie.: the given X is + first. This means for instance elements greater than 5 can be + deleted with `(delete 5 lst <)'. + + LST may be modified to construct the returned list. + + delete-duplicates + +- Scheme Procedure: delete-duplicates lst [pred] + Return a list containing the elements of LST but without + duplicates. + + When elements are equal, only the first in LST is retained. Equal + elements can be anywhere in LST, they don't have to be adjacent. + The returned list will have the retained elements in the same order + as they were in LST. + + Equality is determined by PRED, or `equal?' if not given. Calls + `(pred x y)' are made with element X being before Y in LST. A call + is made at most once for each combination, but the sequence of the + calls across the elements is unspecified. + + LST is not modified, but the return might share a common tail with + LST. + + In the worst case, this is an O(N^2) algorithm because it must + check each element against all those preceding it. For long lists + it is more efficient to sort and then compare only adjacent + elements. + + delete-duplicates! + +- Scheme Procedure: delete-duplicates! lst [pred] + Return a list containing the elements of LST but without + duplicates. + + When elements are equal, only the first in LST is retained. Equal + elements can be anywhere in LST, they don't have to be adjacent. + The returned list will have the retained elements in the same order + as they were in LST. + + Equality is determined by PRED, or `equal?' if not given. Calls + `(pred x y)' are made with element X being before Y in LST. A call + is made at most once for each combination, but the sequence of the + calls across the elements is unspecified. + + LST may be modified to construct the returned list. + + In the worst case, this is an O(N^2) algorithm because it must + check each element against all those preceding it. For long lists + it is more efficient to sort and then compare only adjacent + elements. + + find + +- Scheme Procedure: find pred lst + Return the first element of LST which satisfies the predicate PRED, + or return `#f' if no such element is found. + + find-tail + +- Scheme Procedure: find-tail pred lst + Return the first pair of LST whose CAR satisfies the predicate + PRED, or return `#f' if no such element is found. + + length+ + +- Scheme Procedure: length+ lst + Return the length of LST, or `#f' if LST is circular. + + list-copy + +- Scheme Procedure: list-copy lst + Return a copy of the given list LST. + + LST can be a proper or improper list. And if LST is not a pair + then it's treated as the final tail of an improper list and simply + returned. + + lset-difference! + +- Scheme Procedure: lset-difference! equal lst . rest + Return LST with any elements in the lists in REST removed (ie.: + subtracted). For only one LST argument, just that list is + returned. + + The given EQUAL procedure is used for comparing elements, called as + `(EQUAL elem1 elemN)'. The first argument is from LST and the + second from one of the subsequent lists. But exactly which calls + are made and in what order is unspecified. + + (lset-difference! eqv? (list 'x 'y)) ==> (x y) + (lset-difference! eqv? (list 1 2 3) '(3 1)) ==> (2) + (lset-difference! eqv? (list 1 2 3) '(3) '(2)) ==> (1) + + `lset-difference!' may modify LST to form its result. + + assoc + +- Scheme Procedure: assoc key alist [pred] + Behaves like `assq' but uses third argument PRED for key + comparison. If PRED is not supplied, `equal?' is used. (Extended + from R5RS.) + + partition + +- Scheme Procedure: partition pred list + Partition the elements of LIST with predicate PRED. Return two + values: the list of elements satisfying PRED and the list of + elements _not_ satisfying PRED. The order of the output lists + follows the order of LIST. LIST is not mutated. One of the output + lists may share memory with LIST. + + partition! + +- Scheme Procedure: partition! pred lst + Split LST into those elements which do and don't satisfy the + predicate PRED. + + The return is two values (see Multiple Values), the first being a + list of all elements from LST which satisfy PRED, the second a list + of those which do not. + + The elements in the result lists are in the same order as in LST + but the order in which the calls `(PRED elem)' are made on the list + elements is unspecified. + + LST may be modified to construct the return lists. + + remove + +- Scheme Procedure: remove pred list + Return a list containing all elements from LIST which do not + satisfy the predicate PRED. The elements in the result list have + the same order as in LIST. The order in which PRED is applied to + the list elements is not specified. + + remove! + +- Scheme Procedure: remove! pred list + Return a list containing all elements from LIST which do not + satisfy the predicate PRED. The elements in the result list have + the same order as in LIST. The order in which PRED is applied to + the list elements is not specified. LIST may be modified to build + the return list. + + make-srfi-4-vector + +- Scheme Procedure: make-srfi-4-vector type len [fill] + Make a srfi-4 vector + + string-null? + +- Scheme Procedure: string-null? str + Return `#t' if STR's length is zero, and `#f' otherwise. + + (string-null? "") ==> #t + y ==> "foo" + (string-null? y) ==> #f + + string-any-c-code + +- Scheme Procedure: string-any-c-code char_pred s [start [end]] + Check if CHAR_PRED is true for any character in string S. + + CHAR_PRED can be a character to check for any equal to that, or a + character set (see Character Sets) to check for any in that set, or + a predicate procedure to call. + + For a procedure, calls `(CHAR_PRED c)' are made successively on the + characters from START to END. If CHAR_PRED returns true (ie.: + non-`#f'), `string-any' stops and that return value is the return + from `string-any'. The call on the last character (ie.: at END-1), + if that point is reached, is a tail call. + + If there are no characters in S (ie.: START equals END) then the + return is `#f'. + + string-every-c-code + +- Scheme Procedure: string-every-c-code char_pred s [start [end]] + Check if CHAR_PRED is true for every character in string S. + + CHAR_PRED can be a character to check for every character equal to + that, or a character set (see Character Sets) to check for every + character being in that set, or a predicate procedure to call. + + For a procedure, calls `(CHAR_PRED c)' are made successively on the + characters from START to END. If CHAR_PRED returns `#f', + `string-every' stops and returns `#f'. The call on the last + character (ie.: at END-1), if that point is reached, is a tail call + and the return from that call is the return from `string-every'. + + If there are no characters in S (ie.: START equals END) then the + return is `#t'. + + string-tabulate + +- Scheme Procedure: string-tabulate proc len + PROC is an integer->char procedure. Construct a string of size LEN + by applying PROC to each index to produce the corresponding string + element. The order in which PROC is applied to the indices is not + specified. + + string->list + +- Scheme Procedure: string->list str [start [end]] + Convert the string STR into a list of characters. + + reverse-list->string + +- Scheme Procedure: reverse-list->string chrs + An efficient implementation of `(compose string->list reverse)': + + (reverse-list->string '(#\a #\B #\c)) ==> "cBa" + + string-join + +- Scheme Procedure: string-join ls [delimiter [grammar]] + Append the string in the string list LS, using the string DELIMITER + as a delimiter between the elements of LS. GRAMMAR is a symbol + which specifies how the delimiter is placed between the strings, + and defaults to the symbol `infix'. + + infix + Insert the separator between list elements. An empty string + will produce an empty list. + + strict-infix + Like `infix', but will raise an error if given the empty list. + + suffix + Insert the separator after every list element. + + prefix + Insert the separator before each list element. + + string-copy + +- Scheme Procedure: string-copy str [start [end]] + Return a freshly allocated copy of the string STR. If given, START + and END delimit the portion of STR which is copied. + + string-copy! + +- Scheme Procedure: string-copy! target tstart s [start [end]] + Copy the sequence of characters from index range [START, END) in + string S to string TARGET, beginning at index TSTART. The + characters are copied left-to-right or right-to-left as needed -- + the copy is guaranteed to work, even if TARGET and S are the same + string. It is an error if the copy operation runs off the end of + the target string. + + substring-move! + +- Scheme Procedure: substring-move! str1 start1 end1 str2 start2 + Copy the substring of STR1 bounded by START1 and END1 into STR2 + beginning at position START2. STR1 and STR2 can be the same + string. + + string-take + +- Scheme Procedure: string-take s n + Return the N first characters of S. + + string-drop + +- Scheme Procedure: string-drop s n + Return all but the first N characters of S. + + string-take-right + +- Scheme Procedure: string-take-right s n + Return the N last characters of S. + + string-drop-right + +- Scheme Procedure: string-drop-right s n + Return all but the last N characters of S. + + string-pad + +- Scheme Procedure: string-pad s len [chr [start [end]]] + Take that characters from START to END from the string S and return + a new string, right-padded by the character CHR to length LEN. If + the resulting string is longer than LEN, it is truncated on the + right. + + string-pad-right + +- Scheme Procedure: string-pad-right s len [chr [start [end]]] + Take that characters from START to END from the string S and return + a new string, left-padded by the character CHR to length LEN. If + the resulting string is longer than LEN, it is truncated on the + left. + + string-trim + +- Scheme Procedure: string-trim s [char_pred [start [end]]] + Trim S by skipping over all characters on the left that satisfy the + parameter CHAR_PRED: + + * if it is the character CH, characters equal to CH are trimmed, + + * if it is a procedure PRED characters that satisfy PRED are + trimmed, + + * if it is a character set, characters in that set are trimmed. + + If called without a CHAR_PRED argument, all whitespace is trimmed. + + string-trim-right + +- Scheme Procedure: string-trim-right s [char_pred [start [end]]] + Trim S by skipping over all characters on the right that satisfy + the parameter CHAR_PRED: + + * if it is the character CH, characters equal to CH are trimmed, + + * if it is a procedure PRED characters that satisfy PRED are + trimmed, + + * if it is a character sets, all characters in that set are + trimmed. + + If called without a CHAR_PRED argument, all whitespace is trimmed. + + string-trim-both + +- Scheme Procedure: string-trim-both s [char_pred [start [end]]] + Trim S by skipping over all characters on both sides of the string + that satisfy the parameter CHAR_PRED: + + * if it is the character CH, characters equal to CH are trimmed, + + * if it is a procedure PRED characters that satisfy PRED are + trimmed, + + * if it is a character set, the characters in the set are + trimmed. + + If called without a CHAR_PRED argument, all whitespace is trimmed. + + string-fill! + +- Scheme Procedure: string-fill! str chr [start [end]] + Stores CHR in every element of the given STR and returns an + unspecified value. + + string-compare + +- Scheme Procedure: string-compare s1 s2 proc_lt proc_eq proc_gt [start1 +[end1 [start2 [end2]]]] + Apply PROC_LT, PROC_EQ, PROC_GT to the mismatch index, depending + upon whether S1 is less than, equal to, or greater than S2. The + mismatch index is the largest index I such that for every 0 <= J < + I, S1[J] = S2[J] -- that is, I is the first position that does not + match. + + string-compare-ci + +- Scheme Procedure: string-compare-ci s1 s2 proc_lt proc_eq proc_gt +[start1 [end1 [start2 [end2]]]] + Apply PROC_LT, PROC_EQ, PROC_GT to the mismatch index, depending + upon whether S1 is less than, equal to, or greater than S2. The + mismatch index is the largest index I such that for every 0 <= J < + I, S1[J] = S2[J] -- that is, I is the first position where the + lowercased letters do not match. + + string= + +- Scheme Procedure: string= s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 and S2 are not equal, a true value otherwise. + + string<> + +- Scheme Procedure: string<> s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 and S2 are equal, a true value otherwise. + + string< + +- Scheme Procedure: string< s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 is greater or equal to S2, a true value + otherwise. + + string> + +- Scheme Procedure: string> s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 is less or equal to S2, a true value otherwise. + + string<= + +- Scheme Procedure: string<= s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 is greater to S2, a true value otherwise. + + string>= + +- Scheme Procedure: string>= s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 is less to S2, a true value otherwise. + + string-ci= + +- Scheme Procedure: string-ci= s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 and S2 are not equal, a true value otherwise. The + character comparison is done case-insensitively. + + string-ci<> + +- Scheme Procedure: string-ci<> s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 and S2 are equal, a true value otherwise. The + character comparison is done case-insensitively. + + string-ci< + +- Scheme Procedure: string-ci< s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 is greater or equal to S2, a true value + otherwise. The character comparison is done case-insensitively. + + string-ci> + +- Scheme Procedure: string-ci> s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 is less or equal to S2, a true value otherwise. + The character comparison is done case-insensitively. + + string-ci<= + +- Scheme Procedure: string-ci<= s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 is greater to S2, a true value otherwise. The + character comparison is done case-insensitively. + + string-ci>= + +- Scheme Procedure: string-ci>= s1 s2 [start1 [end1 [start2 [end2]]]] + Return `#f' if S1 is less to S2, a true value otherwise. The + character comparison is done case-insensitively. + + string-hash + +- Scheme Procedure: string-hash s [bound [start [end]]] + Compute a hash value for S. the optional argument BOUND is a + non-negative exact integer specifying the range of the hash + function. A positive value restricts the return value to the range + [0,bound). + + string-hash-ci + +- Scheme Procedure: string-hash-ci s [bound [start [end]]] + Compute a hash value for S. the optional argument BOUND is a + non-negative exact integer specifying the range of the hash + function. A positive value restricts the return value to the range + [0,bound). + + string-prefix-length + +- Scheme Procedure: string-prefix-length s1 s2 [start1 [end1 [start2 +[end2]]]] + Return the length of the longest common prefix of the two strings. + + string-prefix-length-ci + +- Scheme Procedure: string-prefix-length-ci s1 s2 [start1 [end1 [start2 +[end2]]]] + Return the length of the longest common prefix of the two strings, + ignoring character case. + + string-suffix-length + +- Scheme Procedure: string-suffix-length s1 s2 [start1 [end1 [start2 +[end2]]]] + Return the length of the longest common suffix of the two strings. + + string-suffix-length-ci + +- Scheme Procedure: string-suffix-length-ci s1 s2 [start1 [end1 [start2 +[end2]]]] + Return the length of the longest common suffix of the two strings, + ignoring character case. + + string-prefix? + +- Scheme Procedure: string-prefix? s1 s2 [start1 [end1 [start2 [end2]]]] + Is S1 a prefix of S2? + + string-prefix-ci? + +- Scheme Procedure: string-prefix-ci? s1 s2 [start1 [end1 [start2 +[end2]]]] + Is S1 a prefix of S2, ignoring character case? + + string-suffix? + +- Scheme Procedure: string-suffix? s1 s2 [start1 [end1 [start2 [end2]]]] + Is S1 a suffix of S2? + + string-suffix-ci? + +- Scheme Procedure: string-suffix-ci? s1 s2 [start1 [end1 [start2 +[end2]]]] + Is S1 a suffix of S2, ignoring character case? + + string-index + +- Scheme Procedure: string-index s char_pred [start [end]] + Search through the string S from left to right, returning the index + of the first occurrence of a character which + + * equals CHAR_PRED, if it is character, + + * satisfies the predicate CHAR_PRED, if it is a procedure, + + * is in the set CHAR_PRED, if it is a character set. + + Return `#f' if no match is found. + + string-index-right + +- Scheme Procedure: string-index-right s char_pred [start [end]] + Search through the string S from right to left, returning the index + of the last occurrence of a character which + + * equals CHAR_PRED, if it is character, + + * satisfies the predicate CHAR_PRED, if it is a procedure, + + * is in the set if CHAR_PRED is a character set. + + Return `#f' if no match is found. + + string-rindex + +- Scheme Procedure: string-rindex s char_pred [start [end]] + Search through the string S from right to left, returning the index + of the last occurrence of a character which + + * equals CHAR_PRED, if it is character, + + * satisfies the predicate CHAR_PRED, if it is a procedure, + + * is in the set if CHAR_PRED is a character set. + + Return `#f' if no match is found. + + string-skip + +- Scheme Procedure: string-skip s char_pred [start [end]] + Search through the string S from left to right, returning the index + of the first occurrence of a character which + + * does not equal CHAR_PRED, if it is character, + + * does not satisfy the predicate CHAR_PRED, if it is a + procedure, + + * is not in the set if CHAR_PRED is a character set. + + string-skip-right + +- Scheme Procedure: string-skip-right s char_pred [start [end]] + Search through the string S from right to left, returning the index + of the last occurrence of a character which + + * does not equal CHAR_PRED, if it is character, + + * does not satisfy the predicate CHAR_PRED, if it is a + procedure, + + * is not in the set if CHAR_PRED is a character set. + + string-count + +- Scheme Procedure: string-count s char_pred [start [end]] + Return the count of the number of characters in the string S which + + * equals CHAR_PRED, if it is character, + + * satisfies the predicate CHAR_PRED, if it is a procedure. + + * is in the set CHAR_PRED, if it is a character set. + + string-contains + +- Scheme Procedure: string-contains s1 s2 [start1 [end1 [start2 +[end2]]]] + Does string S1 contain string S2? Return the index in S1 where S2 + occurs as a substring, or false. The optional start/end indices + restrict the operation to the indicated substrings. + + string-contains-ci + +- Scheme Procedure: string-contains-ci s1 s2 [start1 [end1 [start2 +[end2]]]] + Does string S1 contain string S2? Return the index in S1 where S2 + occurs as a substring, or false. The optional start/end indices + restrict the operation to the indicated substrings. Character + comparison is done case-insensitively. + + string-upcase! + +- Scheme Procedure: string-upcase! str [start [end]] + Destructively upcase every character in `str'. + + (string-upcase! y) + ==> "ARRDEFG" + y + ==> "ARRDEFG" + + string-upcase + +- Scheme Procedure: string-upcase str [start [end]] + Upcase every character in `str'. + + string-downcase! + +- Scheme Procedure: string-downcase! str [start [end]] + Destructively downcase every character in STR. + + y + ==> "ARRDEFG" + (string-downcase! y) + ==> "arrdefg" + y + ==> "arrdefg" + + string-downcase + +- Scheme Procedure: string-downcase str [start [end]] + Downcase every character in STR. + + string-titlecase! + +- Scheme Procedure: string-titlecase! str [start [end]] + Destructively titlecase every first character in a word in STR. + + string-titlecase + +- Scheme Procedure: string-titlecase str [start [end]] + Titlecase every first character in a word in STR. + + string-capitalize! + +- Scheme Procedure: string-capitalize! str + Upcase the first character of every word in STR destructively and + return STR. + + y ==> "hello world" + (string-capitalize! y) ==> "Hello World" + y ==> "Hello World" + + string-capitalize + +- Scheme Procedure: string-capitalize str + Return a freshly allocated string with the characters in STR, where + the first character of every word is capitalized. + + string-reverse + +- Scheme Procedure: string-reverse str [start [end]] + Reverse the string STR. The optional arguments START and END + delimit the region of STR to operate on. + + string-reverse! + +- Scheme Procedure: string-reverse! str [start [end]] + Reverse the string STR in-place. The optional arguments START and + END delimit the region of STR to operate on. The return value is + unspecified. + + string-append/shared + +- Scheme Procedure: string-append/shared . rest + Like `string-append', but the result may share memory with the + argument strings. + + string-concatenate + +- Scheme Procedure: string-concatenate ls + Append the elements of LS (which must be strings) together into a + single string. Guaranteed to return a freshly allocated string. + + string-concatenate-reverse + +- Scheme Procedure: string-concatenate-reverse ls [final_string [end]] + Without optional arguments, this procedure is equivalent to + + (string-concatenate (reverse ls)) + + If the optional argument FINAL_STRING is specified, it is consed + onto the beginning to LS before performing the list-reverse and + string-concatenate operations. If END is given, only the + characters of FINAL_STRING up to index END are used. + + Guaranteed to return a freshly allocated string. + + string-concatenate/shared + +- Scheme Procedure: string-concatenate/shared ls + Like `string-concatenate', but the result may share memory with the + strings in the list LS. + + string-concatenate-reverse/shared + +- Scheme Procedure: string-concatenate-reverse/shared ls [final_string +[end]] + Like `string-concatenate-reverse', but the result may share memory + with the strings in the LS arguments. + + string-map + +- Scheme Procedure: string-map proc s [start [end]] + PROC is a char->char procedure, it is mapped over S. The order in + which the procedure is applied to the string elements is not + specified. + + string-map! + +- Scheme Procedure: string-map! proc s [start [end]] + PROC is a char->char procedure, it is mapped over S. The order in + which the procedure is applied to the string elements is not + specified. The string S is modified in-place, the return value is + not specified. + + string-fold + +- Scheme Procedure: string-fold kons knil s [start [end]] + Fold KONS over the characters of S, with KNIL as the terminating + element, from left to right. KONS must expect two arguments: The + actual character and the last result of KONS' application. + + string-fold-right + +- Scheme Procedure: string-fold-right kons knil s [start [end]] + Fold KONS over the characters of S, with KNIL as the terminating + element, from right to left. KONS must expect two arguments: The + actual character and the last result of KONS' application. + + string-unfold + +- Scheme Procedure: string-unfold p f g seed [base [make_final]] + * G is used to generate a series of _seed_ values from the + initial SEED: SEED, (G SEED), (G^2 SEED), (G^3 SEED), ... + + * P tells us when to stop -- when it returns true when applied + to one of these seed values. + + * F maps each seed value to the corresponding character in the + result string. These chars are assembled into the string in a + left-to-right order. + + * BASE is the optional initial/leftmost portion of the + constructed string; it default to the empty string. + + * MAKE_FINAL is applied to the terminal seed value (on which P + returns true) to produce the final/rightmost portion of the + constructed string. It defaults to `(lambda (x) )'. + + string-unfold-right + +- Scheme Procedure: string-unfold-right p f g seed [base [make_final]] + * G is used to generate a series of _seed_ values from the + initial SEED: SEED, (G SEED), (G^2 SEED), (G^3 SEED), ... + + * P tells us when to stop -- when it returns true when applied + to one of these seed values. + + * F maps each seed value to the corresponding character in the + result string. These chars are assembled into the string in a + right-to-left order. + + * BASE is the optional initial/rightmost portion of the + constructed string; it default to the empty string. + + * MAKE_FINAL is applied to the terminal seed value (on which P + returns true) to produce the final/leftmost portion of the + constructed string. It defaults to `(lambda (x) )'. + + string-for-each + +- Scheme Procedure: string-for-each proc s [start [end]] + PROC is mapped over S in left-to-right order. The return value is + not specified. + + string-for-each-index + +- Scheme Procedure: string-for-each-index proc s [start [end]] + Call `(PROC i)' for each index i in S, from left to right. + + For example, to change characters to alternately upper and lower + case, + + (define str (string-copy "studly")) + (string-for-each-index + (lambda (i) + (string-set! str i + ((if (even? i) char-upcase char-downcase) + (string-ref str i)))) + str) + str ==> "StUdLy" + + xsubstring + +- Scheme Procedure: xsubstring s from [to [start [end]]] + This is the _extended substring_ procedure that implements + replicated copying of a substring of some string. + + S is a string, START and END are optional arguments that demarcate + a substring of S, defaulting to 0 and the length of S. Replicate + this substring up and down index space, in both the positive and + negative directions. `xsubstring' returns the substring of this + string beginning at index FROM, and ending at TO, which defaults to + FROM + (END - START). + + string-xcopy! + +- Scheme Procedure: string-xcopy! target tstart s sfrom [sto [start +[end]]] + Exactly the same as `xsubstring', but the extracted text is written + into the string TARGET starting at index TSTART. The operation is + not defined if `(eq? TARGET S)' or these arguments share storage -- + you cannot copy a string on top of itself. + + string-replace + +- Scheme Procedure: string-replace s1 s2 [start1 [end1 [start2 [end2]]]] + Return the string S1, but with the characters START1 ... END1 + replaced by the characters START2 ... END2 from S2. + + string-tokenize + +- Scheme Procedure: string-tokenize s [token_set [start [end]]] + Split the string S into a list of substrings, where each substring + is a maximal non-empty contiguous sequence of characters from the + character set TOKEN_SET, which defaults to `char-set:graphic'. If + START or END indices are provided, they restrict `string-tokenize' + to operating on the indicated substring of S. + + string-split + +- Scheme Procedure: string-split str char_pred + Split the string STR into a list of the substrings delimited by + appearances of characters that + + * equal CHAR_PRED, if it is a character, + + * satisfy the predicate CHAR_PRED, if it is a procedure, + + * are in the set CHAR_PRED, if it is a character set. + + Note that an empty substring between separator characters will + result in an empty string in the result list. + + (string-split "root:x:0:0:root:/root:/bin/bash" #\:) + ==> + ("root" "x" "0" "0" "root" "/root" "/bin/bash") + + (string-split "::" #\:) + ==> + ("" "" "") + + (string-split "" #\:) + ==> + ("") + + string-filter + +- Scheme Procedure: string-filter char_pred s [start [end]] + Filter the string S, retaining only those characters which satisfy + CHAR_PRED. + + If CHAR_PRED is a procedure, it is applied to each character as a + predicate, if it is a character, it is tested for equality and if + it is a character set, it is tested for membership. + + string-delete + +- Scheme Procedure: string-delete char_pred s [start [end]] + Delete characters satisfying CHAR_PRED from S. + + If CHAR_PRED is a procedure, it is applied to each character as a + predicate, if it is a character, it is tested for equality and if + it is a character set, it is tested for membership. + + char-set? + +- Scheme Procedure: char-set? obj + Return `#t' if OBJ is a character set, `#f' otherwise. + + char-set= + +- Scheme Procedure: char-set= . char_sets + Return `#t' if all given character sets are equal. + + char-set<= + +- Scheme Procedure: char-set<= . char_sets + Return `#t' if every character set CHAR_SETi is a subset of + character set CHAR_SETi+1. + + char-set-hash + +- Scheme Procedure: char-set-hash cs [bound] + Compute a hash value for the character set CS. If BOUND is given + and non-zero, it restricts the returned value to the range 0 ... + BOUND - 1. + + char-set-cursor + +- Scheme Procedure: char-set-cursor cs + Return a cursor into the character set CS. + + char-set-ref + +- Scheme Procedure: char-set-ref cs cursor + Return the character at the current cursor position CURSOR in the + character set CS. It is an error to pass a cursor for which + `end-of-char-set?' returns true. + + char-set-cursor-next + +- Scheme Procedure: char-set-cursor-next cs cursor + Advance the character set cursor CURSOR to the next character in + the character set CS. It is an error if the cursor given satisfies + `end-of-char-set?'. + + end-of-char-set? + +- Scheme Procedure: end-of-char-set? cursor + Return `#t' if CURSOR has reached the end of a character set, `#f' + otherwise. + + char-set-fold + +- Scheme Procedure: char-set-fold kons knil cs + Fold the procedure KONS over the character set CS, initializing it + with KNIL. + + char-set-unfold + +- Scheme Procedure: char-set-unfold p f g seed [base_cs] + This is a fundamental constructor for character sets. + + * G is used to generate a series of ``seed'' values from the + initial seed: SEED, (G SEED), (G^2 SEED), (G^3 SEED), ... + + * P tells us when to stop -- when it returns true when applied + to one of the seed values. + + * F maps each seed value to a character. These characters are + added to the base character set BASE_CS to form the result; + BASE_CS defaults to the empty set. + + char-set-unfold! + +- Scheme Procedure: char-set-unfold! p f g seed base_cs + This is a fundamental constructor for character sets. + + * G is used to generate a series of ``seed'' values from the + initial seed: SEED, (G SEED), (G^2 SEED), (G^3 SEED), ... + + * P tells us when to stop -- when it returns true when applied + to one of the seed values. + + * F maps each seed value to a character. These characters are + added to the base character set BASE_CS to form the result; + BASE_CS defaults to the empty set. + + char-set-for-each + +- Scheme Procedure: char-set-for-each proc cs + Apply PROC to every character in the character set CS. The return + value is not specified. + + char-set-map + +- Scheme Procedure: char-set-map proc cs + Map the procedure PROC over every character in CS. PROC must be a + character -> character procedure. + + char-set-copy + +- Scheme Procedure: char-set-copy cs + Return a newly allocated character set containing all characters in + CS. + + char-set + +- Scheme Procedure: char-set . rest + Return a character set containing all given characters. + + list->char-set + +- Scheme Procedure: list->char-set list [base_cs] + Convert the character list LIST to a character set. If the + character set BASE_CS is given, the character in this set are also + included in the result. + + list->char-set! + +- Scheme Procedure: list->char-set! list base_cs + Convert the character list LIST to a character set. The characters + are added to BASE_CS and BASE_CS is returned. + + string->char-set + +- Scheme Procedure: string->char-set str [base_cs] + Convert the string STR to a character set. If the character set + BASE_CS is given, the characters in this set are also included in + the result. + + string->char-set! + +- Scheme Procedure: string->char-set! str base_cs + Convert the string STR to a character set. The characters from the + string are added to BASE_CS, and BASE_CS is returned. + + char-set-filter + +- Scheme Procedure: char-set-filter pred cs [base_cs] + Return a character set containing every character from CS so that + it satisfies PRED. If provided, the characters from BASE_CS are + added to the result. + + char-set-filter! + +- Scheme Procedure: char-set-filter! pred cs base_cs + Return a character set containing every character from CS so that + it satisfies PRED. The characters are added to BASE_CS and BASE_CS + is returned. + + ucs-range->char-set + +- Scheme Procedure: ucs-range->char-set lower upper [error [base_cs]] + Return a character set containing all characters whose character + codes lie in the half-open range [LOWER,UPPER). + + If ERROR is a true value, an error is signalled if the specified + range contains characters which are not valid Unicode code points. + If ERROR is `#f', these characters are silently left out of the + resulting character set. + + The characters in BASE_CS are added to the result, if given. + + ucs-range->char-set! + +- Scheme Procedure: ucs-range->char-set! lower upper error base_cs + Return a character set containing all characters whose character + codes lie in the half-open range [LOWER,UPPER). + + If ERROR is a true value, an error is signalled if the specified + range contains characters which are not contained in the + implemented character range. If ERROR is `#f', these characters + are silently left out of the resulting character set. + + The characters are added to BASE_CS and BASE_CS is returned. + + ->char-set + +- Scheme Procedure: ->char-set x + Coerces x into a char-set. X may be a string, character or + char-set. A string is converted to the set of its constituent + characters; a character is converted to a singleton set; a char-set + is returned as-is. + + char-set-size + +- Scheme Procedure: char-set-size cs + Return the number of elements in character set CS. + + char-set-count + +- Scheme Procedure: char-set-count pred cs + Return the number of the elements int the character set CS which + satisfy the predicate PRED. + + char-set->list + +- Scheme Procedure: char-set->list cs + Return a list containing the elements of the character set CS. + + char-set->string + +- Scheme Procedure: char-set->string cs + Return a string containing the elements of the character set CS. + The order in which the characters are placed in the string is not + defined. + + char-set-contains? + +- Scheme Procedure: char-set-contains? cs ch + Return `#t' iff the character CH is contained in the character set + CS. + + char-set-every + +- Scheme Procedure: char-set-every pred cs + Return a true value if every character in the character set CS + satisfies the predicate PRED. + + char-set-any + +- Scheme Procedure: char-set-any pred cs + Return a true value if any character in the character set CS + satisfies the predicate PRED. + + char-set-adjoin + +- Scheme Procedure: char-set-adjoin cs . rest + Add all character arguments to the first argument, which must be a + character set. + + char-set-delete + +- Scheme Procedure: char-set-delete cs . rest + Delete all character arguments from the first argument, which must + be a character set. + + char-set-adjoin! + +- Scheme Procedure: char-set-adjoin! cs . rest + Add all character arguments to the first argument, which must be a + character set. + + char-set-delete! + +- Scheme Procedure: char-set-delete! cs . rest + Delete all character arguments from the first argument, which must + be a character set. + + char-set-complement + +- Scheme Procedure: char-set-complement cs + Return the complement of the character set CS. + + char-set-union + +- Scheme Procedure: char-set-union . rest + Return the union of all argument character sets. + + char-set-intersection + +- Scheme Procedure: char-set-intersection . rest + Return the intersection of all argument character sets. + + char-set-difference + +- Scheme Procedure: char-set-difference cs1 . rest + Return the difference of all argument character sets. + + char-set-xor + +- Scheme Procedure: char-set-xor . rest + Return the exclusive-or of all argument character sets. + + char-set-diff+intersection + +- Scheme Procedure: char-set-diff+intersection cs1 . rest + Return the difference and the intersection of all argument + character sets. + + char-set-complement! + +- Scheme Procedure: char-set-complement! cs + Return the complement of the character set CS. + + char-set-union! + +- Scheme Procedure: char-set-union! cs1 . rest + Return the union of all argument character sets. + + char-set-intersection! + +- Scheme Procedure: char-set-intersection! cs1 . rest + Return the intersection of all argument character sets. + + char-set-difference! + +- Scheme Procedure: char-set-difference! cs1 . rest + Return the difference of all argument character sets. + + char-set-xor! + +- Scheme Procedure: char-set-xor! cs1 . rest + Return the exclusive-or of all argument character sets. + + char-set-diff+intersection! + +- Scheme Procedure: char-set-diff+intersection! cs1 cs2 . rest + Return the difference and the intersection of all argument + character sets. + + %char-set-dump + +- Scheme Procedure: %char-set-dump charset + Returns an association list containing debugging information for + CHARSET. The association list has the following entries. + + char-set + The char-set itself. + + len + The number of character ranges the char-set contains + + ranges + A list of lists where each sublist a range of code points and + their associated characters + + log2-binary-factors + +- Scheme Procedure: log2-binary-factors n + Return a count of how many factors of 2 are present in N. This is + also the bit index of the lowest 1 bit in N. If N is 0, the return + is -1. + + (log2-binary-factors 6) ==> 1 + (log2-binary-factors -8) ==> 3 + + copy-bit + +- Scheme Procedure: copy-bit index n newbit + Return N with the bit at INDEX set according to NEWBIT. NEWBIT + should be `#t' to set the bit to 1, or `#f' to set it to 0. Bits + other than at INDEX are unchanged in the return. + + (copy-bit 1 #b0101 #t) ==> 7 + + rotate-bit-field + +- Scheme Procedure: rotate-bit-field n count start end + Return N with the bit field from START (inclusive) to END + (exclusive) rotated upwards by COUNT bits. + + COUNT can be positive or negative, and it can be more than the + field width (it'll be reduced modulo the width). + + (rotate-bit-field #b0110 2 1 4) ==> #b1010 + + reverse-bit-field + +- Scheme Procedure: reverse-bit-field n start end + Return N with the bits between START (inclusive) to END (exclusive) + reversed. + + (reverse-bit-field #b101001 2 4) ==> #b100101 + + integer->list + +- Scheme Procedure: integer->list n [len] + Return bits from N in the form of a list of `#t' for 1 and `#f' for + 0. The least significant LEN bits are returned, and the first list + element is the most significant of those bits. If LEN is not + given, the default is `(integer-length N)' (see Bitwise + Operations). + + (integer->list 6) ==> (#t #t #f) + (integer->list 1 4) ==> (#f #f #f #t) + + list->integer + +- Scheme Procedure: list->integer lst + Return an integer formed bitwise from the given LST list of + booleans. Each boolean is `#t' for a 1 and `#f' for a 0. The + first element becomes the most significant bit in the return. + + (list->integer '(#t #f #t #f)) ==> 10 + + booleans->integer + +- Scheme Procedure: booleans->integer + implemented by the C function "scm_srfi60_list_to_integer" + + %get-stack-size + +- Scheme Procedure: %get-stack-size + Return the current thread's C stack size (in Scheme objects). + + stack? + +- Scheme Procedure: stack? obj + Return `#t' if OBJ is a calling stack. + + make-stack + +- Scheme Procedure: make-stack obj . args + Create a new stack. If OBJ is `#t', the current evaluation stack + is used for creating the stack frames, otherwise the frames are + taken from OBJ (which must be a continuation or a frame object). + + ARGS should be a list containing any combination of integer, + procedure, address range, prompt tag and `#t' values. + + These values specify various ways of cutting away uninteresting + stack frames from the top and bottom of the stack that `make-stack' + returns. They come in pairs like this: `(INNER_CUT_1 OUTER_CUT_1 + INNER_CUT_2 OUTER_CUT_2 ...)'. + + Each INNER_CUT_I can be an integer, a procedure, an address range, + or a prompt tag. An integer means to cut away exactly that number + of frames. A procedure means to cut away all frames up to but + excluding the frame whose procedure matches the specified one. An + address range is a pair of integers indicating the low and high + addresses of a procedure's code, and is the same as cutting away to + a procedure (though with less work). Anything else is interpreted + as a prompt tag which cuts away all frames that are inside a prompt + with the given tag. + + Each OUTER_CUT_I can be an integer, a procedure, an address range, + or a prompt tag. An integer means to cut away that number of + frames. A procedure means to cut away frames down to but excluding + the frame whose procedure matches the specified one. An address + range is the same, but with the procedure's code specified as an + address range. Anything else is taken to be a prompt tag, which + cuts away all frames that are outside a prompt with the given tag. + + If the OUTER_CUT_I of the last pair is missing, it is taken as 0. + + stack-id + +- Scheme Procedure: stack-id stack + Return the identifier given to STACK by `start-stack'. + + stack-ref + +- Scheme Procedure: stack-ref stack index + Return the INDEX'th frame from STACK. + + stack-length + +- Scheme Procedure: stack-length stack + Return the length of STACK. + + get-internal-real-time + +- Scheme Procedure: get-internal-real-time + Return the number of time units since the interpreter was started. + + times + +- Scheme Procedure: times + Return an object with information about real and processor time. + The following procedures accept such an object as an argument and + return a selected component: + + tms:clock + The current real time, expressed as time units relative to an + arbitrary base. + + tms:utime + The CPU time units used by the calling process. + + tms:stime + The CPU time units used by the system on behalf of the calling + process. + + tms:cutime + The CPU time units used by terminated child processes of the + calling process, whose status has been collected (e.g., using + `waitpid'). + + tms:cstime + Similarly, the CPU times units used by the system on behalf of + terminated child processes. + + get-internal-run-time + +- Scheme Procedure: get-internal-run-time + Return the number of time units of processor time used by the + interpreter. Both _system_ and _user_ time are included but + subprocesses are not. + + current-time + +- Scheme Procedure: current-time + Return the number of seconds since 1970-01-01 00:00:00 UTC, + excluding leap seconds. + + gettimeofday + +- Scheme Procedure: gettimeofday + Return a pair containing the number of seconds and microseconds + since 1970-01-01 00:00:00 UTC, excluding leap seconds. Note: + whether true microsecond resolution is available depends on the + operating system. + + localtime + +- Scheme Procedure: localtime time [zone] + Return an object representing the broken down components of TIME, + an integer like the one returned by `current-time'. The time zone + for the calculation is optionally specified by ZONE (a string), + otherwise the `TZ' environment variable or the system default is + used. + + gmtime + +- Scheme Procedure: gmtime time + Return an object representing the broken down components of TIME, + an integer like the one returned by `current-time'. The values are + calculated for UTC. + + mktime + +- Scheme Procedure: mktime sbd_time [zone] + SBD_TIME is an object representing broken down time and `zone' is + an optional time zone specifier (otherwise the TZ environment + variable or the system default is used). + + Returns a pair: the car is a corresponding integer time value like + that returned by `current-time'; the cdr is a broken down time + object, similar to as SBD_TIME but with normalized values. + + tzset + +- Scheme Procedure: tzset + Initialize the timezone from the TZ environment variable or the + system default. It's not usually necessary to call this procedure + since it's done automatically by other procedures that depend on + the timezone. + + strftime + +- Scheme Procedure: strftime format stime + Return a string which is broken-down time structure STIME formatted + according to the given FORMAT string. + + FORMAT contains field specifications introduced by a `%' character. + See Formatting Calendar Time in manual The GNU C Library Reference + Manual, or `man 3 strftime', for the available formatting. + + (strftime "%c" (localtime (current-time))) + ==> "Mon Mar 11 20:17:43 2002" + + If `setlocale' has been called (see Locales), month and day names + are from the current locale and in the locale character set. + + %string-dump + +- Scheme Procedure: %string-dump str + Returns an association list containing debugging information for + STR. The association list has the following entries. + + string + The string itself. + + start + The start index of the string into its stringbuf + + length + The length of the string + + shared + If this string is a substring, it returns its parent string. + Otherwise, it returns `#f' + + read-only + `#t' if the string is read-only + + stringbuf-chars + A new string containing this string's stringbuf's characters + + stringbuf-length + The number of characters in this stringbuf + + stringbuf-mutable + `#t' if this stringbuf is mutable + + stringbuf-wide + `#t' if this stringbuf's characters are stored in a 32-bit + buffer, or `#f' if they are stored in an 8-bit buffer + + %symbol-dump + +- Scheme Procedure: %symbol-dump sym + Returns an association list containing debugging information for + SYM. The association list has the following entries. + + symbol + The symbol itself + + hash + Its hash value + + interned + `#t' if it is an interned symbol + + stringbuf-chars + A new string containing this symbols's stringbuf's characters + + stringbuf-length + The number of characters in this stringbuf + + stringbuf-mutable + `#t' if this stringbuf is mutable + + stringbuf-wide + `#t' if this stringbuf's characters are stored in a 32-bit + buffer, or `#f' if they are stored in an 8-bit buffer + + string? + +- Scheme Procedure: string? obj + Return `#t' if OBJ is a string, else `#f'. + + list->string + +- Scheme Procedure: list->string + implemented by the C function "scm_string" + + string + +- Scheme Procedure: string . chrs + + + Return a newly allocated string composed of the arguments, CHRS. + + make-string + +- Scheme Procedure: make-string k [chr] + Return a newly allocated string of length K. If CHR is given, then + all elements of the string are initialized to CHR, otherwise the + contents of the string are all set to `# ul'. + + string-length + +- Scheme Procedure: string-length string + Return the number of characters in STRING. + + string-bytes-per-char + +- Scheme Procedure: string-bytes-per-char string + Return the bytes used to represent a character in STRING.This will + return 1 or 4. + + string-ref + +- Scheme Procedure: string-ref str k + Return character K of STR using zero-origin indexing. K must be a + valid index of STR. + + string-set! + +- Scheme Procedure: string-set! str k chr + Store CHR in element K of STR and return an unspecified value. K + must be a valid index of STR. + + substring + +- Scheme Procedure: substring str start [end] + Return a newly allocated string formed from the characters of STR + beginning with index START (inclusive) and ending with index END + (exclusive). STR must be a string, START and END must be exact + integers satisfying: + + 0 <= START <= END <= (string-length STR). + + substring/read-only + +- Scheme Procedure: substring/read-only str start [end] + Return a newly allocated string formed from the characters of STR + beginning with index START (inclusive) and ending with index END + (exclusive). STR must be a string, START and END must be exact + integers satisfying: + + 0 <= START <= END <= (string-length STR). + + The returned string is read-only. + + substring/copy + +- Scheme Procedure: substring/copy str start [end] + Return a newly allocated string formed from the characters of STR + beginning with index START (inclusive) and ending with index END + (exclusive). STR must be a string, START and END must be exact + integers satisfying: + + 0 <= START <= END <= (string-length STR). + + substring/shared + +- Scheme Procedure: substring/shared str start [end] + Return string that indirectly refers to the characters of STR + beginning with index START (inclusive) and ending with index END + (exclusive). STR must be a string, START and END must be exact + integers satisfying: + + 0 <= START <= END <= (string-length STR). + + string-append + +- Scheme Procedure: string-append . args + Return a newly allocated string whose characters form the + concatenation of the given strings, ARGS. + + string-utf8-length + +- Scheme Procedure: string-utf8-length string + Returns the number of bytes in the UTF-8 representation of STRING. + + string-normalize-nfc + +- Scheme Procedure: string-normalize-nfc string + Returns the NFC normalized form of STRING. + + string-normalize-nfd + +- Scheme Procedure: string-normalize-nfd string + Returns the NFD normalized form of STRING. + + string-normalize-nfkc + +- Scheme Procedure: string-normalize-nfkc string + Returns the NFKC normalized form of STRING. + + string-normalize-nfkd + +- Scheme Procedure: string-normalize-nfkd string + Returns the NFKD normalized form of STRING. + + string=? + +- Scheme Procedure: string=? [s1 [s2 . rest]] + Lexicographic equality predicate; return `#t' if the two strings + are the same length and contain the same characters in the same + positions, otherwise return `#f'. + + The procedure `string-ci=?' treats upper and lower case letters as + though they were the same character, but `string=?' treats upper + and lower case as distinct characters. + + string-ci=? + +- Scheme Procedure: string-ci=? [s1 [s2 . rest]] + Case-insensitive string equality predicate; return `#t' if the two + strings are the same length and their component characters match + (ignoring case) at each position; otherwise return `#f'. + + string? + +- Scheme Procedure: string>? [s1 [s2 . rest]] + Lexicographic ordering predicate; return `#t' if S1 is + lexicographically greater than S2. + + string>=? + +- Scheme Procedure: string>=? [s1 [s2 . rest]] + Lexicographic ordering predicate; return `#t' if S1 is + lexicographically greater than or equal to S2. + + string-ci? + +- Scheme Procedure: string-ci>? [s1 [s2 . rest]] + Case insensitive lexicographic ordering predicate; return `#t' if + S1 is lexicographically greater than S2 regardless of case. + + string-ci>=? + +- Scheme Procedure: string-ci>=? [s1 [s2 . rest]] + Case insensitive lexicographic ordering predicate; return `#t' if + S1 is lexicographically greater than or equal to S2 regardless of + case. + + object->string + +- Scheme Procedure: object->string obj [printer] + Return a Scheme string obtained by printing OBJ. Printing function + can be specified by the optional second argument PRINTER (default: + `write'). + + open-input-string + +- Scheme Procedure: open-input-string str + Take a string and return an input port that delivers characters + from the string. The port can be closed by `close-input-port', + though its storage will be reclaimed by the garbage collector if it + becomes inaccessible. + + open-output-string + +- Scheme Procedure: open-output-string + Return an output port that will accumulate characters for retrieval + by `get-output-string'. The port can be closed by the procedure + `close-output-port', though its storage will be reclaimed by the + garbage collector if it becomes inaccessible. + + get-output-string + +- Scheme Procedure: get-output-string port + Given an output port created by `open-output-string', return a + string consisting of the characters that have been output to the + port so far. + + eval-string + +- Scheme Procedure: eval-string string [module] + Evaluate STRING as the text representation of a Scheme form or + forms, and return whatever value they produce. Evaluation takes + place in the given module, or the current module when no module is + given. While the code is evaluated, the given module is made the + current one. The current module is restored when this procedure + returns. + + make-struct-layout + +- Scheme Procedure: make-struct-layout fields + Return a new structure layout object. + + FIELDS must be a string made up of pairs of characters strung + together. The first character of each pair describes a field type, + the second a field protection. Allowed types are 'p' for + GC-protected Scheme data, 'u' for unprotected binary data. Allowed + protections are 'w' for mutable fields, 'h' for hidden fields, and + 'r' for read-only fields. + + Hidden fields are writable, but they will not consume an + initializer arg passed to `make-struct'. They are useful to add + slots to a struct in a way that preserves backward-compatibility + with existing calls to `make-struct', especially for derived + vtables. + + struct? + +- Scheme Procedure: struct? x + Return `#t' iff X is a structure object, else `#f'. + + struct-vtable? + +- Scheme Procedure: struct-vtable? x + Return `#t' iff X is a vtable structure. + + allocate-struct + +- Scheme Procedure: allocate-struct vtable nfields + Allocate a new structure with space for NFIELDS fields. + + VTABLE must be a vtable structure (see Vtables). + + NFIELDS must be a non-negative integer. Strictly speaking NFIELDS + is redundant, as the vtable carries the size for its instances. + However passing it is useful as a sanity check, given that one + module can inline a constructor in another. + + Fields will be initialized with their default values. + + make-struct/no-tail + +- Scheme Procedure: make-struct/no-tail vtable . init + Create a new structure. + + VTABLE must be a vtable structure (see Vtables). + + The INIT1, ... are optional arguments describing how successive + fields of the structure should be initialized. Only fields with + protection 'r' or 'w' can be initialized. Hidden fields (those + with protection 'h') have to be manually set. + + If fewer optional arguments than initializable fields are supplied, + fields of type 'p' get default value #f while fields of type 'u' + are initialized to 0. + + make-vtable + +- Scheme Procedure: make-vtable fields [printer] + Create a vtable, for creating structures with the given FIELDS. + + The optional PRINTER argument is a function to be called `(PRINTER + struct port)' on the structures created. It should look at STRUCT + and write to PORT. + + struct-ref + +- Scheme Procedure: struct-ref handle pos + Access the POSth field of struct associated with HANDLE. + + If the field is of type 'p', then it can be set to an arbitrary + value. + + If the field is of type 'u', then it can only be set to a + non-negative integer value small enough to fit in one machine word. + + struct-set! + +- Scheme Procedure: struct-set! handle pos val + Set the slot of the structure HANDLE with index POS to VAL. Signal + an error if the slot can not be written to. + + struct-ref/unboxed + +- Scheme Procedure: struct-ref/unboxed handle pos + Access the POSth field of struct associated with HANDLE. The field + must be of type 'u'. + + struct-set!/unboxed + +- Scheme Procedure: struct-set!/unboxed handle pos val + Set the slot of the structure HANDLE with index POS to VAL. Signal + an error if the slot can not be written to. + + struct-vtable + +- Scheme Procedure: struct-vtable handle + Return the vtable structure that describes the type of struct + associated with HANDLE. + + struct-vtable-name + +- Scheme Procedure: struct-vtable-name vtable + Return the name of the vtable VTABLE. + + set-struct-vtable-name! + +- Scheme Procedure: set-struct-vtable-name! vtable name + Set the name of the vtable VTABLE to NAME. + + symbol? + +- Scheme Procedure: symbol? obj + Return `#t' if OBJ is a symbol, otherwise return `#f'. + + symbol-interned? + +- Scheme Procedure: symbol-interned? symbol + Return `#t' if SYMBOL is interned, otherwise return `#f'. + + make-symbol + +- Scheme Procedure: make-symbol name + Return a new uninterned symbol with the name NAME. The returned + symbol is guaranteed to be unique and future calls to + `string->symbol' will not return it. + + symbol->string + +- Scheme Procedure: symbol->string s + Return the name of SYMBOL as a string. If the symbol was part of + an object returned as the value of a literal expression (section + see in manual The Revised^5 Report on Scheme) or by a call to the + `read' procedure, and its name contains alphabetic characters, then + the string returned will contain characters in the implementation's + preferred standard case---some implementations will prefer upper + case, others lower case. If the symbol was returned by + `string->symbol', the case of characters in the string returned + will be the same as the case in the string that was passed to + `string->symbol'. It is an error to apply mutation procedures like + `string-set!' to strings returned by this procedure. + + The following examples assume that the implementation's standard + case is lower case: + + (symbol->string 'flying-fish) ==> "flying-fish" + (symbol->string 'Martin) ==> "martin" + (symbol->string + (string->symbol "Malvina")) ==> "Malvina" + + string->symbol + +- Scheme Procedure: string->symbol string + Return the symbol whose name is STRING. This procedure can create + symbols with names containing special characters or letters in the + non-standard case, but it is usually a bad idea to create such + symbols because in some implementations of Scheme they cannot be + read as themselves. See `symbol->string'. + + The following examples assume that the implementation's standard + case is lower case: + + (eq? 'mISSISSIppi 'mississippi) ==> #t + (string->symbol "mISSISSIppi") ==> the symbol with name "mISSISSIppi" + + + (eq? 'bitBlt (string->symbol "bitBlt")) ==> #f + (eq? 'JollyWog + (string->symbol (symbol->string 'JollyWog))) ==> #t + (string=? "K. Harper, M.D." + (symbol->string + (string->symbol "K. Harper, M.D."))) ==>#t + + string-ci->symbol + +- Scheme Procedure: string-ci->symbol str + Return the symbol whose name is STR. STR is converted to lowercase + before the conversion is done, if Guile is currently reading + symbols case-insensitively. + + gensym + +- Scheme Procedure: gensym [prefix] + Create a new symbol with a name constructed from a prefix and a + counter value. The string PREFIX can be specified as an optional + argument. Default prefix is `g'. The counter is increased by 1 at + each call. There is no provision for resetting the counter. + + symbol-hash + +- Scheme Procedure: symbol-hash symbol + Return a hash value for SYMBOL. + + symbol-fref + +- Scheme Procedure: symbol-fref s + Return the contents of the symbol S's "function slot". + + symbol-pref + +- Scheme Procedure: symbol-pref s + Return the "property list" currently associated with the symbol S. + + symbol-fset! + +- Scheme Procedure: symbol-fset! s val + Change the binding of the symbol S's function slot. + + symbol-pset! + +- Scheme Procedure: symbol-pset! s val + Change the binding of the symbol S's property slot. + + syntax? + +- Scheme Procedure: syntax? obj + Return `#t' if the argument OBJ is a syntax object, else `#f'. + + make-syntax + +- Scheme Procedure: make-syntax exp wrap module + Make a new syntax object. + + syntax-expression + +- Scheme Procedure: syntax-expression obj + Return the expression contained in the syntax object OBJ. + + syntax-wrap + +- Scheme Procedure: syntax-wrap obj + Return the wrap contained in the syntax object OBJ. + + syntax-module + +- Scheme Procedure: syntax-module obj + Return the module info contained in the syntax object OBJ. + + %call-with-new-thread + +- Scheme Procedure: %call-with-new-thread thunk + yield + +- Scheme Procedure: yield + Move the calling thread to the end of the scheduling queue. + + thread? + +- Scheme Procedure: thread? obj + Return `#t' if OBJ is a thread. + + make-mutex + +- Scheme Procedure: make-mutex [kind] + Create a new mutex. If KIND is not given, the mutex will be a + standard non-recursive mutex. Otherwise pass `recursive' to make a + recursive mutex, or `allow-external-unlock' to make a non-recursive + mutex that can be unlocked from any thread. + + make-recursive-mutex + +- Scheme Procedure: make-recursive-mutex + Create a new recursive mutex. + + lock-mutex + +- Scheme Procedure: lock-mutex mutex [timeout] + Lock mutex MUTEX. If the mutex is already locked, the calling + thread blocks until the mutex becomes available. + + unlock-mutex + +- Scheme Procedure: unlock-mutex mutex + Unlocks MUTEX. The calling thread must already hold the lock on + MUTEX, unless the mutex was created with the + `allow-external-unlock' option; otherwise an error will be + signalled. + + mutex? + +- Scheme Procedure: mutex? obj + Return `#t' if OBJ is a mutex. + + mutex-owner + +- Scheme Procedure: mutex-owner mx + Return the thread owning MX, or `#f'. + + mutex-level + +- Scheme Procedure: mutex-level mx + Return the lock level of mutex MX. + + mutex-locked? + +- Scheme Procedure: mutex-locked? mx + Returns `#t' if the mutex MX is locked. + + make-condition-variable + +- Scheme Procedure: make-condition-variable + Make a new condition variable. + + wait-condition-variable + +- Scheme Procedure: wait-condition-variable cond mutex [timeout] + Wait until condition variable CV has been signalled. While + waiting, mutex MX is atomically unlocked (as with `unlock-mutex') + and is locked again when this function returns. When T is given, + it specifies a point in time where the waiting should be aborted. + It can be either a integer as returned by `current-time' or a pair + as returned by `gettimeofday'. When the waiting is aborted the + mutex is locked and `#f' is returned. When the condition variable + is in fact signalled, the mutex is also locked and `#t' is + returned. + + signal-condition-variable + +- Scheme Procedure: signal-condition-variable cv + Wake up one thread that is waiting for CV + + broadcast-condition-variable + +- Scheme Procedure: broadcast-condition-variable cv + Wake up all threads that are waiting for CV. + + condition-variable? + +- Scheme Procedure: condition-variable? obj + Return `#t' if OBJ is a condition variable. + + current-thread + +- Scheme Procedure: current-thread + Return the thread that called this function. + + all-threads + +- Scheme Procedure: all-threads + Return a list of all threads. + + thread-exited? + +- Scheme Procedure: thread-exited? thread + Return `#t' iff THREAD has exited. + + total-processor-count + +- Scheme Procedure: total-processor-count + Return the total number of processors of the machine, which is + guaranteed to be at least 1. A ``processor'' here is a thread + execution unit, which can be either: + + * an execution core in a (possibly multi-core) chip, in a + (possibly multi- chip) module, in a single computer, or + + * a thread execution unit inside a core in the case of + "hyper-threaded" CPUs. + + Which of the two definitions is used, is unspecified. + + current-processor-count + +- Scheme Procedure: current-processor-count + Like `total-processor-count', but return the number of processors + available to the current process. See `setaffinity' and + `getaffinity' for more information. + + copy-tree + +- Scheme Procedure: copy-tree obj + Recursively copy the data tree that is bound to OBJ, and return a + the new data structure. `copy-tree' recurses down the contents of + both pairs and vectors (since both cons cells and vector cells may + point to arbitrary objects), and stops recursing when it hits any + other object. + + char->formal-name + +- Scheme Procedure: char->formal-name ch + Return the formal all-upper-case unicode name of CH, as a string. + If the character has no name, return `#f'. + + formal-name->char + +- Scheme Procedure: formal-name->char name + Return the character whose formal all-upper-case unicode name is + NAME, or `#f' if no such character is known. + + values + +- Scheme Procedure: values . args + Delivers all of its arguments to its continuation. Except for + continuations created by the `call-with-values' procedure, all + continuations take exactly one value. The effect of passing no + value or more than one value to continuations that were not created + by `call-with-values' is unspecified. + + make-variable + +- Scheme Procedure: make-variable init + Return a variable initialized to value INIT. + + make-undefined-variable + +- Scheme Procedure: make-undefined-variable + Return a variable that is initially unbound. + + variable? + +- Scheme Procedure: variable? obj + Return `#t' iff OBJ is a variable object, else return `#f'. + + variable-ref + +- Scheme Procedure: variable-ref var + Dereference VAR and return its value. VAR must be a variable + object; see `make-variable' and `make-undefined-variable'. + + variable-set! + +- Scheme Procedure: variable-set! var val + Set the value of the variable VAR to VAL. VAR must be a variable + object, VAL can be any value. Return an unspecified value. + + variable-unset! + +- Scheme Procedure: variable-unset! var + Ensure that VAR is not bound to a value. VAR must be a variable + object. + + variable-bound? + +- Scheme Procedure: variable-bound? var + Return `#t' iff VAR is bound to a value. Throws an error if VAR is + not a variable object. + + vector? + +- Scheme Procedure: vector? obj + Return `#t' if OBJ is a vector, otherwise return `#f'. + + vector-length + +- Scheme Procedure: vector-length v + Returns the number of elements in VECTOR as an exact integer. + + list->vector + +- Scheme Procedure: list->vector + implemented by the C function "scm_vector" + + vector + +- Scheme Procedure: vector . l + + + Return a newly allocated vector composed of the given arguments. + Analogous to `list'. + + (vector 'a 'b 'c) ==> #(a b c) + + vector-ref + +- Scheme Procedure: vector-ref vector k + K must be a valid index of VECTOR. `Vector-ref' returns the + contents of element K of VECTOR. + + (vector-ref '#(1 1 2 3 5 8 13 21) 5) ==> 8 + (vector-ref '#(1 1 2 3 5 8 13 21) + (let ((i (round (* 2 (acos -1))))) + (if (inexact? i) + (inexact->exact i) + i))) ==> 13 + + vector-set! + +- Scheme Procedure: vector-set! vector k obj + K must be a valid index of VECTOR. `Vector-set!' stores OBJ in + element K of VECTOR. The value returned by `vector-set!' is + unspecified. + + (let ((vec (vector 0 '(2 2 2 2) "Anna"))) + (vector-set! vec 1 '("Sue" "Sue")) + vec) ==> #(0 ("Sue" "Sue") "Anna") + (vector-set! '#(0 1 2) 1 "doe") ==> _error_ ; constant vector + + make-vector + +- Scheme Procedure: make-vector k [fill] + Return a newly allocated vector of K elements. If a second + argument is given, then each position is initialized to FILL. + Otherwise the initial contents of each position is unspecified. + + vector-copy + +- Scheme Procedure: vector-copy vec + Return a copy of VEC. + + vector->list + +- Scheme Procedure: vector->list v + Return a newly allocated list composed of the elements of V. + + (vector->list '#(dah dah didah)) ==> (dah dah didah) + (list->vector '(dididit dah)) ==> #(dididit dah) + + vector-fill! + +- Scheme Procedure: vector-fill! v fill + Store FILL in every position of VECTOR. The value returned by + `vector-fill!' is unspecified. + + vector-move-left! + +- Scheme Procedure: vector-move-left! vec1 start1 end1 vec2 start2 + Copy elements from VEC1, positions START1 to END1, to VEC2 starting + at position START2. START1 and START2 are inclusive indices; END1 + is exclusive. + + `vector-move-left!' copies elements in leftmost order. Therefore, + in the case where VEC1 and VEC2 refer to the same vector, + `vector-move-left!' is usually appropriate when START1 is greater + than START2. + + vector-move-right! + +- Scheme Procedure: vector-move-right! vec1 start1 end1 vec2 start2 + Copy elements from VEC1, positions START1 to END1, to VEC2 starting + at position START2. START1 and START2 are inclusive indices; END1 + is exclusive. + + `vector-move-right!' copies elements in rightmost order. Therefore, + in the case where VEC1 and VEC2 refer to the same vector, + `vector-move-right!' is usually appropriate when START1 is less + than START2. + + major-version + +- Scheme Procedure: major-version + Return a string containing Guile's major version number. E.g., the + 1 in "1.6.5". + + minor-version + +- Scheme Procedure: minor-version + Return a string containing Guile's minor version number. E.g., the + 6 in "1.6.5". + + micro-version + +- Scheme Procedure: micro-version + Return a string containing Guile's micro version number. E.g., the + 5 in "1.6.5". + + version + +- Scheme Procedure: version + + + + + + + Return a string describing Guile's version number, or its major, + minor or micro version number, respectively. + + (version) ==> "1.6.0" + (major-version) ==> "1" + (minor-version) ==> "6" + (micro-version) ==> "0" + + effective-version + +- Scheme Procedure: effective-version + Return a string describing Guile's effective version number. + + (version) ==> "1.6.0" + (effective-version) ==> "1.6" + (major-version) ==> "1" + (minor-version) ==> "6" + (micro-version) ==> "0" + + make-soft-port + +- Scheme Procedure: make-soft-port pv modes + Return a port capable of receiving or delivering characters as + specified by the MODES string (see open-file). PV must be a vector + of length 5 or 6. Its components are as follows: + + -48. procedure accepting one character for output + + -47. procedure accepting a string for output + + -46. thunk for flushing output + + -45. thunk for getting one character + + -44. thunk for closing port (not by garbage collection) + + -43. (if present and not `#f') thunk for computing the number of + characters that can be read from the port without blocking. + + For an output-only port only elements 0, 1, 2, and 4 need be + procedures. For an input-only port only elements 3 and 4 need be + procedures. Thunks 2 and 4 can instead be `#f' if there is no + useful operation for them to perform. + + If thunk 3 returns `#f' or an `eof-object' (see eof-object? in + manual The Revised^5 Report on Scheme) it indicates that the port + has reached end-of-file. For example: + + (define stdout (current-output-port)) + (define p (make-soft-port + (vector + (lambda (c) (write c stdout)) + (lambda (s) (display s stdout)) + (lambda () (display "." stdout)) + (lambda () (char-upcase (read-char))) + (lambda () (display "@" stdout))) + "rw")) + + (write p p) ==> # + + make-weak-key-hash-table + +- Scheme Procedure: make-weak-key-hash-table [n] + + + + + Return a weak hash table with SIZE buckets. + + You can modify weak hash tables in exactly the same way you would + modify regular hash tables. (see Hash Tables) + + make-weak-value-hash-table + +- Scheme Procedure: make-weak-value-hash-table [n] + Return a hash table with weak values with SIZE buckets. (see Hash + Tables) + + make-doubly-weak-hash-table + +- Scheme Procedure: make-doubly-weak-hash-table [n] + Return a hash table with weak keys and values with SIZE buckets. + (see Hash Tables) + + weak-key-hash-table? + +- Scheme Procedure: weak-key-hash-table? obj + + + + + Return `#t' if OBJ is the specified weak hash table. Note that a + doubly weak hash table is neither a weak key nor a weak value hash + table. + + weak-value-hash-table? + +- Scheme Procedure: weak-value-hash-table? obj + Return `#t' if OBJ is a weak value hash table. + + doubly-weak-hash-table? + +- Scheme Procedure: doubly-weak-hash-table? obj + Return `#t' if OBJ is a doubly weak hash table. + + make-weak-vector + +- Scheme Procedure: make-weak-vector size [fill] + Return a weak vector with SIZE elements. If the optional argument + FILL is given, all entries in the vector will be set to FILL. The + default value for FILL is the empty list. + + list->weak-vector + +- Scheme Procedure: list->weak-vector + implemented by the C function "scm_weak_vector" + + weak-vector + +- Scheme Procedure: weak-vector . lst + + + Construct a weak vector from a list: `weak-vector' uses the list of + its arguments while `list->weak-vector' uses its only argument L (a + list) to construct a weak vector the same way `list->vector' would. + + weak-vector? + +- Scheme Procedure: weak-vector? obj + Return `#t' if OBJ is a weak vector. Note that all weak hashes are + also weak vectors. + + weak-vector-length + +- Scheme Procedure: weak-vector-length wvect + Like `vector-length', but for weak vectors. + + weak-vector-ref + +- Scheme Procedure: weak-vector-ref wvect k + Like `vector-ref', but for weak vectors. + + weak-vector-set! + +- Scheme Procedure: weak-vector-set! wvect k obj + Like `vector-set!', but for weak vectors. + + dynamic-link + +- Scheme Procedure: dynamic-link [filename] + Find the shared object (shared library) denoted by FILENAME and + link it into the running Guile application. The returned scheme + object is a ``handle'' for the library which can be passed to + `dynamic-func', `dynamic-call' etc. + + Searching for object files is system dependent. Normally, if + FILENAME does have an explicit directory it will be searched for in + locations such as `/usr/lib' and `/usr/local/lib'. + + When FILENAME is omitted, a "global symbol handle" is returned. + This handle provides access to the symbols available to the program + at run-time, including those exported by the program itself and the + shared libraries already loaded. + + dynamic-object? + +- Scheme Procedure: dynamic-object? obj + Return `#t' if OBJ is a dynamic object handle, or `#f' otherwise. + + dynamic-unlink + +- Scheme Procedure: dynamic-unlink dobj + Unlink a dynamic object from the application, if possible. The + object must have been linked by `dynamic-link', with DOBJ the + corresponding handle. After this procedure is called, the handle + can no longer be used to access the object. + + dynamic-pointer + +- Scheme Procedure: dynamic-pointer name dobj + Return a ``wrapped pointer'' to the symbol NAME in the shared + object referred to by DOBJ. The returned pointer points to a C + object. + + Regardless whether your C compiler prepends an underscore `_' to + the global names in a program, you should *not* include this + underscore in NAME since it will be added automatically when + necessary. + + dynamic-func + +- Scheme Procedure: dynamic-func name dobj + Return a ``handle'' for the function NAME in the shared object + referred to by DOBJ. The handle can be passed to `dynamic-call' to + actually call the function. + + Regardless whether your C compiler prepends an underscore `_' to + the global names in a program, you should *not* include this + underscore in NAME since it will be added automatically when + necessary. + + dynamic-call + +- Scheme Procedure: dynamic-call func dobj + Call a C function in a dynamic object. Two styles of invocation + are supported: + + * FUNC can be a function handle returned by `dynamic-func'. In + this case DOBJ is ignored + + * FUNC can be a string with the name of the function to call, + with DOBJ the handle of the dynamic object in which to find + the function. This is equivalent to + + + (dynamic-call (dynamic-func FUNC DOBJ) #f) + + In either case, the function is passed no arguments and its return + value is ignored. + + pipe + +- Scheme Procedure: pipe + Return a newly created pipe: a pair of ports which are linked + together on the local machine. The _car_ is the input port and the + _cdr_ is the output port. Data written (and flushed) to the output + port can be read from the input port. Pipes are commonly used for + communication with a newly forked child process. The need to flush + the output port can be avoided by making it unbuffered using + `setvbuf'. + + Writes occur atomically provided the size of the data in bytes is + not greater than the value of `PIPE_BUF'. Note that the output + port is likely to block if too much data (typically equal to + `PIPE_BUF') has been written but not yet read from the input port. + + kill + +- Scheme Procedure: kill pid sig + Sends a signal to the specified process or group of processes. + + PID specifies the processes to which the signal is sent: + + PID greater than 0 + The process whose identifier is PID. + + PID equal to 0 + All processes in the current process group. + + PID less than -1 + The process group whose identifier is -PID + + PID equal to -1 + If the process is privileged, all processes except for some + special system processes. Otherwise, all processes with the + current effective user ID. + + SIG should be specified using a variable corresponding to the Unix + symbolic name, e.g., + + - Variable: SIGHUP + Hang-up signal. + + - Variable: SIGINT + Interrupt signal. + + waitpid + +- Scheme Procedure: waitpid pid [options] + This procedure collects status information from a child process + which has terminated or (optionally) stopped. Normally it will + suspend the calling process until this can be done. If more than + one child process is eligible then one will be chosen by the + operating system. + + The value of PID determines the behaviour: + + PID greater than 0 + Request status information from the specified child process. + + PID equal to -1 or WAIT_ANY + Request status information for any child process. + + PID equal to 0 or WAIT_MYPGRP + Request status information for any child process in the + current process group. + + PID less than -1 + Request status information for any child process whose process + group ID is -PID. + + The OPTIONS argument, if supplied, should be the bitwise OR of the + values of zero or more of the following variables: + + - Variable: WNOHANG + Return immediately even if there are no child processes to be + collected. + + - Variable: WUNTRACED + Report status information for stopped processes as well as + terminated processes. + + The return value is a pair containing: + + 1. The process ID of the child process, or 0 if `WNOHANG' was + specified and no process was collected. + + 2. The integer status value. + + status:exit-val + +- Scheme Procedure: status:exit-val status + Return the exit status value, as would be set if a process ended + normally through a call to `exit' or `_exit', if any, otherwise + `#f'. + + status:term-sig + +- Scheme Procedure: status:term-sig status + Return the signal number which terminated the process, if any, + otherwise `#f'. + + status:stop-sig + +- Scheme Procedure: status:stop-sig status + Return the signal number which stopped the process, if any, + otherwise `#f'. + + execl + +- Scheme Procedure: execl filename . args + Executes the file named by FILENAME as a new process image. The + remaining arguments are supplied to the process; from a C program + they are accessible as the `argv' argument to `main'. + Conventionally the first ARG is the same as FILENAME. All + arguments must be strings. + + If ARG is missing, PATH is executed with a null argument list, + which may have system-dependent side-effects. + + This procedure is currently implemented using the `execv' system + call, but we call it `execl' because of its Scheme calling + interface. + + execlp + +- Scheme Procedure: execlp filename . args + Similar to `execl', however if FILENAME does not contain a slash + then the file to execute will be located by searching the + directories listed in the `PATH' environment variable. + + This procedure is currently implemented using the `execvp' system + call, but we call it `execlp' because of its Scheme calling + interface. + + execle + +- Scheme Procedure: execle filename env . args + Similar to `execl', but the environment of the new process is + specified by ENV, which must be a list of strings as returned by + the `environ' procedure. + + This procedure is currently implemented using the `execve' system + call, but we call it `execle' because of its Scheme calling + interface. + + system* + +- Scheme Procedure: system* . args + Execute the command indicated by ARGS. The first element must be a + string indicating the command to be executed, and the remaining + items must be strings representing each of the arguments to that + command. + + This function returns the exit status of the command as provided by + `waitpid'. This value can be handled with `status:exit-val' and + the related functions. + + `system*' is similar to `system', but accepts only one string + per-argument, and performs no shell interpretation. The command is + executed using fork and execlp. Accordingly this function may be + safer than `system' in situations where shell interpretation is not + required. + + Example: (system* "echo" "foo" "bar") + + uname + +- Scheme Procedure: uname + Return an object with some information about the computer system + the program is running on. + + environ + +- Scheme Procedure: environ [env] + If ENV is omitted, return the current environment (in the Unix + sense) as a list of strings. Otherwise set the current + environment, which is also the default environment for child + processes, to the supplied list of strings. Each member of ENV + should be of the form `NAME=VALUE' and values of `NAME' should not + be duplicated. If ENV is supplied then the return value is + unspecified. + + tmpnam + +- Scheme Procedure: tmpnam + Return a name in the file system that does not match any existing + file. However there is no guarantee that another process will not + create the file after `tmpnam' is called. Care should be taken if + opening the file, e.g., use the `O_EXCL' open flag or use + `mkstemp!' instead. + + tmpfile + +- Scheme Procedure: tmpfile + Return an input/output port to a unique temporary file named using + the path prefix `P_tmpdir' defined in `stdio.h'. The file is + automatically deleted when the port is closed or the program + terminates. + + utime + +- Scheme Procedure: utime pathname [actime [modtime [actimens [modtimens +[flags]]]]] + `utime' sets the access and modification times for the file named + by PATHNAME. If ACTIME or MODTIME is not supplied, then the + current time is used. ACTIME and MODTIME must be integer time + values as returned by the `current-time' procedure. + + The optional ACTIMENS and MODTIMENS are nanoseconds to add ACTIME + and MODTIME. Nanosecond precision is only supported on some + combinations of file systems and operating systems. + + (utime "foo" (- (current-time) 3600)) + + will set the access time to one hour in the past and the + modification time to the current time. + + Last, FLAGS may be either `0' or the `AT_SYMLINK_NOFOLLOW' + constant, to set the time of PATHNAME even if it is a symbolic + link. + + getpid + +- Scheme Procedure: getpid + Return an integer representing the current process ID. + + putenv + +- Scheme Procedure: putenv str + Modifies the environment of the current process, which is also the + default environment inherited by child processes. If STR is of the + form `NAME=VALUE' then it will be written directly into the + environment, replacing any existing environment string with name + matching `NAME'. If STR does not contain an equal sign, then any + existing string with name matching STR will be removed. + + The return value is unspecified. + + setlocale + +- Scheme Procedure: setlocale category [locale] + If LOCALE is omitted, return the current value of the specified + locale category as a system-dependent string. CATEGORY should be + specified using the values `LC_COLLATE', `LC_ALL' etc. + + Otherwise the specified locale category is set to the string LOCALE + and the new value is returned as a system-dependent string. If + LOCALE is an empty string, the locale will be set using environment + variables. + + When the locale is changed, the character encoding of the new + locale (UTF-8, ISO-8859-1, etc.) is used for the current input, + output, and error ports + + getlogin + +- Scheme Procedure: getlogin + Return a string containing the name of the user logged in on the + controlling terminal of the process, or `#f' if this information + cannot be obtained. + + getpriority + +- Scheme Procedure: getpriority which who + Return the scheduling priority of the process, process group or + user, as indicated by WHICH and WHO. WHICH is one of the variables + `PRIO_PROCESS', `PRIO_PGRP' or `PRIO_USER', and WHO is interpreted + relative to WHICH (a process identifier for `PRIO_PROCESS', process + group identifier for `PRIO_PGRP', and a user identifier for + `PRIO_USER'. A zero value of WHO denotes the current process, + process group, or user. Return the highest priority (lowest + numerical value) of any of the specified processes. + + setpriority + +- Scheme Procedure: setpriority which who prio + Set the scheduling priority of the process, process group or user, + as indicated by WHICH and WHO. WHICH is one of the variables + `PRIO_PROCESS', `PRIO_PGRP' or `PRIO_USER', and WHO is interpreted + relative to WHICH (a process identifier for `PRIO_PROCESS', process + group identifier for `PRIO_PGRP', and a user identifier for + `PRIO_USER'. A zero value of WHO denotes the current process, + process group, or user. PRIO is a value in the range -20 and 20, + the default priority is 0; lower priorities cause more favorable + scheduling. Sets the priority of all of the specified processes. + Only the super-user may lower priorities. The return value is not + specified. + + getaffinity + +- Scheme Procedure: getaffinity pid + Return a bitvector representing the CPU affinity mask for process + PID. Each CPU the process has affinity with has its corresponding + bit set in the returned bitvector. The number of bits set is a + good estimate of how many CPUs Guile can use without stepping on + other processes' toes. + + setaffinity + +- Scheme Procedure: setaffinity pid mask + Install the CPU affinity mask MASK, a bitvector, for the process or + thread with ID PID. The return value is unspecified. + + flock + +- Scheme Procedure: flock file operation + Apply or remove an advisory lock on an open file. OPERATION + specifies the action to be done: + + - Variable: LOCK_SH + Shared lock. More than one process may hold a shared lock for + a given file at a given time. + + - Variable: LOCK_EX + Exclusive lock. Only one process may hold an exclusive lock + for a given file at a given time. + + - Variable: LOCK_UN + Unlock the file. + + - Variable: LOCK_NB + Don't block when locking. This is combined with one of the + other operations using `logior'. If `flock' would block an + `EWOULDBLOCK' error is thrown. + + The return value is not specified. FILE may be an open file + descriptor or an open file descriptor port. + + Note that `flock' does not lock files across NFS. + + gethostname + +- Scheme Procedure: gethostname + Return the host name of the current processor. + + regexp? + +- Scheme Procedure: regexp? obj + Return `#t' if OBJ is a compiled regular expression, or `#f' + otherwise. + + make-regexp + +- Scheme Procedure: make-regexp pat . flags + Compile the regular expression described by PAT, and return the + compiled regexp structure. If PAT does not describe a legal + regular expression, `make-regexp' throws a + `regular-expression-syntax' error. + + The FLAGS arguments change the behavior of the compiled regular + expression. The following flags may be supplied: + + regexp/icase + Consider uppercase and lowercase letters to be the same when + matching. + + regexp/newline + If a newline appears in the target string, then permit the `^' + and `$' operators to match immediately after or immediately + before the newline, respectively. Also, the `.' and `[^...]' + operators will never match a newline character. The intent of + this flag is to treat the target string as a buffer containing + many lines of text, and the regular expression as a pattern + that may match a single one of those lines. + + regexp/basic + Compile a basic (``obsolete'') regexp instead of the extended + (``modern'') regexps that are the default. Basic regexps do + not consider `|', `+' or `?' to be special characters, and + require the `{...}' and `(...)' metacharacters to be + backslash-escaped (see Backslash Escapes). There are several + other differences between basic and extended regular + expressions, but these are the most significant. + + regexp/extended + Compile an extended regular expression rather than a basic + regexp. This is the default behavior; this flag will not + usually be needed. If a call to `make-regexp' includes both + `regexp/basic' and `regexp/extended' flags, the one which + comes last will override the earlier one. + + regexp-exec + +- Scheme Procedure: regexp-exec rx str [start [flags]] + Match the compiled regular expression RX against `str'. If the + optional integer START argument is provided, begin matching from + that position in the string. Return a match structure describing + the results of the match, or `#f' if no match could be found. + + The FLAGS arguments change the matching behavior. The following + flags may be supplied: + + regexp/notbol + Operator `^' always fails (unless `regexp/newline' is used). + Use this when the beginning of the string should not be + considered the beginning of a line. + + regexp/noteol + Operator `$' always fails (unless `regexp/newline' is used). + Use this when the end of the string should not be considered + the end of a line. + diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/and-let-star.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/and-let-star.scm new file mode 100644 index 0000000000000000000000000000000000000000..2d53ff384669d48dde865c3023a8173368f41b6b --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/and-let-star.scm @@ -0,0 +1,73 @@ +;;;; and-let-star.scm --- and-let* syntactic form (SRFI-2) for Guile +;;;; +;;;; Copyright (C) 1999, 2001, 2004, 2006, 2013, +;;;; 2015 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (ice-9 and-let-star) + :export-syntax (and-let*)) + +(define-syntax %and-let* + (lambda (form) + (syntax-case form () + + ;; Handle zero-clauses special-case. + ((_ orig-form () . body) + #'(begin #t . body)) + + ;; Reduce clauses down to one regardless of body. + ((_ orig-form ((var expr) rest . rest*) . body) + (identifier? #'var) + #'(let ((var expr)) + (and var (%and-let* orig-form (rest . rest*) . body)))) + ((_ orig-form ((expr) rest . rest*) . body) + #'(and expr (%and-let* orig-form (rest . rest*) . body))) + ((_ orig-form (var rest . rest*) . body) + (identifier? #'var) + #'(and var (%and-let* orig-form (rest . rest*) . body))) + + ;; Handle 1-clause cases without a body. + ((_ orig-form ((var expr))) + (identifier? #'var) + #'expr) + ((_ orig-form ((expr))) + #'expr) + ((_ orig-form (var)) + (identifier? #'var) + #'var) + + ;; Handle 1-clause cases with a body. + ((_ orig-form ((var expr)) . body) + (identifier? #'var) + #'(let ((var expr)) + (and var (begin . body)))) + ((_ orig-form ((expr)) . body) + #'(and expr (begin . body))) + ((_ orig-form (var) . body) + (identifier? #'var) + #'(and var (begin . body))) + + ;; Handle bad clauses. + ((_ orig-form (bad-clause . rest) . body) + (syntax-violation 'and-let* "Bad clause" #'orig-form #'bad-clause))))) + +(define-syntax and-let* + (lambda (form) + (syntax-case form () + ((_ (c ...) body ...) + #`(%and-let* #,form (c ...) body ...))))) + +(cond-expand-provide (current-module) '(srfi-2)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/arrays.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/arrays.scm new file mode 100644 index 0000000000000000000000000000000000000000..f03eb351b8a19b2a85ee442a27ba2f6acd0c80fe --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/arrays.scm @@ -0,0 +1,70 @@ +;;; -*- mode: scheme; coding: utf-8; -*- +;;; +;;; Copyright (C) 1999, 2001, 2004, 2006, 2017 Free Software Foundation, Inc. +;;; +;;; This library is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU Lesser General Public +;;; License as published by the Free Software Foundation; either +;;; version 3 of the License, or (at your option) any later version. +;;; +;;; This library is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this library; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (ice-9 arrays) + #:use-module (rnrs io ports) + #:use-module (srfi srfi-1) + #:export (array-copy)) + +;; This is actually defined in boot-9.scm, apparently for backwards +;; compatibility. + +;; (define (array-shape a) +;; (map (lambda (ind) (if (number? ind) (list 0 (+ -1 ind)) ind)) +;; (array-dimensions a))) + +; FIXME writes over the array twice if (array-type) is #t +(define (array-copy a) + (let ((b (apply make-typed-array (array-type a) *unspecified* (array-shape a)))) + (array-copy! a b) + b)) + + +;; Printing arrays + +;; The dimensions aren't printed out unless they cannot be deduced from +;; the content, which happens only when certain axes are empty. #:dims? +;; can be used to force this printing. An array with all the dimensions +;; printed out is still readable syntax, this can be useful for +;; truncated-print. + +(define* (array-print-prefix a port #:key dims?) + (put-char port #\#) + (display (array-rank a) port) + (let ((t (array-type a))) + (unless (eq? #t t) + (display t port))) + (let ((ss (array-shape a))) + (let loop ((s ss) (slos? #f) (szero? #f) (slens? dims?)) + (define lo caar) + (define hi cadar) + (if (null? s) + (when (or slos? slens?) + (pair-for-each (lambda (s) + (when slos? + (put-char port #\@) + (display (lo s) port)) + (when slens? + (put-char port #\:) + (display (- (hi s) (lo s) -1) port))) + ss)) + (let ((zero-size? (zero? (- (hi s) (lo s) -1)))) + (loop (cdr s) + (or slos? (not (zero? (lo s)))) + (or szero? zero-size?) + (or slens? (and (not zero-size?) szero?)))))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/atomic.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/atomic.scm new file mode 100644 index 0000000000000000000000000000000000000000..2a8af901d4a21dcb460634d1f33ee664847ad748 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/atomic.scm @@ -0,0 +1,38 @@ +;; Atomic operations + +;;;; Copyright (C) 2016 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 atomic) + #:use-module ((language tree-il primitives) + :select (add-interesting-primitive!)) + #:export (make-atomic-box + atomic-box? + atomic-box-ref + atomic-box-set! + atomic-box-swap! + atomic-box-compare-and-swap!)) + +(eval-when (expand load eval) + (load-extension (string-append "libguile-" (effective-version)) + "scm_init_atomic") + (add-interesting-primitive! 'make-atomic-box) + (add-interesting-primitive! 'atomic-box?) + (add-interesting-primitive! 'atomic-box-ref) + (add-interesting-primitive! 'atomic-box-set!) + (add-interesting-primitive! 'atomic-box-swap!) + (add-interesting-primitive! 'atomic-box-compare-and-swap!)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/binary-ports.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/binary-ports.scm new file mode 100644 index 0000000000000000000000000000000000000000..62fd9786f7b650213de37287b1b079a22dc154b8 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/binary-ports.scm @@ -0,0 +1,53 @@ +;;;; binary-ports.scm --- Binary IO on ports + +;;;; Copyright (C) 2009, 2010, 2011, 2013 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Author: Ludovic Courtès + +;;; Commentary: +;;; +;;; The I/O port API of the R6RS is provided by this module. In many areas +;;; it complements or refines Guile's own historical port API. For instance, +;;; it allows for binary I/O with bytevectors. +;;; +;;; Code: + +(define-module (ice-9 binary-ports) + #:use-module (rnrs bytevectors) + #:export (eof-object + open-bytevector-input-port + make-custom-binary-input-port + get-u8 + lookahead-u8 + get-bytevector-n + get-bytevector-n! + get-bytevector-some + get-bytevector-some! ; Guile extension, not in R6RS + get-bytevector-all + get-string-n! + put-u8 + put-bytevector + unget-bytevector + open-bytevector-output-port + make-custom-binary-output-port + make-custom-binary-input/output-port)) + +;; Note that this extension also defines %make-transcoded-port, which is +;; not exported but is used by (rnrs io ports). + +(load-extension (string-append "libguile-" (effective-version)) + "scm_init_r6rs_ports") diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/boot-9.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/boot-9.scm new file mode 100644 index 0000000000000000000000000000000000000000..c1891e70a17aa69976f168f550e30d0a8445fe72 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/boot-9.scm @@ -0,0 +1,4131 @@ +;;; -*- mode: scheme; coding: utf-8; -*- + +;;;; Copyright (C) 1995-2014, 2016-2018 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + + + +;;; Commentary: + +;;; This file is the first thing loaded into Guile. It adds many mundane +;;; definitions and a few that are interesting. +;;; +;;; The module system (hence the hierarchical namespace) are defined in this +;;; file. +;;; + +;;; Code: + + + +;; Before compiling, make sure any symbols are resolved in the (guile) +;; module, the primary location of those symbols, rather than in +;; (guile-user), the default module that we compile in. + +(eval-when (compile) + (set-current-module (resolve-module '(guile)))) + +;; Prevent this file being loaded more than once in a session. Just +;; doesn't make sense! +(if (current-module) + (error "re-loading ice-9/boot-9.scm not allowed")) + + + +;;; {Language primitives} +;;; + +;; These are are the procedural wrappers around the primitives of +;; Guile's language: apply, call-with-current-continuation, etc. +;; +;; Usually, a call to a primitive is compiled specially. The compiler +;; knows about all these kinds of expressions. But the primitives may +;; be referenced not only as operators, but as values as well. These +;; stub procedures are the "values" of apply, dynamic-wind, and other +;; such primitives. +;; +(define apply + (case-lambda + ((fun args) + ((@@ primitive apply) fun args)) + ((fun arg1 . args) + (letrec ((append* (lambda (tail) + (let ((tail (car tail)) + (tail* (cdr tail))) + (if (null? tail*) + tail + (cons tail (append* tail*))))))) + (apply fun (cons arg1 (append* args))))))) +(define (call-with-current-continuation proc) + ((@@ primitive call-with-current-continuation) proc)) +(define (call-with-values producer consumer) + ((@@ primitive call-with-values) producer consumer)) +(define (dynamic-wind in thunk out) + "All three arguments must be 0-argument procedures. +Guard @var{in} is called, then @var{thunk}, then +guard @var{out}. + +If, any time during the execution of @var{thunk}, the +continuation of the @code{dynamic_wind} expression is escaped +non-locally, @var{out} is called. If the continuation of +the dynamic-wind is re-entered, @var{in} is called. Thus +@var{in} and @var{out} may be called any number of +times. +@lisp + (define x 'normal-binding) +@result{} x + (define a-cont + (call-with-current-continuation + (lambda (escape) + (let ((old-x x)) + (dynamic-wind + ;; in-guard: + ;; + (lambda () (set! x 'special-binding)) + + ;; thunk + ;; + (lambda () (display x) (newline) + (call-with-current-continuation escape) + (display x) (newline) + x) + + ;; out-guard: + ;; + (lambda () (set! x old-x))))))) + +;; Prints: +special-binding +;; Evaluates to: +@result{} a-cont +x +@result{} normal-binding + (a-cont #f) +;; Prints: +special-binding +;; Evaluates to: +@result{} a-cont ;; the value of the (define a-cont...) +x +@result{} normal-binding +a-cont +@result{} special-binding +@end lisp" + ;; FIXME: Here we don't check that the out procedure is a thunk before + ;; calling the in-guard, as dynamic-wind is called as part of loading + ;; modules, but thunk? requires loading (system vm debug). This is in + ;; contrast to the open-coded version of dynamic-wind, which does + ;; currently insert an eager thunk? check (but often optimizes it + ;; out). Not sure what the right thing to do is here -- make thunk? + ;; callable before modules are loaded, live with this inconsistency, + ;; or remove the thunk? check from the compiler? Questions, + ;; questions. + #; + (unless (thunk? out) + (scm-error 'wrong-type-arg "dynamic-wind" "Not a thunk: ~S" + (list out) #f)) + (in) + ((@@ primitive wind) in out) + (call-with-values thunk + (lambda vals + ((@@ primitive unwind)) + (out) + (apply values vals)))) + +(define (with-fluid* fluid val thunk) + "Set @var{fluid} to @var{value} temporarily, and call @var{thunk}. +@var{thunk} must be a procedure of no arguments." + ((@@ primitive push-fluid) fluid val) + (call-with-values thunk + (lambda vals + ((@@ primitive pop-fluid)) + (apply values vals)))) + +(define (with-dynamic-state state thunk) + "Call @var{proc} while @var{state} is the current dynamic state object. +@var{thunk} must be a procedure of no arguments." + ((@@ primitive push-dynamic-state) state) + (call-with-values thunk + (lambda vals + ((@@ primitive pop-dynamic-state)) + (apply values vals)))) + + + +;;; {Simple Debugging Tools} +;;; + +(define (peek . stuff) + "Write arguments to the current output port, and return the last argument. + +This is handy for tracing function calls, e.g.: + +(+ 10 (troublesome-fn)) +=> (+ 10 (pk 'troublesome-fn-returned (troublesome-fn)))" + (newline) + (display ";;; ") + (write stuff) + (newline) + (car (last-pair stuff))) + +(define pk peek) + +(define (warn . stuff) + (newline (current-warning-port)) + (display ";;; WARNING " (current-warning-port)) + (display stuff (current-warning-port)) + (newline (current-warning-port)) + (car (last-pair stuff))) + + + +;;; {Features} +;;; + +(define (provide sym) + (if (not (memq sym *features*)) + (set! *features* (cons sym *features*)))) + +;; In SLIB, provided? also checks to see if the module is available. We +;; should do that too, but don't. + +(define (provided? feature) + "Return #t iff FEATURE is available to this Guile interpreter." + (and (memq feature *features*) #t)) + + + +;;; {map and for-each} +;;; + +(define map + (case-lambda + ((f l) + (if (not (list? l)) + (scm-error 'wrong-type-arg "map" "Not a list: ~S" + (list l) #f)) + (let map1 ((l l)) + (if (pair? l) + (cons (f (car l)) (map1 (cdr l))) + '()))) + + ((f l1 l2) + (if (not (= (length l1) (length l2))) + (scm-error 'wrong-type-arg "map" "List of wrong length: ~S" + (list l2) #f)) + + (let map2 ((l1 l1) (l2 l2)) + (if (pair? l1) + (cons (f (car l1) (car l2)) + (map2 (cdr l1) (cdr l2))) + '()))) + + ((f l1 . rest) + (let ((len (length l1))) + (let mapn ((rest rest)) + (or (null? rest) + (if (= (length (car rest)) len) + (mapn (cdr rest)) + (scm-error 'wrong-type-arg "map" "List of wrong length: ~S" + (list (car rest)) #f))))) + (let mapn ((l1 l1) (rest rest)) + (if (pair? l1) + (cons (apply f (car l1) (map car rest)) + (mapn (cdr l1) (map cdr rest))) + '()))))) + +(define map-in-order map) + +(define for-each + (case-lambda + ((f l) + (if (not (list? l)) + (scm-error 'wrong-type-arg "for-each" "Not a list: ~S" (list l) #f)) + (let for-each1 ((l l)) + (if (not (null? l)) + (begin + (f (car l)) + (for-each1 (cdr l)))))) + + ((f l1 l2) + (if (not (= (length l1) (length l2))) + (scm-error 'wrong-type-arg "for-each" "List of wrong length: ~S" + (list l2) #f)) + (let for-each2 ((l1 l1) (l2 l2)) + (if (not (null? l1)) + (begin + (f (car l1) (car l2)) + (for-each2 (cdr l1) (cdr l2)))))) + + ((f l1 . rest) + (let ((len (length l1))) + (let for-eachn ((rest rest)) + (or (null? rest) + (if (= (length (car rest)) len) + (for-eachn (cdr rest)) + (scm-error 'wrong-type-arg "for-each" "List of wrong length: ~S" + (list (car rest)) #f))))) + + (let for-eachn ((l1 l1) (rest rest)) + (if (pair? l1) + (begin + (apply f (car l1) (map car rest)) + (for-eachn (cdr l1) (map cdr rest)))))))) + + +;; Temporary definitions used by `include'; replaced later. + +(define (absolute-file-name? file-name) #t) +(define (open-input-file str) (open-file str "r")) + +;; Temporary definition; replaced by a parameter later. +(define (allow-legacy-syntax-objects?) #f) + +;;; {and-map and or-map} +;;; +;;; (and-map fn lst) is like (and (fn (car lst)) (fn (cadr lst)) (fn...) ...) +;;; (or-map fn lst) is like (or (fn (car lst)) (fn (cadr lst)) (fn...) ...) +;;; + +(define (and-map f lst) + "Apply F to successive elements of LST until exhaustion or F returns #f. +If returning early, return #f. Otherwise, return the last value returned +by F. If F has never been called because LST is empty, return #t." + (let loop ((result #t) + (l lst)) + (and result + (or (and (null? l) + result) + (loop (f (car l)) (cdr l)))))) + +(define (or-map f lst) + "Apply F to successive elements of LST until exhaustion or while F returns #f. +If returning early, return the return value of F." + (let loop ((result #f) + (l lst)) + (or result + (and (not (null? l)) + (loop (f (car l)) (cdr l)))))) + + + +;; let format alias simple-format until the more complete version is loaded + +(define format simple-format) + +;; this is scheme wrapping the C code so the final pred call is a tail call, +;; per SRFI-13 spec +(define string-any + (lambda* (char_pred s #:optional (start 0) (end (string-length s))) + (if (and (procedure? char_pred) + (> end start) + (<= end (string-length s))) ;; let c-code handle range error + (or (string-any-c-code char_pred s start (1- end)) + (char_pred (string-ref s (1- end)))) + (string-any-c-code char_pred s start end)))) + +;; this is scheme wrapping the C code so the final pred call is a tail call, +;; per SRFI-13 spec +(define string-every + (lambda* (char_pred s #:optional (start 0) (end (string-length s))) + (if (and (procedure? char_pred) + (> end start) + (<= end (string-length s))) ;; let c-code handle range error + (and (string-every-c-code char_pred s start (1- end)) + (char_pred (string-ref s (1- end)))) + (string-every-c-code char_pred s start end)))) + +(define (substring-fill! str start end fill) + "A variant of string-fill! that we keep for compatibility." + (string-fill! str fill start end)) + + + +;; Define a minimal stub of the module API for psyntax, before modules +;; have booted. +(define (module-name x) + '(guile)) +(define (module-add! module sym var) + (hashq-set! (%get-pre-modules-obarray) sym var)) +(define (module-define! module sym val) + (let ((v (hashq-ref (%get-pre-modules-obarray) sym))) + (if v + (variable-set! v val) + (module-add! (current-module) sym (make-variable val))))) +(define (module-ref module sym) + (let ((v (module-variable module sym))) + (if v (variable-ref v) (error "badness!" (pk module) (pk sym))))) +(define module-generate-unique-id! + (let ((next-id 0)) + (lambda (m) + (let ((i next-id)) + (set! next-id (+ i 1)) + i)))) +(define module-gensym gensym) +(define (resolve-module . args) + #f) + +;; API provided by psyntax +(define syntax-violation #f) +(define datum->syntax #f) +(define syntax->datum #f) +(define syntax-source #f) +(define identifier? #f) +(define generate-temporaries #f) +(define bound-identifier=? #f) +(define free-identifier=? #f) + +;; $sc-dispatch is an implementation detail of psyntax. It is used by +;; expanded macros, to dispatch an input against a set of patterns. +(define $sc-dispatch #f) + +;; Load it up! +(primitive-load-path "ice-9/psyntax-pp") +;; The binding for `macroexpand' has now been overridden, making psyntax the +;; expander now. + +(define-syntax and + (syntax-rules () + ((_) #t) + ((_ x) x) + ;; Avoid ellipsis, which would lead to quadratic expansion time. + ((_ x . y) (if x (and . y) #f)))) + +(define-syntax or + (syntax-rules () + ((_) #f) + ((_ x) x) + ;; Avoid ellipsis, which would lead to quadratic expansion time. + ((_ x . y) (let ((t x)) (if t t (or . y)))))) + +(include-from-path "ice-9/quasisyntax") + +(define-syntax-rule (when test stmt stmt* ...) + (if test (begin stmt stmt* ...))) + +(define-syntax-rule (unless test stmt stmt* ...) + (if (not test) (begin stmt stmt* ...))) + +(define-syntax cond + (lambda (whole-expr) + (define (fold f seed xs) + (let loop ((xs xs) (seed seed)) + (if (null? xs) seed + (loop (cdr xs) (f (car xs) seed))))) + (define (reverse-map f xs) + (fold (lambda (x seed) (cons (f x) seed)) + '() xs)) + (syntax-case whole-expr () + ((_ clause clauses ...) + #`(begin + #,@(fold (lambda (clause-builder tail) + (clause-builder tail)) + #'() + (reverse-map + (lambda (clause) + (define* (bad-clause #:optional (msg "invalid clause")) + (syntax-violation 'cond msg whole-expr clause)) + (syntax-case clause (=> else) + ((else e e* ...) + (lambda (tail) + (if (null? tail) + #'((begin e e* ...)) + (bad-clause "else must be the last clause")))) + ((else . _) (bad-clause)) + ((test => receiver) + (lambda (tail) + #`((let ((t test)) + (if t + (receiver t) + #,@tail))))) + ((test => receiver ...) + (bad-clause "wrong number of receiver expressions")) + ((generator guard => receiver) + (lambda (tail) + #`((call-with-values (lambda () generator) + (lambda vals + (if (apply guard vals) + (apply receiver vals) + #,@tail)))))) + ((generator guard => receiver ...) + (bad-clause "wrong number of receiver expressions")) + ((test) + (lambda (tail) + #`((let ((t test)) + (if t t #,@tail))))) + ((test e e* ...) + (lambda (tail) + #`((if test + (begin e e* ...) + #,@tail)))) + (_ (bad-clause)))) + #'(clause clauses ...)))))))) + +(define-syntax case + (lambda (whole-expr) + (define (fold f seed xs) + (let loop ((xs xs) (seed seed)) + (if (null? xs) seed + (loop (cdr xs) (f (car xs) seed))))) + (define (fold2 f a b xs) + (let loop ((xs xs) (a a) (b b)) + (if (null? xs) (values a b) + (call-with-values + (lambda () (f (car xs) a b)) + (lambda (a b) + (loop (cdr xs) a b)))))) + (define (reverse-map-with-seed f seed xs) + (fold2 (lambda (x ys seed) + (call-with-values + (lambda () (f x seed)) + (lambda (y seed) + (values (cons y ys) seed)))) + '() seed xs)) + (syntax-case whole-expr () + ((_ expr clause clauses ...) + (with-syntax ((key #'key)) + #`(let ((key expr)) + #,@(fold + (lambda (clause-builder tail) + (clause-builder tail)) + #'() + (reverse-map-with-seed + (lambda (clause seen) + (define* (bad-clause #:optional (msg "invalid clause")) + (syntax-violation 'case msg whole-expr clause)) + (syntax-case clause () + ((test . rest) + (with-syntax + ((clause-expr + (syntax-case #'rest (=>) + ((=> receiver) #'(receiver key)) + ((=> receiver ...) + (bad-clause + "wrong number of receiver expressions")) + ((e e* ...) #'(begin e e* ...)) + (_ (bad-clause))))) + (syntax-case #'test (else) + ((datums ...) + (let ((seen + (fold + (lambda (datum seen) + (define (warn-datum type) + ((@ (system base message) + warning) + type + (append (source-properties datum) + (source-properties + (syntax->datum #'test))) + datum + (syntax->datum clause) + (syntax->datum whole-expr))) + (when (memv datum seen) + (warn-datum 'duplicate-case-datum)) + (when (or (pair? datum) (array? datum)) + (warn-datum 'bad-case-datum)) + (cons datum seen)) + seen + (map syntax->datum #'(datums ...))))) + (values (lambda (tail) + #`((if (memv key '(datums ...)) + clause-expr + #,@tail))) + seen))) + (else (values (lambda (tail) + (if (null? tail) + #'(clause-expr) + (bad-clause + "else must be the last clause"))) + seen)) + (_ (bad-clause))))) + (_ (bad-clause)))) + '() #'(clause clauses ...))))))))) + +(define-syntax do + (syntax-rules () + ((do ((var init step ...) ...) + (test expr ...) + command ...) + (letrec + ((loop + (lambda (var ...) + (if test + (begin + (if #f #f) + expr ...) + (begin + command + ... + (loop (do "step" var step ...) + ...)))))) + (loop init ...))) + ((do "step" x) + x) + ((do "step" x y) + y))) + +(define-syntax define-values + (lambda (orig-form) + (syntax-case orig-form () + ((_ () expr) + ;; XXX Work around the lack of hygienic top-level identifiers + (with-syntax (((dummy) (generate-temporaries '(dummy)))) + #`(define dummy + (call-with-values (lambda () expr) + (lambda () #f))))) + ((_ (var) expr) + (identifier? #'var) + #`(define var + (call-with-values (lambda () expr) + (lambda (v) v)))) + ((_ (var0 ... varn) expr) + (and-map identifier? #'(var0 ... varn)) + ;; XXX Work around the lack of hygienic toplevel identifiers + (with-syntax (((dummy) (generate-temporaries '(dummy)))) + #`(begin + ;; Avoid mutating the user-visible variables + (define dummy + (call-with-values (lambda () expr) + (lambda (var0 ... varn) + (list var0 ... varn)))) + (define var0 + (let ((v (car dummy))) + (set! dummy (cdr dummy)) + v)) + ... + (define varn + (let ((v (car dummy))) + (set! dummy #f) ; blackhole dummy + v))))) + ((_ var expr) + (identifier? #'var) + #'(define var + (call-with-values (lambda () expr) + list))) + ((_ (var0 ... . varn) expr) + (and-map identifier? #'(var0 ... varn)) + ;; XXX Work around the lack of hygienic toplevel identifiers + (with-syntax (((dummy) (generate-temporaries '(dummy)))) + #`(begin + ;; Avoid mutating the user-visible variables + (define dummy + (call-with-values (lambda () expr) + (lambda (var0 ... . varn) + (list var0 ... varn)))) + (define var0 + (let ((v (car dummy))) + (set! dummy (cdr dummy)) + v)) + ... + (define varn + (let ((v (car dummy))) + (set! dummy #f) ; blackhole dummy + v)))))))) + +(define-syntax-rule (delay exp) + (make-promise (lambda () exp))) + +(define-syntax with-fluids + (lambda (stx) + (define (emit-with-fluids bindings body) + (syntax-case bindings () + (() + body) + (((f v) . bindings) + #`(with-fluid* f v + (lambda () + #,(emit-with-fluids #'bindings body)))))) + (syntax-case stx () + ((_ ((fluid val) ...) exp exp* ...) + (with-syntax (((fluid-tmp ...) (generate-temporaries #'(fluid ...))) + ((val-tmp ...) (generate-temporaries #'(val ...)))) + #`(let ((fluid-tmp fluid) ...) + (let ((val-tmp val) ...) + #,(emit-with-fluids #'((fluid-tmp val-tmp) ...) + #'(begin exp exp* ...))))))))) + +(define-syntax current-source-location + (lambda (x) + (syntax-case x () + ((_) + (with-syntax ((s (datum->syntax x (syntax-source x)))) + #''s))))) + +;; We provide this accessor out of convenience. current-line and +;; current-column aren't so interesting, because they distort what they +;; are measuring; better to use syntax-source from a macro. +;; +(define-syntax current-filename + (lambda (x) + "A macro that expands to the current filename: the filename that +the (current-filename) form appears in. Expands to #f if this +information is unavailable." + (false-if-exception + (canonicalize-path (assq-ref (syntax-source x) 'filename))))) + +(define-syntax-rule (define-once sym val) + (define sym + (if (module-locally-bound? (current-module) 'sym) sym val))) + + + + +;;; {Error handling} +;;; + +;; Define delimited continuation operators, and implement catch and throw in +;; terms of them. + +(define make-prompt-tag + (lambda* (#:optional (stem "prompt")) + ;; The only property that prompt tags need have is uniqueness in the + ;; sense of eq?. A one-element list will serve nicely. + (list stem))) + +(define default-prompt-tag + ;; Redefined later to be a parameter. + (let ((%default-prompt-tag (make-prompt-tag))) + (lambda () + %default-prompt-tag))) + +(define (call-with-prompt tag thunk handler) + ((@@ primitive call-with-prompt) tag thunk handler)) +(define (abort-to-prompt tag . args) + (abort-to-prompt* tag args)) + +;; Define catch and with-throw-handler, using some common helper routines and a +;; shared fluid. Hide the helpers in a lexical contour. + +(define with-throw-handler #f) +(let ((%eh (module-ref (current-module) '%exception-handler))) + (define (make-exception-handler catch-key prompt-tag pre-unwind) + (vector catch-key prompt-tag pre-unwind)) + (define (exception-handler-catch-key handler) (vector-ref handler 0)) + (define (exception-handler-prompt-tag handler) (vector-ref handler 1)) + (define (exception-handler-pre-unwind handler) (vector-ref handler 2)) + + (define %running-pre-unwind (make-fluid #f)) + (define (pre-unwind-handler-running? handler) + (let lp ((depth 0)) + (let ((running (fluid-ref* %running-pre-unwind depth))) + (and running + (or (eq? running handler) (lp (1+ depth))))))) + + (define (dispatch-exception depth key args) + (cond + ((fluid-ref* %eh depth) + => (lambda (handler) + (let ((catch-key (exception-handler-catch-key handler))) + (if (or (eqv? catch-key #t) (eq? catch-key key)) + (let ((prompt-tag (exception-handler-prompt-tag handler)) + (pre-unwind (exception-handler-pre-unwind handler))) + (cond + ((and pre-unwind + (not (pre-unwind-handler-running? handler))) + ;; Prevent errors from within the pre-unwind + ;; handler's invocation from being handled by this + ;; handler. + (with-fluid* %running-pre-unwind handler + (lambda () + ;; FIXME: Currently the "running" flag only + ;; applies to the pre-unwind handler; the + ;; post-unwind handler is still called if the + ;; error is explicitly rethrown. Instead it + ;; would be better to cause a recursive throw to + ;; skip all parts of this handler. Unfortunately + ;; that is incompatible with existing semantics. + ;; We'll see if we can change that later on. + (apply pre-unwind key args) + (dispatch-exception depth key args)))) + (prompt-tag + (apply abort-to-prompt prompt-tag key args)) + (else + (dispatch-exception (1+ depth) key args)))) + (dispatch-exception (1+ depth) key args))))) + ((eq? key 'quit) + (primitive-exit (cond + ((not (pair? args)) 0) + ((integer? (car args)) (car args)) + ((not (car args)) 1) + (else 0)))) + (else + (format (current-error-port) "guile: uncaught throw to ~a: ~a\n" + key args) + (primitive-exit 1)))) + + (define (throw key . args) + "Invoke the catch form matching @var{key}, passing @var{args} to the +@var{handler}. + +@var{key} is a symbol. It will match catches of the same symbol or of @code{#t}. + +If there is no handler at all, Guile prints an error and then exits." + (unless (symbol? key) + (throw 'wrong-type-arg "throw" "Wrong type argument in position ~a: ~a" + (list 1 key) (list key))) + (dispatch-exception 0 key args)) + + (define* (catch k thunk handler #:optional pre-unwind-handler) + "Invoke @var{thunk} in the dynamic context of @var{handler} for +exceptions matching @var{key}. If thunk throws to the symbol +@var{key}, then @var{handler} is invoked this way: +@lisp + (handler key args ...) +@end lisp + +@var{key} is a symbol or @code{#t}. + +@var{thunk} takes no arguments. If @var{thunk} returns +normally, that is the return value of @code{catch}. + +Handler is invoked outside the scope of its own @code{catch}. +If @var{handler} again throws to the same key, a new handler +from further up the call chain is invoked. + +If the key is @code{#t}, then a throw to @emph{any} symbol will +match this call to @code{catch}. + +If a @var{pre-unwind-handler} is given and @var{thunk} throws +an exception that matches @var{key}, Guile calls the +@var{pre-unwind-handler} before unwinding the dynamic state and +invoking the main @var{handler}. @var{pre-unwind-handler} should +be a procedure with the same signature as @var{handler}, that +is @code{(lambda (key . args))}. It is typically used to save +the stack at the point where the exception occurred, but can also +query other parts of the dynamic state at that point, such as +fluid values. + +A @var{pre-unwind-handler} can exit either normally or non-locally. +If it exits normally, Guile unwinds the stack and dynamic context +and then calls the normal (third argument) handler. If it exits +non-locally, that exit determines the continuation." + (define (wrong-type-arg n val) + (scm-error 'wrong-type-arg "catch" + "Wrong type argument in position ~a: ~a" + (list n val) (list val))) + (unless (or (symbol? k) (eqv? k #t)) + (wrong-type-arg 1 k)) + (unless (procedure? handler) + (wrong-type-arg 3 handler)) + (unless (or (not pre-unwind-handler) (procedure? pre-unwind-handler)) + (wrong-type-arg 4 pre-unwind-handler)) + (let ((tag (make-prompt-tag "catch"))) + (call-with-prompt + tag + (lambda () + (with-fluid* %eh (make-exception-handler k tag pre-unwind-handler) + thunk)) + (lambda (cont k . args) + (apply handler k args))))) + + (define (with-throw-handler k thunk pre-unwind-handler) + "Add @var{handler} to the dynamic context as a throw handler +for key @var{k}, then invoke @var{thunk}." + (if (not (or (symbol? k) (eqv? k #t))) + (scm-error 'wrong-type-arg "with-throw-handler" + "Wrong type argument in position ~a: ~a" + (list 1 k) (list k))) + (with-fluid* %eh (make-exception-handler k #f pre-unwind-handler) + thunk)) + + (hashq-remove! (%get-pre-modules-obarray) '%exception-handler) + (define! 'catch catch) + (define! 'with-throw-handler with-throw-handler) + (define! 'throw throw)) + + + + +;;; +;;; Extensible exception printing. +;;; + +(define set-exception-printer! #f) +;; There is already a definition of print-exception from backtrace.c +;; that we will override. + +(let ((exception-printers '())) + (define (print-location frame port) + (let ((source (and=> frame frame-source))) + ;; source := (addr . (filename . (line . column))) + (if source + (let ((filename (or (cadr source) "")) + (line (caddr source)) + (col (cdddr source))) + (format port "~a:~a:~a: " filename (1+ line) col)) + (format port "ERROR: ")))) + + (set! set-exception-printer! + (lambda (key proc) + (set! exception-printers (acons key proc exception-printers)))) + + (set! print-exception + (lambda (port frame key args) + (define (default-printer) + (format port "Throw to key `~a' with args `~s'." key args)) + + (when frame + (print-location frame port) + ;; When booting, false-if-exception isn't defined yet. + (let ((name (catch #t + (lambda () (frame-procedure-name frame)) + (lambda _ #f)))) + (when name + (format port "In procedure ~a:\n" name)))) + + (catch #t + (lambda () + (let ((printer (assq-ref exception-printers key))) + (if printer + (printer port key args default-printer) + (default-printer)))) + (lambda (k . args) + (format port "Error while printing exception."))) + (newline port) + (force-output port)))) + +;;; +;;; Printers for those keys thrown by Guile. +;;; +(let () + (define (scm-error-printer port key args default-printer) + ;; Abuse case-lambda as a pattern matcher, given that we don't have + ;; ice-9 match at this point. + (apply (case-lambda + ((subr msg args . rest) + (if subr + (format port "In procedure ~a: " subr)) + (apply format port msg (or args '()))) + (_ (default-printer))) + args)) + + (define (syntax-error-printer port key args default-printer) + (apply (case-lambda + ((who what where form subform . extra) + (format port "Syntax error:\n") + (if where + (let ((file (or (assq-ref where 'filename) "unknown file")) + (line (and=> (assq-ref where 'line) 1+)) + (col (assq-ref where 'column))) + (format port "~a:~a:~a: " file line col)) + (format port "unknown location: ")) + (if who + (format port "~a: " who)) + (format port "~a" what) + (if subform + (format port " in subform ~s of ~s" subform form) + (if form + (format port " in form ~s" form)))) + (_ (default-printer))) + args)) + + (define (keyword-error-printer port key args default-printer) + (let ((message (cadr args)) + (faulty (car (cadddr args)))) ; I won't do it again, I promise. + (format port "~a: ~s" message faulty))) + + (define (getaddrinfo-error-printer port key args default-printer) + (format port "In procedure getaddrinfo: ~a" (gai-strerror (car args)))) + + (set-exception-printer! 'goops-error scm-error-printer) + (set-exception-printer! 'host-not-found scm-error-printer) + (set-exception-printer! 'keyword-argument-error keyword-error-printer) + (set-exception-printer! 'misc-error scm-error-printer) + (set-exception-printer! 'no-data scm-error-printer) + (set-exception-printer! 'no-recovery scm-error-printer) + (set-exception-printer! 'null-pointer-error scm-error-printer) + (set-exception-printer! 'out-of-memory scm-error-printer) + (set-exception-printer! 'out-of-range scm-error-printer) + (set-exception-printer! 'program-error scm-error-printer) + (set-exception-printer! 'read-error scm-error-printer) + (set-exception-printer! 'regular-expression-syntax scm-error-printer) + (set-exception-printer! 'signal scm-error-printer) + (set-exception-printer! 'stack-overflow scm-error-printer) + (set-exception-printer! 'system-error scm-error-printer) + (set-exception-printer! 'try-again scm-error-printer) + (set-exception-printer! 'unbound-variable scm-error-printer) + (set-exception-printer! 'wrong-number-of-args scm-error-printer) + (set-exception-printer! 'wrong-type-arg scm-error-printer) + + (set-exception-printer! 'syntax-error syntax-error-printer) + + (set-exception-printer! 'getaddrinfo-error getaddrinfo-error-printer)) + + + + +;;; {Defmacros} +;;; + +(define-syntax define-macro + (lambda (x) + "Define a defmacro." + (syntax-case x () + ((_ (macro . args) doc body1 body ...) + (string? (syntax->datum #'doc)) + #'(define-macro macro doc (lambda args body1 body ...))) + ((_ (macro . args) body ...) + #'(define-macro macro #f (lambda args body ...))) + ((_ macro transformer) + #'(define-macro macro #f transformer)) + ((_ macro doc transformer) + (or (string? (syntax->datum #'doc)) + (not (syntax->datum #'doc))) + #'(define-syntax macro + (lambda (y) + doc + #((macro-type . defmacro) + (defmacro-args args)) + (syntax-case y () + ((_ . args) + (let ((v (syntax->datum #'args))) + (datum->syntax y (apply transformer v))))))))))) + +(define-syntax defmacro + (lambda (x) + "Define a defmacro, with the old lispy defun syntax." + (syntax-case x () + ((_ macro args doc body1 body ...) + (string? (syntax->datum #'doc)) + #'(define-macro macro doc (lambda args body1 body ...))) + ((_ macro args body ...) + #'(define-macro macro #f (lambda args body ...)))))) + +(provide 'defmacro) + + + +;;; {Deprecation} +;;; + +(define-syntax begin-deprecated + (lambda (x) + (syntax-case x () + ((_ form form* ...) + (if (include-deprecated-features) + #'(begin form form* ...) + #'(begin)))))) + + + +;;; {Trivial Functions} +;;; + +(define (identity x) x) + +(define (compose proc . rest) + "Compose PROC with the procedures in REST, such that the last one in +REST is applied first and PROC last, and return the resulting procedure. +The given procedures must have compatible arity." + (if (null? rest) + proc + (let ((g (apply compose rest))) + (lambda args + (call-with-values (lambda () (apply g args)) proc))))) + +(define (negate proc) + "Return a procedure with the same arity as PROC that returns the `not' +of PROC's result." + (lambda args + (not (apply proc args)))) + +(define (const value) + "Return a procedure that accepts any number of arguments and returns +VALUE." + (lambda _ + value)) + +(define (and=> value procedure) + "When VALUE is #f, return #f. Otherwise, return (PROC VALUE)." + (and value (procedure value))) + +(define call/cc call-with-current-continuation) + +(define-syntax false-if-exception + (syntax-rules () + ((false-if-exception expr) + (catch #t + (lambda () expr) + (lambda args #f))) + ((false-if-exception expr #:warning template arg ...) + (catch #t + (lambda () expr) + (lambda (key . args) + (for-each (lambda (s) + (if (not (string-null? s)) + (format (current-warning-port) ";;; ~a\n" s))) + (string-split + (call-with-output-string + (lambda (port) + (format port template arg ...) + (print-exception port #f key args))) + #\newline)) + #f))))) + + + +;;; {General Properties} +;;; + +;; Properties are a lispy way to associate random info with random objects. +;; Traditionally properties are implemented as an alist or a plist actually +;; pertaining to the object in question. +;; +;; These "object properties" have the advantage that they can be associated with +;; any object, even if the object has no plist. Object properties are good when +;; you are extending pre-existing objects in unexpected ways. They also present +;; a pleasing, uniform procedure-with-setter interface. But if you have a data +;; type that always has properties, it's often still best to store those +;; properties within the object itself. + +(define (make-object-property) + ;; Weak tables are thread-safe. + (let ((prop (make-weak-key-hash-table))) + (make-procedure-with-setter + (lambda (obj) (hashq-ref prop obj)) + (lambda (obj val) (hashq-set! prop obj val))))) + + + + +;;; {Symbol Properties} +;;; + +;;; Symbol properties are something you see in old Lisp code. In most current +;;; Guile code, symbols are not used as a data structure -- they are used as +;;; keys into other data structures. + +(define (symbol-property sym prop) + (let ((pair (assoc prop (symbol-pref sym)))) + (and pair (cdr pair)))) + +(define (set-symbol-property! sym prop val) + (let ((pair (assoc prop (symbol-pref sym)))) + (if pair + (set-cdr! pair val) + (symbol-pset! sym (acons prop val (symbol-pref sym)))))) + +(define (symbol-property-remove! sym prop) + (let ((pair (assoc prop (symbol-pref sym)))) + (if pair + (symbol-pset! sym (delq! pair (symbol-pref sym)))))) + + + +;;; {Arrays} +;;; + +(define (array-shape a) + (map (lambda (ind) (if (number? ind) (list 0 (+ -1 ind)) ind)) + (array-dimensions a))) + + + +;;; {Keywords} +;;; + +;;; It's much better if you can use lambda* / define*, of course. + +(define (kw-arg-ref args kw) + (let ((rem (member kw args))) + (and rem (pair? (cdr rem)) (cadr rem)))) + + + +;;; {IOTA functions: generating lists of numbers} +;;; + +(define (iota n) + (let loop ((count (1- n)) (result '())) + (if (< count 0) result + (loop (1- count) (cons count result))))) + + + +;;; {Structs} +;;; + +(define (struct-layout s) + (struct-ref (struct-vtable s) vtable-index-layout)) + + + +;;; {Records} +;;; + +;; Printing records: by default, records are printed as +;; +;; # +;; +;; You can change that by giving a custom printing function to +;; MAKE-RECORD-TYPE (after the list of field symbols). This function +;; will be called like +;; +;; ( object port) +;; +;; It should print OBJECT to PORT. + +;; 0: type-name, 1: fields, 2: constructor +(define record-type-vtable + (let ((s (make-vtable (string-append standard-vtable-fields "prprpw") + (lambda (s p) + (display "#" p))))) + (set-struct-vtable-name! s 'record-type) + s)) + +(define (record-type? obj) + (and (struct? obj) (eq? record-type-vtable (struct-vtable obj)))) + +(define* (make-record-type type-name fields #:optional printer) + ;; Pre-generate constructors for nfields < 20. + (define-syntax make-constructor + (lambda (x) + (define *max-static-argument-count* 20) + (define (make-formals n) + (let lp ((i 0)) + (if (< i n) + (cons (datum->syntax + x + (string->symbol + (string (integer->char (+ (char->integer #\a) i))))) + (lp (1+ i))) + '()))) + (syntax-case x () + ((_ rtd exp) (not (identifier? #'exp)) + #'(let ((n exp)) + (make-constructor rtd n))) + ((_ rtd nfields) + #`(case nfields + #,@(let lp ((n 0)) + (if (< n *max-static-argument-count*) + (cons (with-syntax (((formal ...) (make-formals n)) + ((idx ...) (iota n)) + (n n)) + #'((n) + (lambda (formal ...) + (let ((s (allocate-struct rtd n))) + (struct-set! s idx formal) + ... + s)))) + (lp (1+ n))) + '())) + (else + (lambda args + (if (= (length args) nfields) + (apply make-struct/no-tail rtd args) + (scm-error 'wrong-number-of-args + (format #f "make-~a" type-name) + "Wrong number of arguments" '() #f))))))))) + + (define (default-record-printer s p) + (display "#<" p) + (display (record-type-name (record-type-descriptor s)) p) + (let loop ((fields (record-type-fields (record-type-descriptor s))) + (off 0)) + (cond + ((not (null? fields)) + (display " " p) + (display (car fields) p) + (display ": " p) + (display (struct-ref s off) p) + (loop (cdr fields) (+ 1 off))))) + (display ">" p)) + + (let ((rtd (make-struct/no-tail + record-type-vtable + (make-struct-layout + (apply string-append + (map (lambda (f) "pw") fields))) + (or printer default-record-printer) + type-name + (copy-tree fields)))) + (struct-set! rtd (+ vtable-offset-user 2) + (make-constructor rtd (length fields))) + ;; Temporary solution: Associate a name to the record type descriptor + ;; so that the object system can create a wrapper class for it. + (set-struct-vtable-name! rtd (if (symbol? type-name) + type-name + (string->symbol type-name))) + rtd)) + +(define (record-type-name obj) + (if (record-type? obj) + (struct-ref obj vtable-offset-user) + (error 'not-a-record-type obj))) + +(define (record-type-fields obj) + (if (record-type? obj) + (struct-ref obj (+ 1 vtable-offset-user)) + (error 'not-a-record-type obj))) + +(define* (record-constructor rtd #:optional field-names) + (if (not field-names) + (struct-ref rtd (+ 2 vtable-offset-user)) + (primitive-eval + `(lambda ,field-names + (make-struct/no-tail ',rtd + ,@(map (lambda (f) + (if (memq f field-names) + f + #f)) + (record-type-fields rtd))))))) + +(define (record-predicate rtd) + (lambda (obj) (and (struct? obj) (eq? rtd (struct-vtable obj))))) + +(define (%record-type-error rtd obj) ;; private helper + (or (eq? rtd (record-type-descriptor obj)) + (scm-error 'wrong-type-arg "%record-type-check" + "Wrong type record (want `~S'): ~S" + (list (record-type-name rtd) obj) + #f))) + +(define (record-accessor rtd field-name) + (let ((pos (list-index (record-type-fields rtd) field-name))) + (if (not pos) + (error 'no-such-field field-name)) + (lambda (obj) + (if (eq? (struct-vtable obj) rtd) + (struct-ref obj pos) + (%record-type-error rtd obj))))) + +(define (record-modifier rtd field-name) + (let ((pos (list-index (record-type-fields rtd) field-name))) + (if (not pos) + (error 'no-such-field field-name)) + (lambda (obj val) + (if (eq? (struct-vtable obj) rtd) + (struct-set! obj pos val) + (%record-type-error rtd obj))))) + +(define (record? obj) + (and (struct? obj) (record-type? (struct-vtable obj)))) + +(define (record-type-descriptor obj) + (if (struct? obj) + (struct-vtable obj) + (error 'not-a-record obj))) + +(provide 'record) + + + +;;; {Parameters} +;;; + +(define + ;; Three fields: the procedure itself, the fluid, and the converter. + (make-struct/no-tail 'pwprpr)) +(set-struct-vtable-name! ') + +(define* (make-parameter init #:optional (conv (lambda (x) x))) + "Make a new parameter. + +A parameter is a dynamically bound value, accessed through a procedure. +To access the current value, apply the procedure with no arguments: + + (define p (make-parameter 10)) + (p) => 10 + +To provide a new value for the parameter in a dynamic extent, use +`parameterize': + + (parameterize ((p 20)) + (p)) => 20 + (p) => 10 + +The value outside of the dynamic extent of the body is unaffected. To +update the current value, apply it to one argument: + + (p 20) => 10 + (p) => 20 + +As you can see, the call that updates a parameter returns its previous +value. + +All values for the parameter are first run through the CONV procedure, +including INIT, the initial value. The default CONV procedure is the +identity procedure. CONV is commonly used to ensure some set of +invariants on the values that a parameter may have." + (let ((fluid (make-fluid (conv init)))) + (make-struct/no-tail + + (case-lambda + (() (fluid-ref fluid)) + ((x) (let ((prev (fluid-ref fluid))) + (fluid-set! fluid (conv x)) + prev))) + fluid conv))) + +(define (parameter? x) + (and (struct? x) (eq? (struct-vtable x) ))) + +(define (parameter-fluid p) + (if (parameter? p) + (struct-ref p 1) + (scm-error 'wrong-type-arg "parameter-fluid" + "Not a parameter: ~S" (list p) #f))) + +(define (parameter-converter p) + (if (parameter? p) + (struct-ref p 2) + (scm-error 'wrong-type-arg "parameter-fluid" + "Not a parameter: ~S" (list p) #f))) + +(define-syntax parameterize + (lambda (x) + (syntax-case x () + ((_ ((param value) ...) body body* ...) + (with-syntax (((p ...) (generate-temporaries #'(param ...)))) + #'(let ((p param) ...) + (if (not (parameter? p)) + (scm-error 'wrong-type-arg "parameterize" + "Not a parameter: ~S" (list p) #f)) + ... + (with-fluids (((struct-ref p 1) ((struct-ref p 2) value)) + ...) + body body* ...))))))) + +(define* (fluid->parameter fluid #:optional (conv (lambda (x) x))) + "Make a parameter that wraps a fluid. + +The value of the parameter will be the same as the value of the fluid. +If the parameter is rebound in some dynamic extent, perhaps via +`parameterize', the new value will be run through the optional CONV +procedure, as with any parameter. Note that unlike `make-parameter', +CONV is not applied to the initial value." + (make-struct/no-tail + + (case-lambda + (() (fluid-ref fluid)) + ((x) (let ((prev (fluid-ref fluid))) + (fluid-set! fluid (conv x)) + prev))) + fluid conv)) + + + +;;; Once parameters have booted, define the default prompt tag as being +;;; a parameter, and make allow-legacy-syntax-objects? a parameter. +;;; + +(set! default-prompt-tag (make-parameter (default-prompt-tag))) + +;; Because code compiled with Guile 2.2.0 embeds legacy syntax objects +;; into its compiled macros, we have to default to true, sadly. +(set! allow-legacy-syntax-objects? (make-parameter #t)) + + + +;;; {Languages} +;;; + +;; The language can be a symbolic name or a object from +;; (system base language). +;; +(define current-language (make-parameter 'scheme)) + + + + +;;; {High-Level Port Routines} +;;; + +(define (call-with-output-string proc) + "Calls the one-argument procedure @var{proc} with a newly created output +port. When the function returns, the string composed of the characters +written into the port is returned." + (let ((port (open-output-string))) + (proc port) + (get-output-string port))) + + + +;;; {Booleans} +;;; + +(define (->bool x) (not (not x))) + + + +;;; {Symbols} +;;; + +(define (symbol-append . args) + (string->symbol (apply string-append (map symbol->string args)))) + +(define (list->symbol . args) + (string->symbol (apply list->string args))) + +(define (symbol . args) + (string->symbol (apply string args))) + + + +;;; {Lists} +;;; + +(define (list-index l k) + (let loop ((n 0) + (l l)) + (and (not (null? l)) + (if (eq? (car l) k) + n + (loop (+ n 1) (cdr l)))))) + + + +;; Load `posix.scm' even when not (provided? 'posix) so that we get the +;; `stat' accessors. +(primitive-load-path "ice-9/posix") + +(if (provided? 'socket) + (primitive-load-path "ice-9/networking")) + +;; For reference, Emacs file-exists-p uses stat in this same way. +(define file-exists? + (if (provided? 'posix) + (lambda (str) + (->bool (stat str #f))) + (lambda (str) + (let ((port (catch 'system-error (lambda () (open-input-file str)) + (lambda args #f)))) + (if port (begin (close-port port) #t) + #f))))) + +(define file-is-directory? + (if (provided? 'posix) + (lambda (str) + (eq? (stat:type (stat str)) 'directory)) + (lambda (str) + (let ((port (catch 'system-error + (lambda () + (open-input-file (string-append str "/."))) + (lambda args #f)))) + (if port (begin (close-port port) #t) + #f))))) + +(define (system-error-errno args) + (if (eq? (car args) 'system-error) + (car (list-ref args 4)) + #f)) + + + +;;; {Error Handling} +;;; + +(define error + (case-lambda + (() + (scm-error 'misc-error #f "?" #f #f)) + ((message . args) + (let ((msg (string-join (cons "~A" (make-list (length args) "~S"))))) + (scm-error 'misc-error #f msg (cons message args) #f))))) + + + +;;; {Time Structures} +;;; + +(define (tm:sec obj) (vector-ref obj 0)) +(define (tm:min obj) (vector-ref obj 1)) +(define (tm:hour obj) (vector-ref obj 2)) +(define (tm:mday obj) (vector-ref obj 3)) +(define (tm:mon obj) (vector-ref obj 4)) +(define (tm:year obj) (vector-ref obj 5)) +(define (tm:wday obj) (vector-ref obj 6)) +(define (tm:yday obj) (vector-ref obj 7)) +(define (tm:isdst obj) (vector-ref obj 8)) +(define (tm:gmtoff obj) (vector-ref obj 9)) +(define (tm:zone obj) (vector-ref obj 10)) + +(define (set-tm:sec obj val) (vector-set! obj 0 val)) +(define (set-tm:min obj val) (vector-set! obj 1 val)) +(define (set-tm:hour obj val) (vector-set! obj 2 val)) +(define (set-tm:mday obj val) (vector-set! obj 3 val)) +(define (set-tm:mon obj val) (vector-set! obj 4 val)) +(define (set-tm:year obj val) (vector-set! obj 5 val)) +(define (set-tm:wday obj val) (vector-set! obj 6 val)) +(define (set-tm:yday obj val) (vector-set! obj 7 val)) +(define (set-tm:isdst obj val) (vector-set! obj 8 val)) +(define (set-tm:gmtoff obj val) (vector-set! obj 9 val)) +(define (set-tm:zone obj val) (vector-set! obj 10 val)) + +(define (tms:clock obj) (vector-ref obj 0)) +(define (tms:utime obj) (vector-ref obj 1)) +(define (tms:stime obj) (vector-ref obj 2)) +(define (tms:cutime obj) (vector-ref obj 3)) +(define (tms:cstime obj) (vector-ref obj 4)) + + + +;;; {C Environment} +;;; + +(define (setenv name value) + (if value + (putenv (string-append name "=" value)) + (putenv name))) + +(define (unsetenv name) + "Remove the entry for NAME from the environment." + (putenv name)) + + + +;;; {Load Paths} +;;; + +(let-syntax ((compile-time-case + (lambda (stx) + (syntax-case stx () + ((_ exp clauses ...) + (let ((val (primitive-eval (syntax->datum #'exp)))) + (let next-clause ((clauses #'(clauses ...))) + (syntax-case clauses (else) + (() + (syntax-violation 'compile-time-case + "all clauses failed to match" stx)) + (((else form ...)) + #'(begin form ...)) + ((((k ...) form ...) clauses ...) + (if (memv val (syntax->datum #'(k ...))) + #'(begin form ...) + (next-clause #'(clauses ...)))))))))))) + ;; emacs: (put 'compile-time-case 'scheme-indent-function 1) + (compile-time-case (system-file-name-convention) + ((posix) + (define (file-name-separator? c) + (char=? c #\/)) + + (define file-name-separator-string "/") + + (define (absolute-file-name? file-name) + (string-prefix? "/" file-name))) + + ((windows) + (define (file-name-separator? c) + (or (char=? c #\/) + (char=? c #\\))) + + (define file-name-separator-string "/") + + (define (absolute-file-name? file-name) + (define (file-name-separator-at-index? idx) + (and (> (string-length file-name) idx) + (file-name-separator? (string-ref file-name idx)))) + (define (unc-file-name?) + ;; Universal Naming Convention (UNC) file-names start with \\, + ;; and are always absolute. See: + ;; http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#fully_qualified_vs._relative_paths + (and (file-name-separator-at-index? 0) + (file-name-separator-at-index? 1))) + (define (has-drive-specifier?) + (and (>= (string-length file-name) 2) + (let ((drive (string-ref file-name 0))) + (or (char<=? #\a drive #\z) + (char<=? #\A drive #\Z))) + (eqv? (string-ref file-name 1) #\:))) + (or (unc-file-name?) + (if (has-drive-specifier?) + (file-name-separator-at-index? 2) + (file-name-separator-at-index? 0))))))) + +(define (in-vicinity vicinity file) + (let ((tail (let ((len (string-length vicinity))) + (if (zero? len) + #f + (string-ref vicinity (- len 1)))))) + (string-append vicinity + (if (or (not tail) (file-name-separator? tail)) + "" + file-name-separator-string) + file))) + + + +;;; {Help for scm_shell} +;;; +;;; The argument-processing code used by Guile-based shells generates +;;; Scheme code based on the argument list. This page contains help +;;; functions for the code it generates. +;;; + +(define (command-line) (program-arguments)) + +;; This is mostly for the internal use of the code generated by +;; scm_compile_shell_switches. + +(define (load-user-init) + (let* ((home (or (getenv "HOME") + (false-if-exception (passwd:dir (getpwuid (getuid)))) + file-name-separator-string)) ;; fallback for cygwin etc. + (init-file (in-vicinity home ".guile"))) + (if (file-exists? init-file) + (primitive-load init-file)))) + + + +;;; {The interpreter stack} +;;; + +;; %stacks defined in stacks.c +(define (%start-stack tag thunk) + (let ((prompt-tag (make-prompt-tag "start-stack"))) + (call-with-prompt + prompt-tag + (lambda () + (with-fluids ((%stacks (cons tag prompt-tag))) + (thunk))) + (lambda (k . args) + (%start-stack tag (lambda () (apply k args))))))) + +(define-syntax-rule (start-stack tag exp) + (%start-stack tag (lambda () exp))) + + + +;;; {Loading by paths} +;;; + +(define (load-from-path name) + "Load a Scheme source file named NAME, searching for it in the +directories listed in %load-path, and applying each of the file +name extensions listed in %load-extensions." + (start-stack 'load-stack + (primitive-load-path name))) + +(define-syntax-rule (add-to-load-path elt) + "Add ELT to Guile's load path, at compile-time and at run-time." + (eval-when (expand load eval) + (set! %load-path (cons elt (delete elt %load-path))))) + +(define %load-verbosely #f) +(define (assert-load-verbosity v) (set! %load-verbosely v)) + +(define (%load-announce file) + (if %load-verbosely + (with-output-to-port (current-warning-port) + (lambda () + (display ";;; ") + (display "loading ") + (display file) + (newline) + (force-output))))) + +(set! %load-hook %load-announce) + + + +;;; {Reader Extensions} +;;; +;;; Reader code for various "#c" forms. +;;; + +(define read-eval? (make-fluid #f)) +(read-hash-extend #\. + (lambda (c port) + (if (fluid-ref read-eval?) + (eval (read port) (interaction-environment)) + (error + "#. read expansion found and read-eval? is #f.")))) + + + +;;; {Low Level Modules} +;;; +;;; These are the low level data structures for modules. +;;; +;;; Every module object is of the type 'module-type', which is a record +;;; consisting of the following members: +;;; +;;; - eval-closure: A deprecated field, to be removed in Guile 2.2. +;;; +;;; - obarray: a hash table that maps symbols to variable objects. In this +;;; hash table, the definitions are found that are local to the module (that +;;; is, not imported from other modules). When looking up bindings in the +;;; module, this hash table is searched first. +;;; +;;; - binder: either #f or a function taking a module and a symbol argument. +;;; If it is a function it is called after the obarray has been +;;; unsuccessfully searched for a binding. It then can provide bindings +;;; that would otherwise not be found locally in the module. +;;; +;;; - uses: a list of modules from which non-local bindings can be inherited. +;;; These modules are the third place queried for bindings after the obarray +;;; has been unsuccessfully searched and the binder function did not deliver +;;; a result either. +;;; +;;; - transformer: either #f or a function taking a scheme expression as +;;; delivered by read. If it is a function, it will be called to perform +;;; syntax transformations (e. g. makro expansion) on the given scheme +;;; expression. The output of the transformer function will then be passed +;;; to Guile's internal memoizer. This means that the output must be valid +;;; scheme code. The only exception is, that the output may make use of the +;;; syntax extensions provided to identify the modules that a binding +;;; belongs to. +;;; +;;; - name: the name of the module. This is used for all kinds of printing +;;; outputs. In certain places the module name also serves as a way of +;;; identification. When adding a module to the uses list of another +;;; module, it is made sure that the new uses list will not contain two +;;; modules of the same name. +;;; +;;; - kind: classification of the kind of module. The value is (currently?) +;;; only used for printing. It has no influence on how a module is treated. +;;; Currently the following values are used when setting the module kind: +;;; 'module, 'directory, 'interface, 'custom-interface. If no explicit kind +;;; is set, it defaults to 'module. +;;; +;;; - duplicates-handlers: a list of procedures that get called to make a +;;; choice between two duplicate bindings when name clashes occur. See the +;;; `duplicate-handlers' global variable below. +;;; +;;; - observers: a list of procedures that get called when the module is +;;; modified. +;;; +;;; - weak-observers: a weak-key hash table of procedures that get called +;;; when the module is modified. See `module-observe-weak' for details. +;;; +;;; In addition, the module may (must?) contain a binding for +;;; `%module-public-interface'. This variable should be bound to a module +;;; representing the exported interface of a module. See the +;;; `module-public-interface' and `module-export!' procedures. +;;; +;;; !!! warning: The interface to lazy binder procedures is going +;;; to be changed in an incompatible way to permit all the basic +;;; module ops to be virtualized. +;;; +;;; (make-module size use-list lazy-binding-proc) => module +;;; module-{obarray,uses,binder}[|-set!] +;;; (module? obj) => [#t|#f] +;;; (module-locally-bound? module symbol) => [#t|#f] +;;; (module-bound? module symbol) => [#t|#f] +;;; (module-symbol-locally-interned? module symbol) => [#t|#f] +;;; (module-symbol-interned? module symbol) => [#t|#f] +;;; (module-local-variable module symbol) => [# | #f] +;;; (module-variable module symbol) => [# | #f] +;;; (module-symbol-binding module symbol opt-value) +;;; => [ | opt-value | an error occurs ] +;;; (module-make-local-var! module symbol) => # +;;; (module-add! module symbol var) => unspecified +;;; (module-remove! module symbol) => unspecified +;;; (module-for-each proc module) => unspecified +;;; (make-scm-module) => module ; a lazy copy of the symhash module +;;; (set-current-module module) => unspecified +;;; (current-module) => # +;;; +;;; + + + +;;; {Printing Modules} +;;; + +;; This is how modules are printed. You can re-define it. +(define (%print-module mod port) + (display "#<" port) + (display (or (module-kind mod) "module") port) + (display " " port) + (display (module-name mod) port) + (display " " port) + (display (number->string (object-address mod) 16) port) + (display ">" port)) + +(letrec-syntax + ;; Locally extend the syntax to allow record accessors to be defined at + ;; compile-time. Cache the rtd locally to the constructor, the getters and + ;; the setters, in order to allow for redefinition of the record type; not + ;; relevant in the case of modules, but perhaps if we make this public, it + ;; could matter. + + ((define-record-type + (lambda (x) + (define (make-id scope . fragments) + (datum->syntax scope + (apply symbol-append + (map (lambda (x) + (if (symbol? x) x (syntax->datum x))) + fragments)))) + + (define (getter rtd type-name field slot) + #`(define #,(make-id rtd type-name '- field) + (let ((rtd #,rtd)) + (lambda (#,type-name) + (if (eq? (struct-vtable #,type-name) rtd) + (struct-ref #,type-name #,slot) + (%record-type-error rtd #,type-name)))))) + + (define (setter rtd type-name field slot) + #`(define #,(make-id rtd 'set- type-name '- field '!) + (let ((rtd #,rtd)) + (lambda (#,type-name val) + (if (eq? (struct-vtable #,type-name) rtd) + (struct-set! #,type-name #,slot val) + (%record-type-error rtd #,type-name)))))) + + (define (accessors rtd type-name fields n exp) + (syntax-case fields () + (() exp) + (((field #:no-accessors) field* ...) (identifier? #'field) + (accessors rtd type-name #'(field* ...) (1+ n) + exp)) + (((field #:no-setter) field* ...) (identifier? #'field) + (accessors rtd type-name #'(field* ...) (1+ n) + #`(begin #,exp + #,(getter rtd type-name #'field n)))) + (((field #:no-getter) field* ...) (identifier? #'field) + (accessors rtd type-name #'(field* ...) (1+ n) + #`(begin #,exp + #,(setter rtd type-name #'field n)))) + ((field field* ...) (identifier? #'field) + (accessors rtd type-name #'(field* ...) (1+ n) + #`(begin #,exp + #,(getter rtd type-name #'field n) + #,(setter rtd type-name #'field n)))))) + + (define (predicate rtd type-name fields exp) + (accessors + rtd type-name fields 0 + #`(begin + #,exp + (define (#,(make-id rtd type-name '?) obj) + (and (struct? obj) (eq? (struct-vtable obj) #,rtd)))))) + + (define (field-list fields) + (syntax-case fields () + (() '()) + (((f . opts) . rest) (identifier? #'f) + (cons #'f (field-list #'rest))) + ((f . rest) (identifier? #'f) + (cons #'f (field-list #'rest))))) + + (define (constructor rtd type-name fields exp) + (let* ((ctor (make-id rtd type-name '-constructor)) + (args (field-list fields)) + (n (length fields)) + (slots (iota n))) + (predicate rtd type-name fields + #`(begin #,exp + (define #,ctor + (let ((rtd #,rtd)) + (lambda #,args + (let ((s (allocate-struct rtd #,n))) + #,@(map + (lambda (arg slot) + #`(struct-set! s #,slot #,arg)) + args slots) + s)))) + (struct-set! #,rtd (+ vtable-offset-user 2) + #,ctor))))) + + (define (type type-name printer fields) + (define (make-layout) + (let lp ((fields fields) (slots '())) + (syntax-case fields () + (() (datum->syntax #'here + (make-struct-layout + (apply string-append slots)))) + ((_ . rest) (lp #'rest (cons "pw" slots)))))) + + (let ((rtd (make-id type-name type-name '-type))) + (constructor rtd type-name fields + #`(begin + (define #,rtd + (make-struct/no-tail + record-type-vtable + '#,(make-layout) + #,printer + '#,type-name + '#,(field-list fields))) + (set-struct-vtable-name! #,rtd '#,type-name))))) + + (syntax-case x () + ((_ type-name printer (field ...)) + (type #'type-name #'printer #'(field ...))))))) + + ;; module-type + ;; + ;; A module is characterized by an obarray in which local symbols + ;; are interned, a list of modules, "uses", from which non-local + ;; bindings can be inherited, and an optional lazy-binder which + ;; is a (CLOSURE module symbol) which, as a last resort, can provide + ;; bindings that would otherwise not be found locally in the module. + ;; + ;; NOTE: If you change the set of fields or their order, you also need to + ;; change the constants in libguile/modules.h. + ;; + ;; NOTE: The getter `module-transformer' is defined libguile/modules.c. + ;; NOTE: The getter `module-name' is defined later, due to boot reasons. + ;; NOTE: The getter `module-public-interface' is used in libguile/modules.c. + ;; + (define-record-type module + (lambda (obj port) (%print-module obj port)) + (obarray + uses + binder + eval-closure + (transformer #:no-getter) + (name #:no-getter) + kind + duplicates-handlers + (import-obarray #:no-setter) + observers + (weak-observers #:no-setter) + version + submodules + submodule-binder + public-interface + filename + next-unique-id))) + + +;; make-module &opt size uses binder +;; +(define* (make-module #:optional (size 31) (uses '()) (binder #f)) + "Create a new module, perhaps with a particular size of obarray, +initial uses list, or binding procedure." + (if (not (integer? size)) + (error "Illegal size to make-module." size)) + (if (not (and (list? uses) + (and-map module? uses))) + (error "Incorrect use list." uses)) + (if (and binder (not (procedure? binder))) + (error + "Lazy-binder expected to be a procedure or #f." binder)) + + (module-constructor (make-hash-table size) + uses binder #f macroexpand + #f #f #f + (make-hash-table) + '() + (make-weak-key-hash-table 31) #f + (make-hash-table 7) #f #f #f 0)) + + + + +;;; {Observer protocol} +;;; + +(define (module-observe module proc) + (set-module-observers! module (cons proc (module-observers module))) + (cons module proc)) + +(define* (module-observe-weak module observer-id #:optional (proc observer-id)) + "Register PROC as an observer of MODULE under name OBSERVER-ID (which can +be any Scheme object). PROC is invoked and passed MODULE any time +MODULE is modified. PROC gets unregistered when OBSERVER-ID gets GC'd +(thus, it is never unregistered if OBSERVER-ID is an immediate value, +for instance). + +The two-argument version is kept for backward compatibility: when called +with two arguments, the observer gets unregistered when closure PROC +gets GC'd (making it impossible to use an anonymous lambda for PROC)." + (hashq-set! (module-weak-observers module) observer-id proc)) + +(define (module-unobserve token) + (let ((module (car token)) + (id (cdr token))) + (if (integer? id) + (hash-remove! (module-weak-observers module) id) + (set-module-observers! module (delq1! id (module-observers module))))) + *unspecified*) + +;; Hash table of module -> #t indicating modules that changed while +;; observers were deferred, or #f if observers are not being deferred. +(define module-defer-observers (make-parameter #f)) + +(define (module-modified m) + (cond + ((module-defer-observers) => (lambda (tab) (hashq-set! tab m #t))) + (else (module-call-observers m)))) + +;;; This function can be used to delay calls to observers so that they +;;; can be called once only in the face of massive updating of modules. +;;; +(define (call-with-deferred-observers thunk) + (cond + ((module-defer-observers) (thunk)) + (else + (let ((modules (make-hash-table))) + (dynamic-wind (lambda () #t) + (lambda () + (parameterize ((module-defer-observers modules)) + (thunk))) + (lambda () + (let ((changed (hash-map->list cons modules))) + (hash-clear! modules) + (for-each (lambda (pair) + (module-call-observers (car pair))) + changed)))))))) + +(define (module-call-observers m) + (for-each (lambda (proc) (proc m)) (module-observers m)) + + ;; We assume that weak observers don't (un)register themselves as they are + ;; called since this would preclude proper iteration over the hash table + ;; elements. + (hash-for-each (lambda (id proc) (proc m)) (module-weak-observers m))) + + + +;;; {Module Searching in General} +;;; +;;; We sometimes want to look for properties of a symbol +;;; just within the obarray of one module. If the property +;;; holds, then it is said to hold ``locally'' as in, ``The symbol +;;; DISPLAY is locally rebound in the module `safe-guile'.'' +;;; +;;; +;;; Other times, we want to test for a symbol property in the obarray +;;; of M and, if it is not found there, try each of the modules in the +;;; uses list of M. This is the normal way of testing for some +;;; property, so we state these properties without qualification as +;;; in: ``The symbol 'fnord is interned in module M because it is +;;; interned locally in module M2 which is a member of the uses list +;;; of M.'' +;;; + +(define (module-search fn m v) + "Return the first non-#f result of FN applied to M and then to +the modules in the uses of M, and so on recursively. If all applications +return #f, then so does this function." + (define (loop pos) + (and (pair? pos) + (or (module-search fn (car pos) v) + (loop (cdr pos))))) + (or (fn m v) + (loop (module-uses m)))) + + +;;; {Is a symbol bound in a module?} +;;; +;;; Symbol S in Module M is bound if S is interned in M and if the binding +;;; of S in M has been set to some well-defined value. +;;; + +(define (module-locally-bound? m v) + "Is symbol V bound (interned and defined) locally in module M?" + (let ((var (module-local-variable m v))) + (and var + (variable-bound? var)))) + +(define (module-bound? m v) + "Is symbol V bound (interned and defined) anywhere in module M or its +uses?" + (let ((var (module-variable m v))) + (and var + (variable-bound? var)))) + +;;; {Is a symbol interned in a module?} +;;; +;;; Symbol S in Module M is interned if S occurs in +;;; of S in M has been set to some well-defined value. +;;; +;;; It is possible to intern a symbol in a module without providing +;;; an initial binding for the corresponding variable. This is done +;;; with: +;;; (module-add! module symbol (make-undefined-variable)) +;;; +;;; In that case, the symbol is interned in the module, but not +;;; bound there. The unbound symbol shadows any binding for that +;;; symbol that might otherwise be inherited from a member of the uses list. +;;; + +(define (module-obarray-get-handle ob key) + ((if (symbol? key) hashq-get-handle hash-get-handle) ob key)) + +(define (module-obarray-ref ob key) + ((if (symbol? key) hashq-ref hash-ref) ob key)) + +(define (module-obarray-set! ob key val) + ((if (symbol? key) hashq-set! hash-set!) ob key val)) + +(define (module-obarray-remove! ob key) + ((if (symbol? key) hashq-remove! hash-remove!) ob key)) + +(define (module-symbol-locally-interned? m v) + "Is symbol V interned (not neccessarily defined) locally in module M +or its uses? Interned symbols shadow inherited bindings even if they +are not themselves bound to a defined value." + (not (not (module-obarray-get-handle (module-obarray m) v)))) + +(define (module-symbol-interned? m v) + "Is symbol V interned (not neccessarily defined) anywhere in module M +or its uses? Interned symbols shadow inherited bindings even if they +are not themselves bound to a defined value." + (module-search module-symbol-locally-interned? m v)) + + +;;; {Mapping modules x symbols --> variables} +;;; + +;; module-local-variable module symbol +;; return the local variable associated with a MODULE and SYMBOL. +;; +;;; This function is very important. It is the only function that can +;;; return a variable from a module other than the mutators that store +;;; new variables in modules. Therefore, this function is the location +;;; of the "lazy binder" hack. +;;; +;;; If symbol is defined in MODULE, and if the definition binds symbol +;;; to a variable, return that variable object. +;;; +;;; If the symbols is not found at first, but the module has a lazy binder, +;;; then try the binder. +;;; +;;; If the symbol is not found at all, return #f. +;;; +;;; (This is now written in C, see `modules.c'.) +;;; + +;;; {Mapping modules x symbols --> bindings} +;;; +;;; These are similar to the mapping to variables, except that the +;;; variable is dereferenced. +;;; + +(define (module-symbol-local-binding m v . opt-val) + "Return the binding of variable V specified by name within module M, +signalling an error if the variable is unbound. If the OPT-VALUE is +passed, then instead of signalling an error, return OPT-VALUE." + (let ((var (module-local-variable m v))) + (if (and var (variable-bound? var)) + (variable-ref var) + (if (not (null? opt-val)) + (car opt-val) + (error "Locally unbound variable." v))))) + +(define (module-symbol-binding m v . opt-val) + "Return the binding of variable V specified by name within module M, +signalling an error if the variable is unbound. If the OPT-VALUE is +passed, then instead of signalling an error, return OPT-VALUE." + (let ((var (module-variable m v))) + (if (and var (variable-bound? var)) + (variable-ref var) + (if (not (null? opt-val)) + (car opt-val) + (error "Unbound variable." v))))) + + + + +;;; {Adding Variables to Modules} +;;; + +;; This function is used in modules.c. +;; +(define (module-make-local-var! m v) + "Ensure a variable for V in the local namespace of M. +If no variable was already there, then create a new and uninitialized +variable." + (or (let ((b (module-obarray-ref (module-obarray m) v))) + (and (variable? b) + (begin + ;; Mark as modified since this function is called when + ;; the standard eval closure defines a binding + (module-modified m) + b))) + + ;; Create a new local variable. + (let ((local-var (make-undefined-variable))) + (module-add! m v local-var) + local-var))) + +(define (module-ensure-local-variable! module symbol) + "Ensure that there is a local variable in MODULE for SYMBOL. If +there is no binding for SYMBOL, create a new uninitialized +variable. Return the local variable." + (or (module-local-variable module symbol) + (let ((var (make-undefined-variable))) + (module-add! module symbol var) + var))) + +;; module-add! module symbol var +;; +(define (module-add! m v var) + "Ensure a particular variable for V in the local namespace of M." + (if (not (variable? var)) + (error "Bad variable to module-add!" var)) + (if (not (symbol? v)) + (error "Bad symbol to module-add!" v)) + (module-obarray-set! (module-obarray m) v var) + (module-modified m)) + +(define (module-remove! m v) + "Make sure that symbol V is undefined in the local namespace of M." + (module-obarray-remove! (module-obarray m) v) + (module-modified m)) + +(define (module-clear! m) + (hash-clear! (module-obarray m)) + (module-modified m)) + +;; MODULE-FOR-EACH -- exported +;; +(define (module-for-each proc module) + "Call PROC on each symbol in MODULE, with arguments of (SYMBOL VARIABLE)." + (hash-for-each proc (module-obarray module))) + +(define (module-map proc module) + (hash-map->list proc (module-obarray module))) + +;; Submodules +;; +;; Modules exist in a separate namespace from values, because you generally do +;; not want the name of a submodule, which you might not even use, to collide +;; with local variables that happen to be named the same as the submodule. +;; +(define (module-ref-submodule module name) + (or (hashq-ref (module-submodules module) name) + (and (module-submodule-binder module) + ((module-submodule-binder module) module name)))) + +(define (module-define-submodule! module name submodule) + (hashq-set! (module-submodules module) name submodule)) + + + +;;; {Module-based Loading} +;;; + +(define (save-module-excursion thunk) + (let ((inner-module (current-module)) + (outer-module #f)) + (dynamic-wind (lambda () + (set! outer-module (current-module)) + (set-current-module inner-module) + (set! inner-module #f)) + thunk + (lambda () + (set! inner-module (current-module)) + (set-current-module outer-module) + (set! outer-module #f))))) + + + +;;; {MODULE-REF -- exported} +;;; +(define (module-ref module name . rest) + "Returns the value of a variable called NAME in MODULE or any of its +used modules. If there is no such variable, then if the optional third +argument DEFAULT is present, it is returned; otherwise an error is signaled." + (let ((variable (module-variable module name))) + (if (and variable (variable-bound? variable)) + (variable-ref variable) + (if (null? rest) + (error "No variable named" name 'in module) + (car rest) ; default value + )))) + +;; MODULE-SET! -- exported +;; +(define (module-set! module name value) + "Sets the variable called NAME in MODULE (or in a module that MODULE uses) +to VALUE; if there is no such variable, an error is signaled." + (let ((variable (module-variable module name))) + (if variable + (variable-set! variable value) + (error "No variable named" name 'in module)))) + +;; MODULE-DEFINE! -- exported +;; +(define (module-define! module name value) + "Sets the variable called NAME in MODULE to VALUE; if there is no such +variable, it is added first." + (let ((variable (module-local-variable module name))) + (if variable + (begin + (variable-set! variable value) + (module-modified module)) + (let ((variable (make-variable value))) + (module-add! module name variable))))) + +;; MODULE-DEFINED? -- exported +;; +(define (module-defined? module name) + "Return #t iff NAME is defined in MODULE (or in a module that MODULE +uses)." + (let ((variable (module-variable module name))) + (and variable (variable-bound? variable)))) + +(define (module-use! module interface) + "Add INTERFACE to the list of interfaces used by MODULE." + (if (not (or (eq? module interface) + (memq interface (module-uses module)))) + (begin + ;; Newly used modules must be appended rather than consed, so that + ;; `module-variable' traverses the use list starting from the first + ;; used module. + (set-module-uses! module (append (module-uses module) + (list interface))) + (hash-clear! (module-import-obarray module)) + (module-modified module)))) + +(define (module-use-interfaces! module interfaces) + "Same as MODULE-USE!, but only notifies module observers after all +interfaces are added to the inports list." + (let* ((cur (module-uses module)) + (new (let lp ((in interfaces) (out '())) + (if (null? in) + (reverse out) + (lp (cdr in) + (let ((iface (car in))) + (if (or (memq iface cur) (memq iface out)) + out + (cons iface out)))))))) + (set-module-uses! module (append cur new)) + (hash-clear! (module-import-obarray module)) + (module-modified module))) + + + +;;; {Recursive Namespaces} +;;; +;;; A hierarchical namespace emerges if we consider some module to be +;;; root, and submodules of that module to be nested namespaces. +;;; +;;; The routines here manage variable names in hierarchical namespace. +;;; Each variable name is a list of elements, looked up in successively nested +;;; modules. +;;; +;;; (nested-ref some-root-module '(foo bar baz)) +;;; => +;;; +;;; +;;; There are: +;;; +;;; ;; a-root is a module +;;; ;; name is a list of symbols +;;; +;;; nested-ref a-root name +;;; nested-set! a-root name val +;;; nested-define! a-root name val +;;; nested-remove! a-root name +;;; +;;; These functions manipulate values in namespaces. For referencing the +;;; namespaces themselves, use the following: +;;; +;;; nested-ref-module a-root name +;;; nested-define-module! a-root name mod +;;; +;;; (current-module) is a natural choice for a root so for convenience there are +;;; also: +;;; +;;; local-ref name == nested-ref (current-module) name +;;; local-set! name val == nested-set! (current-module) name val +;;; local-define name val == nested-define! (current-module) name val +;;; local-remove name == nested-remove! (current-module) name +;;; local-ref-module name == nested-ref-module (current-module) name +;;; local-define-module! name m == nested-define-module! (current-module) name m +;;; + + +(define (nested-ref root names) + (if (null? names) + root + (let loop ((cur root) + (head (car names)) + (tail (cdr names))) + (if (null? tail) + (module-ref cur head #f) + (let ((cur (module-ref-submodule cur head))) + (and cur + (loop cur (car tail) (cdr tail)))))))) + +(define (nested-set! root names val) + (let loop ((cur root) + (head (car names)) + (tail (cdr names))) + (if (null? tail) + (module-set! cur head val) + (let ((cur (module-ref-submodule cur head))) + (if (not cur) + (error "failed to resolve module" names) + (loop cur (car tail) (cdr tail))))))) + +(define (nested-define! root names val) + (let loop ((cur root) + (head (car names)) + (tail (cdr names))) + (if (null? tail) + (module-define! cur head val) + (let ((cur (module-ref-submodule cur head))) + (if (not cur) + (error "failed to resolve module" names) + (loop cur (car tail) (cdr tail))))))) + +(define (nested-remove! root names) + (let loop ((cur root) + (head (car names)) + (tail (cdr names))) + (if (null? tail) + (module-remove! cur head) + (let ((cur (module-ref-submodule cur head))) + (if (not cur) + (error "failed to resolve module" names) + (loop cur (car tail) (cdr tail))))))) + + +(define (nested-ref-module root names) + (let loop ((cur root) + (names names)) + (if (null? names) + cur + (let ((cur (module-ref-submodule cur (car names)))) + (and cur + (loop cur (cdr names))))))) + +(define (nested-define-module! root names module) + (if (null? names) + (error "can't redefine root module" root module) + (let loop ((cur root) + (head (car names)) + (tail (cdr names))) + (if (null? tail) + (module-define-submodule! cur head module) + (let ((cur (or (module-ref-submodule cur head) + (let ((m (make-module 31))) + (set-module-kind! m 'directory) + (set-module-name! m (append (module-name cur) + (list head))) + (module-define-submodule! cur head m) + m)))) + (loop cur (car tail) (cdr tail))))))) + + +(define (local-ref names) + (nested-ref (current-module) names)) + +(define (local-set! names val) + (nested-set! (current-module) names val)) + +(define (local-define names val) + (nested-define! (current-module) names val)) + +(define (local-remove names) + (nested-remove! (current-module) names)) + +(define (local-ref-module names) + (nested-ref-module (current-module) names)) + +(define (local-define-module names mod) + (nested-define-module! (current-module) names mod)) + + + + + +;;; {The (guile) module} +;;; +;;; The standard module, which has the core Guile bindings. Also called the +;;; "root module", as it is imported by many other modules, but it is not +;;; necessarily the root of anything; and indeed, the module named '() might be +;;; better thought of as a root. +;;; + +;; The root module uses the pre-modules-obarray as its obarray. This +;; special obarray accumulates all bindings that have been established +;; before the module system is fully booted. +;; +;; (The obarray continues to be used by code that has been closed over +;; before the module system has been booted.) +;; +(define the-root-module + (let ((m (make-module 0))) + (set-module-obarray! m (%get-pre-modules-obarray)) + (set-module-name! m '(guile)) + + ;; Inherit next-unique-id from preliminary stub of + ;; %module-get-next-unique-id! defined above. + (set-module-next-unique-id! m (module-generate-unique-id! #f)) + + m)) + +;; The root interface is a module that uses the same obarray as the +;; root module. It does not allow new definitions, tho. +;; +(define the-scm-module + (let ((m (make-module 0))) + (set-module-obarray! m (%get-pre-modules-obarray)) + (set-module-name! m '(guile)) + (set-module-kind! m 'interface) + + ;; In Guile 1.8 and earlier M was its own public interface. + (set-module-public-interface! m m) + + m)) + +(set-module-public-interface! the-root-module the-scm-module) + + + +;; Now that we have a root module, even though modules aren't fully booted, +;; expand the definition of resolve-module. +;; +(define (resolve-module name . args) + (if (equal? name '(guile)) + the-root-module + (error "unexpected module to resolve during module boot" name))) + +(define (module-generate-unique-id! m) + (let ((i (module-next-unique-id m))) + (set-module-next-unique-id! m (+ i 1)) + i)) + +;; Cheat. These bindings are needed by modules.c, but we don't want +;; to move their real definition here because that would be unnatural. +;; +(define define-module* #f) +(define process-use-modules #f) +(define module-export! #f) +(define default-duplicate-binding-procedures #f) + +;; This boots the module system. All bindings needed by modules.c +;; must have been defined by now. +;; +(set-current-module the-root-module) + + + + +(define (call-with-module-autoload-lock thunk) + ;; This binding is overridden when (ice-9 threads) is available to + ;; implement a critical section around the call to THUNK. It must be + ;; used anytime 'autoloads-done' and related variables are accessed + ;; and whenever submodules are accessed (via the 'nested-' + ;; procedures.) + (thunk)) + +;; Now that modules are booted, give module-name its final definition. +;; +(define module-name + (let ((accessor (record-accessor module-type 'name))) + (lambda (mod) + (or (accessor mod) + (let ((name (list (gensym)))) + ;; Name MOD and bind it in the module root so that it's visible to + ;; `resolve-module'. This is important as `psyntax' stores module + ;; names and relies on being able to `resolve-module' them. + (set-module-name! mod name) + (call-with-module-autoload-lock + (lambda () + (nested-define-module! (resolve-module '() #f) name mod))) + (accessor mod)))))) + +(define* (module-gensym #:optional (id " mg") (m (current-module))) + "Return a fresh symbol in the context of module M, based on ID (a +string or symbol). As long as M is a valid module, this procedure is +deterministic." + (define (->string number) + (number->string number 16)) + + (if m + (string->symbol + (string-append id "-" + (->string (hash (module-name m) most-positive-fixnum)) + "-" + (->string (module-generate-unique-id! m)))) + (gensym id))) + +(define (make-modules-in module name) + (or (nested-ref-module module name) + (let ((m (make-module 31))) + (set-module-kind! m 'directory) + (set-module-name! m (append (module-name module) name)) + (nested-define-module! module name m) + m))) + +(define (beautify-user-module! module) + (let ((interface (module-public-interface module))) + (if (or (not interface) + (eq? interface module)) + (let ((interface (make-module 31))) + (set-module-name! interface (module-name module)) + (set-module-version! interface (module-version module)) + (set-module-kind! interface 'interface) + (set-module-public-interface! module interface)))) + (if (and (not (memq the-scm-module (module-uses module))) + (not (eq? module the-root-module))) + ;; Import the default set of bindings (from the SCM module) in MODULE. + (module-use! module the-scm-module))) + +(define (version-matches? version-ref target) + (define (sub-versions-match? v-refs t) + (define (sub-version-matches? v-ref t) + (let ((matches? (lambda (v) (sub-version-matches? v t)))) + (cond + ((number? v-ref) (eqv? v-ref t)) + ((list? v-ref) + (case (car v-ref) + ((>=) (>= t (cadr v-ref))) + ((<=) (<= t (cadr v-ref))) + ((and) (and-map matches? (cdr v-ref))) + ((or) (or-map matches? (cdr v-ref))) + ((not) (not (matches? (cadr v-ref)))) + (else (error "Invalid sub-version reference" v-ref)))) + (else (error "Invalid sub-version reference" v-ref))))) + (or (null? v-refs) + (and (not (null? t)) + (sub-version-matches? (car v-refs) (car t)) + (sub-versions-match? (cdr v-refs) (cdr t))))) + + (let ((matches? (lambda (v) (version-matches? v target)))) + (or (null? version-ref) + (case (car version-ref) + ((and) (and-map matches? (cdr version-ref))) + ((or) (or-map matches? (cdr version-ref))) + ((not) (not (matches? (cadr version-ref)))) + (else (sub-versions-match? version-ref target)))))) + +(define (make-fresh-user-module) + (let ((m (make-module))) + (beautify-user-module! m) + m)) + +;; NOTE: This binding is used in libguile/modules.c. +;; +(define resolve-module + (let ((root (make-module))) + (set-module-name! root '()) + ;; Define the-root-module as '(guile). + (module-define-submodule! root 'guile the-root-module) + + (lambda* (name #:optional (autoload #t) (version #f) #:key (ensure #t)) + (call-with-module-autoload-lock + (lambda () + (let ((already (nested-ref-module root name))) + (cond + ((and already + (or (not autoload) (module-public-interface already))) + ;; A hit, a palpable hit. + (if (and version + (not (version-matches? version (module-version already)))) + (error "incompatible module version already loaded" name)) + already) + (autoload + ;; Try to autoload the module, and recurse. + (try-load-module name version) + (resolve-module name #f #:ensure ensure)) + (else + ;; No module found (or if one was, it had no public interface), and + ;; we're not autoloading. Make an empty module if #:ensure is true. + (or already + (and ensure + (make-modules-in root name))))))))))) + + +(define (try-load-module name version) + (try-module-autoload name version)) + +(define (reload-module m) + "Revisit the source file corresponding to the module @var{m}." + (let ((f (module-filename m))) + (if f + (save-module-excursion + (lambda () + ;; Re-set the initial environment, as in try-module-autoload. + (set-current-module (make-fresh-user-module)) + (primitive-load-path f) + m)) + ;; Though we could guess, we *should* know it. + (error "unknown file name for module" m)))) + +(define (purify-module! module) + "Removes bindings in MODULE which are inherited from the (guile) module." + (let ((use-list (module-uses module))) + (if (and (pair? use-list) + (eq? (car (last-pair use-list)) the-scm-module)) + (set-module-uses! module (reverse (cdr (reverse use-list))))))) + +(define* (resolve-interface name #:key + (select #f) + (hide '()) + (prefix #f) + (renamer (if prefix + (symbol-prefix-proc prefix) + identity)) + version) + "Return a module that is an interface to the module designated by +NAME. + +`resolve-interface' takes four keyword arguments: + + #:select SELECTION + +SELECTION is a list of binding-specs to be imported; A binding-spec +is either a symbol or a pair of symbols (ORIG . SEEN), where ORIG +is the name in the used module and SEEN is the name in the using +module. Note that SEEN is also passed through RENAMER, below. The +default is to select all bindings. If you specify no selection but +a renamer, only the bindings that already exist in the used module +are made available in the interface. Bindings that are added later +are not picked up. + + #:hide BINDINGS + +BINDINGS is a list of bindings which should not be imported. + + #:prefix PREFIX + +PREFIX is a symbol that will be appended to each exported name. +The default is to not perform any renaming. + + #:renamer RENAMER + +RENAMER is a procedure that takes a symbol and returns its new +name. The default is not perform any renaming. + +Signal \"no code for module\" error if module name is not resolvable +or its public interface is not available. Signal \"no binding\" +error if selected binding does not exist in the used module." + (let* ((module (resolve-module name #t version #:ensure #f)) + (public-i (and module (module-public-interface module)))) + (unless public-i + (error "no code for module" name)) + (if (and (not select) (null? hide) (eq? renamer identity)) + public-i + (let ((selection (or select (module-map (lambda (sym var) sym) + public-i))) + (custom-i (make-module 31))) + (set-module-kind! custom-i 'custom-interface) + (set-module-name! custom-i name) + ;; XXX - should use a lazy binder so that changes to the + ;; used module are picked up automatically. + (for-each (lambda (bspec) + (let* ((direct? (symbol? bspec)) + (orig (if direct? bspec (car bspec))) + (seen (if direct? bspec (cdr bspec))) + (var (or (module-local-variable public-i orig) + (error + ;; fixme: format manually for now + (simple-format + #f "no binding `~A' in module ~A" + orig name))))) + (if (memq orig hide) + (set! hide (delq! orig hide)) + (module-add! custom-i + (renamer seen) + var)))) + selection) + ;; Check that we are not hiding bindings which don't exist + (for-each (lambda (binding) + (if (not (module-local-variable public-i binding)) + (error + (simple-format + #f "no binding `~A' to hide in module ~A" + binding name)))) + hide) + custom-i)))) + +(define (symbol-prefix-proc prefix) + (lambda (symbol) + (symbol-append prefix symbol))) + +;; This function is called from "modules.c". If you change it, be +;; sure to update "modules.c" as well. + +(define* (define-module* name + #:key filename pure version (imports '()) (exports '()) + (replacements '()) (re-exports '()) (autoloads '()) + (duplicates #f) transformer) + (define (list-of pred l) + (or (null? l) + (and (pair? l) (pred (car l)) (list-of pred (cdr l))))) + (define (valid-import? x) + (list? x)) + (define (valid-export? x) + (or (symbol? x) (and (pair? x) (symbol? (car x)) (symbol? (cdr x))))) + (define (valid-autoload? x) + (and (pair? x) (list-of symbol? (car x)) (list-of symbol? (cdr x)))) + + ;; We could add a #:no-check arg, set by the define-module macro, if + ;; these checks are taking too much time. + ;; + (let ((module (resolve-module name #f))) + (beautify-user-module! module) + (when filename + (set-module-filename! module filename)) + (when pure + (purify-module! module)) + (when version + (unless (list-of integer? version) + (error "expected list of integers for version")) + (set-module-version! module version) + (set-module-version! (module-public-interface module) version)) + (call-with-deferred-observers + (lambda () + (unless (list-of valid-import? imports) + (error "expected imports to be a list of import specifications")) + (unless (list-of valid-export? exports) + (error "expected exports to be a list of symbols or symbol pairs")) + (unless (list-of valid-export? replacements) + (error "expected replacements to be a list of symbols or symbol pairs")) + (unless (list-of valid-export? re-exports) + (error "expected re-exports to be a list of symbols or symbol pairs")) + (module-export! module exports) + (module-replace! module replacements) + (unless (null? imports) + (let ((imports (map (lambda (import-spec) + (apply resolve-interface import-spec)) + imports))) + (module-use-interfaces! module imports))) + (module-re-export! module re-exports) + ;; FIXME: Avoid use of `apply'. + (apply module-autoload! module autoloads) + (let ((duplicates (or duplicates + ;; Avoid stompling a previously installed + ;; duplicates handlers if possible. + (and (not (module-duplicates-handlers module)) + ;; Note: If you change this default, + ;; change it also in + ;; `default-duplicate-binding-procedures'. + '(replace warn-override-core warn last))))) + (when duplicates + (let ((handlers (lookup-duplicates-handlers duplicates))) + (set-module-duplicates-handlers! module handlers)))))) + + (when transformer + (unless (and (pair? transformer) (list-of symbol? transformer)) + (error "expected transformer to be a module name" transformer)) + (let ((iface (resolve-interface transformer)) + (sym (car (last-pair transformer)))) + (set-module-transformer! module (module-ref iface sym)))) + + (run-hook module-defined-hook module) + module)) + +;; `module-defined-hook' is a hook that is run whenever a new module +;; is defined. Its members are called with one argument, the new +;; module. +(define module-defined-hook (make-hook 1)) + + + +;;; {Autoload} +;;; + +(define (make-autoload-interface module name bindings) + (let ((b (lambda (a sym definep) + (false-if-exception + (and (memq sym bindings) + (let ((i (module-public-interface (resolve-module name)))) + (if (not i) + (error "missing interface for module" name)) + (let ((autoload (memq a (module-uses module)))) + ;; Replace autoload-interface with actual interface if + ;; that has not happened yet. + (if (pair? autoload) + (set-car! autoload i))) + (module-local-variable i sym))) + #:warning "Failed to autoload ~a in ~a:\n" sym name)))) + (module-constructor (make-hash-table 0) '() b #f #f name 'autoload #f + (make-hash-table 0) '() (make-weak-value-hash-table 31) #f + (make-hash-table 0) #f #f #f 0))) + +(define (module-autoload! module . args) + "Have @var{module} automatically load the module named @var{name} when one +of the symbols listed in @var{bindings} is looked up. @var{args} should be a +list of module-name/binding-list pairs, e.g., as in @code{(module-autoload! +module '(ice-9 q) '(make-q q-length))}." + (let loop ((args args)) + (cond ((null? args) + #t) + ((null? (cdr args)) + (error "invalid name+binding autoload list" args)) + (else + (let ((name (car args)) + (bindings (cadr args))) + (module-use! module (make-autoload-interface module + name bindings)) + (loop (cddr args))))))) + + + + +;;; {Autoloading modules} +;;; + +(define autoloads-in-progress '()) + +;; This function is called from scm_load_scheme_module in +;; "deprecated.c". Please do not change its interface. +;; +(define* (try-module-autoload module-name #:optional version) + "Try to load a module of the given name. If it is not found, return +#f. Otherwise return #t. May raise an exception if a file is found, +but it fails to load." + (let* ((reverse-name (reverse module-name)) + (name (symbol->string (car reverse-name))) + (dir-hint-module-name (reverse (cdr reverse-name))) + (dir-hint (apply string-append + (map (lambda (elt) + (string-append (symbol->string elt) + file-name-separator-string)) + dir-hint-module-name)))) + (resolve-module dir-hint-module-name #f) + + (call-with-module-autoload-lock + (lambda () + (and (not (autoload-done-or-in-progress? dir-hint name)) + (let ((didit #f)) + (dynamic-wind + (lambda () (autoload-in-progress! dir-hint name)) + (lambda () + (with-fluids ((current-reader #f)) + (save-module-excursion + (lambda () + (define (call/ec proc) + (let ((tag (make-prompt-tag))) + (call-with-prompt + tag + (lambda () + (proc (lambda () (abort-to-prompt tag)))) + (lambda (k) (values))))) + ;; The initial environment when loading a module is a fresh + ;; user module. + (set-current-module (make-fresh-user-module)) + ;; Here we could allow some other search strategy (other than + ;; primitive-load-path), for example using versions encoded + ;; into the file system -- but then we would have to figure + ;; out how to locate the compiled file, do auto-compilation, + ;; etc. Punt for now, and don't use versions when locating + ;; the file. + (call/ec + (lambda (abort) + (primitive-load-path (in-vicinity dir-hint name) + abort) + (set! didit #t))))))) + (lambda () (set-autoloaded! dir-hint name didit))) + didit)))))) + + + +;;; {Dynamic linking of modules} +;;; + +(define autoloads-done '((guile . guile))) + +(define (autoload-done-or-in-progress? p m) + (let ((n (cons p m))) + (->bool (or (member n autoloads-done) + (member n autoloads-in-progress))))) + +(define (autoload-done! p m) + (let ((n (cons p m))) + (set! autoloads-in-progress + (delete! n autoloads-in-progress)) + (or (member n autoloads-done) + (set! autoloads-done (cons n autoloads-done))))) + +(define (autoload-in-progress! p m) + (let ((n (cons p m))) + (set! autoloads-done + (delete! n autoloads-done)) + (set! autoloads-in-progress (cons n autoloads-in-progress)))) + +(define (set-autoloaded! p m done?) + (if done? + (autoload-done! p m) + (let ((n (cons p m))) + (set! autoloads-done (delete! n autoloads-done)) + (set! autoloads-in-progress (delete! n autoloads-in-progress))))) + + + +;;; {Run-time options} +;;; + +(define-syntax define-option-interface + (syntax-rules () + ((_ (interface (options enable disable) (option-set!))) + (begin + (define options + (case-lambda + (() (interface)) + ((arg) + (if (list? arg) + (begin (interface arg) (interface)) + (for-each + (lambda (option) + (apply (lambda (name value documentation) + (display name) + (let ((len (string-length (symbol->string name)))) + (when (< len 16) + (display #\tab) + (when (< len 8) + (display #\tab)))) + (display #\tab) + (display value) + (display #\tab) + (display documentation) + (newline)) + option)) + (interface #t)))))) + (define (enable . flags) + (interface (append flags (interface))) + (interface)) + (define (disable . flags) + (let ((options (interface))) + (for-each (lambda (flag) (set! options (delq! flag options))) + flags) + (interface options) + (interface))) + (define-syntax-rule (option-set! opt val) + (eval-when (expand load eval) + (options (append (options) (list 'opt val))))))))) + +(define-option-interface + (debug-options-interface + (debug-options debug-enable debug-disable) + (debug-set!))) + +(define-option-interface + (read-options-interface + (read-options read-enable read-disable) + (read-set!))) + +(define-option-interface + (print-options-interface + (print-options print-enable print-disable) + (print-set!))) + + + +;;; {The Unspecified Value} +;;; +;;; Currently Guile represents unspecified values via one particular value, +;;; which may be obtained by evaluating (if #f #f). It would be nice in the +;;; future if we could replace this with a return of 0 values, though. +;;; + +(define-syntax *unspecified* + (identifier-syntax (if #f #f))) + +(define (unspecified? v) (eq? v *unspecified*)) + + + + +;;; {Running Repls} +;;; + +(define *repl-stack* (make-fluid '())) + +;; Programs can call `batch-mode?' to see if they are running as part of a +;; script or if they are running interactively. REPL implementations ensure that +;; `batch-mode?' returns #f during their extent. +;; +(define (batch-mode?) + (null? (fluid-ref *repl-stack*))) + +;; Programs can re-enter batch mode, for example after a fork, by calling +;; `ensure-batch-mode!'. It's not a great interface, though; it would be better +;; to abort to the outermost prompt, and call a thunk there. +;; +(define (ensure-batch-mode!) + (set! batch-mode? (lambda () #t))) + +(define (quit . args) + (apply throw 'quit args)) + +(define exit quit) + +(define (gc-run-time) + (cdr (assq 'gc-time-taken (gc-stats)))) + +(define abort-hook (make-hook)) +(define before-error-hook (make-hook)) +(define after-error-hook (make-hook)) +(define before-backtrace-hook (make-hook)) +(define after-backtrace-hook (make-hook)) + +(define before-read-hook (make-hook)) +(define after-read-hook (make-hook)) +(define before-eval-hook (make-hook 1)) +(define after-eval-hook (make-hook 1)) +(define before-print-hook (make-hook 1)) +(define after-print-hook (make-hook 1)) + +;;; This hook is run at the very end of an interactive session. +;;; +(define exit-hook (make-hook)) + +;;; The default repl-reader function. We may override this if we've +;;; the readline library. +(define repl-reader + (lambda* (prompt #:optional (reader (fluid-ref current-reader))) + (if (not (char-ready?)) + (begin + (display (if (string? prompt) prompt (prompt))) + ;; An interesting situation. The printer resets the column to + ;; 0 by printing a newline, but we then advance it by printing + ;; the prompt. However the port-column of the output port + ;; does not typically correspond with the actual column on the + ;; screen, because the input is echoed back! Since the + ;; input is line-buffered and thus ends with a newline, the + ;; output will really start on column zero. So, here we zero + ;; it out. See bug 9664. + ;; + ;; Note that for similar reasons, the output-line will not + ;; reflect the actual line on the screen. But given the + ;; possibility of multiline input, the fix is not as + ;; straightforward, so we don't bother. + ;; + ;; Also note that the readline implementation papers over + ;; these concerns, because it's readline itself printing the + ;; prompt, and not Guile. + (set-port-column! (current-output-port) 0))) + (force-output) + (run-hook before-read-hook) + ((or reader read) (current-input-port)))) + + + + +;;; {While} +;;; +;;; with `continue' and `break'. +;;; + +;; The inliner will remove the prompts at compile-time if it finds that +;; `continue' or `break' are not used. +;; +(define-syntax while + (lambda (x) + (syntax-case x () + ((while cond body ...) + #`(let ((break-tag (make-prompt-tag "break")) + (continue-tag (make-prompt-tag "continue"))) + (call-with-prompt + break-tag + (lambda () + (define-syntax #,(datum->syntax #'while 'break) + (lambda (x) + (syntax-case x () + ((_ arg (... ...)) + #'(abort-to-prompt break-tag arg (... ...))) + (_ + #'(lambda args + (apply abort-to-prompt break-tag args)))))) + (let lp () + (call-with-prompt + continue-tag + (lambda () + (define-syntax #,(datum->syntax #'while 'continue) + (lambda (x) + (syntax-case x () + ((_) + #'(abort-to-prompt continue-tag)) + ((_ . args) + (syntax-violation 'continue "too many arguments" x)) + (_ + #'(lambda () + (abort-to-prompt continue-tag)))))) + (do () ((not cond) #f) body ...)) + (lambda (k) (lp))))) + (lambda (k . args) + (if (null? args) + #t + (apply values args))))))))) + + + + +;;; {Module System Macros} +;;; + +;; Return a list of expressions that evaluate to the appropriate +;; arguments for resolve-interface according to SPEC. + +(eval-when (expand) + (if (memq 'prefix (read-options)) + (error "boot-9 must be compiled with #:kw, not :kw"))) + +(define (keyword-like-symbol->keyword sym) + (symbol->keyword (string->symbol (substring (symbol->string sym) 1)))) + +(define-syntax define-module + (lambda (x) + (define (keyword-like? stx) + (let ((dat (syntax->datum stx))) + (and (symbol? dat) + (eqv? (string-ref (symbol->string dat) 0) #\:)))) + (define (->keyword sym) + (symbol->keyword (string->symbol (substring (symbol->string sym) 1)))) + + (define (parse-iface args) + (let loop ((in args) (out '())) + (syntax-case in () + (() (reverse! out)) + ;; The user wanted #:foo, but wrote :foo. Fix it. + ((sym . in) (keyword-like? #'sym) + (loop #`(#,(->keyword (syntax->datum #'sym)) . in) out)) + ((kw . in) (not (keyword? (syntax->datum #'kw))) + (syntax-violation 'define-module "expected keyword arg" x #'kw)) + ((#:renamer renamer . in) + (loop #'in (cons* #',renamer #:renamer out))) + ((kw val . in) + (loop #'in (cons* #'val #'kw out)))))) + + (define (parse args imp exp rex rep aut) + ;; Just quote everything except #:use-module and #:use-syntax. We + ;; need to know about all arguments regardless since we want to turn + ;; symbols that look like keywords into real keywords, and the + ;; keyword args in a define-module form are not regular + ;; (i.e. no-backtrace doesn't take a value). + (syntax-case args () + (() + (let ((imp (if (null? imp) '() #`(#:imports `#,imp))) + (exp (if (null? exp) '() #`(#:exports '#,exp))) + (rex (if (null? rex) '() #`(#:re-exports '#,rex))) + (rep (if (null? rep) '() #`(#:replacements '#,rep))) + (aut (if (null? aut) '() #`(#:autoloads '#,aut)))) + #`(#,@imp #,@exp #,@rex #,@rep #,@aut))) + ;; The user wanted #:foo, but wrote :foo. Fix it. + ((sym . args) (keyword-like? #'sym) + (parse #`(#,(->keyword (syntax->datum #'sym)) . args) + imp exp rex rep aut)) + ((kw . args) (not (keyword? (syntax->datum #'kw))) + (syntax-violation 'define-module "expected keyword arg" x #'kw)) + ((#:no-backtrace . args) + ;; Ignore this one. + (parse #'args imp exp rex rep aut)) + ((#:pure . args) + #`(#:pure #t . #,(parse #'args imp exp rex rep aut))) + ((kw) + (syntax-violation 'define-module "keyword arg without value" x #'kw)) + ((#:version (v ...) . args) + #`(#:version '(v ...) . #,(parse #'args imp exp rex rep aut))) + ((#:duplicates (d ...) . args) + #`(#:duplicates '(d ...) . #,(parse #'args imp exp rex rep aut))) + ((#:filename f . args) + #`(#:filename 'f . #,(parse #'args imp exp rex rep aut))) + ((#:use-module (name name* ...) . args) + (and (and-map symbol? (syntax->datum #'(name name* ...)))) + (parse #'args #`(#,@imp ((name name* ...))) exp rex rep aut)) + ((#:use-syntax (name name* ...) . args) + (and (and-map symbol? (syntax->datum #'(name name* ...)))) + #`(#:transformer '(name name* ...) + . #,(parse #'args #`(#,@imp ((name name* ...))) exp rex rep aut))) + ((#:use-module ((name name* ...) arg ...) . args) + (and (and-map symbol? (syntax->datum #'(name name* ...)))) + (parse #'args + #`(#,@imp ((name name* ...) #,@(parse-iface #'(arg ...)))) + exp rex rep aut)) + ((#:export (ex ...) . args) + (parse #'args imp #`(#,@exp ex ...) rex rep aut)) + ((#:export-syntax (ex ...) . args) + (parse #'args imp #`(#,@exp ex ...) rex rep aut)) + ((#:re-export (re ...) . args) + (parse #'args imp exp #`(#,@rex re ...) rep aut)) + ((#:re-export-syntax (re ...) . args) + (parse #'args imp exp #`(#,@rex re ...) rep aut)) + ((#:replace (r ...) . args) + (parse #'args imp exp rex #`(#,@rep r ...) aut)) + ((#:replace-syntax (r ...) . args) + (parse #'args imp exp rex #`(#,@rep r ...) aut)) + ((#:autoload name bindings . args) + (parse #'args imp exp rex rep #`(#,@aut name bindings))) + ((kw val . args) + (syntax-violation 'define-module "unknown keyword or bad argument" + #'kw #'val)))) + + (syntax-case x () + ((_ (name name* ...) arg ...) + (and-map symbol? (syntax->datum #'(name name* ...))) + (with-syntax (((quoted-arg ...) + (parse #'(arg ...) '() '() '() '() '())) + ;; Ideally the filename is either a string or #f; + ;; this hack is to work around a case in which + ;; port-filename returns a symbol (`socket') for + ;; sockets. + (filename (let ((f (assq-ref (or (syntax-source x) '()) + 'filename))) + (and (string? f) f)))) + #'(eval-when (expand load eval) + (let ((m (define-module* '(name name* ...) + #:filename filename quoted-arg ...))) + (set-current-module m) + m))))))) + +;; The guts of the use-modules macro. Add the interfaces of the named +;; modules to the use-list of the current module, in order. + +;; This function is called by "modules.c". If you change it, be sure +;; to change scm_c_use_module as well. + +(define (process-use-modules module-interface-args) + (let ((interfaces (map (lambda (mif-args) + (or (apply resolve-interface mif-args) + (error "no such module" mif-args))) + module-interface-args))) + (call-with-deferred-observers + (lambda () + (module-use-interfaces! (current-module) interfaces))))) + +(define-syntax use-modules + (lambda (x) + (define (keyword-like? stx) + (let ((dat (syntax->datum stx))) + (and (symbol? dat) + (eqv? (string-ref (symbol->string dat) 0) #\:)))) + (define (->keyword sym) + (symbol->keyword (string->symbol (substring (symbol->string sym) 1)))) + + (define (quotify-iface args) + (let loop ((in args) (out '())) + (syntax-case in () + (() (reverse! out)) + ;; The user wanted #:foo, but wrote :foo. Fix it. + ((sym . in) (keyword-like? #'sym) + (loop #`(#,(->keyword (syntax->datum #'sym)) . in) out)) + ((kw . in) (not (keyword? (syntax->datum #'kw))) + (syntax-violation 'define-module "expected keyword arg" x #'kw)) + ((#:renamer renamer . in) + (loop #'in (cons* #'renamer #:renamer out))) + ((kw val . in) + (loop #'in (cons* #''val #'kw out)))))) + + (define (quotify specs) + (let lp ((in specs) (out '())) + (syntax-case in () + (() (reverse out)) + (((name name* ...) . in) + (and-map symbol? (syntax->datum #'(name name* ...))) + (lp #'in (cons #''((name name* ...)) out))) + ((((name name* ...) arg ...) . in) + (and-map symbol? (syntax->datum #'(name name* ...))) + (with-syntax (((quoted-arg ...) (quotify-iface #'(arg ...)))) + (lp #'in (cons #`(list '(name name* ...) quoted-arg ...) + out))))))) + + (syntax-case x () + ((_ spec ...) + (with-syntax (((quoted-args ...) (quotify #'(spec ...)))) + #'(eval-when (expand load eval) + (process-use-modules (list quoted-args ...)) + *unspecified*)))))) + +(include-from-path "ice-9/r6rs-libraries") + +(define-syntax-rule (define-private foo bar) + (define foo bar)) + +(define-syntax define-public + (syntax-rules () + ((_ (name . args) . body) + (begin + (define (name . args) . body) + (export name))) + ((_ name val) + (begin + (define name val) + (export name))))) + +(define-syntax-rule (defmacro-public name args body ...) + (begin + (defmacro name args body ...) + (export-syntax name))) + +;; And now for the most important macro. +(define-syntax-rule (λ formals body ...) + (lambda formals body ...)) + + +;; This function is called from "modules.c". If you change it, be +;; sure to update "modules.c" as well. + +(define (module-export! m names) + "Export a local variable." + (let ((public-i (module-public-interface m))) + (for-each (lambda (name) + (let* ((internal-name (if (pair? name) (car name) name)) + (external-name (if (pair? name) (cdr name) name)) + (var (module-ensure-local-variable! m internal-name))) + (module-add! public-i external-name var))) + names))) + +(define (module-replace! m names) + (let ((public-i (module-public-interface m))) + (for-each (lambda (name) + (let* ((internal-name (if (pair? name) (car name) name)) + (external-name (if (pair? name) (cdr name) name)) + (var (module-ensure-local-variable! m internal-name))) + ;; FIXME: use a bit on variables instead of object + ;; properties. + (set-object-property! var 'replace #t) + (module-add! public-i external-name var))) + names))) + +(define (module-export-all! mod) + "Export all local variables from a module." + (define (fresh-interface!) + (let ((iface (make-module))) + (set-module-name! iface (module-name mod)) + (set-module-version! iface (module-version mod)) + (set-module-kind! iface 'interface) + (set-module-public-interface! mod iface) + iface)) + (let ((iface (or (module-public-interface mod) + (fresh-interface!)))) + (set-module-obarray! iface (module-obarray mod)))) + +(define (module-re-export! m names) + "Re-export an imported variable." + (let ((public-i (module-public-interface m))) + (for-each (lambda (name) + (let* ((internal-name (if (pair? name) (car name) name)) + (external-name (if (pair? name) (cdr name) name)) + (var (module-variable m internal-name))) + (cond ((not var) + (error "Undefined variable:" internal-name)) + ((eq? var (module-local-variable m internal-name)) + (error "re-exporting local variable:" internal-name)) + (else + (module-add! public-i external-name var))))) + names))) + +(define-syntax-rule (export name ...) + (eval-when (expand load eval) + (call-with-deferred-observers + (lambda () + (module-export! (current-module) '(name ...)))))) + +(define-syntax-rule (re-export name ...) + (eval-when (expand load eval) + (call-with-deferred-observers + (lambda () + (module-re-export! (current-module) '(name ...)))))) + +(define-syntax-rule (export! name ...) + (eval-when (expand load eval) + (call-with-deferred-observers + (lambda () + (module-replace! (current-module) '(name ...)))))) + +(define-syntax-rule (export-syntax name ...) + (export name ...)) + +(define-syntax-rule (re-export-syntax name ...) + (re-export name ...)) + + + +;;; {Parameters} +;;; + +(define* (make-mutable-parameter init #:optional (converter identity)) + (let ((fluid (make-fluid (converter init)))) + (case-lambda + (() (fluid-ref fluid)) + ((val) (fluid-set! fluid (converter val)))))) + + + + +;;; {Handling of duplicate imported bindings} +;;; + +;; Duplicate handlers take the following arguments: +;; +;; module importing module +;; name conflicting name +;; int1 old interface where name occurs +;; val1 value of binding in old interface +;; int2 new interface where name occurs +;; val2 value of binding in new interface +;; var previous resolution or #f +;; val value of previous resolution +;; +;; A duplicate handler can take three alternative actions: +;; +;; 1. return #f => leave responsibility to next handler +;; 2. exit with an error +;; 3. return a variable resolving the conflict +;; + +(define duplicate-handlers + (let ((m (make-module 7))) + + (define (check module name int1 val1 int2 val2 var val) + (scm-error 'misc-error + #f + "~A: `~A' imported from both ~A and ~A" + (list (module-name module) + name + (module-name int1) + (module-name int2)) + #f)) + + (define (warn module name int1 val1 int2 val2 var val) + (format (current-warning-port) + "WARNING: ~A: `~A' imported from both ~A and ~A\n" + (module-name module) + name + (module-name int1) + (module-name int2)) + #f) + + (define (replace module name int1 val1 int2 val2 var val) + (let ((old (or (and var (object-property var 'replace) var) + (module-variable int1 name))) + (new (module-variable int2 name))) + (if (object-property old 'replace) + (and (or (eq? old new) + (not (object-property new 'replace))) + old) + (and (object-property new 'replace) + new)))) + + (define (warn-override-core module name int1 val1 int2 val2 var val) + (and (eq? int1 the-scm-module) + (begin + (format (current-warning-port) + "WARNING: ~A: imported module ~A overrides core binding `~A'\n" + (module-name module) + (module-name int2) + name) + (module-local-variable int2 name)))) + + (define (first module name int1 val1 int2 val2 var val) + (or var (module-local-variable int1 name))) + + (define (last module name int1 val1 int2 val2 var val) + (module-local-variable int2 name)) + + (define (noop module name int1 val1 int2 val2 var val) + #f) + + (set-module-name! m 'duplicate-handlers) + (set-module-kind! m 'interface) + (module-define! m 'check check) + (module-define! m 'warn warn) + (module-define! m 'replace replace) + (module-define! m 'warn-override-core warn-override-core) + (module-define! m 'first first) + (module-define! m 'last last) + (module-define! m 'merge-generics noop) + (module-define! m 'merge-accessors noop) + m)) + +(define (lookup-duplicates-handlers handler-names) + (and handler-names + (map (lambda (handler-name) + (or (module-symbol-local-binding + duplicate-handlers handler-name #f) + (error "invalid duplicate handler name:" + handler-name))) + (if (list? handler-names) + handler-names + (list handler-names))))) + +(define default-duplicate-binding-procedures + (case-lambda + (() + (or (module-duplicates-handlers (current-module)) + ;; Note: If you change this default, change it also in + ;; `define-module*'. + (lookup-duplicates-handlers + '(replace warn-override-core warn last)))) + ((procs) + (set-module-duplicates-handlers! (current-module) procs)))) + +(define default-duplicate-binding-handler + (case-lambda + (() + (map procedure-name (default-duplicate-binding-procedures))) + ((handlers) + (default-duplicate-binding-procedures + (lookup-duplicates-handlers handlers))))) + + + +;;; {`load'.} +;;; +;;; Load is tricky when combined with relative file names, compilation, +;;; and the file system. If a file name is relative, what is it +;;; relative to? The name of the source file at the time it was +;;; compiled? The name of the compiled file? What if both or either +;;; were installed? And how do you get that information? Tricky, I +;;; say. +;;; +;;; To get around all of this, we're going to do something nasty, and +;;; turn `load' into a macro. That way it can know the name of the +;;; source file with respect to which it was invoked, so it can resolve +;;; relative file names with respect to the original source file. +;;; +;;; There is an exception, and that is that if the source file was in +;;; the load path when it was compiled, instead of looking up against +;;; the absolute source location, we load-from-path against the relative +;;; source location. +;;; + +(define %auto-compilation-options + ;; Default `compile-file' option when auto-compiling. + '(#:warnings (unbound-variable shadowed-toplevel + macro-use-before-definition arity-mismatch + format duplicate-case-datum bad-case-datum))) + +(define* (load-in-vicinity dir file-name #:optional reader) + "Load source file FILE-NAME in vicinity of directory DIR. Use a +pre-compiled version of FILE-NAME when available, and auto-compile one +when none is available, reading FILE-NAME with READER." + + ;; The auto-compilation code will residualize a .go file in the cache + ;; dir: by default, $HOME/.cache/guile/2.0/ccache/PATH.go. This + ;; function determines the PATH to use as a key into the compilation + ;; cache. + (define (canonical->suffix canon) + (cond + ((and (not (string-null? canon)) + (file-name-separator? (string-ref canon 0))) + canon) + ((and (eq? (system-file-name-convention) 'windows) + (absolute-file-name? canon)) + ;; An absolute file name that doesn't start with a separator + ;; starts with a drive component. Transform the drive component + ;; to a file name element: c:\foo -> \c\foo. + (string-append file-name-separator-string + (substring canon 0 1) + (substring canon 2))) + (else canon))) + + (define compiled-extension + ;; File name extension of compiled files. + (cond ((or (null? %load-compiled-extensions) + (string-null? (car %load-compiled-extensions))) + (warn "invalid %load-compiled-extensions" + %load-compiled-extensions) + ".go") + (else (car %load-compiled-extensions)))) + + (define (more-recent? stat1 stat2) + ;; Return #t when STAT1 has an mtime greater than that of STAT2. + (or (> (stat:mtime stat1) (stat:mtime stat2)) + (and (= (stat:mtime stat1) (stat:mtime stat2)) + (>= (stat:mtimensec stat1) + (stat:mtimensec stat2))))) + + (define (fallback-file-name canon-file-name) + ;; Return the in-cache compiled file name for source file + ;; CANON-FILE-NAME. + + ;; FIXME: would probably be better just to append + ;; SHA1(canon-file-name) to the %compile-fallback-path, to avoid + ;; deep directory stats. + (and %compile-fallback-path + (string-append %compile-fallback-path + (canonical->suffix canon-file-name) + compiled-extension))) + + (define (compile file) + ;; Compile source FILE, lazily loading the compiler. + ((module-ref (resolve-interface '(system base compile)) + 'compile-file) + file + #:opts %auto-compilation-options + #:env (current-module))) + + (define (load-thunk-from-file file) + (let ((loader (resolve-interface '(system vm loader)))) + ((module-ref loader 'load-thunk-from-file) file))) + + ;; Returns a thunk loaded from the .go file corresponding to `name'. + ;; Does not search load paths, only the fallback path. If the .go + ;; file is missing or out of date, and auto-compilation is enabled, + ;; will try auto-compilation, just as primitive-load-path does + ;; internally. primitive-load is unaffected. Returns #f if + ;; auto-compilation failed or was disabled. + ;; + ;; NB: Unless we need to compile the file, this function should not + ;; cause (system base compile) to be loaded up. For that reason + ;; compiled-file-name partially duplicates functionality from (system + ;; base compile). + + (define (fresh-compiled-thunk name scmstat go-file-name) + ;; Return GO-FILE-NAME after making sure that it contains a freshly + ;; compiled version of source file NAME with stat SCMSTAT; return #f + ;; on failure. + (false-if-exception + (let ((gostat (and (not %fresh-auto-compile) + (stat go-file-name #f)))) + (if (and gostat (more-recent? gostat scmstat)) + (load-thunk-from-file go-file-name) + (begin + (when gostat + (format (current-warning-port) + ";;; note: source file ~a\n;;; newer than compiled ~a\n" + name go-file-name)) + (cond + (%load-should-auto-compile + (%warn-auto-compilation-enabled) + (format (current-warning-port) ";;; compiling ~a\n" name) + (let ((cfn (compile name))) + (format (current-warning-port) ";;; compiled ~a\n" cfn) + (load-thunk-from-file cfn))) + (else #f))))) + #:warning "WARNING: compilation of ~a failed:\n" name)) + + (define (sans-extension file) + (let ((dot (string-rindex file #\.))) + (if dot + (substring file 0 dot) + file))) + + (define (load-absolute abs-file-name) + ;; Load from ABS-FILE-NAME, using a compiled file or auto-compiling + ;; if needed. + (define scmstat + (false-if-exception + (stat abs-file-name) + #:warning "Stat of ~a failed:\n" abs-file-name)) + + (define (pre-compiled) + (or-map + (lambda (dir) + (or-map + (lambda (ext) + (let ((candidate (string-append (in-vicinity dir file-name) ext))) + (let ((gostat (stat candidate #f))) + (and gostat + (more-recent? gostat scmstat) + (false-if-exception + (load-thunk-from-file candidate) + #:warning "WARNING: failed to load compiled file ~a:\n" + candidate))))) + %load-compiled-extensions)) + %load-compiled-path)) + + (define (fallback) + (and=> (false-if-exception (canonicalize-path abs-file-name)) + (lambda (canon) + (and=> (fallback-file-name canon) + (lambda (go-file-name) + (fresh-compiled-thunk abs-file-name + scmstat + go-file-name)))))) + + (let ((compiled (and scmstat (or (pre-compiled) (fallback))))) + (if compiled + (begin + (if %load-hook + (%load-hook abs-file-name)) + (compiled)) + (start-stack 'load-stack + (primitive-load abs-file-name))))) + + (save-module-excursion + (lambda () + (with-fluids ((current-reader reader) + (%file-port-name-canonicalization 'relative)) + (cond + ((absolute-file-name? file-name) + (load-absolute file-name)) + ((absolute-file-name? dir) + (load-absolute (in-vicinity dir file-name))) + (else + (load-from-path (in-vicinity dir file-name)))))))) + +(define-syntax load + (make-variable-transformer + (lambda (x) + (let* ((src (syntax-source x)) + (file (and src (assq-ref src 'filename))) + (dir (and (string? file) (dirname file)))) + (syntax-case x () + ((_ arg ...) + #`(load-in-vicinity #,(or dir #'(getcwd)) arg ...)) + (id + (identifier? #'id) + #`(lambda args + (apply load-in-vicinity #,(or dir #'(getcwd)) args)))))))) + + + +;;; {`cond-expand' for SRFI-0 support.} +;;; +;;; This syntactic form expands into different commands or +;;; definitions, depending on the features provided by the Scheme +;;; implementation. +;;; +;;; Syntax: +;;; +;;; +;;; --> (cond-expand +) +;;; | (cond-expand * (else )) +;;; +;;; --> ( *) +;;; +;;; --> +;;; | (and *) +;;; | (or *) +;;; | (not ) +;;; +;;; --> +;;; +;;; Additionally, this implementation provides the +;;; s `guile' and `r5rs', so that programs can +;;; determine the implementation type and the supported standard. +;;; +;;; Remember to update the features list when adding more SRFIs. +;;; + +(define %cond-expand-features + ;; This should contain only features that are present in core Guile, + ;; before loading any modules. Modular features are handled by + ;; placing 'cond-expand-provide' in the relevant module. + '(guile + guile-2 + guile-2.2 + r5rs + srfi-0 ;; cond-expand itself + srfi-4 ;; homogeneous numeric vectors + srfi-6 ;; string ports + srfi-13 ;; string library + srfi-14 ;; character sets + srfi-16 ;; case-lambda + srfi-23 ;; `error` procedure + srfi-30 ;; nested multi-line comments + srfi-39 ;; parameterize + srfi-46 ;; basic syntax-rules extensions + srfi-55 ;; require-extension + srfi-61 ;; general cond clause + srfi-62 ;; s-expression comments + srfi-87 ;; => in case clauses + srfi-105 ;; curly infix expressions + )) + +;; This table maps module public interfaces to the list of features. +;; +(define %cond-expand-table (make-hash-table 31)) + +;; Add one or more features to the `cond-expand' feature list of the +;; module `module'. +;; +(define (cond-expand-provide module features) + (let ((mod (module-public-interface module))) + (and mod + (hashq-set! %cond-expand-table mod + (append (hashq-ref %cond-expand-table mod '()) + features))))) + +(define-syntax cond-expand + (lambda (x) + (define (module-has-feature? mod sym) + (or-map (lambda (mod) + (memq sym (hashq-ref %cond-expand-table mod '()))) + (module-uses mod))) + + (define (condition-matches? condition) + (syntax-case condition (and or not) + ((and c ...) + (and-map condition-matches? #'(c ...))) + ((or c ...) + (or-map condition-matches? #'(c ...))) + ((not c) + (if (condition-matches? #'c) #f #t)) + (c + (identifier? #'c) + (let ((sym (syntax->datum #'c))) + (if (memq sym %cond-expand-features) + #t + (module-has-feature? (current-module) sym)))))) + + (define (match clauses alternate) + (syntax-case clauses () + (((condition form ...) . rest) + (if (condition-matches? #'condition) + #'(begin form ...) + (match #'rest alternate))) + (() (alternate)))) + + (syntax-case x (else) + ((_ clause ... (else form ...)) + (match #'(clause ...) + (lambda () + #'(begin form ...)))) + ((_ clause ...) + (match #'(clause ...) + (lambda () + (syntax-violation 'cond-expand "unfulfilled cond-expand" x))))))) + +;; This procedure gets called from the startup code with a list of +;; numbers, which are the numbers of the SRFIs to be loaded on startup. +;; +(define (use-srfis srfis) + (process-use-modules + (map (lambda (num) + (list (list 'srfi (string->symbol + (string-append "srfi-" (number->string num)))))) + srfis))) + + + +;;; srfi-55: require-extension +;;; + +(define-syntax require-extension + (lambda (x) + (syntax-case x (srfi) + ((_ (srfi n ...)) + (and-map integer? (syntax->datum #'(n ...))) + (with-syntax + (((srfi-n ...) + (map (lambda (n) + (datum->syntax x (symbol-append 'srfi- n))) + (map string->symbol + (map number->string (syntax->datum #'(n ...))))))) + #'(use-modules (srfi srfi-n) ...))) + ((_ (type arg ...)) + (identifier? #'type) + (syntax-violation 'require-extension "Not a recognized extension type" + x))))) + + +;;; Defining transparently inlinable procedures +;;; + +(define-syntax define-inlinable + ;; Define a macro and a procedure such that direct calls are inlined, via + ;; the macro expansion, whereas references in non-call contexts refer to + ;; the procedure. Inspired by the `define-integrable' macro by Dybvig et al. + (lambda (x) + ;; Use a space in the prefix to avoid potential -Wunused-toplevel + ;; warning + (define prefix (string->symbol "% ")) + (define (make-procedure-name name) + (datum->syntax name + (symbol-append prefix (syntax->datum name) + '-procedure))) + + (syntax-case x () + ((_ (name formals ...) body ...) + (identifier? #'name) + (with-syntax ((proc-name (make-procedure-name #'name)) + ((args ...) (generate-temporaries #'(formals ...)))) + #`(begin + (define (proc-name formals ...) + (syntax-parameterize ((name (identifier-syntax proc-name))) + body ...)) + (define-syntax-parameter name + (lambda (x) + (syntax-case x () + ((_ args ...) + #'((syntax-parameterize ((name (identifier-syntax proc-name))) + (lambda (formals ...) + body ...)) + args ...)) + ((_ a (... ...)) + (syntax-violation 'name "Wrong number of arguments" x)) + (_ + (identifier? x) + #'proc-name)))))))))) + + + +(define using-readline? + (let ((using-readline? (make-fluid))) + (make-procedure-with-setter + (lambda () (fluid-ref using-readline?)) + (lambda (v) (fluid-set! using-readline? v))))) + + + +;;; {Deprecated stuff} +;;; + +(begin-deprecated + (module-use! the-scm-module (resolve-interface '(ice-9 deprecated)))) + + + +;;; {Ports} +;;; + +;; Allow code in (guile) to use port bindings. +(module-use! the-root-module (resolve-interface '(ice-9 ports))) +;; Allow users of (guile) to see port bindings. +(module-use! the-scm-module (resolve-interface '(ice-9 ports))) + + + +;;; {Threads} +;;; + +;; Load (ice-9 threads), initializing some internal data structures. +(resolve-interface '(ice-9 threads)) + + + +;;; SRFI-4 in the default environment. FIXME: we should figure out how +;;; to deprecate this. +;;; + +;; FIXME: +(module-use! the-scm-module (resolve-interface '(srfi srfi-4))) + + + +;;; A few identifiers that need to be defined in this file are really +;;; internal implementation details. We shove them off into internal +;;; modules, removing them from the (guile) module. +;;; + +(define-module (system syntax internal)) + +(let () + (define (steal-bindings! from to ids) + (for-each + (lambda (sym) + (let ((v (module-local-variable from sym))) + (module-remove! from sym) + (module-add! to sym v))) + ids) + (module-export! to ids)) + + (steal-bindings! the-root-module (resolve-module '(system syntax internal)) + '(syntax? + syntax-local-binding + %syntax-module + syntax-locally-bound-identifiers + syntax-session-id + make-syntax + syntax-expression + syntax-wrap + syntax-module))) + + + + +;;; Place the user in the guile-user module. +;;; + +;; Set filename to #f to prevent reload. +(define-module (guile-user) + #:autoload (system base compile) (compile compile-file) + #:filename #f) + +;; Remain in the `(guile)' module at compilation-time so that the +;; `-Wunused-toplevel' warning works as expected. +(eval-when (compile) (set-current-module the-root-module)) + +;;; boot-9.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/buffered-input.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/buffered-input.scm new file mode 100644 index 0000000000000000000000000000000000000000..56b1d87cb418690cee2e8050735df9631cdb2872 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/buffered-input.scm @@ -0,0 +1,109 @@ +;;;; buffered-input.scm --- construct a port from a buffered input reader +;;;; +;;;; Copyright (C) 2001, 2006, 2010 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (ice-9 buffered-input) + #:export (make-buffered-input-port + make-line-buffered-input-port + set-buffered-input-continuation?!)) + +;; @code{buffered-input-continuation?} is a property of the ports +;; created by @code{make-line-buffered-input-port} that stores the +;; read continuation flag for each such port. +(define buffered-input-continuation? (make-object-property)) + +(define (set-buffered-input-continuation?! port val) + "Set the read continuation flag for @var{port} to @var{val}. + +See @code{make-buffered-input-port} for the meaning and use of this +flag." + (set! (buffered-input-continuation? port) val)) + +(define (make-buffered-input-port reader) + "Construct a line-buffered input port from the specified @var{reader}. +@var{reader} should be a procedure of one argument that somehow reads +a chunk of input and returns it as a string. + +The port created by @code{make-buffered-input-port} does @emph{not} +interpolate any additional characters between the strings returned by +@var{reader}. + +@var{reader} should take a boolean @var{continuation?} argument. +@var{continuation?} indicates whether @var{reader} is being called to +start a logically new read operation (in which case +@var{continuation?} is @code{#f}) or to continue a read operation for +which some input has already been read (in which case +@var{continuation?} is @code{#t}). Some @var{reader} implementations +use the @var{continuation?} argument to determine what prompt to +display to the user. + +The new/continuation distinction is largely an application-level +concept: @code{set-buffered-input-continuation?!} allows an +application to specify when a read operation is considered to be new. +But note that if there is non-whitespace data already buffered in the +port when a new read operation starts, this data will be read before +the first call to @var{reader}, and so @var{reader} will be called +with @var{continuation?} set to @code{#t}." + (let ((read-string "") + (string-index 0)) + (letrec ((get-character + (lambda () + (if (< string-index (string-length read-string)) + ;; Read a char. + (let ((res (string-ref read-string string-index))) + (set! string-index (+ 1 string-index)) + (if (not (char-whitespace? res)) + (set! (buffered-input-continuation? port) #t)) + res) + ;; Fill the buffer. + (let ((x (reader (buffered-input-continuation? port)))) + (cond + ((eof-object? x) + ;; Don't buffer the EOF object. + x) + (else + (set! read-string x) + (set! string-index 0) + (get-character))))))) + (input-waiting + (lambda () + (- (string-length read-string) string-index))) + (port #f)) + (set! port (make-soft-port (vector #f #f #f get-character #f input-waiting) "r")) + (set! (buffered-input-continuation? port) #f) + port))) + +(define (make-line-buffered-input-port reader) + "Construct a line-buffered input port from the specified @var{reader}. +@var{reader} should be a procedure of one argument that somehow reads +a line of input and returns it as a string @emph{without} the +terminating newline character. + +The port created by @code{make-line-buffered-input-port} automatically +interpolates a newline character after each string returned by +@var{reader}. + +@var{reader} should take a boolean @var{continuation?} argument. For +the meaning and use of this argument, see +@code{make-buffered-input-port}." + (make-buffered-input-port (lambda (continuation?) + (let ((str (reader continuation?))) + (if (eof-object? str) + str + (string-append str "\n")))))) + +;;; buffered-input.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/calling.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/calling.scm new file mode 100644 index 0000000000000000000000000000000000000000..f66bba27e80027a387da9ce2763a2c0016b56f47 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/calling.scm @@ -0,0 +1,326 @@ +;;;; calling.scm --- Calling Conventions +;;;; +;;;; Copyright (C) 1995, 1996, 1997, 2000, 2001, 2006 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 calling) + :export-syntax (with-excursion-function + with-getter-and-setter + with-getter + with-delegating-getter-and-setter + with-excursion-getter-and-setter + with-configuration-getter-and-setter + with-delegating-configuration-getter-and-setter + let-with-configuration-getter-and-setter)) + +;;;; +;;; +;;; This file contains a number of macros that support +;;; common calling conventions. + +;;; +;;; with-excursion-function proc +;;; is an unevaluated list of names that are bound in the caller. +;;; proc is a procedure, called: +;;; (proc excursion) +;;; +;;; excursion is a procedure isolates all changes to +;;; in the dynamic scope of the call to proc. In other words, +;;; the values of are saved when proc is entered, and when +;;; proc returns, those values are restored. Values are also restored +;;; entering and leaving the call to proc non-locally, such as using +;;; call-with-current-continuation, error, or throw. +;;; +(defmacro with-excursion-function (vars proc) + `(,proc ,(excursion-function-syntax vars))) + + + +;;; with-getter-and-setter proc +;;; is an unevaluated list of names that are bound in the caller. +;;; proc is a procedure, called: +;;; (proc getter setter) +;;; +;;; getter and setter are procedures used to access +;;; or modify . +;;; +;;; setter, called with keywords arguments, modifies the named +;;; values. If "foo" and "bar" are among , then: +;;; +;;; (setter :foo 1 :bar 2) +;;; == (set! foo 1 bar 2) +;;; +;;; getter, called with just keywords, returns +;;; a list of the corresponding values. For example, +;;; if "foo" and "bar" are among the , then +;;; +;;; (getter :foo :bar) +;;; => ( ) +;;; +;;; getter, called with no arguments, returns a list of all accepted +;;; keywords and the corresponding values. If "foo" and "bar" are +;;; the *only* , then: +;;; +;;; (getter) +;;; => (:foo :bar ) +;;; +;;; The unusual calling sequence of a getter supports too handy +;;; idioms: +;;; +;;; (apply setter (getter)) ;; save and restore +;;; +;;; (apply-to-args (getter :foo :bar) ;; fetch and bind +;;; (lambda (foo bar) ....)) +;;; +;;; ;; [ "apply-to-args" is just like two-argument "apply" except that it +;;; ;; takes its arguments in a different order. +;;; +;;; +(defmacro with-getter-and-setter (vars proc) + `(,proc ,@ (getter-and-setter-syntax vars))) + +;;; with-getter vars proc +;;; A short-hand for a call to with-getter-and-setter. +;;; The procedure is called: +;;; (proc getter) +;;; +(defmacro with-getter (vars proc) + `(,proc ,(car (getter-and-setter-syntax vars)))) + + +;;; with-delegating-getter-and-setter get-delegate set-delegate proc +;;; Compose getters and setters. +;;; +;;; is an unevaluated list of names that are bound in the caller. +;;; +;;; get-delegate is called by the new getter to extend the set of +;;; gettable variables beyond just +;;; set-delegate is called by the new setter to extend the set of +;;; gettable variables beyond just +;;; +;;; proc is a procedure that is called +;;; (proc getter setter) +;;; +(defmacro with-delegating-getter-and-setter (vars get-delegate set-delegate proc) + `(,proc ,@ (delegating-getter-and-setter-syntax vars get-delegate set-delegate))) + + +;;; with-excursion-getter-and-setter proc +;;; is an unevaluated list of names that are bound in the caller. +;;; proc is called: +;;; +;;; (proc excursion getter setter) +;;; +;;; See also: +;;; with-getter-and-setter +;;; with-excursion-function +;;; +(defmacro with-excursion-getter-and-setter (vars proc) + `(,proc ,(excursion-function-syntax vars) + ,@ (getter-and-setter-syntax vars))) + + +(define (excursion-function-syntax vars) + (let ((saved-value-names (map gensym vars)) + (tmp-var-name (gensym "temp")) + (swap-fn-name (gensym "swap")) + (thunk-name (gensym "thunk"))) + `(lambda (,thunk-name) + (letrec ((,tmp-var-name #f) + (,swap-fn-name + (lambda () ,@ (map (lambda (n sn) + `(begin (set! ,tmp-var-name ,n) + (set! ,n ,sn) + (set! ,sn ,tmp-var-name))) + vars saved-value-names))) + ,@ (map (lambda (sn n) `(,sn ,n)) saved-value-names vars)) + (dynamic-wind + ,swap-fn-name + ,thunk-name + ,swap-fn-name))))) + + +(define (getter-and-setter-syntax vars) + (let ((args-name (gensym "args")) + (an-arg-name (gensym "an-arg")) + (new-val-name (gensym "new-value")) + (loop-name (gensym "loop")) + (kws (map symbol->keyword vars))) + (list `(lambda ,args-name + (let ,loop-name ((,args-name ,args-name)) + (if (null? ,args-name) + ,(if (null? kws) + ''() + `(let ((all-vals (,loop-name ',kws))) + (let ,loop-name ((vals all-vals) + (kws ',kws)) + (if (null? vals) + '() + `(,(car kws) ,(car vals) ,@(,loop-name (cdr vals) (cdr kws))))))) + (map (lambda (,an-arg-name) + (case ,an-arg-name + ,@ (append + (map (lambda (kw v) `((,kw) ,v)) kws vars) + `((else (throw 'bad-get-option ,an-arg-name)))))) + ,args-name)))) + + `(lambda ,args-name + (let ,loop-name ((,args-name ,args-name)) + (or (null? ,args-name) + (null? (cdr ,args-name)) + (let ((,an-arg-name (car ,args-name)) + (,new-val-name (cadr ,args-name))) + (case ,an-arg-name + ,@ (append + (map (lambda (kw v) `((,kw) (set! ,v ,new-val-name))) kws vars) + `((else (throw 'bad-set-option ,an-arg-name))))) + (,loop-name (cddr ,args-name))))))))) + +(define (delegating-getter-and-setter-syntax vars get-delegate set-delegate) + (let ((args-name (gensym "args")) + (an-arg-name (gensym "an-arg")) + (new-val-name (gensym "new-value")) + (loop-name (gensym "loop")) + (kws (map symbol->keyword vars))) + (list `(lambda ,args-name + (let ,loop-name ((,args-name ,args-name)) + (if (null? ,args-name) + (append! + ,(if (null? kws) + ''() + `(let ((all-vals (,loop-name ',kws))) + (let ,loop-name ((vals all-vals) + (kws ',kws)) + (if (null? vals) + '() + `(,(car kws) ,(car vals) ,@(,loop-name (cdr vals) (cdr kws))))))) + (,get-delegate)) + (map (lambda (,an-arg-name) + (case ,an-arg-name + ,@ (append + (map (lambda (kw v) `((,kw) ,v)) kws vars) + `((else (car (,get-delegate ,an-arg-name))))))) + ,args-name)))) + + `(lambda ,args-name + (let ,loop-name ((,args-name ,args-name)) + (or (null? ,args-name) + (null? (cdr ,args-name)) + (let ((,an-arg-name (car ,args-name)) + (,new-val-name (cadr ,args-name))) + (case ,an-arg-name + ,@ (append + (map (lambda (kw v) `((,kw) (set! ,v ,new-val-name))) kws vars) + `((else (,set-delegate ,an-arg-name ,new-val-name))))) + (,loop-name (cddr ,args-name))))))))) + + + + +;;; with-configuration-getter-and-setter proc +;;; +;;; Create a getter and setter that can trigger arbitrary computation. +;;; +;;; is a list of variable specifiers, explained below. +;;; proc is called: +;;; +;;; (proc getter setter) +;;; +;;; Each element of the list is of the form: +;;; +;;; ( getter-hook setter-hook) +;;; +;;; Both hook elements are evaluated; the variable name is not. +;;; Either hook may be #f or procedure. +;;; +;;; A getter hook is a thunk that returns a value for the corresponding +;;; variable. If omitted (#f is passed), the binding of is +;;; returned. +;;; +;;; A setter hook is a procedure of one argument that accepts a new value +;;; for the corresponding variable. If omitted, the binding of +;;; is simply set using set!. +;;; +(defmacro with-configuration-getter-and-setter (vars-etc proc) + `((lambda (simpler-get simpler-set body-proc) + (with-delegating-getter-and-setter () + simpler-get simpler-set body-proc)) + + (lambda (kw) + (case kw + ,@(map (lambda (v) `((,(symbol->keyword (car v))) + ,(cond + ((cadr v) => list) + (else `(list ,(car v)))))) + vars-etc))) + + (lambda (kw new-val) + (case kw + ,@(map (lambda (v) `((,(symbol->keyword (car v))) + ,(cond + ((caddr v) => (lambda (proc) `(,proc new-val))) + (else `(set! ,(car v) new-val))))) + vars-etc))) + + ,proc)) + +(defmacro with-delegating-configuration-getter-and-setter (vars-etc delegate-get delegate-set proc) + `((lambda (simpler-get simpler-set body-proc) + (with-delegating-getter-and-setter () + simpler-get simpler-set body-proc)) + + (lambda (kw) + (case kw + ,@(append! (map (lambda (v) `((,(symbol->keyword (car v))) + ,(cond + ((cadr v) => list) + (else `(list ,(car v)))))) + vars-etc) + `((else (,delegate-get kw)))))) + + (lambda (kw new-val) + (case kw + ,@(append! (map (lambda (v) `((,(symbol->keyword (car v))) + ,(cond + ((caddr v) => (lambda (proc) `(,proc new-val))) + (else `(set! ,(car v) new-val))))) + vars-etc) + `((else (,delegate-set kw new-val)))))) + + ,proc)) + + +;;; let-configuration-getter-and-setter proc +;;; +;;; This procedure is like with-configuration-getter-and-setter (q.v.) +;;; except that each element of is: +;;; +;;; ( initial-value getter-hook setter-hook) +;;; +;;; Unlike with-configuration-getter-and-setter, let-configuration-getter-and-setter +;;; introduces bindings for the variables named in . +;;; It is short-hand for: +;;; +;;; (let (( initial-value-1) +;;; ( initial-value-2) +;;; ...) +;;; (with-configuration-getter-and-setter (( v1-get v1-set) ...) proc)) +;;; +(defmacro let-with-configuration-getter-and-setter (vars-etc proc) + `(let ,(map (lambda (v) `(,(car v) ,(cadr v))) vars-etc) + (with-configuration-getter-and-setter ,(map (lambda (v) `(,(car v) ,(caddr v) ,(cadddr v))) vars-etc) + ,proc))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/channel.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/channel.scm new file mode 100644 index 0000000000000000000000000000000000000000..9c237f5b00c7a16643cf4c0955fa0ee2dc9bffaa --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/channel.scm @@ -0,0 +1,170 @@ +;;; Guile object channel + +;; Copyright (C) 2001, 2006, 2009, 2010 Free Software Foundation, Inc. + +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Commentary: + +;; Now you can use Guile's modules in Emacs Lisp like this: +;; +;; (guile-import current-module) +;; (guile-import module-ref) +;; +;; (setq assq (module-ref (current-module) 'assq)) +;; => ("" %%1%% . "#") +;; +;; (guile-use-modules (ice-9 documentation)) +;; +;; (object-documentation assq) +;; => +;; " - primitive: assq key alist +;; - primitive: assv key alist +;; - primitive: assoc key alist +;; Fetches the entry in ALIST that is associated with KEY. To decide +;; whether the argument KEY matches a particular entry in ALIST, +;; `assq' compares keys with `eq?', `assv' uses `eqv?' and `assoc' +;; uses `equal?'. If KEY cannot be found in ALIST (according to +;; whichever equality predicate is in use), then `#f' is returned. +;; These functions return the entire alist entry found (i.e. both the +;; key and the value)." +;; +;; Probably we can use GTK in Emacs Lisp. Can anybody try it? +;; +;; I have also implemented Guile Scheme mode and Scheme Interaction mode. +;; Just put the following lines in your ~/.emacs: +;; +;; (require 'guile-scheme) +;; (setq initial-major-mode 'scheme-interaction-mode) +;; +;; Currently, the following commands are available: +;; +;; M-TAB guile-scheme-complete-symbol +;; M-C-x guile-scheme-eval-define +;; C-x C-e guile-scheme-eval-last-sexp +;; C-c C-b guile-scheme-eval-buffer +;; C-c C-r guile-scheme-eval-region +;; C-c : guile-scheme-eval-expression +;; +;; I'll write more commands soon, or if you want to hack, please take +;; a look at the following files: +;; +;; guile-core/ice-9/channel.scm ;; object channel +;; guile-core/emacs/guile.el ;; object adapter +;; guile-core/emacs/guile-emacs.scm ;; Guile <-> Emacs channels +;; guile-core/emacs/guile-scheme.el ;; Guile Scheme mode +;; +;; As always, there are more than one bugs ;) + +;;; Code: + +(define-module (ice-9 channel) + :export (make-object-channel + channel-open + channel-print-value + channel-print-token)) + +;;; +;;; Channel type +;;; + +(define channel-type + (make-record-type 'channel '(stdin stdout printer token-module))) + +(define make-channel (record-constructor channel-type)) + +(define (make-object-channel printer) + (make-channel (current-input-port) + (current-output-port) + printer + (make-module))) + +(define channel-stdin (record-accessor channel-type 'stdin)) +(define channel-stdout (record-accessor channel-type 'stdout)) +(define channel-printer (record-accessor channel-type 'printer)) +(define channel-token-module (record-accessor channel-type 'token-module)) + +;;; +;;; Channel +;;; + +(define (channel-open ch) + (let ((stdin (channel-stdin ch)) + (stdout (channel-stdout ch)) + (printer (channel-printer ch)) + (token-module (channel-token-module ch))) + (let loop () + (catch #t + (lambda () + (channel:prompt stdout) + (let ((cmd (read stdin))) + (if (eof-object? cmd) + (throw 'quit) + (case cmd + ((eval) + (module-use! (current-module) token-module) + (printer ch (eval (read stdin) (current-module)))) + ((destroy) + (let ((token (read stdin))) + (if (module-defined? token-module token) + (module-remove! token-module token) + (channel:error stdout "Invalid token: ~S" token)))) + ((quit) + (throw 'quit)) + (else + (channel:error stdout "Unknown command: ~S" cmd))))) + (loop)) + (lambda (key . args) + (case key + ((quit) (throw 'quit)) + (else + (format stdout "exception = ~S\n" + (list key (apply format #f (cadr args) (caddr args)))) + (loop)))))))) + +(define (channel-print-value ch val) + (format (channel-stdout ch) "value = ~S\n" val)) + +(define (channel-print-token ch val) + (let* ((token (symbol-append (gensym "%%") '%%)) + (pair (cons token (object->string val)))) + (format (channel-stdout ch) "token = ~S\n" pair) + (module-define! (channel-token-module ch) token val))) + +(define (channel:prompt port) + (display "channel> " port) + (force-output port)) + +(define (channel:error port msg . args) + (display "ERROR: " port) + (apply format port msg args) + (newline port)) + +;;; +;;; Guile 1.4 compatibility +;;; + +(define guile:eval eval) +(define eval + (if (= (car (procedure-minimum-arity guile:eval)) 1) + (lambda (x e) (guile:eval x e)) + guile:eval)) + +(define object->string + (if (defined? 'object->string) + object->string + (lambda (x) (format #f "~S" x)))) + +;;; channel.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/command-line.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/command-line.scm new file mode 100644 index 0000000000000000000000000000000000000000..7cebd3d1c8d2d5c68d03bebe321f62a667c2c61d --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/command-line.scm @@ -0,0 +1,477 @@ +;;; Parsing Guile's command-line + +;;; Copyright (C) 1994-1998, 2000-2020 Free Software Foundation, Inc. + +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Code: + +;;; +;;; Please be careful not to load up other modules in this file, unless +;;; they are explicitly requested. Loading modules currently imposes a +;;; speed penalty of a few stats, an mmap, and some allocation, which +;;; can range from 1 to 20ms, depending on the state of your disk cache. +;;; Since `compile-shell-switches' is called even for the most transient +;;; of command-line programs, we need to keep it lean. +;;; +;;; Generally speaking, the goal is for Guile to boot and execute simple +;;; expressions like "1" within 20ms or less, measured using system time +;;; from the time of the `guile' invocation to exit. +;;; + +(define-module (ice-9 command-line) + #:autoload (system vm vm) (set-default-vm-engine! set-vm-engine!) + #:export (compile-shell-switches + version-etc + *GPLv3+* + *LGPLv3+* + emit-bug-reporting-address)) + +;; An initial stab at i18n. +(define _ gettext) + +(define *GPLv3+* + (_ "License GPLv3+: GNU GPL version 3 or later . +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law.")) + +(define *LGPLv3+* + (_ "License LGPLv3+: GNU LGPL 3 or later . +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law.")) + +;; Display the --version information in the +;; standard way: command and package names, package version, followed +;; by a short license notice and a list of up to 10 author names. +;; If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of +;; the program. The formats are therefore: +;; PACKAGE VERSION +;; or +;; COMMAND_NAME (PACKAGE) VERSION. +;; +;; Based on the version-etc gnulib module. +;; +(define* (version-etc package version #:key + (port (current-output-port)) + ;; FIXME: authors + (copyright-year 2020) + (copyright-holder "Free Software Foundation, Inc.") + (copyright (format #f "Copyright (C) ~a ~a" + copyright-year copyright-holder)) + (license *GPLv3+*) + command-name + packager packager-version) + (if command-name + (format port "~a (~a) ~a\n" command-name package version) + (format port "~a ~a\n" package version)) + + (if packager + (if packager-version + (format port (_ "Packaged by ~a (~a)\n") packager packager-version) + (format port (_ "Packaged by ~a\n") packager))) + + (display copyright port) + (newline port) + (newline port) + (display license port) + (newline port)) + + +;; Display the usual `Report bugs to' stanza. +;; +(define* (emit-bug-reporting-address package bug-address #:key + (port (current-output-port)) + (url (string-append + "http://www.gnu.org/software/" + package + "/")) + packager packager-bug-address) + (format port (_ "\nReport bugs to: ~a\n") bug-address) + (if (and packager packager-bug-address) + (format port (_ "Report ~a bugs to: ~a\n") packager packager-bug-address)) + (format port (_ "~a home page: <~a>\n") package url) + (format port + (_ "General help using GNU software: \n"))) + +(define *usage* + (_ "Evaluate code with Guile, interactively or from a script. + + [-s] FILE load source code from FILE, and exit + -c EXPR evalute expression EXPR, and exit + -- stop scanning arguments; run interactively + +The above switches stop argument processing, and pass all +remaining arguments as the value of (command-line). +If FILE begins with `-' the -s switch is mandatory. + + -L DIRECTORY add DIRECTORY to the front of the module load path + -C DIRECTORY like -L, but for compiled files + -x EXTENSION add EXTENSION to the front of the load extensions + -l FILE load source code from FILE + -e FUNCTION after reading script, apply FUNCTION to + command line arguments + --language=LANG change language; default: scheme + -ds do -s script at this point + --debug start with the \"debugging\" VM engine + --no-debug start with the normal VM engine (backtraces but + no breakpoints); default is --debug for interactive + use, but not for `-s' and `-c'. + --auto-compile compile source files automatically + --fresh-auto-compile invalidate auto-compilation cache + --no-auto-compile disable automatic source file compilation; + default is to enable auto-compilation of source + files. + --listen[=P] listen on a local port or a path for REPL clients; + if P is not given, the default is local port 37146 + -q inhibit loading of user init file + --use-srfi=LS load SRFI modules for the SRFIs in LS, + which is a list of numbers like \"2,13,14\" + -h, --help display this help and exit + -v, --version display version information and exit + \\ read arguments from following script lines")) + + +(define* (shell-usage name fatal? #:optional fmt . args) + (let ((port (if fatal? + (current-error-port) + (current-output-port)))) + (when fmt + (apply format port fmt args) + (newline port)) + + (format port (_ "Usage: ~a [OPTION]... [FILE]...\n") name) + (display *usage* port) + (newline port) + + (emit-bug-reporting-address + "GNU Guile" "bug-guile@gnu.org" + #:port port + #:url "http://www.gnu.org/software/guile/" + #:packager (assq-ref %guile-build-info 'packager) + #:packager-bug-address + (assq-ref %guile-build-info 'packager-bug-address)) + + (if fatal? + (exit 1)))) + +;; Try to avoid loading (ice-9 eval-string) and (system base compile) if +;; possible. +(define (eval-string/lang str) + (case (current-language) + ((scheme) + (call-with-input-string + str + (lambda (port) + (let lp () + (let ((exp (read port))) + (if (not (eof-object? exp)) + (begin + (eval exp (current-module)) + (lp)))))))) + (else + ((module-ref (resolve-module '(ice-9 eval-string)) 'eval-string) str)))) + +(define (load/lang f) + (case (current-language) + ((scheme) + (load-in-vicinity (getcwd) f)) + (else + ((module-ref (resolve-module '(system base compile)) 'compile-file) + f #:to 'value)))) + +(define* (compile-shell-switches args #:optional (usage-name "guile")) + (let ((arg0 "guile") + (script-cell #f) + (entry-point #f) + (user-load-path '()) + (user-load-compiled-path '()) + (user-extensions '()) + (interactive? #t) + (inhibit-user-init? #f) + (turn-on-debugging? #f) + (turn-off-debugging? #f)) + + (define (error fmt . args) + (apply shell-usage usage-name #t + (string-append "error: " fmt "~%") args)) + + (define (parse args out) + (cond + ((null? args) + (finish args out)) + (else + (let ((arg (car args)) + (args (cdr args))) + (cond + ((not (string-prefix? "-" arg)) ; foo + ;; If we specified the -ds option, script-cell is the cdr of + ;; an expression like (load #f). We replace the car (i.e., + ;; the #f) with the script name. + (set! arg0 arg) + (set! interactive? #f) + (if script-cell + (begin + (set-car! script-cell arg0) + (finish args out)) + (finish args + (cons `((@@ (ice-9 command-line) load/lang) ,arg0) + out)))) + + ((string=? arg "-s") ; foo + (if (null? args) + (error "missing argument to `-s' switch")) + (set! arg0 (car args)) + (set! interactive? #f) + (if script-cell + (begin + (set-car! script-cell arg0) + (finish (cdr args) out)) + (finish (cdr args) + (cons `((@@ (ice-9 command-line) load/lang) ,arg0) + out)))) + + ((string=? arg "-c") ; evaluate expr + (if (null? args) + (error "missing argument to `-c' switch")) + (set! interactive? #f) + (finish (cdr args) + (cons `((@@ (ice-9 command-line) eval-string/lang) + ,(car args)) + out))) + + ((string=? arg "--") ; end args go interactive + (finish args out)) + + ((string=? arg "-l") ; load a file + (if (null? args) + (error "missing argument to `-l' switch")) + (parse (cdr args) + (cons `((@@ (ice-9 command-line) load/lang) ,(car args)) + out))) + + ((string=? arg "-L") ; add to %load-path + (if (null? args) + (error "missing argument to `-L' switch")) + (set! user-load-path (cons (car args) user-load-path)) + (parse (cdr args) + out)) + + ((string=? arg "-C") ; add to %load-compiled-path + (if (null? args) + (error "missing argument to `-C' switch")) + (set! user-load-compiled-path + (cons (car args) user-load-compiled-path)) + (parse (cdr args) + out)) + + ((string=? arg "-x") ; add to %load-extensions + (if (null? args) + (error "missing argument to `-x' switch")) + (set! user-extensions (cons (car args) user-extensions)) + (parse (cdr args) + out)) + + ((string=? arg "-e") ; entry point + (if (null? args) + (error "missing argument to `-e' switch")) + (let* ((port (open-input-string (car args))) + (arg1 (read port)) + (arg2 (read port))) + ;; Recognize syntax of certain versions of guile 1.4 and + ;; transform to (@ MODULE-NAME FUNC). + (set! entry-point + (cond + ((not (eof-object? arg2)) + `(@ ,arg1 ,arg2)) + ((and (pair? arg1) + (not (memq (car arg1) '(@ @@))) + (and-map symbol? arg1)) + `(@ ,arg1 main)) + (else + arg1)))) + (parse (cdr args) + out)) + + ((string-prefix? "--language=" arg) ; language + (parse args + (cons `(current-language + ',(string->symbol + (substring arg (string-length "--language=")))) + out))) + + ((string=? "--language" arg) ; language + (when (null? args) + (error "missing argument to `--language' option")) + (parse (cdr args) + (cons `(current-language ',(string->symbol (car args))) + out))) + + ((string=? arg "-ds") ; do script here + ;; We put a dummy "load" expression, and let the -s put the + ;; filename in. + (when script-cell + (error "the -ds switch may only be specified once")) + (set! script-cell (list #f)) + (parse args + (acons '(@@ (ice-9 command-line) load/lang) + script-cell + out))) + + ((string=? arg "--debug") + (set! turn-on-debugging? #t) + (set! turn-off-debugging? #f) + (parse args out)) + + ((string=? arg "--no-debug") + (set! turn-off-debugging? #t) + (set! turn-on-debugging? #f) + (parse args out)) + + ;; Do auto-compile on/off now, because the form itself might + ;; need this decision. + ((string=? arg "--auto-compile") + (set! %load-should-auto-compile #t) + (parse args out)) + + ((string=? arg "--fresh-auto-compile") + (set! %load-should-auto-compile #t) + (set! %fresh-auto-compile #t) + (parse args out)) + + ((string=? arg "--no-auto-compile") + (set! %load-should-auto-compile #f) + (parse args out)) + + ((string=? arg "-q") ; don't load user init + (set! inhibit-user-init? #t) + (parse args out)) + + ((string-prefix? "--use-srfi=" arg) + (let ((srfis (map (lambda (x) + (let ((n (string->number x))) + (if (and n (exact? n) (integer? n) (>= n 0)) + n + (error "invalid SRFI specification")))) + (string-split (substring arg 11) #\,)))) + (if (null? srfis) + (error "invalid SRFI specification")) + (parse args + (cons `(use-srfis ',srfis) out)))) + + ((string=? arg "--listen") ; start a repl server + (parse args + (cons '((@@ (system repl server) spawn-server)) out))) + + ((string-prefix? "--listen=" arg) ; start a repl server + (parse + args + (cons + (let ((where (substring arg 9))) + (cond + ((string->number where) ; --listen=PORT + => (lambda (port) + (if (and (integer? port) (exact? port) (>= port 0)) + `((@@ (system repl server) spawn-server) + ((@@ (system repl server) make-tcp-server-socket) #:port ,port)) + (error "invalid port for --listen")))) + ((string-prefix? "/" where) ; --listen=/PATH/TO/SOCKET + `((@@ (system repl server) spawn-server) + ((@@ (system repl server) make-unix-domain-server-socket) #:path ,where))) + (else + (error "unknown argument to --listen")))) + out))) + + ((or (string=? arg "-h") (string=? arg "--help")) + (shell-usage usage-name #f) + (exit 0)) + + ((or (string=? arg "-v") (string=? arg "--version")) + (version-etc "GNU Guile" (version) + #:license *LGPLv3+* + #:command-name "guile" + #:packager (assq-ref %guile-build-info 'packager) + #:packager-version + (assq-ref %guile-build-info 'packager-version)) + (exit 0)) + + (else + (error "unrecognized switch ~a" arg))))))) + + (define (finish args out) + ;; Check to make sure the -ds got a -s. + (when (and script-cell (not (car script-cell))) + (error "the `-ds' switch requires the use of `-s' as well")) + + ;; Make any remaining arguments available to the + ;; script/command/whatever. + (set-program-arguments (cons arg0 args)) + + ;; If debugging was requested, or we are interactive and debugging + ;; was not explicitly turned off, use the debug engine. + (if (or turn-on-debugging? + (and interactive? (not turn-off-debugging?))) + (begin + (set-default-vm-engine! 'debug) + (set-vm-engine! 'debug))) + + ;; Return this value. + `(;; It would be nice not to load up (ice-9 control), but the + ;; default-prompt-handler is nontrivial. + (@ (ice-9 control) %) + (begin + ;; If we didn't end with a -c or a -s and didn't supply a -q, load + ;; the user's customization file. + ,@(if (and interactive? (not inhibit-user-init?)) + '((load-user-init)) + '()) + + ;; Use-specified extensions. + ,@(map (lambda (ext) + `(set! %load-extensions (cons ,ext %load-extensions))) + user-extensions) + + ;; Add the user-specified load paths here, so they won't be in + ;; effect during the loading of the user's customization file. + ,@(map (lambda (path) + `(set! %load-path (cons ,path %load-path))) + user-load-path) + ,@(map (lambda (path) + `(set! %load-compiled-path + (cons ,path %load-compiled-path))) + user-load-compiled-path) + + ;; Put accumulated actions in their correct order. + ,@(reverse! out) + + ;; Handle the `-e' switch, if it was specified. + ,@(if entry-point + `((,entry-point (command-line))) + '()) + ,(if interactive? + ;; If we didn't end with a -c or a -s, start the + ;; repl. + '((@ (ice-9 top-repl) top-repl)) + ;; Otherwise, after doing all the other actions + ;; prescribed by the command line, quit. + '(quit))))) + + (if (pair? args) + (begin + (set! arg0 (car args)) + (let ((slash (string-rindex arg0 #\/))) + (set! usage-name + (if slash (substring arg0 (1+ slash)) arg0))) + (parse (cdr args) '())) + (parse args '())))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/common-list.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/common-list.scm new file mode 100644 index 0000000000000000000000000000000000000000..ea1b0f3de9c4d87f885cff1e24fcff1f61907047 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/common-list.scm @@ -0,0 +1,278 @@ +;;;; common-list.scm --- COMMON LISP list functions for Scheme +;;;; +;;;; Copyright (C) 1995, 1996, 1997, 2001, 2006 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +;;; Commentary: + +;; These procedures are exported: +;; (adjoin e l) +;; (union l1 l2) +;; (intersection l1 l2) +;; (set-difference l1 l2) +;; (reduce-init p init l) +;; (reduce p l) +;; (some pred l . rest) +;; (every pred l . rest) +;; (notany pred . ls) +;; (notevery pred . ls) +;; (count-if pred l) +;; (find-if pred l) +;; (member-if pred l) +;; (remove-if pred l) +;; (remove-if-not pred l) +;; (delete-if! pred l) +;; (delete-if-not! pred l) +;; (butlast lst n) +;; (and? . args) +;; (or? . args) +;; (has-duplicates? lst) +;; (pick p l) +;; (pick-mappings p l) +;; (uniq l) +;; +;; See docstrings for each procedure for more info. See also module +;; `(srfi srfi-1)' for a complete list handling library. + +;;; Code: + +(define-module (ice-9 common-list) + :export (adjoin union intersection set-difference reduce-init reduce + some every notany notevery count-if find-if member-if remove-if + remove-if-not delete-if! delete-if-not! butlast and? or? + has-duplicates? pick pick-mappings uniq)) + +;;"comlist.scm" Implementation of COMMON LISP list functions for Scheme +; Copyright (C) 1991, 1993, 1995 Aubrey Jaffer. +; +;Permission to copy this software, to redistribute it, and to use it +;for any purpose is granted, subject to the following restrictions and +;understandings. +; +;1. Any copy made of this software must include this copyright notice +;in full. +; +;2. I have made no warrantee or representation that the operation of +;this software will be error-free, and I am under no obligation to +;provide any services, by way of maintenance, update, or otherwise. +; +;3. In conjunction with products arising from the use of this +;material, there shall be no use of my name in any advertising, +;promotional, or sales literature without prior written consent in +;each case. + +(define (adjoin e l) + "Return list L, possibly with element E added if it is not already in L." + (if (memq e l) l (cons e l))) + +(define (union l1 l2) + "Return a new list that is the union of L1 and L2. +Elements that occur in both lists occur only once in +the result list." + (cond ((null? l1) l2) + ((null? l2) l1) + (else (union (cdr l1) (adjoin (car l1) l2))))) + +(define (intersection l1 l2) + "Return a new list that is the intersection of L1 and L2. +Only elements that occur in both lists occur in the result list." + (if (null? l2) l2 + (let loop ((l1 l1) (result '())) + (cond ((null? l1) (reverse! result)) + ((memv (car l1) l2) (loop (cdr l1) (cons (car l1) result))) + (else (loop (cdr l1) result)))))) + +(define (set-difference l1 l2) + "Return elements from list L1 that are not in list L2." + (let loop ((l1 l1) (result '())) + (cond ((null? l1) (reverse! result)) + ((memv (car l1) l2) (loop (cdr l1) result)) + (else (loop (cdr l1) (cons (car l1) result)))))) + +(define (reduce-init p init l) + "Same as `reduce' except it implicitly inserts INIT at the start of L." + (if (null? l) + init + (reduce-init p (p init (car l)) (cdr l)))) + +(define (reduce p l) + "Combine all the elements of sequence L using a binary operation P. +The combination is left-associative. For example, using +, one can +add up all the elements. `reduce' allows you to apply a function which +accepts only two arguments to more than 2 objects. Functional +programmers usually refer to this as foldl." + (cond ((null? l) l) + ((null? (cdr l)) (car l)) + (else (reduce-init p (car l) (cdr l))))) + +(define (some pred l . rest) + "PRED is a boolean function of as many arguments as there are list +arguments to `some', i.e., L plus any optional arguments. PRED is +applied to successive elements of the list arguments in order. As soon +as one of these applications returns a true value, return that value. +If no application returns a true value, return #f. +All the lists should have the same length." + (cond ((null? rest) + (let mapf ((l l)) + (and (not (null? l)) + (or (pred (car l)) (mapf (cdr l)))))) + (else (let mapf ((l l) (rest rest)) + (and (not (null? l)) + (or (apply pred (car l) (map car rest)) + (mapf (cdr l) (map cdr rest)))))))) + +(define (every pred l . rest) + "Return #t iff every application of PRED to L, etc., returns #t. +Analogous to `some' except it returns #t if every application of +PRED is #t and #f otherwise." + (cond ((null? rest) + (let mapf ((l l)) + (or (null? l) + (and (pred (car l)) (mapf (cdr l)))))) + (else (let mapf ((l l) (rest rest)) + (or (null? l) + (and (apply pred (car l) (map car rest)) + (mapf (cdr l) (map cdr rest)))))))) + +(define (notany pred . ls) + "Return #t iff every application of PRED to L, etc., returns #f. +Analogous to some but returns #t if no application of PRED returns a +true value or #f as soon as any one does." + (not (apply some pred ls))) + +(define (notevery pred . ls) + "Return #t iff there is an application of PRED to L, etc., that returns #f. +Analogous to some but returns #t as soon as an application of PRED returns #f, +or #f otherwise." + (not (apply every pred ls))) + +(define (count-if pred l) + "Return the number of elements in L for which (PRED element) returns true." + (let loop ((n 0) (l l)) + (cond ((null? l) n) + ((pred (car l)) (loop (+ n 1) (cdr l))) + (else (loop n (cdr l)))))) + +(define (find-if pred l) + "Search for the first element in L for which (PRED element) returns true. +If found, return that element, otherwise return #f." + (cond ((null? l) #f) + ((pred (car l)) (car l)) + (else (find-if pred (cdr l))))) + +(define (member-if pred l) + "Return the first sublist of L for whose car PRED is true." + (cond ((null? l) #f) + ((pred (car l)) l) + (else (member-if pred (cdr l))))) + +(define (remove-if pred l) + "Remove all elements from L where (PRED element) is true. +Return everything that's left." + (let loop ((l l) (result '())) + (cond ((null? l) (reverse! result)) + ((pred (car l)) (loop (cdr l) result)) + (else (loop (cdr l) (cons (car l) result)))))) + +(define (remove-if-not pred l) + "Remove all elements from L where (PRED element) is #f. +Return everything that's left." + (let loop ((l l) (result '())) + (cond ((null? l) (reverse! result)) + ((not (pred (car l))) (loop (cdr l) result)) + (else (loop (cdr l) (cons (car l) result)))))) + +(define (delete-if! pred l) + "Destructive version of `remove-if'." + (let delete-if ((l l)) + (cond ((null? l) '()) + ((pred (car l)) (delete-if (cdr l))) + (else + (set-cdr! l (delete-if (cdr l))) + l)))) + +(define (delete-if-not! pred l) + "Destructive version of `remove-if-not'." + (let delete-if-not ((l l)) + (cond ((null? l) '()) + ((not (pred (car l))) (delete-if-not (cdr l))) + (else + (set-cdr! l (delete-if-not (cdr l))) + l)))) + +(define (butlast lst n) + "Return all but the last N elements of LST." + (letrec ((l (- (length lst) n)) + (bl (lambda (lst n) + (cond ((null? lst) lst) + ((positive? n) + (cons (car lst) (bl (cdr lst) (+ -1 n)))) + (else '()))))) + (bl lst (if (negative? n) + (error "negative argument to butlast" n) + l)))) + +(define (and? . args) + "Return #t iff all of ARGS are true." + (cond ((null? args) #t) + ((car args) (apply and? (cdr args))) + (else #f))) + +(define (or? . args) + "Return #t iff any of ARGS is true." + (cond ((null? args) #f) + ((car args) #t) + (else (apply or? (cdr args))))) + +(define (has-duplicates? lst) + "Return #t iff 2 members of LST are equal?, else #f." + (cond ((null? lst) #f) + ((member (car lst) (cdr lst)) #t) + (else (has-duplicates? (cdr lst))))) + +(define (pick p l) + "Apply P to each element of L, returning a list of elts +for which P returns a non-#f value." + (let loop ((s '()) + (l l)) + (cond + ((null? l) s) + ((p (car l)) (loop (cons (car l) s) (cdr l))) + (else (loop s (cdr l)))))) + +(define (pick-mappings p l) + "Apply P to each element of L, returning a list of the +non-#f return values of P." + (let loop ((s '()) + (l l)) + (cond + ((null? l) s) + ((p (car l)) => (lambda (mapping) (loop (cons mapping s) (cdr l)))) + (else (loop s (cdr l)))))) + +(define (uniq l) + "Return a list containing elements of L, with duplicates removed." + (let loop ((acc '()) + (l l)) + (if (null? l) + (reverse! acc) + (loop (if (memq (car l) acc) + acc + (cons (car l) acc)) + (cdr l))))) + +;;; common-list.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/control.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/control.scm new file mode 100644 index 0000000000000000000000000000000000000000..edd184659ec0a9c180939a826ef219fc6935282d --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/control.scm @@ -0,0 +1,110 @@ +;;; Beyond call/cc + +;; Copyright (C) 2010, 2011, 2013 Free Software Foundation, Inc. + +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Code: + +(define-module (ice-9 control) + #:re-export (call-with-prompt abort-to-prompt + default-prompt-tag make-prompt-tag) + #:export (% abort shift reset shift* reset* + call-with-escape-continuation call/ec + let-escape-continuation let/ec + suspendable-continuation?)) + +(load-extension (string-append "libguile-" (effective-version)) + "scm_init_ice_9_control") + +(define (abort . args) + (apply abort-to-prompt (default-prompt-tag) args)) + +(define-syntax % + (syntax-rules () + ((_ expr) + (call-with-prompt (default-prompt-tag) + (lambda () expr) + default-prompt-handler)) + ((_ expr handler) + (call-with-prompt (default-prompt-tag) + (lambda () expr) + handler)) + ((_ tag expr handler) + (call-with-prompt tag + (lambda () expr) + handler)))) + +;; Each prompt tag has a type -- an expected set of arguments, and an unwritten +;; contract of what its handler will do on an abort. In the case of the default +;; prompt tag, we could choose to return values, exit nonlocally, or punt to the +;; user. +;; +;; We choose the latter, by requiring that the user return one value, a +;; procedure, to an abort to the prompt tag. That argument is then invoked with +;; the continuation as an argument, within a reinstated default prompt. In this +;; way the return value(s) from a default prompt are under the user's control. +(define (default-prompt-handler k proc) + (% (default-prompt-tag) + (proc k) + default-prompt-handler)) + +;; Kindly provided by Wolfgang J Moeller , modelled +;; after the ones by Oleg Kiselyov in +;; http://okmij.org/ftp/Scheme/delim-control-n.scm, which are in the +;; public domain, as noted at the top of http://okmij.org/ftp/. +;; +(define-syntax-rule (reset . body) + (call-with-prompt (default-prompt-tag) + (lambda () . body) + (lambda (cont f) (f cont)))) + +(define-syntax-rule (shift var . body) + (abort-to-prompt (default-prompt-tag) + (lambda (cont) + ((lambda (var) (reset . body)) + (lambda vals (reset (apply cont vals))))))) + +(define (reset* thunk) + (reset (thunk))) + +(define (shift* fc) + (shift c (fc c))) + +(define (call-with-escape-continuation proc) + "Call PROC with an escape continuation." + (let ((tag (list 'call/ec))) + (call-with-prompt tag + (lambda () + (proc (lambda args + (apply abort-to-prompt tag args)))) + (lambda (_ . args) + (apply values args))))) + +(define call/ec call-with-escape-continuation) + +(define-syntax-rule (let-escape-continuation k body ...) + "Bind K to an escape continuation within the lexical extent of BODY." + (let ((tag (list 'let/ec))) + (call-with-prompt tag + (lambda () + (let ((k (lambda args + (apply abort-to-prompt tag args)))) + body ...)) + (lambda (_ . results) + (apply values results))))) + +(define-syntax-rule (let/ec k body ...) + (let-escape-continuation k body ...)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/curried-definitions.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/curried-definitions.scm new file mode 100644 index 0000000000000000000000000000000000000000..7545338e3a279d1bfa901fd7687776903bf0da2c --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/curried-definitions.scm @@ -0,0 +1,57 @@ +;;; Copyright (C) 2010, 2013 Free Software Foundation, Inc. +;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (ice-9 curried-definitions) + #:replace ((cdefine . define) + (cdefine* . define*) + define-public + define*-public)) + +(define-syntax cdefine + (syntax-rules () + ((_ (head . rest) body body* ...) + (cdefine head + (lambda rest body body* ...))) + ((_ name val) + (define name val)))) + +(define-syntax cdefine* + (syntax-rules () + ((_ (head . rest) body body* ...) + (cdefine* head + (lambda* rest body body* ...))) + ((_ name val) + (define* name val)))) + +(define-syntax define-public + (syntax-rules () + ((_ (head . rest) body body* ...) + (define-public head + (lambda rest body body* ...))) + ((_ name val) + (begin + (define name val) + (export name))))) + +(define-syntax define*-public + (syntax-rules () + ((_ (head . rest) body body* ...) + (define*-public head + (lambda* rest body body* ...))) + ((_ name val) + (begin + (define* name val) + (export name))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/debug.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/debug.scm new file mode 100644 index 0000000000000000000000000000000000000000..380b045959e1fe162d81ffde8b06334c1d8f5269 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/debug.scm @@ -0,0 +1,25 @@ +;;;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2006, 2010 Free Software Foundation +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; +;;;; The author can be reached at djurfeldt@nada.kth.se +;;;; Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN +;;;; + + +(define-module (ice-9 debug)) + +(issue-deprecation-warning + "(ice-9 debug) is deprecated. Use (system vm trace) for tracing.") diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/deprecated.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/deprecated.scm new file mode 100644 index 0000000000000000000000000000000000000000..2f41686ac2eb182cfa154ede05c7def92cd34fbb --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/deprecated.scm @@ -0,0 +1,93 @@ +;;;; Copyright (C) 2003, 2005, 2006, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 deprecated) + #:use-module ((ice-9 threads) #:prefix threads:)) + +(define-syntax-rule (define-deprecated var msg exp) + (begin + (define-syntax var + (lambda (x) + (issue-deprecation-warning msg) + (syntax-case x () + ((id arg (... ...)) #'(let ((x id)) (x arg (... ...)))) + (id (identifier? #'id) #'exp)))) + (export var))) + +(define-deprecated _IONBF + "`_IONBF' is deprecated. Use the symbol 'none instead." + 'none) +(define-deprecated _IOLBF + "`_IOLBF' is deprecated. Use the symbol 'line instead." + 'line) +(define-deprecated _IOFBF + "`_IOFBF' is deprecated. Use the symbol 'block instead." + 'block) + +(define-syntax define-deprecated/threads + (lambda (stx) + (define (threads-name id) + (datum->syntax id (symbol-append 'threads: (syntax->datum id)))) + (syntax-case stx () + ((_ name) + (with-syntax ((name* (threads-name #'name)) + (warning (string-append + "Import (ice-9 threads) to have access to `" + (symbol->string (syntax->datum #'name)) "'."))) + #'(define-deprecated name warning name*)))))) + +(define-syntax-rule (define-deprecated/threads* name ...) + (begin (define-deprecated/threads name) ...)) + +(define-deprecated/threads* + call-with-new-thread + yield + cancel-thread + join-thread + thread? + make-mutex + make-recursive-mutex + lock-mutex + try-mutex + unlock-mutex + mutex? + mutex-owner + mutex-level + mutex-locked? + make-condition-variable + wait-condition-variable + signal-condition-variable + broadcast-condition-variable + condition-variable? + current-thread + all-threads + thread-exited? + total-processor-count + current-processor-count) + +(define-public make-dynamic-state + (case-lambda + (() + (issue-deprecation-warning + "`(make-dynamic-state)' is deprecated; use `(current-dynamic-state)' +instead.") + (current-dynamic-state)) + ((parent) + (issue-deprecation-warning + "`(make-dynamic-state PARENT)' is deprecated; now that reified +dynamic state objects are themselves copies, just use PARENT directly.") + parent))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/documentation.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/documentation.scm new file mode 100644 index 0000000000000000000000000000000000000000..9b0a121cc431866e6bff252dd630e6817fdd215a --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/documentation.scm @@ -0,0 +1,203 @@ +;;;; Copyright (C) 2000,2001, 2002, 2003, 2006, 2009, 2010 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +;;; Commentary: + +;; * This module exports: +;; +;; file-commentary -- a procedure that returns a file's "commentary" +;; +;; documentation-files -- a search-list of files using the Guile +;; Documentation Format Version 2. +;; +;; search-documentation-files -- a procedure that takes NAME (a symbol) +;; and searches `documentation-files' for +;; associated documentation. optional +;; arg FILES is a list of filenames to use +;; instead of `documentation-files'. +;; +;; object-documentation -- a procedure that returns its arg's docstring +;; +;; * Guile Documentation Format +;; +;; Here is the complete and authoritative documentation for the Guile +;; Documentation Format Version 2: +;; +;; HEADER +;; ^LPROC1 +;; DOCUMENTATION1 +;; +;; ^LPROC2 +;; DOCUMENTATION2 +;; +;; ^L... +;; +;; The HEADER is completely ignored. The "^L" are formfeeds. PROC1, PROC2 +;; and so on are symbols that name the element documented. DOCUMENTATION1, +;; DOCUMENTATION2 and so on are the related documentation, w/o any further +;; formatting. Note that there are two newlines before the next formfeed; +;; these are discarded when the documentation is read in. +;; +;; (Version 1, corresponding to guile-1.4 and prior, is documented as being +;; not documented anywhere except by this embarrassingly circular comment.) +;; +;; * File Commentary +;; +;; A file's commentary is the body of text found between comments +;; ;;; Commentary: +;; and +;; ;;; Code: +;; both of which must be at the beginning of the line. In the result string, +;; semicolons at the beginning of each line are discarded. +;; +;; You can specify to `file-commentary' alternate begin and end strings, and +;; scrub procedure. Use #t to get default values. For example: +;; +;; (file-commentary "documentation.scm") +;; You should see this text! +;; +;; (file-commentary "documentation.scm" "^;;; Code:" "ends here$") +;; You should see the rest of this file. +;; +;; (file-commentary "documentation.scm" #t #t string-upcase) +;; You should see this text very loudly (note semicolons untouched). + +;;; Code: + +(define-module (ice-9 documentation) + :use-module (ice-9 rdelim) + :export (file-commentary + documentation-files search-documentation-files + object-documentation) + :autoload (ice-9 regex) (match:suffix) + :no-backtrace) + + +;; +;; commentary extraction +;; + +(define (file-commentary filename . cust) ; (IN-LINE-RE AFTER-LINE-RE SCRUB) + + ;; These are constants but are not at the top level because the repl in + ;; boot-9.scm loads session.scm which in turn loads this file, and we want + ;; that to work even even when regexps are not available (ie. make-regexp + ;; doesn't exist), as for instance is the case on mingw. + ;; + (define default-in-line-re (make-regexp "^;;; Commentary:")) + (define default-after-line-re (make-regexp "^;;; Code:")) + (define default-scrub (let ((dirt (make-regexp "^;+"))) + (lambda (line) + (let ((m (regexp-exec dirt line))) + (if m (match:suffix m) line))))) + + ;; fixme: might be cleaner to use optargs here... + (let ((in-line-re (if (> 1 (length cust)) + default-in-line-re + (let ((v (car cust))) + (cond ((regexp? v) v) + ((string? v) (make-regexp v)) + (else default-in-line-re))))) + (after-line-re (if (> 2 (length cust)) + default-after-line-re + (let ((v (cadr cust))) + (cond ((regexp? v) v) + ((string? v) (make-regexp v)) + (else default-after-line-re))))) + (scrub (if (> 3 (length cust)) + default-scrub + (let ((v (caddr cust))) + (cond ((procedure? v) v) + (else default-scrub)))))) + (call-with-input-file filename + (lambda (port) + (let loop ((line (read-delimited "\n" port)) + (doc "") + (parse-state 'before)) + (if (or (eof-object? line) (eq? 'after parse-state)) + doc + (let ((new-state + (cond ((regexp-exec in-line-re line) 'in) + ((regexp-exec after-line-re line) 'after) + (else parse-state)))) + (if (eq? 'after new-state) + doc + (loop (read-delimited "\n" port) + (if (and (eq? 'in new-state) (eq? 'in parse-state)) + (string-append doc (scrub line) "\n") + doc) + new-state))))))))) + + + +;; +;; documentation-files is the list of places to look for documentation +;; +(define documentation-files + (map (lambda (vicinity) + (in-vicinity (vicinity) "guile-procedures.txt")) + (list %library-dir + %package-data-dir + %site-dir + (lambda () ".")))) + +(define entry-delimiter "\f") + +(define (find-documentation-in-file name file) + (and (file-exists? file) + (call-with-input-file file + (lambda (port) + (let ((name (symbol->string name))) + (let ((len (string-length name))) + (read-delimited entry-delimiter port) ;skip to first entry + (let loop ((entry (read-delimited entry-delimiter port))) + (cond ((eof-object? entry) #f) + ;; match? + ((and ;; large enough? + (>= (string-length entry) len) + ;; matching name? + (string=? (substring entry 0 len) name) + ;; terminated? + (memq (string-ref entry len) '(#\newline))) + ;; cut away name tag and extra surrounding newlines + (substring entry (+ len 2) (- (string-length entry) 2))) + (else (loop (read-delimited entry-delimiter port))))))))))) + +(define (search-documentation-files name . files) + (or-map (lambda (file) + (find-documentation-in-file name file)) + (cond ((null? files) documentation-files) + (else files)))) + +(define (object-documentation object) + "Return the docstring for OBJECT. +OBJECT can be a procedure, macro or any object that has its +`documentation' property set." + (or (and (procedure? object) + (procedure-documentation object)) + (object-property object 'documentation) + (and (macro? object) + (object-documentation (macro-transformer object))) + (and (procedure? object) + (procedure-name object) + (let ((docstring (search-documentation-files + (procedure-name object)))) + (if docstring + (set-procedure-property! object 'documentation docstring)) + docstring)))) + +;;; documentation.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/eval-string.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/eval-string.scm new file mode 100644 index 0000000000000000000000000000000000000000..789980938a3ff710efb65f2f50e8f8ae86b0221b --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/eval-string.scm @@ -0,0 +1,90 @@ +;;; Evaluating code from users + +;;; Copyright (C) 2011, 2013 Free Software Foundation, Inc. + +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Code: + +(define-module (ice-9 eval-string) + #:use-module (system base compile) + #:use-module (system base language) + #:use-module (system vm program) + #:use-module (system vm loader) + #:replace (eval-string)) + +(define (ensure-language x) + (if (language? x) + x + (lookup-language x))) + +(define* (read-and-eval port #:key (lang (current-language))) + (parameterize ((current-language (ensure-language lang))) + (define (read) + ((language-reader (current-language)) port (current-module))) + (define (eval exp) + ((language-evaluator (current-language)) exp (current-module))) + + (let ((exp (read))) + (if (eof-object? exp) + ;; The behavior of read-and-compile and of the old + ;; eval-string. + *unspecified* + (let lp ((exp exp)) + (call-with-values + (lambda () (eval exp)) + (lambda vals + (let ((next (read))) + (cond + ((eof-object? next) + (apply values vals)) + (else + (lp next))))))))))) + +(define* (eval-string str #:key + (module (current-module)) + (file #f) + (line #f) + (column #f) + (lang (current-language)) + (compile? #f)) + (define (maybe-with-module module thunk) + (if module + (save-module-excursion + (lambda () + (set-current-module module) + (thunk))) + (thunk))) + + (let ((lang (ensure-language lang))) + (call-with-input-string + str + (lambda (port) + (maybe-with-module + module + (lambda () + (if module + (set-current-module module)) + (if file + (set-port-filename! port file)) + (if line + (set-port-line! port line)) + (if column + (set-port-column! port line)) + + (if (or compile? (not (language-evaluator lang))) + ((load-thunk-from-memory + (read-and-compile port #:from lang #:to 'bytecode))) + (read-and-eval port #:lang lang)))))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/eval.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/eval.scm new file mode 100644 index 0000000000000000000000000000000000000000..d21f59abde9ca33564db22f9cf45c91395c28ef5 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/eval.scm @@ -0,0 +1,723 @@ +;;; -*- mode: scheme; coding: utf-8; -*- + +;;;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + + + +;;; Commentary: + +;;; Scheme eval, written in Scheme. +;;; +;;; Expressions are first expanded, by the syntax expander (i.e. +;;; psyntax), then memoized into internal forms. The evaluator itself +;;; only operates on the internal forms ("memoized expressions"). +;;; +;;; Environments are represented as a chain of vectors, linked through +;;; their first elements. The terminal element of an environment is the +;;; module that was current when the outer lexical environment was +;;; entered. +;;; + +;;; Code: + + + +(define (primitive-eval exp) + "Evaluate @var{exp} in the current module." + (define-syntax env-toplevel + (syntax-rules () + ((_ env) + (let lp ((e env)) + (if (vector? e) + (lp (vector-ref e 0)) + e))))) + + (define-syntax make-env + (syntax-rules () + ((_ n init next) + (let ((v (make-vector (1+ n) init))) + (vector-set! v 0 next) + v)))) + + (define-syntax make-env* + (syntax-rules () + ((_ next init ...) + (vector next init ...)))) + + (define-syntax env-ref + (syntax-rules () + ((_ env depth width) + (let lp ((e env) (d depth)) + (if (zero? d) + (vector-ref e (1+ width)) + (lp (vector-ref e 0) (1- d))))))) + + (define-syntax env-set! + (syntax-rules () + ((_ env depth width val) + (let lp ((e env) (d depth)) + (if (zero? d) + (vector-set! e (1+ width) val) + (lp (vector-ref e 0) (1- d))))))) + + ;; This is a modified version of Oleg Kiselyov's "pmatch". + (define-syntax-rule (match e cs ...) + (let ((v e)) (expand-clauses v cs ...))) + + (define-syntax expand-clauses + (syntax-rules () + ((_ v) ((error "unreachable"))) + ((_ v (pat e0 e ...) cs ...) + (let ((fk (lambda () (expand-clauses v cs ...)))) + (expand-pattern v pat (let () e0 e ...) (fk)))))) + + (define-syntax expand-pattern + (syntax-rules (_ quote unquote ?) + ((_ v _ kt kf) kt) + ((_ v () kt kf) (if (null? v) kt kf)) + ((_ v (quote lit) kt kf) + (if (equal? v (quote lit)) kt kf)) + ((_ v (unquote exp) kt kf) + (if (equal? v exp) kt kf)) + ((_ v (x . y) kt kf) + (if (pair? v) + (let ((vx (car v)) (vy (cdr v))) + (expand-pattern vx x (expand-pattern vy y kt kf) kf)) + kf)) + ((_ v (? pred var) kt kf) + (if (pred v) (let ((var v)) kt) kf)) + ((_ v #f kt kf) (if (eqv? v #f) kt kf)) + ((_ v var kt kf) (let ((var v)) kt)))) + + (define-syntax typecode + (lambda (x) + (syntax-case x () + ((_ type) + (or (memoized-typecode (syntax->datum #'type)) + (error "not a typecode" (syntax->datum #'type))))))) + + (define-syntax-rule (lazy (arg ...) exp) + (letrec ((proc (lambda (arg ...) + (set! proc exp) + (proc arg ...)))) + (lambda (arg ...) + (proc arg ...)))) + + (define (compile-lexical-ref depth width) + (case depth + ((0) (lambda (env) (env-ref env 0 width))) + ((1) (lambda (env) (env-ref env 1 width))) + ((2) (lambda (env) (env-ref env 2 width))) + (else (lambda (env) (env-ref env depth width))))) + + (define (primitive=? name loc module var) + "Return true if VAR is the same as the primitive bound to NAME." + (match loc + ((mode . loc) + (and (match loc + ((mod name* . public?) (eq? name* name)) + (_ (eq? loc name))) + ;; `module' can be #f if the module system was not yet + ;; booted when the environment was captured. + (or (not module) + (eq? var (module-local-variable the-root-module name))))))) + + (define (compile-top-call cenv loc args) + (let* ((module (env-toplevel cenv)) + (var (%resolve-variable loc module))) + (define-syntax-rule (maybe-primcall (prim ...) arg ...) + (let ((arg (compile arg)) + ...) + (cond + ((primitive=? 'prim loc module var) + (lambda (env) (prim (arg env) ...))) + ... + (else (lambda (env) ((variable-ref var) (arg env) ...)))))) + (match args + (() + (lambda (env) ((variable-ref var)))) + ((a) + (maybe-primcall (1+ 1- car cdr lognot vector-length + variable-ref string-length struct-vtable) + a)) + ((a b) + (maybe-primcall (+ - * / ash logand logior logxor + cons vector-ref struct-ref allocate-struct variable-set!) + a b)) + ((a b c) + (maybe-primcall (vector-set! struct-set!) a b c)) + ((a b c . args) + (let ((a (compile a)) + (b (compile b)) + (c (compile c)) + (args (let lp ((args args)) + (if (null? args) + '() + (cons (compile (car args)) (lp (cdr args))))))) + (lambda (env) + (apply (variable-ref var) (a env) (b env) (c env) + (let lp ((args args)) + (if (null? args) + '() + (cons ((car args) env) (lp (cdr args)))))))))))) + + (define (compile-call f args) + (match f + ((,(typecode box-ref) . (,(typecode resolve) . loc)) + (lazy (env) (compile-top-call env loc args))) + (_ + (match args + (() + (let ((f (compile f))) + (lambda (env) ((f env))))) + ((a) + (let ((f (compile f)) + (a (compile a))) + (lambda (env) ((f env) (a env))))) + ((a b) + (let ((f (compile f)) + (a (compile a)) + (b (compile b))) + (lambda (env) ((f env) (a env) (b env))))) + ((a b c) + (let ((f (compile f)) + (a (compile a)) + (b (compile b)) + (c (compile c))) + (lambda (env) ((f env) (a env) (b env) (c env))))) + ((a b c . args) + (let ((f (compile f)) + (a (compile a)) + (b (compile b)) + (c (compile c)) + (args (let lp ((args args)) + (if (null? args) + '() + (cons (compile (car args)) (lp (cdr args))))))) + (lambda (env) + (apply (f env) (a env) (b env) (c env) + (let lp ((args args)) + (if (null? args) + '() + (cons ((car args) env) (lp (cdr args))))))))))))) + + (define (compile-box-ref box) + (match box + ((,(typecode resolve) . loc) + (lazy (cenv) + (let ((var (%resolve-variable loc (env-toplevel cenv)))) + (lambda (env) (variable-ref var))))) + ((,(typecode lexical-ref) depth . width) + (lambda (env) + (variable-ref (env-ref env depth width)))) + (_ + (let ((box (compile box))) + (lambda (env) + (variable-ref (box env))))))) + + (define (compile-resolve cenv loc) + (let ((var (%resolve-variable loc (env-toplevel cenv)))) + (lambda (env) var))) + + (define (compile-top-branch cenv loc args consequent alternate) + (let* ((module (env-toplevel cenv)) + (var (%resolve-variable loc module)) + (consequent (compile consequent)) + (alternate (compile alternate))) + (define (generic-top-branch) + (let ((test (compile-top-call cenv loc args))) + (lambda (env) + (if (test env) (consequent env) (alternate env))))) + (define-syntax-rule (maybe-primcall (prim ...) arg ...) + (cond + ((primitive=? 'prim loc module var) + (let ((arg (compile arg)) + ...) + (lambda (env) + (if (prim (arg env) ...) + (consequent env) + (alternate env))))) + ... + (else (generic-top-branch)))) + (match args + ((a) + (maybe-primcall (null? nil? pair? struct? string? vector? symbol? + keyword? variable? bitvector? char? zero? not) + a)) + ((a b) + (maybe-primcall (eq? eqv? equal? = < > <= >= logtest logbit?) + a b)) + (_ + (generic-top-branch))))) + + (define (compile-if test consequent alternate) + (match test + ((,(typecode call) + (,(typecode box-ref) . (,(typecode resolve) . loc)) + . args) + (lazy (env) (compile-top-branch env loc args consequent alternate))) + (_ + (let ((test (compile test)) + (consequent (compile consequent)) + (alternate (compile alternate))) + (lambda (env) + (if (test env) (consequent env) (alternate env))))))) + + (define (compile-quote x) + (lambda (env) x)) + + (define (compile-let inits body) + (let ((body (compile body)) + (width (vector-length inits))) + (case width + ((0) (lambda (env) + (body (make-env* env)))) + ((1) + (let ((a (compile (vector-ref inits 0)))) + (lambda (env) + (body (make-env* env (a env)))))) + ((2) + (let ((a (compile (vector-ref inits 0))) + (b (compile (vector-ref inits 1)))) + (lambda (env) + (body (make-env* env (a env) (b env)))))) + ((3) + (let ((a (compile (vector-ref inits 0))) + (b (compile (vector-ref inits 1))) + (c (compile (vector-ref inits 2)))) + (lambda (env) + (body (make-env* env (a env) (b env) (c env)))))) + ((4) + (let ((a (compile (vector-ref inits 0))) + (b (compile (vector-ref inits 1))) + (c (compile (vector-ref inits 2))) + (d (compile (vector-ref inits 3)))) + (lambda (env) + (body (make-env* env (a env) (b env) (c env) (d env)))))) + (else + (let lp ((n width) + (k (lambda (env) + (make-env width #f env)))) + (if (zero? n) + (lambda (env) + (body (k env))) + (lp (1- n) + (let ((init (compile (vector-ref inits (1- n))))) + (lambda (env) + (let* ((x (init env)) + (new-env (k env))) + (env-set! new-env 0 (1- n) x) + new-env)))))))))) + + (define (compile-fixed-lambda body nreq) + (case nreq + ((0) (lambda (env) + (lambda () + (body (make-env* env))))) + ((1) (lambda (env) + (lambda (a) + (body (make-env* env a))))) + ((2) (lambda (env) + (lambda (a b) + (body (make-env* env a b))))) + ((3) (lambda (env) + (lambda (a b c) + (body (make-env* env a b c))))) + ((4) (lambda (env) + (lambda (a b c d) + (body (make-env* env a b c d))))) + ((5) (lambda (env) + (lambda (a b c d e) + (body (make-env* env a b c d e))))) + ((6) (lambda (env) + (lambda (a b c d e f) + (body (make-env* env a b c d e f))))) + ((7) (lambda (env) + (lambda (a b c d e f g) + (body (make-env* env a b c d e f g))))) + (else + (lambda (env) + (lambda (a b c d e f g . more) + (let ((env (make-env nreq #f env))) + (env-set! env 0 0 a) + (env-set! env 0 1 b) + (env-set! env 0 2 c) + (env-set! env 0 3 d) + (env-set! env 0 4 e) + (env-set! env 0 5 f) + (env-set! env 0 6 g) + (let lp ((n 7) (args more)) + (cond + ((= n nreq) + (unless (null? args) + (scm-error 'wrong-number-of-args + "eval" "Wrong number of arguments" + '() #f)) + (body env)) + ((null? args) + (scm-error 'wrong-number-of-args + "eval" "Wrong number of arguments" + '() #f)) + (else + (env-set! env 0 n (car args)) + (lp (1+ n) (cdr args))))))))))) + + (define (compile-rest-lambda body nreq rest?) + (case nreq + ((0) (lambda (env) + (lambda rest + (body (make-env* env rest))))) + ((1) (lambda (env) + (lambda (a . rest) + (body (make-env* env a rest))))) + ((2) (lambda (env) + (lambda (a b . rest) + (body (make-env* env a b rest))))) + ((3) (lambda (env) + (lambda (a b c . rest) + (body (make-env* env a b c rest))))) + (else + (lambda (env) + (lambda (a b c . more) + (let ((env (make-env (1+ nreq) #f env))) + (env-set! env 0 0 a) + (env-set! env 0 1 b) + (env-set! env 0 2 c) + (let lp ((n 3) (args more)) + (cond + ((= n nreq) + (env-set! env 0 n args) + (body env)) + ((null? args) + (scm-error 'wrong-number-of-args + "eval" "Wrong number of arguments" + '() #f)) + (else + (env-set! env 0 n (car args)) + (lp (1+ n) (cdr args))))))))))) + + (define (compile-opt-lambda body nreq rest? nopt ninits unbound make-alt) + (lambda (env) + (define alt (and make-alt (make-alt env))) + (lambda args + (let ((nargs (length args))) + (cond + ((or (< nargs nreq) (and (not rest?) (> nargs (+ nreq nopt)))) + (if alt + (apply alt args) + ((scm-error 'wrong-number-of-args + "eval" "Wrong number of arguments" + '() #f)))) + (else + (let* ((nvals (+ nreq (if rest? 1 0) ninits)) + (env (make-env nvals unbound env))) + (define (bind-req args) + (let lp ((i 0) (args args)) + (cond + ((< i nreq) + ;; Bind required arguments. + (env-set! env 0 i (car args)) + (lp (1+ i) (cdr args))) + (else + (bind-opt args))))) + (define (bind-opt args) + (let lp ((i nreq) (args args)) + (cond + ((and (< i (+ nreq nopt)) (< i nargs)) + (env-set! env 0 i (car args)) + (lp (1+ i) (cdr args))) + (else + (bind-rest args))))) + (define (bind-rest args) + (when rest? + (env-set! env 0 (+ nreq nopt) args)) + (body env)) + (bind-req args)))))))) + + (define (compile-kw-lambda body nreq rest? nopt kw ninits unbound make-alt) + (define allow-other-keys? (car kw)) + (define keywords (cdr kw)) + (lambda (env) + (define alt (and make-alt (make-alt env))) + (lambda args + (define (npositional args) + (let lp ((n 0) (args args)) + (if (or (null? args) + (and (>= n nreq) (keyword? (car args)))) + n + (lp (1+ n) (cdr args))))) + (let ((nargs (length args))) + (cond + ((or (< nargs nreq) + (and alt (not rest?) (> (npositional args) (+ nreq nopt)))) + (if alt + (apply alt args) + ((scm-error 'wrong-number-of-args + "eval" "Wrong number of arguments" + '() #f)))) + (else + (let* ((nvals (+ nreq (if rest? 1 0) ninits)) + (env (make-env nvals unbound env))) + (define (bind-req args) + (let lp ((i 0) (args args)) + (cond + ((< i nreq) + ;; Bind required arguments. + (env-set! env 0 i (car args)) + (lp (1+ i) (cdr args))) + (else + (bind-opt args))))) + (define (bind-opt args) + (let lp ((i nreq) (args args)) + (cond + ((and (< i (+ nreq nopt)) (< i nargs) + (not (keyword? (car args)))) + (env-set! env 0 i (car args)) + (lp (1+ i) (cdr args))) + (else + (bind-rest args))))) + (define (bind-rest args) + (when rest? + (env-set! env 0 (+ nreq nopt) args)) + (bind-kw args)) + (define (bind-kw args) + (let lp ((args args)) + (cond + ((pair? args) + (cond + ((keyword? (car args)) + (let ((k (car args)) + (args (cdr args))) + (cond + ((assq k keywords) + => (lambda (kw-pair) + ;; Found a known keyword; set its value. + (if (pair? args) + (let ((v (car args)) + (args (cdr args))) + (env-set! env 0 (cdr kw-pair) v) + (lp args)) + ((scm-error 'keyword-argument-error + "eval" + "Keyword argument has no value" + '() (list k)))))) + ;; Otherwise unknown keyword. + (allow-other-keys? + (lp (if (pair? args) (cdr args) args))) + (else + ((scm-error 'keyword-argument-error + "eval" "Unrecognized keyword" + '() (list k))))))) + (rest? + ;; Be lenient parsing rest args. + (lp (cdr args))) + (else + ((scm-error 'keyword-argument-error + "eval" "Invalid keyword" + '() (list (car args))))))) + (else + (body env))))) + (bind-req args)))))))) + + (define (compute-arity alt nreq rest? nopt kw) + (let lp ((alt alt) (nreq nreq) (nopt nopt) (rest? rest?)) + (if (not alt) + (let ((arglist (list nreq + nopt + (if kw (cdr kw) '()) + (and kw (car kw)) + (and rest? '_)))) + (values arglist nreq nopt rest?)) + (let* ((spec (cddr alt)) + (nreq* (car spec)) + (rest?* (if (null? (cdr spec)) #f (cadr spec))) + (tail (and (pair? (cdr spec)) (pair? (cddr spec)) (cddr spec))) + (nopt* (if tail (car tail) 0)) + (alt* (and tail (car (cddddr tail))))) + (if (or (< nreq* nreq) + (and (= nreq* nreq) + (if rest? + (and rest?* (> nopt* nopt)) + (or rest?* (> nopt* nopt))))) + (lp alt* nreq* nopt* rest?*) + (lp alt* nreq nopt rest?)))))) + + (define (compile-general-lambda body nreq rest? nopt kw ninits unbound alt) + (call-with-values + (lambda () + (compute-arity alt nreq rest? nopt kw)) + (lambda (arglist min-nreq min-nopt min-rest?) + (define make-alt + (match alt + (#f #f) + ((body meta nreq . tail) + (compile-lambda body meta nreq tail)))) + (define make-closure + (if kw + (compile-kw-lambda body nreq rest? nopt kw ninits unbound make-alt) + (compile-opt-lambda body nreq rest? nopt ninits unbound make-alt))) + (lambda (env) + (let ((proc (make-closure env))) + (set-procedure-property! proc 'arglist arglist) + (set-procedure-minimum-arity! proc min-nreq min-nopt min-rest?) + proc))))) + + (define (compile-lambda body meta nreq tail) + (define (set-procedure-meta meta proc) + (match meta + (() proc) + (((prop . val) . meta) + (set-procedure-meta meta + (lambda (env) + (let ((proc (proc env))) + (set-procedure-property! proc prop val) + proc)))))) + (let ((body (lazy (env) (compile body)))) + (set-procedure-meta + meta + (match tail + (() (compile-fixed-lambda body nreq)) + ((rest? . tail) + (match tail + (() (compile-rest-lambda body nreq rest?)) + ((nopt kw ninits unbound alt) + (compile-general-lambda body nreq rest? nopt kw + ninits unbound alt)))))))) + + (define (compile-capture-env locs body) + (let ((body (compile body))) + (lambda (env) + (let* ((len (vector-length locs)) + (new-env (make-env len #f (env-toplevel env)))) + (let lp ((n 0)) + (when (< n len) + (match (vector-ref locs n) + ((depth . width) + (env-set! new-env 0 n (env-ref env depth width)))) + (lp (1+ n)))) + (body new-env))))) + + (define (compile-seq head tail) + (let ((head (compile head)) + (tail (compile tail))) + (lambda (env) + (head env) + (tail env)))) + + (define (compile-box-set! box val) + (let ((box (compile box)) + (val (compile val))) + (lambda (env) + (let ((val (val env))) + (variable-set! (box env) val))))) + + (define (compile-lexical-set! depth width x) + (let ((x (compile x))) + (lambda (env) + (env-set! env depth width (x env))))) + + (define (compile-call-with-values producer consumer) + (let ((producer (compile producer)) + (consumer (compile consumer))) + (lambda (env) + (call-with-values (producer env) + (consumer env))))) + + (define (compile-apply f args) + (let ((f (compile f)) + (args (compile args))) + (lambda (env) + (apply (f env) (args env))))) + + (define (compile-capture-module x) + (let ((x (compile x))) + (lambda (env) + (x (current-module))))) + + (define (compile-call-with-prompt tag thunk handler) + (let ((tag (compile tag)) + (thunk (compile thunk)) + (handler (compile handler))) + (lambda (env) + (call-with-prompt (tag env) (thunk env) (handler env))))) + + (define (compile-call/cc proc) + (let ((proc (compile proc))) + (lambda (env) + (call/cc (proc env))))) + + (define (compile exp) + (match exp + ((,(typecode lexical-ref) depth . width) + (compile-lexical-ref depth width)) + + ((,(typecode call) f . args) + (compile-call f args)) + + ((,(typecode box-ref) . box) + (compile-box-ref box)) + + ((,(typecode resolve) . loc) + (lazy (env) (compile-resolve env loc))) + + ((,(typecode if) test consequent . alternate) + (compile-if test consequent alternate)) + + ((,(typecode quote) . x) + (compile-quote x)) + + ((,(typecode let) inits . body) + (compile-let inits body)) + + ((,(typecode lambda) body meta nreq . tail) + (compile-lambda body meta nreq tail)) + + ((,(typecode capture-env) locs . body) + (compile-capture-env locs body)) + + ((,(typecode seq) head . tail) + (compile-seq head tail)) + + ((,(typecode box-set!) box . val) + (compile-box-set! box val)) + + ((,(typecode lexical-set!) (depth . width) . x) + (compile-lexical-set! depth width x)) + + ((,(typecode call-with-values) producer . consumer) + (compile-call-with-values producer consumer)) + + ((,(typecode apply) f args) + (compile-apply f args)) + + ((,(typecode capture-module) . x) + (compile-capture-module x)) + + ((,(typecode call-with-prompt) tag thunk . handler) + (compile-call-with-prompt tag thunk handler)) + + ((,(typecode call/cc) . proc) + (compile-call/cc proc)))) + + (let ((eval (compile + (memoize-expression + (if (macroexpanded? exp) + exp + ((module-transformer (current-module)) exp))))) + (env #f)) + (eval env))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/expect.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/expect.scm new file mode 100644 index 0000000000000000000000000000000000000000..ffc2e174221eaecfac4d5936aca39e781391abf8 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/expect.scm @@ -0,0 +1,171 @@ +;;;; Copyright (C) 1996, 1998, 1999, 2001, 2006 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +;;; Commentary: + +;; This module is documented in the Guile Reference Manual. +;; Briefly, these are exported: +;; procedures: expect-select, expect-regexec +;; variables: expect-port, expect-timeout, expect-timeout-proc, +;; expect-eof-proc, expect-char-proc, +;; expect-strings-compile-flags, expect-strings-exec-flags, +;; macros: expect, expect-strings + +;;; Code: + +(define-module (ice-9 expect) + :use-module (ice-9 regex) + :export-syntax (expect expect-strings) + :export (expect-port expect-timeout expect-timeout-proc + expect-eof-proc expect-char-proc expect-strings-compile-flags + expect-strings-exec-flags expect-select expect-regexec)) + +;;; Expect: a macro for selecting actions based on what it reads from a port. +;;; The idea is from Don Libes' expect based on Tcl. +;;; This version by Gary Houston incorporating ideas from Aubrey Jaffer. + + +(define expect-port #f) +(define expect-timeout #f) +(define expect-timeout-proc #f) +(define expect-eof-proc #f) +(define expect-char-proc #f) + +;;; expect: each test is a procedure which is applied to the accumulating +;;; string. +(defmacro expect clauses + (let ((s (gensym)) + (c (gensym)) + (port (gensym)) + (timeout (gensym))) + `(let ((,s "") + (,port (or expect-port (current-input-port))) + ;; when timeout occurs, in floating point seconds. + (,timeout (if expect-timeout + (let* ((secs-usecs (gettimeofday))) + (+ (car secs-usecs) + expect-timeout + (/ (cdr secs-usecs) + 1000000))) ; one million. + #f))) + (let next-char () + (if (and expect-timeout + (not (expect-select ,port ,timeout))) + (if expect-timeout-proc + (expect-timeout-proc ,s) + #f) + (let ((,c (read-char ,port))) + (if expect-char-proc + (expect-char-proc ,c)) + (if (not (eof-object? ,c)) + (set! ,s (string-append ,s (string ,c)))) + (cond + ;; this expands to clauses where the car invokes the + ;; match proc and the cdr is the return value from expect + ;; if the proc matched. + ,@(let next-expr ((tests (map car clauses)) + (exprs (map cdr clauses)) + (body '())) + (cond + ((null? tests) + (reverse body)) + (else + (next-expr + (cdr tests) + (cdr exprs) + (cons + `((,(car tests) ,s (eof-object? ,c)) + ,@(cond ((null? (car exprs)) + '()) + ((eq? (caar exprs) '=>) + (if (not (= (length (car exprs)) + 2)) + (scm-error 'misc-error + "expect" + "bad recipient: ~S" + (list (car exprs)) + #f) + `((apply ,(cadar exprs) + (,(car tests) ,s ,port))))) + (else + (car exprs)))) + body))))) + ;; if none of the clauses matched the current string. + (else (cond ((eof-object? ,c) + (if expect-eof-proc + (expect-eof-proc ,s) + #f)) + (else + (next-char))))))))))) + + +(define expect-strings-compile-flags regexp/newline) +(define expect-strings-exec-flags regexp/noteol) + +;;; the regexec front-end to expect: +;;; each test must evaluate to a regular expression. +(defmacro expect-strings clauses + `(let ,@(let next-test ((tests (map car clauses)) + (exprs (map cdr clauses)) + (defs '()) + (body '())) + (cond ((null? tests) + (list (reverse defs) `(expect ,@(reverse body)))) + (else + (let ((rxname (gensym))) + (next-test (cdr tests) + (cdr exprs) + (cons `(,rxname (make-regexp + ,(car tests) + expect-strings-compile-flags)) + defs) + (cons `((lambda (s eof?) + (expect-regexec ,rxname s eof?)) + ,@(car exprs)) + body)))))))) + +;;; simplified select: returns #t if input is waiting or #f if timed out or +;;; select was interrupted by a signal. +;;; timeout is an absolute time in floating point seconds. +(define (expect-select port timeout) + (let* ((secs-usecs (gettimeofday)) + (relative (- timeout + (car secs-usecs) + (/ (cdr secs-usecs) + 1000000)))) ; one million. + (and (> relative 0) + (pair? (car (select (list port) '() '() + relative)))))) + +;;; match a string against a regexp, returning a list of strings (required +;;; by the => syntax) or #f. called once each time a character is added +;;; to s (eof? will be #f), and once when eof is reached (with eof? #t). +(define (expect-regexec rx s eof?) + ;; if expect-strings-exec-flags contains regexp/noteol, + ;; remove it for the eof test. + (let* ((flags (if (and eof? + (logand expect-strings-exec-flags regexp/noteol)) + (logxor expect-strings-exec-flags regexp/noteol) + expect-strings-exec-flags)) + (match (regexp-exec rx s 0 flags))) + (if match + (do ((i (- (match:count match) 1) (- i 1)) + (result '() (cons (match:substring match i) result))) + ((< i 0) result)) + #f))) + +;;; expect.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/fdes-finalizers.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/fdes-finalizers.scm new file mode 100644 index 0000000000000000000000000000000000000000..acb2ed1c3d6186ae4d113c1f145cd4b950a2eac6 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/fdes-finalizers.scm @@ -0,0 +1,25 @@ +;;;; Copyright (C) 2016 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public License +;;;; as published by the Free Software Foundation; either version 3 of +;;;; the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + + +(define-module (ice-9 fdes-finalizers) + #:export (add-fdes-finalizer! + remove-fdes-finalizer!)) + +(eval-when (expand load eval) + (load-extension (string-append "libguile-" (effective-version)) + "scm_init_fdes_finalizers")) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/format.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/format.scm new file mode 100644 index 0000000000000000000000000000000000000000..1ef4cb5ef89f5d34bfab131407cd71b25f6d3582 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/format.scm @@ -0,0 +1,1626 @@ +;;;; "format.scm" Common LISP text output formatter for SLIB +;;; Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +;;; +;;; This library is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU Lesser General Public +;;; License as published by the Free Software Foundation; either +;;; version 3 of the License, or (at your option) any later version. +;;; +;;; This library is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this library; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;; + +;;; This code was orignally in the public domain. +;;; +;;; Written 1992-1994 by Dirk Lutzebaeck (lutzeb@cs.tu-berlin.de). +;;; +;;; Authors of the version from SLIB (< 1.4) were Ken Dickey and Aubrey +;;; Jaffer. +;;; +;;; Assimilated into Guile May 1999. +;;; +;;; Please don't bother the original authors with bug reports, though; +;;; send them to bug-guile@gnu.org. +;;; + +(define-module (ice-9 format) + #:autoload (ice-9 pretty-print) (pretty-print truncated-print) + #:autoload (ice-9 i18n) (%global-locale number->locale-string) + #:replace (format)) + +(define format:version "3.0") + +(define (format destination format-string . format-args) + (if (not (string? format-string)) + (error "format: expected a string for format string" format-string)) + + (let* ((port + (cond + ((not destination) (open-output-string)) + ((boolean? destination) (current-output-port)) ; boolean but not false + ((output-port? destination) destination) + ((number? destination) + (issue-deprecation-warning + "Passing a number to format as the port is deprecated." + "Pass (current-error-port) instead.") + (current-error-port)) + (else + (error "format: bad destination `~a'" destination)))) + + (output-col (or (port-column port) 0)) + + (flush-output? #f)) + + (define format:case-conversion #f) + (define format:pos 0) ; curr. format string parsing position + (define format:arg-pos 0) ; curr. format argument position + ; this is global for error presentation + + ;; format string and char output routines on port + + (define (format:out-str str) + (if format:case-conversion + (display (format:case-conversion str) port) + (display str port)) + (set! output-col + (+ output-col (string-length str)))) + + (define (format:out-char ch) + (if format:case-conversion + (display (format:case-conversion (string ch)) + port) + (write-char ch port)) + (set! output-col + (if (char=? ch #\newline) + 0 + (+ output-col 1)))) + + ;;(define (format:out-substr str i n) ; this allocates a new string + ;; (display (substring str i n) port) + ;; (set! output-col (+ output-col n))) + + (define (format:out-substr str i n) + (do ((k i (+ k 1))) + ((= k n)) + (write-char (string-ref str k) port)) + (set! output-col (+ output-col (- n i)))) + + ;;(define (format:out-fill n ch) ; this allocates a new string + ;; (format:out-str (make-string n ch))) + + (define (format:out-fill n ch) + (do ((i 0 (+ i 1))) + ((= i n)) + (write-char ch port)) + (set! output-col (+ output-col n))) + + ;; format's user error handler + + (define (format:error . args) ; never returns! + (let ((port (current-error-port))) + (set! format:error format:intern-error) + (if (not (zero? format:arg-pos)) + (set! format:arg-pos (- format:arg-pos 1))) + (format port + "~%FORMAT: error with call: (format ~a \"~a<===~a\" ~ + ~{~a ~}===>~{~a ~})~% " + destination + (substring format-string 0 format:pos) + (substring format-string format:pos + (string-length format-string)) + (list-head format-args format:arg-pos) + (list-tail format-args format:arg-pos)) + (apply format port args) + (newline port) + (set! format:error format:error-save) + (format:abort))) + + (define (format:intern-error . args) + ;;if something goes wrong in format:error + (display "FORMAT: INTERNAL ERROR IN FORMAT:ERROR!") (newline) + (display " destination: ") (write destination) (newline) + (display " format string: ") (write format-string) (newline) + (display " format args: ") (write format-args) (newline) + (display " error args: ") (write args) (newline) + (set! format:error format:error-save) + (format:abort)) + + (define format:error-save format:error) + + (define format:parameter-characters + '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\- #\+ #\v #\# #\')) + + (define (format:format-work format-string arglist) ; does the formatting work + (letrec + ((format-string-len (string-length format-string)) + (arg-pos 0) ; argument position in arglist + (arg-len (length arglist)) ; number of arguments + (modifier #f) ; 'colon | 'at | 'colon-at | #f + (params '()) ; directive parameter list + (param-value-found #f) ; a directive + ; parameter value + ; found + (conditional-nest 0) ; conditional nesting level + (clause-pos 0) ; last cond. clause + ; beginning char pos + (clause-default #f) ; conditional default + ; clause string + (clauses '()) ; conditional clause + ; string list + (conditional-type #f) ; reflects the + ; contional modifiers + (conditional-arg #f) ; argument to apply the conditional + (iteration-nest 0) ; iteration nesting level + (iteration-pos 0) ; iteration string + ; beginning char pos + (iteration-type #f) ; reflects the + ; iteration modifiers + (max-iterations #f) ; maximum number of + ; iterations + (recursive-pos-save format:pos) + + (next-char ; gets the next char + ; from format-string + (lambda () + (let ((ch (peek-next-char))) + (set! format:pos (+ 1 format:pos)) + ch))) + + (peek-next-char + (lambda () + (if (>= format:pos format-string-len) + (format:error "illegal format string") + (string-ref format-string format:pos)))) + + (one-positive-integer? + (lambda (params) + (cond + ((null? params) #f) + ((and (integer? (car params)) + (>= (car params) 0) + (= (length params) 1)) #t) + (else + (format:error + "one positive integer parameter expected"))))) + + (next-arg + (lambda () + (if (>= arg-pos arg-len) + (begin + (set! format:arg-pos (+ arg-len 1)) + (format:error "missing argument(s)"))) + (add-arg-pos 1) + (list-ref arglist (- arg-pos 1)))) + + (prev-arg + (lambda () + (add-arg-pos -1) + (if (negative? arg-pos) + (format:error "missing backward argument(s)")) + (list-ref arglist arg-pos))) + + (rest-args + (lambda () + (let loop ((l arglist) (k arg-pos)) ; list-tail definition + (if (= k 0) l (loop (cdr l) (- k 1)))))) + + (add-arg-pos + (lambda (n) + (set! arg-pos (+ n arg-pos)) + (set! format:arg-pos arg-pos))) + + (anychar-dispatch ; dispatches the format-string + (lambda () + (if (>= format:pos format-string-len) + arg-pos ; used for ~? continuance + (let ((char (next-char))) + (cond + ((char=? char #\~) + (set! modifier #f) + (set! params '()) + (set! param-value-found #f) + (tilde-dispatch)) + (else + (if (and (zero? conditional-nest) + (zero? iteration-nest)) + (format:out-char char)) + (anychar-dispatch))))))) + + (tilde-dispatch + (lambda () + (cond + ((>= format:pos format-string-len) + (format:out-str "~") ; tilde at end of + ; string is just + ; output + arg-pos) ; used for ~? + ; continuance + ((and (or (zero? conditional-nest) + (memv (peek-next-char) ; find conditional + ; directives + (append '(#\[ #\] #\; #\: #\@ #\^) + format:parameter-characters))) + (or (zero? iteration-nest) + (memv (peek-next-char) ; find iteration + ; directives + (append '(#\{ #\} #\: #\@ #\^) + format:parameter-characters)))) + (case (char-upcase (next-char)) + + ;; format directives + + ((#\A) ; Any -- for humans + (set! format:read-proof + (memq modifier '(colon colon-at))) + (format:out-obj-padded (memq modifier '(at colon-at)) + (next-arg) #f params) + (anychar-dispatch)) + ((#\S) ; Slashified -- for parsers + (set! format:read-proof + (memq modifier '(colon colon-at))) + (format:out-obj-padded (memq modifier '(at colon-at)) + (next-arg) #t params) + (anychar-dispatch)) + ((#\D) ; Decimal + (format:out-num-padded modifier (next-arg) params 10) + (anychar-dispatch)) + ((#\H) ; Localized number + (let* ((num (next-arg)) + (locale (case modifier + ((colon) (next-arg)) + (else %global-locale))) + (argc (length params)) + (width (format:par params argc 0 #f "width")) + (decimals (format:par params argc 1 #t "decimals")) + (padchar (integer->char + (format:par params argc 2 format:space-ch + "padchar"))) + (str (number->locale-string num decimals + locale))) + (format:out-str (if (and width + (< (string-length str) width)) + (string-pad str width padchar) + str))) + (anychar-dispatch)) + ((#\X) ; Hexadecimal + (format:out-num-padded modifier (next-arg) params 16) + (anychar-dispatch)) + ((#\O) ; Octal + (format:out-num-padded modifier (next-arg) params 8) + (anychar-dispatch)) + ((#\B) ; Binary + (format:out-num-padded modifier (next-arg) params 2) + (anychar-dispatch)) + ((#\R) + (if (null? params) + (format:out-obj-padded ; Roman, cardinal, + ; ordinal numerals + #f + ((case modifier + ((at) format:num->roman) + ((colon-at) format:num->old-roman) + ((colon) format:num->ordinal) + (else format:num->cardinal)) + (next-arg)) + #f params) + (format:out-num-padded ; any Radix + modifier (next-arg) (cdr params) (car params))) + (anychar-dispatch)) + ((#\F) ; Fixed-format floating-point + (format:out-fixed modifier (next-arg) params) + (anychar-dispatch)) + ((#\E) ; Exponential floating-point + (format:out-expon modifier (next-arg) params) + (anychar-dispatch)) + ((#\G) ; General floating-point + (format:out-general modifier (next-arg) params) + (anychar-dispatch)) + ((#\$) ; Dollars floating-point + (format:out-dollar modifier (next-arg) params) + (anychar-dispatch)) + ((#\I) ; Complex numbers + (let ((z (next-arg))) + (if (not (complex? z)) + (format:error "argument not a complex number")) + (format:out-fixed modifier (real-part z) params) + (format:out-fixed 'at (imag-part z) params) + (format:out-char #\i)) + (anychar-dispatch)) + ((#\C) ; Character + (let ((ch (if (one-positive-integer? params) + (integer->char (car params)) + (next-arg)))) + (if (not (char? ch)) + (format:error "~~c expects a character")) + (case modifier + ((at) + (format:out-str (object->string ch))) + ((colon) + (let ((c (char->integer ch))) + (if (< c 0) + (set! c (+ c 256))) ; compensate + ; complement + ; impl. + (cond + ((< c #x20) ; assumes that control + ; chars are < #x20 + (format:out-char #\^) + (format:out-char + (integer->char (+ c #x40)))) + ((>= c #x7f) + (format:out-str "#\\") + (format:out-str + (number->string c 8))) + (else + (format:out-char ch))))) + (else (format:out-char ch)))) + (anychar-dispatch)) + ((#\P) ; Plural + (if (memq modifier '(colon colon-at)) + (prev-arg)) + (let ((arg (next-arg))) + (if (not (number? arg)) + (format:error "~~p expects a number argument")) + (if (= arg 1) + (if (memq modifier '(at colon-at)) + (format:out-char #\y)) + (if (memq modifier '(at colon-at)) + (format:out-str "ies") + (format:out-char #\s)))) + (anychar-dispatch)) + ((#\~) ; Tilde + (if (one-positive-integer? params) + (format:out-fill (car params) #\~) + (format:out-char #\~)) + (anychar-dispatch)) + ((#\%) ; Newline + (if (one-positive-integer? params) + (format:out-fill (car params) #\newline) + (format:out-char #\newline)) + (set! output-col 0) + (anychar-dispatch)) + ((#\&) ; Fresh line + (if (one-positive-integer? params) + (begin + (if (> (car params) 0) + (format:out-fill (- (car params) + (if (> + output-col + 0) 0 1)) + #\newline)) + (set! output-col 0)) + (if (> output-col 0) + (format:out-char #\newline))) + (anychar-dispatch)) + ((#\_) ; Space character + (if (one-positive-integer? params) + (format:out-fill (car params) #\space) + (format:out-char #\space)) + (anychar-dispatch)) + ((#\/) ; Tabulator character + (if (one-positive-integer? params) + (format:out-fill (car params) #\tab) + (format:out-char #\tab)) + (anychar-dispatch)) + ((#\|) ; Page seperator + (if (one-positive-integer? params) + (format:out-fill (car params) #\page) + (format:out-char #\page)) + (set! output-col 0) + (anychar-dispatch)) + ((#\T) ; Tabulate + (format:tabulate modifier params) + (anychar-dispatch)) + ((#\Y) ; Structured print + (let ((width (if (one-positive-integer? params) + (car params) + 79))) + (case modifier + ((at) + (format:out-str + (call-with-output-string + (lambda (p) + (truncated-print (next-arg) p + #:width width))))) + ((colon-at) + (format:out-str + (call-with-output-string + (lambda (p) + (truncated-print (next-arg) p + #:width + (max (- width + output-col) + 1)))))) + ((colon) + (format:error "illegal modifier in ~~?")) + (else + (pretty-print (next-arg) port + #:width width) + (set! output-col 0)))) + (anychar-dispatch)) + ((#\? #\K) ; Indirection (is "~K" in T-Scheme) + (cond + ((memq modifier '(colon colon-at)) + (format:error "illegal modifier in ~~?")) + ((eq? modifier 'at) + (let* ((frmt (next-arg)) + (args (rest-args))) + (add-arg-pos (format:format-work frmt args)))) + (else + (let* ((frmt (next-arg)) + (args (next-arg))) + (format:format-work frmt args)))) + (anychar-dispatch)) + ((#\!) ; Flush output + (set! flush-output? #t) + (anychar-dispatch)) + ((#\newline) ; Continuation lines + (if (eq? modifier 'at) + (format:out-char #\newline)) + (if (< format:pos format-string-len) + (do ((ch (peek-next-char) (peek-next-char))) + ((or (not (char-whitespace? ch)) + (= format:pos (- format-string-len 1)))) + (if (eq? modifier 'colon) + (format:out-char (next-char)) + (next-char)))) + (anychar-dispatch)) + ((#\*) ; Argument jumping + (case modifier + ((colon) ; jump backwards + (if (one-positive-integer? params) + (do ((i 0 (+ i 1))) + ((= i (car params))) + (prev-arg)) + (prev-arg))) + ((at) ; jump absolute + (set! arg-pos (if (one-positive-integer? params) + (car params) 0))) + ((colon-at) + (format:error "illegal modifier `:@' in ~~* directive")) + (else ; jump forward + (if (one-positive-integer? params) + (do ((i 0 (+ i 1))) + ((= i (car params))) + (next-arg)) + (next-arg)))) + (anychar-dispatch)) + ((#\() ; Case conversion begin + (set! format:case-conversion + (case modifier + ((at) string-capitalize-first) + ((colon) string-capitalize) + ((colon-at) string-upcase) + (else string-downcase))) + (anychar-dispatch)) + ((#\)) ; Case conversion end + (if (not format:case-conversion) + (format:error "missing ~~(")) + (set! format:case-conversion #f) + (anychar-dispatch)) + ((#\[) ; Conditional begin + (set! conditional-nest (+ conditional-nest 1)) + (cond + ((= conditional-nest 1) + (set! clause-pos format:pos) + (set! clause-default #f) + (set! clauses '()) + (set! conditional-type + (case modifier + ((at) 'if-then) + ((colon) 'if-else-then) + ((colon-at) (format:error "illegal modifier in ~~[")) + (else 'num-case))) + (set! conditional-arg + (if (one-positive-integer? params) + (car params) + (next-arg))))) + (anychar-dispatch)) + ((#\;) ; Conditional separator + (if (zero? conditional-nest) + (format:error "~~; not in ~~[~~] conditional")) + (if (not (null? params)) + (format:error "no parameter allowed in ~~;")) + (if (= conditional-nest 1) + (let ((clause-str + (cond + ((eq? modifier 'colon) + (set! clause-default #t) + (substring format-string clause-pos + (- format:pos 3))) + ((memq modifier '(at colon-at)) + (format:error "illegal modifier in ~~;")) + (else + (substring format-string clause-pos + (- format:pos 2)))))) + (set! clauses (append clauses (list clause-str))) + (set! clause-pos format:pos))) + (anychar-dispatch)) + ((#\]) ; Conditional end + (if (zero? conditional-nest) (format:error "missing ~~[")) + (set! conditional-nest (- conditional-nest 1)) + (if modifier + (format:error "no modifier allowed in ~~]")) + (if (not (null? params)) + (format:error "no parameter allowed in ~~]")) + (cond + ((zero? conditional-nest) + (let ((clause-str (substring format-string clause-pos + (- format:pos 2)))) + (if clause-default + (set! clause-default clause-str) + (set! clauses (append clauses (list clause-str))))) + (case conditional-type + ((if-then) + (if conditional-arg + (format:format-work (car clauses) + (list conditional-arg)))) + ((if-else-then) + (add-arg-pos + (format:format-work (if conditional-arg + (cadr clauses) + (car clauses)) + (rest-args)))) + ((num-case) + (if (or (not (integer? conditional-arg)) + (< conditional-arg 0)) + (format:error "argument not a positive integer")) + (if (not (and (>= conditional-arg (length clauses)) + (not clause-default))) + (add-arg-pos + (format:format-work + (if (>= conditional-arg (length clauses)) + clause-default + (list-ref clauses conditional-arg)) + (rest-args)))))))) + (anychar-dispatch)) + ((#\{) ; Iteration begin + (set! iteration-nest (+ iteration-nest 1)) + (cond + ((= iteration-nest 1) + (set! iteration-pos format:pos) + (set! iteration-type + (case modifier + ((at) 'rest-args) + ((colon) 'sublists) + ((colon-at) 'rest-sublists) + (else 'list))) + (set! max-iterations (if (one-positive-integer? params) + (car params) #f)))) + (anychar-dispatch)) + ((#\}) ; Iteration end + (if (zero? iteration-nest) (format:error "missing ~~{")) + (set! iteration-nest (- iteration-nest 1)) + (case modifier + ((colon) + (if (not max-iterations) (set! max-iterations 1))) + ((colon-at at) (format:error "illegal modifier"))) + (if (not (null? params)) + (format:error "no parameters allowed in ~~}")) + (if (zero? iteration-nest) + (let ((iteration-str + (substring format-string iteration-pos + (- format:pos (if modifier 3 2))))) + (if (string=? iteration-str "") + (set! iteration-str (next-arg))) + (case iteration-type + ((list) + (let ((args (next-arg)) + (args-len 0)) + (if (not (list? args)) + (format:error "expected a list argument")) + (set! args-len (length args)) + (do ((arg-pos 0 (+ arg-pos + (format:format-work + iteration-str + (list-tail args arg-pos)))) + (i 0 (+ i 1))) + ((or (>= arg-pos args-len) + (and max-iterations + (>= i max-iterations))))))) + ((sublists) + (let ((args (next-arg)) + (args-len 0)) + (if (not (list? args)) + (format:error "expected a list argument")) + (set! args-len (length args)) + (do ((arg-pos 0 (+ arg-pos 1))) + ((or (>= arg-pos args-len) + (and max-iterations + (>= arg-pos max-iterations)))) + (let ((sublist (list-ref args arg-pos))) + (if (not (list? sublist)) + (format:error + "expected a list of lists argument")) + (format:format-work iteration-str sublist))))) + ((rest-args) + (let* ((args (rest-args)) + (args-len (length args)) + (usedup-args + (do ((arg-pos 0 (+ arg-pos + (format:format-work + iteration-str + (list-tail + args arg-pos)))) + (i 0 (+ i 1))) + ((or (>= arg-pos args-len) + (and max-iterations + (>= i max-iterations))) + arg-pos)))) + (add-arg-pos usedup-args))) + ((rest-sublists) + (let* ((args (rest-args)) + (args-len (length args)) + (usedup-args + (do ((arg-pos 0 (+ arg-pos 1))) + ((or (>= arg-pos args-len) + (and max-iterations + (>= arg-pos max-iterations))) + arg-pos) + (let ((sublist (list-ref args arg-pos))) + (if (not (list? sublist)) + (format:error "expected list arguments")) + (format:format-work iteration-str sublist))))) + (add-arg-pos usedup-args))) + (else (format:error "internal error in ~~}"))))) + (anychar-dispatch)) + ((#\^) ; Up and out + (let* ((continue + (cond + ((not (null? params)) + (not + (case (length params) + ((1) (zero? (car params))) + ((2) (= (list-ref params 0) (list-ref params 1))) + ((3) (<= (list-ref params 0) + (list-ref params 1) + (list-ref params 2))) + (else (format:error "too much parameters"))))) + (format:case-conversion ; if conversion stop conversion + (set! format:case-conversion string-copy) #t) + ((= iteration-nest 1) #t) + ((= conditional-nest 1) #t) + ((>= arg-pos arg-len) + (set! format:pos format-string-len) #f) + (else #t)))) + (if continue + (anychar-dispatch)))) + + ;; format directive modifiers and parameters + + ((#\@) ; `@' modifier + (if (memq modifier '(at colon-at)) + (format:error "double `@' modifier")) + (set! modifier (if (eq? modifier 'colon) 'colon-at 'at)) + (tilde-dispatch)) + ((#\:) ; `:' modifier + (if (memq modifier '(colon colon-at)) + (format:error "double `:' modifier")) + (set! modifier (if (eq? modifier 'at) 'colon-at 'colon)) + (tilde-dispatch)) + ((#\') ; Character parameter + (if modifier (format:error "misplaced modifier")) + (set! params (append params (list (char->integer (next-char))))) + (set! param-value-found #t) + (tilde-dispatch)) + ((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\- #\+) ; num. paramtr + (if modifier (format:error "misplaced modifier")) + (let ((num-str-beg (- format:pos 1)) + (num-str-end format:pos)) + (do ((ch (peek-next-char) (peek-next-char))) + ((not (char-numeric? ch))) + (next-char) + (set! num-str-end (+ 1 num-str-end))) + (set! params + (append params + (list (string->number + (substring format-string + num-str-beg + num-str-end)))))) + (set! param-value-found #t) + (tilde-dispatch)) + ((#\V) ; Variable parameter from next argum. + (if modifier (format:error "misplaced modifier")) + (set! params (append params (list (next-arg)))) + (set! param-value-found #t) + (tilde-dispatch)) + ((#\#) ; Parameter is number of remaining args + (if param-value-found (format:error "misplaced '#'")) + (if modifier (format:error "misplaced modifier")) + (set! params (append params (list (length (rest-args))))) + (set! param-value-found #t) + (tilde-dispatch)) + ((#\,) ; Parameter separators + (if modifier (format:error "misplaced modifier")) + (if (not param-value-found) + (set! params (append params '(#f)))) ; append empty paramtr + (set! param-value-found #f) + (tilde-dispatch)) + ((#\Q) ; Inquiry messages + (if (eq? modifier 'colon) + (format:out-str format:version) + (let ((nl (string #\newline))) + (format:out-str + (string-append + "SLIB Common LISP format version " format:version nl + " (C) copyright 1992-1994 by Dirk Lutzebaeck" nl + " please send bug reports to `lutzeb@cs.tu-berlin.de'" + nl)))) + (anychar-dispatch)) + (else ; Unknown tilde directive + (format:error "unknown control character `~c'" + (string-ref format-string (- format:pos 1)))))) + (else (anychar-dispatch)))))) ; in case of conditional + + (set! format:pos 0) + (set! format:arg-pos 0) + (anychar-dispatch) ; start the formatting + (set! format:pos recursive-pos-save) + arg-pos)) ; return the position in the arg. list + + ;; when format:read-proof is true, format:obj->str will wrap + ;; result strings starting with "#<" in an extra pair of double + ;; quotes. + + (define format:read-proof #f) + + ;; format:obj->str returns a R4RS representation as a string of + ;; an arbitrary scheme object. + + (define (format:obj->str obj slashify) + (let ((res (if slashify + (object->string obj) + (call-with-output-string (lambda (p) (display obj p)))))) + (if (and format:read-proof (string-prefix? "#<" res)) + (object->string res) + res))) + + (define format:space-ch (char->integer #\space)) + (define format:zero-ch (char->integer #\0)) + + (define (format:par pars length index default name) + (if (> length index) + (let ((par (list-ref pars index))) + (if par + (if name + (if (< par 0) + (format:error + "~s parameter must be a positive integer" name) + par) + par) + default)) + default)) + + (define (format:out-obj-padded pad-left obj slashify pars) + (if (null? pars) + (format:out-str (format:obj->str obj slashify)) + (let ((l (length pars))) + (let ((mincol (format:par pars l 0 0 "mincol")) + (colinc (format:par pars l 1 1 "colinc")) + (minpad (format:par pars l 2 0 "minpad")) + (padchar (integer->char + (format:par pars l 3 format:space-ch #f))) + (objstr (format:obj->str obj slashify))) + (if (not pad-left) + (format:out-str objstr)) + (do ((objstr-len (string-length objstr)) + (i minpad (+ i colinc))) + ((>= (+ objstr-len i) mincol) + (format:out-fill i padchar))) + (if pad-left + (format:out-str objstr)))))) + + (define (format:out-num-padded modifier number pars radix) + (if (not (integer? number)) (format:error "argument not an integer")) + (let ((numstr (number->string number radix))) + (if (and (null? pars) (not modifier)) + (format:out-str numstr) + (let ((l (length pars)) + (numstr-len (string-length numstr))) + (let ((mincol (format:par pars l 0 #f "mincol")) + (padchar (integer->char + (format:par pars l 1 format:space-ch #f))) + (commachar (integer->char + (format:par pars l 2 (char->integer #\,) #f))) + (commawidth (format:par pars l 3 3 "commawidth"))) + (if mincol + (let ((numlen numstr-len)) ; calc. the output len of number + (if (and (memq modifier '(at colon-at)) (>= number 0)) + (set! numlen (+ numlen 1))) + (if (memq modifier '(colon colon-at)) + (set! numlen (+ (quotient (- numstr-len + (if (< number 0) 2 1)) + commawidth) + numlen))) + (if (> mincol numlen) + (format:out-fill (- mincol numlen) padchar)))) + (if (and (memq modifier '(at colon-at)) + (>= number 0)) + (format:out-char #\+)) + (if (memq modifier '(colon colon-at)) ; insert comma character + (let ((start (remainder numstr-len commawidth)) + (ns (if (< number 0) 1 0))) + (format:out-substr numstr 0 start) + (do ((i start (+ i commawidth))) + ((>= i numstr-len)) + (if (> i ns) + (format:out-char commachar)) + (format:out-substr numstr i (+ i commawidth)))) + (format:out-str numstr))))))) + + (define (format:tabulate modifier pars) + (let ((l (length pars))) + (let ((colnum (format:par pars l 0 1 "colnum")) + (colinc (format:par pars l 1 1 "colinc")) + (padch (integer->char (format:par pars l 2 format:space-ch #f)))) + (case modifier + ((colon colon-at) + (format:error "unsupported modifier for ~~t")) + ((at) ; relative tabulation + (format:out-fill + (if (= colinc 0) + colnum ; colnum = colrel + (do ((c 0 (+ c colinc)) + (col (+ output-col colnum))) + ((>= c col) + (- c output-col)))) + padch)) + (else ; absolute tabulation + (format:out-fill + (cond + ((< output-col colnum) + (- colnum output-col)) + ((= colinc 0) + 0) + (else + (do ((c colnum (+ c colinc))) + ((>= c output-col) + (- c output-col))))) + padch)))))) + + + ;; roman numerals (from dorai@cs.rice.edu). + + (define format:roman-alist + '((1000 #\M) (500 #\D) (100 #\C) (50 #\L) + (10 #\X) (5 #\V) (1 #\I))) + + (define format:roman-boundary-values + '(100 100 10 10 1 1 #f)) + + (define (format:num->old-roman n) + (if (and (integer? n) (>= n 1)) + (let loop ((n n) + (romans format:roman-alist) + (s '())) + (if (null? romans) (list->string (reverse s)) + (let ((roman-val (caar romans)) + (roman-dgt (cadar romans))) + (do ((q (quotient n roman-val) (- q 1)) + (s s (cons roman-dgt s))) + ((= q 0) + (loop (remainder n roman-val) + (cdr romans) s)))))) + (format:error "only positive integers can be romanized"))) + + (define (format:num->roman n) + (if (and (integer? n) (> n 0)) + (let loop ((n n) + (romans format:roman-alist) + (boundaries format:roman-boundary-values) + (s '())) + (if (null? romans) + (list->string (reverse s)) + (let ((roman-val (caar romans)) + (roman-dgt (cadar romans)) + (bdry (car boundaries))) + (let loop2 ((q (quotient n roman-val)) + (r (remainder n roman-val)) + (s s)) + (if (= q 0) + (if (and bdry (>= r (- roman-val bdry))) + (loop (remainder r bdry) (cdr romans) + (cdr boundaries) + (cons roman-dgt + (append + (cdr (assv bdry romans)) + s))) + (loop r (cdr romans) (cdr boundaries) s)) + (loop2 (- q 1) r (cons roman-dgt s))))))) + (format:error "only positive integers can be romanized"))) + + ;; cardinals & ordinals (from dorai@cs.rice.edu) + + (define format:cardinal-ones-list + '(#f "one" "two" "three" "four" "five" + "six" "seven" "eight" "nine" "ten" "eleven" "twelve" "thirteen" + "fourteen" "fifteen" "sixteen" "seventeen" "eighteen" + "nineteen")) + + (define format:cardinal-tens-list + '(#f #f "twenty" "thirty" "forty" "fifty" "sixty" "seventy" "eighty" + "ninety")) + + (define (format:num->cardinal999 n) + ;; this procedure is inspired by the Bruno Haible's CLisp + ;; function format-small-cardinal, which converts numbers + ;; in the range 1 to 999, and is used for converting each + ;; thousand-block in a larger number + (let* ((hundreds (quotient n 100)) + (tens+ones (remainder n 100)) + (tens (quotient tens+ones 10)) + (ones (remainder tens+ones 10))) + (append + (if (> hundreds 0) + (append + (string->list + (list-ref format:cardinal-ones-list hundreds)) + (string->list" hundred") + (if (> tens+ones 0) '(#\space) '())) + '()) + (if (< tens+ones 20) + (if (> tens+ones 0) + (string->list + (list-ref format:cardinal-ones-list tens+ones)) + '()) + (append + (string->list + (list-ref format:cardinal-tens-list tens)) + (if (> ones 0) + (cons #\- + (string->list + (list-ref format:cardinal-ones-list ones))) + '())))))) + + (define format:cardinal-thousand-block-list + '("" " thousand" " million" " billion" " trillion" " quadrillion" + " quintillion" " sextillion" " septillion" " octillion" " nonillion" + " decillion" " undecillion" " duodecillion" " tredecillion" + " quattuordecillion" " quindecillion" " sexdecillion" " septendecillion" + " octodecillion" " novemdecillion" " vigintillion")) + + (define (format:num->cardinal n) + (cond ((not (integer? n)) + (format:error + "only integers can be converted to English cardinals")) + ((= n 0) "zero") + ((< n 0) (string-append "minus " (format:num->cardinal (- n)))) + (else + (let ((power3-word-limit + (length format:cardinal-thousand-block-list))) + (let loop ((n n) + (power3 0) + (s '())) + (if (= n 0) + (list->string s) + (let ((n-before-block (quotient n 1000)) + (n-after-block (remainder n 1000))) + (loop n-before-block + (+ power3 1) + (if (> n-after-block 0) + (append + (if (> n-before-block 0) + (string->list ", ") '()) + (format:num->cardinal999 n-after-block) + (if (< power3 power3-word-limit) + (string->list + (list-ref + format:cardinal-thousand-block-list + power3)) + (append + (string->list " times ten to the ") + (string->list + (format:num->ordinal + (* power3 3))) + (string->list " power"))) + s) + s))))))))) + + (define format:ordinal-ones-list + '(#f "first" "second" "third" "fourth" "fifth" + "sixth" "seventh" "eighth" "ninth" "tenth" "eleventh" "twelfth" + "thirteenth" "fourteenth" "fifteenth" "sixteenth" "seventeenth" + "eighteenth" "nineteenth")) + + (define format:ordinal-tens-list + '(#f #f "twentieth" "thirtieth" "fortieth" "fiftieth" "sixtieth" + "seventieth" "eightieth" "ninetieth")) + + (define (format:num->ordinal n) + (cond ((not (integer? n)) + (format:error + "only integers can be converted to English ordinals")) + ((= n 0) "zeroth") + ((< n 0) (string-append "minus " (format:num->ordinal (- n)))) + (else + (let ((hundreds (quotient n 100)) + (tens+ones (remainder n 100))) + (string-append + (if (> hundreds 0) + (string-append + (format:num->cardinal (* hundreds 100)) + (if (= tens+ones 0) "th" " ")) + "") + (if (= tens+ones 0) "" + (if (< tens+ones 20) + (list-ref format:ordinal-ones-list tens+ones) + (let ((tens (quotient tens+ones 10)) + (ones (remainder tens+ones 10))) + (if (= ones 0) + (list-ref format:ordinal-tens-list tens) + (string-append + (list-ref format:cardinal-tens-list tens) + "-" + (list-ref format:ordinal-ones-list ones)))) + ))))))) + + ;; format inf and nan. + + (define (format:out-inf-nan number width digits edigits overch padch) + ;; inf and nan are always printed exactly as "+inf.0", "-inf.0" or + ;; "+nan.0", suitably justified in their field. We insist on + ;; printing this exact form so that the numbers can be read back in. + (let* ((str (number->string number)) + (len (string-length str)) + (dot (string-index str #\.)) + (digits (+ (or digits 0) + (if edigits (+ edigits 2) 0)))) + (if (and width overch (< width len)) + (format:out-fill width (integer->char overch)) + (let* ((leftpad (if width + (max (- width (max len (+ dot 1 digits))) 0) + 0)) + (rightpad (if width + (max (- width leftpad len) 0) + 0)) + (padch (integer->char (or padch format:space-ch)))) + (format:out-fill leftpad padch) + (format:out-str str) + (format:out-fill rightpad padch))))) + + ;; format fixed flonums (~F) + + (define (format:out-fixed modifier number pars) + (if (not (or (number? number) (string? number))) + (format:error "argument is not a number or a number string")) + + (let ((l (length pars))) + (let ((width (format:par pars l 0 #f "width")) + (digits (format:par pars l 1 #f "digits")) + (scale (format:par pars l 2 0 #f)) + (overch (format:par pars l 3 #f #f)) + (padch (format:par pars l 4 format:space-ch #f))) + + (cond + ((and (number? number) + (or (inf? number) (nan? number))) + (format:out-inf-nan number width digits #f overch padch)) + + (digits + (format:parse-float number #t scale) + (if (<= (- format:fn-len format:fn-dot) digits) + (format:fn-zfill #f (- digits (- format:fn-len format:fn-dot))) + (format:fn-round digits)) + (if width + (let ((numlen (+ format:fn-len 1))) + (if (or (not format:fn-pos?) (eq? modifier 'at)) + (set! numlen (+ numlen 1))) + (if (and (= format:fn-dot 0) (> width (+ digits 1))) + (set! numlen (+ numlen 1))) + (if (< numlen width) + (format:out-fill (- width numlen) (integer->char padch))) + (if (and overch (> numlen width)) + (format:out-fill width (integer->char overch)) + (format:fn-out modifier (> width (+ digits 1))))) + (format:fn-out modifier #t))) + + (else + (format:parse-float number #t scale) + (format:fn-strip) + (if width + (let ((numlen (+ format:fn-len 1))) + (if (or (not format:fn-pos?) (eq? modifier 'at)) + (set! numlen (+ numlen 1))) + (if (= format:fn-dot 0) + (set! numlen (+ numlen 1))) + (if (< numlen width) + (format:out-fill (- width numlen) (integer->char padch))) + (if (> numlen width) ; adjust precision if possible + (let ((dot-index (- numlen + (- format:fn-len format:fn-dot)))) + (if (> dot-index width) + (if overch ; numstr too big for required width + (format:out-fill width (integer->char overch)) + (format:fn-out modifier #t)) + (begin + (format:fn-round (- width dot-index)) + (format:fn-out modifier #t)))) + (format:fn-out modifier #t))) + (format:fn-out modifier #t))))))) + + ;; format exponential flonums (~E) + + (define (format:out-expon modifier number pars) + (if (not (or (number? number) (string? number))) + (format:error "argument is not a number")) + + (let ((l (length pars))) + (let ((width (format:par pars l 0 #f "width")) + (digits (format:par pars l 1 #f "digits")) + (edigits (format:par pars l 2 #f "exponent digits")) + (scale (format:par pars l 3 1 #f)) + (overch (format:par pars l 4 #f #f)) + (padch (format:par pars l 5 format:space-ch #f)) + (expch (format:par pars l 6 #f #f))) + + (cond + ((and (number? number) + (or (inf? number) (nan? number))) + (format:out-inf-nan number width digits edigits overch padch)) + + (digits ; fixed precision + + (let ((digits (if (> scale 0) + (if (< scale (+ digits 2)) + (+ (- digits scale) 1) + 0) + digits))) + (format:parse-float number #f scale) + (if (<= (- format:fn-len format:fn-dot) digits) + (format:fn-zfill #f (- digits (- format:fn-len format:fn-dot))) + (format:fn-round digits)) + (if width + (if (and edigits overch (> format:en-len edigits)) + (format:out-fill width (integer->char overch)) + (let ((numlen (+ format:fn-len 3))) ; .E+ + (if (or (not format:fn-pos?) (eq? modifier 'at)) + (set! numlen (+ numlen 1))) + (if (and (= format:fn-dot 0) (> width (+ digits 1))) + (set! numlen (+ numlen 1))) + (set! numlen + (+ numlen + (if (and edigits (>= edigits format:en-len)) + edigits + format:en-len))) + (if (< numlen width) + (format:out-fill (- width numlen) + (integer->char padch))) + (if (and overch (> numlen width)) + (format:out-fill width (integer->char overch)) + (begin + (format:fn-out modifier (> width (- numlen 1))) + (format:en-out edigits expch))))) + (begin + (format:fn-out modifier #t) + (format:en-out edigits expch))))) + + (else + (format:parse-float number #f scale) + (format:fn-strip) + (if width + (if (and edigits overch (> format:en-len edigits)) + (format:out-fill width (integer->char overch)) + (let ((numlen (+ format:fn-len 3))) ; .E+ + (if (or (not format:fn-pos?) (eq? modifier 'at)) + (set! numlen (+ numlen 1))) + (if (= format:fn-dot 0) + (set! numlen (+ numlen 1))) + (set! numlen + (+ numlen + (if (and edigits (>= edigits format:en-len)) + edigits + format:en-len))) + (if (< numlen width) + (format:out-fill (- width numlen) + (integer->char padch))) + (if (> numlen width) ; adjust precision if possible + (let ((f (- format:fn-len format:fn-dot))) ; fract len + (if (> (- numlen f) width) + (if overch ; numstr too big for required width + (format:out-fill width + (integer->char overch)) + (begin + (format:fn-out modifier #t) + (format:en-out edigits expch))) + (begin + (format:fn-round (+ (- f numlen) width)) + (format:fn-out modifier #t) + (format:en-out edigits expch)))) + (begin + (format:fn-out modifier #t) + (format:en-out edigits expch))))) + (begin + (format:fn-out modifier #t) + (format:en-out edigits expch)))))))) + + ;; format general flonums (~G) + + (define (format:out-general modifier number pars) + (if (not (or (number? number) (string? number))) + (format:error "argument is not a number or a number string")) + + (let ((l (length pars))) + (let ((width (if (> l 0) (list-ref pars 0) #f)) + (digits (if (> l 1) (list-ref pars 1) #f)) + (edigits (if (> l 2) (list-ref pars 2) #f)) + (overch (if (> l 4) (list-ref pars 4) #f)) + (padch (if (> l 5) (list-ref pars 5) #f))) + (cond + ((and (number? number) + (or (inf? number) (nan? number))) + ;; FIXME: this isn't right. + (format:out-inf-nan number width digits edigits overch padch)) + (else + (format:parse-float number #t 0) + (format:fn-strip) + (let* ((ee (if edigits (+ edigits 2) 4)) ; for the following algorithm + (ww (if width (- width ee) #f)) ; see Steele's CL book p.395 + (n (if (= format:fn-dot 0) ; number less than (abs 1.0) ? + (- (format:fn-zlead)) + format:fn-dot)) + (d (if digits + digits + (max format:fn-len (min n 7)))) ; q = format:fn-len + (dd (- d n))) + (if (<= 0 dd d) + (begin + (format:out-fixed modifier number (list ww dd #f overch padch)) + (format:out-fill ee #\space)) ;~@T not implemented yet + (format:out-expon modifier number pars)))))))) + + ;; format dollar flonums (~$) + + (define (format:out-dollar modifier number pars) + (if (not (or (number? number) (string? number))) + (format:error "argument is not a number or a number string")) + + (let ((l (length pars))) + (let ((digits (format:par pars l 0 2 "digits")) + (mindig (format:par pars l 1 1 "mindig")) + (width (format:par pars l 2 0 "width")) + (padch (format:par pars l 3 format:space-ch #f))) + + (cond + ((and (number? number) + (or (inf? number) (nan? number))) + (format:out-inf-nan number width digits #f #f padch)) + + (else + (format:parse-float number #t 0) + (if (<= (- format:fn-len format:fn-dot) digits) + (format:fn-zfill #f (- digits (- format:fn-len format:fn-dot))) + (format:fn-round digits)) + (let ((numlen (+ format:fn-len 1))) + (if (or (not format:fn-pos?) (memq modifier '(at colon-at))) + (set! numlen (+ numlen 1))) + (if (and mindig (> mindig format:fn-dot)) + (set! numlen (+ numlen (- mindig format:fn-dot)))) + (if (and (= format:fn-dot 0) (not mindig)) + (set! numlen (+ numlen 1))) + (if (< numlen width) + (case modifier + ((colon) + (if (not format:fn-pos?) + (format:out-char #\-)) + (format:out-fill (- width numlen) (integer->char padch))) + ((at) + (format:out-fill (- width numlen) (integer->char padch)) + (format:out-char (if format:fn-pos? #\+ #\-))) + ((colon-at) + (format:out-char (if format:fn-pos? #\+ #\-)) + (format:out-fill (- width numlen) (integer->char padch))) + (else + (format:out-fill (- width numlen) (integer->char padch)) + (if (not format:fn-pos?) + (format:out-char #\-)))) + (if format:fn-pos? + (if (memq modifier '(at colon-at)) (format:out-char #\+)) + (format:out-char #\-)))) + (if (and mindig (> mindig format:fn-dot)) + (format:out-fill (- mindig format:fn-dot) #\0)) + (if (and (= format:fn-dot 0) (not mindig)) + (format:out-char #\0)) + (format:out-substr format:fn-str 0 format:fn-dot) + (format:out-char #\.) + (format:out-substr format:fn-str format:fn-dot format:fn-len)))))) + + ; the flonum buffers + + (define format:fn-max 400) ; max. number of number digits + (define format:fn-str (make-string format:fn-max)) ; number buffer + (define format:fn-len 0) ; digit length of number + (define format:fn-dot #f) ; dot position of number + (define format:fn-pos? #t) ; number positive? + (define format:en-max 10) ; max. number of exponent digits + (define format:en-str (make-string format:en-max)) ; exponent buffer + (define format:en-len 0) ; digit length of exponent + (define format:en-pos? #t) ; exponent positive? + + (define (format:parse-float num fixed? scale) + (let ((num-str (if (string? num) + num + (number->string (exact->inexact num))))) + (set! format:fn-pos? #t) + (set! format:fn-len 0) + (set! format:fn-dot #f) + (set! format:en-pos? #t) + (set! format:en-len 0) + (do ((i 0 (+ i 1)) + (left-zeros 0) + (mantissa? #t) + (all-zeros? #t) + (num-len (string-length num-str)) + (c #f)) ; current exam. character in num-str + ((= i num-len) + (if (not format:fn-dot) + (set! format:fn-dot format:fn-len)) + + (if all-zeros? + (begin + (set! left-zeros 0) + (set! format:fn-dot 0) + (set! format:fn-len 1))) + + ;; now format the parsed values according to format's need + + (if fixed? + + (begin ; fixed format m.nnn or .nnn + (if (and (> left-zeros 0) (> format:fn-dot 0)) + (if (> format:fn-dot left-zeros) + (begin ; norm 0{0}nn.mm to nn.mm + (format:fn-shiftleft left-zeros) + (set! format:fn-dot (- format:fn-dot left-zeros)) + (set! left-zeros 0)) + (begin ; normalize 0{0}.nnn to .nnn + (format:fn-shiftleft format:fn-dot) + (set! left-zeros (- left-zeros format:fn-dot)) + (set! format:fn-dot 0)))) + (if (or (not (= scale 0)) (> format:en-len 0)) + (let ((shift (+ scale (format:en-int)))) + (cond + (all-zeros? #t) + ((> (+ format:fn-dot shift) format:fn-len) + (format:fn-zfill + #f (- shift (- format:fn-len format:fn-dot))) + (set! format:fn-dot format:fn-len)) + ((< (+ format:fn-dot shift) 0) + (format:fn-zfill #t (- (- shift) format:fn-dot)) + (set! format:fn-dot 0)) + (else + (if (> left-zeros 0) + (if (<= left-zeros shift) ; shift always > 0 here + (format:fn-shiftleft shift) ; shift out 0s + (begin + (format:fn-shiftleft left-zeros) + (set! format:fn-dot (- shift left-zeros)))) + (set! format:fn-dot (+ format:fn-dot shift)))))))) + + (let ((negexp ; expon format m.nnnEee + (if (> left-zeros 0) + (- left-zeros format:fn-dot -1) + (if (= format:fn-dot 0) 1 0)))) + (if (> left-zeros 0) + (begin ; normalize 0{0}.nnn to n.nn + (format:fn-shiftleft left-zeros) + (set! format:fn-dot 1)) + (if (= format:fn-dot 0) + (set! format:fn-dot 1))) + (format:en-set (- (+ (- format:fn-dot scale) (format:en-int)) + negexp)) + (cond + (all-zeros? + (format:en-set 0) + (set! format:fn-dot 1)) + ((< scale 0) ; leading zero + (format:fn-zfill #t (- scale)) + (set! format:fn-dot 0)) + ((> scale format:fn-dot) + (format:fn-zfill #f (- scale format:fn-dot)) + (set! format:fn-dot scale)) + (else + (set! format:fn-dot scale))))) + #t) + + ;; do body + (set! c (string-ref num-str i)) ; parse the output of number->string + (cond ; which can be any valid number + ((char-numeric? c) ; representation of R4RS except + (if mantissa? ; complex numbers + (begin + (if (char=? c #\0) + (if all-zeros? + (set! left-zeros (+ left-zeros 1))) + (begin + (set! all-zeros? #f))) + (string-set! format:fn-str format:fn-len c) + (set! format:fn-len (+ format:fn-len 1))) + (begin + (string-set! format:en-str format:en-len c) + (set! format:en-len (+ format:en-len 1))))) + ((or (char=? c #\-) (char=? c #\+)) + (if mantissa? + (set! format:fn-pos? (char=? c #\+)) + (set! format:en-pos? (char=? c #\+)))) + ((char=? c #\.) + (set! format:fn-dot format:fn-len)) + ((char=? c #\e) + (set! mantissa? #f)) + ((char=? c #\E) + (set! mantissa? #f)) + ((char-whitespace? c) #t) + ((char=? c #\d) #t) ; decimal radix prefix + ((char=? c #\#) #t) + (else + (format:error "illegal character `~c' in number->string" c)))))) + + (define (format:en-int) ; convert exponent string to integer + (if (= format:en-len 0) + 0 + (do ((i 0 (+ i 1)) + (n 0)) + ((= i format:en-len) + (if format:en-pos? + n + (- n))) + (set! n (+ (* n 10) (- (char->integer (string-ref format:en-str i)) + format:zero-ch)))))) + + (define (format:en-set en) ; set exponent string number + (set! format:en-len 0) + (set! format:en-pos? (>= en 0)) + (let ((en-str (number->string en))) + (do ((i 0 (+ i 1)) + (en-len (string-length en-str)) + (c #f)) + ((= i en-len)) + (set! c (string-ref en-str i)) + (if (char-numeric? c) + (begin + (string-set! format:en-str format:en-len c) + (set! format:en-len (+ format:en-len 1))))))) + + (define (format:fn-zfill left? n) ; fill current number string with 0s + (if (> (+ n format:fn-len) format:fn-max) ; from the left or right + (format:error "number is too long to format (enlarge format:fn-max)")) + (set! format:fn-len (+ format:fn-len n)) + (if left? + (do ((i format:fn-len (- i 1))) ; fill n 0s to left + ((< i 0)) + (string-set! format:fn-str i + (if (< i n) + #\0 + (string-ref format:fn-str (- i n))))) + (do ((i (- format:fn-len n) (+ i 1))) ; fill n 0s to the right + ((= i format:fn-len)) + (string-set! format:fn-str i #\0)))) + + (define (format:fn-shiftleft n) ; shift left current number n positions + (if (> n format:fn-len) + (format:error "internal error in format:fn-shiftleft (~d,~d)" + n format:fn-len)) + (do ((i n (+ i 1))) + ((= i format:fn-len) + (set! format:fn-len (- format:fn-len n))) + (string-set! format:fn-str (- i n) (string-ref format:fn-str i)))) + + (define (format:fn-round digits) ; round format:fn-str + (set! digits (+ digits format:fn-dot)) + (do ((i digits (- i 1)) ; "099",2 -> "10" + (c 5)) ; "023",2 -> "02" + ((or (= c 0) (< i 0)) ; "999",2 -> "100" + (if (= c 1) ; "005",2 -> "01" + (begin ; carry overflow + (set! format:fn-len digits) + (format:fn-zfill #t 1) ; add a 1 before fn-str + (string-set! format:fn-str 0 #\1) + (set! format:fn-dot (+ format:fn-dot 1))) + (set! format:fn-len digits))) + (set! c (+ (- (char->integer (string-ref format:fn-str i)) + format:zero-ch) c)) + (string-set! format:fn-str i (integer->char + (if (< c 10) + (+ c format:zero-ch) + (+ (- c 10) format:zero-ch)))) + (set! c (if (< c 10) 0 1)))) + + (define (format:fn-out modifier add-leading-zero?) + (if format:fn-pos? + (if (eq? modifier 'at) + (format:out-char #\+)) + (format:out-char #\-)) + (if (= format:fn-dot 0) + (if add-leading-zero? + (format:out-char #\0)) + (format:out-substr format:fn-str 0 format:fn-dot)) + (format:out-char #\.) + (format:out-substr format:fn-str format:fn-dot format:fn-len)) + + (define (format:en-out edigits expch) + (format:out-char (if expch (integer->char expch) #\E)) + (format:out-char (if format:en-pos? #\+ #\-)) + (if edigits + (if (< format:en-len edigits) + (format:out-fill (- edigits format:en-len) #\0))) + (format:out-substr format:en-str 0 format:en-len)) + + (define (format:fn-strip) ; strip trailing zeros but one + (string-set! format:fn-str format:fn-len #\0) + (do ((i format:fn-len (- i 1))) + ((or (not (char=? (string-ref format:fn-str i) #\0)) + (<= i format:fn-dot)) + (set! format:fn-len (+ i 1))))) + + (define (format:fn-zlead) ; count leading zeros + (do ((i 0 (+ i 1))) + ((or (= i format:fn-len) + (not (char=? (string-ref format:fn-str i) #\0))) + (if (= i format:fn-len) ; found a real zero + 0 + i)))) + + +;;; some global functions not found in SLIB + + (define (string-capitalize-first str) ; "hello" -> "Hello" + (let ((cap-str (string-copy str)) ; "hELLO" -> "Hello" + (non-first-alpha #f) ; "*hello" -> "*Hello" + (str-len (string-length str))) ; "hello you" -> "Hello you" + (do ((i 0 (+ i 1))) + ((= i str-len) cap-str) + (let ((c (string-ref str i))) + (if (char-alphabetic? c) + (if non-first-alpha + (string-set! cap-str i (char-downcase c)) + (begin + (set! non-first-alpha #t) + (string-set! cap-str i (char-upcase c))))))))) + + ;; Aborts the program when a formatting error occures. This is a null + ;; argument closure to jump to the interpreters toplevel continuation. + + (define (format:abort) (error "error in format")) + + (let ((arg-pos (format:format-work format-string format-args)) + (arg-len (length format-args))) + (cond + ((> arg-pos arg-len) + (set! format:arg-pos (+ arg-len 1)) + (display format:arg-pos) + (format:error "~a missing argument~:p" (- arg-pos arg-len))) + (else + (if flush-output? + (force-output port)) + (if destination + #t + (let ((str (get-output-string port))) + (close-port port) + str))))))) + +(begin-deprecated + (set! format + (let ((format format)) + (case-lambda + ((destination format-string . args) + (if (string? destination) + (begin + (issue-deprecation-warning + "Omitting the destination on a call to format is deprecated." + "Pass #f as the destination, before the format string.") + (apply format #f destination format-string args)) + (apply format destination format-string args))) + ((deprecated-format-string-only) + (issue-deprecation-warning + "Omitting the destination port on a call to format is deprecated." + "Pass #f as the destination port, before the format string.") + (format #f deprecated-format-string-only)))))) + + +;; Thanks to Shuji Narazaki +(module-set! the-root-module 'format format) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/ftw.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/ftw.scm new file mode 100644 index 0000000000000000000000000000000000000000..78636286a4d2afe2aebc5e2ff53a8e30b84817bb --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/ftw.scm @@ -0,0 +1,564 @@ +;;;; ftw.scm --- file system tree walk + +;;;; Copyright (C) 2002, 2003, 2006, 2011, 2012, 2014, 2016 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Author: Thien-Thi Nguyen + +;;; Commentary: + +;; Two procedures are provided: `ftw' and `nftw'. + +;; NOTE: The following description was adapted from the GNU libc info page, w/ +;; significant modifications for a more "Schemey" interface. Most noticible +;; are the inlining of `struct FTW *' parameters `base' and `level' and the +;; omission of `descriptors' parameters. + +;; * Types +;; +;; The X/Open specification defines two procedures to process whole +;; hierarchies of directories and the contained files. Both procedures +;; of this `ftw' family take as one of the arguments a callback procedure +;; which must be of these types. +;; +;; - Data Type: __ftw_proc_t +;; (lambda (filename statinfo flag) ...) => status +;; +;; Type for callback procedures given to the `ftw' procedure. The +;; first parameter is a filename, the second parameter is the +;; vector value as returned by calling `stat' on FILENAME. +;; +;; The last parameter is a symbol giving more information about +;; FILENAM. It can have one of the following values: +;; +;; `regular' +;; The current item is a normal file or files which do not fit +;; into one of the following categories. This means +;; especially special files, sockets etc. +;; +;; `directory' +;; The current item is a directory. +;; +;; `invalid-stat' +;; The `stat' call to fill the object pointed to by the second +;; parameter failed and so the information is invalid. +;; +;; `directory-not-readable' +;; The item is a directory which cannot be read. +;; +;; `symlink' +;; The item is a symbolic link. Since symbolic links are +;; normally followed seeing this value in a `ftw' callback +;; procedure means the referenced file does not exist. The +;; situation for `nftw' is different. +;; +;; - Data Type: __nftw_proc_t +;; (lambda (filename statinfo flag base level) ...) => status +;; +;; The first three arguments have the same as for the +;; `__ftw_proc_t' type. A difference is that for the third +;; argument some additional values are defined to allow finer +;; differentiation: +;; +;; `directory-processed' +;; The current item is a directory and all subdirectories have +;; already been visited and reported. This flag is returned +;; instead of `directory' if the `depth' flag is given to +;; `nftw' (see below). +;; +;; `stale-symlink' +;; The current item is a stale symbolic link. The file it +;; points to does not exist. +;; +;; The last two parameters are described below. They contain +;; information to help interpret FILENAME and give some information +;; about current state of the traversal of the directory hierarchy. +;; +;; `base' +;; The value specifies which part of the filename argument +;; given in the first parameter to the callback procedure is +;; the name of the file. The rest of the string is the path +;; to locate the file. This information is especially +;; important if the `chdir' flag for `nftw' was set since then +;; the current directory is the one the current item is found +;; in. +;; +;; `level' +;; While processing the directory the procedures tracks how +;; many directories have been examined to find the current +;; item. This nesting level is 0 for the item given starting +;; item (file or directory) and is incremented by one for each +;; entered directory. +;; +;; * Procedure: (ftw filename proc . options) +;; Do a file system tree walk starting at FILENAME using PROC. +;; +;; The `ftw' procedure calls the callback procedure given in the +;; parameter PROC for every item which is found in the directory +;; specified by FILENAME and all directories below. The procedure +;; follows symbolic links if necessary but does not process an item +;; twice. If FILENAME names no directory this item is the only +;; object reported by calling the callback procedure. +;; +;; The filename given to the callback procedure is constructed by +;; taking the FILENAME parameter and appending the names of all +;; passed directories and then the local file name. So the +;; callback procedure can use this parameter to access the file. +;; Before the callback procedure is called `ftw' calls `stat' for +;; this file and passes the information up to the callback +;; procedure. If this `stat' call was not successful the failure is +;; indicated by setting the flag argument of the callback procedure +;; to `invalid-stat'. Otherwise the flag is set according to the +;; description given in the description of `__ftw_proc_t' above. +;; +;; The callback procedure is expected to return non-#f to indicate +;; that no error occurred and the processing should be continued. +;; If an error occurred in the callback procedure or the call to +;; `ftw' shall return immediately the callback procedure can return +;; #f. This is the only correct way to stop the procedure. The +;; program must not use `throw' or similar techniques to continue +;; the program in another place. [Can we relax this? --ttn] +;; +;; The return value of the `ftw' procedure is #t if all callback +;; procedure calls returned #t and all actions performed by the +;; `ftw' succeeded. If some procedure call failed (other than +;; calling `stat' on an item) the procedure returns #f. If a +;; callback procedure returns a value other than #t this value is +;; returned as the return value of `ftw'. +;; +;; * Procedure: (nftw filename proc . control-flags) +;; Do a new-style file system tree walk starting at FILENAME using PROC. +;; Various optional CONTROL-FLAGS alter the default behavior. +;; +;; The `nftw' procedures works like the `ftw' procedures. It calls +;; the callback procedure PROC for all items it finds in the +;; directory FILENAME and below. +;; +;; The differences are that for one the callback procedure is of a +;; different type. It takes also `base' and `level' parameters as +;; described above. +;; +;; The second difference is that `nftw' takes additional optional +;; arguments which are zero or more of the following symbols: +;; +;; physical' +;; While traversing the directory symbolic links are not +;; followed. I.e., if this flag is given symbolic links are +;; reported using the `symlink' value for the type parameter +;; to the callback procedure. Please note that if this flag is +;; used the appearance of `symlink' in a callback procedure +;; does not mean the referenced file does not exist. To +;; indicate this the extra value `stale-symlink' exists. +;; +;; mount' +;; The callback procedure is only called for items which are on +;; the same mounted file system as the directory given as the +;; FILENAME parameter to `nftw'. +;; +;; chdir' +;; If this flag is given the current working directory is +;; changed to the directory containing the reported object +;; before the callback procedure is called. +;; +;; depth' +;; If this option is given the procedure visits first all files +;; and subdirectories before the callback procedure is called +;; for the directory itself (depth-first processing). This +;; also means the type flag given to the callback procedure is +;; `directory-processed' and not `directory'. +;; +;; The return value is computed in the same way as for `ftw'. +;; `nftw' returns #t if no failure occurred in `nftw' and all +;; callback procedure call return values are also #t. For internal +;; errors such as memory problems the error `ftw-error' is thrown. +;; If the return value of a callback invocation is not #t this +;; very same value is returned. + +;;; Code: + +(define-module (ice-9 ftw) + #:use-module (ice-9 match) + #:use-module (ice-9 vlist) + #:use-module (srfi srfi-1) + #:autoload (ice-9 i18n) (string-locale cadr) + (else 211)))) + (stat&flag (stat&flag-proc + (stat-dir-readable?-proc (getuid) (getgid))))) + (letrec ((go (lambda (fullname) + (call-with-values (lambda () (stat&flag fullname)) + (lambda (s flag) + (or (visited? s) + (let ((ret (proc fullname s flag))) ; callback + (or (eq? #t ret) + (throw 'ftw-early-exit ret)) + (and (eq? 'directory flag) + (for-each + (lambda (child) + (go (pathify fullname child))) + (directory-files fullname))) + #t))))))) + (catch 'ftw-early-exit + (lambda () (go (clean filename))) + (lambda (key val) val))))) + +(define (nftw filename proc . control-flags) + (let* ((od (getcwd)) ; orig dir + (odev (let ((s (false-if-exception (lstat filename)))) + (if s (stat:dev s) -1))) + (same-dev? (if (memq 'mount control-flags) + (lambda (s) (= (stat:dev s) odev)) + (lambda (s) #t))) + (base-sub (lambda (name base) (substring name 0 base))) + (maybe-cd (if (memq 'chdir control-flags) + (if (abs? filename) + (lambda (fullname base) + (or (= 0 base) + (chdir (base-sub fullname base)))) + (lambda (fullname base) + (chdir + (pathify od (base-sub fullname base))))) + (lambda (fullname base) #t))) + (maybe-cd-back (if (memq 'chdir control-flags) + (lambda () (chdir od)) + (lambda () #t))) + (depth-first? (memq 'depth control-flags)) + (visited? (visited?-proc + (cond ((memq 'hash-size control-flags) => cadr) + (else 211)))) + (has-kids? (if depth-first? + (lambda (flag) (eq? flag 'directory-processed)) + (lambda (flag) (eq? flag 'directory)))) + (stat&flag (apply stat&flag-proc + (stat-dir-readable?-proc (getuid) (getgid)) + (cons 'nftw-style control-flags)))) + (letrec ((go (lambda (fullname base level) + (call-with-values (lambda () (stat&flag fullname)) + (lambda (s flag) + (letrec ((self (lambda () + (maybe-cd fullname base) + ;; the callback + (let ((ret (proc fullname s flag + base level))) + (maybe-cd-back) + (or (eq? #t ret) + (throw 'nftw-early-exit ret))))) + (kids (lambda () + (and (has-kids? flag) + (for-each + (lambda (child) + (go (pathify fullname child) + (1+ (string-length + fullname)) + (1+ level))) + (directory-files fullname)))))) + (or (visited? s) + (not (same-dev? s)) + (if depth-first? + (begin (kids) (self)) + (begin (self) (kids))))))) + #t))) + (let ((ret (catch 'nftw-early-exit + (lambda () (go (clean filename) 0 0)) + (lambda (key val) val)))) + (chdir od) + ret)))) + + +;;; +;;; `file-system-fold' & co. +;;; + +(define-syntax-rule (errno-if-exception expr) + (catch 'system-error + (lambda () + expr) + (lambda args + (system-error-errno args)))) + +(define* (file-system-fold enter? leaf down up skip error init file-name + #:optional (stat lstat)) + "Traverse the directory at FILE-NAME, recursively. Enter +sub-directories only when (ENTER? PATH STAT RESULT) returns true. When +a sub-directory is entered, call (DOWN PATH STAT RESULT), where PATH is +the path of the sub-directory and STAT the result of (stat PATH); when +it is left, call (UP PATH STAT RESULT). For each file in a directory, +call (LEAF PATH STAT RESULT). When ENTER? returns false, call (SKIP +PATH STAT RESULT). When an `opendir' or STAT call raises an exception, +call (ERROR PATH STAT ERRNO RESULT), with ERRNO being the operating +system error number that was raised. + +Return the result of these successive applications. +When FILE-NAME names a flat file, (LEAF PATH STAT INIT) is returned. +The optional STAT parameter defaults to `lstat'." + + (define (mark v s) + (vhash-cons (cons (stat:dev s) (stat:ino s)) #t v)) + + (define (visited? v s) + (vhash-assoc (cons (stat:dev s) (stat:ino s)) v)) + + (let loop ((name file-name) + (path "") + (dir-stat (errno-if-exception (stat file-name))) + (result init) + (visited vlist-null)) + + (define full-name + (if (string=? path "") + name + (string-append path "/" name))) + + (cond + ((integer? dir-stat) + ;; FILE-NAME is not readable. + (error full-name #f dir-stat result)) + ((visited? visited dir-stat) + (values result visited)) + ((eq? 'directory (stat:type dir-stat)) ; true except perhaps the 1st time + (if (enter? full-name dir-stat result) + (let ((dir (errno-if-exception (opendir full-name))) + (visited (mark visited dir-stat))) + (cond + ((directory-stream? dir) + (let liip ((entry (readdir dir)) + (result (down full-name dir-stat result)) + (subdirs '())) + (cond ((eof-object? entry) + (begin + (closedir dir) + (let ((r+v + (fold (lambda (subdir result+visited) + (call-with-values + (lambda () + (loop (car subdir) + full-name + (cdr subdir) + (car result+visited) + (cdr result+visited))) + cons)) + (cons result visited) + subdirs))) + (values (up full-name dir-stat (car r+v)) + (cdr r+v))))) + ((or (string=? entry ".") + (string=? entry "..")) + (liip (readdir dir) + result + subdirs)) + (else + (let* ((child (string-append full-name "/" entry)) + (st (errno-if-exception (stat child)))) + (if (integer? st) ; CHILD is a dangling symlink? + (liip (readdir dir) + (error child #f st result) + subdirs) + (if (eq? (stat:type st) 'directory) + (liip (readdir dir) + result + (alist-cons entry st subdirs)) + (liip (readdir dir) + (leaf child st result) + subdirs)))))))) + (else + ;; Directory FULL-NAME not readable, but it is stat'able. + (values (error full-name dir-stat dir result) + visited)))) + (values (skip full-name dir-stat result) + (mark visited dir-stat)))) + (else + ;; Caller passed a FILE-NAME that names a flat file, not a directory. + (leaf full-name dir-stat result))))) + +(define* (file-system-tree file-name + #:optional (enter? (lambda (n s) #t)) + (stat lstat)) + "Return a tree of the form (FILE-NAME STAT CHILDREN ...) where STAT is +the result of (STAT FILE-NAME) and CHILDREN are similar structures for +each file contained in FILE-NAME when it designates a directory. The +optional ENTER? predicate is invoked as (ENTER? NAME STAT) and should +return true to allow recursion into directory NAME; the default value is +a procedure that always returns #t. When a directory does not match +ENTER?, it nonetheless appears in the resulting tree, only with zero +children. The optional STAT parameter defaults to `lstat'. Return #f +when FILE-NAME is not readable." + (define (enter?* name stat result) + (enter? name stat)) + (define (leaf name stat result) + (match result + (((siblings ...) rest ...) + (cons (alist-cons (basename name) (cons stat '()) siblings) + rest)))) + (define (down name stat result) + (cons '() result)) + (define (up name stat result) + (match result + (((children ...) (siblings ...) rest ...) + (cons (alist-cons (basename name) (cons stat children) + siblings) + rest)))) + (define skip ; keep an entry for skipped directories + leaf) + (define (error name stat errno result) + (if (string=? name file-name) + result + (leaf name stat result))) + + (match (file-system-fold enter?* leaf down up skip error '(()) + file-name stat) + (((tree)) tree) + ((()) #f))) ; FILE-NAME is unreadable + +(define* (scandir name #:optional (select? (const #t)) + (entry (opendir* name) + (lambda (stream) + (let loop ((entry (readdir stream)) + (files '())) + (if (eof-object? entry) + (begin + (closedir stream) + (sort files entry +;;; +;;; Commentary: +;;; +;;; This module provides an implementation of futures, a mechanism for +;;; fine-grain parallelism. Futures were first described by Henry Baker +;;; in ``The Incremental Garbage Collection of Processes'', 1977, and +;;; then implemented in MultiLisp (an implicit variant thereof, i.e., +;;; without `touch'.) +;;; +;;; This modules uses a fixed thread pool, normally one per CPU core. +;;; Futures are off-loaded to these threads, when they are idle. +;;; +;;; Code: + + +;;; +;;; Futures. +;;; + +(define-record-type + (%make-future thunk state mutex completion) + future? + (thunk future-thunk set-future-thunk!) + (state future-state set-future-state!) ; done | started | queued + (result future-result set-future-result!) + (mutex future-mutex) + (completion future-completion)) ; completion cond. var. + +(set-record-type-printer! + + (lambda (future port) + (simple-format port "#" + (number->string (object-address future) 16) + (future-state future) + (future-thunk future)))) + +(define (make-future thunk) + "Return a new future for THUNK. Execution may start at any point +concurrently, or it can start at the time when the returned future is +touched." + (create-workers!) + (let ((future (%make-future thunk 'queued + (make-mutex) (make-condition-variable)))) + (register-future! future) + future)) + + +;;; +;;; Future queues. +;;; + +;; Global queue of pending futures. +;; TODO: Use per-worker queues to reduce contention. +(define %futures (make-q)) + +;; Lock for %FUTURES and %FUTURES-WAITING. +(define %futures-mutex (make-mutex)) +(define %futures-available (make-condition-variable)) + +;; A mapping of nested futures to futures waiting for them to complete. +(define %futures-waiting '()) + +;; Whether currently running within a future. +(define %within-future? (make-parameter #f)) + +(define-syntax-rule (with-mutex m e0 e1 ...) + ;; Copied from (ice-9 threads) to avoid circular dependency. + (let ((x m)) + (dynamic-wind + (lambda () (lock-mutex x)) + (lambda () (begin e0 e1 ...)) + (lambda () (unlock-mutex x))))) + +(define %future-prompt + ;; The prompt futures abort to when they want to wait for another + ;; future. + (make-prompt-tag)) + + +(define (register-future! future) + ;; Register FUTURE as being processable. + (lock-mutex %futures-mutex) + (enq! %futures future) + (signal-condition-variable %futures-available) + (unlock-mutex %futures-mutex)) + +(define (process-future! future) + "Process FUTURE. When FUTURE completes, return #t and update its +result; otherwise, when FUTURE touches a nested future that has not +completed yet, then suspend it and return #f. Suspending a future +consists in capturing its continuation, marking it as `queued', and +adding it to the waiter queue." + (let/ec return + (let* ((suspend + (lambda (cont future-to-wait) + ;; FUTURE wishes to wait for the completion of FUTURE-TO-WAIT. + ;; At this point, FUTURE is unlocked and in `started' state, + ;; and FUTURE-TO-WAIT is unlocked. + (with-mutex %futures-mutex + (with-mutex (future-mutex future) + (set-future-thunk! future cont) + (set-future-state! future 'queued)) + + (with-mutex (future-mutex future-to-wait) + ;; If FUTURE-TO-WAIT completed in the meantime, then + ;; reschedule FUTURE directly; otherwise, add it to the + ;; waiter queue. + (if (eq? 'done (future-state future-to-wait)) + (begin + (enq! %futures future) + (signal-condition-variable %futures-available)) + (set! %futures-waiting + (alist-cons future-to-wait future + %futures-waiting)))) + + (return #f)))) + (thunk (lambda () + (call-with-prompt %future-prompt + (lambda () + (parameterize ((%within-future? #t)) + ((future-thunk future)))) + suspend)))) + (set-future-result! future + (catch #t + (lambda () + (call-with-values thunk + (lambda results + (lambda () + (apply values results))))) + (lambda args + (lambda () + (apply throw args))))) + #t))) + +(define (process-one-future) + "Attempt to pick one future from the queue and process it." + ;; %FUTURES-MUTEX must be locked on entry, and is locked on exit. + (or (q-empty? %futures) + (let ((future (deq! %futures))) + (lock-mutex (future-mutex future)) + (case (future-state future) + ((done started) + ;; Nothing to do. + (unlock-mutex (future-mutex future))) + (else + ;; Do the actual work. + + ;; We want to release %FUTURES-MUTEX so that other workers can + ;; progress. However, to avoid deadlocks, we have to unlock + ;; FUTURE as well, to preserve lock ordering. + (unlock-mutex (future-mutex future)) + (unlock-mutex %futures-mutex) + + (lock-mutex (future-mutex future)) + (if (eq? (future-state future) 'queued) ; lost the race? + (begin ; no, so let's process it + (set-future-state! future 'started) + (unlock-mutex (future-mutex future)) + + (let ((done? (process-future! future))) + (when done? + (with-mutex %futures-mutex + (with-mutex (future-mutex future) + (set-future-state! future 'done) + (notify-completion future)))))) + (unlock-mutex (future-mutex future))) ; yes + + (lock-mutex %futures-mutex)))))) + +(define (process-futures) + "Continuously process futures from the queue." + (lock-mutex %futures-mutex) + (let loop () + (when (q-empty? %futures) + (wait-condition-variable %futures-available + %futures-mutex)) + + (process-one-future) + (loop))) + +(define (notify-completion future) + "Notify futures and callers waiting that FUTURE completed." + ;; FUTURE and %FUTURES-MUTEX are locked. + (broadcast-condition-variable (future-completion future)) + (let-values (((waiting remaining) + (partition (match-lambda ; TODO: optimize + ((waitee . _) + (eq? waitee future))) + %futures-waiting))) + (set! %futures-waiting remaining) + (for-each (match-lambda + ((_ . waiter) + (enq! %futures waiter))) + waiting))) + +(define (touch future) + "Return the result of FUTURE, computing it if not already done." + (define (work) + ;; Do some work while waiting for FUTURE to complete. + (lock-mutex %futures-mutex) + (if (q-empty? %futures) + (begin + (unlock-mutex %futures-mutex) + (with-mutex (future-mutex future) + (unless (eq? 'done (future-state future)) + (wait-condition-variable (future-completion future) + (future-mutex future))))) + (begin + (process-one-future) + (unlock-mutex %futures-mutex)))) + + (let loop () + (lock-mutex (future-mutex future)) + (case (future-state future) + ((done) + (unlock-mutex (future-mutex future))) + ((started) + (unlock-mutex (future-mutex future)) + (if (%within-future?) + (abort-to-prompt %future-prompt future) + (begin + (work) + (loop)))) + (else + (unlock-mutex (future-mutex future)) + (work) + (loop)))) + ((future-result future))) + + +;;; +;;; Workers. +;;; + +(define %worker-count + (if (provided? 'threads) + (- (current-processor-count) 1) + 0)) + +;; A dock of workers that stay here forever. + +;; TODO +;; 1. Allow the pool to be shrunk, as in libgomp (though that we'd +;; need semaphores, which aren't yet in libguile!). +;; 2. Provide a `worker-count' fluid. +(define %workers '()) + +(define (%create-workers!) + (with-mutex + %futures-mutex + ;; Setting 'create-workers!' to a no-op is an optimization, but it is + ;; still possible for '%create-workers!' to be called more than once + ;; from different threads. Therefore, to avoid creating %workers more + ;; than once (and thus creating too many threads), we check to make + ;; sure %workers is empty within the critical section. + (when (null? %workers) + (set! %workers + (unfold (lambda (i) (>= i %worker-count)) + (lambda (i) (call-with-new-thread process-futures)) + 1+ + 0)) + (set! create-workers! (lambda () #t))))) + +(define create-workers! + (lambda () (%create-workers!))) + + +;;; +;;; Syntax. +;;; + +(define-syntax-rule (future body) + "Return a new future for BODY." + (make-future (lambda () body))) + +;;; Local Variables: +;;; eval: (put 'with-mutex 'scheme-indent-function 1) +;;; End: diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/gap-buffer.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/gap-buffer.scm new file mode 100644 index 0000000000000000000000000000000000000000..4533bb539084285e8edb27e213845b5fb2672886 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/gap-buffer.scm @@ -0,0 +1,283 @@ +;;; gap-buffer.scm --- String buffer that supports point + +;;; Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. +;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;; + +;;; Author: Thien-Thi Nguyen + +;;; Commentary: + +;; A gap buffer is a structure that models a string but allows relatively +;; efficient insertion of text somewhere in the middle. The insertion +;; location is called `point' with minimum value 1, and a maximum value of the +;; length of the string (which is not fixed). +;; +;; Specifically, we allocate a continuous buffer of characters that is +;; composed of the BEFORE, the GAP and the AFTER (reading L->R), like so: +;; +;; +--- POINT +;; v +;; +--------------------+--------------------+--------------------+ +;; | BEFORE | GAP | AFTER | +;; +--------------------+--------------------+--------------------+ +;; +;; <----- bef-sz ----->|<----- gap-sz ----->|<----- aft-sz -----> +;; +;; <-------------------| usr-sz |-------------------> +;; +;; <-------------------------- all-sz --------------------------> +;; +;; This diagram also shows how the different sizes are computed, and the +;; location of POINT. Note that the user-visible buffer size `usr-sz' does +;; NOT include the GAP, while the allocation `all-sz' DOES. +;; +;; The consequence of this arrangement is that "moving point" is simply a +;; matter of kicking characters across the GAP, while insertion can be viewed +;; as filling up the gap, increasing `bef-sz' and decreasing `gap-sz'. When +;; `gap-sz' falls below some threshold, we reallocate with a larger `all-sz'. +;; +;; In the implementation, we actually keep track of the AFTER start offset +;; `aft-ofs' since it is used more often than `gap-sz'. In fact, most of the +;; variables in the diagram are for conceptualization only. +;; +;; A gap buffer port is a soft port (see Guile manual) that wraps a gap +;; buffer. Character and string writes, as well as character reads, are +;; supported. Flushing and closing are not supported. +;; +;; These procedures are exported: +;; (gb? OBJ) +;; (make-gap-buffer . INIT) +;; (gb-point GB) +;; (gb-point-min GB) +;; (gb-point-max GB) +;; (gb-insert-string! GB STRING) +;; (gb-insert-char! GB CHAR) +;; (gb-delete-char! GB COUNT) +;; (gb-goto-char GB LOCATION) +;; (gb->string GB) +;; (gb-filter! GB STRING-PROC) +;; (gb->lines GB) +;; (gb-filter-lines! GB LINES-PROC) +;; (make-gap-buffer-port GB) +;; +;; INIT is an optional port or a string. COUNT and LOCATION are integers. +;; STRING-PROC is a procedure that takes and returns a string. LINES-PROC is +;; a procedure that takes and returns a list of strings, each representing a +;; line of text (newlines are stripped and added back automatically). +;; +;; (The term and concept of "gap buffer" are borrowed from Emacs. We will +;; gladly return them when libemacs.so is available. ;-) +;; +;; Notes: +;; - overrun errors are suppressed silently + +;;; Code: + +(define-module (ice-9 gap-buffer) + :autoload (srfi srfi-13) (string-join) + :export (gb? + make-gap-buffer + gb-point + gb-point-min + gb-point-max + gb-insert-string! + gb-insert-char! + gb-delete-char! + gb-erase! + gb-goto-char + gb->string + gb-filter! + gb->lines + gb-filter-lines! + make-gap-buffer-port)) + +(define gap-buffer + (make-record-type 'gap-buffer + '(s ; the buffer, a string + all-sz ; total allocation + gap-ofs ; GAP starts, aka (1- point) + aft-ofs ; AFTER starts + ))) + +(define gb? (record-predicate gap-buffer)) + +(define s: (record-accessor gap-buffer 's)) +(define all-sz: (record-accessor gap-buffer 'all-sz)) +(define gap-ofs: (record-accessor gap-buffer 'gap-ofs)) +(define aft-ofs: (record-accessor gap-buffer 'aft-ofs)) + +(define s! (record-modifier gap-buffer 's)) +(define all-sz! (record-modifier gap-buffer 'all-sz)) +(define gap-ofs! (record-modifier gap-buffer 'gap-ofs)) +(define aft-ofs! (record-modifier gap-buffer 'aft-ofs)) + +;; todo: expose +(define default-initial-allocation 128) +(define default-chunk-size 128) +(define default-realloc-threshold 32) + +(define (round-up n) + (* default-chunk-size (+ 1 (quotient n default-chunk-size)))) + +(define new (record-constructor gap-buffer '())) + +(define (realloc gb inc) + (let* ((old-s (s: gb)) + (all-sz (all-sz: gb)) + (new-sz (+ all-sz inc)) + (gap-ofs (gap-ofs: gb)) + (aft-ofs (aft-ofs: gb)) + (new-s (make-string new-sz)) + (new-aft-ofs (+ aft-ofs inc))) + (substring-move! old-s 0 gap-ofs new-s 0) + (substring-move! old-s aft-ofs all-sz new-s new-aft-ofs) + (s! gb new-s) + (all-sz! gb new-sz) + (aft-ofs! gb new-aft-ofs))) + +(define (make-gap-buffer . init) ; port/string + (let ((gb (new))) + (cond ((null? init) + (s! gb (make-string default-initial-allocation)) + (all-sz! gb default-initial-allocation) + (gap-ofs! gb 0) + (aft-ofs! gb default-initial-allocation)) + (else (let ((jam! (lambda (string len) + (let ((alloc (round-up len))) + (s! gb (make-string alloc)) + (all-sz! gb alloc) + (substring-move! string 0 len (s: gb) 0) + (gap-ofs! gb len) + (aft-ofs! gb alloc)))) + (v (car init))) + (cond ((port? v) + (let ((next (lambda () (read-char v)))) + (let loop ((c (next)) (acc '()) (len 0)) + (if (eof-object? c) + (jam! (list->string (reverse acc)) len) + (loop (next) (cons c acc) (1+ len)))))) + ((string? v) + (jam! v (string-length v))) + (else (error "bad init type")))))) + gb)) + +(define (gb-point gb) + (1+ (gap-ofs: gb))) + +(define (gb-point-min gb) 1) ; no narrowing (for now) + +(define (gb-point-max gb) + (1+ (- (all-sz: gb) (- (aft-ofs: gb) (gap-ofs: gb))))) + +(define (insert-prep gb len) + (let* ((gap-ofs (gap-ofs: gb)) + (aft-ofs (aft-ofs: gb)) + (slack (- (- aft-ofs gap-ofs) len))) + (and (< slack default-realloc-threshold) + (realloc gb (round-up (- slack)))) + gap-ofs)) + +(define (gb-insert-string! gb string) + (let* ((len (string-length string)) + (gap-ofs (insert-prep gb len))) + (substring-move! string 0 len (s: gb) gap-ofs) + (gap-ofs! gb (+ gap-ofs len)))) + +(define (gb-insert-char! gb char) + (let ((gap-ofs (insert-prep gb 1))) + (string-set! (s: gb) gap-ofs char) + (gap-ofs! gb (+ gap-ofs 1)))) + +(define (gb-delete-char! gb count) + (cond ((< count 0) ; backwards + (gap-ofs! gb (max 0 (+ (gap-ofs: gb) count)))) + ((> count 0) ; forwards + (aft-ofs! gb (min (all-sz: gb) (+ (aft-ofs: gb) count)))) + ((= count 0) ; do nothing + #t))) + +(define (gb-erase! gb) + (gap-ofs! gb 0) + (aft-ofs! gb (all-sz: gb))) + +(define (point++n! gb n s gap-ofs aft-ofs) ; n>0; warning: reckless + (substring-move! s aft-ofs (+ aft-ofs n) s gap-ofs) + (gap-ofs! gb (+ gap-ofs n)) + (aft-ofs! gb (+ aft-ofs n))) + +(define (point+-n! gb n s gap-ofs aft-ofs) ; n<0; warning: reckless + (substring-move! s (+ gap-ofs n) gap-ofs s (+ aft-ofs n)) + (gap-ofs! gb (+ gap-ofs n)) + (aft-ofs! gb (+ aft-ofs n))) + +(define (gb-goto-char gb new-point) + (let ((pmax (gb-point-max gb))) + (or (and (< new-point 1) (gb-goto-char gb 1)) + (and (> new-point pmax) (gb-goto-char gb pmax)) + (let ((delta (- new-point (gb-point gb)))) + (or (= delta 0) + ((if (< delta 0) + point+-n! + point++n!) + gb delta (s: gb) (gap-ofs: gb) (aft-ofs: gb)))))) + new-point) + +(define (gb->string gb) + (let ((s (s: gb))) + (string-append (substring s 0 (gap-ofs: gb)) + (substring s (aft-ofs: gb))))) + +(define (gb-filter! gb string-proc) + (let ((new (string-proc (gb->string gb)))) + (gb-erase! gb) + (gb-insert-string! gb new))) + +(define (gb->lines gb) + (let ((str (gb->string gb))) + (let loop ((start 0) (acc '())) + (cond ((string-index str #\newline start) + => (lambda (w) + (loop (1+ w) (cons (substring str start w) acc)))) + (else (reverse (cons (substring str start) acc))))))) + +(define (gb-filter-lines! gb lines-proc) + (let ((new-lines (lines-proc (gb->lines gb)))) + (gb-erase! gb) + (gb-insert-string! gb (string-join new-lines #\newline)))) + +(define (make-gap-buffer-port gb) + (or (gb? gb) + (error "not a gap-buffer:" gb)) + (make-soft-port + (vector + (lambda (c) (gb-insert-char! gb c)) + (lambda (s) (gb-insert-string! gb s)) + #f + (lambda () (let ((gap-ofs (gap-ofs: gb)) + (aft-ofs (aft-ofs: gb))) + (if (= aft-ofs (all-sz: gb)) + #f + (let* ((s (s: gb)) + (c (string-ref s aft-ofs))) + (string-set! s gap-ofs c) + (gap-ofs! gb (1+ gap-ofs)) + (aft-ofs! gb (1+ aft-ofs)) + c)))) + #f) + "rw")) + +;;; gap-buffer.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/getopt-long.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/getopt-long.scm new file mode 100644 index 0000000000000000000000000000000000000000..14eaf8e23bf0d03e1734876e6fb3a051e355cc61 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/getopt-long.scm @@ -0,0 +1,371 @@ +;;; Copyright (C) 1998, 2001, 2006, 2009, 2011 Free Software Foundation, Inc. +;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Author: Russ McManus (rewritten by Thien-Thi Nguyen) + +;;; Commentary: + +;;; This module implements some complex command line option parsing, in +;;; the spirit of the GNU C library function `getopt_long'. Both long +;;; and short options are supported. +;;; +;;; The theory is that people should be able to constrain the set of +;;; options they want to process using a grammar, rather than some arbitrary +;;; structure. The grammar makes the option descriptions easy to read. +;;; +;;; `getopt-long' is a procedure for parsing command-line arguments in a +;;; manner consistent with other GNU programs. `option-ref' is a procedure +;;; that facilitates processing of the `getopt-long' return value. + +;;; (getopt-long ARGS GRAMMAR) +;;; Parse the arguments ARGS according to the argument list grammar GRAMMAR. +;;; +;;; ARGS should be a list of strings. Its first element should be the +;;; name of the program; subsequent elements should be the arguments +;;; that were passed to the program on the command line. The +;;; `program-arguments' procedure returns a list of this form. +;;; +;;; GRAMMAR is a list of the form: +;;; ((OPTION (PROPERTY VALUE) ...) ...) +;;; +;;; Each OPTION should be a symbol. `getopt-long' will accept a +;;; command-line option named `--OPTION'. +;;; Each option can have the following (PROPERTY VALUE) pairs: +;;; +;;; (single-char CHAR) --- Accept `-CHAR' as a single-character +;;; equivalent to `--OPTION'. This is how to specify traditional +;;; Unix-style flags. +;;; (required? BOOL) --- If BOOL is true, the option is required. +;;; getopt-long will raise an error if it is not found in ARGS. +;;; (value BOOL) --- If BOOL is #t, the option accepts a value; if +;;; it is #f, it does not; and if it is the symbol +;;; `optional', the option may appear in ARGS with or +;;; without a value. +;;; (predicate FUNC) --- If the option accepts a value (i.e. you +;;; specified `(value #t)' for this option), then getopt +;;; will apply FUNC to the value, and throw an exception +;;; if it returns #f. FUNC should be a procedure which +;;; accepts a string and returns a boolean value; you may +;;; need to use quasiquotes to get it into GRAMMAR. +;;; +;;; The (PROPERTY VALUE) pairs may occur in any order, but each +;;; property may occur only once. By default, options do not have +;;; single-character equivalents, are not required, and do not take +;;; values. +;;; +;;; In ARGS, single-character options may be combined, in the usual +;;; Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option +;;; accepts values, then it must be the last option in the +;;; combination; the value is the next argument. So, for example, using +;;; the following grammar: +;;; ((apples (single-char #\a)) +;;; (blimps (single-char #\b) (value #t)) +;;; (catalexis (single-char #\c) (value #t))) +;;; the following argument lists would be acceptable: +;;; ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values +;;; for "blimps" and "catalexis") +;;; ("-ab" "bang" "-c" "couth") (same) +;;; ("-ac" "couth" "-b" "bang") (same) +;;; ("-abc" "couth" "bang") (an error, since `-b' is not the +;;; last option in its combination) +;;; +;;; If an option's value is optional, then `getopt-long' decides +;;; whether it has a value by looking at what follows it in ARGS. If +;;; the next element is does not appear to be an option itself, then +;;; that element is the option's value. +;;; +;;; The value of a long option can appear as the next element in ARGS, +;;; or it can follow the option name, separated by an `=' character. +;;; Thus, using the same grammar as above, the following argument lists +;;; are equivalent: +;;; ("--apples" "Braeburn" "--blimps" "Goodyear") +;;; ("--apples=Braeburn" "--blimps" "Goodyear") +;;; ("--blimps" "Goodyear" "--apples=Braeburn") +;;; +;;; If the option "--" appears in ARGS, argument parsing stops there; +;;; subsequent arguments are returned as ordinary arguments, even if +;;; they resemble options. So, in the argument list: +;;; ("--apples" "Granny Smith" "--" "--blimp" "Goodyear") +;;; `getopt-long' will recognize the `apples' option as having the +;;; value "Granny Smith", but it will not recognize the `blimp' +;;; option; it will return the strings "--blimp" and "Goodyear" as +;;; ordinary argument strings. +;;; +;;; The `getopt-long' function returns the parsed argument list as an +;;; assocation list, mapping option names --- the symbols from GRAMMAR +;;; --- onto their values, or #t if the option does not accept a value. +;;; Unused options do not appear in the alist. +;;; +;;; All arguments that are not the value of any option are returned +;;; as a list, associated with the empty list. +;;; +;;; `getopt-long' throws an exception if: +;;; - it finds an unrecognized property in GRAMMAR +;;; - the value of the `single-char' property is not a character +;;; - it finds an unrecognized option in ARGS +;;; - a required option is omitted +;;; - an option that requires an argument doesn't get one +;;; - an option that doesn't accept an argument does get one (this can +;;; only happen using the long option `--opt=value' syntax) +;;; - an option predicate fails +;;; +;;; So, for example: +;;; +;;; (define grammar +;;; `((lockfile-dir (required? #t) +;;; (value #t) +;;; (single-char #\k) +;;; (predicate ,file-is-directory?)) +;;; (verbose (required? #f) +;;; (single-char #\v) +;;; (value #f)) +;;; (x-includes (single-char #\x)) +;;; (rnet-server (single-char #\y) +;;; (predicate ,string?)))) +;;; +;;; (getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include" +;;; "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3") +;;; grammar) +;;; => ((() "foo1" "-fred" "foo2" "foo3") +;;; (rnet-server . "lamprod") +;;; (x-includes . "/usr/include") +;;; (lockfile-dir . "/tmp") +;;; (verbose . #t)) + +;;; (option-ref OPTIONS KEY DEFAULT) +;;; Return value in alist OPTIONS using KEY, a symbol; or DEFAULT if not +;;; found. The value is either a string or `#t'. +;;; +;;; For example, using the `getopt-long' return value from above: +;;; +;;; (option-ref (getopt-long ...) 'x-includes 42) => "/usr/include" +;;; (option-ref (getopt-long ...) 'not-a-key! 31) => 31 + +;;; Code: + +(define-module (ice-9 getopt-long) + #:use-module ((ice-9 common-list) #:select (remove-if-not)) + #:use-module (srfi srfi-9) + #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #:use-module (ice-9 optargs) + #:export (getopt-long option-ref)) + +(define %program-name (make-fluid "guile")) +(define (program-name) + (fluid-ref %program-name)) + +(define (fatal-error fmt . args) + (format (current-error-port) "~a: " (program-name)) + (apply format (current-error-port) fmt args) + (newline (current-error-port)) + (exit 1)) + +(define-record-type option-spec + (%make-option-spec name required? option-spec->single-char predicate value-policy) + option-spec? + (name + option-spec->name set-option-spec-name!) + (required? + option-spec->required? set-option-spec-required?!) + (option-spec->single-char + option-spec->single-char set-option-spec-single-char!) + (predicate + option-spec->predicate set-option-spec-predicate!) + (value-policy + option-spec->value-policy set-option-spec-value-policy!)) + +(define (make-option-spec name) + (%make-option-spec name #f #f #f #f)) + +(define (parse-option-spec desc) + (let ((spec (make-option-spec (symbol->string (car desc))))) + (for-each (match-lambda + (('required? val) + (set-option-spec-required?! spec val)) + (('value val) + (set-option-spec-value-policy! spec val)) + (('single-char val) + (or (char? val) + (error "`single-char' value must be a char!")) + (set-option-spec-single-char! spec val)) + (('predicate pred) + (set-option-spec-predicate! + spec (lambda (name val) + (or (not val) + (pred val) + (fatal-error "option predicate failed: --~a" + name))))) + ((prop val) + (error "invalid getopt-long option property:" prop))) + (cdr desc)) + spec)) + +(define (split-arg-list argument-list) + ;; Scan ARGUMENT-LIST for "--" and return (BEFORE-LS . AFTER-LS). + ;; Discard the "--". If no "--" is found, AFTER-LS is empty. + (let loop ((yes '()) (no argument-list)) + (cond ((null? no) (cons (reverse yes) no)) + ((string=? "--" (car no)) (cons (reverse yes) (cdr no))) + (else (loop (cons (car no) yes) (cdr no)))))) + +(define short-opt-rx (make-regexp "^-([a-zA-Z]+)(.*)")) +(define long-opt-no-value-rx (make-regexp "^--([^=]+)$")) +(define long-opt-with-value-rx (make-regexp "^--([^=]+)=(.*)")) + +(define (looks-like-an-option string) + (or (regexp-exec short-opt-rx string) + (regexp-exec long-opt-with-value-rx string) + (regexp-exec long-opt-no-value-rx string))) + +(define (process-options specs argument-ls stop-at-first-non-option) + ;; Use SPECS to scan ARGUMENT-LS; return (FOUND . ETC). + ;; FOUND is an unordered list of option specs for found options, while ETC + ;; is an order-maintained list of elements in ARGUMENT-LS that are neither + ;; options nor their values. + (let ((idx (map (lambda (spec) + (cons (option-spec->name spec) spec)) + specs)) + (sc-idx (map (lambda (spec) + (cons (make-string 1 (option-spec->single-char spec)) + spec)) + (remove-if-not option-spec->single-char specs)))) + (let loop ((unclumped 0) (argument-ls argument-ls) (found '()) (etc '())) + (define (eat! spec ls) + (cond + ((eq? 'optional (option-spec->value-policy spec)) + (if (or (null? ls) + (looks-like-an-option (car ls))) + (loop (- unclumped 1) ls (acons spec #t found) etc) + (loop (- unclumped 2) (cdr ls) (acons spec (car ls) found) etc))) + ((eq? #t (option-spec->value-policy spec)) + (if (or (null? ls) + (looks-like-an-option (car ls))) + (fatal-error "option must be specified with argument: --~a" + (option-spec->name spec)) + (loop (- unclumped 2) (cdr ls) (acons spec (car ls) found) etc))) + (else + (loop (- unclumped 1) ls (acons spec #t found) etc)))) + + (match argument-ls + (() + (cons found (reverse etc))) + ((opt . rest) + (cond + ((regexp-exec short-opt-rx opt) + => (lambda (match) + (if (> unclumped 0) + ;; Next option is known not to be clumped. + (let* ((c (match:substring match 1)) + (spec (or (assoc-ref sc-idx c) + (fatal-error "no such option: -~a" c)))) + (eat! spec rest)) + ;; Expand a clumped group of short options. + (let* ((extra (match:substring match 2)) + (unclumped-opts + (append (map (lambda (c) + (string-append "-" (make-string 1 c))) + (string->list + (match:substring match 1))) + (if (string=? "" extra) '() (list extra))))) + (loop (length unclumped-opts) + (append unclumped-opts rest) + found + etc))))) + ((regexp-exec long-opt-no-value-rx opt) + => (lambda (match) + (let* ((opt (match:substring match 1)) + (spec (or (assoc-ref idx opt) + (fatal-error "no such option: --~a" opt)))) + (eat! spec rest)))) + ((regexp-exec long-opt-with-value-rx opt) + => (lambda (match) + (let* ((opt (match:substring match 1)) + (spec (or (assoc-ref idx opt) + (fatal-error "no such option: --~a" opt)))) + (if (option-spec->value-policy spec) + (eat! spec (cons (match:substring match 2) rest)) + (fatal-error "option does not support argument: --~a" + opt))))) + ((and stop-at-first-non-option + (<= unclumped 0)) + (cons found (append (reverse etc) argument-ls))) + (else + (loop (- unclumped 1) rest found (cons opt etc))))))))) + +(define* (getopt-long program-arguments option-desc-list + #:key stop-at-first-non-option) + "Process options, handling both long and short options, similar to +the glibc function 'getopt_long'. PROGRAM-ARGUMENTS should be a value +similar to what (program-arguments) returns. OPTION-DESC-LIST is a +list of option descriptions. Each option description must satisfy the +following grammar: + + :: ( . ) + :: ( . ) + | () + :: + | + | + | + | + :: (required? ) + :: (single-char ) + :: (value #t) + (value #f) + (value optional) + :: (predicate <1-ary-function>) + + The procedure returns an alist of option names and values. Each +option name is a symbol. The option value will be '#t' if no value +was specified. There is a special item in the returned alist with a +key of the empty list, (): the list of arguments that are not options +or option values. + By default, options are not required, and option values are not +required. By default, single character equivalents are not supported; +if you want to allow the user to use single character options, you need +to add a `single-char' clause to the option description." + (with-fluids ((%program-name (car program-arguments))) + (let* ((specifications (map parse-option-spec option-desc-list)) + (pair (split-arg-list (cdr program-arguments))) + (split-ls (car pair)) + (non-split-ls (cdr pair)) + (found/etc (process-options specifications split-ls + stop-at-first-non-option)) + (found (car found/etc)) + (rest-ls (append (cdr found/etc) non-split-ls))) + (for-each (lambda (spec) + (let ((name (option-spec->name spec)) + (val (assq-ref found spec))) + (and (option-spec->required? spec) + (or val + (fatal-error "option must be specified: --~a" + name))) + (let ((pred (option-spec->predicate spec))) + (and pred (pred name val))))) + specifications) + (for-each (lambda (spec+val) + (set-car! spec+val + (string->symbol (option-spec->name (car spec+val))))) + found) + (cons (cons '() rest-ls) found)))) + +(define (option-ref options key default) + "Return value in alist OPTIONS using KEY, a symbol; or DEFAULT if not found. +The value is either a string or `#t'." + (or (assq-ref options key) default)) + +;;; getopt-long.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/hash-table.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/hash-table.scm new file mode 100644 index 0000000000000000000000000000000000000000..ca9d2fd37dac990cbfc56fd155b8ea56a3b9b837 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/hash-table.scm @@ -0,0 +1,45 @@ +;;;; hash-table.scm --- Additional hash table procedures +;;;; Copyright (C) 2013 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 hash-table) + #:export (alist->hash-table + alist->hashq-table + alist->hashv-table + alist->hashx-table)) + +(define-syntax-rule (define-alist-converter name hash-set-proc) + (define (name alist) + "Convert ALIST into a hash table." + (let ((table (make-hash-table))) + (for-each (lambda (pair) + (hash-set-proc table (car pair) (cdr pair))) + (reverse alist)) + table))) + +(define-alist-converter alist->hash-table hash-set!) +(define-alist-converter alist->hashq-table hashq-set!) +(define-alist-converter alist->hashv-table hashv-set!) + +(define (alist->hashx-table hash assoc alist) + "Convert ALIST into a hash table with custom HASH and ASSOC +procedures." + (let ((table (make-hash-table))) + (for-each (lambda (pair) + (hashx-set! hash assoc table (car pair) (cdr pair))) + (reverse alist)) + table)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/hcons.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/hcons.scm new file mode 100644 index 0000000000000000000000000000000000000000..7275cf4769c3cac7ce7ad812b9b303fa56585311 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/hcons.scm @@ -0,0 +1,80 @@ +;;; installed-scm-file + +;;;; Copyright (C) 1995, 1996, 1998, 2001, 2003, 2006 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + + +(define-module (ice-9 hcons) + :export (hashq-cons-hash hashq-cons-assoc hashq-cons-get-handle + hashq-cons-create-handle! hashq-cons-ref hashq-cons-set! hashq-cons + hashq-conser make-gc-buffer)) + + +;;; {Eq? hash-consing} +;;; +;;; A hash conser maintains a private universe of pairs s.t. if +;;; two cons calls pass eq? arguments, the pairs returned are eq?. +;;; +;;; A hash conser does not contribute life to the pairs it returns. +;;; + +(define (hashq-cons-hash pair n) + (modulo (logxor (hashq (car pair) 4194303) + (hashq (cdr pair) 4194303)) + n)) + +(define (hashq-cons-assoc key l) + (and (not (null? l)) + (or (and (pair? l) ; If not a pair, use its cdr? + (pair? (car l)) + (pair? (caar l)) + (eq? (car key) (caaar l)) + (eq? (cdr key) (cdaar l)) + (car l)) + (hashq-cons-assoc key (cdr l))))) + +(define (hashq-cons-get-handle table key) + (hashx-get-handle hashq-cons-hash hashq-cons-assoc table key)) + +(define (hashq-cons-create-handle! table key init) + (hashx-create-handle! hashq-cons-hash hashq-cons-assoc table key init)) + +(define (hashq-cons-ref table key) + (hashx-ref hashq-cons-hash hashq-cons-assoc table key #f)) + +(define (hashq-cons-set! table key val) + (hashx-set! hashq-cons-hash hashq-cons-assoc table key val)) + +(define (hashq-cons table a d) + (car (hashq-cons-create-handle! table (cons a d) #f))) + +(define (hashq-conser hash-tab-or-size) + (let ((table (if (vector? hash-tab-or-size) + hash-tab-or-size + (make-doubly-weak-hash-table hash-tab-or-size)))) + (lambda (a d) (hashq-cons table a d)))) + + + + +(define (make-gc-buffer n) + (let ((ring (make-list n #f))) + (append! ring ring) + (lambda (next) + (set-car! ring next) + (set! ring (cdr ring)) + next))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/history.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/history.scm new file mode 100644 index 0000000000000000000000000000000000000000..ebf609bf362bd9b01dd30b035f613cfcee4641e6 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/history.scm @@ -0,0 +1,65 @@ +;;;; Copyright (C) 2000, 2001, 2004, 2006, 2010 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +;;;; A simple value history support + +(define-module (ice-9 history) + #:export (value-history-enabled? enable-value-history! disable-value-history! + clear-value-history!)) + +(define-module* '(value-history)) + +(define *value-history-enabled?* #f) +(define (value-history-enabled?) + *value-history-enabled?*) + +(define (use-value-history x) + (module-use! (current-module) + (resolve-interface '(value-history)))) + +(define save-value-history + (let ((count 0) + (history (resolve-module '(value-history)))) + (lambda (v) + (if (not (unspecified? v)) + (let* ((c (1+ count)) + (s (string->symbol (simple-format #f "$~A" c)))) + (simple-format #t "~A = " s) + (module-define! history s v) + (module-export! history (list s)) + (set! count c)))))) + +(define (enable-value-history!) + (if (not (value-history-enabled?)) + (begin + (add-hook! before-eval-hook use-value-history) + (add-hook! before-print-hook save-value-history) + (set! *value-history-enabled?* #t)))) + +(define (disable-value-history!) + (if (value-history-enabled?) + (begin + (remove-hook! before-eval-hook use-value-history) + (remove-hook! before-print-hook save-value-history) + (set! *value-history-enabled?* #f)))) + +(define (clear-value-history!) + (let ((history (resolve-module '(value-history)))) + (hash-clear! (module-obarray history)) + (hash-clear! (module-obarray (module-public-interface history))))) + +(enable-value-history!) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/i18n.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/i18n.scm new file mode 100644 index 0000000000000000000000000000000000000000..319d5a23c8da24752a6036db8ef4aa4d1addb71a --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/i18n.scm @@ -0,0 +1,531 @@ +;;;; i18n.scm --- internationalization support -*- coding: utf-8 -*- + +;;;; Copyright (C) 2006, 2007, 2009, 2010, 2012, +;;;; 2017, 2019 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Author: Ludovic Courtès + +;;; Commentary: +;;; +;;; This module provides a number of routines that support +;;; internationalization (e.g., locale-dependent text collation, character +;;; mapping, etc.). It also defines `locale' objects, representing locale +;;; settings, that may be passed around to most of these procedures. +;;; + +;;; Code: + +(define-module (ice-9 i18n) + :use-module (ice-9 optargs) + :export (;; `locale' type + make-locale locale? + %global-locale + + ;; text collation + string-locale? + string-locale-ci? string-locale-ci=? + + char-locale? + char-locale-ci? char-locale-ci=? + + ;; character mapping + char-locale-downcase char-locale-upcase char-locale-titlecase + string-locale-downcase string-locale-upcase string-locale-titlecase + + ;; reading numbers + locale-string->integer locale-string->inexact + + ;; charset/encoding + locale-encoding + + ;; days and months + locale-day-short locale-day locale-month-short locale-month + + ;; date and time + locale-am-string locale-pm-string + locale-date+time-format locale-date-format locale-time-format + locale-time+am/pm-format + locale-era locale-era-year + locale-era-date-format locale-era-date+time-format + locale-era-time-format + + ;; monetary + locale-currency-symbol + locale-monetary-decimal-point locale-monetary-thousands-separator + locale-monetary-grouping locale-monetary-fractional-digits + locale-currency-symbol-precedes-positive? + locale-currency-symbol-precedes-negative? + locale-positive-separated-by-space? + locale-negative-separated-by-space? + locale-monetary-positive-sign locale-monetary-negative-sign + locale-positive-sign-position locale-negative-sign-position + monetary-amount->locale-string + + ;; number formatting + locale-digit-grouping locale-decimal-point + locale-thousands-separator + number->locale-string + + ;; miscellaneous + locale-yes-regexp locale-no-regexp + + ;; debugging + %locale-dump)) + + +(eval-when (expand load eval) + (load-extension (string-append "libguile-" (effective-version)) + "scm_init_i18n")) + + +;;; +;;; Charset/encoding. +;;; + +(define (locale-encoding . locale) + (apply nl-langinfo CODESET locale)) + + +;;; +;;; Months and days. +;;; + +;; Helper macro: Define a procedure named NAME that maps its argument to +;; NL-ITEMS. Gnulib guarantees that these items are available. +(define-macro (define-vector-langinfo-mapping name nl-items) + (let* ((item-count (length nl-items)) + (defines `(define %nl-items (vector #f ,@nl-items))) + (make-body (lambda (result) + `(if (and (integer? item) (exact? item)) + (if (and (>= item 1) (<= item ,item-count)) + ,result + (throw 'out-of-range "out of range" item)) + (throw 'wrong-type-arg "wrong argument type" item))))) + `(define (,name item . locale) + ,defines + ,(make-body '(apply nl-langinfo (vector-ref %nl-items item) locale))))) + + +(define-vector-langinfo-mapping locale-day-short + (ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7)) + +(define-vector-langinfo-mapping locale-day + (DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7)) + +(define-vector-langinfo-mapping locale-month-short + (ABMON_1 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6 + ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12)) + +(define-vector-langinfo-mapping locale-month + (MON_1 MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 MON_10 MON_11 MON_12)) + + + +;;; +;;; Date and time. +;;; + +;; Define a procedure NAME that gets langinfo item ITEM. Gnulib's +;; `nl_langinfo' does not guarantee that all these items are supported +;; (for instance, `GROUPING' is lacking on Darwin and Gnulib provides no +;; replacement), so use DEFAULT as the default value when ITEM is not +;; available. +(define-macro (define-simple-langinfo-mapping name item default) + (let ((body (if (defined? item) + `(apply nl-langinfo ,item locale) + default))) + `(define (,name . locale) + ,body))) + +(define-simple-langinfo-mapping locale-am-string + AM_STR "AM") +(define-simple-langinfo-mapping locale-pm-string + PM_STR "PM") +(define-simple-langinfo-mapping locale-date+time-format + D_T_FMT "%a %b %e %H:%M:%S %Y") +(define-simple-langinfo-mapping locale-date-format + D_FMT "%m/%d/%y") +(define-simple-langinfo-mapping locale-time-format + T_FMT "%H:%M:%S") +(define-simple-langinfo-mapping locale-time+am/pm-format + T_FMT_AMPM "%I:%M:%S %p") +(define-simple-langinfo-mapping locale-era + ERA "") +(define-simple-langinfo-mapping locale-era-year + ERA_YEAR "") +(define-simple-langinfo-mapping locale-era-date+time-format + ERA_D_T_FMT "") +(define-simple-langinfo-mapping locale-era-date-format + ERA_D_FMT "") +(define-simple-langinfo-mapping locale-era-time-format + ERA_T_FMT "") + + + +;;; +;;; Monetary information. +;;; + +;; Define a procedure NAME that gets item LOCAL-ITEM or INTL-ITEM, +;; depending on whether the caller asked for the international version +;; or not. Since Gnulib's `nl_langinfo' module doesn't guarantee that +;; all these items are available, use DEFAULT/LOCAL and DEFAULT/INTL as +;; default values when the system does not support them. +(define-macro (define-monetary-langinfo-mapping name local-item intl-item + default/local default/intl) + (let ((body + (let ((intl (if (defined? intl-item) + `(apply nl-langinfo ,intl-item locale) + default/intl)) + (local (if (defined? local-item) + `(apply nl-langinfo ,local-item locale) + default/local))) + `(if intl? ,intl ,local)))) + + `(define (,name intl? . locale) + ,body))) + +;; FIXME: How can we use ALT_DIGITS? +(define-monetary-langinfo-mapping locale-currency-symbol + CRNCYSTR INT_CURR_SYMBOL + "-" "") +(define-monetary-langinfo-mapping locale-monetary-fractional-digits + FRAC_DIGITS INT_FRAC_DIGITS + 2 2) + +(define-simple-langinfo-mapping locale-monetary-positive-sign + POSITIVE_SIGN "+") +(define-simple-langinfo-mapping locale-monetary-negative-sign + NEGATIVE_SIGN "-") +(define-simple-langinfo-mapping locale-monetary-decimal-point + MON_DECIMAL_POINT ".") +(define-simple-langinfo-mapping locale-monetary-thousands-separator + MON_THOUSANDS_SEP "") +(define-simple-langinfo-mapping locale-monetary-grouping + MON_GROUPING '()) + +(define-monetary-langinfo-mapping locale-currency-symbol-precedes-positive? + P_CS_PRECEDES INT_P_CS_PRECEDES + #t #t) +(define-monetary-langinfo-mapping locale-currency-symbol-precedes-negative? + N_CS_PRECEDES INT_N_CS_PRECEDES + #t #t) + + +(define-monetary-langinfo-mapping locale-positive-separated-by-space? + ;; Whether a space should be inserted between a positive amount and the + ;; currency symbol. + P_SEP_BY_SPACE INT_P_SEP_BY_SPACE + #t #t) +(define-monetary-langinfo-mapping locale-negative-separated-by-space? + ;; Whether a space should be inserted between a negative amount and the + ;; currency symbol. + N_SEP_BY_SPACE INT_N_SEP_BY_SPACE + #t #t) + +(define-monetary-langinfo-mapping locale-positive-sign-position + ;; Position of the positive sign wrt. currency symbol and quantity in a + ;; monetary amount. + P_SIGN_POSN INT_P_SIGN_POSN + 'unspecified 'unspecified) +(define-monetary-langinfo-mapping locale-negative-sign-position + ;; Position of the negative sign wrt. currency symbol and quantity in a + ;; monetary amount. + N_SIGN_POSN INT_N_SIGN_POSN + 'unspecified 'unspecified) + + +(define (integer->string number) + "Return a string representing NUMBER, an integer, written in base 10." + (define (digit->char digit) + (integer->char (+ digit (char->integer #\0)))) + + (if (zero? number) + "0" + (let loop ((number number) + (digits '())) + (if (zero? number) + (list->string digits) + (loop (quotient number 10) + (cons (digit->char (modulo number 10)) + digits)))))) + +(define (number-decimal-string number digit-count) + "Return a string representing the decimal part of NUMBER. When +DIGIT-COUNT is an integer, return exactly DIGIT-COUNT digits; when +DIGIT-COUNT is #t, return as many decimals as necessary, up to an +arbitrary limit." + (define max-decimals + 5) + + ;; XXX: This is brute-force and could be improved by following one of + ;; the "Printing Floating-Point Numbers Quickly and Accurately" + ;; papers. + (if (integer? digit-count) + (let ((number (* (expt 10 digit-count) + (- number (floor number))))) + (string-pad (integer->string (round (inexact->exact number))) + digit-count + #\0)) + (let loop ((decimals 0)) + (let ((number' (* number (expt 10 decimals)))) + (if (or (= number' (floor number')) + (>= decimals max-decimals)) + (let* ((fraction (- number' + (* (floor number) + (expt 10 decimals)))) + (str (integer->string + (round (inexact->exact fraction))))) + (if (zero? fraction) + "" + str)) + (loop (+ decimals 1))))))) + +(define (%number-integer-part int grouping separator) + ;; Process INT (a string denoting a number's integer part) and return a new + ;; string with digit grouping and separators according to GROUPING (a list, + ;; potentially circular) and SEPARATOR (a string). + + ;; Process INT from right to left. + (let loop ((int int) + (grouping grouping) + (result '())) + (cond ((string=? int "") (apply string-append result)) + ((null? grouping) (apply string-append int result)) + (else + (let* ((len (string-length int)) + (cut (min (car grouping) len))) + (loop (substring int 0 (- len cut)) + (cdr grouping) + (let ((sub (substring int (- len cut) len))) + (if (> len cut) + (cons* separator sub result) + (cons sub result))))))))) + +(define (add-monetary-sign+currency amount figure intl? locale) + ;; Add a sign and currency symbol around FIGURE. FIGURE should be a + ;; formatted unsigned amount (a string) representing AMOUNT. + (let* ((positive? (> amount 0)) + (sign + (cond ((> amount 0) (locale-monetary-positive-sign locale)) + ((< amount 0) (locale-monetary-negative-sign locale)) + (else ""))) + (currency (locale-currency-symbol intl? locale)) + (currency-precedes? + (if positive? + locale-currency-symbol-precedes-positive? + locale-currency-symbol-precedes-negative?)) + (separated? + (if positive? + locale-positive-separated-by-space? + locale-negative-separated-by-space?)) + (sign-position + (if positive? + locale-positive-sign-position + locale-negative-sign-position)) + (currency-space + (if (separated? intl? locale) " " "")) + (append-currency + (lambda (amt) + (if (currency-precedes? intl? locale) + (string-append currency currency-space amt) + (string-append amt currency-space currency))))) + + (case (sign-position intl? locale) + ((parenthesize) + (string-append "(" (append-currency figure) ")")) + ((sign-before) + (string-append sign (append-currency figure))) + ((sign-after unspecified) + ;; following glibc's recommendation for `unspecified'. + (if (currency-precedes? intl? locale) + (string-append currency currency-space sign figure) + (string-append figure currency-space currency sign))) + ((sign-before-currency-symbol) + (if (currency-precedes? intl? locale) + (string-append sign currency currency-space figure) + (string-append figure currency-space sign currency))) ;; unlikely + ((sign-after-currency-symbol) + (if (currency-precedes? intl? locale) + (string-append currency sign currency-space figure) + (string-append figure currency-space currency sign))) + (else + (error "unsupported sign position" (sign-position intl? locale)))))) + + +(define* (monetary-amount->locale-string amount intl? + #:optional (locale %global-locale)) + "Convert @var{amount} (an inexact) into a string according to the cultural +conventions of either @var{locale} (a locale object) or the current locale. +If @var{intl?} is true, then the international monetary format for the given +locale is used." + + (let* ((fraction-digits + (or (locale-monetary-fractional-digits intl? locale) 2)) + (decimal-part + (lambda (dec) + (if (or (string=? dec "") (eq? 0 fraction-digits)) + "" + (string-append (locale-monetary-decimal-point locale) + (if (< fraction-digits (string-length dec)) + (substring dec 0 fraction-digits) + dec))))) + + (int (integer->string (inexact->exact + (floor (abs amount))))) + (dec (decimal-part + (number-decimal-string (abs amount) + fraction-digits))) + (grouping (locale-monetary-grouping locale)) + (separator (locale-monetary-thousands-separator locale))) + + (add-monetary-sign+currency amount + (string-append + (%number-integer-part int grouping + separator) + dec) + intl? locale))) + + + +;;; +;;; Number formatting. +;;; + +(define-simple-langinfo-mapping locale-digit-grouping + GROUPING '()) +(define-simple-langinfo-mapping locale-decimal-point + RADIXCHAR ".") +(define-simple-langinfo-mapping locale-thousands-separator + THOUSEP "") + +(define* (number->locale-string number + #:optional (fraction-digits #t) + (locale %global-locale)) + "Convert @var{number} (an inexact) into a string according to the cultural +conventions of either @var{locale} (a locale object) or the current locale. +By default, print as many fractional digits as necessary, up to an upper bound. +Optionally, @var{fraction-digits} may be bound to an integer specifying the +number of fractional digits to be displayed." + + (let* ((sign + (cond ((> number 0) "") + ((< number 0) "-") + (else ""))) + (decimal-part + (lambda (dec) + (if (or (string=? dec "") (eq? 0 fraction-digits)) + "" + (string-append (locale-decimal-point locale) + (if (and (integer? fraction-digits) + (< fraction-digits + (string-length dec))) + (substring dec 0 fraction-digits) + dec)))))) + + (let* ((int (integer->string (inexact->exact + (floor (abs number))))) + (dec (decimal-part + (number-decimal-string (abs number) + fraction-digits))) + (grouping (locale-digit-grouping locale)) + (separator (locale-thousands-separator locale))) + + (string-append sign + (%number-integer-part int grouping separator) + dec)))) + + +;;; +;;; Miscellaneous. +;;; + +(define-simple-langinfo-mapping locale-yes-regexp + YESEXPR "^[yY]") +(define-simple-langinfo-mapping locale-no-regexp + NOEXPR "^[nN]") + +;; `YESSTR' and `NOSTR' are considered deprecated so we don't provide them. + + +;;; +;;; Debugging +;;; + +(define (%locale-dump loc) + "Given a locale, display an association list containing all the locale +information. + +This procedure is intended for debugging locale problems, and should +not be used in production code." + (when (locale? loc) + (list + (cons 'encoding (locale-encoding loc)) + (cons 'day-short + (map (lambda (n) (locale-day-short (1+ n) loc)) (iota 7))) + (cons 'day + (map (lambda (n) (locale-day (1+ n) loc)) (iota 7))) + (cons 'month-short + (map (lambda (n) (locale-month-short (1+ n) loc)) (iota 12))) + (cons 'month + (map (lambda (n) (locale-month (1+ n) loc)) (iota 12))) + (cons 'am-string (locale-am-string loc)) + (cons 'pm-string (locale-pm-string loc)) + (cons 'date+time-format (locale-date+time-format loc)) + (cons 'date-format (locale-date-format loc)) + (cons 'time-format (locale-time-format loc)) + (cons 'time+am/pm-format (locale-time+am/pm-format loc)) + (cons 'era (locale-era loc)) + (cons 'era-year (locale-era-year loc)) + (cons 'era-date-format (locale-era-date-format loc)) + (cons 'era-date+time-format (locale-era-date+time-format loc)) + (cons 'era-time-format (locale-era-time-format loc)) + (cons 'currency-symbol + (list (locale-currency-symbol #t loc) + (locale-currency-symbol #f loc))) + (cons 'monetary-decimal-point (locale-monetary-decimal-point loc)) + (cons 'monetary-thousands-separator (locale-monetary-thousands-separator loc)) + (cons 'monetary-grouping (locale-monetary-grouping loc)) + (cons 'monetary-fractional-digits + (list (locale-monetary-fractional-digits #t loc) + (locale-monetary-fractional-digits #f loc))) + (cons 'currency-symbol-precedes-positive? + (list (locale-currency-symbol-precedes-positive? #t loc) + (locale-currency-symbol-precedes-positive? #f loc))) + (cons 'currency-symbol-precedes-negative? + (list (locale-currency-symbol-precedes-negative? #t loc) + (locale-currency-symbol-precedes-negative? #f loc))) + (cons 'positive-separated-by-space? + (list (locale-positive-separated-by-space? #t loc) + (locale-positive-separated-by-space? #f loc))) + (cons 'negative-separated-by-space? + (list (locale-negative-separated-by-space? #t loc) + (locale-negative-separated-by-space? #f loc))) + (cons 'monetary-positive-sign (locale-monetary-positive-sign loc)) + (cons 'monetary-negative-sign (locale-monetary-negative-sign loc)) + (cons 'positive-sign-position + (list (locale-positive-sign-position #t loc) + (locale-negative-sign-position #f loc))) + (cons 'negative-sign-position + (list (locale-negative-sign-position #t loc) + (locale-negative-sign-position #f loc))) + (cons 'digit-grouping (locale-digit-grouping loc)) + (cons 'decimal-point (locale-decimal-point loc)) + (cons 'thousands-separator (locale-thousands-separator loc)) + (cons 'locale-yes-regexp (locale-yes-regexp loc)) + (cons 'no-regexp (locale-no-regexp loc))))) +;;; i18n.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/iconv.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/iconv.scm new file mode 100644 index 0000000000000000000000000000000000000000..125dad8b8100af643dc2218ed68144a738298bc2 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/iconv.scm @@ -0,0 +1,95 @@ +;;; Encoding and decoding byte representations of strings + +;; Copyright (C) 2013 Free Software Foundation, Inc. + +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +;;; Code: + +(define-module (ice-9 iconv) + #:use-module (rnrs bytevectors) + #:use-module (ice-9 binary-ports) + #:use-module ((ice-9 rdelim) #:select (read-string)) + #:export (string->bytevector + bytevector->string + call-with-encoded-output-string)) + +;; Like call-with-output-string, but actually closes the port. +(define (call-with-output-string* proc) + (let ((port (open-output-string))) + (proc port) + (let ((str (get-output-string port))) + (close-port port) + str))) + +(define (call-with-output-bytevector* proc) + (call-with-values (lambda () (open-bytevector-output-port)) + (lambda (port get-bytevector) + (proc port) + (let ((bv (get-bytevector))) + (close-port port) + bv)))) + +(define* (call-with-encoded-output-string encoding proc + #:optional + (conversion-strategy 'error)) + "Call PROC on a fresh port. Encode the resulting string as a +bytevector according to ENCODING, and return the bytevector." + (if (and (string-ci=? encoding "utf-8") + (eq? conversion-strategy 'error)) + ;; I don't know why, but this appears to be faster; at least for + ;; serving examples/debug-sxml.scm (1464 reqs/s versus 850 + ;; reqs/s). + (string->utf8 (call-with-output-string* proc)) + (call-with-output-bytevector* + (lambda (port) + (set-port-encoding! port encoding) + (if conversion-strategy + (set-port-conversion-strategy! port conversion-strategy)) + (proc port))))) + +;; TODO: Provide C implementations that call scm_from_stringn and +;; friends? + +(define* (string->bytevector str encoding + #:optional (conversion-strategy 'error)) + "Encode STRING according to ENCODING, which should be a string naming +a character encoding, like \"utf-8\"." + (if (and (string-ci=? encoding "utf-8") + (eq? conversion-strategy 'error)) + (string->utf8 str) + (call-with-encoded-output-string + encoding + (lambda (port) + (display str port)) + conversion-strategy))) + +(define* (bytevector->string bv encoding + #:optional (conversion-strategy 'error)) + "Decode the string represented by BV. The bytes in the bytevector +will be interpreted according to ENCODING, which should be a string +naming a character encoding, like \"utf-8\"." + (if (and (string-ci=? encoding "utf-8") + (eq? conversion-strategy 'error)) + (utf8->string bv) + (let ((p (open-bytevector-input-port bv))) + (set-port-encoding! p encoding) + (if conversion-strategy + (set-port-conversion-strategy! p conversion-strategy)) + (let ((res (read-string p))) + (close-port p) + (if (eof-object? res) + "" + res))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/lineio.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/lineio.scm new file mode 100644 index 0000000000000000000000000000000000000000..68f290369015a1bf58769f203bbb46cca6e1fcf0 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/lineio.scm @@ -0,0 +1,115 @@ +;;; installed-scm-file + +;;;; Copyright (C) 1996, 1998, 2001, 2003, 2006 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + + + +(define-module (ice-9 lineio) + :use-module (ice-9 rdelim) + :export (unread-string read-string lineio-port? + make-line-buffering-input-port)) + + +;;; {Line Buffering Input Ports} +;;; +;;; [This is a work-around to get past certain deficiencies in the capabilities +;;; of ports. Eventually, ports should be fixed and this module nuked.] +;;; +;;; A line buffering input port supports: +;;; +;;; read-string which returns the next line of input +;;; unread-string which pushes a line back onto the stream +;;; +;;; The implementation of unread-string is kind of limited; it doesn't +;;; interact properly with unread-char, or any of the other port +;;; reading functions. Only read-string will get you back the things that +;;; unread-string accepts. +;;; +;;; Normally a "line" is all characters up to and including a newline. +;;; If lines are put back using unread-string, they can be broken arbitrarily +;;; -- that is, read-string returns strings passed to unread-string (or +;;; shared substrings of them). +;;; + +;; read-string port +;; unread-string port str +;; Read (or buffer) a line from PORT. +;; +;; Not all ports support these functions -- only those with +;; 'unread-string and 'read-string properties, bound to hooks +;; implementing these functions. +;; +(define (unread-string str line-buffering-input-port) + ((object-property line-buffering-input-port 'unread-string) str)) + +;; +(define (read-string line-buffering-input-port) + ((object-property line-buffering-input-port 'read-string))) + + +(define (lineio-port? port) + (not (not (object-property port 'read-string)))) + +;; make-line-buffering-input-port port +;; Return a wrapper for PORT. The wrapper handles read-string/unread-string. +;; +;; The port returned by this function reads newline terminated lines from PORT. +;; It buffers these characters internally, and parsels them out via calls +;; to read-char, read-string, and unread-string. +;; + +(define (make-line-buffering-input-port underlying-port) + (let* (;; buffers - a list of strings put back by unread-string or cached + ;; using read-line. + ;; + (buffers '()) + + ;; getc - return the next character from a buffer or from the underlying + ;; port. + ;; + (getc (lambda () + (if (not buffers) + (read-char underlying-port) + (let ((c (string-ref (car buffers) 0))) + (if (= 1 (string-length (car buffers))) + (set! buffers (cdr buffers)) + (set-car! buffers (substring (car buffers) 1))) + c)))) + + (propogate-close (lambda () (close-port underlying-port))) + + (self (make-soft-port (vector #f #f #f getc propogate-close) "r")) + + (unread-string (lambda (str) + (and (< 0 (string-length str)) + (set! buffers (cons str buffers))))) + + (read-string (lambda () + (cond + ((not (null? buffers)) + (let ((answer (car buffers))) + (set! buffers (cdr buffers)) + answer)) + (else + (read-line underlying-port 'concat)))))) ;handle-newline->concat + + (set-object-property! self 'unread-string unread-string) + (set-object-property! self 'read-string read-string) + self)) + + diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/list.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/list.scm new file mode 100644 index 0000000000000000000000000000000000000000..1b898a36886de84d2f1515cd92e4a6b90ede198f --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/list.scm @@ -0,0 +1,36 @@ +;;;; List functions not provided in R5RS or srfi-1 + +;;; Copyright (C) 2003, 2006 Free Software Foundation, Inc. +;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (ice-9 list) + :export (rassoc rassv rassq)) + +(define (generic-rassoc key alist =) + (let loop ((ls alist)) + (and (not (null? ls)) + (if (= key (cdar ls)) + (car ls) + (loop (cdr ls)))))) + +(define (rassoc key alist . =) + (generic-rassoc key alist (if (null? =) equal? (car =)))) + +(define (rassv key alist) + (generic-rassoc key alist eqv?)) + +(define (rassq key alist) + (generic-rassoc key alist eq?)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/local-eval.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/local-eval.scm new file mode 100644 index 0000000000000000000000000000000000000000..b81daf3e8ad1990d4e52362f8501c8500578248b --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/local-eval.scm @@ -0,0 +1,261 @@ +;;; -*- mode: scheme; coding: utf-8; -*- +;;; +;;; Copyright (C) 2012, 2013 Free Software Foundation, Inc. +;;; +;;; This library is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU Lesser General Public +;;; License as published by the Free Software Foundation; either +;;; version 3 of the License, or (at your option) any later version. +;;; +;;; This library is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this library; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (ice-9 local-eval) + #:use-module (ice-9 format) + #:use-module (srfi srfi-9) + #:use-module (srfi srfi-9 gnu) + #:use-module (system base compile) + #:use-module (system syntax) + #:export (the-environment local-eval local-compile)) + +(define-record-type lexical-environment-type + (make-lexical-environment scope wrapper boxes patterns) + lexical-environment? + (scope lexenv-scope) + (wrapper lexenv-wrapper) + (boxes lexenv-boxes) + (patterns lexenv-patterns)) + +(set-record-type-printer! + lexical-environment-type + (lambda (e port) + (format port "#" + (syntax-module (lexenv-scope e)) + (+ (length (lexenv-boxes e)) (length (lexenv-patterns e)))))) + +(define-syntax syntax-object-of + (lambda (form) + (syntax-case form () + ((_ x) #`(quote #,(datum->syntax #'x #'x)))))) + +(define-syntax-rule (make-box v) + (case-lambda + (() v) + ((x) (set! v x)))) + +(define (make-transformer-from-box id trans) + (set-procedure-property! trans 'identifier-syntax-box id) + trans) + +(define-syntax-rule (identifier-syntax-from-box box) + (make-transformer-from-box + (syntax-object-of box) + (identifier-syntax (id (box)) + ((set! id x) (box x))))) + +(define (unsupported-binding name) + (make-variable-transformer + (lambda (x) + (syntax-violation + 'local-eval + "unsupported binding captured by (the-environment)" + x)))) + +(define (within-nested-ellipses id lvl) + (let loop ((s id) (n lvl)) + (if (zero? n) + s + (loop #`(#,s (... ...)) (- n 1))))) + +;; Analyze the set of bound identifiers IDS. Return four values: +;; +;; capture: A list of forms that will be emitted in the expansion of +;; `the-environment' to capture lexical variables. +;; +;; formals: Corresponding formal parameters for use in the lambda that +;; re-introduces those variables. These are temporary identifiers, and +;; as such if we have a nested `the-environment', there is no need to +;; capture them. (See the notes on nested `the-environment' and +;; proxies, below.) +;; +;; wrappers: A list of procedures of type SYNTAX -> SYNTAX, used to wrap +;; the expression to be evaluated in forms that re-introduce the +;; variable. The forms will be nested so that the variable shadowing +;; semantics of the original form are maintained. +;; +;; patterns: A terrible hack. The issue is that for pattern variables, +;; we can't emit lexically nested with-syntax forms, like: +;; +;; (with-syntax ((foo 1)) (the-environment)) +;; => (with-syntax ((foo 1)) +;; ... #'(with-syntax ((foo ...)) ... exp) ...) +;; +;; The reason is that the outer "foo" substitutes into the inner "foo", +;; yielding something like: +;; +;; (with-syntax ((foo 1)) +;; ... (with-syntax ((1 ...)) ...) +;; +;; Which ain't what we want. So we hide the information needed to +;; re-make the inner pattern binding form in the lexical environment +;; object, and then introduce those identifiers via another with-syntax. +;; +;; +;; There are four different kinds of lexical bindings: normal lexicals, +;; macros, displaced lexicals, and pattern variables. See the +;; documentation of syntax-local-binding for more info on these. +;; +;; We capture normal lexicals via `make-box', which creates a +;; case-lambda that can reference or set a variable. These get +;; re-introduced with an identifier-syntax. +;; +;; We can't capture macros currently. However we do recognize our own +;; macros that are actually proxying lexicals, so that nested +;; `the-environment' forms are possible. In that case we drill down to +;; the identifier for the already-existing box, and just capture that +;; box. +;; +;; And that's it: we skip displaced lexicals, and the pattern variables +;; are discussed above. +;; +(define (analyze-identifiers ids) + (define (mktmp) + (datum->syntax #'here (gensym "t "))) + (let lp ((ids ids) (capture '()) (formals '()) (wrappers '()) (patterns '())) + (cond + ((null? ids) + (values capture formals wrappers patterns)) + (else + (let ((id (car ids)) (ids (cdr ids))) + (call-with-values (lambda () (syntax-local-binding id)) + (lambda (type val) + (case type + ((lexical) + (if (or-map (lambda (x) (bound-identifier=? x id)) formals) + (lp ids capture formals wrappers patterns) + (let ((t (mktmp))) + (lp ids + (cons #`(make-box #,id) capture) + (cons t formals) + (cons (lambda (x) + #`(let-syntax ((#,id (identifier-syntax-from-box #,t))) + #,x)) + wrappers) + patterns)))) + ((displaced-lexical) + (lp ids capture formals wrappers patterns)) + ((macro) + (let ((b (procedure-property val 'identifier-syntax-box))) + (if b + (lp ids (cons b capture) (cons b formals) + (cons (lambda (x) + #`(let-syntax ((#,id (identifier-syntax-from-box #,b))) + #,x)) + wrappers) + patterns) + (lp ids capture formals + (cons (lambda (x) + #`(let-syntax ((#,id (unsupported-binding '#,id))) + #,x)) + wrappers) + patterns)))) + ((pattern-variable) + (let ((t (datum->syntax id (gensym "p "))) + (nested (within-nested-ellipses id (cdr val)))) + (lp ids capture formals + (cons (lambda (x) + #`(with-syntax ((#,t '#,nested)) + #,x)) + wrappers) + ;; This dance is to hide these pattern variables + ;; from the expander. + (cons (list (datum->syntax #'here (syntax->datum id)) + (cdr val) + t) + patterns)))) + ((ellipsis) + (lp ids capture formals + (cons (lambda (x) + #`(with-ellipsis #,val #,x)) + wrappers) + patterns)) + (else + ;; Interestingly, this case can include globals (and + ;; global macros), now that Guile tracks which globals it + ;; introduces. Not sure what to do here! For now, punt. + ;; + (lp ids capture formals wrappers patterns)))))))))) + +(define-syntax the-environment + (lambda (x) + (syntax-case x () + ((the-environment) + #'(the-environment the-environment)) + ((the-environment scope) + (call-with-values (lambda () + (analyze-identifiers + (syntax-locally-bound-identifiers #'scope))) + (lambda (capture formals wrappers patterns) + (define (wrap-expression x) + (let lp ((x x) (wrappers wrappers)) + (if (null? wrappers) + x + (lp ((car wrappers) x) (cdr wrappers))))) + (with-syntax (((f ...) formals) + ((c ...) capture) + (((pname plvl pformal) ...) patterns) + (wrapped (wrap-expression #'(begin #f exp)))) + #'(make-lexical-environment + #'scope + (lambda (exp pformal ...) + (with-syntax ((exp exp) + (pformal pformal) + ...) + #'(lambda (f ...) + wrapped))) + (list c ...) + (list (list 'pname plvl #'pformal) ...))))))))) + +(define (env-module e) + (cond + ((lexical-environment? e) (resolve-module (syntax-module (lexenv-scope e)))) + ((module? e) e) + (else (error "invalid lexical environment" e)))) + +(define (env-boxes e) + (cond + ((lexical-environment? e) (lexenv-boxes e)) + ((module? e) '()) + (else (error "invalid lexical environment" e)))) + +(define (local-wrap x e) + (cond + ((lexical-environment? e) + (apply (lexenv-wrapper e) + (datum->syntax (lexenv-scope e) x) + (map (lambda (l) + (let ((name (car l)) + (lvl (cadr l)) + (scope (caddr l))) + (within-nested-ellipses (datum->syntax scope name) lvl))) + (lexenv-patterns e)))) + ((module? e) #`(lambda () #f #,x)) + (else (error "invalid lexical environment" e)))) + +(define (local-eval x e) + "Evaluate the expression @var{x} within the lexical environment @var{e}." + (apply (eval (local-wrap x e) (env-module e)) + (env-boxes e))) + +(define* (local-compile x e #:key (opts '())) + "Compile and evaluate the expression @var{x} within the lexical +environment @var{e}." + (apply (compile (local-wrap x e) #:env (env-module e) + #:from 'scheme #:opts opts) + (env-boxes e))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/ls.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/ls.scm new file mode 100644 index 0000000000000000000000000000000000000000..6a5b4e09ab6b861cb715bebcb385025ef4740f87 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/ls.scm @@ -0,0 +1,94 @@ +;;;; ls.scm --- functions for browsing modules +;;;; +;;;; Copyright (C) 1995, 1996, 1997, 1999, 2001, 2006, 2010 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 ls) + :use-module (ice-9 common-list) + :export (local-definitions-in definitions-in ls lls + recursive-local-define)) + +;;;; +;;; local-definitions-in root name +;;; Returns a list of names defined locally in the named +;;; subdirectory of root. +;;; definitions-in root name +;;; Returns a list of all names defined in the named +;;; subdirectory of root. The list includes alll locally +;;; defined names as well as all names inherited from a +;;; member of a use-list. +;;; +;;; A convenient interface for examining the nature of things: +;;; +;;; ls . various-names +;;; +;;; With no arguments, return a list of definitions in +;;; `(current-module)'. +;;; +;;; With just one argument, interpret that argument as the +;;; name of a subdirectory of the current module and +;;; return a list of names defined there. +;;; +;;; With more than one argument, still compute +;;; subdirectory lists, but return a list: +;;; (( . ) +;;; ( . ) +;;; ...) +;;; +;;; lls . various-names +;;; +;;; Analogous to `ls', but with local definitions only. + +(define (local-definitions-in root names) + (let ((m (nested-ref-module root names))) + (if m + (module-map (lambda (k v) k) m) + (nested-ref root names)))) + +(define (definitions-in root names) + (let ((m (nested-ref-module root names))) + (if m + (reduce union + (cons (local-definitions-in m '()) + (map (lambda (m2) (definitions-in m2 '())) + (module-uses m)))) + (nested-ref root names)))) + +(define (ls . various-refs) + (if (pair? various-refs) + (if (cdr various-refs) + (map (lambda (ref) + (cons ref (definitions-in (current-module) ref))) + various-refs) + (definitions-in (current-module) (car various-refs))) + (definitions-in (current-module) '()))) + +(define (lls . various-refs) + (if (pair? various-refs) + (if (cdr various-refs) + (map (lambda (ref) + (cons ref (local-definitions-in (current-module) ref))) + various-refs) + (local-definitions-in (current-module) (car various-refs))) + (local-definitions-in (current-module) '()))) + +(define (recursive-local-define name value) + (let ((parent (reverse! (cdr (reverse name))))) + (module-define! (make-modules-in (current-module) parent) + name value))) + +;;; ls.scm ends here diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/mapping.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/mapping.scm new file mode 100644 index 0000000000000000000000000000000000000000..bd4dbfbd3d2a82940a054ea0a97e8f6839b6d99b --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/mapping.scm @@ -0,0 +1,118 @@ +;;; installed-scm-file + +;;;; Copyright (C) 1996, 2001, 2006, 2013 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + + + +(define-module (ice-9 mapping) + :use-module (ice-9 poe) + :export (mapping-hooks-type make-mapping-hooks mapping-hooks? + mapping-hooks-get-handle mapping-hooks-create-handle + mapping-hooks-remove mapping-type make-mapping mapping? + mapping-hooks mapping-data set-mapping-hooks! set-mapping-data! + mapping-get-handle mapping-create-handle! mapping-remove! + mapping-ref mapping-set! hash-table-mapping-hooks + make-hash-table-mapping hash-table-mapping)) + +(issue-deprecation-warning + "(ice-9 mapping) is deprecated. Use srfi-69 or rnrs hash tables instead.") + +(define mapping-hooks-type (make-record-type 'mapping-hooks '(get-handle + create-handle + remove))) + + +(define make-mapping-hooks (perfect-funcq 17 (record-constructor mapping-hooks-type))) +(define mapping-hooks? (record-predicate mapping-hooks-type)) +(define mapping-hooks-get-handle (record-accessor mapping-hooks-type 'get-handle)) +(define mapping-hooks-create-handle (record-accessor mapping-hooks-type 'create-handle)) +(define mapping-hooks-remove (record-accessor mapping-hooks-type 'remove)) + +(define mapping-type (make-record-type 'mapping '(hooks data))) +(define make-mapping (record-constructor mapping-type)) +(define mapping? (record-predicate mapping-type)) +(define mapping-hooks (record-accessor mapping-type 'hooks)) +(define mapping-data (record-accessor mapping-type 'data)) +(define set-mapping-hooks! (record-modifier mapping-type 'hooks)) +(define set-mapping-data! (record-modifier mapping-type 'data)) + +(define (mapping-get-handle map key) + ((mapping-hooks-get-handle (mapping-hooks map)) map key)) +(define (mapping-create-handle! map key init) + ((mapping-hooks-create-handle (mapping-hooks map)) map key init)) +(define (mapping-remove! map key) + ((mapping-hooks-remove (mapping-hooks map)) map key)) + +(define* (mapping-ref map key #:optional dflt) + (cond + ((mapping-get-handle map key) => cdr) + (else dflt))) + +(define (mapping-set! map key val) + (set-cdr! (mapping-create-handle! map key #f) val)) + + + +(define hash-table-mapping-hooks + (let ((wrap (lambda (proc) (lambda (1st . rest) (apply proc (mapping-data 1st) rest))))) + + (perfect-funcq 17 + (lambda (hash-proc assoc-proc) + (let ((procs (list hash-proc assoc-proc))) + (cond + ((equal? procs `(,hashq ,assq)) + (make-mapping-hooks (wrap hashq-get-handle) + (wrap hashq-create-handle!) + (wrap hashq-remove!))) + ((equal? procs `(,hashv ,assv)) + (make-mapping-hooks (wrap hashv-get-handle) + (wrap hashv-create-handle!) + (wrap hashv-remove!))) + ((equal? procs `(,hash ,assoc)) + (make-mapping-hooks (wrap hash-get-handle) + (wrap hash-create-handle!) + (wrap hash-remove!))) + (else + (make-mapping-hooks (wrap + (lambda (table key) + (hashx-get-handle hash-proc assoc-proc table key))) + (wrap + (lambda (table key init) + (hashx-create-handle! hash-proc assoc-proc table key init))) + (wrap + (lambda (table key) + (hashx-remove! hash-proc assoc-proc table key))))))))))) + +(define (make-hash-table-mapping table hash-proc assoc-proc) + (make-mapping (hash-table-mapping-hooks hash-proc assoc-proc) table)) + +(define* (hash-table-mapping #:optional (size 71) #:key + (hash-proc hash) + (assoc-proc + (or (assq-ref `((,hashq . ,assq) + (,hashv . ,assv) + (,hash . ,assoc)) + hash-proc) + (error 'hash-table-mapping + "Hash-procedure specified with no known assoc function." + hash-proc))) + (table-constructor + (lambda (len) (make-vector len '())))) + (make-hash-table-mapping (table-constructor size) + hash-proc + assoc-proc)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/match.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/match.scm new file mode 100644 index 0000000000000000000000000000000000000000..099afb53a7d7e4a4ca59e443b6b35970a516402e --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/match.scm @@ -0,0 +1,59 @@ +;;; -*- mode: scheme; coding: utf-8; -*- +;;; +;;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. +;;; +;;; This library is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU Lesser General Public +;;; License as published by the Free Software Foundation; either +;;; version 3 of the License, or (at your option) any later version. +;;; +;;; This library is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this library; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (ice-9 match) + #:export (match + match-lambda + match-lambda* + match-let + match-let* + match-letrec)) + +(define (error _ . args) + ;; Error procedure for run-time "no matching pattern" errors. + (apply throw 'match-error "match" args)) + +;; Support for record matching. + +(define-syntax slot-ref + (syntax-rules () + ((_ rtd rec n) + (struct-ref rec n)))) + +(define-syntax slot-set! + (syntax-rules () + ((_ rtd rec n value) + (struct-set! rec n value)))) + +(define-syntax is-a? + (syntax-rules () + ((_ rec rtd) + (and (struct? rec) + (eq? (struct-vtable rec) rtd))))) + +;; Compared to Andrew K. Wright's `match', this one lacks `match-define', +;; `match:error-control', `match:set-error-control', `match:error', +;; `match:set-error', and all structure-related procedures. Also, +;; `match' doesn't support clauses of the form `(pat => exp)'. + +;; Unmodified public domain code by Alex Shinn retrieved from +;; the Chibi-Scheme repository, commit 1206:acd808700e91. +;; +;; Note: Make sure to update `match.test.upstream' when updating this +;; file. +(include-from-path "ice-9/match.upstream.scm") diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/match.upstream.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/match.upstream.scm new file mode 100644 index 0000000000000000000000000000000000000000..1983c1e3f0950e18acf262a1df6197de0ab8089c --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/match.upstream.scm @@ -0,0 +1,917 @@ +;;;; match.scm -- portable hygienic pattern matcher -*- coding: utf-8 -*- +;; +;; This code is written by Alex Shinn and placed in the +;; Public Domain. All warranties are disclaimed. + +;;> @example-import[(srfi 9)] + +;;> This is a full superset of the popular @hyperlink[ +;;> "http://www.cs.indiana.edu/scheme-repository/code.match.html"]{match} +;;> package by Andrew Wright, written in fully portable @scheme{syntax-rules} +;;> and thus preserving hygiene. + +;;> The most notable extensions are the ability to use @emph{non-linear} +;;> patterns - patterns in which the same identifier occurs multiple +;;> times, tail patterns after ellipsis, and the experimental tree patterns. + +;;> @subsubsection{Patterns} + +;;> Patterns are written to look like the printed representation of +;;> the objects they match. The basic usage is + +;;> @scheme{(match expr (pat body ...) ...)} + +;;> where the result of @var{expr} is matched against each pattern in +;;> turn, and the corresponding body is evaluated for the first to +;;> succeed. Thus, a list of three elements matches a list of three +;;> elements. + +;;> @example{(let ((ls (list 1 2 3))) (match ls ((1 2 3) #t)))} + +;;> If no patterns match an error is signalled. + +;;> Identifiers will match anything, and make the corresponding +;;> binding available in the body. + +;;> @example{(match (list 1 2 3) ((a b c) b))} + +;;> If the same identifier occurs multiple times, the first instance +;;> will match anything, but subsequent instances must match a value +;;> which is @scheme{equal?} to the first. + +;;> @example{(match (list 1 2 1) ((a a b) 1) ((a b a) 2))} + +;;> The special identifier @scheme{_} matches anything, no matter how +;;> many times it is used, and does not bind the result in the body. + +;;> @example{(match (list 1 2 1) ((_ _ b) 1) ((a b a) 2))} + +;;> To match a literal identifier (or list or any other literal), use +;;> @scheme{quote}. + +;;> @example{(match 'a ('b 1) ('a 2))} + +;;> Analogous to its normal usage in scheme, @scheme{quasiquote} can +;;> be used to quote a mostly literally matching object with selected +;;> parts unquoted. + +;;> @example|{(match (list 1 2 3) (`(1 ,b ,c) (list b c)))}| + +;;> Often you want to match any number of a repeated pattern. Inside +;;> a list pattern you can append @scheme{...} after an element to +;;> match zero or more of that pattern (like a regexp Kleene star). + +;;> @example{(match (list 1 2) ((1 2 3 ...) #t))} +;;> @example{(match (list 1 2 3) ((1 2 3 ...) #t))} +;;> @example{(match (list 1 2 3 3 3) ((1 2 3 ...) #t))} + +;;> Pattern variables matched inside the repeated pattern are bound to +;;> a list of each matching instance in the body. + +;;> @example{(match (list 1 2) ((a b c ...) c))} +;;> @example{(match (list 1 2 3) ((a b c ...) c))} +;;> @example{(match (list 1 2 3 4 5) ((a b c ...) c))} + +;;> More than one @scheme{...} may not be used in the same list, since +;;> this would require exponential backtracking in the general case. +;;> However, @scheme{...} need not be the final element in the list, +;;> and may be succeeded by a fixed number of patterns. + +;;> @example{(match (list 1 2 3 4) ((a b c ... d e) c))} +;;> @example{(match (list 1 2 3 4 5) ((a b c ... d e) c))} +;;> @example{(match (list 1 2 3 4 5 6 7) ((a b c ... d e) c))} + +;;> @scheme{___} is provided as an alias for @scheme{...} when it is +;;> inconvenient to use the ellipsis (as in a syntax-rules template). + +;;> The @scheme{..1} syntax is exactly like the @scheme{...} except +;;> that it matches one or more repetitions (like a regexp "+"). + +;;> @example{(match (list 1 2) ((a b c ..1) c))} +;;> @example{(match (list 1 2 3) ((a b c ..1) c))} + +;;> The boolean operators @scheme{and}, @scheme{or} and @scheme{not} +;;> can be used to group and negate patterns analogously to their +;;> Scheme counterparts. + +;;> The @scheme{and} operator ensures that all subpatterns match. +;;> This operator is often used with the idiom @scheme{(and x pat)} to +;;> bind @var{x} to the entire value that matches @var{pat} +;;> (c.f. "as-patterns" in ML or Haskell). Another common use is in +;;> conjunction with @scheme{not} patterns to match a general case +;;> with certain exceptions. + +;;> @example{(match 1 ((and) #t))} +;;> @example{(match 1 ((and x) x))} +;;> @example{(match 1 ((and x 1) x))} + +;;> The @scheme{or} operator ensures that at least one subpattern +;;> matches. If the same identifier occurs in different subpatterns, +;;> it is matched independently. All identifiers from all subpatterns +;;> are bound if the @scheme{or} operator matches, but the binding is +;;> only defined for identifiers from the subpattern which matched. + +;;> @example{(match 1 ((or) #t) (else #f))} +;;> @example{(match 1 ((or x) x))} +;;> @example{(match 1 ((or x 2) x))} + +;;> The @scheme{not} operator succeeds if the given pattern doesn't +;;> match. None of the identifiers used are available in the body. + +;;> @example{(match 1 ((not 2) #t))} + +;;> The more general operator @scheme{?} can be used to provide a +;;> predicate. The usage is @scheme{(? predicate pat ...)} where +;;> @var{predicate} is a Scheme expression evaluating to a predicate +;;> called on the value to match, and any optional patterns after the +;;> predicate are then matched as in an @scheme{and} pattern. + +;;> @example{(match 1 ((? odd? x) x))} + +;;> The field operator @scheme{=} is used to extract an arbitrary +;;> field and match against it. It is useful for more complex or +;;> conditional destructuring that can't be more directly expressed in +;;> the pattern syntax. The usage is @scheme{(= field pat)}, where +;;> @var{field} can be any expression, and should result in a +;;> procedure of one argument, which is applied to the value to match +;;> to generate a new value to match against @var{pat}. + +;;> Thus the pattern @scheme{(and (= car x) (= cdr y))} is equivalent +;;> to @scheme{(x . y)}, except it will result in an immediate error +;;> if the value isn't a pair. + +;;> @example{(match '(1 . 2) ((= car x) x))} +;;> @example{(match 4 ((= sqrt x) x))} + +;;> The record operator @scheme{$} is used as a concise way to match +;;> records defined by SRFI-9 (or SRFI-99). The usage is +;;> @scheme{($ rtd field ...)}, where @var{rtd} should be the record +;;> type descriptor specified as the first argument to +;;> @scheme{define-record-type}, and each @var{field} is a subpattern +;;> matched against the fields of the record in order. Not all fields +;;> must be present. + +;;> @example{ +;;> (let () +;;> (define-record-type employee +;;> (make-employee name title) +;;> employee? +;;> (name get-name) +;;> (title get-title)) +;;> (match (make-employee "Bob" "Doctor") +;;> (($ employee n t) (list t n)))) +;;> } + +;;> The @scheme{set!} and @scheme{get!} operators are used to bind an +;;> identifier to the setter and getter of a field, respectively. The +;;> setter is a procedure of one argument, which mutates the field to +;;> that argument. The getter is a procedure of no arguments which +;;> returns the current value of the field. + +;;> @example{(let ((x (cons 1 2))) (match x ((1 . (set! s)) (s 3) x)))} +;;> @example{(match '(1 . 2) ((1 . (get! g)) (g)))} + +;;> The new operator @scheme{***} can be used to search a tree for +;;> subpatterns. A pattern of the form @scheme{(x *** y)} represents +;;> the subpattern @var{y} located somewhere in a tree where the path +;;> from the current object to @var{y} can be seen as a list of the +;;> form @scheme{(x ...)}. @var{y} can immediately match the current +;;> object in which case the path is the empty list. In a sense it's +;;> a 2-dimensional version of the @scheme{...} pattern. + +;;> As a common case the pattern @scheme{(_ *** y)} can be used to +;;> search for @var{y} anywhere in a tree, regardless of the path +;;> used. + +;;> @example{(match '(a (a (a b))) ((x *** 'b) x))} +;;> @example{(match '(a (b) (c (d e) (f g))) ((x *** 'g) x))} + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Notes + +;; The implementation is a simple generative pattern matcher - each +;; pattern is expanded into the required tests, calling a failure +;; continuation if the tests fail. This makes the logic easy to +;; follow and extend, but produces sub-optimal code in cases where you +;; have many similar clauses due to repeating the same tests. +;; Nonetheless a smart compiler should be able to remove the redundant +;; tests. For MATCH-LET and DESTRUCTURING-BIND type uses there is no +;; performance hit. + +;; The original version was written on 2006/11/29 and described in the +;; following Usenet post: +;; http://groups.google.com/group/comp.lang.scheme/msg/0941234de7112ffd +;; and is still available at +;; http://synthcode.com/scheme/match-simple.scm +;; It's just 80 lines for the core MATCH, and an extra 40 lines for +;; MATCH-LET, MATCH-LAMBDA and other syntactic sugar. +;; +;; A variant of this file which uses COND-EXPAND in a few places for +;; performance can be found at +;; http://synthcode.com/scheme/match-cond-expand.scm +;; +;; 2016/03/06 - fixing named match-let (thanks to Stefan Israelsson Tampe) +;; 2015/05/09 - fixing bug in var extraction of quasiquote patterns +;; 2014/11/24 - [OMITTED IN GUILE] adding Gauche's `@' pattern for named record field matching +;; 2012/12/26 - wrapping match-let&co body in lexical closure +;; 2012/11/28 - fixing typo s/vetor/vector in largely unused set! code +;; 2012/05/23 - fixing combinatorial explosion of code in certain or patterns +;; 2011/09/25 - fixing bug when directly matching an identifier repeated in +;; the pattern (thanks to Stefan Israelsson Tampe) +;; 2011/01/27 - fixing bug when matching tail patterns against improper lists +;; 2010/09/26 - adding `..1' patterns (thanks to Ludovic Courtès) +;; 2010/09/07 - fixing identifier extraction in some `...' and `***' patterns +;; 2009/11/25 - adding `***' tree search patterns +;; 2008/03/20 - fixing bug where (a ...) matched non-lists +;; 2008/03/15 - removing redundant check in vector patterns +;; 2008/03/06 - you can use `...' portably now (thanks to Taylor Campbell) +;; 2007/09/04 - fixing quasiquote patterns +;; 2007/07/21 - allowing ellipsis patterns in non-final list positions +;; 2007/04/10 - fixing potential hygiene issue in match-check-ellipsis +;; (thanks to Taylor Campbell) +;; 2007/04/08 - clean up, commenting +;; 2006/12/24 - bugfixes +;; 2006/12/01 - non-linear patterns, shared variables in OR, get!/set! + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; force compile-time syntax errors with useful messages + +(define-syntax match-syntax-error + (syntax-rules () + ((_) (match-syntax-error "invalid match-syntax-error usage")))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;> @subsubsection{Syntax} + +;;> @subsubsubsection{@rawcode{(match expr (pattern . body) ...)@br{} +;;> (match expr (pattern (=> failure) . body) ...)}} + +;;> The result of @var{expr} is matched against each @var{pattern} in +;;> turn, according to the pattern rules described in the previous +;;> section, until the the first @var{pattern} matches. When a match is +;;> found, the corresponding @var{body}s are evaluated in order, +;;> and the result of the last expression is returned as the result +;;> of the entire @scheme{match}. If a @var{failure} is provided, +;;> then it is bound to a procedure of no arguments which continues, +;;> processing at the next @var{pattern}. If no @var{pattern} matches, +;;> an error is signalled. + +;; The basic interface. MATCH just performs some basic syntax +;; validation, binds the match expression to a temporary variable `v', +;; and passes it on to MATCH-NEXT. It's a constant throughout the +;; code below that the binding `v' is a direct variable reference, not +;; an expression. + +(define-syntax match + (syntax-rules () + ((match) + (match-syntax-error "missing match expression")) + ((match atom) + (match-syntax-error "no match clauses")) + ((match (app ...) (pat . body) ...) + (let ((v (app ...))) + (match-next v ((app ...) (set! (app ...))) (pat . body) ...))) + ((match #(vec ...) (pat . body) ...) + (let ((v #(vec ...))) + (match-next v (v (set! v)) (pat . body) ...))) + ((match atom (pat . body) ...) + (let ((v atom)) + (match-next v (atom (set! atom)) (pat . body) ...))) + )) + +;; MATCH-NEXT passes each clause to MATCH-ONE in turn with its failure +;; thunk, which is expanded by recursing MATCH-NEXT on the remaining +;; clauses. `g+s' is a list of two elements, the get! and set! +;; expressions respectively. + +(define-syntax match-next + (syntax-rules (=>) + ;; no more clauses, the match failed + ((match-next v g+s) + ;; Here we call error in non-tail context, so that the backtrace + ;; can show the source location of the failing match form. + (begin + (error 'match "no matching pattern" v) + #f)) + ;; named failure continuation + ((match-next v g+s (pat (=> failure) . body) . rest) + (let ((failure (lambda () (match-next v g+s . rest)))) + ;; match-one analyzes the pattern for us + (match-one v pat g+s (match-drop-ids (begin . body)) (failure) ()))) + ;; anonymous failure continuation, give it a dummy name + ((match-next v g+s (pat . body) . rest) + (match-next v g+s (pat (=> failure) . body) . rest)))) + +;; MATCH-ONE first checks for ellipsis patterns, otherwise passes on to +;; MATCH-TWO. + +(define-syntax match-one + (syntax-rules () + ;; If it's a list of two or more values, check to see if the + ;; second one is an ellipsis and handle accordingly, otherwise go + ;; to MATCH-TWO. + ((match-one v (p q . r) g+s sk fk i) + (match-check-ellipsis + q + (match-extract-vars p (match-gen-ellipsis v p r g+s sk fk i) i ()) + (match-two v (p q . r) g+s sk fk i))) + ;; Go directly to MATCH-TWO. + ((match-one . x) + (match-two . x)))) + +;; This is the guts of the pattern matcher. We are passed a lot of +;; information in the form: +;; +;; (match-two var pattern getter setter success-k fail-k (ids ...)) +;; +;; usually abbreviated +;; +;; (match-two v p g+s sk fk i) +;; +;; where VAR is the symbol name of the current variable we are +;; matching, PATTERN is the current pattern, getter and setter are the +;; corresponding accessors (e.g. CAR and SET-CAR! of the pair holding +;; VAR), SUCCESS-K is the success continuation, FAIL-K is the failure +;; continuation (which is just a thunk call and is thus safe to expand +;; multiple times) and IDS are the list of identifiers bound in the +;; pattern so far. + +(define-syntax match-two + (syntax-rules (_ ___ ..1 *** quote quasiquote ? $ = and or not set! get!) + ((match-two v () g+s (sk ...) fk i) + (if (null? v) (sk ... i) fk)) + ((match-two v (quote p) g+s (sk ...) fk i) + (if (equal? v 'p) (sk ... i) fk)) + ((match-two v (quasiquote p) . x) + (match-quasiquote v p . x)) + ((match-two v (and) g+s (sk ...) fk i) (sk ... i)) + ((match-two v (and p q ...) g+s sk fk i) + (match-one v p g+s (match-one v (and q ...) g+s sk fk) fk i)) + ((match-two v (or) g+s sk fk i) fk) + ((match-two v (or p) . x) + (match-one v p . x)) + ((match-two v (or p ...) g+s sk fk i) + (match-extract-vars (or p ...) (match-gen-or v (p ...) g+s sk fk i) i ())) + ((match-two v (not p) g+s (sk ...) fk i) + (match-one v p g+s (match-drop-ids fk) (sk ... i) i)) + ((match-two v (get! getter) (g s) (sk ...) fk i) + (let ((getter (lambda () g))) (sk ... i))) + ((match-two v (set! setter) (g (s ...)) (sk ...) fk i) + (let ((setter (lambda (x) (s ... x)))) (sk ... i))) + ((match-two v (? pred . p) g+s sk fk i) + (if (pred v) (match-one v (and . p) g+s sk fk i) fk)) + ((match-two v (= proc p) . x) + (let ((w (proc v))) (match-one w p . x))) + ((match-two v (p ___ . r) g+s sk fk i) + (match-extract-vars p (match-gen-ellipsis v p r g+s sk fk i) i ())) + ((match-two v (p) g+s sk fk i) + (if (and (pair? v) (null? (cdr v))) + (let ((w (car v))) + (match-one w p ((car v) (set-car! v)) sk fk i)) + fk)) + ((match-two v (p *** q) g+s sk fk i) + (match-extract-vars p (match-gen-search v p q g+s sk fk i) i ())) + ((match-two v (p *** . q) g+s sk fk i) + (match-syntax-error "invalid use of ***" (p *** . q))) + ((match-two v (p ..1) g+s sk fk i) + (if (pair? v) + (match-one v (p ___) g+s sk fk i) + fk)) + ((match-two v ($ rec p ...) g+s sk fk i) + (if (is-a? v rec) + (match-record-refs v rec 0 (p ...) g+s sk fk i) + fk)) + ((match-two v (p . q) g+s sk fk i) + (if (pair? v) + (let ((w (car v)) (x (cdr v))) + (match-one w p ((car v) (set-car! v)) + (match-one x q ((cdr v) (set-cdr! v)) sk fk) + fk + i)) + fk)) + ((match-two v #(p ...) g+s . x) + (match-vector v 0 () (p ...) . x)) + ((match-two v _ g+s (sk ...) fk i) (sk ... i)) + ;; Not a pair or vector or special literal, test to see if it's a + ;; new symbol, in which case we just bind it, or if it's an + ;; already bound symbol or some other literal, in which case we + ;; compare it with EQUAL?. + ((match-two v x g+s (sk ...) fk (id ...)) + (let-syntax + ((new-sym? + (syntax-rules (id ...) + ((new-sym? x sk2 fk2) sk2) + ((new-sym? y sk2 fk2) fk2)))) + (new-sym? random-sym-to-match + (let ((x v)) (sk ... (id ... x))) + (if (equal? v x) (sk ... (id ...)) fk)))) + )) + +;; QUASIQUOTE patterns + +(define-syntax match-quasiquote + (syntax-rules (unquote unquote-splicing quasiquote) + ((_ v (unquote p) g+s sk fk i) + (match-one v p g+s sk fk i)) + ((_ v ((unquote-splicing p) . rest) g+s sk fk i) + (if (pair? v) + (match-one v + (p . tmp) + (match-quasiquote tmp rest g+s sk fk) + fk + i) + fk)) + ((_ v (quasiquote p) g+s sk fk i . depth) + (match-quasiquote v p g+s sk fk i #f . depth)) + ((_ v (unquote p) g+s sk fk i x . depth) + (match-quasiquote v p g+s sk fk i . depth)) + ((_ v (unquote-splicing p) g+s sk fk i x . depth) + (match-quasiquote v p g+s sk fk i . depth)) + ((_ v (p . q) g+s sk fk i . depth) + (if (pair? v) + (let ((w (car v)) (x (cdr v))) + (match-quasiquote + w p g+s + (match-quasiquote-step x q g+s sk fk depth) + fk i . depth)) + fk)) + ((_ v #(elt ...) g+s sk fk i . depth) + (if (vector? v) + (let ((ls (vector->list v))) + (match-quasiquote ls (elt ...) g+s sk fk i . depth)) + fk)) + ((_ v x g+s sk fk i . depth) + (match-one v 'x g+s sk fk i)))) + +(define-syntax match-quasiquote-step + (syntax-rules () + ((match-quasiquote-step x q g+s sk fk depth i) + (match-quasiquote x q g+s sk fk i . depth)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Utilities + +;; Takes two values and just expands into the first. +(define-syntax match-drop-ids + (syntax-rules () + ((_ expr ids ...) expr))) + +(define-syntax match-tuck-ids + (syntax-rules () + ((_ (letish args (expr ...)) ids ...) + (letish args (expr ... ids ...))))) + +(define-syntax match-drop-first-arg + (syntax-rules () + ((_ arg expr) expr))) + +;; To expand an OR group we try each clause in succession, passing the +;; first that succeeds to the success continuation. On failure for +;; any clause, we just try the next clause, finally resorting to the +;; failure continuation fk if all clauses fail. The only trick is +;; that we want to unify the identifiers, so that the success +;; continuation can refer to a variable from any of the OR clauses. + +(define-syntax match-gen-or + (syntax-rules () + ((_ v p g+s (sk ...) fk (i ...) ((id id-ls) ...)) + (let ((sk2 (lambda (id ...) (sk ... (i ... id ...))))) + (match-gen-or-step v p g+s (match-drop-ids (sk2 id ...)) fk (i ...)))))) + +(define-syntax match-gen-or-step + (syntax-rules () + ((_ v () g+s sk fk . x) + ;; no OR clauses, call the failure continuation + fk) + ((_ v (p) . x) + ;; last (or only) OR clause, just expand normally + (match-one v p . x)) + ((_ v (p . q) g+s sk fk i) + ;; match one and try the remaining on failure + (let ((fk2 (lambda () (match-gen-or-step v q g+s sk fk i)))) + (match-one v p g+s sk (fk2) i))) + )) + +;; We match a pattern (p ...) by matching the pattern p in a loop on +;; each element of the variable, accumulating the bound ids into lists. + +;; Look at the body of the simple case - it's just a named let loop, +;; matching each element in turn to the same pattern. The only trick +;; is that we want to keep track of the lists of each extracted id, so +;; when the loop recurses we cons the ids onto their respective list +;; variables, and on success we bind the ids (what the user input and +;; expects to see in the success body) to the reversed accumulated +;; list IDs. + +(define-syntax match-gen-ellipsis + (syntax-rules () + ((_ v p () g+s (sk ...) fk i ((id id-ls) ...)) + (match-check-identifier p + ;; simplest case equivalent to (p ...), just bind the list + (let ((p v)) + (if (list? p) + (sk ... i) + fk)) + ;; simple case, match all elements of the list + (let loop ((ls v) (id-ls '()) ...) + (cond + ((null? ls) + (let ((id (reverse id-ls)) ...) (sk ... i))) + ((pair? ls) + (let ((w (car ls))) + (match-one w p ((car ls) (set-car! ls)) + (match-drop-ids (loop (cdr ls) (cons id id-ls) ...)) + fk i))) + (else + fk))))) + ((_ v p r g+s (sk ...) fk i ((id id-ls) ...)) + ;; general case, trailing patterns to match, keep track of the + ;; remaining list length so we don't need any backtracking + (match-verify-no-ellipsis + r + (let* ((tail-len (length 'r)) + (ls v) + (len (and (list? ls) (length ls)))) + (if (or (not len) (< len tail-len)) + fk + (let loop ((ls ls) (n len) (id-ls '()) ...) + (cond + ((= n tail-len) + (let ((id (reverse id-ls)) ...) + (match-one ls r (#f #f) (sk ...) fk i))) + ((pair? ls) + (let ((w (car ls))) + (match-one w p ((car ls) (set-car! ls)) + (match-drop-ids + (loop (cdr ls) (- n 1) (cons id id-ls) ...)) + fk + i))) + (else + fk))))))))) + +;; This is just a safety check. Although unlike syntax-rules we allow +;; trailing patterns after an ellipsis, we explicitly disable multiple +;; ellipses at the same level. This is because in the general case +;; such patterns are exponential in the number of ellipses, and we +;; don't want to make it easy to construct very expensive operations +;; with simple looking patterns. For example, it would be O(n^2) for +;; patterns like (a ... b ...) because we must consider every trailing +;; element for every possible break for the leading "a ...". + +(define-syntax match-verify-no-ellipsis + (syntax-rules () + ((_ (x . y) sk) + (match-check-ellipsis + x + (match-syntax-error + "multiple ellipsis patterns not allowed at same level") + (match-verify-no-ellipsis y sk))) + ((_ () sk) + sk) + ((_ x sk) + (match-syntax-error "dotted tail not allowed after ellipsis" x)))) + +;; To implement the tree search, we use two recursive procedures. TRY +;; attempts to match Y once, and on success it calls the normal SK on +;; the accumulated list ids as in MATCH-GEN-ELLIPSIS. On failure, we +;; call NEXT which first checks if the current value is a list +;; beginning with X, then calls TRY on each remaining element of the +;; list. Since TRY will recursively call NEXT again on failure, this +;; effects a full depth-first search. +;; +;; The failure continuation throughout is a jump to the next step in +;; the tree search, initialized with the original failure continuation +;; FK. + +(define-syntax match-gen-search + (syntax-rules () + ((match-gen-search v p q g+s sk fk i ((id id-ls) ...)) + (letrec ((try (lambda (w fail id-ls ...) + (match-one w q g+s + (match-tuck-ids + (let ((id (reverse id-ls)) ...) + sk)) + (next w fail id-ls ...) i))) + (next (lambda (w fail id-ls ...) + (if (not (pair? w)) + (fail) + (let ((u (car w))) + (match-one + u p ((car w) (set-car! w)) + (match-drop-ids + ;; accumulate the head variables from + ;; the p pattern, and loop over the tail + (let ((id-ls (cons id id-ls)) ...) + (let lp ((ls (cdr w))) + (if (pair? ls) + (try (car ls) + (lambda () (lp (cdr ls))) + id-ls ...) + (fail))))) + (fail) i)))))) + ;; the initial id-ls binding here is a dummy to get the right + ;; number of '()s + (let ((id-ls '()) ...) + (try v (lambda () fk) id-ls ...)))))) + +;; Vector patterns are just more of the same, with the slight +;; exception that we pass around the current vector index being +;; matched. + +(define-syntax match-vector + (syntax-rules (___) + ((_ v n pats (p q) . x) + (match-check-ellipsis q + (match-gen-vector-ellipsis v n pats p . x) + (match-vector-two v n pats (p q) . x))) + ((_ v n pats (p ___) sk fk i) + (match-gen-vector-ellipsis v n pats p sk fk i)) + ((_ . x) + (match-vector-two . x)))) + +;; Check the exact vector length, then check each element in turn. + +(define-syntax match-vector-two + (syntax-rules () + ((_ v n ((pat index) ...) () sk fk i) + (if (vector? v) + (let ((len (vector-length v))) + (if (= len n) + (match-vector-step v ((pat index) ...) sk fk i) + fk)) + fk)) + ((_ v n (pats ...) (p . q) . x) + (match-vector v (+ n 1) (pats ... (p n)) q . x)))) + +(define-syntax match-vector-step + (syntax-rules () + ((_ v () (sk ...) fk i) (sk ... i)) + ((_ v ((pat index) . rest) sk fk i) + (let ((w (vector-ref v index))) + (match-one w pat ((vector-ref v index) (vector-set! v index)) + (match-vector-step v rest sk fk) + fk i))))) + +;; With a vector ellipsis pattern we first check to see if the vector +;; length is at least the required length. + +(define-syntax match-gen-vector-ellipsis + (syntax-rules () + ((_ v n ((pat index) ...) p sk fk i) + (if (vector? v) + (let ((len (vector-length v))) + (if (>= len n) + (match-vector-step v ((pat index) ...) + (match-vector-tail v p n len sk fk) + fk i) + fk)) + fk)))) + +(define-syntax match-vector-tail + (syntax-rules () + ((_ v p n len sk fk i) + (match-extract-vars p (match-vector-tail-two v p n len sk fk i) i ())))) + +(define-syntax match-vector-tail-two + (syntax-rules () + ((_ v p n len (sk ...) fk i ((id id-ls) ...)) + (let loop ((j n) (id-ls '()) ...) + (if (>= j len) + (let ((id (reverse id-ls)) ...) (sk ... i)) + (let ((w (vector-ref v j))) + (match-one w p ((vector-ref v j) (vector-set! v j)) + (match-drop-ids (loop (+ j 1) (cons id id-ls) ...)) + fk i))))))) + +(define-syntax match-record-refs + (syntax-rules () + ((_ v rec n (p . q) g+s sk fk i) + (let ((w (slot-ref rec v n))) + (match-one w p ((slot-ref rec v n) (slot-set! rec v n)) + (match-record-refs v rec (+ n 1) q g+s sk fk) fk i))) + ((_ v rec n () g+s (sk ...) fk i) + (sk ... i)))) + +;; Extract all identifiers in a pattern. A little more complicated +;; than just looking for symbols, we need to ignore special keywords +;; and non-pattern forms (such as the predicate expression in ? +;; patterns), and also ignore previously bound identifiers. +;; +;; Calls the continuation with all new vars as a list of the form +;; ((orig-var tmp-name) ...), where tmp-name can be used to uniquely +;; pair with the original variable (e.g. it's used in the ellipsis +;; generation for list variables). +;; +;; (match-extract-vars pattern continuation (ids ...) (new-vars ...)) + +(define-syntax match-extract-vars + (syntax-rules (_ ___ ..1 *** ? $ = quote quasiquote and or not get! set!) + ((match-extract-vars (? pred . p) . x) + (match-extract-vars p . x)) + ((match-extract-vars ($ rec . p) . x) + (match-extract-vars p . x)) + ((match-extract-vars (= proc p) . x) + (match-extract-vars p . x)) + ((match-extract-vars (quote x) (k ...) i v) + (k ... v)) + ((match-extract-vars (quasiquote x) k i v) + (match-extract-quasiquote-vars x k i v (#t))) + ((match-extract-vars (and . p) . x) + (match-extract-vars p . x)) + ((match-extract-vars (or . p) . x) + (match-extract-vars p . x)) + ((match-extract-vars (not . p) . x) + (match-extract-vars p . x)) + ;; A non-keyword pair, expand the CAR with a continuation to + ;; expand the CDR. + ((match-extract-vars (p q . r) k i v) + (match-check-ellipsis + q + (match-extract-vars (p . r) k i v) + (match-extract-vars p (match-extract-vars-step (q . r) k i v) i ()))) + ((match-extract-vars (p . q) k i v) + (match-extract-vars p (match-extract-vars-step q k i v) i ())) + ((match-extract-vars #(p ...) . x) + (match-extract-vars (p ...) . x)) + ((match-extract-vars _ (k ...) i v) (k ... v)) + ((match-extract-vars ___ (k ...) i v) (k ... v)) + ((match-extract-vars *** (k ...) i v) (k ... v)) + ((match-extract-vars ..1 (k ...) i v) (k ... v)) + ;; This is the main part, the only place where we might add a new + ;; var if it's an unbound symbol. + ((match-extract-vars p (k ...) (i ...) v) + (let-syntax + ((new-sym? + (syntax-rules (i ...) + ((new-sym? p sk fk) sk) + ((new-sym? any sk fk) fk)))) + (new-sym? random-sym-to-match + (k ... ((p p-ls) . v)) + (k ... v)))) + )) + +;; Stepper used in the above so it can expand the CAR and CDR +;; separately. + +(define-syntax match-extract-vars-step + (syntax-rules () + ((_ p k i v ((v2 v2-ls) ...)) + (match-extract-vars p k (v2 ... . i) ((v2 v2-ls) ... . v))) + )) + +(define-syntax match-extract-quasiquote-vars + (syntax-rules (quasiquote unquote unquote-splicing) + ((match-extract-quasiquote-vars (quasiquote x) k i v d) + (match-extract-quasiquote-vars x k i v (#t . d))) + ((match-extract-quasiquote-vars (unquote-splicing x) k i v d) + (match-extract-quasiquote-vars (unquote x) k i v d)) + ((match-extract-quasiquote-vars (unquote x) k i v (#t)) + (match-extract-vars x k i v)) + ((match-extract-quasiquote-vars (unquote x) k i v (#t . d)) + (match-extract-quasiquote-vars x k i v d)) + ((match-extract-quasiquote-vars (x . y) k i v d) + (match-extract-quasiquote-vars + x + (match-extract-quasiquote-vars-step y k i v d) i () d)) + ((match-extract-quasiquote-vars #(x ...) k i v d) + (match-extract-quasiquote-vars (x ...) k i v d)) + ((match-extract-quasiquote-vars x (k ...) i v d) + (k ... v)) + )) + +(define-syntax match-extract-quasiquote-vars-step + (syntax-rules () + ((_ x k i v d ((v2 v2-ls) ...)) + (match-extract-quasiquote-vars x k (v2 ... . i) ((v2 v2-ls) ... . v) d)) + )) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Gimme some sugar baby. + +;;> Shortcut for @scheme{lambda} + @scheme{match}. Creates a +;;> procedure of one argument, and matches that argument against each +;;> clause. + +(define-syntax match-lambda + (syntax-rules () + ((_ (pattern . body) ...) (lambda (expr) (match expr (pattern . body) ...))))) + +;;> Similar to @scheme{match-lambda}. Creates a procedure of any +;;> number of arguments, and matches the argument list against each +;;> clause. + +(define-syntax match-lambda* + (syntax-rules () + ((_ (pattern . body) ...) (lambda expr (match expr (pattern . body) ...))))) + +;;> Matches each var to the corresponding expression, and evaluates +;;> the body with all match variables in scope. Raises an error if +;;> any of the expressions fail to match. Syntax analogous to named +;;> let can also be used for recursive functions which match on their +;;> arguments as in @scheme{match-lambda*}. + +(define-syntax match-let + (syntax-rules () + ((_ ((var value) ...) . body) + (match-let/helper let () () ((var value) ...) . body)) + ((_ loop ((var init) ...) . body) + (match-named-let loop () ((var init) ...) . body)))) + +;;> Similar to @scheme{match-let}, but analogously to @scheme{letrec} +;;> matches and binds the variables with all match variables in scope. + +(define-syntax match-letrec + (syntax-rules () + ((_ ((var value) ...) . body) + (match-let/helper letrec () () ((var value) ...) . body)))) + +(define-syntax match-let/helper + (syntax-rules () + ((_ let ((var expr) ...) () () . body) + (let ((var expr) ...) . body)) + ((_ let ((var expr) ...) ((pat tmp) ...) () . body) + (let ((var expr) ...) + (match-let* ((pat tmp) ...) + . body))) + ((_ let (v ...) (p ...) (((a . b) expr) . rest) . body) + (match-let/helper + let (v ... (tmp expr)) (p ... ((a . b) tmp)) rest . body)) + ((_ let (v ...) (p ...) ((#(a ...) expr) . rest) . body) + (match-let/helper + let (v ... (tmp expr)) (p ... (#(a ...) tmp)) rest . body)) + ((_ let (v ...) (p ...) ((a expr) . rest) . body) + (match-let/helper let (v ... (a expr)) (p ...) rest . body)))) + +(define-syntax match-named-let + (syntax-rules () + ((_ loop ((pat expr var) ...) () . body) + (let loop ((var expr) ...) + (match-let ((pat var) ...) + . body))) + ((_ loop (v ...) ((pat expr) . rest) . body) + (match-named-let loop (v ... (pat expr tmp)) rest . body)))) + +;;> @subsubsubsection{@rawcode{(match-let* ((var value) ...) body ...)}} + +;;> Similar to @scheme{match-let}, but analogously to @scheme{let*} +;;> matches and binds the variables in sequence, with preceding match +;;> variables in scope. + +(define-syntax match-let* + (syntax-rules () + ((_ () . body) + (let () . body)) + ((_ ((pat expr) . rest) . body) + (match expr (pat (match-let* rest . body)))))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Otherwise COND-EXPANDed bits. + +;; This *should* work, but doesn't :( +;; (define-syntax match-check-ellipsis +;; (syntax-rules (...) +;; ((_ ... sk fk) sk) +;; ((_ x sk fk) fk))) + +;; This is a little more complicated, and introduces a new let-syntax, +;; but should work portably in any R[56]RS Scheme. Taylor Campbell +;; originally came up with the idea. +(define-syntax match-check-ellipsis + (syntax-rules () + ;; these two aren't necessary but provide fast-case failures + ((match-check-ellipsis (a . b) success-k failure-k) failure-k) + ((match-check-ellipsis #(a ...) success-k failure-k) failure-k) + ;; matching an atom + ((match-check-ellipsis id success-k failure-k) + (let-syntax ((ellipsis? (syntax-rules () + ;; iff `id' is `...' here then this will + ;; match a list of any length + ((ellipsis? (foo id) sk fk) sk) + ((ellipsis? other sk fk) fk)))) + ;; this list of three elements will only match the (foo id) list + ;; above if `id' is `...' + (ellipsis? (a b c) success-k failure-k))))) + + +;; This is portable but can be more efficient with non-portable +;; extensions. This trick was originally discovered by Oleg Kiselyov. + +(define-syntax match-check-identifier + (syntax-rules () + ;; fast-case failures, lists and vectors are not identifiers + ((_ (x . y) success-k failure-k) failure-k) + ((_ #(x ...) success-k failure-k) failure-k) + ;; x is an atom + ((_ x success-k failure-k) + (let-syntax + ((sym? + (syntax-rules () + ;; if the symbol `abracadabra' matches x, then x is a + ;; symbol + ((sym? x sk fk) sk) + ;; otherwise x is a non-symbol datum + ((sym? y sk fk) fk)))) + (sym? abracadabra success-k failure-k))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/networking.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/networking.scm new file mode 100644 index 0000000000000000000000000000000000000000..f9ff39436fc2c17c1664f1013e14ba4802a69126 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/networking.scm @@ -0,0 +1,94 @@ +;;; installed-scm-file + +;;;; Copyright (C) 1999, 2005, 2006, 2010 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(eval-when (compile) + (set-current-module (resolve-module '(guile)))) + +(define (gethostbyaddr addr) (gethost addr)) +(define (gethostbyname name) (gethost name)) + +(define (getnetbyaddr addr) (getnet addr)) +(define (getnetbyname name) (getnet name)) + +(define (getprotobyname name) (getproto name)) +(define (getprotobynumber addr) (getproto addr)) + +(define (getservbyname name proto) (getserv name proto)) +(define (getservbyport port proto) (getserv port proto)) + +(define (sethostent . stayopen) + (if (pair? stayopen) + (sethost (car stayopen)) + (sethost #f))) +(define (setnetent . stayopen) + (if (pair? stayopen) + (setnet (car stayopen)) + (setnet #f))) +(define (setprotoent . stayopen) + (if (pair? stayopen) + (setproto (car stayopen)) + (setproto #f))) +(define (setservent . stayopen) + (if (pair? stayopen) + (setserv (car stayopen)) + (setserv #f))) + +(define (gethostent) (gethost)) +(define (getnetent) (getnet)) +(define (getprotoent) (getproto)) +(define (getservent) (getserv)) + +(define (endhostent) (sethost)) +(define (endnetent) (setnet)) +(define (endprotoent) (setproto)) +(define (endservent) (setserv)) + +(define (hostent:name obj) (vector-ref obj 0)) +(define (hostent:aliases obj) (vector-ref obj 1)) +(define (hostent:addrtype obj) (vector-ref obj 2)) +(define (hostent:length obj) (vector-ref obj 3)) +(define (hostent:addr-list obj) (vector-ref obj 4)) + +(define (netent:name obj) (vector-ref obj 0)) +(define (netent:aliases obj) (vector-ref obj 1)) +(define (netent:addrtype obj) (vector-ref obj 2)) +(define (netent:net obj) (vector-ref obj 3)) + +(define (protoent:name obj) (vector-ref obj 0)) +(define (protoent:aliases obj) (vector-ref obj 1)) +(define (protoent:proto obj) (vector-ref obj 2)) + +(define (servent:name obj) (vector-ref obj 0)) +(define (servent:aliases obj) (vector-ref obj 1)) +(define (servent:port obj) (vector-ref obj 2)) +(define (servent:proto obj) (vector-ref obj 3)) + +(define (sockaddr:fam obj) (vector-ref obj 0)) +(define (sockaddr:path obj) (vector-ref obj 1)) +(define (sockaddr:addr obj) (vector-ref obj 1)) +(define (sockaddr:port obj) (vector-ref obj 2)) +(define (sockaddr:flowinfo obj) (vector-ref obj 3)) +(define (sockaddr:scopeid obj) (vector-ref obj 4)) + +(define (addrinfo:flags obj) (vector-ref obj 0)) +(define (addrinfo:fam obj) (vector-ref obj 1)) +(define (addrinfo:socktype obj) (vector-ref obj 2)) +(define (addrinfo:protocol obj) (vector-ref obj 3)) +(define (addrinfo:addr obj) (vector-ref obj 4)) +(define (addrinfo:canonname obj) (vector-ref obj 5)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/null.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/null.scm new file mode 100644 index 0000000000000000000000000000000000000000..58b271e318dd0da30f4f855c8a2b176f5bdb33cc --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/null.scm @@ -0,0 +1,34 @@ +;;;; Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +;;;; The null environment - only syntactic bindings + +(define-module (ice-9 null) + :re-export-syntax (define quote lambda if set! + + cond case and or + + let let* letrec + + begin do + + delay + + quasiquote + + define-syntax + let-syntax letrec-syntax)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/occam-channel.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/occam-channel.scm new file mode 100644 index 0000000000000000000000000000000000000000..ea1154b52d89f9af91ebd0783e17314814df76ac --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/occam-channel.scm @@ -0,0 +1,261 @@ +;;;; Occam-like channels + +;;; Copyright (C) 2003, 2006 Free Software Foundation, Inc. +;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (ice-9 occam-channel) + #:use-module (oop goops) + #:use-module (ice-9 threads) + #:export-syntax (alt + ;; macro use: + oc:lock oc:unlock oc:consequence + oc:immediate-dispatch oc:late-dispatch oc:first-channel + oc:set-handshake-channel oc:unset-handshake-channel) + #:export (make-channel + ? + ! + make-timer + ;; macro use: + handshake-channel mutex + sender-waiting? + immediate-receive late-receive + ) + ) + +(define no-data '(no-data)) +(define receiver-waiting '(receiver-waiting)) + +(define-class ()) + +(define-class () + (handshake-channel #:accessor handshake-channel) + (data #:accessor data #:init-value no-data) + (cv #:accessor cv #:init-form (make-condition-variable)) + (mutex #:accessor mutex #:init-form (make-mutex))) + +(define-method (initialize (ch ) initargs) + (next-method) + (set! (handshake-channel ch) ch)) + +(define-method (make-channel) + (make )) + +(define-method (sender-waiting? (ch )) + (not (eq? (data ch) no-data))) + +(define-method (receiver-waiting? (ch )) + (eq? (data ch) receiver-waiting)) + +(define-method (immediate-receive (ch )) + (signal-condition-variable (cv ch)) + (let ((res (data ch))) + (set! (data ch) no-data) + res)) + +(define-method (late-receive (ch )) + (let ((res (data ch))) + (set! (data ch) no-data) + res)) + +(define-method (? (ch )) + (lock-mutex (mutex ch)) + (let ((res (cond ((receiver-waiting? ch) + (unlock-mutex (mutex ch)) + (scm-error 'misc-error '? + "another process is already receiving on ~A" + (list ch) #f)) + ((sender-waiting? ch) + (immediate-receive ch)) + (else + (set! (data ch) receiver-waiting) + (wait-condition-variable (cv ch) (mutex ch)) + (late-receive ch))))) + (unlock-mutex (mutex ch)) + res)) + +(define-method (! (ch )) + (! ch *unspecified*)) + +(define-method (! (ch ) (x )) + (lock-mutex (mutex (handshake-channel ch))) + (cond ((receiver-waiting? ch) + (set! (data ch) x) + (signal-condition-variable (cv (handshake-channel ch)))) + ((sender-waiting? ch) + (unlock-mutex (mutex (handshake-channel ch))) + (scm-error 'misc-error '! "another process is already sending on ~A" + (list ch) #f)) + (else + (set! (data ch) x) + (wait-condition-variable (cv ch) (mutex ch)))) + (unlock-mutex (mutex (handshake-channel ch)))) + +;;; Add protocols? + +(define-class () + (port #:accessor port #:init-keyword #:port)) + +(define-method (make-channel (port )) + (make #:port port)) + +(define-method (? (ch )) + (read (port ch))) + +(define-method (! (ch )) + (write (port ch))) + +(define-class ()) + +(define the-timer (make )) + +(define timer-cv (make-condition-variable)) +(define timer-mutex (make-mutex)) + +(define (make-timer) + the-timer) + +(define (timeofday->us t) + (+ (* 1000000 (car t)) (cdr t))) + +(define (us->timeofday n) + (cons (quotient n 1000000) + (remainder n 1000000))) + +(define-method (? (ch )) + (timeofday->us (gettimeofday))) + +(define-method (? (ch ) (t )) + (lock-mutex timer-mutex) + (wait-condition-variable timer-cv timer-mutex (us->timeofday t)) + (unlock-mutex timer-mutex)) + +;;; (alt CLAUSE ...) +;;; +;;; CLAUSE ::= ((? CH) FORM ...) +;;; | (EXP (? CH) FORM ...) +;;; | (EXP FORM ...) +;;; +;;; where FORM ... can be => (lambda (x) ...) +;;; +;;; *fixme* Currently only handles :s +;;; + +(define-syntax oc:lock + (syntax-rules (?) + ((_ ((? ch) form ...)) (lock-mutex (mutex ch))) + ((_ (exp (? ch) form ...)) (lock-mutex (mutex ch))) + ((_ (exp form ...)) #f))) + +(define-syntax oc:unlock + (syntax-rules (?) + ((_ ((? ch) form ...)) (unlock-mutex (mutex ch))) + ((_ (exp (? ch) form ...)) (unlock-mutex (mutex ch))) + ((_ (exp form ...)) #f))) + +(define-syntax oc:consequence + (syntax-rules (=>) + ((_ data) data) + ((_ data => (lambda (x) e1 e2 ...)) + (let ((x data)) e1 e2 ...)) + ((_ data e1 e2 ...) + (begin data e1 e2 ...)))) + +(define-syntax oc:immediate-dispatch + (syntax-rules (?) + ((_ ((? ch) e1 ...)) + ((sender-waiting? ch) + (oc:consequence (immediate-receive ch) e1 ...))) + ((_ (exp (? ch) e1 ...)) + ((and exp (sender-waiting? ch)) + (oc:consequence (immediate-receive ch) e1 ...))) + ((_ (exp e1 ...)) + (exp e1 ...)))) + +(define-syntax oc:late-dispatch + (syntax-rules (?) + ((_ ((? ch) e1 ...)) + ((sender-waiting? ch) + (oc:consequence (late-receive ch) e1 ...))) + ((_ (exp (? ch) e1 ...)) + ((and exp (sender-waiting? ch)) + (oc:consequence (late-receive ch) e1 ...))) + ((_ (exp e1 ...)) + (#f)))) + +(define-syntax oc:first-channel + (syntax-rules (?) + ((_ ((? ch) e1 ...) c2 ...) + ch) + ((_ (exp (? ch) e1 ...) c2 ...) + ch) + ((_ c1 c2 ...) + (first-channel c2 ...)))) + +(define-syntax oc:set-handshake-channel + (syntax-rules (?) + ((_ ((? ch) e1 ...) handshake) + (set! (handshake-channel ch) handshake)) + ((_ (exp (? ch) e1 ...) handshake) + (and exp (set! (handshake-channel ch) handshake))) + ((_ (exp e1 ...) handshake) + #f))) + +(define-syntax oc:unset-handshake-channel + (syntax-rules (?) + ((_ ((? ch) e1 ...)) + (set! (handshake-channel ch) ch)) + ((_ (exp (? ch) e1 ...)) + (and exp (set! (handshake-channel ch) ch))) + ((_ (exp e1 ...)) + #f))) + +(define-syntax alt + (lambda (x) + (define (else-clause? x) + (syntax-case x (else) + ((_) #f) + ((_ (else e1 e2 ...)) #t) + ((_ c1 c2 ...) (else-clause? (syntax (_ c2 ...)))))) + + (syntax-case x (else) + ((_ c1 c2 ...) + (else-clause? x) + (syntax (begin + (oc:lock c1) + (oc:lock c2) ... + (let ((res (cond (oc:immediate-dispatch c1) + (oc:immediate-dispatch c2) ...))) + (oc:unlock c1) + (oc:unlock c2) ... + res)))) + ((_ c1 c2 ...) + (syntax (begin + (oc:lock c1) + (oc:lock c2) ... + (let ((res (cond (oc:immediate-dispatch c1) + (oc:immediate-dispatch c2) ... + (else (let ((ch (oc:first-channel c1 c2 ...))) + (oc:set-handshake-channel c1 ch) + (oc:set-handshake-channel c2 ch) ... + (wait-condition-variable (cv ch) + (mutex ch)) + (oc:unset-handshake-channel c1) + (oc:unset-handshake-channel c2) ... + (cond (oc:late-dispatch c1) + (oc:late-dispatch c2) ...)))))) + (oc:unlock c1) + (oc:unlock c2) ... + res))))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/optargs.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/optargs.scm new file mode 100644 index 0000000000000000000000000000000000000000..dc4ec9571e130b30db75cf60d15a4496464cf7d3 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/optargs.scm @@ -0,0 +1,381 @@ +;;;; optargs.scm -- support for optional arguments +;;;; +;;;; Copyright (C) 1997, 1998, 1999, 2001, 2002, 2004, 2006, 2009, 2010, 2011 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; +;;;; Contributed by Maciej Stachowiak + + + +;;; Commentary: + +;;; {Optional Arguments} +;;; +;;; The C interface for creating Guile procedures has a very handy +;;; "optional argument" feature. This module attempts to provide +;;; similar functionality for procedures defined in Scheme with +;;; a convenient and attractive syntax. +;;; +;;; exported macros are: +;;; let-optional +;;; let-optional* +;;; let-keywords +;;; let-keywords* +;;; lambda* +;;; define* +;;; define*-public +;;; defmacro* +;;; defmacro*-public +;;; +;;; +;;; Summary of the lambda* extended parameter list syntax (brackets +;;; are used to indicate grouping only): +;;; +;;; ext-param-list ::= [identifier]* [#:optional [ext-var-decl]+]? +;;; [#:key [ext-var-decl]+ [#:allow-other-keys]?]? +;;; [[#:rest identifier]|[. identifier]]? +;;; +;;; ext-var-decl ::= identifier | ( identifier expression ) +;;; +;;; The characters `*', `+' and `?' are not to be taken literally; they +;;; mean respectively, zero or more occurences, one or more occurences, +;;; and one or zero occurences. +;;; + +;;; Code: + +(define-module (ice-9 optargs) + #:use-module (system base pmatch) + #:re-export (lambda* define*) + #:export (let-optional + let-optional* + let-keywords + let-keywords* + define*-public + defmacro* + defmacro*-public)) + +;; let-optional rest-arg (binding ...) . body +;; let-optional* rest-arg (binding ...) . body +;; macros used to bind optional arguments +;; +;; These two macros give you an optional argument interface that is +;; very "Schemey" and introduces no fancy syntax. They are compatible +;; with the scsh macros of the same name, but are slightly +;; extended. Each of binding may be of one of the forms or +;; ( ). rest-arg should be the rest-argument of +;; the procedures these are used from. The items in rest-arg are +;; sequentially bound to the variable namess are given. When rest-arg +;; runs out, the remaining vars are bound either to the default values +;; or to `#f' if no default value was specified. rest-arg remains +;; bound to whatever may have been left of rest-arg. +;; + +(define (vars&inits bindings) + (let lp ((bindings bindings) (vars '()) (inits '())) + (syntax-case bindings () + (() + (values (reverse vars) (reverse inits))) + (((v init) . rest) (identifier? #'v) + (lp #'rest (cons #'v vars) (cons #'init inits))) + ((v . rest) (identifier? #'v) + (lp #'rest (cons #'v vars) (cons #'#f inits)))))) + +(define-syntax let-optional + (lambda (x) + (syntax-case x () + ((_ rest-arg (binding ...) b0 b1 ...) (identifier? #'rest-arg) + (call-with-values (lambda () (vars&inits #'(binding ...))) + (lambda (vars inits) + (with-syntax ((n (length vars)) + (n+1 (1+ (length vars))) + (vars (append vars (list #'rest-arg))) + ((t ...) (generate-temporaries vars)) + ((i ...) inits)) + #'(let ((t (lambda vars i)) + ...) + (apply (lambda vars b0 b1 ...) + (or (parse-lambda-case '(0 n n n+1 #f '()) + (list t ...) + rest-arg) + (error "sth" rest-arg))))))))))) + +(define-syntax let-optional* + (lambda (x) + (syntax-case x () + ((_ rest-arg (binding ...) b0 b1 ...) (identifier? #'rest-arg) + (call-with-values (lambda () (vars&inits #'(binding ...))) + (lambda (vars inits) + (with-syntax ((n (length vars)) + (n+1 (1+ (length vars))) + (vars (append vars (list #'rest-arg))) + ((i ...) inits)) + #'(apply (lambda vars b0 b1 ...) + (or (parse-lambda-case '(0 n n n+1 #f '()) + (list (lambda vars i) ...) + rest-arg) + (error "sth" rest-arg)))))))))) + + +;; let-keywords rest-arg allow-other-keys? (binding ...) . body +;; let-keywords* rest-arg allow-other-keys? (binding ...) . body +;; macros used to bind keyword arguments +;; +;; These macros pick out keyword arguments from rest-arg, but do not +;; modify it. This is consistent at least with Common Lisp, which +;; duplicates keyword args in the rest arg. More explanation of what +;; keyword arguments in a lambda list look like can be found below in +;; the documentation for lambda*. Bindings can have the same form as +;; for let-optional. If allow-other-keys? is false, an error will be +;; thrown if anything that looks like a keyword argument but does not +;; match a known keyword parameter will result in an error. +;; + + +(define-syntax let-keywords + (lambda (x) + (syntax-case x () + ((_ rest-arg aok (binding ...) b0 b1 ...) (identifier? #'rest-arg) + (call-with-values (lambda () (vars&inits #'(binding ...))) + (lambda (vars inits) + (with-syntax ((n (length vars)) + (vars vars) + (ivars (generate-temporaries vars)) + ((kw ...) (map symbol->keyword + (map syntax->datum vars))) + ((idx ...) (iota (length vars))) + ((t ...) (generate-temporaries vars)) + ((i ...) inits)) + #'(let ((t (lambda ivars i)) + ...) + (apply (lambda vars b0 b1 ...) + (or (parse-lambda-case '(0 0 #f n aok ((kw . idx) ...)) + (list t ...) + rest-arg) + (error "sth" rest-arg)))))))) + ((_ rest-arg aok (binding ...) b0 b1 ...) + #'(let ((r rest-arg)) + (let-keywords r aok (binding ...) b0 b1 ...)))))) + +(define-syntax let-keywords* + (lambda (x) + (syntax-case x () + ((_ rest-arg aok (binding ...) b0 b1 ...) (identifier? #'rest-arg) + (call-with-values (lambda () (vars&inits #'(binding ...))) + (lambda (vars inits) + (with-syntax ((n (length vars)) + (vars vars) + ((kw ...) (map symbol->keyword + (map syntax->datum vars))) + ((idx ...) (iota (length vars))) + ((i ...) inits)) + #'(apply (lambda vars b0 b1 ...) + (or (parse-lambda-case '(0 0 #f n aok ((kw . idx) ...)) + (list (lambda vars i) ...) + rest-arg) + (error "sth" rest-arg))))))) + ((_ rest-arg aok (binding ...) b0 b1 ...) + #'(let ((r rest-arg)) + (let-keywords* r aok (binding ...) b0 b1 ...)))))) + +;; lambda* args . body +;; lambda extended for optional and keyword arguments +;; +;; lambda* creates a procedure that takes optional arguments. These +;; are specified by putting them inside brackets at the end of the +;; paramater list, but before any dotted rest argument. For example, +;; (lambda* (a b #:optional c d . e) '()) +;; creates a procedure with fixed arguments a and b, optional arguments c +;; and d, and rest argument e. If the optional arguments are omitted +;; in a call, the variables for them are bound to `#f'. +;; +;; lambda* can also take keyword arguments. For example, a procedure +;; defined like this: +;; (lambda* (#:key xyzzy larch) '()) +;; can be called with any of the argument lists (#:xyzzy 11) +;; (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments +;; are given as keywords are bound to values. +;; +;; Optional and keyword arguments can also be given default values +;; which they take on when they are not present in a call, by giving a +;; two-item list in place of an optional argument, for example in: +;; (lambda* (foo #:optional (bar 42) #:key (baz 73)) (list foo bar baz)) +;; foo is a fixed argument, bar is an optional argument with default +;; value 42, and baz is a keyword argument with default value 73. +;; Default value expressions are not evaluated unless they are needed +;; and until the procedure is called. +;; +;; lambda* now supports two more special parameter list keywords. +;; +;; lambda*-defined procedures now throw an error by default if a +;; keyword other than one of those specified is found in the actual +;; passed arguments. However, specifying #:allow-other-keys +;; immediately after the keyword argument declarations restores the +;; previous behavior of ignoring unknown keywords. lambda* also now +;; guarantees that if the same keyword is passed more than once, the +;; last one passed is the one that takes effect. For example, +;; ((lambda* (#:key (heads 0) (tails 0)) (display (list heads tails))) +;; #:heads 37 #:tails 42 #:heads 99) +;; would result in (99 47) being displayed. +;; +;; #:rest is also now provided as a synonym for the dotted syntax rest +;; argument. The argument lists (a . b) and (a #:rest b) are equivalent in +;; all respects to lambda*. This is provided for more similarity to DSSSL, +;; MIT-Scheme and Kawa among others, as well as for refugees from other +;; Lisp dialects. + + +;; define* args . body +;; define*-public args . body +;; define and define-public extended for optional and keyword arguments +;; +;; define* and define*-public support optional arguments with +;; a similar syntax to lambda*. Some examples: +;; (define* (x y #:optional a (z 3) #:key w . u) (display (list y z u))) +;; defines a procedure x with a fixed argument y, an optional agument +;; a, another optional argument z with default value 3, a keyword argument w, +;; and a rest argument u. +;; +;; Of course, define*[-public] also supports #:rest and #:allow-other-keys +;; in the same way as lambda*. + +(define-syntax define*-public + (lambda (x) + (syntax-case x () + ((_ (id . args) b0 b1 ...) + #'(define-public id (lambda* args b0 b1 ...))) + ((_ id val) (identifier? #'id) + #'(define-public id val))))) + + +;; defmacro* name args . body +;; defmacro*-public args . body +;; defmacro and defmacro-public extended for optional and keyword arguments +;; +;; These are just like defmacro and defmacro-public except that they +;; take lambda*-style extended paramter lists, where #:optional, +;; #:key, #:allow-other-keys and #:rest are allowed with the usual +;; semantics. Here is an example of a macro with an optional argument: +;; (defmacro* transmogrify (a #:optional b) + +(define-syntax defmacro* + (lambda (x) + (syntax-case x () + ((_ id args doc b0 b1 ...) (string? (syntax->datum #'doc)) + #'(define-macro id doc (lambda* args b0 b1 ...))) + ((_ id args b0 b1 ...) + #'(define-macro id #f (lambda* args b0 b1 ...)))))) +(define-syntax-rule (defmacro*-public id args b0 b1 ...) + (begin + (defmacro* id args b0 b1 ...) + (export-syntax id))) + +;;; Support for optional & keyword args with the interpreter. +(define *uninitialized* (list 'uninitialized)) +(define (parse-lambda-case spec inits args) + (pmatch spec + ((,nreq ,nopt ,rest-idx ,nargs ,allow-other-keys? ,kw-indices) + (define (req args prev tail n) + (cond + ((zero? n) + (if prev (set-cdr! prev '())) + (let ((slots-tail (make-list (- nargs nreq) *uninitialized*))) + (opt (if prev (append! args slots-tail) slots-tail) + slots-tail tail nopt inits))) + ((null? tail) + #f) ;; fail + (else + (req args tail (cdr tail) (1- n))))) + (define (opt slots slots-tail args-tail n inits) + (cond + ((zero? n) + (rest-or-key slots slots-tail args-tail inits rest-idx)) + ((null? args-tail) + (set-car! slots-tail (apply (car inits) slots)) + (opt slots (cdr slots-tail) '() (1- n) (cdr inits))) + (else + (set-car! slots-tail (car args-tail)) + (opt slots (cdr slots-tail) (cdr args-tail) (1- n) (cdr inits))))) + (define (rest-or-key slots slots-tail args-tail inits rest-idx) + (cond + (rest-idx + ;; it has to be this way, vars are allocated in this order + (set-car! slots-tail args-tail) + (if (pair? kw-indices) + (permissive-keys slots (cdr slots-tail) args-tail inits) + (rest-or-key slots (cdr slots-tail) '() inits #f))) + ((pair? kw-indices) + ;; fail early here, because once we're in keyword land we throw + ;; errors instead of failing + (and (or (null? args-tail) rest-idx (keyword? (car args-tail))) + (key slots slots-tail args-tail inits))) + ((pair? args-tail) + #f) ;; fail + (else + slots))) + (define (permissive-keys slots slots-tail args-tail inits) + (cond + ((null? args-tail) + (if (null? inits) + slots + (begin + (if (eq? (car slots-tail) *uninitialized*) + (set-car! slots-tail (apply (car inits) slots))) + (permissive-keys slots (cdr slots-tail) '() (cdr inits))))) + ((not (keyword? (car args-tail))) + (permissive-keys slots slots-tail (cdr args-tail) inits)) + ((and (keyword? (car args-tail)) + (pair? (cdr args-tail)) + (assq-ref kw-indices (car args-tail))) + => (lambda (i) + (list-set! slots i (cadr args-tail)) + (permissive-keys slots slots-tail (cddr args-tail) inits))) + ((and (keyword? (car args-tail)) + (pair? (cdr args-tail)) + allow-other-keys?) + (permissive-keys slots slots-tail (cddr args-tail) inits)) + (else (scm-error 'keyword-argument-error #f "Unrecognized keyword" + '() args-tail)))) + (define (key slots slots-tail args-tail inits) + (cond + ((null? args-tail) + (if (null? inits) + slots + (begin + (if (eq? (car slots-tail) *uninitialized*) + (set-car! slots-tail (apply (car inits) slots))) + (key slots (cdr slots-tail) '() (cdr inits))))) + ((not (keyword? (car args-tail))) + (if rest-idx + ;; no error checking, everything goes to the rest.. + (key slots slots-tail '() inits) + (scm-error 'keyword-argument-error #f "Invalid keyword" + '() args-tail))) + ((and (keyword? (car args-tail)) + (pair? (cdr args-tail)) + (assq-ref kw-indices (car args-tail))) + => (lambda (i) + (list-set! slots i (cadr args-tail)) + (key slots slots-tail (cddr args-tail) inits))) + ((and (keyword? (car args-tail)) + (pair? (cdr args-tail)) + allow-other-keys?) + (key slots slots-tail (cddr args-tail) inits)) + (else (scm-error 'keyword-argument-error #f "Unrecognized keyword" + '() args-tail)))) + (let ((args (list-copy args))) + (req args #f args nreq))) + (else (error "unexpected spec" spec)))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/peg.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/peg.scm new file mode 100644 index 0000000000000000000000000000000000000000..4e03131cd265bc57adb9ad58c28d00e6d6a683a8 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/peg.scm @@ -0,0 +1,42 @@ +;;;; peg.scm --- Parsing Expression Grammar (PEG) parser generator +;;;; +;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 peg) + #:use-module (ice-9 peg codegen) + #:use-module (ice-9 peg string-peg) + ;; Note: the most important effect of using string-peg is not whatever + ;; functions it exports, but the fact that it adds a new handler to + ;; peg-sexp-compile. + #:use-module (ice-9 peg simplify-tree) + #:use-module (ice-9 peg using-parsers) + #:use-module (ice-9 peg cache) + #:re-export (define-peg-pattern + define-peg-string-patterns + match-pattern + search-for-pattern + compile-peg-pattern + keyword-flatten + context-flatten + peg:start + peg:end + peg:string + peg:tree + peg:substring + peg-record?)) + diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/peg/cache.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/cache.scm new file mode 100644 index 0000000000000000000000000000000000000000..f45432b35eb140dfcb6a30d03b6f2b3980bcee43 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/cache.scm @@ -0,0 +1,45 @@ +;;;; cache.scm --- cache the results of parsing +;;;; +;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 peg cache) + #:export (cg-cached-parser)) + +;; The results of parsing using a nonterminal are cached. Think of it like a +;; hash with no conflict resolution. Process for deciding on the cache size +;; wasn't very scientific; just ran the benchmarks and stopped a little after +;; the point of diminishing returns on my box. +(define *cache-size* 512) + +(define (make-cache) + (make-vector *cache-size* #f)) + +;; given a syntax object which is a parser function, returns syntax +;; which, if evaluated, will become a parser function that uses a cache. +(define (cg-cached-parser parser) + #`(let ((cache (make-cache))) + (lambda (str strlen at) + (let* ((vref (vector-ref cache (modulo at *cache-size*)))) + ;; Check to see whether the value is cached. + (if (and vref (eq? (car vref) str) (= (cadr vref) at)) + (caddr vref);; If it is return it. + (let ((fres ;; Else calculate it and cache it. + (#,parser str strlen at))) + (vector-set! cache (modulo at *cache-size*) + (list str at fres)) + fres)))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/peg/codegen.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/codegen.scm new file mode 100644 index 0000000000000000000000000000000000000000..d80c3e849976acd05e1cc7a79dc8ce4de9b1e740 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/codegen.scm @@ -0,0 +1,359 @@ +;;;; codegen.scm --- code generation for composable parsers +;;;; +;;;; Copyright (C) 2011 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 peg codegen) + #:export (compile-peg-pattern wrap-parser-for-users add-peg-compiler!) + #:use-module (ice-9 pretty-print) + #:use-module (system base pmatch)) + +(define-syntax single? + (syntax-rules () + "Return #t if X is a list of one element." + ((_ x) + (pmatch x + ((_) #t) + (else #f))))) + +(define-syntax single-filter + (syntax-rules () + "If EXP is a list of one element, return the element. Otherwise +return EXP." + ((_ exp) + (pmatch exp + ((,elt) elt) + (,elts elts))))) + +(define-syntax push-not-null! + (syntax-rules () + "If OBJ is non-null, push it onto LST, otherwise do nothing." + ((_ lst obj) + (if (not (null? obj)) + (push! lst obj))))) + +(define-syntax push! + (syntax-rules () + "Push an object onto a list." + ((_ lst obj) + (set! lst (cons obj lst))))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; CODE GENERATORS +;; These functions generate scheme code for parsing PEGs. +;; Conventions: +;; accum: (all name body none) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Code we generate will have a certain return structure depending on how we're +;; accumulating (the ACCUM variable). +(define (cg-generic-ret accum name body-uneval at) + ;; name, body-uneval and at are syntax + #`(let ((body #,body-uneval)) + #,(cond + ((and (eq? accum 'all) name) + #`(list #,at + (cond + ((not (list? body)) (list '#,name body)) + ((null? body) '#,name) + ((symbol? (car body)) (list '#,name body)) + (else (cons '#,name body))))) + ((eq? accum 'name) + #`(list #,at '#,name)) + ((eq? accum 'body) + #`(list #,at + (cond + ((single? body) (car body)) + (else body)))) + ((eq? accum 'none) + #`(list #,at '())) + (else + (begin + (pretty-print `(cg-generic-ret-error ,accum ,name ,body-uneval ,at)) + (pretty-print "Defaulting to accum of none.\n") + #`(list #,at '())))))) + +;; The short name makes the formatting below much easier to read. +(define cggr cg-generic-ret) + +;; Generates code that matches a particular string. +;; E.g.: (cg-string syntax "abc" 'body) +(define (cg-string pat accum) + (let ((plen (string-length pat))) + #`(lambda (str len pos) + (let ((end (+ pos #,plen))) + (and (<= end len) + (string= str #,pat pos end) + #,(case accum + ((all) #`(list end (list 'cg-string #,pat))) + ((name) #`(list end 'cg-string)) + ((body) #`(list end #,pat)) + ((none) #`(list end '())) + (else (error "bad accum" accum)))))))) + +;; Generates code for matching any character. +;; E.g.: (cg-peg-any syntax 'body) +(define (cg-peg-any accum) + #`(lambda (str len pos) + (and (< pos len) + #,(case accum + ((all) #`(list (1+ pos) + (list 'cg-peg-any (substring str pos (1+ pos))))) + ((name) #`(list (1+ pos) 'cg-peg-any)) + ((body) #`(list (1+ pos) (substring str pos (1+ pos)))) + ((none) #`(list (1+ pos) '())) + (else (error "bad accum" accum)))))) + +;; Generates code for matching a range of characters between start and end. +;; E.g.: (cg-range syntax #\a #\z 'body) +(define (cg-range pat accum) + (syntax-case pat () + ((start end) + (if (not (and (char? (syntax->datum #'start)) + (char? (syntax->datum #'end)))) + (error "range PEG should have characters after it; instead got" + #'start #'end)) + #`(lambda (str len pos) + (and (< pos len) + (let ((c (string-ref str pos))) + (and (char>=? c start) + (char<=? c end) + #,(case accum + ((all) #`(list (1+ pos) (list 'cg-range (string c)))) + ((name) #`(list (1+ pos) 'cg-range)) + ((body) #`(list (1+ pos) (string c))) + ((none) #`(list (1+ pos) '())) + (else (error "bad accum" accum)))))))))) + +;; Generate code to match a pattern and do nothing with the result +(define (cg-ignore pat accum) + (syntax-case pat () + ((inner) + (compile-peg-pattern #'inner 'none)))) + +(define (cg-capture pat accum) + (syntax-case pat () + ((inner) + (compile-peg-pattern #'inner 'body)))) + +;; Filters the accum argument to compile-peg-pattern for buildings like string +;; literals (since we don't want to tag them with their name if we're doing an +;; "all" accum). +(define (builtin-accum-filter accum) + (cond + ((eq? accum 'all) 'body) + ((eq? accum 'name) 'name) + ((eq? accum 'body) 'body) + ((eq? accum 'none) 'none))) +(define baf builtin-accum-filter) + +;; Top-level function builder for AND. Reduces to a call to CG-AND-INT. +(define (cg-and clauses accum) + #`(lambda (str len pos) + (let ((body '())) + #,(cg-and-int clauses (baf accum) #'str #'len #'pos #'body)))) + +;; Internal function builder for AND (calls itself). +(define (cg-and-int clauses accum str strlen at body) + (syntax-case clauses () + (() + (cggr accum 'cg-and #`(reverse #,body) at)) + ((first rest ...) + #`(let ((res (#,(compile-peg-pattern #'first accum) #,str #,strlen #,at))) + (and res + ;; update AT and BODY then recurse + (let ((newat (car res)) + (newbody (cadr res))) + (set! #,at newat) + (push-not-null! #,body (single-filter newbody)) + #,(cg-and-int #'(rest ...) accum str strlen at body))))))) + +;; Top-level function builder for OR. Reduces to a call to CG-OR-INT. +(define (cg-or clauses accum) + #`(lambda (str len pos) + #,(cg-or-int clauses (baf accum) #'str #'len #'pos))) + +;; Internal function builder for OR (calls itself). +(define (cg-or-int clauses accum str strlen at) + (syntax-case clauses () + (() + #f) + ((first rest ...) + #`(or (#,(compile-peg-pattern #'first accum) #,str #,strlen #,at) + #,(cg-or-int #'(rest ...) accum str strlen at))))) + +(define (cg-* args accum) + (syntax-case args () + ((pat) + #`(lambda (str strlen at) + (let ((body '())) + (let lp ((end at) (count 0)) + (let* ((match (#,(compile-peg-pattern #'pat (baf accum)) + str strlen end)) + (new-end (if match (car match) end)) + (count (if (> new-end end) (1+ count) count))) + (if (> new-end end) + (push-not-null! body (single-filter (cadr match)))) + (if (and (> new-end end) + #,#t) + (lp new-end count) + (let ((success #,#t)) + #,#`(and success + #,(cggr (baf accum) 'cg-body + #'(reverse body) #'new-end))))))))))) + +(define (cg-+ args accum) + (syntax-case args () + ((pat) + #`(lambda (str strlen at) + (let ((body '())) + (let lp ((end at) (count 0)) + (let* ((match (#,(compile-peg-pattern #'pat (baf accum)) + str strlen end)) + (new-end (if match (car match) end)) + (count (if (> new-end end) (1+ count) count))) + (if (> new-end end) + (push-not-null! body (single-filter (cadr match)))) + (if (and (> new-end end) + #,#t) + (lp new-end count) + (let ((success #,#'(>= count 1))) + #,#`(and success + #,(cggr (baf accum) 'cg-body + #'(reverse body) #'new-end))))))))))) + +(define (cg-? args accum) + (syntax-case args () + ((pat) + #`(lambda (str strlen at) + (let ((body '())) + (let lp ((end at) (count 0)) + (let* ((match (#,(compile-peg-pattern #'pat (baf accum)) + str strlen end)) + (new-end (if match (car match) end)) + (count (if (> new-end end) (1+ count) count))) + (if (> new-end end) + (push-not-null! body (single-filter (cadr match)))) + (if (and (> new-end end) + #,#'(< count 1)) + (lp new-end count) + (let ((success #,#t)) + #,#`(and success + #,(cggr (baf accum) 'cg-body + #'(reverse body) #'new-end))))))))))) + +(define (cg-followed-by args accum) + (syntax-case args () + ((pat) + #`(lambda (str strlen at) + (let ((body '())) + (let lp ((end at) (count 0)) + (let* ((match (#,(compile-peg-pattern #'pat (baf accum)) + str strlen end)) + (new-end (if match (car match) end)) + (count (if (> new-end end) (1+ count) count))) + (if (> new-end end) + (push-not-null! body (single-filter (cadr match)))) + (if (and (> new-end end) + #,#'(< count 1)) + (lp new-end count) + (let ((success #,#'(= count 1))) + #,#`(and success + #,(cggr (baf accum) 'cg-body #''() #'at))))))))))) + +(define (cg-not-followed-by args accum) + (syntax-case args () + ((pat) + #`(lambda (str strlen at) + (let ((body '())) + (let lp ((end at) (count 0)) + (let* ((match (#,(compile-peg-pattern #'pat (baf accum)) + str strlen end)) + (new-end (if match (car match) end)) + (count (if (> new-end end) (1+ count) count))) + (if (> new-end end) + (push-not-null! body (single-filter (cadr match)))) + (if (and (> new-end end) + #,#'(< count 1)) + (lp new-end count) + (let ((success #,#'(= count 1))) + #,#`(if success + #f + #,(cggr (baf accum) 'cg-body #''() #'at))))))))))) + +;; Association list of functions to handle different expressions as PEGs +(define peg-compiler-alist '()) + +(define (add-peg-compiler! symbol function) + (set! peg-compiler-alist + (assq-set! peg-compiler-alist symbol function))) + +(add-peg-compiler! 'range cg-range) +(add-peg-compiler! 'ignore cg-ignore) +(add-peg-compiler! 'capture cg-capture) +(add-peg-compiler! 'and cg-and) +(add-peg-compiler! 'or cg-or) +(add-peg-compiler! '* cg-*) +(add-peg-compiler! '+ cg-+) +(add-peg-compiler! '? cg-?) +(add-peg-compiler! 'followed-by cg-followed-by) +(add-peg-compiler! 'not-followed-by cg-not-followed-by) + +;; Takes an arbitrary expressions and accumulation variable, then parses it. +;; E.g.: (compile-peg-pattern syntax '(and "abc" (or "-" (range #\a #\z))) 'all) +(define (compile-peg-pattern pat accum) + (syntax-case pat (peg-any) + (peg-any + (cg-peg-any (baf accum))) + (sym (identifier? #'sym) ;; nonterminal + #'sym) + (str (string? (syntax->datum #'str)) ;; literal string + (cg-string (syntax->datum #'str) (baf accum))) + ((name . args) (let* ((nm (syntax->datum #'name)) + (entry (assq-ref peg-compiler-alist nm))) + (if entry + (entry #'args accum) + (error "Bad peg form" nm #'args + "Not one of" (map car peg-compiler-alist))))))) + +;; Packages the results of a parser +(define (wrap-parser-for-users for-syntax parser accumsym s-syn) + #`(lambda (str strlen at) + (let ((res (#,parser str strlen at))) + ;; Try to match the nonterminal. + (if res + ;; If we matched, do some post-processing to figure out + ;; what data to propagate upward. + (let ((at (car res)) + (body (cadr res))) + #,(cond + ((eq? accumsym 'name) + #`(list at '#,s-syn)) + ((eq? accumsym 'all) + #`(list (car res) + (cond + ((not (list? body)) + (list '#,s-syn body)) + ((null? body) '#,s-syn) + ((symbol? (car body)) + (list '#,s-syn body)) + (else (cons '#,s-syn body))))) + ((eq? accumsym 'none) #`(list (car res) '())) + (else #`(begin res)))) + ;; If we didn't match, just return false. + #f)))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/peg/simplify-tree.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/simplify-tree.scm new file mode 100644 index 0000000000000000000000000000000000000000..4c781a191f3fa3440c3269946e9f68f6e7ad46ff --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/simplify-tree.scm @@ -0,0 +1,97 @@ +;;;; simplify-tree.scm --- utility functions for the PEG parser +;;;; +;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 peg simplify-tree) + #:export (keyword-flatten context-flatten string-collapse) + #:use-module (system base pmatch)) + +(define-syntax single? + (syntax-rules () + "Return #t if X is a list of one element." + ((_ x) + (pmatch x + ((_) #t) + (else #f))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; POST-PROCESSING FUNCTIONS (TO CANONICALIZE MATCH TREES) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Is everything in LST true? +(define (andlst lst) + (or (null? lst) + (and (car lst) (andlst (cdr lst))))) + +;; Is LST a list of strings? +(define (string-list? lst) + (and (list? lst) (not (null? lst)) + (andlst (map string? lst)))) + +;; Groups all strings that are next to each other in LST. Used in +;; STRING-COLLAPSE. +(define (string-group lst) + (if (not (list? lst)) + lst + (if (null? lst) + '() + (let ((next (string-group (cdr lst)))) + (if (not (string? (car lst))) + (cons (car lst) next) + (if (and (not (null? next)) + (list? (car next)) + (string? (caar next))) + (cons (cons (car lst) (car next)) (cdr next)) + (cons (list (car lst)) next))))))) + + +;; Collapses all the string in LST. +;; ("a" "b" (c d) "e" "f") -> ("ab" (c d) "ef") +(define (string-collapse lst) + (if (list? lst) + (let ((res (map (lambda (x) (if (string-list? x) + (apply string-append x) + x)) + (string-group (map string-collapse lst))))) + (if (single? res) (car res) res)) + lst)) + +;; If LST is an atom, return (list LST), else return LST. +(define (mklst lst) + (if (not (list? lst)) (list lst) lst)) + +;; Takes a list and "flattens" it, using the predicate TST to know when to stop +;; instead of terminating on atoms (see tutorial). +(define (context-flatten tst lst) + (if (or (not (list? lst)) (null? lst)) + lst + (if (tst lst) + (list lst) + (apply append + (map (lambda (x) (mklst (context-flatten tst x))) + lst))))) + +;; Takes a list and "flattens" it, using the list of keywords KEYWORD-LST to +;; know when to stop at (see tutorial). +(define (keyword-flatten keyword-lst lst) + (context-flatten + (lambda (x) + (if (or (not (list? x)) (null? x)) + #t + (member (car x) keyword-lst))) + lst)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/peg/string-peg.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/string-peg.scm new file mode 100644 index 0000000000000000000000000000000000000000..45ed14bb12cb0ffeeb608c33f2316f615f348186 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/string-peg.scm @@ -0,0 +1,273 @@ +;;;; string-peg.scm --- representing PEG grammars as strings +;;;; +;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 peg string-peg) + #:export (peg-as-peg + define-peg-string-patterns + peg-grammar) + #:use-module (ice-9 peg using-parsers) + #:use-module (ice-9 peg codegen) + #:use-module (ice-9 peg simplify-tree)) + +;; Gets the left-hand depth of a list. +(define (depth lst) + (if (or (not (list? lst)) (null? lst)) + 0 + (+ 1 (depth (car lst))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; Parse string PEGs using sexp PEGs. +;; See the variable PEG-AS-PEG for an easier-to-read syntax. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Grammar for PEGs in PEG grammar. +(define peg-as-peg +"grammar <-- (nonterminal ('<--' / '<-' / '<') sp pattern)+ +pattern <-- alternative (SLASH sp alternative)* +alternative <-- ([!&]? sp suffix)+ +suffix <-- primary ([*+?] sp)* +primary <-- '(' sp pattern ')' sp / '.' sp / literal / charclass / nonterminal !'<' +literal <-- ['] (!['] .)* ['] sp +charclass <-- LB (!']' (CCrange / CCsingle))* RB sp +CCrange <-- . '-' . +CCsingle <-- . +nonterminal <-- [a-zA-Z0-9-]+ sp +sp < [ \t\n]* +SLASH < '/' +LB < '[' +RB < ']' +") + +(define-syntax define-sexp-parser + (lambda (x) + (syntax-case x () + ((_ sym accum pat) + (let* ((matchf (compile-peg-pattern #'pat (syntax->datum #'accum))) + (accumsym (syntax->datum #'accum)) + (syn (wrap-parser-for-users x matchf accumsym #'sym))) + #`(define sym #,syn)))))) + +(define-sexp-parser peg-grammar all + (+ (and peg-nonterminal (or "<--" "<-" "<") peg-sp peg-pattern))) +(define-sexp-parser peg-pattern all + (and peg-alternative + (* (and (ignore "/") peg-sp peg-alternative)))) +(define-sexp-parser peg-alternative all + (+ (and (? (or "!" "&")) peg-sp peg-suffix))) +(define-sexp-parser peg-suffix all + (and peg-primary (* (and (or "*" "+" "?") peg-sp)))) +(define-sexp-parser peg-primary all + (or (and "(" peg-sp peg-pattern ")" peg-sp) + (and "." peg-sp) + peg-literal + peg-charclass + (and peg-nonterminal (not-followed-by "<")))) +(define-sexp-parser peg-literal all + (and "'" (* (and (not-followed-by "'") peg-any)) "'" peg-sp)) +(define-sexp-parser peg-charclass all + (and (ignore "[") + (* (and (not-followed-by "]") + (or charclass-range charclass-single))) + (ignore "]") + peg-sp)) +(define-sexp-parser charclass-range all (and peg-any "-" peg-any)) +(define-sexp-parser charclass-single all peg-any) +(define-sexp-parser peg-nonterminal all + (and (+ (or (range #\a #\z) (range #\A #\Z) (range #\0 #\9) "-")) peg-sp)) +(define-sexp-parser peg-sp none + (* (or " " "\t" "\n"))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; PARSE STRING PEGS +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Takes a string representing a PEG grammar and returns syntax that +;; will define all of the nonterminals in the grammar with equivalent +;; PEG s-expressions. +(define (peg-parser str for-syntax) + (let ((parsed (match-pattern peg-grammar str))) + (if (not parsed) + (begin + ;; (display "Invalid PEG grammar!\n") + #f) + (let ((lst (peg:tree parsed))) + (cond + ((or (not (list? lst)) (null? lst)) + lst) + ((eq? (car lst) 'peg-grammar) + #`(begin + #,@(map (lambda (x) (peg-nonterm->defn x for-syntax)) + (context-flatten (lambda (lst) (<= (depth lst) 2)) + (cdr lst)))))))))) + +;; Macro wrapper for PEG-PARSER. Parses PEG grammars expressed as strings and +;; defines all the appropriate nonterminals. +(define-syntax define-peg-string-patterns + (lambda (x) + (syntax-case x () + ((_ str) + (peg-parser (syntax->datum #'str) x))))) + +;; lst has format (nonterm grabber pattern), where +;; nonterm is a symbol (the name of the nonterminal), +;; grabber is a string (either "<", "<-" or "<--"), and +;; pattern is the parse of a PEG pattern expressed as as string. +(define (peg-nonterm->defn lst for-syntax) + (let* ((nonterm (car lst)) + (grabber (cadr lst)) + (pattern (caddr lst)) + (nonterm-name (datum->syntax for-syntax + (string->symbol (cadr nonterm))))) + #`(define-peg-pattern #,nonterm-name + #,(cond + ((string=? grabber "<--") (datum->syntax for-syntax 'all)) + ((string=? grabber "<-") (datum->syntax for-syntax 'body)) + (else (datum->syntax for-syntax 'none))) + #,(compressor (peg-pattern->defn pattern for-syntax) for-syntax)))) + +;; lst has format ('peg-pattern ...). +;; After the context-flatten, (cdr lst) has format +;; (('peg-alternative ...) ...), where the outer list is a collection +;; of elements from a '/' alternative. +(define (peg-pattern->defn lst for-syntax) + #`(or #,@(map (lambda (x) (peg-alternative->defn x for-syntax)) + (context-flatten (lambda (x) (eq? (car x) 'peg-alternative)) + (cdr lst))))) + +;; lst has format ('peg-alternative ...). +;; After the context-flatten, (cdr lst) has the format +;; (item ...), where each item has format either ("!" ...), ("&" ...), +;; or ('peg-suffix ...). +(define (peg-alternative->defn lst for-syntax) + #`(and #,@(map (lambda (x) (peg-body->defn x for-syntax)) + (context-flatten (lambda (x) (or (string? (car x)) + (eq? (car x) 'peg-suffix))) + (cdr lst))))) + +;; lst has the format either +;; ("!" ('peg-suffix ...)), ("&" ('peg-suffix ...)), or +;; ('peg-suffix ...). +(define (peg-body->defn lst for-syntax) + (cond + ((equal? (car lst) "&") + #`(followed-by #,(peg-suffix->defn (cadr lst) for-syntax))) + ((equal? (car lst) "!") + #`(not-followed-by #,(peg-suffix->defn (cadr lst) for-syntax))) + ((eq? (car lst) 'peg-suffix) + (peg-suffix->defn lst for-syntax)) + (else `(peg-parse-body-fail ,lst)))) + +;; lst has format ('peg-suffix (? (/ "*" "?" "+"))) +(define (peg-suffix->defn lst for-syntax) + (let ((inner-defn (peg-primary->defn (cadr lst) for-syntax))) + (cond + ((null? (cddr lst)) + inner-defn) + ((equal? (caddr lst) "*") + #`(* #,inner-defn)) + ((equal? (caddr lst) "?") + #`(? #,inner-defn)) + ((equal? (caddr lst) "+") + #`(+ #,inner-defn))))) + +;; Parse a primary. +(define (peg-primary->defn lst for-syntax) + (let ((el (cadr lst))) + (cond + ((list? el) + (cond + ((eq? (car el) 'peg-literal) + (peg-literal->defn el for-syntax)) + ((eq? (car el) 'peg-charclass) + (peg-charclass->defn el for-syntax)) + ((eq? (car el) 'peg-nonterminal) + (datum->syntax for-syntax (string->symbol (cadr el)))))) + ((string? el) + (cond + ((equal? el "(") + (peg-pattern->defn (caddr lst) for-syntax)) + ((equal? el ".") + (datum->syntax for-syntax 'peg-any)) + (else (datum->syntax for-syntax + `(peg-parse-any unknown-string ,lst))))) + (else (datum->syntax for-syntax + `(peg-parse-any unknown-el ,lst)))))) + +;; Trims characters off the front and end of STR. +;; (trim-1chars "'ab'") -> "ab" +(define (trim-1chars str) (substring str 1 (- (string-length str) 1))) + +;; Parses a literal. +(define (peg-literal->defn lst for-syntax) + (datum->syntax for-syntax (trim-1chars (cadr lst)))) + +;; Parses a charclass. +(define (peg-charclass->defn lst for-syntax) + #`(or + #,@(map + (lambda (cc) + (cond + ((eq? (car cc) 'charclass-range) + #`(range #,(datum->syntax + for-syntax + (string-ref (cadr cc) 0)) + #,(datum->syntax + for-syntax + (string-ref (cadr cc) 2)))) + ((eq? (car cc) 'charclass-single) + (datum->syntax for-syntax (cadr cc))))) + (context-flatten + (lambda (x) (or (eq? (car x) 'charclass-range) + (eq? (car x) 'charclass-single))) + (cdr lst))))) + +;; Compresses a list to save the optimizer work. +;; e.g. (or (and a)) -> a +(define (compressor-core lst) + (if (or (not (list? lst)) (null? lst)) + lst + (cond + ((and (or (eq? (car lst) 'or) (eq? (car lst) 'and)) + (null? (cddr lst))) + (compressor-core (cadr lst))) + ((and (eq? (car lst) 'body) + (eq? (cadr lst) 'lit) + (eq? (cadddr lst) 1)) + (compressor-core (caddr lst))) + (else (map compressor-core lst))))) + +(define (compressor syn for-syntax) + (datum->syntax for-syntax + (compressor-core (syntax->datum syn)))) + +;; Builds a lambda-expressions for the pattern STR using accum. +(define (peg-string-compile args accum) + (syntax-case args () + ((str-stx) (string? (syntax->datum #'str-stx)) + (let ((string (syntax->datum #'str-stx))) + (compile-peg-pattern + (compressor + (peg-pattern->defn + (peg:tree (match-pattern peg-pattern string)) #'str-stx) + #'str-stx) + (if (eq? accum 'all) 'body accum)))) + (else (error "Bad embedded PEG string" args)))) + +(add-peg-compiler! 'peg peg-string-compile) + diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/peg/using-parsers.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/using-parsers.scm new file mode 100644 index 0000000000000000000000000000000000000000..076de299926ec44ff1281a3a835d1d1780ad50d8 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/peg/using-parsers.scm @@ -0,0 +1,116 @@ +;;;; using-parsers.scm --- utilities to make using parsers easier +;;;; +;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 peg using-parsers) + #:use-module (ice-9 peg simplify-tree) + #:use-module (ice-9 peg codegen) + #:use-module (ice-9 peg cache) + #:export (match-pattern define-peg-pattern search-for-pattern + prec make-prec peg:start peg:end peg:string + peg:tree peg:substring peg-record?)) + +;;; +;;; Helper Macros +;;; + +(define-syntax until + (syntax-rules () + "Evaluate TEST. If it is true, return its value. Otherwise, +execute the STMTs and try again." + ((_ test stmt stmt* ...) + (let lp () + (or test + (begin stmt stmt* ... (lp))))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; FOR DEFINING AND USING NONTERMINALS +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Parses STRING using NONTERM +(define (match-pattern nonterm string) + ;; We copy the string before using it because it might have been modified + ;; in-place since the last time it was parsed, which would invalidate the + ;; cache. Guile uses copy-on-write for strings, so this is fast. + (let ((res (nonterm (string-copy string) (string-length string) 0))) + (if (not res) + #f + (make-prec 0 (car res) string (string-collapse (cadr res)))))) + +;; Defines a new nonterminal symbol accumulating with ACCUM. +(define-syntax define-peg-pattern + (lambda (x) + (syntax-case x () + ((_ sym accum pat) + (let ((matchf (compile-peg-pattern #'pat (syntax->datum #'accum))) + (accumsym (syntax->datum #'accum))) + ;; CODE is the code to parse the string if the result isn't cached. + (let ((syn (wrap-parser-for-users x matchf accumsym #'sym))) + #`(define sym #,(cg-cached-parser syn)))))))) + +(define (peg-like->peg pat) + (syntax-case pat () + (str (string? (syntax->datum #'str)) #'(peg str)) + (else pat))) + +;; Searches through STRING for something that parses to PEG-MATCHER. Think +;; regexp search. +(define-syntax search-for-pattern + (lambda (x) + (syntax-case x () + ((_ pattern string-uncopied) + (let ((pmsym (syntax->datum #'pattern))) + (let ((matcher (compile-peg-pattern (peg-like->peg #'pattern) 'body))) + ;; We copy the string before using it because it might have been + ;; modified in-place since the last time it was parsed, which would + ;; invalidate the cache. Guile uses copy-on-write for strings, so + ;; this is fast. + #`(let ((string (string-copy string-uncopied)) + (strlen (string-length string-uncopied)) + (at 0)) + (let ((ret (until (or (>= at strlen) + (#,matcher string strlen at)) + (set! at (+ at 1))))) + (if (eq? ret #t) ;; (>= at strlen) succeeded + #f + (let ((end (car ret)) + (match (cadr ret))) + (make-prec + at end string + (string-collapse match)))))))))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; PMATCH STRUCTURE MUNGING +;; Pretty self-explanatory. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define prec + (make-record-type "peg" '(start end string tree))) +(define make-prec + (record-constructor prec '(start end string tree))) +(define (peg:start pm) + (if pm ((record-accessor prec 'start) pm) #f)) +(define (peg:end pm) + (if pm ((record-accessor prec 'end) pm) #f)) +(define (peg:string pm) + (if pm ((record-accessor prec 'string) pm) #f)) +(define (peg:tree pm) + (if pm ((record-accessor prec 'tree) pm) #f)) +(define (peg:substring pm) + (if pm (substring (peg:string pm) (peg:start pm) (peg:end pm)) #f)) +(define peg-record? (record-predicate prec)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/poe.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/poe.scm new file mode 100644 index 0000000000000000000000000000000000000000..c19a760b24a5f5316dfca4bd24e38d6e6ad2a048 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/poe.scm @@ -0,0 +1,116 @@ +;;; installed-scm-file + +;;;; Copyright (C) 1996, 2001, 2006, 2011 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + + +(define-module (ice-9 poe) + :use-module (ice-9 hcons) + :export (pure-funcq perfect-funcq)) + + + + +;;; {Pure Functions} +;;; +;;; A pure function (of some sort) is characterized by two equality +;;; relations: one on argument lists and one on return values. +;;; A pure function is one that when applied to equal arguments lists +;;; yields equal results. +;;; +;;; If the equality relationship on return values can be eq?, it may make +;;; sense to cache values returned by the function. Choosing the right +;;; equality relation on arguments is tricky. +;;; + + +;;; {pure-funcq} +;;; +;;; The simplest case of pure functions are those in which results +;;; are only certainly eq? if all of the arguments are. These functions +;;; are called "pure-funcq", for obvious reasons. +;;; + + +(define funcq-memo (make-weak-key-hash-table 523)) ; !!! randomly selected values +(define funcq-buffer (make-gc-buffer 256)) + +(define (funcq-hash arg-list n) + (let ((it (let loop ((x 0) + (arg-list arg-list)) + (if (null? arg-list) + (modulo x n) + (loop (logior x (hashq (car arg-list) 4194303)) + (cdr arg-list)))))) + it)) + +;; return true if lists X and Y are the same length and each element is `eq?' +(define (eq?-list x y) + (if (null? x) + (null? y) + (and (not (null? y)) + (eq? (car x) (car y)) + (eq?-list (cdr x) (cdr y))))) + +(define (funcq-assoc arg-list alist) + (if (null? alist) + #f + (if (eq?-list arg-list (caar alist)) + (car alist) + (funcq-assoc arg-list (cdr alist))))) + + +(define not-found (list 'not-found)) + + +(define (pure-funcq base-func) + (lambda args + (let* ((key (cons base-func args)) + (cached (hashx-ref funcq-hash funcq-assoc funcq-memo key not-found))) + (if (not (eq? cached not-found)) + (begin + (funcq-buffer key) + cached) + + (let ((val (apply base-func args))) + (funcq-buffer key) + (hashx-set! funcq-hash funcq-assoc funcq-memo key val) + val))))) + + + +;;; {Perfect funq} +;;; +;;; A pure funq may sometimes forget its past but a perfect +;;; funcq never does. +;;; + +(define (perfect-funcq size base-func) + (define funcq-memo (make-hash-table size)) + + (lambda args + (let* ((key (cons base-func args)) + (cached (hashx-ref funcq-hash funcq-assoc funcq-memo key not-found))) + (if (not (eq? cached not-found)) + (begin + (funcq-buffer key) + cached) + + (let ((val (apply base-func args))) + (funcq-buffer key) + (hashx-set! funcq-hash funcq-assoc funcq-memo key val) + val))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/poll.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/poll.scm new file mode 100644 index 0000000000000000000000000000000000000000..57b5047abcdcb2bfb46417833c6c0772333f3f84 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/poll.scm @@ -0,0 +1,172 @@ +;; poll + +;;;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 poll) + #:use-module (srfi srfi-9) + #:use-module (srfi srfi-9 gnu) + #:use-module (rnrs bytevectors) + #:export (make-empty-poll-set + poll-set? + poll-set-nfds + poll-set-find-port + poll-set-port + poll-set-events + set-poll-set-events! + poll-set-revents + set-poll-set-revents! + poll-set-add! + poll-set-remove! + poll)) + +(eval-when (expand load eval) + (load-extension (string-append "libguile-" (effective-version)) + "scm_init_poll")) + +(if (not (= %sizeof-struct-pollfd 8)) + (error "Unexpected struct pollfd size" %sizeof-struct-pollfd)) + +(if (defined? 'POLLIN) + (export POLLIN)) + +(if (defined? 'POLLPRI) + (export POLLPRI)) + +(if (defined? 'POLLOUT) + (export POLLOUT)) + +(if (defined? 'POLLRDHUP) + (export POLLRDHUP)) + +(if (defined? 'POLLERR) + (export POLLERR)) + +(if (defined? 'POLLHUP) + (export POLLHUP)) + +(if (defined? 'POLLNVAL) + (export POLLNVAL)) + + +(define-record-type + (make-poll-set pollfds nfds ports) + poll-set? + (pollfds pset-pollfds set-pset-pollfds!) + (nfds poll-set-nfds set-pset-nfds!) + (ports pset-ports set-pset-ports!) + ) + +(define-syntax-rule (pollfd-offset n) + (* n 8)) + +(define* (make-empty-poll-set #:optional (pre-allocated 4)) + (make-poll-set (make-bytevector (pollfd-offset pre-allocated) 0) + 0 + (make-vector pre-allocated #f))) + +(define (pset-size set) + (vector-length (pset-ports set))) + +(define (ensure-pset-size! set size) + (let ((prev (pset-size set))) + (if (< prev size) + (let lp ((new prev)) + (if (< new size) + (lp (* new 2)) + (let ((old-pollfds (pset-pollfds set)) + (nfds (poll-set-nfds set)) + (old-ports (pset-ports set)) + (new-pollfds (make-bytevector (pollfd-offset new) 0)) + (new-ports (make-vector new #f))) + (bytevector-copy! old-pollfds 0 new-pollfds 0 + (pollfd-offset nfds)) + (vector-move-left! old-ports 0 nfds new-ports 0) + (set-pset-pollfds! set new-pollfds) + (set-pset-ports! set new-ports))))))) + +(define (poll-set-find-port set port) + (let lp ((i 0)) + (if (< i (poll-set-nfds set)) + (if (equal? (vector-ref (pset-ports set) i) port) + i + (lp (1+ i))) + #f))) + +(define (poll-set-port set idx) + (if (< idx (poll-set-nfds set)) + (vector-ref (pset-ports set) idx) + (error "poll set index out of bounds" set idx))) + +(define (poll-set-events set idx) + (if (< idx (poll-set-nfds set)) + (bytevector-u16-native-ref (pset-pollfds set) (+ (pollfd-offset idx) 4)) + (error "poll set index out of bounds" set idx))) + +(define (set-poll-set-events! set idx events) + (if (< idx (poll-set-nfds set)) + (bytevector-u16-native-set! (pset-pollfds set) (+ (pollfd-offset idx) 4) + events) + (error "poll set index out of bounds" set idx))) + +(define (poll-set-revents set idx) + (if (< idx (poll-set-nfds set)) + (bytevector-u16-native-ref (pset-pollfds set) (+ (pollfd-offset idx) 6)) + (error "poll set index out of bounds" set idx))) + +(define (set-poll-set-revents! set idx revents) + (if (< idx (poll-set-nfds set)) + (bytevector-u16-native-set! (pset-pollfds set) (+ (pollfd-offset idx) 6) + revents) + (error "poll set index out of bounds" set idx))) + +(define (poll-set-add! set fd-or-port events) + (let* ((idx (poll-set-nfds set)) + (off (pollfd-offset idx)) + (fd (if (integer? fd-or-port) + fd-or-port + (fileno fd-or-port)))) + + (ensure-pset-size! set (1+ idx)) + (bytevector-s32-native-set! (pset-pollfds set) off fd) + (bytevector-u16-native-set! (pset-pollfds set) (+ off 4) events) + (bytevector-u16-native-set! (pset-pollfds set) (+ off 6) 0) ; revents + (vector-set! (pset-ports set) idx fd-or-port) + (set-pset-nfds! set (1+ idx)))) + +(define (poll-set-remove! set idx) + (if (not (< idx (poll-set-nfds set))) + (error "poll set index out of bounds" set idx)) + (let ((nfds (poll-set-nfds set)) + (off (pollfd-offset idx)) + (port (vector-ref (pset-ports set) idx))) + (vector-move-left! (pset-ports set) (1+ idx) nfds + (pset-ports set) idx) + (vector-set! (pset-ports set) (1- nfds) #f) + (bytevector-copy! (pset-pollfds set) (pollfd-offset (1+ idx)) + (pset-pollfds set) off + (- (pollfd-offset nfds) (pollfd-offset (1+ idx)))) + ;; zero the struct pollfd all at once + (bytevector-u64-native-set! (pset-pollfds set) (pollfd-offset (1- nfds)) 0) + (set-pset-nfds! set (1- nfds)) + port)) + +(define* (poll poll-set #:optional (timeout -1)) + (primitive-poll (pset-pollfds poll-set) + (poll-set-nfds poll-set) + (pset-ports poll-set) + timeout)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/popen.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/popen.scm new file mode 100644 index 0000000000000000000000000000000000000000..f9781c69892012d94b5294d483decd23be300194 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/popen.scm @@ -0,0 +1,178 @@ +;; popen emulation, for non-stdio based ports. + +;;;; Copyright (C) 1998-2001, 2003, 2006, 2010-2013, 2019 +;;;; Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (ice-9 popen) + #:use-module (rnrs bytevectors) + #:use-module (ice-9 binary-ports) + #:use-module (ice-9 threads) + #:use-module (srfi srfi-9) + #:export (port/pid-table open-pipe* open-pipe close-pipe open-input-pipe + open-output-pipe open-input-output-pipe)) + +(eval-when (expand load eval) + (load-extension (string-append "libguile-" (effective-version)) + "scm_init_popen")) + +(define-record-type + (make-pipe-info pid) + pipe-info? + (pid pipe-info-pid set-pipe-info-pid!)) + +(define (make-rw-port read-port write-port) + (define (read! bv start count) + (let ((result (get-bytevector-some! read-port bv start count))) + (if (eof-object? result) + 0 + result))) + + (define (write! bv start count) + (put-bytevector write-port bv start count) + count) + + (define (close) + (close-port read-port) + (close-port write-port)) + + (define rw-port + (make-custom-binary-input/output-port "ice-9-popen-rw-port" + read! + write! + #f ;get-position + #f ;set-position! + close)) + ;; Enable buffering on 'read-port' so that 'get-bytevector-some' will + ;; return non-trivial blocks. + (setvbuf read-port 'block 16384) + + ;; Inherit the port-encoding from the read-port. + (set-port-encoding! rw-port (port-encoding read-port)) + + ;; Reset the port encoding on the underlying ports to inhibit BOM + ;; handling there. Instead, the BOM handling (if any) will be handled + ;; in the rw-port. In the current implementation of Guile ports, + ;; using binary I/O primitives alone is not enough to reliably inhibit + ;; BOM handling, if the port encoding is set to UTF-{8,16,32}. + (set-port-encoding! read-port "ISO-8859-1") + (set-port-encoding! write-port "ISO-8859-1") + + rw-port) + +;; a guardian to ensure the cleanup is done correctly when +;; an open pipe is gc'd or a close-port is used. +(define pipe-guardian (make-guardian)) + +;; a weak hash-table to store the process ids. +;; XXX use of this table is deprecated. It is no longer used here, and +;; is populated for backward compatibility only (since it is exported). +(define port/pid-table (make-weak-key-hash-table 31)) +(define port/pid-table-mutex (make-mutex)) + +(define (open-pipe* mode command . args) + "Executes the program @var{command} with optional arguments +@var{args} (all strings) in a subprocess. +A port to the process (based on pipes) is created and returned. +@var{mode} specifies whether an input, an output or an input-output +port to the process is created: it should be the value of +@code{OPEN_READ}, @code{OPEN_WRITE} or @code{OPEN_BOTH}." + (call-with-values (lambda () + (apply open-process mode command args)) + (lambda (read-port write-port pid) + (let ((port (or (and read-port write-port + (make-rw-port read-port write-port)) + read-port + write-port + (%make-void-port mode))) + (pipe-info (make-pipe-info pid))) + + ;; Guard the pipe-info instead of the port, so that we can still + ;; call 'waitpid' even if 'close-port' is called (which clears + ;; the port entry). + (pipe-guardian pipe-info) + (%set-port-property! port 'popen-pipe-info pipe-info) + + ;; XXX populate port/pid-table for backward compatibility. + (with-mutex port/pid-table-mutex + (hashq-set! port/pid-table port pid)) + + port)))) + +(define (open-pipe command mode) + "Executes the shell command @var{command} (a string) in a subprocess. +A port to the process (based on pipes) is created and returned. +@var{mode} specifies whether an input, an output or an input-output +port to the process is created: it should be the value of +@code{OPEN_READ}, @code{OPEN_WRITE} or @code{OPEN_BOTH}." + (open-pipe* mode "/bin/sh" "-c" command)) + +(define (fetch-pipe-info port) + (%port-property port 'popen-pipe-info)) + +(define (close-process port pid) + (close-port port) + (cdr (waitpid pid))) + +(define (close-pipe p) + "Closes the pipe created by @code{open-pipe}, then waits for the process +to terminate and returns its status value, @xref{Processes, waitpid}, for +information on how to interpret this value." + (let ((pipe-info (fetch-pipe-info p))) + (unless pipe-info + (error "close-pipe: port not created by (ice-9 popen)")) + (let ((pid (pipe-info-pid pipe-info))) + (unless pid + (error "close-pipe: pid has already been cleared")) + ;; clear the pid to avoid repeated calls to 'waitpid'. + (set-pipe-info-pid! pipe-info #f) + (close-process p pid)))) + +(define (reap-pipes) + (let loop () + (let ((pipe-info (pipe-guardian))) + (when pipe-info + (let ((pid (pipe-info-pid pipe-info))) + ;; maybe 'close-pipe' was already called. + (when pid + ;; clean up without reporting errors. also avoids blocking + ;; the process: if the child isn't ready to be collected, + ;; puts it back into the guardian's live list so it can be + ;; tried again the next time the cleanup runs. + (catch 'system-error + (lambda () + (let ((pid/status (waitpid pid WNOHANG))) + (if (zero? (car pid/status)) + (pipe-guardian pipe-info) ; not ready for collection + (set-pipe-info-pid! pipe-info #f)))) + (lambda args #f)))) + (loop))))) + +(add-hook! after-gc-hook reap-pipes) + +(define (open-input-pipe command) + "Equivalent to @code{open-pipe} with mode @code{OPEN_READ}" + (open-pipe command OPEN_READ)) + +(define (open-output-pipe command) + "Equivalent to @code{open-pipe} with mode @code{OPEN_WRITE}" + (open-pipe command OPEN_WRITE)) + +(define (open-input-output-pipe command) + "Equivalent to @code{open-pipe} with mode @code{OPEN_BOTH}" + (open-pipe command OPEN_BOTH)) + diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/ports.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/ports.scm new file mode 100644 index 0000000000000000000000000000000000000000..dbc7ef7a7990fc99cfffa8572152197324e5aece --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/ports.scm @@ -0,0 +1,566 @@ +;;; Ports +;;; Copyright (C) 2016, 2019 Free Software Foundation, Inc. +;;; +;;; This library is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU Lesser General Public License as +;;; published by the Free Software Foundation, either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; This library is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this program. If not, see +;;; . + +;;; Commentary: +;;; +;;; Implementation of input/output routines over ports. +;;; +;;; Note that loading this module overrides some core bindings; see the +;;; `replace-bootstrap-bindings' invocation below for details. +;;; +;;; Code: + + +(define-module (ice-9 ports) + #:export (;; Definitions from ports.c. + %port-property + %set-port-property! + current-input-port current-output-port + current-error-port current-warning-port + current-load-port + set-current-input-port set-current-output-port + set-current-error-port + port-mode + port? + input-port? + output-port? + port-closed? + eof-object? + close-port + close-input-port + close-output-port + ;; These two are currently defined by scm_init_ports; fix? + ;; %default-port-encoding + ;; %default-port-conversion-strategy + port-encoding + set-port-encoding! + port-conversion-strategy + set-port-conversion-strategy! + read-char + peek-char + unread-char + unread-string + setvbuf + drain-input + force-output + char-ready? + seek SEEK_SET SEEK_CUR SEEK_END + truncate-file + port-line + set-port-line! + port-column + set-port-column! + port-filename + set-port-filename! + port-for-each + flush-all-ports + %make-void-port + + ;; Definitions from fports.c. + open-file + file-port? + port-revealed + set-port-revealed! + adjust-port-revealed! + ;; note: %file-port-name-canonicalization is used in boot-9 + + ;; Definitions from ioext.c. + ftell + redirect-port + dup->fdes + dup2 + fileno + isatty? + fdopen + primitive-move->fdes + fdes->ports + + ;; Definitions in Scheme + file-position + file-set-position + move->fdes + release-port-handle + dup->port + dup->inport + dup->outport + dup + duplicate-port + fdes->inport + fdes->outport + port->fdes + OPEN_READ OPEN_WRITE OPEN_BOTH + *null-device* + open-input-file + open-output-file + open-io-file + call-with-input-file + call-with-output-file + with-input-from-port + with-output-to-port + with-error-to-port + with-input-from-file + with-output-to-file + with-error-to-file + call-with-input-string + with-input-from-string + call-with-output-string + with-output-to-string + with-error-to-string + the-eof-object + inherit-print-state)) + +(define (replace-bootstrap-bindings syms) + (for-each + (lambda (sym) + (let* ((var (module-variable the-scm-module sym)) + (mod (current-module)) + (iface (module-public-interface mod))) + (unless var (error "unbound in root module" sym)) + (module-add! mod sym var) + (when (module-local-variable iface sym) + (module-add! iface sym var)))) + syms)) + +(replace-bootstrap-bindings '(open-file + open-input-file + set-port-encoding! + eof-object? + force-output + call-with-output-string + close-port + current-error-port + current-warning-port)) + +(load-extension (string-append "libguile-" (effective-version)) + "scm_init_ice_9_ports") +(load-extension (string-append "libguile-" (effective-version)) + "scm_init_ice_9_fports") +(load-extension (string-append "libguile-" (effective-version)) + "scm_init_ice_9_ioext") + + + +(define (port-encoding port) + "Return, as a string, the character encoding that @var{port} uses to +interpret its input and output." + (symbol->string (%port-encoding port))) + + + +(define-module (ice-9 ports internal) + #:use-module (ice-9 ports) + #:export (port-read-buffer + port-write-buffer + port-auxiliary-write-buffer + port-line-buffered? + expand-port-read-buffer! + port-buffer-bytevector + port-buffer-cur + port-buffer-end + port-buffer-has-eof? + port-buffer-position + set-port-buffer-cur! + set-port-buffer-end! + set-port-buffer-has-eof?! + port-position-line + port-position-column + set-port-position-line! + set-port-position-column! + port-read + port-write + port-clear-stream-start-for-bom-read + port-clear-stream-start-for-bom-write + %port-encoding + specialize-port-encoding! + port-random-access? + port-decode-char + port-encode-char + port-encode-chars + port-read-buffering + port-poll + port-read-wait-fd + port-write-wait-fd + put-char + put-string)) + +(define-syntax-rule (port-buffer-bytevector buf) (vector-ref buf 0)) +(define-syntax-rule (port-buffer-cur buf) (vector-ref buf 1)) +(define-syntax-rule (port-buffer-end buf) (vector-ref buf 2)) +(define-syntax-rule (port-buffer-has-eof? buf) (vector-ref buf 3)) +(define-syntax-rule (port-buffer-position buf) (vector-ref buf 4)) + +(define-syntax-rule (set-port-buffer-cur! buf cur) + (vector-set! buf 1 cur)) +(define-syntax-rule (set-port-buffer-end! buf end) + (vector-set! buf 2 end)) +(define-syntax-rule (set-port-buffer-has-eof?! buf has-eof?) + (vector-set! buf 3 has-eof?)) + +(define-syntax-rule (port-position-line position) + (car position)) +(define-syntax-rule (port-position-column position) + (cdr position)) +(define-syntax-rule (set-port-position-line! position line) + (set-car! position line)) +(define-syntax-rule (set-port-position-column! position column) + (set-cdr! position column)) + +(eval-when (expand) + (define-syntax-rule (private-port-bindings binding ...) + (begin + (define binding (@@ (ice-9 ports) binding)) + ...))) + +(private-port-bindings port-read-buffer + port-write-buffer + port-auxiliary-write-buffer + port-line-buffered? + expand-port-read-buffer! + port-read + port-write + port-clear-stream-start-for-bom-read + port-clear-stream-start-for-bom-write + %port-encoding + specialize-port-encoding! + port-decode-char + port-encode-char + port-encode-chars + port-random-access? + port-read-buffering + port-poll + port-read-wait-fd + port-write-wait-fd + put-char + put-string) + +;; And we're back. +(define-module (ice-9 ports)) + + + +;;; Current ports as parameters. +;;; + +(define current-input-port + (fluid->parameter %current-input-port-fluid + (lambda (x) + (unless (input-port? x) + (error "expected an input port" x)) + x))) + +(define current-output-port + (fluid->parameter %current-output-port-fluid + (lambda (x) + (unless (output-port? x) + (error "expected an output port" x)) + x))) + +(define current-error-port + (fluid->parameter %current-error-port-fluid + (lambda (x) + (unless (output-port? x) + (error "expected an output port" x)) + x))) + +(define current-warning-port + (fluid->parameter %current-warning-port-fluid + (lambda (x) + (unless (output-port? x) + (error "expected an output port" x)) + x))) + + + + +;;; {File Descriptors and Ports} +;;; + +(define file-position ftell) +(define* (file-set-position port offset #:optional (whence SEEK_SET)) + (seek port offset whence)) + +(define (move->fdes fd/port fd) + (cond ((integer? fd/port) + (dup->fdes fd/port fd) + (close fd/port) + fd) + (else + (primitive-move->fdes fd/port fd) + (set-port-revealed! fd/port 1) + fd/port))) + +(define (release-port-handle port) + (let ((revealed (port-revealed port))) + (if (> revealed 0) + (set-port-revealed! port (- revealed 1))))) + +(define dup->port + (case-lambda + ((port/fd mode) + (fdopen (dup->fdes port/fd) mode)) + ((port/fd mode new-fd) + (let ((port (fdopen (dup->fdes port/fd new-fd) mode))) + (set-port-revealed! port 1) + port)))) + +(define dup->inport + (case-lambda + ((port/fd) + (dup->port port/fd "r")) + ((port/fd new-fd) + (dup->port port/fd "r" new-fd)))) + +(define dup->outport + (case-lambda + ((port/fd) + (dup->port port/fd "w")) + ((port/fd new-fd) + (dup->port port/fd "w" new-fd)))) + +(define dup + (case-lambda + ((port/fd) + (if (integer? port/fd) + (dup->fdes port/fd) + (dup->port port/fd (port-mode port/fd)))) + ((port/fd new-fd) + (if (integer? port/fd) + (dup->fdes port/fd new-fd) + (dup->port port/fd (port-mode port/fd) new-fd))))) + +(define (duplicate-port port modes) + (dup->port port modes)) + +(define (fdes->inport fdes) + (let loop ((rest-ports (fdes->ports fdes))) + (cond ((null? rest-ports) + (let ((result (fdopen fdes "r"))) + (set-port-revealed! result 1) + result)) + ((input-port? (car rest-ports)) + (set-port-revealed! (car rest-ports) + (+ (port-revealed (car rest-ports)) 1)) + (car rest-ports)) + (else + (loop (cdr rest-ports)))))) + +(define (fdes->outport fdes) + (let loop ((rest-ports (fdes->ports fdes))) + (cond ((null? rest-ports) + (let ((result (fdopen fdes "w"))) + (set-port-revealed! result 1) + result)) + ((output-port? (car rest-ports)) + (set-port-revealed! (car rest-ports) + (+ (port-revealed (car rest-ports)) 1)) + (car rest-ports)) + (else + (loop (cdr rest-ports)))))) + +(define (port->fdes port) + (set-port-revealed! port (+ (port-revealed port) 1)) + (fileno port)) + +;; Legacy interfaces. + +(define (set-current-input-port port) + "Set the current default input port to @var{port}." + (current-input-port port)) + +(define (set-current-output-port port) + "Set the current default output port to @var{port}." + (current-output-port port)) + +(define (set-current-error-port port) + "Set the current default error port to @var{port}." + (current-error-port port)) + + +;;;; high level routines + + +;;; {High-Level Port Routines} +;;; + +;; These are used to request the proper mode to open files in. +;; +(define OPEN_READ "r") +(define OPEN_WRITE "w") +(define OPEN_BOTH "r+") + +(define *null-device* "/dev/null") + +(define* (open-input-file + file #:key (binary #f) (encoding #f) (guess-encoding #f)) + "Takes a string naming an existing file and returns an input port +capable of delivering characters from the file. If the file +cannot be opened, an error is signalled." + (open-file file (if binary "rb" "r") + #:encoding encoding + #:guess-encoding guess-encoding)) + +(define* (open-output-file file #:key (binary #f) (encoding #f)) + "Takes a string naming an output file to be created and returns an +output port capable of writing characters to a new file by that +name. If the file cannot be opened, an error is signalled. If a +file with the given name already exists, the effect is unspecified." + (open-file file (if binary "wb" "w") + #:encoding encoding)) + +(define (open-io-file str) + "Open file with name STR for both input and output." + (open-file str OPEN_BOTH)) + +(define* (call-with-input-file + file proc #:key (binary #f) (encoding #f) (guess-encoding #f)) + "PROC should be a procedure of one argument, and FILE should be a +string naming a file. The file must +already exist. These procedures call PROC +with one argument: the port obtained by opening the named file for +input or output. If the file cannot be opened, an error is +signalled. If the procedure returns, then the port is closed +automatically and the values yielded by the procedure are returned. +If the procedure does not return, then the port will not be closed +automatically unless it is possible to prove that the port will +never again be used for a read or write operation." + (let ((p (open-input-file file + #:binary binary + #:encoding encoding + #:guess-encoding guess-encoding))) + (call-with-values + (lambda () (proc p)) + (lambda vals + (close-input-port p) + (apply values vals))))) + +(define* (call-with-output-file file proc #:key (binary #f) (encoding #f)) + "PROC should be a procedure of one argument, and FILE should be a +string naming a file. The behaviour is unspecified if the file +already exists. These procedures call PROC +with one argument: the port obtained by opening the named file for +input or output. If the file cannot be opened, an error is +signalled. If the procedure returns, then the port is closed +automatically and the values yielded by the procedure are returned. +If the procedure does not return, then the port will not be closed +automatically unless it is possible to prove that the port will +never again be used for a read or write operation." + (let ((p (open-output-file file #:binary binary #:encoding encoding))) + (call-with-values + (lambda () (proc p)) + (lambda vals + (close-output-port p) + (apply values vals))))) + +(define (with-input-from-port port thunk) + (parameterize ((current-input-port port)) + (thunk))) + +(define (with-output-to-port port thunk) + (parameterize ((current-output-port port)) + (thunk))) + +(define (with-error-to-port port thunk) + (parameterize ((current-error-port port)) + (thunk))) + +(define* (with-input-from-file + file thunk #:key (binary #f) (encoding #f) (guess-encoding #f)) + "THUNK must be a procedure of no arguments, and FILE must be a +string naming a file. The file must already exist. The file is opened for +input, an input port connected to it is made +the default value returned by `current-input-port', +and the THUNK is called with no arguments. +When the THUNK returns, the port is closed and the previous +default is restored. Returns the values yielded by THUNK. If an +escape procedure is used to escape from the continuation of these +procedures, their behavior is implementation dependent." + (call-with-input-file file + (lambda (p) (with-input-from-port p thunk)) + #:binary binary + #:encoding encoding + #:guess-encoding guess-encoding)) + +(define* (with-output-to-file file thunk #:key (binary #f) (encoding #f)) + "THUNK must be a procedure of no arguments, and FILE must be a +string naming a file. The effect is unspecified if the file already exists. +The file is opened for output, an output port connected to it is made +the default value returned by `current-output-port', +and the THUNK is called with no arguments. +When the THUNK returns, the port is closed and the previous +default is restored. Returns the values yielded by THUNK. If an +escape procedure is used to escape from the continuation of these +procedures, their behavior is implementation dependent." + (call-with-output-file file + (lambda (p) (with-output-to-port p thunk)) + #:binary binary + #:encoding encoding)) + +(define* (with-error-to-file file thunk #:key (binary #f) (encoding #f)) + "THUNK must be a procedure of no arguments, and FILE must be a +string naming a file. The effect is unspecified if the file already exists. +The file is opened for output, an output port connected to it is made +the default value returned by `current-error-port', +and the THUNK is called with no arguments. +When the THUNK returns, the port is closed and the previous +default is restored. Returns the values yielded by THUNK. If an +escape procedure is used to escape from the continuation of these +procedures, their behavior is implementation dependent." + (call-with-output-file file + (lambda (p) (with-error-to-port p thunk)) + #:binary binary + #:encoding encoding)) + +(define (call-with-input-string string proc) + "Calls the one-argument procedure @var{proc} with a newly created +input port from which @var{string}'s contents may be read. The value +yielded by the @var{proc} is returned." + (proc (open-input-string string))) + +(define (with-input-from-string string thunk) + "THUNK must be a procedure of no arguments. +The test of STRING is opened for +input, an input port connected to it is made, +and the THUNK is called with no arguments. +When the THUNK returns, the port is closed. +Returns the values yielded by THUNK. If an +escape procedure is used to escape from the continuation of these +procedures, their behavior is implementation dependent." + (call-with-input-string string + (lambda (p) (with-input-from-port p thunk)))) + +(define (call-with-output-string proc) + "Calls the one-argument procedure @var{proc} with a newly created output +port. When the function returns, the string composed of the characters +written into the port is returned." + (let ((port (open-output-string))) + (proc port) + (get-output-string port))) + +(define (with-output-to-string thunk) + "Calls THUNK and returns its output as a string." + (call-with-output-string + (lambda (p) (with-output-to-port p thunk)))) + +(define (with-error-to-string thunk) + "Calls THUNK and returns its error output as a string." + (call-with-output-string + (lambda (p) (with-error-to-port p thunk)))) + +(define (inherit-print-state old-port new-port) + (if (get-print-state old-port) + (port-with-print-state new-port (get-print-state old-port)) + new-port)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/posix.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/posix.scm new file mode 100644 index 0000000000000000000000000000000000000000..b00267665e3e51ad7f2ac80a325dc82198969ea2 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/posix.scm @@ -0,0 +1,75 @@ +;;; installed-scm-file + +;;;; Copyright (C) 1999, 2006 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(eval-when (compile) + (set-current-module (resolve-module '(guile)))) + +(define (stat:dev f) (vector-ref f 0)) +(define (stat:ino f) (vector-ref f 1)) +(define (stat:mode f) (vector-ref f 2)) +(define (stat:nlink f) (vector-ref f 3)) +(define (stat:uid f) (vector-ref f 4)) +(define (stat:gid f) (vector-ref f 5)) +(define (stat:rdev f) (vector-ref f 6)) +(define (stat:size f) (vector-ref f 7)) +(define (stat:atime f) (vector-ref f 8)) +(define (stat:mtime f) (vector-ref f 9)) +(define (stat:ctime f) (vector-ref f 10)) +(define (stat:blksize f) (vector-ref f 11)) +(define (stat:blocks f) (vector-ref f 12)) +(define (stat:atimensec f) (vector-ref f 15)) +(define (stat:mtimensec f) (vector-ref f 16)) +(define (stat:ctimensec f) (vector-ref f 17)) + +;; derived from stat mode. +(define (stat:type f) (vector-ref f 13)) +(define (stat:perms f) (vector-ref f 14)) + +(define (passwd:name obj) (vector-ref obj 0)) +(define (passwd:passwd obj) (vector-ref obj 1)) +(define (passwd:uid obj) (vector-ref obj 2)) +(define (passwd:gid obj) (vector-ref obj 3)) +(define (passwd:gecos obj) (vector-ref obj 4)) +(define (passwd:dir obj) (vector-ref obj 5)) +(define (passwd:shell obj) (vector-ref obj 6)) + +(define (group:name obj) (vector-ref obj 0)) +(define (group:passwd obj) (vector-ref obj 1)) +(define (group:gid obj) (vector-ref obj 2)) +(define (group:mem obj) (vector-ref obj 3)) + +(define (utsname:sysname obj) (vector-ref obj 0)) +(define (utsname:nodename obj) (vector-ref obj 1)) +(define (utsname:release obj) (vector-ref obj 2)) +(define (utsname:version obj) (vector-ref obj 3)) +(define (utsname:machine obj) (vector-ref obj 4)) + +(define (getpwent) (getpw)) +(define (setpwent) (setpw #t)) +(define (endpwent) (setpw)) + +(define (getpwnam name) (getpw name)) +(define (getpwuid uid) (getpw uid)) + +(define (getgrent) (getgr)) +(define (setgrent) (setgr #t)) +(define (endgrent) (setgr)) + +(define (getgrnam name) (getgr name)) +(define (getgrgid id) (getgr id)) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/pretty-print.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/pretty-print.scm new file mode 100644 index 0000000000000000000000000000000000000000..f90e15d384e946f2d634a3ca9acb3d788c3e444f --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/pretty-print.scm @@ -0,0 +1,483 @@ +;;;; -*- coding: utf-8; mode: scheme -*- +;;;; +;;;; Copyright (C) 2001, 2004, 2006, 2009, 2010, +;;;; 2012, 2013, 2014 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; +(define-module (ice-9 pretty-print) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (rnrs bytevectors) + #:export (pretty-print + truncated-print)) + + +;; From SLIB. + +;;"genwrite.scm" generic write used by pretty-print and truncated-print. +;; Copyright (c) 1991, Marc Feeley +;; Author: Marc Feeley (feeley@iro.umontreal.ca) +;; Distribution restrictions: none + +(define genwrite:newline-str (make-string 1 #\newline)) + +(define (generic-write + obj display? width max-expr-width per-line-prefix output) + + (define (read-macro? l) + (define (length1? l) (and (pair? l) (null? (cdr l)))) + (let ((head (car l)) (tail (cdr l))) + (case head + ((quote quasiquote unquote unquote-splicing) (length1? tail)) + (else #f)))) + + (define (read-macro-body l) + (cadr l)) + + (define (read-macro-prefix l) + (let ((head (car l))) + (case head + ((quote) "'") + ((quasiquote) "`") + ((unquote) ",") + ((unquote-splicing) ",@")))) + + (define (out str col) + (and col (output str) (+ col (string-length str)))) + + (define (wr obj col) + (let loop ((obj obj) + (col col)) + (match obj + (((or 'quote 'quasiquote 'unquote 'unquote-splicing) body) + (wr body (out (read-macro-prefix obj) col))) + ((head . (rest ...)) + ;; A proper list: do our own list printing so as to catch read + ;; macros that appear in the middle of the list. + (let ((col (loop head (out "(" col)))) + (out ")" + (fold (lambda (i col) + (loop i (out " " col))) + col rest)))) + (_ + (out (object->string obj (if display? display write)) col))))) + + (define (pp obj col) + + (define (spaces n col) + (if (> n 0) + (if (> n 7) + (spaces (- n 8) (out " " col)) + (out (substring " " 0 n) col)) + col)) + + (define (indent to col) + (and col + (if (< to col) + (and (out genwrite:newline-str col) + (out per-line-prefix 0) + (spaces to 0)) + (spaces (- to col) col)))) + + (define (pr obj col extra pp-pair) + (if (or (pair? obj) (vector? obj)) ; may have to split on multiple lines + (let ((result '()) + (left (min (+ (- (- width col) extra) 1) max-expr-width))) + (generic-write obj display? #f max-expr-width "" + (lambda (str) + (set! result (cons str result)) + (set! left (- left (string-length str))) + (> left 0))) + (if (> left 0) ; all can be printed on one line + (out (reverse-string-append result) col) + (if (pair? obj) + (pp-pair obj col extra) + (pp-list (vector->list obj) (out "#" col) extra pp-expr)))) + (wr obj col))) + + (define (pp-expr expr col extra) + (if (read-macro? expr) + (pr (read-macro-body expr) + (out (read-macro-prefix expr) col) + extra + pp-expr) + (let ((head (car expr))) + (if (symbol? head) + (let ((proc (style head))) + (if proc + (proc expr col extra) + (if (> (string-length (symbol->string head)) + max-call-head-width) + (pp-general expr col extra #f #f #f pp-expr) + (pp-call expr col extra pp-expr)))) + (pp-list expr col extra pp-expr))))) + + ; (head item1 + ; item2 + ; item3) + (define (pp-call expr col extra pp-item) + (let ((col* (wr (car expr) (out "(" col)))) + (and col + (pp-down (cdr expr) col* (+ col* 1) extra pp-item)))) + + ; (item1 + ; item2 + ; item3) + (define (pp-list l col extra pp-item) + (let ((col (out "(" col))) + (pp-down l col col extra pp-item))) + + (define (pp-down l col1 col2 extra pp-item) + (let loop ((l l) (col col1)) + (and col + (cond ((pair? l) + (let ((rest (cdr l))) + (let ((extra (if (null? rest) (+ extra 1) 0))) + (loop rest + (pr (car l) (indent col2 col) extra pp-item))))) + ((null? l) + (out ")" col)) + (else + (out ")" + (pr l + (indent col2 (out "." (indent col2 col))) + (+ extra 1) + pp-item))))))) + + (define (pp-general expr col extra named? pp-1 pp-2 pp-3) + + (define (tail1 rest col1 col2 col3) + (if (and pp-1 (pair? rest)) + (let* ((val1 (car rest)) + (rest (cdr rest)) + (extra (if (null? rest) (+ extra 1) 0))) + (tail2 rest col1 (pr val1 (indent col3 col2) extra pp-1) col3)) + (tail2 rest col1 col2 col3))) + + (define (tail2 rest col1 col2 col3) + (if (and pp-2 (pair? rest)) + (let* ((val1 (car rest)) + (rest (cdr rest)) + (extra (if (null? rest) (+ extra 1) 0))) + (tail3 rest col1 (pr val1 (indent col3 col2) extra pp-2))) + (tail3 rest col1 col2))) + + (define (tail3 rest col1 col2) + (pp-down rest col2 col1 extra pp-3)) + + (let* ((head (car expr)) + (rest (cdr expr)) + (col* (wr head (out "(" col)))) + (if (and named? (pair? rest)) + (let* ((name (car rest)) + (rest (cdr rest)) + (col** (wr name (out " " col*)))) + (tail1 rest (+ col indent-general) col** (+ col** 1))) + (tail1 rest (+ col indent-general) col* (+ col* 1))))) + + (define (pp-expr-list l col extra) + (pp-list l col extra pp-expr)) + + (define (pp-LAMBDA expr col extra) + (pp-general expr col extra #f pp-expr-list #f pp-expr)) + + (define (pp-IF expr col extra) + (pp-general expr col extra #f pp-expr #f pp-expr)) + + (define (pp-COND expr col extra) + (pp-call expr col extra pp-expr-list)) + + (define (pp-CASE expr col extra) + (pp-general expr col extra #f pp-expr #f pp-expr-list)) + + (define (pp-AND expr col extra) + (pp-call expr col extra pp-expr)) + + (define (pp-LET expr col extra) + (let* ((rest (cdr expr)) + (named? (and (pair? rest) (symbol? (car rest))))) + (pp-general expr col extra named? pp-expr-list #f pp-expr))) + + (define (pp-BEGIN expr col extra) + (pp-general expr col extra #f #f #f pp-expr)) + + (define (pp-DO expr col extra) + (pp-general expr col extra #f pp-expr-list pp-expr-list pp-expr)) + + (define (pp-SYNTAX-CASE expr col extra) + (pp-general expr col extra #t pp-expr-list #f pp-expr)) + + ; define formatting style (change these to suit your style) + + (define indent-general 2) + + (define max-call-head-width 5) + + (define (style head) + (case head + ((lambda lambda* let* letrec define define* define-public + define-syntax let-syntax letrec-syntax with-syntax) + pp-LAMBDA) + ((if set!) pp-IF) + ((cond) pp-COND) + ((case) pp-CASE) + ((and or) pp-AND) + ((let) pp-LET) + ((begin) pp-BEGIN) + ((do) pp-DO) + ((syntax-rules) pp-LAMBDA) + ((syntax-case) pp-SYNTAX-CASE) + (else #f))) + + (pr obj col 0 pp-expr)) + + (out per-line-prefix 0) + (if width + (out genwrite:newline-str (pp obj 0)) + (wr obj 0)) + ;; Return `unspecified' + (if #f #f)) + +; (reverse-string-append l) = (apply string-append (reverse l)) + +(define (reverse-string-append l) + + (define (rev-string-append l i) + (if (pair? l) + (let* ((str (car l)) + (len (string-length str)) + (result (rev-string-append (cdr l) (+ i len)))) + (let loop ((j 0) (k (- (- (string-length result) i) len))) + (if (< j len) + (begin + (string-set! result k (string-ref str j)) + (loop (+ j 1) (+ k 1))) + result))) + (make-string i))) + + (rev-string-append l 0)) + +(define* (pretty-print obj #:optional port* + #:key + (port (or port* (current-output-port))) + (width 79) + (max-expr-width 50) + (display? #f) + (per-line-prefix "")) + "Pretty-print OBJ on PORT, which is a keyword argument defaulting to +the current output port. Formatting can be controlled by a number of +keyword arguments: Each line in the output is preceded by the string +PER-LINE-PREFIX, which is empty by default. The output lines will be +at most WIDTH characters wide; the default is 79. If DISPLAY? is +true, display rather than write representation will be used. + +Instead of with a keyword argument, you can also specify the output +port directly after OBJ, like (pretty-print OBJ PORT)." + (generic-write obj display? + (- width (string-length per-line-prefix)) + max-expr-width + per-line-prefix + (lambda (s) (display s port) #t))) + + +;; `truncated-print' was written in 2009 by Andy Wingo, and is not from +;; genwrite.scm. +(define* (truncated-print x #:optional port* + #:key + (port (or port* (current-output-port))) + (width 79) + (display? #f) + (breadth-first? #f)) + "Print @var{x}, truncating the output, if necessary, to make it fit +into @var{width} characters. By default, @var{x} will be printed using +@code{write}, though that behavior can be overriden via the +@var{display?} keyword argument. + +The default behaviour is to print depth-first, meaning that the entire +remaining width will be available to each sub-expression of @var{x} -- +e.g., if @var{x} is a vector, each member of @var{x}. One can attempt to +\"ration\" the available width, trying to allocate it equally to each +sub-expression, via the @var{breadth-first?} keyword argument." + + (define ellipsis + ;; Choose between `HORIZONTAL ELLIPSIS' (U+2026) and three dots, depending + ;; on the encoding of PORT. + (let ((e "…")) + (catch 'encoding-error + (lambda () + (with-fluids ((%default-port-conversion-strategy 'error)) + (call-with-output-string + (lambda (p) + (set-port-encoding! p (port-encoding port)) + (display e p))))) + (lambda (key . args) + "...")))) + + (let ((ellipsis-width (string-length ellipsis))) + + (define* (print-sequence x width len ref next #:key inner?) + (let lp ((x x) + (width width) + (i 0)) + (if (> i 0) + (display #\space)) + (cond + ((= i len)) ; catches 0-length case + ((and (= i (1- len)) (or (zero? i) (> width 1))) + (print (ref x i) (if (zero? i) width (1- width)) #:inner? inner?)) + ((<= width (+ 1 ellipsis-width)) + (display ellipsis)) + (else + (let ((str (with-output-to-string + (lambda () + (print (ref x i) + (if breadth-first? + (max 1 + (1- (floor (/ width (- len i))))) + (- width (+ 1 ellipsis-width))) + #:inner? inner?))))) + (display str) + (lp (next x) (- width 1 (string-length str)) (1+ i))))))) + + (define (print-tree x width) + ;; width is >= the width of # . #, which is 5 + (let lp ((x x) + (width width)) + (cond + ((or (not (pair? x)) (<= width 4)) + (display ". ") + (print x (- width 2))) + (else + ;; width >= 5 + (let ((str (with-output-to-string + (lambda () + (print (car x) + (if breadth-first? + (floor (/ (- width 3) 2)) + (- width 4))))))) + (display str) + (display " ") + (lp (cdr x) (- width 1 (string-length str)))))))) + + (define (truncate-string str width) + ;; width is < (string-length str) + (let lp ((fixes '(("#<" . ">") + ("#(" . ")") + ("(" . ")") + ("\"" . "\"")))) + (cond + ((null? fixes) + "#") + ((and (string-prefix? (caar fixes) str) + (string-suffix? (cdar fixes) str) + (>= (string-length str) + width + (+ (string-length (caar fixes)) + (string-length (cdar fixes)) + ellipsis-width))) + (format #f "~a~a~a~a" + (caar fixes) + (substring str (string-length (caar fixes)) + (- width (string-length (cdar fixes)) + ellipsis-width)) + ellipsis + (cdar fixes))) + (else + (lp (cdr fixes)))))) + + (define* (print x width #:key inner?) + (cond + ((<= width 0) + (error "expected a positive width" width)) + ((list? x) + (cond + ((>= width (+ 2 ellipsis-width)) + (display "(") + (print-sequence x (- width 2) (length x) + (lambda (x i) (car x)) cdr) + (display ")")) + (else + (display "#")))) + ((vector? x) + (cond + ((>= width (+ 3 ellipsis-width)) + (display "#(") + (print-sequence x (- width 3) (vector-length x) + vector-ref identity) + (display ")")) + (else + (display "#")))) + ((bytevector? x) + (cond + ((>= width 9) + (format #t "#~a(" (array-type x)) + (print-sequence x (- width 6) (array-length x) + array-ref identity) + (display ")")) + (else + (display "#")))) + ((bitvector? x) + (cond + ((>= width (+ 2 (array-length x))) + (format #t "~a" x)) + ;; the truncated bitvector would print as #1b(...), so we print by hand. + ((>= width (+ 2 ellipsis-width)) + (format #t "#*") + (array-for-each (lambda (xi) (format #t (if xi "1" "0"))) + (make-shared-array x list (- width 2 ellipsis-width))) + (format #t ellipsis)) + (else + (display "#")))) + ((and (array? x) (not (string? x))) + (let* ((type (array-type x)) + (prefix + (if inner? + "" + (call-with-output-string + (lambda (s) ((@@ (ice-9 arrays) array-print-prefix) x s))))) + (width-prefix (string-length prefix))) + (cond + ((>= width (+ 2 width-prefix ellipsis-width)) + (format #t "~a(" prefix) + (if (zero? (array-rank x)) + (print (array-ref x) (- width width-prefix 2)) + (print-sequence x (- width width-prefix 2) (array-length x) + (let ((base (caar (array-shape x)))) + (lambda (x i) (array-cell-ref x (+ base i)))) + identity + #:inner? (< 1 (array-rank x)))) + (display ")")) + (else + (display "#"))))) + ((pair? x) + (cond + ((>= width (+ 4 ellipsis-width)) + (display "(") + (print-tree x (- width 2)) + (display ")")) + (else + (display "#")))) + (else + (let* ((str (with-output-to-string + (lambda () (if display? (display x) (write x))))) + (len (string-length str))) + (display (if (<= (string-length str) width) + str + (truncate-string str width))))))) + + (with-output-to-port port + (lambda () + (print x width))))) diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/psyntax-pp.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/psyntax-pp.scm new file mode 100644 index 0000000000000000000000000000000000000000..6ee86210de1b13c4ab4ec7311ad887e786d40ad0 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/psyntax-pp.scm @@ -0,0 +1,3542 @@ +(eval-when (compile) (set-current-module (resolve-module (quote (guile))))) +(if #f #f) + +(let ((syntax? (module-ref (current-module) 'syntax?)) + (make-syntax (module-ref (current-module) 'make-syntax)) + (syntax-expression (module-ref (current-module) 'syntax-expression)) + (syntax-wrap (module-ref (current-module) 'syntax-wrap)) + (syntax-module (module-ref (current-module) 'syntax-module))) + (letrec* + ((make-void + (lambda (src) + (make-struct/no-tail (vector-ref %expanded-vtables 0) src))) + (make-const + (lambda (src exp) + (make-struct/no-tail (vector-ref %expanded-vtables 1) src exp))) + (make-primitive-ref + (lambda (src name) + (make-struct/no-tail (vector-ref %expanded-vtables 2) src name))) + (make-lexical-ref + (lambda (src name gensym) + (make-struct/no-tail + (vector-ref %expanded-vtables 3) + src + name + gensym))) + (make-lexical-set + (lambda (src name gensym exp) + (make-struct/no-tail + (vector-ref %expanded-vtables 4) + src + name + gensym + exp))) + (make-module-ref + (lambda (src mod name public?) + (make-struct/no-tail + (vector-ref %expanded-vtables 5) + src + mod + name + public?))) + (make-module-set + (lambda (src mod name public? exp) + (make-struct/no-tail + (vector-ref %expanded-vtables 6) + src + mod + name + public? + exp))) + (make-toplevel-ref + (lambda (src name) + (make-struct/no-tail (vector-ref %expanded-vtables 7) src name))) + (make-toplevel-set + (lambda (src name exp) + (make-struct/no-tail (vector-ref %expanded-vtables 8) src name exp))) + (make-toplevel-define + (lambda (src name exp) + (make-struct/no-tail (vector-ref %expanded-vtables 9) src name exp))) + (make-conditional + (lambda (src test consequent alternate) + (make-struct/no-tail + (vector-ref %expanded-vtables 10) + src + test + consequent + alternate))) + (make-call + (lambda (src proc args) + (make-struct/no-tail (vector-ref %expanded-vtables 11) src proc args))) + (make-primcall + (lambda (src name args) + (make-struct/no-tail (vector-ref %expanded-vtables 12) src name args))) + (make-seq + (lambda (src head tail) + (make-struct/no-tail (vector-ref %expanded-vtables 13) src head tail))) + (make-lambda + (lambda (src meta body) + (make-struct/no-tail (vector-ref %expanded-vtables 14) src meta body))) + (make-lambda-case + (lambda (src req opt rest kw inits gensyms body alternate) + (make-struct/no-tail + (vector-ref %expanded-vtables 15) + src + req + opt + rest + kw + inits + gensyms + body + alternate))) + (make-let + (lambda (src names gensyms vals body) + (make-struct/no-tail + (vector-ref %expanded-vtables 16) + src + names + gensyms + vals + body))) + (make-letrec + (lambda (src in-order? names gensyms vals body) + (make-struct/no-tail + (vector-ref %expanded-vtables 17) + src + in-order? + names + gensyms + vals + body))) + (lambda? + (lambda (x) + (and (struct? x) + (eq? (struct-vtable x) (vector-ref %expanded-vtables 14))))) + (lambda-meta (lambda (x) (struct-ref x 1))) + (set-lambda-meta! (lambda (x v) (struct-set! x 1 v))) + (top-level-eval-hook (lambda (x mod) (primitive-eval x))) + (local-eval-hook (lambda (x mod) (primitive-eval x))) + (session-id + (let ((v (module-variable (current-module) 'syntax-session-id))) + (lambda () ((variable-ref v))))) + (decorate-source + (lambda (e s) + (if (and s (supports-source-properties? e)) + (set-source-properties! e s)) + e)) + (maybe-name-value! + (lambda (name val) + (if (lambda? val) + (let ((meta (lambda-meta val))) + (if (not (assq 'name meta)) + (set-lambda-meta! val (acons 'name name meta))))))) + (build-void (lambda (source) (make-void source))) + (build-call + (lambda (source fun-exp arg-exps) + (make-call source fun-exp arg-exps))) + (build-conditional + (lambda (source test-exp then-exp else-exp) + (make-conditional source test-exp then-exp else-exp))) + (build-lexical-reference + (lambda (type source name var) (make-lexical-ref source name var))) + (build-lexical-assignment + (lambda (source name var exp) + (maybe-name-value! name exp) + (make-lexical-set source name var exp))) + (analyze-variable + (lambda (mod var modref-cont bare-cont) + (if (not mod) + (bare-cont var) + (let ((kind (car mod)) (mod (cdr mod))) + (let ((key kind)) + (cond ((memv key '(public)) (modref-cont mod var #t)) + ((memv key '(private)) + (if (not (equal? mod (module-name (current-module)))) + (modref-cont mod var #f) + (bare-cont var))) + ((memv key '(bare)) (bare-cont var)) + ((memv key '(hygiene)) + (if (and (not (equal? mod (module-name (current-module)))) + (module-variable (resolve-module mod) var)) + (modref-cont mod var #f) + (bare-cont var))) + ((memv key '(primitive)) + (syntax-violation #f "primitive not in operator position" var)) + (else (syntax-violation #f "bad module kind" var mod)))))))) + (build-global-reference + (lambda (source var mod) + (analyze-variable + mod + var + (lambda (mod var public?) (make-module-ref source mod var public?)) + (lambda (var) (make-toplevel-ref source var))))) + (build-global-assignment + (lambda (source var exp mod) + (maybe-name-value! var exp) + (analyze-variable + mod + var + (lambda (mod var public?) + (make-module-set source mod var public? exp)) + (lambda (var) (make-toplevel-set source var exp))))) + (build-global-definition + (lambda (source var exp) + (maybe-name-value! var exp) + (make-toplevel-define source var exp))) + (build-simple-lambda + (lambda (src req rest vars meta exp) + (make-lambda + src + meta + (make-lambda-case src req #f rest #f '() vars exp #f)))) + (build-case-lambda + (lambda (src meta body) (make-lambda src meta body))) + (build-lambda-case + (lambda (src req opt rest kw inits vars body else-case) + (make-lambda-case src req opt rest kw inits vars body else-case))) + (build-primcall + (lambda (src name args) (make-primcall src name args))) + (build-primref (lambda (src name) (make-primitive-ref src name))) + (build-data (lambda (src exp) (make-const src exp))) + (build-sequence + (lambda (src exps) + (if (null? (cdr exps)) + (car exps) + (make-seq src (car exps) (build-sequence #f (cdr exps)))))) + (build-let + (lambda (src ids vars val-exps body-exp) + (for-each maybe-name-value! ids val-exps) + (if (null? vars) body-exp (make-let src ids vars val-exps body-exp)))) + (build-named-let + (lambda (src ids vars val-exps body-exp) + (let ((f (car vars)) (f-name (car ids)) (vars (cdr vars)) (ids (cdr ids))) + (let ((proc (build-simple-lambda src ids #f vars '() body-exp))) + (maybe-name-value! f-name proc) + (for-each maybe-name-value! ids val-exps) + (make-letrec + src + #f + (list f-name) + (list f) + (list proc) + (build-call src (build-lexical-reference 'fun src f-name f) val-exps)))))) + (build-letrec + (lambda (src in-order? ids vars val-exps body-exp) + (if (null? vars) + body-exp + (begin + (for-each maybe-name-value! ids val-exps) + (make-letrec src in-order? ids vars val-exps body-exp))))) + (syntax-object? + (lambda (x) + (or (syntax? x) + (and (allow-legacy-syntax-objects?) + (vector? x) + (= (vector-length x) 4) + (eqv? (vector-ref x 0) 'syntax-object))))) + (make-syntax-object + (lambda (expression wrap module) + (make-syntax expression wrap module))) + (syntax-object-expression + (lambda (obj) + (if (syntax? obj) (syntax-expression obj) (vector-ref obj 1)))) + (syntax-object-wrap + (lambda (obj) + (if (syntax? obj) (syntax-wrap obj) (vector-ref obj 2)))) + (syntax-object-module + (lambda (obj) + (if (syntax? obj) (syntax-module obj) (vector-ref obj 3)))) + (source-annotation + (lambda (x) + (let ((props (source-properties + (if (syntax-object? x) (syntax-object-expression x) x)))) + (and (pair? props) props)))) + (extend-env + (lambda (labels bindings r) + (if (null? labels) + r + (extend-env + (cdr labels) + (cdr bindings) + (cons (cons (car labels) (car bindings)) r))))) + (extend-var-env + (lambda (labels vars r) + (if (null? labels) + r + (extend-var-env + (cdr labels) + (cdr vars) + (cons (cons (car labels) (cons 'lexical (car vars))) r))))) + (macros-only-env + (lambda (r) + (if (null? r) + '() + (let ((a (car r))) + (if (memq (cadr a) '(macro syntax-parameter ellipsis)) + (cons a (macros-only-env (cdr r))) + (macros-only-env (cdr r))))))) + (global-extend + (lambda (type sym val) + (module-define! + (current-module) + sym + (make-syntax-transformer sym type val)))) + (nonsymbol-id? + (lambda (x) + (and (syntax-object? x) (symbol? (syntax-object-expression x))))) + (id? (lambda (x) + (if (symbol? x) + #t + (and (syntax-object? x) (symbol? (syntax-object-expression x)))))) + (id-sym-name&marks + (lambda (x w) + (if (syntax-object? x) + (values + (syntax-object-expression x) + (join-marks (car w) (car (syntax-object-wrap x)))) + (values x (car w))))) + (gen-label (lambda () (symbol->string (module-gensym "l")))) + (gen-labels + (lambda (ls) + (if (null? ls) '() (cons (gen-label) (gen-labels (cdr ls)))))) + (make-ribcage + (lambda (symnames marks labels) + (vector 'ribcage symnames marks labels))) + (ribcage? + (lambda (x) + (and (vector? x) + (= (vector-length x) 4) + (eq? (vector-ref x 0) 'ribcage)))) + (ribcage-symnames (lambda (x) (vector-ref x 1))) + (ribcage-marks (lambda (x) (vector-ref x 2))) + (ribcage-labels (lambda (x) (vector-ref x 3))) + (set-ribcage-symnames! (lambda (x update) (vector-set! x 1 update))) + (set-ribcage-marks! (lambda (x update) (vector-set! x 2 update))) + (set-ribcage-labels! (lambda (x update) (vector-set! x 3 update))) + (anti-mark + (lambda (w) (cons (cons #f (car w)) (cons 'shift (cdr w))))) + (extend-ribcage! + (lambda (ribcage id label) + (set-ribcage-symnames! + ribcage + (cons (syntax-object-expression id) (ribcage-symnames ribcage))) + (set-ribcage-marks! + ribcage + (cons (car (syntax-object-wrap id)) (ribcage-marks ribcage))) + (set-ribcage-labels! ribcage (cons label (ribcage-labels ribcage))))) + (make-binding-wrap + (lambda (ids labels w) + (if (null? ids) + w + (cons (car w) + (cons (let* ((labelvec (list->vector labels)) (n (vector-length labelvec))) + (let ((symnamevec (make-vector n)) (marksvec (make-vector n))) + (let f ((ids ids) (i 0)) + (if (not (null? ids)) + (call-with-values + (lambda () (id-sym-name&marks (car ids) w)) + (lambda (symname marks) + (vector-set! symnamevec i symname) + (vector-set! marksvec i marks) + (f (cdr ids) (+ i 1)))))) + (make-ribcage symnamevec marksvec labelvec))) + (cdr w)))))) + (smart-append (lambda (m1 m2) (if (null? m2) m1 (append m1 m2)))) + (join-wraps + (lambda (w1 w2) + (let ((m1 (car w1)) (s1 (cdr w1))) + (if (null? m1) + (if (null? s1) w2 (cons (car w2) (smart-append s1 (cdr w2)))) + (cons (smart-append m1 (car w2)) (smart-append s1 (cdr w2))))))) + (join-marks (lambda (m1 m2) (smart-append m1 m2))) + (same-marks? + (lambda (x y) + (or (eq? x y) + (and (not (null? x)) + (not (null? y)) + (eq? (car x) (car y)) + (same-marks? (cdr x) (cdr y)))))) + (id-var-name + (lambda (id w mod) + (letrec* + ((search + (lambda (sym subst marks mod) + (if (null? subst) + (values #f marks) + (let ((fst (car subst))) + (if (eq? fst 'shift) + (search sym (cdr subst) (cdr marks) mod) + (let ((symnames (ribcage-symnames fst))) + (if (vector? symnames) + (search-vector-rib sym subst marks symnames fst mod) + (search-list-rib sym subst marks symnames fst mod)))))))) + (search-list-rib + (lambda (sym subst marks symnames ribcage mod) + (let f ((symnames symnames) (i 0)) + (cond ((null? symnames) (search sym (cdr subst) marks mod)) + ((and (eq? (car symnames) sym) + (same-marks? marks (list-ref (ribcage-marks ribcage) i))) + (let ((n (list-ref (ribcage-labels ribcage) i))) + (if (pair? n) + (if (equal? mod (car n)) + (values (cdr n) marks) + (f (cdr symnames) (+ i 1))) + (values n marks)))) + (else (f (cdr symnames) (+ i 1))))))) + (search-vector-rib + (lambda (sym subst marks symnames ribcage mod) + (let ((n (vector-length symnames))) + (let f ((i 0)) + (cond ((= i n) (search sym (cdr subst) marks mod)) + ((and (eq? (vector-ref symnames i) sym) + (same-marks? marks (vector-ref (ribcage-marks ribcage) i))) + (let ((n (vector-ref (ribcage-labels ribcage) i))) + (if (pair? n) + (if (equal? mod (car n)) (values (cdr n) marks) (f (+ i 1))) + (values n marks)))) + (else (f (+ i 1))))))))) + (cond ((symbol? id) (or (search id (cdr w) (car w) mod) id)) + ((syntax-object? id) + (let ((id (syntax-object-expression id)) + (w1 (syntax-object-wrap id)) + (mod (syntax-object-module id))) + (let ((marks (join-marks (car w) (car w1)))) + (call-with-values + (lambda () (search id (cdr w) marks mod)) + (lambda (new-id marks) (or new-id (search id (cdr w1) marks mod) id)))))) + (else (syntax-violation 'id-var-name "invalid id" id)))))) + (locally-bound-identifiers + (lambda (w mod) + (letrec* + ((scan (lambda (subst results) + (if (null? subst) + results + (let ((fst (car subst))) + (if (eq? fst 'shift) + (scan (cdr subst) results) + (let ((symnames (ribcage-symnames fst)) (marks (ribcage-marks fst))) + (if (vector? symnames) + (scan-vector-rib subst symnames marks results) + (scan-list-rib subst symnames marks results)))))))) + (scan-list-rib + (lambda (subst symnames marks results) + (let f ((symnames symnames) (marks marks) (results results)) + (if (null? symnames) + (scan (cdr subst) results) + (f (cdr symnames) + (cdr marks) + (cons (wrap (car symnames) (anti-mark (cons (car marks) subst)) mod) + results)))))) + (scan-vector-rib + (lambda (subst symnames marks results) + (let ((n (vector-length symnames))) + (let f ((i 0) (results results)) + (if (= i n) + (scan (cdr subst) results) + (f (+ i 1) + (cons (wrap (vector-ref symnames i) + (anti-mark (cons (vector-ref marks i) subst)) + mod) + results)))))))) + (scan (cdr w) '())))) + (resolve-identifier + (lambda (id w r mod resolve-syntax-parameters?) + (letrec* + ((resolve-global + (lambda (var mod) + (if (and (not mod) (current-module)) + (warn "module system is booted, we should have a module" var)) + (let ((v (and (not (equal? mod '(primitive))) + (module-variable + (if mod (resolve-module (cdr mod)) (current-module)) + var)))) + (if (and v (variable-bound? v) (macro? (variable-ref v))) + (let* ((m (variable-ref v)) + (type (macro-type m)) + (trans (macro-binding m)) + (trans (if (pair? trans) (car trans) trans))) + (if (eq? type 'syntax-parameter) + (if resolve-syntax-parameters? + (let ((lexical (assq-ref r v))) + (values 'macro (if lexical (cdr lexical) trans) mod)) + (values type v mod)) + (values type trans mod))) + (values 'global var mod))))) + (resolve-lexical + (lambda (label mod) + (let ((b (assq-ref r label))) + (if b + (let ((type (car b)) (value (cdr b))) + (if (eq? type 'syntax-parameter) + (if resolve-syntax-parameters? + (values 'macro value mod) + (values type label mod)) + (values type value mod))) + (values 'displaced-lexical #f #f)))))) + (let ((n (id-var-name id w mod))) + (cond ((syntax-object? n) + (if (not (eq? n id)) + (resolve-identifier n w r mod resolve-syntax-parameters?) + (resolve-identifier + (syntax-object-expression n) + (syntax-object-wrap n) + r + (syntax-object-module n) + resolve-syntax-parameters?))) + ((symbol? n) + (resolve-global + n + (if (syntax-object? id) (syntax-object-module id) mod))) + ((string? n) + (resolve-lexical + n + (if (syntax-object? id) (syntax-object-module id) mod))) + (else (error "unexpected id-var-name" id w n))))))) + (transformer-environment + (make-fluid + (lambda (k) + (error "called outside the dynamic extent of a syntax transformer")))) + (with-transformer-environment + (lambda (k) ((fluid-ref transformer-environment) k))) + (free-id=? + (lambda (i j) + (let* ((mi (and (syntax-object? i) (syntax-object-module i))) + (mj (and (syntax-object? j) (syntax-object-module j))) + (ni (id-var-name i '(()) mi)) + (nj (id-var-name j '(()) mj))) + (letrec* + ((id-module-binding + (lambda (id mod) + (module-variable + (if mod (resolve-module (cdr mod)) (current-module)) + (let ((x id)) (if (syntax-object? x) (syntax-object-expression x) x)))))) + (cond ((syntax-object? ni) (free-id=? ni j)) + ((syntax-object? nj) (free-id=? i nj)) + ((symbol? ni) + (and (eq? nj + (let ((x j)) (if (syntax-object? x) (syntax-object-expression x) x))) + (let ((bi (id-module-binding i mi))) + (if bi + (eq? bi (id-module-binding j mj)) + (and (not (id-module-binding j mj)) (eq? ni nj)))) + (eq? (id-module-binding i mi) (id-module-binding j mj)))) + (else (equal? ni nj))))))) + (bound-id=? + (lambda (i j) + (if (and (syntax-object? i) (syntax-object? j)) + (and (eq? (syntax-object-expression i) (syntax-object-expression j)) + (same-marks? + (car (syntax-object-wrap i)) + (car (syntax-object-wrap j)))) + (eq? i j)))) + (valid-bound-ids? + (lambda (ids) + (and (let all-ids? ((ids ids)) + (or (null? ids) (and (id? (car ids)) (all-ids? (cdr ids))))) + (distinct-bound-ids? ids)))) + (distinct-bound-ids? + (lambda (ids) + (let distinct? ((ids ids)) + (or (null? ids) + (and (not (bound-id-member? (car ids) (cdr ids))) + (distinct? (cdr ids))))))) + (bound-id-member? + (lambda (x list) + (and (not (null? list)) + (or (bound-id=? x (car list)) (bound-id-member? x (cdr list)))))) + (wrap (lambda (x w defmod) + (cond ((and (null? (car w)) (null? (cdr w))) x) + ((syntax-object? x) + (make-syntax-object + (syntax-object-expression x) + (join-wraps w (syntax-object-wrap x)) + (syntax-object-module x))) + ((null? x) x) + (else (make-syntax-object x w defmod))))) + (source-wrap + (lambda (x w s defmod) (wrap (decorate-source x s) w defmod))) + (expand-sequence + (lambda (body r w s mod) + (build-sequence + s + (let dobody ((body body) (r r) (w w) (mod mod)) + (if (null? body) + '() + (let ((first (expand (car body) r w mod))) + (cons first (dobody (cdr body) r w mod)))))))) + (expand-top-sequence + (lambda (body r w s m esew mod) + (let* ((r (cons '("placeholder" placeholder) r)) + (ribcage (make-ribcage '() '() '())) + (w (cons (car w) (cons ribcage (cdr w))))) + (letrec* + ((record-definition! + (lambda (id var) + (let ((mod (cons 'hygiene (module-name (current-module))))) + (extend-ribcage! + ribcage + id + (cons (syntax-object-module id) (wrap var '((top)) mod)))))) + (macro-introduced-identifier? + (lambda (id) (not (equal? (car (syntax-object-wrap id)) '(top))))) + (fresh-derived-name + (lambda (id orig-form) + (symbol-append + (syntax-object-expression id) + '- + (string->symbol + (number->string + (hash (syntax->datum orig-form) most-positive-fixnum) + 16))))) + (parse (lambda (body r w s m esew mod) + (let lp ((body body) (exps '())) + (if (null? body) + exps + (lp (cdr body) (append (parse1 (car body) r w s m esew mod) exps)))))) + (parse1 + (lambda (x r w s m esew mod) + (letrec* + ((current-module-for-expansion + (lambda (mod) + (let ((key (car mod))) + (if (memv key '(hygiene)) + (cons 'hygiene (module-name (current-module))) + mod))))) + (call-with-values + (lambda () + (let ((mod (current-module-for-expansion mod))) + (syntax-type x r w (source-annotation x) ribcage mod #f))) + (lambda (type value form e w s mod) + (let ((key type)) + (cond ((memv key '(define-form)) + (let* ((id (wrap value w mod)) + (label (gen-label)) + (var (if (macro-introduced-identifier? id) + (fresh-derived-name id x) + (syntax-object-expression id)))) + (record-definition! id var) + (list (if (eq? m 'c&e) + (let ((x (build-global-definition s var (expand e r w mod)))) + (top-level-eval-hook x mod) + (lambda () x)) + (call-with-values + (lambda () (resolve-identifier id '(()) r mod #t)) + (lambda (type* value* mod*) + (if (eq? type* 'macro) + (top-level-eval-hook + (build-global-definition s var (build-void s)) + mod)) + (lambda () (build-global-definition s var (expand e r w mod))))))))) + ((memv key '(define-syntax-form define-syntax-parameter-form)) + (let* ((id (wrap value w mod)) + (label (gen-label)) + (var (if (macro-introduced-identifier? id) + (fresh-derived-name id x) + (syntax-object-expression id)))) + (record-definition! id var) + (let ((key m)) + (cond ((memv key '(c)) + (cond ((memq 'compile esew) + (let ((e (expand-install-global var type (expand e r w mod)))) + (top-level-eval-hook e mod) + (if (memq 'load esew) (list (lambda () e)) '()))) + ((memq 'load esew) + (list (lambda () + (expand-install-global var type (expand e r w mod))))) + (else '()))) + ((memv key '(c&e)) + (let ((e (expand-install-global var type (expand e r w mod)))) + (top-level-eval-hook e mod) + (list (lambda () e)))) + (else + (if (memq 'eval esew) + (top-level-eval-hook + (expand-install-global var type (expand e r w mod)) + mod)) + '()))))) + ((memv key '(begin-form)) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ . each-any)))) + (if tmp + (apply (lambda (e1) (parse e1 r w s m esew mod)) tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))) + ((memv key '(local-syntax-form)) + (expand-local-syntax + value + e + r + w + s + mod + (lambda (forms r w s mod) (parse forms r w s m esew mod)))) + ((memv key '(eval-when-form)) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ each-any any . each-any)))) + (if tmp + (apply (lambda (x e1 e2) + (let ((when-list (parse-when-list e x)) (body (cons e1 e2))) + (letrec* + ((recurse (lambda (m esew) (parse body r w s m esew mod)))) + (cond ((eq? m 'e) + (if (memq 'eval when-list) + (recurse (if (memq 'expand when-list) 'c&e 'e) '(eval)) + (begin + (if (memq 'expand when-list) + (top-level-eval-hook + (expand-top-sequence body r w s 'e '(eval) mod) + mod)) + '()))) + ((memq 'load when-list) + (cond ((or (memq 'compile when-list) + (memq 'expand when-list) + (and (eq? m 'c&e) (memq 'eval when-list))) + (recurse 'c&e '(compile load))) + ((memq m '(c c&e)) (recurse 'c '(load))) + (else '()))) + ((or (memq 'compile when-list) + (memq 'expand when-list) + (and (eq? m 'c&e) (memq 'eval when-list))) + (top-level-eval-hook + (expand-top-sequence body r w s 'e '(eval) mod) + mod) + '()) + (else '()))))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))) + (else + (list (if (eq? m 'c&e) + (let ((x (expand-expr type value form e r w s mod))) + (top-level-eval-hook x mod) + (lambda () x)) + (lambda () (expand-expr type value form e r w s mod))))))))))))) + (let ((exps (map (lambda (x) (x)) (reverse (parse body r w s m esew mod))))) + (if (null? exps) (build-void s) (build-sequence s exps))))))) + (expand-install-global + (lambda (name type e) + (build-global-definition + #f + name + (build-primcall + #f + 'make-syntax-transformer + (list (build-data #f name) + (build-data + #f + (if (eq? type 'define-syntax-parameter-form) + 'syntax-parameter + 'macro)) + e))))) + (parse-when-list + (lambda (e when-list) + (let ((result (strip when-list '(())))) + (let lp ((l result)) + (cond ((null? l) result) + ((memq (car l) '(compile load eval expand)) (lp (cdr l))) + (else (syntax-violation 'eval-when "invalid situation" e (car l)))))))) + (syntax-type + (lambda (e r w s rib mod for-car?) + (cond ((symbol? e) + (call-with-values + (lambda () (resolve-identifier e w r mod #t)) + (lambda (type value mod*) + (let ((key type)) + (cond ((memv key '(macro)) + (if for-car? + (values type value e e w s mod) + (syntax-type + (expand-macro value e r w s rib mod) + r + '(()) + s + rib + mod + #f))) + ((memv key '(global)) (values type value e value w s mod*)) + (else (values type value e e w s mod))))))) + ((pair? e) + (let ((first (car e))) + (call-with-values + (lambda () (syntax-type first r w s rib mod #t)) + (lambda (ftype fval fform fe fw fs fmod) + (let ((key ftype)) + (cond ((memv key '(lexical)) (values 'lexical-call fval e e w s mod)) + ((memv key '(global)) + (if (equal? fmod '(primitive)) + (values 'primitive-call fval e e w s mod) + (values 'global-call (make-syntax-object fval w fmod) e e w s mod))) + ((memv key '(macro)) + (syntax-type + (expand-macro fval e r w s rib mod) + r + '(()) + s + rib + mod + for-car?)) + ((memv key '(module-ref)) + (call-with-values + (lambda () (fval e r w mod)) + (lambda (e r w s mod) (syntax-type e r w s rib mod for-car?)))) + ((memv key '(core)) (values 'core-form fval e e w s mod)) + ((memv key '(local-syntax)) + (values 'local-syntax-form fval e e w s mod)) + ((memv key '(begin)) (values 'begin-form #f e e w s mod)) + ((memv key '(eval-when)) (values 'eval-when-form #f e e w s mod)) + ((memv key '(define)) + (let* ((tmp e) (tmp-1 ($sc-dispatch tmp '(_ any any)))) + (if (and tmp-1 (apply (lambda (name val) (id? name)) tmp-1)) + (apply (lambda (name val) (values 'define-form name e val w s mod)) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ (any . any) any . each-any)))) + (if (and tmp-1 + (apply (lambda (name args e1 e2) + (and (id? name) (valid-bound-ids? (lambda-var-list args)))) + tmp-1)) + (apply (lambda (name args e1 e2) + (values + 'define-form + (wrap name w mod) + (wrap e w mod) + (decorate-source + (cons (make-syntax 'lambda '((top)) '(hygiene guile)) + (wrap (cons args (cons e1 e2)) w mod)) + s) + '(()) + s + mod)) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ any)))) + (if (and tmp-1 (apply (lambda (name) (id? name)) tmp-1)) + (apply (lambda (name) + (values + 'define-form + (wrap name w mod) + (wrap e w mod) + (list (make-syntax 'if '((top)) '(hygiene guile)) #f #f) + '(()) + s + mod)) + tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp)))))))) + ((memv key '(define-syntax)) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ any any)))) + (if (and tmp (apply (lambda (name val) (id? name)) tmp)) + (apply (lambda (name val) (values 'define-syntax-form name e val w s mod)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))) + ((memv key '(define-syntax-parameter)) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ any any)))) + (if (and tmp (apply (lambda (name val) (id? name)) tmp)) + (apply (lambda (name val) + (values 'define-syntax-parameter-form name e val w s mod)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))) + (else (values 'call #f e e w s mod)))))))) + ((syntax-object? e) + (syntax-type + (syntax-object-expression e) + r + (join-wraps w (syntax-object-wrap e)) + (or (source-annotation e) s) + rib + (or (syntax-object-module e) mod) + for-car?)) + ((self-evaluating? e) (values 'constant #f e e w s mod)) + (else (values 'other #f e e w s mod))))) + (expand + (lambda (e r w mod) + (call-with-values + (lambda () (syntax-type e r w (source-annotation e) #f mod #f)) + (lambda (type value form e w s mod) + (expand-expr type value form e r w s mod))))) + (expand-expr + (lambda (type value form e r w s mod) + (let ((key type)) + (cond ((memv key '(lexical)) (build-lexical-reference 'value s e value)) + ((memv key '(core core-form)) (value e r w s mod)) + ((memv key '(module-ref)) + (call-with-values + (lambda () (value e r w mod)) + (lambda (e r w s mod) (expand e r w mod)))) + ((memv key '(lexical-call)) + (expand-call + (let ((id (car e))) + (build-lexical-reference + 'fun + (source-annotation id) + (if (syntax-object? id) (syntax->datum id) id) + value)) + e + r + w + s + mod)) + ((memv key '(global-call)) + (expand-call + (build-global-reference + (source-annotation (car e)) + (if (syntax-object? value) (syntax-object-expression value) value) + (if (syntax-object? value) (syntax-object-module value) mod)) + e + r + w + s + mod)) + ((memv key '(primitive-call)) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ . each-any)))) + (if tmp + (apply (lambda (e) + (build-primcall s value (map (lambda (e) (expand e r w mod)) e))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))) + ((memv key '(constant)) + (build-data s (strip (source-wrap e w s mod) '(())))) + ((memv key '(global)) (build-global-reference s value mod)) + ((memv key '(call)) + (expand-call (expand (car e) r w mod) e r w s mod)) + ((memv key '(begin-form)) + (let* ((tmp e) (tmp-1 ($sc-dispatch tmp '(_ any . each-any)))) + (if tmp-1 + (apply (lambda (e1 e2) (expand-sequence (cons e1 e2) r w s mod)) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_)))) + (if tmp-1 + (apply (lambda () + (syntax-violation + #f + "sequence of zero expressions" + (source-wrap e w s mod))) + tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp)))))) + ((memv key '(local-syntax-form)) + (expand-local-syntax value e r w s mod expand-sequence)) + ((memv key '(eval-when-form)) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ each-any any . each-any)))) + (if tmp + (apply (lambda (x e1 e2) + (let ((when-list (parse-when-list e x))) + (if (memq 'eval when-list) + (expand-sequence (cons e1 e2) r w s mod) + (expand-void)))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))) + ((memv key + '(define-form define-syntax-form define-syntax-parameter-form)) + (syntax-violation + #f + "definition in expression context, where definitions are not allowed," + (source-wrap form w s mod))) + ((memv key '(syntax)) + (syntax-violation + #f + "reference to pattern variable outside syntax form" + (source-wrap e w s mod))) + ((memv key '(displaced-lexical)) + (syntax-violation + #f + "reference to identifier outside its scope" + (source-wrap e w s mod))) + (else + (syntax-violation #f "unexpected syntax" (source-wrap e w s mod))))))) + (expand-call + (lambda (x e r w s mod) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(any . each-any)))) + (if tmp + (apply (lambda (e0 e1) + (build-call s x (map (lambda (e) (expand e r w mod)) e1))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))) + (expand-macro + (lambda (p e r w s rib mod) + (letrec* + ((rebuild-macro-output + (lambda (x m) + (cond ((pair? x) + (decorate-source + (cons (rebuild-macro-output (car x) m) + (rebuild-macro-output (cdr x) m)) + s)) + ((syntax-object? x) + (let ((w (syntax-object-wrap x))) + (let ((ms (car w)) (ss (cdr w))) + (if (and (pair? ms) (eq? (car ms) #f)) + (make-syntax-object + (syntax-object-expression x) + (cons (cdr ms) (if rib (cons rib (cdr ss)) (cdr ss))) + (syntax-object-module x)) + (make-syntax-object + (decorate-source (syntax-object-expression x) s) + (cons (cons m ms) + (if rib (cons rib (cons 'shift ss)) (cons 'shift ss))) + (syntax-object-module x)))))) + ((vector? x) + (let* ((n (vector-length x)) (v (decorate-source (make-vector n) s))) + (let loop ((i 0)) + (if (= i n) + (begin (if #f #f) v) + (begin + (vector-set! v i (rebuild-macro-output (vector-ref x i) m)) + (loop (+ i 1))))))) + ((symbol? x) + (syntax-violation + #f + "encountered raw symbol in macro output" + (source-wrap e w (cdr w) mod) + x)) + (else (decorate-source x s)))))) + (let* ((t-680b775fb37a463-7d8 transformer-environment) + (t-680b775fb37a463-7d9 (lambda (k) (k e r w s rib mod)))) + (with-fluid* + t-680b775fb37a463-7d8 + t-680b775fb37a463-7d9 + (lambda () + (rebuild-macro-output + (p (source-wrap e (anti-mark w) s mod)) + (module-gensym "m")))))))) + (expand-body + (lambda (body outer-form r w mod) + (let* ((r (cons '("placeholder" placeholder) r)) + (ribcage (make-ribcage '() '() '())) + (w (cons (car w) (cons ribcage (cdr w))))) + (let parse ((body (map (lambda (x) (cons r (wrap x w mod))) body)) + (ids '()) + (labels '()) + (var-ids '()) + (vars '()) + (vals '()) + (bindings '())) + (if (null? body) + (syntax-violation #f "no expressions in body" outer-form) + (let ((e (cdar body)) (er (caar body))) + (call-with-values + (lambda () + (syntax-type e er '(()) (source-annotation e) ribcage mod #f)) + (lambda (type value form e w s mod) + (let ((key type)) + (cond ((memv key '(define-form)) + (let ((id (wrap value w mod)) (label (gen-label))) + (let ((var (gen-var id))) + (extend-ribcage! ribcage id label) + (parse (cdr body) + (cons id ids) + (cons label labels) + (cons id var-ids) + (cons var vars) + (cons (cons er (wrap e w mod)) vals) + (cons (cons 'lexical var) bindings))))) + ((memv key '(define-syntax-form)) + (let ((id (wrap value w mod)) + (label (gen-label)) + (trans-r (macros-only-env er))) + (extend-ribcage! ribcage id label) + (set-cdr! + r + (extend-env + (list label) + (list (cons 'macro (eval-local-transformer (expand e trans-r w mod) mod))) + (cdr r))) + (parse (cdr body) (cons id ids) labels var-ids vars vals bindings))) + ((memv key '(define-syntax-parameter-form)) + (let ((id (wrap value w mod)) + (label (gen-label)) + (trans-r (macros-only-env er))) + (extend-ribcage! ribcage id label) + (set-cdr! + r + (extend-env + (list label) + (list (cons 'syntax-parameter + (eval-local-transformer (expand e trans-r w mod) mod))) + (cdr r))) + (parse (cdr body) (cons id ids) labels var-ids vars vals bindings))) + ((memv key '(begin-form)) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ . each-any)))) + (if tmp + (apply (lambda (e1) + (parse (let f ((forms e1)) + (if (null? forms) + (cdr body) + (cons (cons er (wrap (car forms) w mod)) (f (cdr forms))))) + ids + labels + var-ids + vars + vals + bindings)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))) + ((memv key '(local-syntax-form)) + (expand-local-syntax + value + e + er + w + s + mod + (lambda (forms er w s mod) + (parse (let f ((forms forms)) + (if (null? forms) + (cdr body) + (cons (cons er (wrap (car forms) w mod)) (f (cdr forms))))) + ids + labels + var-ids + vars + vals + bindings)))) + ((null? ids) + (build-sequence + #f + (map (lambda (x) (expand (cdr x) (car x) '(()) mod)) + (cons (cons er (source-wrap e w s mod)) (cdr body))))) + (else + (if (not (valid-bound-ids? ids)) + (syntax-violation + #f + "invalid or duplicate identifier in definition" + outer-form)) + (set-cdr! r (extend-env labels bindings (cdr r))) + (build-letrec + #f + #t + (reverse (map syntax->datum var-ids)) + (reverse vars) + (map (lambda (x) (expand (cdr x) (car x) '(()) mod)) (reverse vals)) + (build-sequence + #f + (map (lambda (x) (expand (cdr x) (car x) '(()) mod)) + (cons (cons er (source-wrap e w s mod)) (cdr body)))))))))))))))) + (expand-local-syntax + (lambda (rec? e r w s mod k) + (let* ((tmp e) + (tmp ($sc-dispatch tmp '(_ #(each (any any)) any . each-any)))) + (if tmp + (apply (lambda (id val e1 e2) + (let ((ids id)) + (if (not (valid-bound-ids? ids)) + (syntax-violation #f "duplicate bound keyword" e) + (let* ((labels (gen-labels ids)) (new-w (make-binding-wrap ids labels w))) + (k (cons e1 e2) + (extend-env + labels + (let ((w (if rec? new-w w)) (trans-r (macros-only-env r))) + (map (lambda (x) + (cons 'macro (eval-local-transformer (expand x trans-r w mod) mod))) + val)) + r) + new-w + s + mod))))) + tmp) + (syntax-violation + #f + "bad local syntax definition" + (source-wrap e w s mod)))))) + (eval-local-transformer + (lambda (expanded mod) + (let ((p (local-eval-hook expanded mod))) + (if (procedure? p) + p + (syntax-violation #f "nonprocedure transformer" p))))) + (expand-void (lambda () (build-void #f))) + (ellipsis? + (lambda (e r mod) + (and (nonsymbol-id? e) + (call-with-values + (lambda () + (resolve-identifier + (make-syntax-object + '#{ $sc-ellipsis }# + (syntax-object-wrap e) + (syntax-object-module e)) + '(()) + r + mod + #f)) + (lambda (type value mod) + (if (eq? type 'ellipsis) + (bound-id=? e value) + (free-id=? e (make-syntax '... '((top)) '(hygiene guile))))))))) + (lambda-formals + (lambda (orig-args) + (letrec* + ((req (lambda (args rreq) + (let* ((tmp args) (tmp-1 ($sc-dispatch tmp '()))) + (if tmp-1 + (apply (lambda () (check (reverse rreq) #f)) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if (and tmp-1 (apply (lambda (a b) (id? a)) tmp-1)) + (apply (lambda (a b) (req b (cons a rreq))) tmp-1) + (let ((tmp-1 (list tmp))) + (if (and tmp-1 (apply (lambda (r) (id? r)) tmp-1)) + (apply (lambda (r) (check (reverse rreq) r)) tmp-1) + (let ((else tmp)) + (syntax-violation 'lambda "invalid argument list" orig-args args)))))))))) + (check (lambda (req rest) + (if (distinct-bound-ids? (if rest (cons rest req) req)) + (values req #f rest #f) + (syntax-violation + 'lambda + "duplicate identifier in argument list" + orig-args))))) + (req orig-args '())))) + (expand-simple-lambda + (lambda (e r w s mod req rest meta body) + (let* ((ids (if rest (append req (list rest)) req)) + (vars (map gen-var ids)) + (labels (gen-labels ids))) + (build-simple-lambda + s + (map syntax->datum req) + (and rest (syntax->datum rest)) + vars + meta + (expand-body + body + (source-wrap e w s mod) + (extend-var-env labels vars r) + (make-binding-wrap ids labels w) + mod))))) + (lambda*-formals + (lambda (orig-args) + (letrec* + ((req (lambda (args rreq) + (let* ((tmp args) (tmp-1 ($sc-dispatch tmp '()))) + (if tmp-1 + (apply (lambda () (check (reverse rreq) '() #f '())) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if (and tmp-1 (apply (lambda (a b) (id? a)) tmp-1)) + (apply (lambda (a b) (req b (cons a rreq))) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if (and tmp-1 + (apply (lambda (a b) (eq? (syntax->datum a) #:optional)) tmp-1)) + (apply (lambda (a b) (opt b (reverse rreq) '())) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if (and tmp-1 + (apply (lambda (a b) (eq? (syntax->datum a) #:key)) tmp-1)) + (apply (lambda (a b) (key b (reverse rreq) '() '())) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any any)))) + (if (and tmp-1 + (apply (lambda (a b) (eq? (syntax->datum a) #:rest)) tmp-1)) + (apply (lambda (a b) (rest b (reverse rreq) '() '())) tmp-1) + (let ((tmp-1 (list tmp))) + (if (and tmp-1 (apply (lambda (r) (id? r)) tmp-1)) + (apply (lambda (r) (rest r (reverse rreq) '() '())) tmp-1) + (let ((else tmp)) + (syntax-violation + 'lambda* + "invalid argument list" + orig-args + args)))))))))))))))) + (opt (lambda (args req ropt) + (let* ((tmp args) (tmp-1 ($sc-dispatch tmp '()))) + (if tmp-1 + (apply (lambda () (check req (reverse ropt) #f '())) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if (and tmp-1 (apply (lambda (a b) (id? a)) tmp-1)) + (apply (lambda (a b) (opt b req (cons (cons a '(#f)) ropt))) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '((any any) . any)))) + (if (and tmp-1 (apply (lambda (a init b) (id? a)) tmp-1)) + (apply (lambda (a init b) (opt b req (cons (list a init) ropt))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if (and tmp-1 + (apply (lambda (a b) (eq? (syntax->datum a) #:key)) tmp-1)) + (apply (lambda (a b) (key b req (reverse ropt) '())) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any any)))) + (if (and tmp-1 + (apply (lambda (a b) (eq? (syntax->datum a) #:rest)) tmp-1)) + (apply (lambda (a b) (rest b req (reverse ropt) '())) tmp-1) + (let ((tmp-1 (list tmp))) + (if (and tmp-1 (apply (lambda (r) (id? r)) tmp-1)) + (apply (lambda (r) (rest r req (reverse ropt) '())) tmp-1) + (let ((else tmp)) + (syntax-violation + 'lambda* + "invalid optional argument list" + orig-args + args)))))))))))))))) + (key (lambda (args req opt rkey) + (let* ((tmp args) (tmp-1 ($sc-dispatch tmp '()))) + (if tmp-1 + (apply (lambda () (check req opt #f (cons #f (reverse rkey)))) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if (and tmp-1 (apply (lambda (a b) (id? a)) tmp-1)) + (apply (lambda (a b) + (let* ((tmp (symbol->keyword (syntax->datum a))) (k tmp)) + (key b req opt (cons (cons k (cons a '(#f))) rkey)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '((any any) . any)))) + (if (and tmp-1 (apply (lambda (a init b) (id? a)) tmp-1)) + (apply (lambda (a init b) + (let* ((tmp (symbol->keyword (syntax->datum a))) (k tmp)) + (key b req opt (cons (list k a init) rkey)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '((any any any) . any)))) + (if (and tmp-1 + (apply (lambda (a init k b) (and (id? a) (keyword? (syntax->datum k)))) + tmp-1)) + (apply (lambda (a init k b) (key b req opt (cons (list k a init) rkey))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any)))) + (if (and tmp-1 + (apply (lambda (aok) (eq? (syntax->datum aok) #:allow-other-keys)) + tmp-1)) + (apply (lambda (aok) (check req opt #f (cons #t (reverse rkey)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any any any)))) + (if (and tmp-1 + (apply (lambda (aok a b) + (and (eq? (syntax->datum aok) #:allow-other-keys) + (eq? (syntax->datum a) #:rest))) + tmp-1)) + (apply (lambda (aok a b) (rest b req opt (cons #t (reverse rkey)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if (and tmp-1 + (apply (lambda (aok r) + (and (eq? (syntax->datum aok) #:allow-other-keys) + (id? r))) + tmp-1)) + (apply (lambda (aok r) (rest r req opt (cons #t (reverse rkey)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any any)))) + (if (and tmp-1 + (apply (lambda (a b) (eq? (syntax->datum a) #:rest)) tmp-1)) + (apply (lambda (a b) (rest b req opt (cons #f (reverse rkey)))) + tmp-1) + (let ((tmp-1 (list tmp))) + (if (and tmp-1 (apply (lambda (r) (id? r)) tmp-1)) + (apply (lambda (r) (rest r req opt (cons #f (reverse rkey)))) + tmp-1) + (let ((else tmp)) + (syntax-violation + 'lambda* + "invalid keyword argument list" + orig-args + args)))))))))))))))))))))) + (rest (lambda (args req opt kw) + (let* ((tmp-1 args) (tmp (list tmp-1))) + (if (and tmp (apply (lambda (r) (id? r)) tmp)) + (apply (lambda (r) (check req opt r kw)) tmp) + (let ((else tmp-1)) + (syntax-violation 'lambda* "invalid rest argument" orig-args args)))))) + (check (lambda (req opt rest kw) + (if (distinct-bound-ids? + (append + req + (map car opt) + (if rest (list rest) '()) + (if (pair? kw) (map cadr (cdr kw)) '()))) + (values req opt rest kw) + (syntax-violation + 'lambda* + "duplicate identifier in argument list" + orig-args))))) + (req orig-args '())))) + (expand-lambda-case + (lambda (e r w s mod get-formals clauses) + (letrec* + ((parse-req + (lambda (req opt rest kw body) + (let ((vars (map gen-var req)) (labels (gen-labels req))) + (let ((r* (extend-var-env labels vars r)) + (w* (make-binding-wrap req labels w))) + (parse-opt + (map syntax->datum req) + opt + rest + kw + body + (reverse vars) + r* + w* + '() + '()))))) + (parse-opt + (lambda (req opt rest kw body vars r* w* out inits) + (cond ((pair? opt) + (let* ((tmp-1 (car opt)) (tmp ($sc-dispatch tmp-1 '(any any)))) + (if tmp + (apply (lambda (id i) + (let* ((v (gen-var id)) + (l (gen-labels (list v))) + (r** (extend-var-env l (list v) r*)) + (w** (make-binding-wrap (list id) l w*))) + (parse-opt + req + (cdr opt) + rest + kw + body + (cons v vars) + r** + w** + (cons (syntax->datum id) out) + (cons (expand i r* w* mod) inits)))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))) + (rest + (let* ((v (gen-var rest)) + (l (gen-labels (list v))) + (r* (extend-var-env l (list v) r*)) + (w* (make-binding-wrap (list rest) l w*))) + (parse-kw + req + (and (pair? out) (reverse out)) + (syntax->datum rest) + (if (pair? kw) (cdr kw) kw) + body + (cons v vars) + r* + w* + (and (pair? kw) (car kw)) + '() + inits))) + (else + (parse-kw + req + (and (pair? out) (reverse out)) + #f + (if (pair? kw) (cdr kw) kw) + body + vars + r* + w* + (and (pair? kw) (car kw)) + '() + inits))))) + (parse-kw + (lambda (req opt rest kw body vars r* w* aok out inits) + (if (pair? kw) + (let* ((tmp-1 (car kw)) (tmp ($sc-dispatch tmp-1 '(any any any)))) + (if tmp + (apply (lambda (k id i) + (let* ((v (gen-var id)) + (l (gen-labels (list v))) + (r** (extend-var-env l (list v) r*)) + (w** (make-binding-wrap (list id) l w*))) + (parse-kw + req + opt + rest + (cdr kw) + body + (cons v vars) + r** + w** + aok + (cons (list (syntax->datum k) (syntax->datum id) v) out) + (cons (expand i r* w* mod) inits)))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))) + (parse-body + req + opt + rest + (and (or aok (pair? out)) (cons aok (reverse out))) + body + (reverse vars) + r* + w* + (reverse inits) + '())))) + (parse-body + (lambda (req opt rest kw body vars r* w* inits meta) + (let* ((tmp body) (tmp-1 ($sc-dispatch tmp '(any any . each-any)))) + (if (and tmp-1 + (apply (lambda (docstring e1 e2) (string? (syntax->datum docstring))) + tmp-1)) + (apply (lambda (docstring e1 e2) + (parse-body + req + opt + rest + kw + (cons e1 e2) + vars + r* + w* + inits + (append meta (list (cons 'documentation (syntax->datum docstring)))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(vector #(each (any . any))) any . each-any)))) + (if tmp-1 + (apply (lambda (k v e1 e2) + (parse-body + req + opt + rest + kw + (cons e1 e2) + vars + r* + w* + inits + (append meta (syntax->datum (map cons k v))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . each-any)))) + (if tmp-1 + (apply (lambda (e1 e2) + (values + meta + req + opt + rest + kw + inits + vars + (expand-body (cons e1 e2) (source-wrap e w s mod) r* w* mod))) + tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp)))))))))) + (let* ((tmp clauses) (tmp-1 ($sc-dispatch tmp '()))) + (if tmp-1 + (apply (lambda () (values '() #f)) tmp-1) + (let ((tmp-1 ($sc-dispatch + tmp + '((any any . each-any) . #(each (any any . each-any)))))) + (if tmp-1 + (apply (lambda (args e1 e2 args* e1* e2*) + (call-with-values + (lambda () (get-formals args)) + (lambda (req opt rest kw) + (call-with-values + (lambda () (parse-req req opt rest kw (cons e1 e2))) + (lambda (meta req opt rest kw inits vars body) + (call-with-values + (lambda () + (expand-lambda-case + e + r + w + s + mod + get-formals + (map (lambda (tmp-680b775fb37a463-ac9 + tmp-680b775fb37a463-ac8 + tmp-680b775fb37a463-ac7) + (cons tmp-680b775fb37a463-ac7 + (cons tmp-680b775fb37a463-ac8 tmp-680b775fb37a463-ac9))) + e2* + e1* + args*))) + (lambda (meta* else*) + (values + (append meta meta*) + (build-lambda-case s req opt rest kw inits vars body else*))))))))) + tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp)))))))) + (strip (lambda (x w) + (if (memq 'top (car w)) + x + (let f ((x x)) + (cond ((syntax-object? x) + (strip (syntax-object-expression x) (syntax-object-wrap x))) + ((pair? x) + (let ((a (f (car x))) (d (f (cdr x)))) + (if (and (eq? a (car x)) (eq? d (cdr x))) x (cons a d)))) + ((vector? x) + (let* ((old (vector->list x)) (new (map f old))) + (let lp ((l1 old) (l2 new)) + (cond ((null? l1) x) + ((eq? (car l1) (car l2)) (lp (cdr l1) (cdr l2))) + (else (list->vector new)))))) + (else x)))))) + (gen-var + (lambda (id) + (let ((id (if (syntax-object? id) (syntax-object-expression id) id))) + (module-gensym (symbol->string id))))) + (lambda-var-list + (lambda (vars) + (let lvl ((vars vars) (ls '()) (w '(()))) + (cond ((pair? vars) (lvl (cdr vars) (cons (wrap (car vars) w #f) ls) w)) + ((id? vars) (cons (wrap vars w #f) ls)) + ((null? vars) ls) + ((syntax-object? vars) + (lvl (syntax-object-expression vars) + ls + (join-wraps w (syntax-object-wrap vars)))) + (else (cons vars ls))))))) + (global-extend 'local-syntax 'letrec-syntax #t) + (global-extend 'local-syntax 'let-syntax #f) + (global-extend + 'core + 'syntax-parameterize + (lambda (e r w s mod) + (let* ((tmp e) + (tmp ($sc-dispatch tmp '(_ #(each (any any)) any . each-any)))) + (if (and tmp (apply (lambda (var val e1 e2) (valid-bound-ids? var)) tmp)) + (apply (lambda (var val e1 e2) + (let ((names (map (lambda (x) + (call-with-values + (lambda () (resolve-identifier x w r mod #f)) + (lambda (type value mod) + (let ((key type)) + (cond ((memv key '(displaced-lexical)) + (syntax-violation + 'syntax-parameterize + "identifier out of context" + e + (source-wrap x w s mod))) + ((memv key '(syntax-parameter)) value) + (else + (syntax-violation + 'syntax-parameterize + "invalid syntax parameter" + e + (source-wrap x w s mod)))))))) + var)) + (bindings + (let ((trans-r (macros-only-env r))) + (map (lambda (x) + (cons 'syntax-parameter + (eval-local-transformer (expand x trans-r w mod) mod))) + val)))) + (expand-body + (cons e1 e2) + (source-wrap e w s mod) + (extend-env names bindings r) + w + mod))) + tmp) + (syntax-violation + 'syntax-parameterize + "bad syntax" + (source-wrap e w s mod)))))) + (global-extend + 'core + 'quote + (lambda (e r w s mod) + (let* ((tmp e) (tmp ($sc-dispatch tmp '(_ any)))) + (if tmp + (apply (lambda (e) (build-data s (strip e w))) tmp) + (syntax-violation 'quote "bad syntax" (source-wrap e w s mod)))))) + (global-extend + 'core + 'syntax + (letrec* + ((gen-syntax + (lambda (src e r maps ellipsis? mod) + (if (id? e) + (call-with-values + (lambda () (resolve-identifier e '(()) r mod #f)) + (lambda (type value mod) + (let ((key type)) + (cond ((memv key '(syntax)) + (call-with-values + (lambda () (gen-ref src (car value) (cdr value) maps)) + (lambda (var maps) (values (list 'ref var) maps)))) + ((ellipsis? e r mod) + (syntax-violation 'syntax "misplaced ellipsis" src)) + (else (values (list 'quote e) maps)))))) + (let* ((tmp e) (tmp-1 ($sc-dispatch tmp '(any any)))) + (if (and tmp-1 (apply (lambda (dots e) (ellipsis? dots r mod)) tmp-1)) + (apply (lambda (dots e) (gen-syntax src e r maps (lambda (e r mod) #f) mod)) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any any . any)))) + (if (and tmp-1 (apply (lambda (x dots y) (ellipsis? dots r mod)) tmp-1)) + (apply (lambda (x dots y) + (let f ((y y) + (k (lambda (maps) + (call-with-values + (lambda () (gen-syntax src x r (cons '() maps) ellipsis? mod)) + (lambda (x maps) + (if (null? (car maps)) + (syntax-violation 'syntax "extra ellipsis" src) + (values (gen-map x (car maps)) (cdr maps)))))))) + (let* ((tmp y) (tmp ($sc-dispatch tmp '(any . any)))) + (if (and tmp (apply (lambda (dots y) (ellipsis? dots r mod)) tmp)) + (apply (lambda (dots y) + (f y + (lambda (maps) + (call-with-values + (lambda () (k (cons '() maps))) + (lambda (x maps) + (if (null? (car maps)) + (syntax-violation 'syntax "extra ellipsis" src) + (values (gen-mappend x (car maps)) (cdr maps)))))))) + tmp) + (call-with-values + (lambda () (gen-syntax src y r maps ellipsis? mod)) + (lambda (y maps) + (call-with-values + (lambda () (k maps)) + (lambda (x maps) (values (gen-append x y) maps))))))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if tmp-1 + (apply (lambda (x y) + (call-with-values + (lambda () (gen-syntax src x r maps ellipsis? mod)) + (lambda (x maps) + (call-with-values + (lambda () (gen-syntax src y r maps ellipsis? mod)) + (lambda (y maps) (values (gen-cons x y) maps)))))) + tmp-1) + (let ((tmp ($sc-dispatch tmp '#(vector (any . each-any))))) + (if tmp + (apply (lambda (e1 e2) + (call-with-values + (lambda () (gen-syntax src (cons e1 e2) r maps ellipsis? mod)) + (lambda (e maps) (values (gen-vector e) maps)))) + tmp) + (values (list 'quote e) maps)))))))))))) + (gen-ref + (lambda (src var level maps) + (cond ((= level 0) (values var maps)) + ((null? maps) (syntax-violation 'syntax "missing ellipsis" src)) + (else + (call-with-values + (lambda () (gen-ref src var (- level 1) (cdr maps))) + (lambda (outer-var outer-maps) + (let ((b (assq outer-var (car maps)))) + (if b + (values (cdr b) maps) + (let ((inner-var (gen-var 'tmp))) + (values + inner-var + (cons (cons (cons outer-var inner-var) (car maps)) outer-maps))))))))))) + (gen-mappend + (lambda (e map-env) + (list 'apply '(primitive append) (gen-map e map-env)))) + (gen-map + (lambda (e map-env) + (let ((formals (map cdr map-env)) + (actuals (map (lambda (x) (list 'ref (car x))) map-env))) + (cond ((eq? (car e) 'ref) (car actuals)) + ((and-map + (lambda (x) (and (eq? (car x) 'ref) (memq (cadr x) formals))) + (cdr e)) + (cons 'map + (cons (list 'primitive (car e)) + (map (let ((r (map cons formals actuals))) + (lambda (x) (cdr (assq (cadr x) r)))) + (cdr e))))) + (else (cons 'map (cons (list 'lambda formals e) actuals))))))) + (gen-cons + (lambda (x y) + (let ((key (car y))) + (cond ((memv key '(quote)) + (cond ((eq? (car x) 'quote) (list 'quote (cons (cadr x) (cadr y)))) + ((eq? (cadr y) '()) (list 'list x)) + (else (list 'cons x y)))) + ((memv key '(list)) (cons 'list (cons x (cdr y)))) + (else (list 'cons x y)))))) + (gen-append (lambda (x y) (if (equal? y ''()) x (list 'append x y)))) + (gen-vector + (lambda (x) + (cond ((eq? (car x) 'list) (cons 'vector (cdr x))) + ((eq? (car x) 'quote) (list 'quote (list->vector (cadr x)))) + (else (list 'list->vector x))))) + (regen (lambda (x) + (let ((key (car x))) + (cond ((memv key '(ref)) + (build-lexical-reference 'value #f (cadr x) (cadr x))) + ((memv key '(primitive)) (build-primref #f (cadr x))) + ((memv key '(quote)) (build-data #f (cadr x))) + ((memv key '(lambda)) + (if (list? (cadr x)) + (build-simple-lambda #f (cadr x) #f (cadr x) '() (regen (caddr x))) + (error "how did we get here" x))) + (else (build-primcall #f (car x) (map regen (cdr x))))))))) + (lambda (e r w s mod) + (let* ((e (source-wrap e w s mod)) + (tmp e) + (tmp ($sc-dispatch tmp '(_ any)))) + (if tmp + (apply (lambda (x) + (call-with-values + (lambda () (gen-syntax e x r '() ellipsis? mod)) + (lambda (e maps) (regen e)))) + tmp) + (syntax-violation 'syntax "bad `syntax' form" e)))))) + (global-extend + 'core + 'lambda + (lambda (e r w s mod) + (let* ((tmp e) (tmp ($sc-dispatch tmp '(_ any any . each-any)))) + (if tmp + (apply (lambda (args e1 e2) + (call-with-values + (lambda () (lambda-formals args)) + (lambda (req opt rest kw) + (let lp ((body (cons e1 e2)) (meta '())) + (let* ((tmp-1 body) (tmp ($sc-dispatch tmp-1 '(any any . each-any)))) + (if (and tmp + (apply (lambda (docstring e1 e2) (string? (syntax->datum docstring))) + tmp)) + (apply (lambda (docstring e1 e2) + (lp (cons e1 e2) + (append meta (list (cons 'documentation (syntax->datum docstring)))))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(#(vector #(each (any . any))) any . each-any)))) + (if tmp + (apply (lambda (k v e1 e2) + (lp (cons e1 e2) (append meta (syntax->datum (map cons k v))))) + tmp) + (expand-simple-lambda e r w s mod req rest meta body))))))))) + tmp) + (syntax-violation 'lambda "bad lambda" e))))) + (global-extend + 'core + 'lambda* + (lambda (e r w s mod) + (let* ((tmp e) (tmp ($sc-dispatch tmp '(_ any any . each-any)))) + (if tmp + (apply (lambda (args e1 e2) + (call-with-values + (lambda () + (expand-lambda-case + e + r + w + s + mod + lambda*-formals + (list (cons args (cons e1 e2))))) + (lambda (meta lcase) (build-case-lambda s meta lcase)))) + tmp) + (syntax-violation 'lambda "bad lambda*" e))))) + (global-extend + 'core + 'case-lambda + (lambda (e r w s mod) + (letrec* + ((build-it + (lambda (meta clauses) + (call-with-values + (lambda () (expand-lambda-case e r w s mod lambda-formals clauses)) + (lambda (meta* lcase) + (build-case-lambda s (append meta meta*) lcase)))))) + (let* ((tmp-1 e) + (tmp ($sc-dispatch tmp-1 '(_ . #(each (any any . each-any)))))) + (if tmp + (apply (lambda (args e1 e2) + (build-it + '() + (map (lambda (tmp-680b775fb37a463-c96 + tmp-680b775fb37a463-c95 + tmp-680b775fb37a463-c94) + (cons tmp-680b775fb37a463-c94 + (cons tmp-680b775fb37a463-c95 tmp-680b775fb37a463-c96))) + e2 + e1 + args))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(_ any . #(each (any any . each-any)))))) + (if (and tmp + (apply (lambda (docstring args e1 e2) (string? (syntax->datum docstring))) + tmp)) + (apply (lambda (docstring args e1 e2) + (build-it + (list (cons 'documentation (syntax->datum docstring))) + (map (lambda (tmp-680b775fb37a463-cac + tmp-680b775fb37a463-cab + tmp-680b775fb37a463-caa) + (cons tmp-680b775fb37a463-caa + (cons tmp-680b775fb37a463-cab tmp-680b775fb37a463-cac))) + e2 + e1 + args))) + tmp) + (syntax-violation 'case-lambda "bad case-lambda" e)))))))) + (global-extend + 'core + 'case-lambda* + (lambda (e r w s mod) + (letrec* + ((build-it + (lambda (meta clauses) + (call-with-values + (lambda () (expand-lambda-case e r w s mod lambda*-formals clauses)) + (lambda (meta* lcase) + (build-case-lambda s (append meta meta*) lcase)))))) + (let* ((tmp-1 e) + (tmp ($sc-dispatch tmp-1 '(_ . #(each (any any . each-any)))))) + (if tmp + (apply (lambda (args e1 e2) + (build-it + '() + (map (lambda (tmp-680b775fb37a463-ccc + tmp-680b775fb37a463-ccb + tmp-680b775fb37a463-cca) + (cons tmp-680b775fb37a463-cca + (cons tmp-680b775fb37a463-ccb tmp-680b775fb37a463-ccc))) + e2 + e1 + args))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(_ any . #(each (any any . each-any)))))) + (if (and tmp + (apply (lambda (docstring args e1 e2) (string? (syntax->datum docstring))) + tmp)) + (apply (lambda (docstring args e1 e2) + (build-it + (list (cons 'documentation (syntax->datum docstring))) + (map (lambda (tmp-680b775fb37a463-ce2 + tmp-680b775fb37a463-ce1 + tmp-680b775fb37a463-ce0) + (cons tmp-680b775fb37a463-ce0 + (cons tmp-680b775fb37a463-ce1 tmp-680b775fb37a463-ce2))) + e2 + e1 + args))) + tmp) + (syntax-violation 'case-lambda "bad case-lambda*" e)))))))) + (global-extend + 'core + 'with-ellipsis + (lambda (e r w s mod) + (let* ((tmp e) (tmp ($sc-dispatch tmp '(_ any any . each-any)))) + (if (and tmp (apply (lambda (dots e1 e2) (id? dots)) tmp)) + (apply (lambda (dots e1 e2) + (let ((id (if (symbol? dots) + '#{ $sc-ellipsis }# + (make-syntax-object + '#{ $sc-ellipsis }# + (syntax-object-wrap dots) + (syntax-object-module dots))))) + (let ((ids (list id)) + (labels (list (gen-label))) + (bindings (list (cons 'ellipsis (source-wrap dots w s mod))))) + (let ((nw (make-binding-wrap ids labels w)) + (nr (extend-env labels bindings r))) + (expand-body (cons e1 e2) (source-wrap e nw s mod) nr nw mod))))) + tmp) + (syntax-violation + 'with-ellipsis + "bad syntax" + (source-wrap e w s mod)))))) + (global-extend + 'core + 'let + (letrec* + ((expand-let + (lambda (e r w s mod constructor ids vals exps) + (if (not (valid-bound-ids? ids)) + (syntax-violation 'let "duplicate bound variable" e) + (let ((labels (gen-labels ids)) (new-vars (map gen-var ids))) + (let ((nw (make-binding-wrap ids labels w)) + (nr (extend-var-env labels new-vars r))) + (constructor + s + (map syntax->datum ids) + new-vars + (map (lambda (x) (expand x r w mod)) vals) + (expand-body exps (source-wrap e nw s mod) nr nw mod)))))))) + (lambda (e r w s mod) + (let* ((tmp-1 e) + (tmp ($sc-dispatch tmp-1 '(_ #(each (any any)) any . each-any)))) + (if (and tmp (apply (lambda (id val e1 e2) (and-map id? id)) tmp)) + (apply (lambda (id val e1 e2) + (expand-let e r w s mod build-let id val (cons e1 e2))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(_ any #(each (any any)) any . each-any)))) + (if (and tmp + (apply (lambda (f id val e1 e2) (and (id? f) (and-map id? id))) tmp)) + (apply (lambda (f id val e1 e2) + (expand-let e r w s mod build-named-let (cons f id) val (cons e1 e2))) + tmp) + (syntax-violation 'let "bad let" (source-wrap e w s mod))))))))) + (global-extend + 'core + 'letrec + (lambda (e r w s mod) + (let* ((tmp e) + (tmp ($sc-dispatch tmp '(_ #(each (any any)) any . each-any)))) + (if (and tmp (apply (lambda (id val e1 e2) (and-map id? id)) tmp)) + (apply (lambda (id val e1 e2) + (let ((ids id)) + (if (not (valid-bound-ids? ids)) + (syntax-violation 'letrec "duplicate bound variable" e) + (let ((labels (gen-labels ids)) (new-vars (map gen-var ids))) + (let ((w (make-binding-wrap ids labels w)) + (r (extend-var-env labels new-vars r))) + (build-letrec + s + #f + (map syntax->datum ids) + new-vars + (map (lambda (x) (expand x r w mod)) val) + (expand-body (cons e1 e2) (source-wrap e w s mod) r w mod))))))) + tmp) + (syntax-violation 'letrec "bad letrec" (source-wrap e w s mod)))))) + (global-extend + 'core + 'letrec* + (lambda (e r w s mod) + (let* ((tmp e) + (tmp ($sc-dispatch tmp '(_ #(each (any any)) any . each-any)))) + (if (and tmp (apply (lambda (id val e1 e2) (and-map id? id)) tmp)) + (apply (lambda (id val e1 e2) + (let ((ids id)) + (if (not (valid-bound-ids? ids)) + (syntax-violation 'letrec* "duplicate bound variable" e) + (let ((labels (gen-labels ids)) (new-vars (map gen-var ids))) + (let ((w (make-binding-wrap ids labels w)) + (r (extend-var-env labels new-vars r))) + (build-letrec + s + #t + (map syntax->datum ids) + new-vars + (map (lambda (x) (expand x r w mod)) val) + (expand-body (cons e1 e2) (source-wrap e w s mod) r w mod))))))) + tmp) + (syntax-violation 'letrec* "bad letrec*" (source-wrap e w s mod)))))) + (global-extend + 'core + 'set! + (lambda (e r w s mod) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ any any)))) + (if (and tmp (apply (lambda (id val) (id? id)) tmp)) + (apply (lambda (id val) + (call-with-values + (lambda () (resolve-identifier id w r mod #t)) + (lambda (type value id-mod) + (let ((key type)) + (cond ((memv key '(lexical)) + (build-lexical-assignment + s + (syntax->datum id) + value + (expand val r w mod))) + ((memv key '(global)) + (build-global-assignment s value (expand val r w mod) id-mod)) + ((memv key '(macro)) + (if (procedure-property value 'variable-transformer) + (expand (expand-macro value e r w s #f mod) r '(()) mod) + (syntax-violation + 'set! + "not a variable transformer" + (wrap e w mod) + (wrap id w id-mod)))) + ((memv key '(displaced-lexical)) + (syntax-violation 'set! "identifier out of context" (wrap id w mod))) + (else (syntax-violation 'set! "bad set!" (source-wrap e w s mod)))))))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(_ (any . each-any) any)))) + (if tmp + (apply (lambda (head tail val) + (call-with-values + (lambda () (syntax-type head r '(()) #f #f mod #t)) + (lambda (type value ee* ee ww ss modmod) + (let ((key type)) + (if (memv key '(module-ref)) + (let ((val (expand val r w mod))) + (call-with-values + (lambda () (value (cons head tail) r w mod)) + (lambda (e r w s* mod) + (let* ((tmp-1 e) (tmp (list tmp-1))) + (if (and tmp (apply (lambda (e) (id? e)) tmp)) + (apply (lambda (e) (build-global-assignment s (syntax->datum e) val mod)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))) + (build-call + s + (expand + (list (make-syntax 'setter '((top)) '(hygiene guile)) head) + r + w + mod) + (map (lambda (e) (expand e r w mod)) (append tail (list val))))))))) + tmp) + (syntax-violation 'set! "bad set!" (source-wrap e w s mod)))))))) + (global-extend + 'module-ref + '@ + (lambda (e r w mod) + (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ each-any any)))) + (if (and tmp + (apply (lambda (mod id) (and (and-map id? mod) (id? id))) tmp)) + (apply (lambda (mod id) + (values + (syntax->datum id) + r + '((top)) + #f + (syntax->datum + (cons (make-syntax 'public '((top)) '(hygiene guile)) mod)))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))) + (global-extend + 'module-ref + '@@ + (lambda (e r w mod) + (letrec* + ((remodulate + (lambda (x mod) + (cond ((pair? x) (cons (remodulate (car x) mod) (remodulate (cdr x) mod))) + ((syntax-object? x) + (make-syntax-object + (remodulate (syntax-object-expression x) mod) + (syntax-object-wrap x) + mod)) + ((vector? x) + (let* ((n (vector-length x)) (v (make-vector n))) + (let loop ((i 0)) + (if (= i n) + (begin (if #f #f) v) + (begin + (vector-set! v i (remodulate (vector-ref x i) mod)) + (loop (+ i 1))))))) + (else x))))) + (let* ((tmp e) + (tmp-1 ($sc-dispatch + tmp + (list '_ + (vector 'free-id (make-syntax 'primitive '((top)) '(hygiene guile))) + 'any)))) + (if (and tmp-1 + (apply (lambda (id) + (and (id? id) + (equal? + (cdr (if (syntax-object? id) (syntax-object-module id) mod)) + '(guile)))) + tmp-1)) + (apply (lambda (id) (values (syntax->datum id) r '((top)) #f '(primitive))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ each-any any)))) + (if (and tmp-1 + (apply (lambda (mod id) (and (and-map id? mod) (id? id))) tmp-1)) + (apply (lambda (mod id) + (values + (syntax->datum id) + r + '((top)) + #f + (syntax->datum + (cons (make-syntax 'private '((top)) '(hygiene guile)) mod)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch + tmp + (list '_ + (vector 'free-id (make-syntax '@@ '((top)) '(hygiene guile))) + 'each-any + 'any)))) + (if (and tmp-1 (apply (lambda (mod exp) (and-map id? mod)) tmp-1)) + (apply (lambda (mod exp) + (let ((mod (syntax->datum + (cons (make-syntax 'private '((top)) '(hygiene guile)) mod)))) + (values (remodulate exp mod) r w (source-annotation exp) mod))) + tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp)))))))))) + (global-extend + 'core + 'if + (lambda (e r w s mod) + (let* ((tmp e) (tmp-1 ($sc-dispatch tmp '(_ any any)))) + (if tmp-1 + (apply (lambda (test then) + (build-conditional + s + (expand test r w mod) + (expand then r w mod) + (build-void #f))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ any any any)))) + (if tmp-1 + (apply (lambda (test then else) + (build-conditional + s + (expand test r w mod) + (expand then r w mod) + (expand else r w mod))) + tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp))))))) + (global-extend 'begin 'begin '()) + (global-extend 'define 'define '()) + (global-extend 'define-syntax 'define-syntax '()) + (global-extend 'define-syntax-parameter 'define-syntax-parameter '()) + (global-extend 'eval-when 'eval-when '()) + (global-extend + 'core + 'syntax-case + (letrec* + ((convert-pattern + (lambda (pattern keys ellipsis?) + (letrec* + ((cvt* (lambda (p* n ids) + (let* ((tmp p*) (tmp ($sc-dispatch tmp '(any . any)))) + (if tmp + (apply (lambda (x y) + (call-with-values + (lambda () (cvt* y n ids)) + (lambda (y ids) + (call-with-values + (lambda () (cvt x n ids)) + (lambda (x ids) (values (cons x y) ids)))))) + tmp) + (cvt p* n ids))))) + (v-reverse + (lambda (x) + (let loop ((r '()) (x x)) + (if (not (pair? x)) (values r x) (loop (cons (car x) r) (cdr x)))))) + (cvt (lambda (p n ids) + (if (id? p) + (cond ((bound-id-member? p keys) (values (vector 'free-id p) ids)) + ((free-id=? p (make-syntax '_ '((top)) '(hygiene guile))) + (values '_ ids)) + (else (values 'any (cons (cons p n) ids)))) + (let* ((tmp p) (tmp-1 ($sc-dispatch tmp '(any any)))) + (if (and tmp-1 (apply (lambda (x dots) (ellipsis? dots)) tmp-1)) + (apply (lambda (x dots) + (call-with-values + (lambda () (cvt x (+ n 1) ids)) + (lambda (p ids) + (values (if (eq? p 'any) 'each-any (vector 'each p)) ids)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any any . any)))) + (if (and tmp-1 (apply (lambda (x dots ys) (ellipsis? dots)) tmp-1)) + (apply (lambda (x dots ys) + (call-with-values + (lambda () (cvt* ys n ids)) + (lambda (ys ids) + (call-with-values + (lambda () (cvt x (+ n 1) ids)) + (lambda (x ids) + (call-with-values + (lambda () (v-reverse ys)) + (lambda (ys e) (values (vector 'each+ x ys e) ids)))))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if tmp-1 + (apply (lambda (x y) + (call-with-values + (lambda () (cvt y n ids)) + (lambda (y ids) + (call-with-values + (lambda () (cvt x n ids)) + (lambda (x ids) (values (cons x y) ids)))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '()))) + (if tmp-1 + (apply (lambda () (values '() ids)) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '#(vector each-any)))) + (if tmp-1 + (apply (lambda (x) + (call-with-values + (lambda () (cvt x n ids)) + (lambda (p ids) (values (vector 'vector p) ids)))) + tmp-1) + (let ((x tmp)) (values (vector 'atom (strip p '(()))) ids)))))))))))))))) + (cvt pattern 0 '())))) + (build-dispatch-call + (lambda (pvars exp y r mod) + (let ((ids (map car pvars)) (levels (map cdr pvars))) + (let ((labels (gen-labels ids)) (new-vars (map gen-var ids))) + (build-primcall + #f + 'apply + (list (build-simple-lambda + #f + (map syntax->datum ids) + #f + new-vars + '() + (expand + exp + (extend-env + labels + (map (lambda (var level) (cons 'syntax (cons var level))) + new-vars + (map cdr pvars)) + r) + (make-binding-wrap ids labels '(())) + mod)) + y)))))) + (gen-clause + (lambda (x keys clauses r pat fender exp mod) + (call-with-values + (lambda () + (convert-pattern pat keys (lambda (e) (ellipsis? e r mod)))) + (lambda (p pvars) + (cond ((not (and-map (lambda (x) (not (ellipsis? (car x) r mod))) pvars)) + (syntax-violation 'syntax-case "misplaced ellipsis" pat)) + ((not (distinct-bound-ids? (map car pvars))) + (syntax-violation 'syntax-case "duplicate pattern variable" pat)) + (else + (let ((y (gen-var 'tmp))) + (build-call + #f + (build-simple-lambda + #f + (list 'tmp) + #f + (list y) + '() + (let ((y (build-lexical-reference 'value #f 'tmp y))) + (build-conditional + #f + (let* ((tmp fender) (tmp ($sc-dispatch tmp '#(atom #t)))) + (if tmp + (apply (lambda () y) tmp) + (build-conditional + #f + y + (build-dispatch-call pvars fender y r mod) + (build-data #f #f)))) + (build-dispatch-call pvars exp y r mod) + (gen-syntax-case x keys clauses r mod)))) + (list (if (eq? p 'any) + (build-primcall #f 'list (list x)) + (build-primcall #f '$sc-dispatch (list x (build-data #f p))))))))))))) + (gen-syntax-case + (lambda (x keys clauses r mod) + (if (null? clauses) + (build-primcall + #f + 'syntax-violation + (list (build-data #f #f) + (build-data #f "source expression failed to match any pattern") + x)) + (let* ((tmp-1 (car clauses)) (tmp ($sc-dispatch tmp-1 '(any any)))) + (if tmp + (apply (lambda (pat exp) + (if (and (id? pat) + (and-map + (lambda (x) (not (free-id=? pat x))) + (cons (make-syntax '... '((top)) '(hygiene guile)) keys))) + (if (free-id=? pat (make-syntax '_ '((top)) '(hygiene guile))) + (expand exp r '(()) mod) + (let ((labels (list (gen-label))) (var (gen-var pat))) + (build-call + #f + (build-simple-lambda + #f + (list (syntax->datum pat)) + #f + (list var) + '() + (expand + exp + (extend-env labels (list (cons 'syntax (cons var 0))) r) + (make-binding-wrap (list pat) labels '(())) + mod)) + (list x)))) + (gen-clause x keys (cdr clauses) r pat #t exp mod))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(any any any)))) + (if tmp + (apply (lambda (pat fender exp) + (gen-clause x keys (cdr clauses) r pat fender exp mod)) + tmp) + (syntax-violation 'syntax-case "invalid clause" (car clauses)))))))))) + (lambda (e r w s mod) + (let* ((e (source-wrap e w s mod)) + (tmp-1 e) + (tmp ($sc-dispatch tmp-1 '(_ any each-any . each-any)))) + (if tmp + (apply (lambda (val key m) + (if (and-map (lambda (x) (and (id? x) (not (ellipsis? x r mod)))) key) + (let ((x (gen-var 'tmp))) + (build-call + s + (build-simple-lambda + #f + (list 'tmp) + #f + (list x) + '() + (gen-syntax-case + (build-lexical-reference 'value #f 'tmp x) + key + m + r + mod)) + (list (expand val r '(()) mod)))) + (syntax-violation 'syntax-case "invalid literals list" e))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))) + (set! macroexpand + (lambda* (x #:optional (m 'e) (esew '(eval))) + (expand-top-sequence + (list x) + '() + '((top)) + #f + m + esew + (cons 'hygiene (module-name (current-module)))))) + (set! identifier? (lambda (x) (nonsymbol-id? x))) + (set! datum->syntax + (lambda (id datum) + (make-syntax-object + datum + (syntax-object-wrap id) + (syntax-object-module id)))) + (set! syntax->datum (lambda (x) (strip x '(())))) + (set! syntax-source (lambda (x) (source-annotation x))) + (set! generate-temporaries + (lambda (ls) + (let ((x ls)) + (if (not (list? x)) + (syntax-violation 'generate-temporaries "invalid argument" x))) + (let ((mod (cons 'hygiene (module-name (current-module))))) + (map (lambda (x) (wrap (module-gensym "t") '((top)) mod)) ls)))) + (set! free-identifier=? + (lambda (x y) + (let ((x x)) + (if (not (nonsymbol-id? x)) + (syntax-violation 'free-identifier=? "invalid argument" x))) + (let ((x y)) + (if (not (nonsymbol-id? x)) + (syntax-violation 'free-identifier=? "invalid argument" x))) + (free-id=? x y))) + (set! bound-identifier=? + (lambda (x y) + (let ((x x)) + (if (not (nonsymbol-id? x)) + (syntax-violation 'bound-identifier=? "invalid argument" x))) + (let ((x y)) + (if (not (nonsymbol-id? x)) + (syntax-violation 'bound-identifier=? "invalid argument" x))) + (bound-id=? x y))) + (set! syntax-violation + (lambda* (who message form #:optional (subform #f)) + (let ((x who)) + (if (not (let ((x x)) (or (not x) (string? x) (symbol? x)))) + (syntax-violation 'syntax-violation "invalid argument" x))) + (let ((x message)) + (if (not (string? x)) + (syntax-violation 'syntax-violation "invalid argument" x))) + (throw 'syntax-error + who + message + (or (source-annotation subform) (source-annotation form)) + (strip form '(())) + (and subform (strip subform '(())))))) + (letrec* + ((%syntax-module + (lambda (id) + (let ((x id)) + (if (not (nonsymbol-id? x)) + (syntax-violation 'syntax-module "invalid argument" x))) + (let ((mod (syntax-object-module id))) + (and (not (equal? mod '(primitive))) (cdr mod))))) + (syntax-local-binding + (lambda* (id + #:key + (resolve-syntax-parameters? #t #:resolve-syntax-parameters?)) + (let ((x id)) + (if (not (nonsymbol-id? x)) + (syntax-violation 'syntax-local-binding "invalid argument" x))) + (with-transformer-environment + (lambda (e r w s rib mod) + (letrec* + ((strip-anti-mark + (lambda (w) + (let ((ms (car w)) (s (cdr w))) + (if (and (pair? ms) (eq? (car ms) #f)) + (cons (cdr ms) (if rib (cons rib (cdr s)) (cdr s))) + (cons ms (if rib (cons rib s) s))))))) + (call-with-values + (lambda () + (resolve-identifier + (syntax-object-expression id) + (strip-anti-mark (syntax-object-wrap id)) + r + (syntax-object-module id) + resolve-syntax-parameters?)) + (lambda (type value mod) + (let ((key type)) + (cond ((memv key '(lexical)) (values 'lexical value)) + ((memv key '(macro)) (values 'macro value)) + ((memv key '(syntax-parameter)) (values 'syntax-parameter value)) + ((memv key '(syntax)) (values 'pattern-variable value)) + ((memv key '(displaced-lexical)) (values 'displaced-lexical #f)) + ((memv key '(global)) + (if (equal? mod '(primitive)) + (values 'primitive value) + (values 'global (cons value (cdr mod))))) + ((memv key '(ellipsis)) + (values + 'ellipsis + (make-syntax-object + (syntax-object-expression value) + (anti-mark (syntax-object-wrap value)) + (syntax-object-module value)))) + (else (values 'other #f))))))))))) + (syntax-locally-bound-identifiers + (lambda (id) + (let ((x id)) + (if (not (nonsymbol-id? x)) + (syntax-violation + 'syntax-locally-bound-identifiers + "invalid argument" + x))) + (locally-bound-identifiers + (syntax-object-wrap id) + (syntax-object-module id))))) + (define! '%syntax-module %syntax-module) + (define! 'syntax-local-binding syntax-local-binding) + (define! + 'syntax-locally-bound-identifiers + syntax-locally-bound-identifiers)) + (letrec* + ((match-each + (lambda (e p w mod) + (cond ((pair? e) + (let ((first (match (car e) p w '() mod))) + (and first + (let ((rest (match-each (cdr e) p w mod))) + (and rest (cons first rest)))))) + ((null? e) '()) + ((syntax-object? e) + (match-each + (syntax-object-expression e) + p + (join-wraps w (syntax-object-wrap e)) + (syntax-object-module e))) + (else #f)))) + (match-each+ + (lambda (e x-pat y-pat z-pat w r mod) + (let f ((e e) (w w)) + (cond ((pair? e) + (call-with-values + (lambda () (f (cdr e) w)) + (lambda (xr* y-pat r) + (if r + (if (null? y-pat) + (let ((xr (match (car e) x-pat w '() mod))) + (if xr (values (cons xr xr*) y-pat r) (values #f #f #f))) + (values '() (cdr y-pat) (match (car e) (car y-pat) w r mod))) + (values #f #f #f))))) + ((syntax-object? e) + (f (syntax-object-expression e) + (join-wraps w (syntax-object-wrap e)))) + (else (values '() y-pat (match e z-pat w r mod))))))) + (match-each-any + (lambda (e w mod) + (cond ((pair? e) + (let ((l (match-each-any (cdr e) w mod))) + (and l (cons (wrap (car e) w mod) l)))) + ((null? e) '()) + ((syntax-object? e) + (match-each-any + (syntax-object-expression e) + (join-wraps w (syntax-object-wrap e)) + mod)) + (else #f)))) + (match-empty + (lambda (p r) + (cond ((null? p) r) + ((eq? p '_) r) + ((eq? p 'any) (cons '() r)) + ((pair? p) (match-empty (car p) (match-empty (cdr p) r))) + ((eq? p 'each-any) (cons '() r)) + (else + (let ((key (vector-ref p 0))) + (cond ((memv key '(each)) (match-empty (vector-ref p 1) r)) + ((memv key '(each+)) + (match-empty + (vector-ref p 1) + (match-empty + (reverse (vector-ref p 2)) + (match-empty (vector-ref p 3) r)))) + ((memv key '(free-id atom)) r) + ((memv key '(vector)) (match-empty (vector-ref p 1) r)))))))) + (combine + (lambda (r* r) + (if (null? (car r*)) r (cons (map car r*) (combine (map cdr r*) r))))) + (match* + (lambda (e p w r mod) + (cond ((null? p) (and (null? e) r)) + ((pair? p) + (and (pair? e) + (match (car e) (car p) w (match (cdr e) (cdr p) w r mod) mod))) + ((eq? p 'each-any) + (let ((l (match-each-any e w mod))) (and l (cons l r)))) + (else + (let ((key (vector-ref p 0))) + (cond ((memv key '(each)) + (if (null? e) + (match-empty (vector-ref p 1) r) + (let ((l (match-each e (vector-ref p 1) w mod))) + (and l + (let collect ((l l)) + (if (null? (car l)) r (cons (map car l) (collect (map cdr l))))))))) + ((memv key '(each+)) + (call-with-values + (lambda () + (match-each+ + e + (vector-ref p 1) + (vector-ref p 2) + (vector-ref p 3) + w + r + mod)) + (lambda (xr* y-pat r) + (and r + (null? y-pat) + (if (null? xr*) (match-empty (vector-ref p 1) r) (combine xr* r)))))) + ((memv key '(free-id)) + (and (id? e) (free-id=? (wrap e w mod) (vector-ref p 1)) r)) + ((memv key '(atom)) (and (equal? (vector-ref p 1) (strip e w)) r)) + ((memv key '(vector)) + (and (vector? e) (match (vector->list e) (vector-ref p 1) w r mod))))))))) + (match (lambda (e p w r mod) + (cond ((not r) #f) + ((eq? p '_) r) + ((eq? p 'any) (cons (wrap e w mod) r)) + ((syntax-object? e) + (match* + (syntax-object-expression e) + p + (join-wraps w (syntax-object-wrap e)) + r + (syntax-object-module e))) + (else (match* e p w r mod)))))) + (set! $sc-dispatch + (lambda (e p) + (cond ((eq? p 'any) (list e)) + ((eq? p '_) '()) + ((syntax-object? e) + (match* + (syntax-object-expression e) + p + (syntax-object-wrap e) + '() + (syntax-object-module e))) + (else (match* e p '(()) '() #f)))))))) + +(define with-syntax + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'with-syntax + 'macro + (lambda (x) + (let ((tmp x)) + (let ((tmp-1 ($sc-dispatch tmp '(_ () any . each-any)))) + (if tmp-1 + (apply (lambda (e1 e2) + (cons (make-syntax 'let '((top)) '(hygiene guile)) + (cons '() (cons e1 e2)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ ((any any)) any . each-any)))) + (if tmp-1 + (apply (lambda (out in e1 e2) + (list (make-syntax 'syntax-case '((top)) '(hygiene guile)) + in + '() + (list out + (cons (make-syntax 'let '((top)) '(hygiene guile)) + (cons '() (cons e1 e2)))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ #(each (any any)) any . each-any)))) + (if tmp-1 + (apply (lambda (out in e1 e2) + (list (make-syntax 'syntax-case '((top)) '(hygiene guile)) + (cons (make-syntax 'list '((top)) '(hygiene guile)) in) + '() + (list out + (cons (make-syntax 'let '((top)) '(hygiene guile)) + (cons '() (cons e1 e2)))))) + tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp)))))))))))) + +(define syntax-error + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'syntax-error + 'macro + (lambda (x) + (let ((tmp-1 x)) + (let ((tmp ($sc-dispatch tmp-1 '(_ (any . any) any . each-any)))) + (if (if tmp + (apply (lambda (keyword operands message arg) + (string? (syntax->datum message))) + tmp) + #f) + (apply (lambda (keyword operands message arg) + (syntax-violation + (syntax->datum keyword) + (string-join + (cons (syntax->datum message) + (map (lambda (x) (object->string (syntax->datum x))) arg))) + (if (syntax->datum keyword) (cons keyword operands) #f))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(_ any . each-any)))) + (if (if tmp + (apply (lambda (message arg) (string? (syntax->datum message))) tmp) + #f) + (apply (lambda (message arg) + (cons (make-syntax + 'syntax-error + (list '(top) + (vector + 'ribcage + '#(syntax-error) + '#((top)) + (vector + (cons '(hygiene guile) + (make-syntax 'syntax-error '((top)) '(hygiene guile)))))) + '(hygiene guile)) + (cons '(#f) (cons message arg)))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))))) + +(define syntax-rules + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'syntax-rules + 'macro + (lambda (xx) + (letrec* + ((expand-clause + (lambda (clause) + (let ((tmp-1 clause)) + (let ((tmp ($sc-dispatch + tmp-1 + (list '(any . any) + (cons (vector + 'free-id + (make-syntax 'syntax-error '((top)) '(hygiene guile))) + '(any . each-any)))))) + (if (if tmp + (apply (lambda (keyword pattern message arg) + (string? (syntax->datum message))) + tmp) + #f) + (apply (lambda (keyword pattern message arg) + (list (cons (make-syntax 'dummy '((top)) '(hygiene guile)) pattern) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) + (cons (make-syntax 'syntax-error '((top)) '(hygiene guile)) + (cons (cons (make-syntax 'dummy '((top)) '(hygiene guile)) pattern) + (cons message arg)))))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '((any . any) any)))) + (if tmp + (apply (lambda (keyword pattern template) + (list (cons (make-syntax 'dummy '((top)) '(hygiene guile)) pattern) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) template))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))) + (expand-syntax-rules + (lambda (dots keys docstrings clauses) + (let ((tmp-1 (list keys docstrings clauses (map expand-clause clauses)))) + (let ((tmp ($sc-dispatch + tmp-1 + '(each-any each-any #(each ((any . any) any)) each-any)))) + (if tmp + (apply (lambda (k docstring keyword pattern template clause) + (let ((tmp (cons (make-syntax 'lambda '((top)) '(hygiene guile)) + (cons (list (make-syntax 'x '((top)) '(hygiene guile))) + (append + docstring + (list (vector + (cons (make-syntax 'macro-type '((top)) '(hygiene guile)) + (make-syntax + 'syntax-rules + (list '(top) + (vector + 'ribcage + '#(syntax-rules) + '#((top)) + (vector + (cons '(hygiene guile) + (make-syntax + 'syntax-rules + '((top)) + '(hygiene guile)))))) + '(hygiene guile))) + (cons (make-syntax 'patterns '((top)) '(hygiene guile)) + pattern)) + (cons (make-syntax 'syntax-case '((top)) '(hygiene guile)) + (cons (make-syntax 'x '((top)) '(hygiene guile)) + (cons k clause))))))))) + (let ((form tmp)) + (if dots + (let ((tmp dots)) + (let ((dots tmp)) + (list (make-syntax 'with-ellipsis '((top)) '(hygiene guile)) + dots + form))) + form)))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))))) + (let ((tmp xx)) + (let ((tmp-1 ($sc-dispatch tmp '(_ each-any . #(each ((any . any) any)))))) + (if tmp-1 + (apply (lambda (k keyword pattern template) + (expand-syntax-rules + #f + k + '() + (map (lambda (tmp-680b775fb37a463-2 tmp-680b775fb37a463-1 tmp-680b775fb37a463) + (list (cons tmp-680b775fb37a463 tmp-680b775fb37a463-1) + tmp-680b775fb37a463-2)) + template + pattern + keyword))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ each-any any . #(each ((any . any) any)))))) + (if (if tmp-1 + (apply (lambda (k docstring keyword pattern template) + (string? (syntax->datum docstring))) + tmp-1) + #f) + (apply (lambda (k docstring keyword pattern template) + (expand-syntax-rules + #f + k + (list docstring) + (map (lambda (tmp-680b775fb37a463 + tmp-680b775fb37a463-114f + tmp-680b775fb37a463-114e) + (list (cons tmp-680b775fb37a463-114e tmp-680b775fb37a463-114f) + tmp-680b775fb37a463)) + template + pattern + keyword))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ any each-any . #(each ((any . any) any)))))) + (if (if tmp-1 + (apply (lambda (dots k keyword pattern template) (identifier? dots)) + tmp-1) + #f) + (apply (lambda (dots k keyword pattern template) + (expand-syntax-rules + dots + k + '() + (map (lambda (tmp-680b775fb37a463-2 tmp-680b775fb37a463-1 tmp-680b775fb37a463) + (list (cons tmp-680b775fb37a463 tmp-680b775fb37a463-1) + tmp-680b775fb37a463-2)) + template + pattern + keyword))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(_ any each-any any . #(each ((any . any) any)))))) + (if (if tmp-1 + (apply (lambda (dots k docstring keyword pattern template) + (if (identifier? dots) (string? (syntax->datum docstring)) #f)) + tmp-1) + #f) + (apply (lambda (dots k docstring keyword pattern template) + (expand-syntax-rules + dots + k + (list docstring) + (map (lambda (tmp-680b775fb37a463-2 tmp-680b775fb37a463-1 tmp-680b775fb37a463) + (list (cons tmp-680b775fb37a463 tmp-680b775fb37a463-1) + tmp-680b775fb37a463-2)) + template + pattern + keyword))) + tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp))))))))))))))) + +(define define-syntax-rule + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'define-syntax-rule + 'macro + (lambda (x) + (let ((tmp-1 x)) + (let ((tmp ($sc-dispatch tmp-1 '(_ (any . any) any)))) + (if tmp + (apply (lambda (name pattern template) + (list (make-syntax 'define-syntax '((top)) '(hygiene guile)) + name + (list (make-syntax 'syntax-rules '((top)) '(hygiene guile)) + '() + (list (cons (make-syntax '_ '((top)) '(hygiene guile)) pattern) + template)))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(_ (any . any) any any)))) + (if (if tmp + (apply (lambda (name pattern docstring template) + (string? (syntax->datum docstring))) + tmp) + #f) + (apply (lambda (name pattern docstring template) + (list (make-syntax 'define-syntax '((top)) '(hygiene guile)) + name + (list (make-syntax 'syntax-rules '((top)) '(hygiene guile)) + '() + docstring + (list (cons (make-syntax '_ '((top)) '(hygiene guile)) pattern) + template)))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))))) + +(define let* + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'let* + 'macro + (lambda (x) + (let ((tmp-1 x)) + (let ((tmp ($sc-dispatch tmp-1 '(any #(each (any any)) any . each-any)))) + (if (if tmp + (apply (lambda (let* x v e1 e2) (and-map identifier? x)) tmp) + #f) + (apply (lambda (let* x v e1 e2) + (let f ((bindings (map list x v))) + (if (null? bindings) + (cons (make-syntax 'let '((top)) '(hygiene guile)) + (cons '() (cons e1 e2))) + (let ((tmp-1 (list (f (cdr bindings)) (car bindings)))) + (let ((tmp ($sc-dispatch tmp-1 '(any any)))) + (if tmp + (apply (lambda (body binding) + (list (make-syntax 'let '((top)) '(hygiene guile)) + (list binding) + body)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))) + +(define quasiquote + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'quasiquote + 'macro + (letrec* + ((quasi (lambda (p lev) + (let ((tmp p)) + (let ((tmp-1 ($sc-dispatch + tmp + (list (vector 'free-id (make-syntax 'unquote '((top)) '(hygiene guile))) + 'any)))) + (if tmp-1 + (apply (lambda (p) + (if (= lev 0) + (list "value" p) + (quasicons + (list "quote" (make-syntax 'unquote '((top)) '(hygiene guile))) + (quasi (list p) (- lev 1))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch + tmp + (list (vector + 'free-id + (make-syntax + 'quasiquote + (list '(top) + (vector + 'ribcage + '#(quasiquote) + '#((top)) + (vector + (cons '(hygiene guile) + (make-syntax 'quasiquote '((top)) '(hygiene guile)))))) + '(hygiene guile))) + 'any)))) + (if tmp-1 + (apply (lambda (p) + (quasicons + (list "quote" + (make-syntax + 'quasiquote + (list '(top) + (vector + 'ribcage + '#(quasiquote) + '#((top)) + (vector + (cons '(hygiene guile) + (make-syntax 'quasiquote '((top)) '(hygiene guile)))))) + '(hygiene guile))) + (quasi (list p) (+ lev 1)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if tmp-1 + (apply (lambda (p q) + (let ((tmp-1 p)) + (let ((tmp ($sc-dispatch + tmp-1 + (cons (vector + 'free-id + (make-syntax 'unquote '((top)) '(hygiene guile))) + 'each-any)))) + (if tmp + (apply (lambda (p) + (if (= lev 0) + (quasilist* + (map (lambda (tmp-680b775fb37a463-11f3) + (list "value" tmp-680b775fb37a463-11f3)) + p) + (quasi q lev)) + (quasicons + (quasicons + (list "quote" + (make-syntax 'unquote '((top)) '(hygiene guile))) + (quasi p (- lev 1))) + (quasi q lev)))) + tmp) + (let ((tmp ($sc-dispatch + tmp-1 + (cons (vector + 'free-id + (make-syntax + 'unquote-splicing + '((top)) + '(hygiene guile))) + 'each-any)))) + (if tmp + (apply (lambda (p) + (if (= lev 0) + (quasiappend + (map (lambda (tmp-680b775fb37a463-11f8) + (list "value" tmp-680b775fb37a463-11f8)) + p) + (quasi q lev)) + (quasicons + (quasicons + (list "quote" + (make-syntax + 'unquote-splicing + '((top)) + '(hygiene guile))) + (quasi p (- lev 1))) + (quasi q lev)))) + tmp) + (quasicons (quasi p lev) (quasi q lev)))))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '#(vector each-any)))) + (if tmp-1 + (apply (lambda (x) (quasivector (vquasi x lev))) tmp-1) + (let ((p tmp)) (list "quote" p))))))))))))) + (vquasi + (lambda (p lev) + (let ((tmp p)) + (let ((tmp-1 ($sc-dispatch tmp '(any . any)))) + (if tmp-1 + (apply (lambda (p q) + (let ((tmp-1 p)) + (let ((tmp ($sc-dispatch + tmp-1 + (cons (vector 'free-id (make-syntax 'unquote '((top)) '(hygiene guile))) + 'each-any)))) + (if tmp + (apply (lambda (p) + (if (= lev 0) + (quasilist* + (map (lambda (tmp-680b775fb37a463-120e) + (list "value" tmp-680b775fb37a463-120e)) + p) + (vquasi q lev)) + (quasicons + (quasicons + (list "quote" (make-syntax 'unquote '((top)) '(hygiene guile))) + (quasi p (- lev 1))) + (vquasi q lev)))) + tmp) + (let ((tmp ($sc-dispatch + tmp-1 + (cons (vector + 'free-id + (make-syntax 'unquote-splicing '((top)) '(hygiene guile))) + 'each-any)))) + (if tmp + (apply (lambda (p) + (if (= lev 0) + (quasiappend + (map (lambda (tmp-680b775fb37a463) + (list "value" tmp-680b775fb37a463)) + p) + (vquasi q lev)) + (quasicons + (quasicons + (list "quote" + (make-syntax 'unquote-splicing '((top)) '(hygiene guile))) + (quasi p (- lev 1))) + (vquasi q lev)))) + tmp) + (quasicons (quasi p lev) (vquasi q lev)))))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '()))) + (if tmp-1 + (apply (lambda () '("quote" ())) tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp)))))))) + (quasicons + (lambda (x y) + (let ((tmp-1 (list x y))) + (let ((tmp ($sc-dispatch tmp-1 '(any any)))) + (if tmp + (apply (lambda (x y) + (let ((tmp y)) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "quote") any)))) + (if tmp-1 + (apply (lambda (dy) + (let ((tmp x)) + (let ((tmp ($sc-dispatch tmp '(#(atom "quote") any)))) + (if tmp + (apply (lambda (dx) (list "quote" (cons dx dy))) tmp) + (if (null? dy) (list "list" x) (list "list*" x y)))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "list") . any)))) + (if tmp-1 + (apply (lambda (stuff) (cons "list" (cons x stuff))) tmp-1) + (let ((tmp ($sc-dispatch tmp '(#(atom "list*") . any)))) + (if tmp + (apply (lambda (stuff) (cons "list*" (cons x stuff))) tmp) + (list "list*" x y))))))))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))) + (quasiappend + (lambda (x y) + (let ((tmp y)) + (let ((tmp ($sc-dispatch tmp '(#(atom "quote") ())))) + (if tmp + (apply (lambda () + (if (null? x) + '("quote" ()) + (if (null? (cdr x)) + (car x) + (let ((tmp-1 x)) + (let ((tmp ($sc-dispatch tmp-1 'each-any))) + (if tmp + (apply (lambda (p) (cons "append" p)) tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))))) + tmp) + (if (null? x) + y + (let ((tmp-1 (list x y))) + (let ((tmp ($sc-dispatch tmp-1 '(each-any any)))) + (if tmp + (apply (lambda (p y) (cons "append" (append p (list y)))) tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))))) + (quasilist* + (lambda (x y) + (let f ((x x)) (if (null? x) y (quasicons (car x) (f (cdr x))))))) + (quasivector + (lambda (x) + (let ((tmp x)) + (let ((tmp ($sc-dispatch tmp '(#(atom "quote") each-any)))) + (if tmp + (apply (lambda (x) (list "quote" (list->vector x))) tmp) + (let f ((y x) + (k (lambda (ls) + (let ((tmp-1 ls)) + (let ((tmp ($sc-dispatch tmp-1 'each-any))) + (if tmp + (apply (lambda (t-680b775fb37a463-125c) + (cons "vector" t-680b775fb37a463-125c)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))))) + (let ((tmp y)) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "quote") each-any)))) + (if tmp-1 + (apply (lambda (y) + (k (map (lambda (tmp-680b775fb37a463) (list "quote" tmp-680b775fb37a463)) + y))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "list") . each-any)))) + (if tmp-1 + (apply (lambda (y) (k y)) tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "list*") . #(each+ any (any) ()))))) + (if tmp-1 + (apply (lambda (y z) (f z (lambda (ls) (k (append y ls))))) tmp-1) + (let ((else tmp)) + (let ((tmp x)) + (let ((t-680b775fb37a463 tmp)) + (list "list->vector" t-680b775fb37a463))))))))))))))))) + (emit (lambda (x) + (let ((tmp x)) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "quote") any)))) + (if tmp-1 + (apply (lambda (x) (list (make-syntax 'quote '((top)) '(hygiene guile)) x)) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "list") . each-any)))) + (if tmp-1 + (apply (lambda (x) + (let ((tmp-1 (map emit x))) + (let ((tmp ($sc-dispatch tmp-1 'each-any))) + (if tmp + (apply (lambda (t-680b775fb37a463) + (cons (make-syntax 'list '((top)) '(hygiene guile)) + t-680b775fb37a463)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "list*") . #(each+ any (any) ()))))) + (if tmp-1 + (apply (lambda (x y) + (let f ((x* x)) + (if (null? x*) + (emit y) + (let ((tmp-1 (list (emit (car x*)) (f (cdr x*))))) + (let ((tmp ($sc-dispatch tmp-1 '(any any)))) + (if tmp + (apply (lambda (t-680b775fb37a463-129a t-680b775fb37a463) + (list (make-syntax 'cons '((top)) '(hygiene guile)) + t-680b775fb37a463-129a + t-680b775fb37a463)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "append") . each-any)))) + (if tmp-1 + (apply (lambda (x) + (let ((tmp-1 (map emit x))) + (let ((tmp ($sc-dispatch tmp-1 'each-any))) + (if tmp + (apply (lambda (t-680b775fb37a463-12a6) + (cons (make-syntax 'append '((top)) '(hygiene guile)) + t-680b775fb37a463-12a6)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "vector") . each-any)))) + (if tmp-1 + (apply (lambda (x) + (let ((tmp-1 (map emit x))) + (let ((tmp ($sc-dispatch tmp-1 'each-any))) + (if tmp + (apply (lambda (t-680b775fb37a463-12b2) + (cons (make-syntax 'vector '((top)) '(hygiene guile)) + t-680b775fb37a463-12b2)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "list->vector") any)))) + (if tmp-1 + (apply (lambda (x) + (let ((tmp (emit x))) + (let ((t-680b775fb37a463-12be tmp)) + (list (make-syntax 'list->vector '((top)) '(hygiene guile)) + t-680b775fb37a463-12be)))) + tmp-1) + (let ((tmp-1 ($sc-dispatch tmp '(#(atom "value") any)))) + (if tmp-1 + (apply (lambda (x) x) tmp-1) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp))))))))))))))))))) + (lambda (x) + (let ((tmp-1 x)) + (let ((tmp ($sc-dispatch tmp-1 '(_ any)))) + (if tmp + (apply (lambda (e) (emit (quasi e 0))) tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1))))))))) + +(define include + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'include + 'macro + (lambda (x) + (letrec* + ((read-file + (lambda (fn dir k) + (let ((p (open-input-file + (if (absolute-file-name? fn) + fn + (if dir + (in-vicinity dir fn) + (syntax-violation + 'include + "relative file name only allowed when the include form is in a file" + x)))))) + (let ((enc (file-encoding p))) + (set-port-encoding! p (let ((t enc)) (if t t "UTF-8"))) + (let f ((x (read p)) (result '())) + (if (eof-object? x) + (begin (close-port p) (reverse result)) + (f (read p) (cons (datum->syntax k x) result))))))))) + (let ((src (syntax-source x))) + (let ((file (if src (assq-ref src 'filename) #f))) + (let ((dir (if (string? file) (dirname file) #f))) + (let ((tmp-1 x)) + (let ((tmp ($sc-dispatch tmp-1 '(any any)))) + (if tmp + (apply (lambda (k filename) + (let ((fn (syntax->datum filename))) + (let ((tmp-1 (read-file fn dir filename))) + (let ((tmp ($sc-dispatch tmp-1 'each-any))) + (if tmp + (apply (lambda (exp) + (cons (make-syntax 'begin '((top)) '(hygiene guile)) exp)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))))))) + +(define include-from-path + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'include-from-path + 'macro + (lambda (x) + (let ((tmp-1 x)) + (let ((tmp ($sc-dispatch tmp-1 '(any any)))) + (if tmp + (apply (lambda (k filename) + (let ((fn (syntax->datum filename))) + (let ((tmp (datum->syntax + filename + (canonicalize-path + (let ((t (%search-load-path fn))) + (if t + t + (syntax-violation + 'include-from-path + "file not found in path" + x + filename))))))) + (let ((fn tmp)) + (list (make-syntax 'include '((top)) '(hygiene guile)) fn))))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))) + +(define unquote + (make-syntax-transformer + 'unquote + 'macro + (lambda (x) + (syntax-violation + 'unquote + "expression not valid outside of quasiquote" + x)))) + +(define unquote-splicing + (make-syntax-transformer + 'unquote-splicing + 'macro + (lambda (x) + (syntax-violation + 'unquote-splicing + "expression not valid outside of quasiquote" + x)))) + +(define make-variable-transformer + (lambda (proc) + (if (procedure? proc) + (let ((trans (lambda (x) (proc x)))) + (set-procedure-property! trans 'variable-transformer #t) + trans) + (error "variable transformer not a procedure" proc)))) + +(define identifier-syntax + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'identifier-syntax + 'macro + (lambda (xx) + (let ((tmp-1 xx)) + (let ((tmp ($sc-dispatch tmp-1 '(_ any)))) + (if tmp + (apply (lambda (e) + (list (make-syntax 'lambda '((top)) '(hygiene guile)) + (list (make-syntax 'x '((top)) '(hygiene guile))) + (vector + (cons (make-syntax 'macro-type '((top)) '(hygiene guile)) + (make-syntax + 'identifier-syntax + (list '(top) + (vector + 'ribcage + '#(identifier-syntax) + '#((top)) + (vector + (cons '(hygiene guile) + (make-syntax 'identifier-syntax '((top)) '(hygiene guile)))))) + '(hygiene guile)))) + (list (make-syntax 'syntax-case '((top)) '(hygiene guile)) + (make-syntax 'x '((top)) '(hygiene guile)) + '() + (list (make-syntax 'id '((top)) '(hygiene guile)) + (list (make-syntax 'identifier? '((top)) '(hygiene guile)) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) + (make-syntax 'id '((top)) '(hygiene guile)))) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) e)) + (list (list (make-syntax '_ '((top)) '(hygiene guile)) + (make-syntax 'x '((top)) '(hygiene guile)) + (make-syntax '... '((top)) '(hygiene guile))) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) + (cons e + (list (make-syntax 'x '((top)) '(hygiene guile)) + (make-syntax '... '((top)) '(hygiene guile))))))))) + tmp) + (let ((tmp ($sc-dispatch + tmp-1 + (list '_ + '(any any) + (list (list (vector 'free-id (make-syntax 'set! '((top)) '(hygiene guile))) + 'any + 'any) + 'any))))) + (if (if tmp + (apply (lambda (id exp1 var val exp2) + (if (identifier? id) (identifier? var) #f)) + tmp) + #f) + (apply (lambda (id exp1 var val exp2) + (list (make-syntax 'make-variable-transformer '((top)) '(hygiene guile)) + (list (make-syntax 'lambda '((top)) '(hygiene guile)) + (list (make-syntax 'x '((top)) '(hygiene guile))) + (vector + (cons (make-syntax 'macro-type '((top)) '(hygiene guile)) + (make-syntax 'variable-transformer '((top)) '(hygiene guile)))) + (list (make-syntax 'syntax-case '((top)) '(hygiene guile)) + (make-syntax 'x '((top)) '(hygiene guile)) + (list (make-syntax 'set! '((top)) '(hygiene guile))) + (list (list (make-syntax 'set! '((top)) '(hygiene guile)) var val) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) exp2)) + (list (cons id + (list (make-syntax 'x '((top)) '(hygiene guile)) + (make-syntax '... '((top)) '(hygiene guile)))) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) + (cons exp1 + (list (make-syntax 'x '((top)) '(hygiene guile)) + (make-syntax '... '((top)) '(hygiene guile)))))) + (list id + (list (make-syntax 'identifier? '((top)) '(hygiene guile)) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) id)) + (list (make-syntax 'syntax '((top)) '(hygiene guile)) exp1)))))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))))) + +(define define* + (let ((make-syntax make-syntax)) + (make-syntax-transformer + 'define* + 'macro + (lambda (x) + (let ((tmp-1 x)) + (let ((tmp ($sc-dispatch tmp-1 '(_ (any . any) any . each-any)))) + (if tmp + (apply (lambda (id args b0 b1) + (list (make-syntax 'define '((top)) '(hygiene guile)) + id + (cons (make-syntax 'lambda* '((top)) '(hygiene guile)) + (cons args (cons b0 b1))))) + tmp) + (let ((tmp ($sc-dispatch tmp-1 '(_ any any)))) + (if (if tmp (apply (lambda (id val) (identifier? id)) tmp) #f) + (apply (lambda (id val) + (list (make-syntax 'define '((top)) '(hygiene guile)) id val)) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))))) + diff --git a/lilypond-2.24.2/share/guile/2.2/ice-9/psyntax.scm b/lilypond-2.24.2/share/guile/2.2/ice-9/psyntax.scm new file mode 100644 index 0000000000000000000000000000000000000000..a51e99d9cf1b138781b37c5942cd775817ff2ae6 --- /dev/null +++ b/lilypond-2.24.2/share/guile/2.2/ice-9/psyntax.scm @@ -0,0 +1,3326 @@ +;;;; -*-scheme-*- +;;;; +;;;; Copyright (C) 2001, 2003, 2006, 2009, 2010, 2011, +;;;; 2012, 2013, 2015, 2016, 2019 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + + +;;; Portable implementation of syntax-case +;;; Originally extracted from Chez Scheme Version 5.9f +;;; Authors: R. Kent Dybvig, Oscar Waddell, Bob Hieb, Carl Bruggeman + +;;; Copyright (c) 1992-1997 Cadence Research Systems +;;; Permission to copy this software, in whole or in part, to use this +;;; software for any lawful purpose, and to redistribute this software +;;; is granted subject to the restriction that all copies made of this +;;; software must include this copyright notice in full. This software +;;; is provided AS IS, with NO WARRANTY, EITHER EXPRESS OR IMPLIED, +;;; INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY +;;; OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT SHALL THE +;;; AUTHORS BE LIABLE FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES OF ANY +;;; NATURE WHATSOEVER. + +;;; Modified by Mikael Djurfeldt according +;;; to the ChangeLog distributed in the same directory as this file: +;;; 1997-08-19, 1997-09-03, 1997-09-10, 2000-08-13, 2000-08-24, +;;; 2000-09-12, 2001-03-08 + +;;; Modified by Andy Wingo according to the Git +;;; revision control logs corresponding to this file: 2009, 2010. + +;;; Modified by Mark H Weaver according to the Git +;;; revision control logs corresponding to this file: 2012, 2013. + + +;;; This code is based on "Syntax Abstraction in Scheme" +;;; by R. Kent Dybvig, Robert Hieb, and Carl Bruggeman. +;;; Lisp and Symbolic Computation 5:4, 295-326, 1992. +;;; + + +;;; This file defines the syntax-case expander, macroexpand, and a set +;;; of associated syntactic forms and procedures. Of these, the +;;; following are documented in The Scheme Programming Language, +;;; Fourth Edition (R. Kent Dybvig, MIT Press, 2009), and in the +;;; R6RS: +;;; +;;; bound-identifier=? +;;; datum->syntax +;;; define-syntax +;;; syntax-parameterize +;;; free-identifier=? +;;; generate-temporaries +;;; identifier? +;;; identifier-syntax +;;; let-syntax +;;; letrec-syntax +;;; syntax +;;; syntax-case +;;; syntax->datum +;;; syntax-rules +;;; with-syntax +;;; +;;; Additionally, the expander provides definitions for a number of core +;;; Scheme syntactic bindings, such as `let', `lambda', and the like. + +;;; The remaining exports are listed below: +;;; +;;; (macroexpand datum) +;;; if datum represents a valid expression, macroexpand returns an +;;; expanded version of datum in a core language that includes no +;;; syntactic abstractions. The core language includes begin, +;;; define, if, lambda, letrec, quote, and set!. +;;; (eval-when situations expr ...) +;;; conditionally evaluates expr ... at compile-time or run-time +;;; depending upon situations (see the Chez Scheme System Manual, +;;; Revision 3, for a complete description) +;;; (syntax-violation who message form [subform]) +;;; used to report errors found during expansion +;;; ($sc-dispatch e p) +;;; used by expanded code to handle syntax-case matching + +;;; This file is shipped along with an expanded version of itself, +;;; psyntax-pp.scm, which is loaded when psyntax.scm has not yet been +;;; compiled. In this way, psyntax bootstraps off of an expanded +;;; version of itself. + +;;; This implementation of the expander sometimes uses syntactic +;;; abstractions when procedural abstractions would suffice. For +;;; example, we define top-wrap and top-marked? as +;;; +;;; (define-syntax top-wrap (identifier-syntax '((top)))) +;;; (define-syntax top-marked? +;;; (syntax-rules () +;;; ((_ w) (memq 'top (wrap-marks w))))) +;;; +;;; rather than +;;; +;;; (define top-wrap '((top))) +;;; (define top-marked? +;;; (lambda (w) (memq 'top (wrap-marks w)))) +;;; +;;; On the other hand, we don't do this consistently; we define +;;; make-wrap, wrap-marks, and wrap-subst simply as +;;; +;;; (define make-wrap cons) +;;; (define wrap-marks car) +;;; (define wrap-subst cdr) +;;; +;;; In Chez Scheme, the syntactic and procedural forms of these +;;; abstractions are equivalent, since the optimizer consistently +;;; integrates constants and small procedures. This will be true of +;;; Guile as well, once we implement a proper inliner. + + +;;; Implementation notes: + +;;; Objects with no standard print syntax, including objects containing +;;; cycles and syntax object, are allowed in quoted data as long as they +;;; are contained within a syntax form or produced by datum->syntax. +;;; Such objects are never copied. + +;;; All identifiers that don't have macro definitions and are not bound +;;; lexically are assumed to be global variables. + +;;; Top-level definitions of macro-introduced identifiers are allowed. +;;; This may not be appropriate for implementations in which the +;;; model is that bindings are created by definitions, as opposed to +;;; one in which initial values are assigned by definitions. + +;;; Identifiers and syntax objects are implemented as vectors for +;;; portability. As a result, it is possible to "forge" syntax objects. + +;;; The implementation of generate-temporaries assumes that it is +;;; possible to generate globally unique symbols (gensyms). + +;;; The source location associated with incoming expressions is tracked +;;; via the source-properties mechanism, a weak map from expression to +;;; source information. At times the source is separated from the +;;; expression; see the note below about "efficiency and confusion". + + +;;; Bootstrapping: + +;;; When changing syntax-object representations, it is necessary to support +;;; both old and new syntax-object representations in id-var-name. It +;;; should be sufficient to recognize old representations and treat +;;; them as not lexically bound. + + + +(eval-when (compile) + (set-current-module (resolve-module '(guile)))) + +(let ((syntax? (module-ref (current-module) 'syntax?)) + (make-syntax (module-ref (current-module) 'make-syntax)) + (syntax-expression (module-ref (current-module) 'syntax-expression)) + (syntax-wrap (module-ref (current-module) 'syntax-wrap)) + (syntax-module (module-ref (current-module) 'syntax-module))) + + (define-syntax define-expansion-constructors + (lambda (x) + (syntax-case x () + ((_) + (let lp ((n 0) (out '())) + (if (< n (vector-length %expanded-vtables)) + (lp (1+ n) + (let* ((vtable (vector-ref %expanded-vtables n)) + (stem (struct-ref vtable (+ vtable-offset-user 0))) + (fields (struct-ref vtable (+ vtable-offset-user 2))) + (sfields (map (lambda (f) (datum->syntax x f)) fields)) + (ctor (datum->syntax x (symbol-append 'make- stem)))) + (cons #`(define (#,ctor #,@sfields) + (make-struct/no-tail + (vector-ref %expanded-vtables #,n) + #,@sfields)) + out))) + #`(begin #,@(reverse out)))))))) + + (define-syntax define-expansion-accessors + (lambda (x) + (syntax-case x () + ((_ stem field ...) + (let lp ((n 0)) + (let ((vtable (vector-ref %expanded-vtables n)) + (stem (syntax->datum #'stem))) + (if (eq? (struct-ref vtable (+ vtable-offset-user 0)) stem) + #`(begin + (define (#,(datum->syntax x (symbol-append stem '?)) x) + (and (struct? x) + (eq? (struct-vtable x) + (vector-ref %expanded-vtables #,n)))) + #,@(map + (lambda (f) + (let ((get (datum->syntax x (symbol-append stem '- f))) + (set (datum->syntax x (symbol-append 'set- stem '- f '!))) + (idx (list-index (struct-ref vtable + (+ vtable-offset-user 2)) + f))) + #`(begin + (define (#,get x) + (struct-ref x #,idx)) + (define (#,set x v) + (struct-set! x #,idx v))))) + (syntax->datum #'(field ...)))) + (lp (1+ n))))))))) + + (define-syntax define-structure + (lambda (x) + (define construct-name + (lambda (template-identifier . args) + (datum->syntax + template-identifier + (string->symbol + (apply string-append + (map (lambda (x) + (if (string? x) + x + (symbol->string (syntax->datum x)))) + args)))))) + (syntax-case x () + ((_ (name id1 ...)) + (and-map identifier? #'(name id1 ...)) + (with-syntax + ((constructor (construct-name #'name "make-" #'name)) + (predicate (construct-name #'name #'name "?")) + ((access ...) + (map (lambda (x) (construct-name x #'name "-" x)) + #'(id1 ...))) + ((assign ...) + (map (lambda (x) + (construct-name x "set-" #'name "-" x "!")) + #'(id1 ...))) + (structure-length + (+ (length #'(id1 ...)) 1)) + ((index ...) + (let f ((i 1) (ids #'(id1 ...))) + (if (null? ids) + '() + (cons i (f (+ i 1) (cdr ids))))))) + #'(begin + (define constructor + (lambda (id1 ...) + (vector 'name id1 ... ))) + (define predicate + (lambda (x) + (and (vector? x) + (= (vector-length x) structure-length) + (eq? (vector-ref x 0) 'name)))) + (define access + (lambda (x) + (vector-ref x index))) + ... + (define assign + (lambda (x update) + (vector-set! x index update))) + ...)))))) + + (let () + (define-expansion-constructors) + (define-expansion-accessors lambda meta) + + ;; hooks to nonportable run-time helpers + (begin + (define-syntax fx+ (identifier-syntax +)) + (define-syntax fx- (identifier-syntax -)) + (define-syntax fx= (identifier-syntax =)) + (define-syntax fx< (identifier-syntax <)) + + (define top-level-eval-hook + (lambda (x mod) + (primitive-eval x))) + + (define local-eval-hook + (lambda (x mod) + (primitive-eval x))) + + ;; Capture syntax-session-id before we shove it off into a module. + (define session-id + (let ((v (module-variable (current-module) 'syntax-session-id))) + (lambda () + ((variable-ref v)))))) + + (define (decorate-source e s) + (if (and s (supports-source-properties? e)) + (set-source-properties! e s)) + e) + + (define (maybe-name-value! name val) + (if (lambda? val) + (let ((meta (lambda-meta val))) + (if (not (assq 'name meta)) + (set-lambda-meta! val (acons 'name name meta)))))) + + ;; output constructors + (define build-void + (lambda (source) + (make-void source))) + + (define build-call + (lambda (source fun-exp arg-exps) + (make-call source fun-exp arg-exps))) + + (define build-conditional + (lambda (source test-exp then-exp else-exp) + (make-conditional source test-exp then-exp else-exp))) + + (define build-lexical-reference + (lambda (type source name var) + (make-lexical-ref source name var))) + + (define build-lexical-assignment + (lambda (source name var exp) + (maybe-name-value! name exp) + (make-lexical-set source name var exp))) + + (define (analyze-variable mod var modref-cont bare-cont) + (if (not mod) + (bare-cont var) + (let ((kind (car mod)) + (mod (cdr mod))) + (case kind + ((public) (modref-cont mod var #t)) + ((private) (if (not (equal? mod (module-name (current-module)))) + (modref-cont mod var #f) + (bare-cont var))) + ((bare) (bare-cont var)) + ((hygiene) (if (and (not (equal? mod (module-name (current-module)))) + (module-variable (resolve-module mod) var)) + (modref-cont mod var #f) + (bare-cont var))) + ((primitive) + (syntax-violation #f "primitive not in operator position" var)) + (else (syntax-violation #f "bad module kind" var mod)))))) + + (define build-global-reference + (lambda (source var mod) + (analyze-variable + mod var + (lambda (mod var public?) + (make-module-ref source mod var public?)) + (lambda (var) + (make-toplevel-ref source var))))) + + (define build-global-assignment + (lambda (source var exp mod) + (maybe-name-value! var exp) + (analyze-variable + mod var + (lambda (mod var public?) + (make-module-set source mod var public? exp)) + (lambda (var) + (make-toplevel-set source var exp))))) + + (define build-global-definition + (lambda (source var exp) + (maybe-name-value! var exp) + (make-toplevel-define source var exp))) + + (define build-simple-lambda + (lambda (src req rest vars meta exp) + (make-lambda src + meta + ;; hah, a case in which kwargs would be nice. + (make-lambda-case + ;; src req opt rest kw inits vars body else + src req #f rest #f '() vars exp #f)))) + + (define build-case-lambda + (lambda (src meta body) + (make-lambda src meta body))) + + (define build-lambda-case + ;; req := (name ...) + ;; opt := (name ...) | #f + ;; rest := name | #f + ;; kw := (allow-other-keys? (keyword name var) ...) | #f + ;; inits: (init ...) + ;; vars: (sym ...) + ;; vars map to named arguments in the following order: + ;; required, optional (positional), rest, keyword. + ;; the body of a lambda: anything, already expanded + ;; else: lambda-case | #f + (lambda (src req opt rest kw inits vars body else-case) + (make-lambda-case src req opt rest kw inits vars body else-case))) + + (define build-primcall + (lambda (src name args) + (make-primcall src name args))) + + (define build-primref + (lambda (src name) + (make-primitive-ref src name))) + + (define (build-data src exp) + (make-const src exp)) + + (define build-sequence + (lambda (src exps) + (if (null? (cdr exps)) + (car exps) + (make-seq src (car exps) (build-sequence #f (cdr exps)))))) + + (define build-let + (lambda (src ids vars val-exps body-exp) + (for-each maybe-name-value! ids val-exps) + (if (null? vars) + body-exp + (make-let src ids vars val-exps body-exp)))) + + (define build-named-let + (lambda (src ids vars val-exps body-exp) + (let ((f (car vars)) + (f-name (car ids)) + (vars (cdr vars)) + (ids (cdr ids))) + (let ((proc (build-simple-lambda src ids #f vars '() body-exp))) + (maybe-name-value! f-name proc) + (for-each maybe-name-value! ids val-exps) + (make-letrec + src #f + (list f-name) (list f) (list proc) + (build-call src (build-lexical-reference 'fun src f-name f) + val-exps)))))) + + (define build-letrec + (lambda (src in-order? ids vars val-exps body-exp) + (if (null? vars) + body-exp + (begin + (for-each maybe-name-value! ids val-exps) + (make-letrec src in-order? ids vars val-exps body-exp))))) + + + (define-syntax-rule (build-lexical-var src id) + ;; Use a per-module counter instead of the global counter of + ;; 'gensym' so that the generated identifier is reproducible. + (module-gensym (symbol->string id))) + + (define (syntax-object? x) + (or (syntax? x) + (and (allow-legacy-syntax-objects?) + (vector? x) + (= (vector-length x) 4) + (eqv? (vector-ref x 0) 'syntax-object)))) + (define (make-syntax-object expression wrap module) + (make-syntax expression wrap module)) + (define (syntax-object-expression obj) + (if (syntax? obj) + (syntax-expression obj) + (vector-ref obj 1))) + (define (syntax-object-wrap obj) + (if (syntax? obj) + (syntax-wrap obj) + (vector-ref obj 2))) + (define (syntax-object-module obj) + (if (syntax? obj) + (syntax-module obj) + (vector-ref obj 3))) + + (define-syntax no-source (identifier-syntax #f)) + + (define source-annotation + (lambda (x) + (let ((props (source-properties + (if (syntax-object? x) + (syntax-object-expression x) + x)))) + (and (pair? props) props)))) + + (define-syntax-rule (arg-check pred? e who) + (let ((x e)) + (if (not (pred? x)) (syntax-violation who "invalid argument" x)))) + + ;; compile-time environments + + ;; wrap and environment comprise two level mapping. + ;; wrap : id --> label + ;; env : label --> + + ;; environments are represented in two parts: a lexical part and a + ;; global part. The lexical part is a simple list of associations + ;; from labels to bindings. The global part is implemented by + ;; Guile's module system and associates symbols with bindings. + + ;; global (assumed global variable) and displaced-lexical (see below) + ;; do not show up in any environment; instead, they are fabricated by + ;; resolve-identifier when it finds no other bindings. + + ;; ::= ((