Module: dfmc-environment-reports Synopsis: DFMC report generation utilities Author: Chris Page Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND // Coerce a symbol to a string //---*** cpage: Currently, this is necessary because the default format for "%s" // produces all-caps; this may be an anomally of the emulator. define macro as-string { as-string (?:expression) } => { as-lowercase(as(, ?expression)) }; end macro as-string; // Return the name of a definition (source-form) define function definition-name (definition :: ) => (name :: false-or()) let variables = definition.source-form-defined-variables; if (variables & size(variables) >= 1) variables[0].variable-name end if end function definition-name; // Extract the name of a keyword //---*** cpage: This whole function is a kludge. dfmc-browser-support currently // has a bug in which it returns instances of some class other than // for "keywords". Here, we fudge up a string, then parse // for the keyword name. define function keyword-name (keyword) => (name :: ) if (instance?(keyword, )) key else // debug-message("Error: %= is not an instance of ", keyword); // Two formats are possible: '#P{ #"keyword" }' '#P{ keyword: }' let name = format-to-string("%=", keyword); let key-start = subsequence-position(name, "\""); let key-end = 0; if (key-start) key-end := subsequence-position(name, "\"", count: 2); else key-start := subsequence-position(name, " "); key-end := subsequence-position(name, ":"); end if; let key-name = copy-sequence(name, start: key-start + 1, end: key-end); as(, key-name) end block; end function keyword-name;