Viewing p-Code

Navigation:  Appendices > Debugging > Diary Generation >

Viewing p-Code

Previous pageReturn to chapter overviewNext page

The p-Code Viewer debug tool is accessible from the Debug and Diary Generation menu sequence, and it is used to view the precise commands that are sent to QuarkXPress during diary generation.



This tool is mostly used by the Q++Studio development team, but it can also be of use to end-users in the following cases :


A token is not converted the way you expect. Viewing the p-Code allows you to determine if the token processing you expected was sent to QuarkXPress or not. If not, then you may have misunderstood the behavior of a particular token, or there may be a bug in the Q++Studio code that generates the p-Code.


QuarkXPress crashes at a particular point of the token processing step of diary generation. Using the Log QuarkXPress Activity option and the activity log it generates, you can pinpoint the page and object number that caused the crash and view what token processing QuarkXPress was attempting before it crashed.


The p-Code debugger displays the p-code of the most recent diary generation (details of the script and time appear at the top of the dialog), and is divided into 3 areas : Pages, Objects and Actions.




Lets you navigate the list of pages of the diary that the p-Code represents. The number in bold in the Pge column refers to the page number of the output file. The T.Id column refers to the template that this page uses, and refers to which page of the template is used. The value in the T.Id column refers to the templates as they are used in the script, not to the template ID as displayed in the Templates Manager. These ID values start at 2; 0 being used for BlankPages and 1 for PlaceHolders.


Lists the IDs of all the textbox objects contained in the page selected to the left. Note that only textboxes are listed here.


This section is divided into 3 parts. The Actions part itself lists all actions that are to be applied to the object/textbox selected in the middle section. The Token Conversion lists all the tokens that have been identified and how they will be replaced. The Raw p-Code at the bottom shows the p-Code in its rawest form, for cases when you need to see the exact, uninterpreted textual commands that are sent to QuarkXPress.



Four or five additional windows display information, based on the currently selected pCode line above.







Usually there is only one action per textbox and it involves replacing tokens using Q++Studio Text Formatting (QTF). Sometimes, if a token involves complex format change, you will see 2 actions; one that replaces the text and one that then applies formatting (font, size, color, ...) to the already once processed textbox :




In the above example, the first action replaces text in the entire textbox, placing tags (such as **RICH1** and **TEXT1**) to indicate where further processing is to occur. The second line then isolates the text delimited by the **1** tags and applies some specific formatting (changing the text color to magenta in this case).

Topic 108047 updated on 03-May-2018.
Topic URL: