PSC Code Manual

util/file.lsp [src]

File-handling functions

Functions

Function signature Description
(get-files-this-dir full-path) Prompts to select files from current directory using dialog listbox
(open-csv file) Opens FILE with Excel
(process-generic-def def repo-file) Retrieves the unique primary key for DEF in REPO-FILE
(read-csv file) Return the contents of csv FILE as a list of lists of strings
(read-file-to-string file) Returns the contents of FILE as a string
(read-key-val-file file) Return the contents of key/value FILE as a list of 2-element lists
(write-csv lines filename wrap-str) Write the contents of LINES to FILENAME

(get-files-this-dir full-path)

Prompts to select files from current directory using dialog listbox

The DCL for this dialog is files-this-dir.dcl.

(open-csv file)

Opens FILE with Excel

VARS:
(FILE STR)

(process-generic-def def repo-file)

Retrieves the unique primary key for DEF in REPO-FILE

DEF should be the definition of an object as a list. REPO-FILE should be the name of a csv
file that serves as the database of that object type. Each unique object definition is
assigned a primary key number in the database. This function returns DEF with the primary
key as the first item.

This function handles creating REPO-FILE and assigning primary keys.

VARS:
(DEF LIST)
(REPO-FILE STR)

(read-csv file)

Return the contents of csv FILE as a list of lists of strings

VARS:
(FILE STR)

(read-file-to-string file)

Returns the contents of FILE as a string

VARS:
(FILE STR)

(read-key-val-file file)

Return the contents of key/value FILE as a list of 2-element lists

VARS:
(FILE STR)

(write-csv lines filename wrap-str)

Write the contents of LINES to FILENAME

LINES should be a list of lists of strings. FILENAME should be a file name as a string. If
WRAP-STR is non-nil, wrap each cell in a formula like ="CELL-CONTENT".

VARS:
(LINES LIST)
(FILENAME STR)