The LINCKS GPD
We will not cover the creation of the address GPD in that much detail, but the basic steps are:
1) Select the GPDmap (use the same that we used for the person GPD)
2) Move to the person line. and do an insert plural.
3) Name the GPD address and give it the descriptive line view of address object.
4) Expand on the view of address object.
5) And complete it according to Figure 8.
Now, we need to create an address object and we follow the same steps as for the initial person object. We add the object to our home directory with the result as in Figure 9.
We have now defined templates for storing and retrieving address and person objects, but we need to connect one person to one or more specific addresses. We would like to link one person object to one or more address objects under the link name of ADDRESSBOOK Address (group and field tag). We will modify the person object to include a link to an address object. First, we need to add a new entity to the logical structure. Let us call it address. Second, we need to specify where to find the new part, extending the person GPD as in Figure 10.
Notice that we have introduced the ATTR CONSTANT which defines a constant attribute, in this case a sequence of dashes. Moreover, in the GPD's EXPAND section we have defined that any expansion of the logical part address (which is found by following the link ADDRESSBOOK:Address) should be viewed using the address GPD. After storing the changed person GPD, we expand again the Martin Sjölin entry in our home directory and we see the added dashes as well as the placeholder <<address>> (Figure 11).
Adding a link to address +46 13 148155 to the placeholder and after expanding that phone number, we get Figure 12.
To make the person GPD look more like the standard folder or our home directory, we can put a border around the address entry (for example, the phone number) and push the left margin 10 pixels to the right by adding an entry to the FORMAT section under the logical part address as:
where we use width to specify the widget's width in pixels.
The last example shows how to create a combined person and address GPD, let us call it the person and address GPD. As before, select the GPDmap, add a new GPD, name it person and address with a one line description, as seen in Figure 13. This GPD contains several noteworthy features. First, we use the font specification in the FORMAT section. Any valid X11 font in our system can be specified after the equal sign. Sometimes quotation marks (“) are needed around the font name. Also, the font and marginal specification is valid for all entries which follow below (in logical structure), as seen in Figure 13. We have applied the person and address view on the person object Martin Sjölin in the home directory.
Second, in the ACCESS section, --- Indirect References --- we have re-used the ACCESS specification in the person GPD by using the same logical name on the same logical part in the address GPD and then adding a link to the person GPD. The system follows the link to the other GPD and looks for the ACCESS specification under the name name and birth date. Thus, we only have the ACCESS specification in one GPD instead of copied into several GPDs (we avoid magic numbers!).
Third, what about the addresslink structure part? We have defined addresslink to point to the address object in the ACCESS section which results in an address object. Then, in the STRUCTURE section, we have used the indirect feature and re-used the address GPD (as seen by the descriptive name on the line below address).
Now, if we use the --- Indirect References --- in ACCESS, EXPAND, or FORMAT sections, we are only re-using the declaration for that specific logical part, that is, we are using that ACCESS, EXPAND or FORMAT declaration in the other GPD. But, when using the indirection in the STRUCTURE part, we use the STRUCTURE, ACCESS, EXPAND and FORMAT declarations in the GPD that is pointed to (in this case the address GPD) and no longer use any declarations in the GPD that is pointed from (the person and address).
For example, if we add a FORMAT specification for the address part in the person and address GPD, it will not be used since any FORMAT declaration must be included in the (address) GPD pointed to—try it out yourself. The mechanism is similar to a function call.
This introduction, along with the material in the xlincks manual, should help get you started. If not, you will have to bug the author enough to finish the real GPD tutorial, hopefully before the next public release of LINCKS (hopefully released by the time you read this).
Martin Sjölin is about to complete an MSc in computer science at the Department of Computer and Information Science, University of Linköping, Sweden. He is working in the fields of hypertext/hypermedia, document handling, CSCW, and information filtering/sharing. He is responsible for support and development of LINCKS, whenever he is not browsing the net (WWW, mailing lists, Usenet). Beside computers, he enjoys cooking, backpacking, skiing, wind surfing, canoeing, and reading, whenever he is not hacking on LINCKS or Linux for the MacIntosh. (email@example.com)
- October 2014 Issue of Linux Journal: Embedded
- Encrypt Your Dog (Mutt and GPG)
- Practical Tiny Core in the Fire Service
- DevOps for Dummies
- Tech Tip: Really Simple HTTP Server with Python
- Python Scripts as a Replacement for Bash Utility Scripts
- New Products
- RSS Feeds
- Open Axiom
- Cooking with Linux - Serious Cool, Sysadmin Style!
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal