This file is indexed.

/usr/bin/mma-libdoc is in mma 16.06-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
#! /usr/bin/python

# Parse libraries and create html docs (works in py 2 & 3)

import os, sys, time, platform, subprocess

if len(sys.argv)>1:
    print("""mma-libdoc is a MMA maintenance program to parse library
 files and create/maintain the html library documentation.
 This program should be run as 'root' and it takes no
 command options. For more details see the file
 "README.mma-libdoc" which is distributed with MMA.""")
    sys.exit(0)

installdir = ( "c:\\mma\\", "/usr/local/share/mma", "/usr/share/mma", ".")

libpath = ''
docpath = ''

for p in installdir:
    a = os.path.join(p, 'lib', '')
    if os.path.isdir(a):
        libpath=a
        docpath = os.path.join(p, 'docs', 'html', 'lib')
        break

if not libpath:
    print("Can't find the MMA library!")
    print("Please check your installation and/or change the search path in this program.")
    sys.exit(1)

try:
    os.mkdir(docpath)
except:
    pass

index = []
links = []

MMA = "mma"   # set different path to mma if you need to

if platform == "Windows":
    sh_value = True
else:
    sh_value = False


print("Processing library files")

def  dodir(dir):
    """ Process files in directory.  """

    global index, links
    newdirs = []

    olib = os.path.join(docpath, dir)
    if not os.path.isdir(olib):
        try:
            os.mkdir(olib)
        except:
            print("Can't create directory %s" % olib)
            sys.exit(1)

    links.append("<li> <A Href=#%s> <h2> %s </h2> </a> </li>" % (dir, dir.title()))

    if dir.lower() == "stdlib":
        index.append("<P><h3>These grooves can be used from a program just by using their name.</h3>")

    index.append("<A Name =%s></a>" % dir)
    index.append("<h2> %s </h2>" % dir.title() )

    index.append("<ul>")


    for f in sorted(os.listdir(libpath + dir)):
        this = os.path.join(libpath, dir, f)

        if f.startswith('#') or f.startswith('.'):   # ignore backup and hidden
                continue

        if os.path.isdir(this):
            newdirs.append(os.path.join(dir, f))
            continue

        if this.endswith('.mma'):
            htmlfname = os.path.join(dir, f.replace('.mma' , '.html'))
            htmldate = 0
            htmlout = os.path.join(docpath, htmlfname)
            try:
                htmldate = os.path.getmtime(htmlout)
            except:
                pass

            libdate = 0
            try:
                libdate = os.path.getmtime(this)
            except:
                print("NO, NO, NO --- let Bob know about this!")
                pass   # shouldn't ever happen!

            if libdate < htmldate:
                print("Skipping: %s" % this)

            else:
                if htmldate == 0:
                    print("Creating: %s" % htmlfname)
                else:
                    print("Updating: %s" % htmlfname)
                try:
                    pid = subprocess.Popen( [MMA, "-Dxh", "-w", "-n", this],
                          shell=sh_value, stdout=subprocess.PIPE)
                    output = pid.communicate()[0]

                except:
                    print("Error forking %s. Is MMA variable correctly set?" % MMA)
                    sys.exit(1)

                try:
                    o = open(htmlout, "w")
                    output = output.decode(encoding="UTF-8")  # for py3
                    o.write(output)
                    o.close()
                except:
                    print("ERROR Creating %s" % htmlout)
                    continue
                    

                # Now make html files for each groove in the lib file.

                for a in open(htmlout):
                    if a.startswith("<!-- GROOVE"):
                        a=a.split()
                        gname = a[1].split('=', 1)[1]
                        gout = os.path.join(docpath, dir, a[2].split('=', 1)[1])
                        srcfile = a[3].split('=', 1)[1]

                        try:
                            pid = subprocess.Popen( [MMA, "-Dgh", "-w", "-n",
                               "%s/%s" % (srcfile, gname)],
                               shell=sh_value, stdout=subprocess.PIPE)
                            output = pid.communicate()[0]
                        except:
                            print("Error forking %s. Is MMA variable correctly set?")
                            sys.exit(1)

                        try:
                            o = open(gout, "w")
                            output = output.decode(encoding="UTF-8")  # for py3
                            o.write(str(output))
                            o.close()
                        except:
                            print("ERROR Creating %s" % gout)
                        continue


            index.append("<li> <A Href = %s> %s </a> </li>" % \
                     (htmlfname, os.path.join(dir, f)))

    index.append("</ul>")

    if dir.lower() == "stdlib":
        index.append('<P><h3>These groove should be callable just by using their names. If you have problems with duplicate groove names you can always force their use with a "use" directive.</h3>')

    for d in newdirs:
        dodir(d)

