summaryrefslogtreecommitdiff
path: root/mp.h (follow)
Commit message (Collapse)AuthorAge
* Switch to SPDX identifiers.Andre Noll2026-03-17
| | | | | | | | Generated with sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h followed by manually tweaking the result a bit. No license change intended.
* mood: Make "duration" a new keyword for the mood grammar.Andre Noll2021-10-10
| | | | | | | | | | | | The new keyword makes it possible to define moods which impose a constraint on the duration of the admissible files. For example, the expression duration < 120 * 1000 selects only files which are shorter than two minutes. The implementation is pretty simple.
* Shorten copyright notice.Andre Noll2017-09-22
| | | | | | | | | | | | | | | | | | | | | The GPLv2 line does not add any additional information, so drop it. This leaves a single line of legalese text for most files, which is about the amount of screen real estate it deserves. This patch was created with the following script (plus some manual fixups): awk '{ if (NR <= 5) { gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g") if (gs != $0) year = gs next } if (NR == 6 && year != "") printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year) print }'
* Version 2 moods.Andre Noll2017-08-20
This introduces a context-free grammar for moods. The parser for the corresponding language (the version 2 mood parser) is generated by flex and bison and will eventually replace the open-coded parser for traditional (version 1) moods. Those are still supported, but the server now logs a deprecation warning when a version 1 mood is loaded, Loading a version 2 mood is a two step procedure. In the first step the bison parser reads the mood definition stored in the moods table of the afs database. If there are no errors, the parser returns an abstract syntax tree which represents the syntactic structure of the mood definition. In the second step the abstract syntax tree is evaluated for each row of the audio file table in turn. If the evaluation function returns true, the audio file is considered admissible. In this case a reference to the row is added to the score table in the same way the version 1 mood parser stores the set of admissible files. The commit adds the following new files to the repository: * yy/mp.lex: the lexer * yy/mp.y: the bison parser * yy/makefile: rules for building the parser, included from main Makefile * mp.c: frontend (high-level API) and backend (helpers for yy/mp.[ch]) * mp.h: backend data structures and function prototypes The frontend is only needed in the existing mood.c, which now also contains the declarations of the frontend API so that mp.h needs only be included by the lexer and the parser. The comment at the top of mp.c gives an overview of the mood parser API. All non-static functions of mp.c (both frontend and backend) are fully documented. The section on moods of the user manual has been rewritten and extended. Since flex and bison are required to build para_server, the list of optional software packages now mentions these tools, with links to their home page. If either tool is not installed, the configure script succeeds but para_server will not be built.