
# this defines the datadex format; what fields exist and which are
# where may change with time, so it should be stored in a %field
# thing like this for easy maintainance
%field = ("author" => 0,
	  "title" => 1,
	  "series" => 2,
	  "code" => 3,
	  );



$line = a line of something datadex-like;
@part = split /</, $line;
%bk = ();
foreach $f (keys %field) {  $bk{$f} = $part[$field{$f}];  }




# the author field looks like
# join '|', map { (last name, first name) } (authors of the book);

# the title field looks like
# join '|', (titles in book);
# with the exception that the first one may be of the form
# "real title"="placement title" e.g. "DR. DOOM=DOCTOR DOOM",
# indicating that the stuff before '=' is the actual title
# but it should be shelved by the stuff after the '='.  The actual
# title parts cannot contain '=' characters, of course.
# Also, title fields may contain parentheticals, which are not part
# of the title but notes, such as (ABRIDGED) or (PROOF).

# the series field looks like
# join '|', (series in book, same order as titles)
# with some rules about where '@' and '#' characters and numbers appear
# and what they mean.

# the shelfcode field looks like
# code:multiplicity,code:multiplicity,...code:multiplicity
# where the ":multiplicity" is omitted if 1.
# possible codes are the keys of %categories.
# (exists $category{$code}{'seek'}) is true if and only if having
# something in that shelfcode is insufficient and we still seek a real
# copy --- e.g. SFWA books aren't ours and we want our own, tapes aren't
# real books, doubles are nasty, etc.
# the other fields in %$category{$code} will be explained if necessary.
