SDF 2.001: SDF Guru Guide: dict.pl - Dictionary Library

Contents | Parent Topic | Previous Topic | Next Topic
Home | Catalog

# 2.3. dict.pl - Dictionary Library

## 2.3.1. Purpose

This library provides support for reading and processing dictionaries stored in text files.

## 2.3.2. Interface

    require "dict.pl";

    @DICT_DFLT_REPORT = ...

    @dict_rest = ...

    $success =
    &DictFetch($file, $begin, $delimiter, $end, $prefix);

    $ok =
    &DictPrint($strm, $level, $buffer_name, $bufref, @report);

## 2.3.3. Description

A dictionary is a collection of items where each item has:

- a unique key
- a description

DICT_DFLT_REPORT is the default report for DictPrint. It:

- outputs items in the order found, separated by blank lines
- outputs each item as:
  - key on one line
  - description on the next

dict_rest is the set of lines in the last file processed by DictFetch which are not in the dictionary.

DictFetch inputs filename as a dictionary.

DictPrint outputs a dictionary using report. If no report is specified, DICT_DFLT_REPORT is used.