VistaIOdictionary - representation of a keyword/value mapping
VistaIODictEntry dictionary[] = { { "keyword", integer_value }, { "keyword", 0, string_value }, ... { NULL } };
This manual page documents a data structure, called a dictionary, for describing a mapping between keywords and values. Dictionaries are used by the Vista library to interpret keywords present in command line options and in data files. Library routines are available for locating dictionary entries by keyword and by value. Data Structure typedef struct { VistaIOStringConst keyword;/* keyword string */ VistaIOLong ivalue; /* value, if an integer */ VistaIOStringConst svalue;/* value, if a string */ VistaIOBoolean icached; /* whether integer value cached */ VistaIOBoolean fcached; /* whether float value cached */ VistaIODouble fvalue; /* cached floating-point value */ } VistaIODictEntry; The dictionary data structure is designed to permit any string or numeric value to be associated with a keyword, and to permit the use of statically-initialized dictionaries. A dictionary is an array of VistaIODictEntry structures. The last entry in the array has a keyword field of NULL while each preceding entry contains both a keyword and a value. When the dictionary is initialized each value can be represented either as an integer in the ivalue field (in which case svalue must be NULL) or as a string pointed to by the svalue field (in which case the ivalue field is irrelevant). A floating point number is incorporated as a string value containing the number in printable form. The ``EXAMPLES'' section, below, shows typical code for establishing dictionaries. Other fields of the VistaIODictEntry are only used internally by the VistaIOLookupDictValue routine, which provides one form of access to dictionaries. The fields are used to cache the results of having converted a string value to an integer or a floating-point number. When an entry contains a string value (svalue is not NULL) then icached and fcached indicate whether or not equivalent integer and floating-point values are also cached in ivalue and fvalue. When creating a dictionary, initialize icached and fcached to zero; this need not be done explicitly if the dictionary is initialized statically as shown under ``EXAMPLES''. Routines With the following routines a dictionary entry can be located either by keyword or by value. Both routines search a dictionary sequentially from first entry to last, returning the first matching entry encountered. VistaIODictEntry *VistaIOLookupDictKeyword (VistaIODictEntry *dict, VistaIOStringConst keyword) VistaIOLookupDictEntry searches the dictionary dict for an entry whose keyword is keyword. It returns a pointer to the entry, if found, or NULL otherwise. VistaIODictEntry *VistaIOLookupDictValue (VistaIODictEntry *dict, VistaIORepnKind repn, type value) VistaIOLookupDictValue searches the dictionary dict for an entry whose value is value. The value to be searched for can be specified in any of several representations; that chosen is indicated by repn. Then type is one of VistaIOBit, VistaIOUByte, VistaIOSByte, VistaIOShort, VistaIOLong, VistaIOFloat, VistaIODouble, VistaIOBoolean, or VistaIOString, depending on repn. VistaIOLookupDictValue returns a pointer to the entry, if found, or NULL otherwise. Built-in Dictionaries The following dictionaries are already included in the library: VistaIOBooleanDict maps between the keywords false, true, no, yes, off, and on and the values FALSE and TRUE VistaIONumericRepnDict maps between the keywords bit, ubyte, sbyte, short, long, float, and double and the values VistaIOBitRepn through VistaIODoubleRepn.
This dictionary describes a mapping between keywords and integers: VistaIODictEntry VistaIOBooleanDict[] = { { "false", FALSE }, { "true", TRUE }, { "no", FALSE }, { "yes", TRUE }, { "off", FALSE }, { "on", TRUE }, { NULL } }; This dictionary describes a mapping between keywords and floating point numbers: VistaIODictEntry ConstantDict[] = { { "zero", 0 }, { "one", 1 }, { "pi", 0, "3.14159" }, { "e", 0, "2.7182818" }, { NULL } }; This dictionary describes a mapping between keywords and strings: VistaIODictEntry TitleDict[] = { { "Clinton", 0, "President of the U.S.A." }, { "Major", 0, "Prime Minister of Great Britain" }, { "Mulroney", 0, "Prime Minister of Canada" }, { NULL } };
Art Pope <pope@cs.ubc.ca> Adaption to vistaio: Gert Wollny <gw.fossdev@gmail.com>
Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.
Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.
Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.
Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.
The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.
Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.
Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.
Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.