Members Base ============ These modules manage the member files in members directory. Modules ------- ### Base Member Record (import brmember) This module encapsulates the data structure representing a single member record. (make-brmember file-name file-path symlinks . args) * ```file-name``` - a symbol representing the primary filename * ```file-path``` - a string representing the path to the file * ```symlinks``` - a list of symbols representing symlinks * ```args``` - optional keyword arguments Creates a new member record dictionary. The three mandatory arguments are stored under respective keys and any keyword arguments are stored as keys obtained by converting the keyword to symbol with values following the keyword. The ```'id``` key is filled with any four-digit file-name or symlink converted to a number. Preferably the four-digit symbol should be the file-name but it is not required. (brmember? v) * ```v``` - any value Returns ```#t``` if given value ```v``` is a brmember instance. (brmember-file-name mr) * ```mr``` - a member record structure Returns the file name of this member's file usually without full path. (brmember-file-path mr) * ```mr``` - a member record structure Returns the path used for accessing this member's file. (brmember-input-file mr) * ```mr``` - a member record structure Returns an open file port to given member record underlying file. This function should be used by the parser to get the member file contents. (brmember-set mr . args) * ```mr``` - a member record structure * ```args``` - optional keyword arguments Any keyword arguments are stored in the member record dictionary as keys obtained by converting the keyword to symbol with values following the keyword. (brmember-add-highlight mr line message pass type) * ```mr``` - a member record structure * ```line``` - line number in the source file * ```message``` - a string with message for highlight * ```pass``` - parsing stage * ```type``` - symbol representing the highlight type Adds a new highlight to member record to be used when displaying the source file listing. Known types are: * ```'error``` - to denote fatal problem in the source * ```'warning``` - to signal known problem which does not make the record invalid * ```'info``` - supplemental information The structure is perfectly suited for ```print-source-listing``` function. (brmember-sub-ref mr sec key [default]) * ```mr``` - a member record structure * ```sec``` - section symbol * ```key``` - key symbol * ```default``` - optional default value Retrieves given ```key``` from dictionary stored as section ```sec``` in given ```mr``` structure. If no ```default``` is provided and the ```key``` does not exist it raises an exception. (brmember-sub-set mr sec key value) * ```mr``` - a member record structure * ```sec``` - section symbol * ```key``` - key symbol * ```value``` - value to set Sets the value of given ```key``` in dictionary stored as section ```sec``` in given ```mr``` structure to the new ```value``` possibly overwriting previous one. (brmember-sub-prepend mr sec key value) * ```mr``` - a member record structure * ```sec``` - section symbol * ```key``` - key symbol * ```value``` - value to prepend (cons) to the key current value Prepends (cons) new the ```value``` to current value of given ```key``` in dictionary stored as section ```sec``` in given ```mr``` structure replacing the original value. (brmember-sub-has-key? mr sec key) * ```mr``` - a member record structure * ```sec``` - section symbol * ```key``` - key symbol Returns ```#t``` if given section ```sec``` contains the ```key```. (brmember-sub-ensure mr sec key value) * ```mr``` - a member record structure * ```sec``` - section symbol * ```key``` - key symbol * ```value``` - value to set Sets the value of given ```key``` in dictionary stored as section ```sec``` in given ```mr``` structure to the new ```value``` if and only if it is not already present. (brmember-source mr) * ```mr``` - a member record structure Returns a list of strings representing the source file of this member record. (brmember-info mr key [default]) * ```mr``` - a member record structure * ```key``` - key (symbol) to retrieve * ```default``` - optional default value Like ```dict-ref``` returns the value associated with ```key``` in section ```'info```. If ```default``` is provided, it is passed on to the underlying ```dict-ref```. (brmember-missing-keys mr) * ```mr``` - a member record structure Returns a list of keys (symbols) from within the ```'info``` section of given ```mr``` that have ```#f``` values (indicating they are missing mandatory fields in the source). (brmember-has-highlights? mr) * ```mr``` - a member record structure Returns ```#t``` if given ```mr``` has at least one source highlight. (brmember-usable? mr) * ```mr``` - a member record structure Returns ```#t``` if it is possible to work with this member - mainly that the ```'info``` section contains the ```'member``` key. (brmember-has-problems? mr) * ```mr``` - a member record structure Returns ```#t``` if there are any ```'error``` type highlights in ```mr```, or it is not ```brmember-usable?``` or the ```member-id``` is not 4-digit prime number. (brmember-destroyed? mr) * ```mr``` - a member record structure Returns ```#t``` if the member is not existing and already has existed in the past. (brmember-suspended? mr) * ```mr``` - a member record structure Returns ```#t``` if the current month falls within any of given member's suspended periods. (brmember-active? mr) * ```mr``` - a member record structure Returns ```#t``` if given member exists, is a member and is currently not suspended. (brmember-student? mr) * ```mr``` - a member record structure Returns ```#t``` if given member exists, is a member, is currently not suspended and current month falls within any member's suspended periods. (brmember-existing? mr) * ```mr``` - a member record structure Returns ```#t``` if given member exists - that is the current month is within any of the member (membership) periods. (brmember-chair? mr) * ```mr``` - a member record structure Returns ```#t``` if given ```mr``` is chair as of ```(*current-day*)```. (brmember-council? mr) * ```mr``` - a member record structure Returns ```#t``` if given ```mr``` is a member of council as of ```(*current-day*)```. (brmember-revision? mr) * ```mr``` - a member record structure Returns ```#t``` if given ```mr``` is a member of revision committee as of ```(*current-day*)```. (brmember-grant? mr) * ```mr``` - a member record structure Returns ```#t``` if given ```mr``` is a member of grant committee as of ```(*current-day*)```. (brmember-flags mr) * ```mr``` - a member record structure Returns a list of member flags which can be any of the following: * ```'student``` * ```'suspended``` * ```'active``` * ```'destroyed``` * ```'existing``` * ```'chair``` * ```'council``` * ```'revision``` * ```'grant``` The ```'existing``` and ```'destroyed``` are mutually exclusive. Also ```'active``` and ```'suspended``` are mutually exclusive. (brmember-nick mr) * ```mr``` - a member record structure Returns member's nick from its ```'info``` section. (brmember-id mr) * ```mr``` - a member record structure Returns given member's id. (brmember-suspended-months mr) * ```mr``` - a member record structure Returns the number of months this member is suspended in ```(*current-month*)```. If the member is not suspended, returns ```0```. ((brmember-suspended-for at-least [less-than]) mr) * ```at-least``` - number of months * ```less-than``` - number of months * ```mr``` - member record structure Curried predicate for checking whether given member ```mr``` is at least ```at-least``` months suspended. If ```less-than``` is provided then only those records which have been suspended less than this value are included. (brmember