##############################


a = os.listdir(libpath)
dirs = []

for b in a:
    if os.path.isdir(libpath + b):
        dirs.append(b)
dirs.sort()

if dirs.count("stdlib"):
    dirs.remove("stdlib")
    dirs.insert(0, "stdlib")


for dir in dirs:
    dodir(dir)

out = open(os.path.join(docpath, 'index.html'), "w")

out.write("""<HTML>

    <!-- Autogenerated by mma-libdoc. Do not edit ... you'll lose it! -->

<Center> <h1> The MMA Library </h1> </Center>

<P>
This document is provided as a supplement to the <em>MMA Reference
Manual</em> which lists all of the commands in the program and helpful
information which can be used to create your own "style" files. If you are a
newcomer to MMA, you
should also have a look at the <em>MMA Tutorial</em> for some "getting
started" information.

<P>
The information on these HTML pages has been generated directly
from the library files in your MMA library. Each
entry uses the filename as a header and then lists the various
defined grooves. In addition, the individual groove names are
clickable and will display further, detailed information on that groove.
<P>
You should be able to use any of the grooves listed in the "STDLIB"
section in your files without
using other directives. However, if you have files in other
locations you will need to need to
explicitly load the library file(s) with a <em>Use</em> directive.

<P>
The filenames are in all lowercase. These are the actual filenames
used in the library. If you are loading files with the <em>Use</em>
directive you must use the same case (please note that
typographic case applies only to the filename---this is operating system
dependant). <em>Groove</em> commands are case-insensitive.

<P>
Following each groove description is a boxed number in the form
<B>(4)</B>. This indicates the sequence size of the groove. Next, is
a list of tracks and instrument names. This shows the first voice or
drum note defined for each track---it is quite possible that the track
uses other voices. This data is included so that you can see what
tracks are active.

<P>
The library files supplied with MMA contain embedded documentation.
The <em>-Dxh</em> and <em>-Dxl</em> MMA command line options extract the following
information from the each library file:

<UL>
<LI> The filename from the "Doc File" directive.

<LI> The file description from the "Doc Note" directive.

<LI> Any user variables documented in "DocVar" directives.

<LI> Each groove description: This is the optional text following a
  <em>DefGroove</em> directive.

    <UL>
    <LI> The sequence size. This is extracted from the current groove
  information and was set with the <em>SeqSize</em> directive. It is
  displayed in a small box after the groove description.

    <LI>  A "summary" of the voices used in the groove. Note that a
  different voice or MIDI note is possible for each bar in the
  sequence size; however, this listing only lists the selection for
  the first bar.

   </UL>
</UL>

<P>In addition, the <em>-Dgh</em> command generates sequence graphs and
detailed settings for each groove.

<P>If you find that you don't have some of the grooves listed below
in your distribution you need to run the program <em>mma-libdoc</em>
to update these docs. Not all style files are distributed in the
default MMA distribution.

<p>

<b><font size="+1">
<p>During the development of MMA the library files have improved to the
   point of being quite reasonable. They never will substitute for
   professional players, but that never was the intention.
<p>
<p>Still, some of the files need some help. Some, frankly, need
   quite a bit of help. Hopefully, you, the intelligent user, will
   make them better and share the results with the ever growing
   MMA community. Thank you! 
</b></font>

<HR Size=3pt>
<CENTER> <H2> Index </H2> </CENTER>

""")

if links:
    out.write("<ul>")
    out.write("\n".join(links))
    out.write("</ul>")
    out.write("<HR Size=3pt>")
out.write( "\n".join(index))

out.write("""
<BR>
<HR  Size=3pt>
<P> This document and the files linked were created by <em>mma-libdoc</em>.

<P>It is a part of the MMA distribution
and is protected by the same copyrights as MMA (the GNU General Public License).

<P> Created: %s""" % time.ctime() )

out.write("<HTML>")


out.close()