Discussion List Archives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ddlm-group] The Grazulis eliding proposal: how to incorporateinto CIF?

Dear Herbert,dear colleagues,
On Tuesday 28 June 2011 21:45:43 Herbert J. Bernstein wrote:
> ...  I for one find the> either-or approach to prefixes and line-folding unnecessary> and confusing.  When working with old fortran compilers,> I _need_ the line folding protocol.  If the prefixes> are bing introduced, I need a way to deal with both the> prefixes _and_ the line-folding protocol, not have it> be either-or.  I understand that mos people don't> see a problem, but I work with software both on new computers> and very, very old computers (e.g. I just brought an Indigo> back to life).
May I try to disspell one of your worries: the prefixing *does not* exclude line folding; it can perfectly work together with the CIF line folding protocol. The only caution is that one needs to fold first, then prefix; and on reading, first unprefix, and then unfold -- otherwise folding might produce unprefixed lines that start with ';' and break the core CIF syntax.
My example would be:
Lets take the following text:
;; Lisp, as some other languages, like Molscript or assemblers,;; uses semicolon ';' to denote comments.(if x (format t "yes") (format t "no"))
Let's assume for the sake of the argument that we need to fold it at the level of "'" in the second line -- we do this first:
;; Lisp, as some ot\her languages, like\ Molscript or assem\blers,;; uses semicolon '\;' to denote commen\ts.(if x (format t "ye\s") (format t "no"))
(Note the new semicolon at the beginning of the line after folding. Best viewed in a fixed-width font).
Now each line fits into a fixed-length buffer. To indicate that the text is folded, we need to put ;\ at the beginning of the text field:
_text_in_lisp;\
But we can not just put the text into the CIF -- the value will break the CIF syntax. Nasty. We can avoid this, in a general way, by adding a prefix in front of each line so that the lines a guaranteed not to start with a semicolon:
LISP> ;; Lisp, as some ot\LISP> her languages, like\LISP>  Molscript or assem\LISP> blers,LISP> ;; uses semicolon '\LISP> ;' to denote commen\LISP> ts.LISP> (if x (format t "ye\LISP> s") (format t "no"))
This enlarges lines by a fixed amount, but since the length of a prefix is constant, small and known before writing the line, we can take it into account.
Now we just need to tell all programs (and humans, for that matter), what is the prefix, and what is the real text. I think a natural and unambiguous way is to insert a "sample prefix" between the starting semicolon and the backslash of the first line:
_text_in_lisp;LISP> \\LISP> ;; Lisp, as some ot\LISP> her languages, like\LISP>  Molscript or assem\LISP> blers,LISP> ;; uses semicolon '\LISP> ;' to denote commen\LISP> ts.LISP> (if x (format t "ye\LISP> s") (format t "no"));
Note the two backslashes at the end of the first line -- the first indicates the end of the prefix, and the second indicates that line folding is in effect.
Now we have arbitrary text (also another CIF) unambiguously folded and prefixed. The transformation is unambiguous since prefixes are always at the beginning of the line, and folding reversed solidi -- at the end of the lines.
The back transformation would unprefix and then unfold as usual.
Sincerely,Saulius
PS. For better readability, a "blank" prefix, consisting of one or more space or tab characters, might be preferable:
_text_in_lisp; \\ ;; Lisp, as some ot\ her languages, like\  Molscript or assem\ blers, ;; uses semicolon '\ ;' to denote commen\ ts. (if x (format t "ye\ s") (format t "no"));
S.G.
-- Dr. Saulius Gražulis
Institute of BiotechnologyGraiciuno 8LT-02241 VilniusLietuva (Lithuania)
fax:          (+370-5)-2602116tel.: office: (+370-5)-2602556      mobile: (+370-684)-49802, (+370-614)-36366_______________________________________________ddlm-group mailing listddlm-group@iucr.orghttp://scripts.iucr.org/mailman/listinfo/ddlm-group

Reply to: [list | sender only]
International Union of Crystallography

Scientific Union Member of the International Science Council (admitted 1947). Member of CODATA, the ISC Committee on Data. Partner with UNESCO, the United Nations Educational, Scientific and Cultural Organization in the International Year of Crystallography 2014.

International Science Council Scientific Freedom Policy

The IUCr observes the basic policy of non-discrimination and affirms the right and freedom of scientists to associate in international scientific activity without regard to such factors as ethnic origin, religion, citizenship, language, political stance, gender, sex or age, in accordance with the Statutes of the International Council for Science.