1%
2% Author:      William Chia-Wei Cheng (bill.cheng@acm.org)
3%
4% Copyright (C) 2001-2009, William Chia-Wei Cheng.
5%
6% This file may be distributed under the terms of the Q Public License
7% as defined by Trolltech AS of Norway and appearing in the file
8% LICENSE.QPL included in the packaging of this file.
9%
10% THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING
11% THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
12% PURPOSE.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
13% INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
14% FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15% NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
16% WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17%
18% @(#)$Header: /mm2/home/cvs/bc-src/tgif/tgif.pl,v 1.7 2011/05/16 16:26:57 william Exp $
19%
20
21% 1) Call tgif_clean/0 each time before step (2).
22% 2) Consult a '.obj' or a '.sym' file.
23% 3) Call tgif_state/2.  This must be called before any other tgif goals
24%    are called.
25% 4) Trace any other goals.
26
27%
28% Note: tgif_pin() is not documented because its implementation is not done.
29%       tgif_pin() first appears in file version 34.
30%
31
32internal_file_version(FileVersion) :-
33    nl, write('Sorry, FileVersion '), write(FileVersion),
34    write(' belongs to an internal release and it is not supported.'), nl.
35
36check_file_version(34) :- internal_file_version(34), !, fail.
37check_file_version(35) :- internal_file_version(35), !, fail.
38check_file_version(36) :- internal_file_version(36), !, fail.
39check_file_version(_).
40
41tgif_state(FileVersion,Obj) :-
42    tgif_state(FileVersion,Obj,_),
43    !, check_file_version(FileVersion).
44
45tgif_state(FileVersion,Obj,Parms) :-
46    (   var(Obj) -> OutputObj = true,
47        current_predicate(state,
48            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
49    ;   OutputObj = false
50    ),
51    Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom,
52        _GridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
53        _LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
54        _TextStyle,_TextSize),
55    tgif_chk_output(OutputObj,Obj),
56    FileVersion =< 3,
57    Parms = [page_style=_PageStyle,file_version=FileVersion,
58        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
59        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
60        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
61        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
62        text_just=_TextJust,font=_Font,text_style=_TextStyle,
63        text_size=_TextSize],
64    !, abolish(tgif_file_version/1),
65    !, assert(tgif_file_version(FileVersion)).
66tgif_state(FileVersion,Obj,Parms) :-
67    (   var(Obj) -> OutputObj = true,
68        current_predicate(state,
69            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
70    ;   OutputObj = false
71    ),
72    Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom,
73        _GridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
74        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
75        _TextStyle,_TextSize),
76    tgif_chk_output(OutputObj,Obj),
77    FileVersion =< 7,
78    Parms = [page_style=_PageStyle,file_version=FileVersion,
79        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
80        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
81        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
82        line_type=_Spline,
83        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
84        text_just=_TextJust,font=_Font,text_style=_TextStyle,
85        text_size=_TextSize],
86    !, abolish(tgif_file_version/1),
87    !, assert(tgif_file_version(FileVersion)).
88tgif_state(FileVersion,Obj,Parms) :-
89    (   var(Obj) -> OutputObj = true,
90        current_predicate(state,
91            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
92    ;   OutputObj = false
93    ),
94    Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom,
95        _GridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
96        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
97        _TextStyle,_TextSize,_TextDPI),
98    tgif_chk_output(OutputObj,Obj),
99    FileVersion =< 8,
100    Parms = [page_style=_PageStyle,file_version=FileVersion,
101        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
102        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
103        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
104        line_type=_Spline,
105        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
106        text_just=_TextJust,font=_Font,text_style=_TextStyle,
107        text_size=_TextSize,text_dpi=_TextDPI],
108    !, abolish(tgif_file_version/1),
109    !, assert(tgif_file_version(FileVersion)).
110tgif_state(FileVersion,Obj,Parms) :-
111    (   var(Obj) -> OutputObj = true,
112        current_predicate(state,
113            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
114    ;   OutputObj = false
115    ),
116    Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom,
117        _GridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
118        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
119        _TextStyle,_TextSize,_TextDPI,_Dash),
120    tgif_chk_output(OutputObj,Obj),
121    FileVersion =< 11,
122    Parms = [page_style=_PageStyle,file_version=FileVersion,
123        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
124        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
125        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
126        line_type=_Spline,
127        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
128        text_just=_TextJust,font=_Font,text_style=_TextStyle,
129        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash],
130    !, abolish(tgif_file_version/1),
131    !, assert(tgif_file_version(FileVersion)).
132tgif_state(FileVersion,Obj,Parms) :-
133    (   var(Obj) -> OutputObj = true,
134        current_predicate(state,
135            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
136    ;   OutputObj = false
137    ),
138    Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom,
139        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
140        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
141        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
142        _MetricGridSize),
143    tgif_chk_output(OutputObj,Obj),
144    FileVersion =< 12,
145    Parms = [page_style=_PageStyle,file_version=FileVersion,
146        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
147        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
148        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
149        line_type=_Spline,
150        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
151        text_just=_TextJust,font=_Font,text_style=_TextStyle,
152        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
153        grid_system=_GridSystem,metric_grid=_MetricGridSize],
154    !, abolish(tgif_file_version/1),
155    !, assert(tgif_file_version(FileVersion)).
156tgif_state(FileVersion,Obj,Parms) :-
157    (   var(Obj) -> OutputObj = true,
158        current_predicate(state,
159            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
160    ;   OutputObj = false
161    ),
162    Obj = state(_PageStyle,FileVersion,_OrigX,_OrigY,_Zoom,
163        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
164        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
165        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
166        _MetricGridSize,_TextVSpace),
167    tgif_chk_output(OutputObj,Obj),
168    FileVersion =< 13,
169    Parms = [page_style=_PageStyle,file_version=FileVersion,
170        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
171        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
172        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
173        line_type=_Spline,
174        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
175        text_just=_TextJust,font=_Font,text_style=_TextStyle,
176        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
177        grid_system=_GridSystem,metric_grid=_MetricGridSize,
178        text_v_space=_TextVSpace],
179    !, abolish(tgif_file_version/1),
180    !, assert(tgif_file_version(FileVersion)).
181tgif_state(FileVersion,Obj,Parms) :-
182    (   var(Obj) -> OutputObj = true,
183        current_predicate(state,
184            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
185    ;   OutputObj = false
186    ),
187    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
188        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
189        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
190        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
191        _MetricGridSize,_TextVSpace),
192    tgif_chk_output(OutputObj,Obj),
193    FileVersion =< 18,
194    Parms = [page_style=_PageStyle,file_version=FileVersion,
195        print_mag=_PrintMag,
196        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
197        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
198        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
199        line_type=_Spline,
200        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
201        text_just=_TextJust,font=_Font,text_style=_TextStyle,
202        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
203        grid_system=_GridSystem,metric_grid=_MetricGridSize,
204        text_v_space=_TextVSpace],
205    !, abolish(tgif_file_version/1),
206    !, assert(tgif_file_version(FileVersion)).
207tgif_state(FileVersion,Obj,Parms) :-
208    (   var(Obj) -> OutputObj = true,
209        current_predicate(state,
210            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
211    ;   OutputObj = false
212    ),
213    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
214        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
215        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
216        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
217        _MetricGridSize,_TextVSpace,_ZoomIn),
218    tgif_chk_output(OutputObj,Obj),
219    FileVersion =< 19,
220    Parms = [page_style=_PageStyle,file_version=FileVersion,
221        print_mag=_PrintMag,
222        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
223        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
224        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
225        line_type=_Spline,
226        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
227        text_just=_TextJust,font=_Font,text_style=_TextStyle,
228        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
229        grid_system=_GridSystem,metric_grid=_MetricGridSize,
230        text_v_space=_TextVSpace,zoom_in=_ZoomIn],
231    !, abolish(tgif_file_version/1),
232    !, assert(tgif_file_version(FileVersion)).
233tgif_state(FileVersion,Obj,Parms) :-
234    (   var(Obj) -> OutputObj = true,
235        current_predicate(state,
236            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
237    ;   OutputObj = false
238    ),
239    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
240        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
241        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
242        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
243        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode),
244    tgif_chk_output(OutputObj,Obj),
245    FileVersion =< 21,
246    Parms = [page_style=_PageStyle,file_version=FileVersion,
247        print_mag=_PrintMag,
248        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
249        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
250        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
251        line_type=_Spline,
252        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
253        text_just=_TextJust,font=_Font,text_style=_TextStyle,
254        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
255        grid_system=_GridSystem,metric_grid=_MetricGridSize,
256        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
257        move_mode=_ModeMode],
258    !, abolish(tgif_file_version/1),
259    !, assert(tgif_file_version(FileVersion)).
260tgif_state(FileVersion,Obj,Parms) :-
261    (   var(Obj) -> OutputObj = true,
262        current_predicate(state,
263            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
264    ;   OutputObj = false
265    ),
266    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
267        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
268        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
269        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
270        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
271        _TextRotate,_RCBoxRadius),
272    tgif_chk_output(OutputObj,Obj),
273    FileVersion =< 26,
274    Parms = [page_style=_PageStyle,file_version=FileVersion,
275        print_mag=_PrintMag,
276        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
277        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
278        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
279        line_type=_Spline,
280        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
281        text_just=_TextJust,font=_Font,text_style=_TextStyle,
282        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
283        grid_system=_GridSystem,metric_grid=_MetricGridSize,
284        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
285        move_mode=_ModeMode,text_rotate=_TextRotate,
286        rcb_radius=_RCBoxRadius],
287    !, abolish(tgif_file_version/1),
288    !, assert(tgif_file_version(FileVersion)).
289tgif_state(FileVersion,Obj,Parms) :-
290    (   var(Obj) -> OutputObj = true,
291        current_predicate(state,
292            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
293    ;   OutputObj = false
294    ),
295    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
296        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
297        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
298        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
299        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
300        _TextRotate,_RCBoxRadius,_UseGray),
301    tgif_chk_output(OutputObj,Obj),
302    FileVersion =< 27,
303    Parms = [page_style=_PageStyle,file_version=FileVersion,
304        print_mag=_PrintMag,
305        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
306        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
307        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
308        line_type=_Spline,
309        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
310        text_just=_TextJust,font=_Font,text_style=_TextStyle,
311        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
312        grid_system=_GridSystem,metric_grid=_MetricGridSize,
313        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
314        move_mode=_ModeMode,text_rotate=_TextRotate,
315        rcb_radius=_RCBoxRadius,use_gray=_UseGray],
316    !, abolish(tgif_file_version/1),
317    !, assert(tgif_file_version(FileVersion)).
318tgif_state(FileVersion,Obj,Parms) :-
319    % Mstsuda's Version
320    (   var(Obj) -> OutputObj = true,
321        current_predicate(state,
322            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
323    ;   OutputObj = false
324    ),
325    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
326        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
327        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
328        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
329        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
330        _TextRotate,_RCBoxRadius,_UseGray,_PaperCol,_PaperRow,
331        _CurPageNum,_LastPageNum),
332    tgif_chk_output(OutputObj,Obj),
333    FileVersion =< 28,
334    Parms = [page_style=_PageStyle,file_version=FileVersion,
335        print_mag=_PrintMag,
336        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
337        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
338        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
339        line_type=_Spline,
340        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
341        text_just=_TextJust,font=_Font,text_style=_TextStyle,
342        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
343        grid_system=_GridSystem,metric_grid=_MetricGridSize,
344        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
345        move_mode=_ModeMode,text_rotate=_TextRotate,
346        rcb_radius=_RCBoxRadius,use_gray=_UseGray,
347        papge_col=_PaperCol,papge_row=_PaperRow,
348        cur_page_num=_CurPageNum,last_page_num=_LastPageNum],
349    !, abolish(tgif_file_version/1),
350    !, assert(tgif_file_version(FileVersion)).
351tgif_state(FileVersion,Obj,Parms) :-
352    (   var(Obj) -> OutputObj = true,
353        current_predicate(state,
354            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
355    ;   OutputObj = false
356    ),
357    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
358        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
359        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_Font,
360        _TextStyle,_TextSize,_TextDPI,_Dash,_GridSystem,
361        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
362        _TextRotate,_RCBoxRadius,_UseGray,_PageLayoutMode,_PageArg1,
363        _PageArg2,_PageLineShownInTileMode),
364    tgif_chk_output(OutputObj,Obj),
365    FileVersion =< 29,
366    (   (_PageLayoutMode == 0) -> % stack mode
367        _CurPageNum = _PageArg1, _LastPageNum = _PageArg2,
368        _PaperRow = 1, _PaperCol = 1
369    ;   _PaperCol = _PageArg1, _PaperRow = _PageArg2,
370        _CurPageNum = 1, _LastPageNum = 1
371    ),
372    Parms = [page_style=_PageStyle,file_version=FileVersion,
373        print_mag=_PrintMag,
374        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
375        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
376        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
377        line_type=_Spline,
378        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
379        text_just=_TextJust,font=_Font,text_style=_TextStyle,
380        text_size=_TextSize,text_dpi=_TextDPI,line_dash=_Dash,
381        grid_system=_GridSystem,metric_grid=_MetricGridSize,
382        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
383        move_mode=_ModeMode,text_rotate=_TextRotate,
384        rcb_radius=_RCBoxRadius,use_gray=_UseGray,
385        page_layout_mode=_PageLayoutMode,
386        page_line_shown_in_tile_mode=_PageLineShownInTileMode,
387        papge_col=_PaperCol,papge_row=_PaperRow,
388        cur_page_num=_CurPageNum,last_page_num=_LastPageNum],
389    !, abolish(tgif_file_version/1),
390    !, assert(tgif_file_version(FileVersion)).
391tgif_state(FileVersion,Obj,Parms) :-
392    (   var(Obj) -> OutputObj = true,
393        current_predicate(state,
394            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
395    ;   OutputObj = false
396    ),
397    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
398        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
399        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_FontName,
400        _TextStyle,_FontSize,0,_Dash,_GridSystem,
401        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
402        _TextRotate,_RCBoxRadius,_UseGray,_PageLayoutMode,_PageArg1,
403        _PageArg2,_PageLineShownInTileMode),
404    tgif_chk_output(OutputObj,Obj),
405    FileVersion =< 30,
406    (   (_PageLayoutMode == 0) -> % stack mode
407        _CurPageNum = _PageArg1, _LastPageNum = _PageArg2,
408        _PaperRow = 1, _PaperCol = 1
409    ;   _PaperCol = _PageArg1, _PaperRow = _PageArg2,
410        _CurPageNum = 1, _LastPageNum = 1
411    ),
412    Parms = [page_style=_PageStyle,file_version=FileVersion,
413        print_mag=_PrintMag,
414        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
415        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
416        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
417        line_type=_Spline,
418        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
419        text_just=_TextJust,font_name=_FontName,text_style=_TextStyle,
420        font_size=_FontSize,line_dash=_Dash,
421        grid_system=_GridSystem,metric_grid=_MetricGridSize,
422        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
423        move_mode=_ModeMode,text_rotate=_TextRotate,
424        rcb_radius=_RCBoxRadius,use_gray=_UseGray,
425        page_layout_mode=_PageLayoutMode,
426        page_line_shown_in_tile_mode=_PageLineShownInTileMode,
427        papge_col=_PaperCol,papge_row=_PaperRow,
428        cur_page_num=_CurPageNum,last_page_num=_LastPageNum],
429    !, abolish(tgif_file_version/1),
430    !, assert(tgif_file_version(FileVersion)).
431tgif_state(FileVersion,Obj,Parms) :-
432    (   var(Obj) -> OutputObj = true,
433        current_predicate(state,
434            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
435    ;   OutputObj = false
436    ),
437    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
438        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
439        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_FontName,
440        _TextStyle,_FontSize,0,_Dash,_GridSystem,
441        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
442        _TextRotate,_RCBoxRadius,_UseGray,_PageLayoutMode,_PageArg1,
443        _PageArg2,_PageLineShownInTileMode,_ColorDump),
444    tgif_chk_output(OutputObj,Obj),
445    FileVersion =< 31,
446    (   (_PageLayoutMode == 0) -> % stack mode
447        _CurPageNum = _PageArg1, _LastPageNum = _PageArg2,
448        _PaperRow = 1, _PaperCol = 1
449    ;   _PaperCol = _PageArg1, _PaperRow = _PageArg2,
450        _CurPageNum = 1, _LastPageNum = 1
451    ),
452    Parms = [page_style=_PageStyle,file_version=FileVersion,
453        print_mag=_PrintMag,
454        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
455        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
456        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
457        line_type=_Spline,
458        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
459        text_just=_TextJust,font_name=_FontName,text_style=_TextStyle,
460        font_size=_FontSize,line_dash=_Dash,
461        grid_system=_GridSystem,metric_grid=_MetricGridSize,
462        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
463        move_mode=_ModeMode,text_rotate=_TextRotate,
464        rcb_radius=_RCBoxRadius,use_gray=_UseGray,
465        page_layout_mode=_PageLayoutMode,
466        page_line_shown_in_tile_mode=_PageLineShownInTileMode,
467        papge_col=_PaperCol,papge_row=_PaperRow,
468        cur_page_num=_CurPageNum,last_page_num=_LastPageNum,
469        color_dump=_ColorDump],
470    !, abolish(tgif_file_version/1),
471    !, assert(tgif_file_version(FileVersion)).
472tgif_state(FileVersion,Obj,Parms) :-
473    (   var(Obj) -> OutputObj = true,
474        current_predicate(state,
475            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
476    ;   OutputObj = false
477    ),
478    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
479        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
480        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_FontName,
481        _TextStyle,_FontSize,0,_Dash,_GridSystem,
482        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
483        _TextRotate,_RCBoxRadius,_UseGray,_PageLayoutMode,_PageArg1,
484        _PageArg2,_PageLineShownInTileMode,_ColorDump,
485        _OnePageWidth,_OnePageHeight),
486    tgif_chk_output(OutputObj,Obj),
487    FileVersion =< 32,
488    (   (_PageLayoutMode == 0) -> % stack mode
489        _CurPageNum = _PageArg1, _LastPageNum = _PageArg2,
490        _PaperRow = 1, _PaperCol = 1
491    ;   _PaperCol = _PageArg1, _PaperRow = _PageArg2,
492        _CurPageNum = 1, _LastPageNum = 1
493    ),
494    Parms = [page_style=_PageStyle,file_version=FileVersion,
495        print_mag=_PrintMag,
496        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
497        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
498        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
499        line_type=_Spline,
500        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
501        text_just=_TextJust,font_name=_FontName,text_style=_TextStyle,
502        font_size=_FontSize,line_dash=_Dash,
503        grid_system=_GridSystem,metric_grid=_MetricGridSize,
504        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
505        move_mode=_ModeMode,text_rotate=_TextRotate,
506        rcb_radius=_RCBoxRadius,use_gray=_UseGray,
507        page_layout_mode=_PageLayoutMode,
508        page_line_shown_in_tile_mode=_PageLineShownInTileMode,
509        papge_col=_PaperCol,papge_row=_PaperRow,
510        cur_page_num=_CurPageNum,last_page_num=_LastPageNum,
511        color_dump=_ColorDump,one_page_width=_OnePageWidth,
512        one_page_height=_OnePageHeight],
513    !, abolish(tgif_file_version/1),
514    !, assert(tgif_file_version(FileVersion)).
515tgif_state(FileVersion,Obj,Parms) :-
516    (   var(Obj) -> OutputObj = true,
517        current_predicate(state,
518            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
519    ;   OutputObj = false
520    ),
521    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
522        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
523        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_FontName,
524        _TextStyle,_FontSize,0,_Dash,_GridSystem,
525        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
526        _TextRotate,_RCBoxRadius,_UseGray,_PageLayoutMode,_PageArg1,
527        _PageArg2,_PageLineShownInTileMode,_ColorDump,
528        _OnePageWidth,_OnePageHeight,_StretchableText,_TextRotation,
529        _RotationIncrement),
530    tgif_chk_output(OutputObj,Obj),
531    FileVersion =< 34,
532    (   (_PageLayoutMode == 0) -> % stack mode
533        _CurPageNum = _PageArg1, _LastPageNum = _PageArg2,
534        _PaperRow = 1, _PaperCol = 1
535    ;   _PaperCol = _PageArg1, _PaperRow = _PageArg2,
536        _CurPageNum = 1, _LastPageNum = 1
537    ),
538    Parms = [page_style=_PageStyle,file_version=FileVersion,
539        print_mag=_PrintMag,
540        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
541        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
542        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
543        line_type=_Spline,
544        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
545        text_just=_TextJust,font_name=_FontName,text_style=_TextStyle,
546        font_size=_FontSize,line_dash=_Dash,
547        grid_system=_GridSystem,metric_grid=_MetricGridSize,
548        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
549        move_mode=_ModeMode,text_rotate=_TextRotate,
550        rcb_radius=_RCBoxRadius,use_gray=_UseGray,
551        page_layout_mode=_PageLayoutMode,
552        page_line_shown_in_tile_mode=_PageLineShownInTileMode,
553        papge_col=_PaperCol,papge_row=_PaperRow,
554        cur_page_num=_CurPageNum,last_page_num=_LastPageNum,
555        color_dump=_ColorDump,one_page_width=_OnePageWidth,
556        one_page_height=_OnePageHeight,
557        stretchable_text=_StretchableText,text_rotation=_TextRotation,
558        rotation_increment=_RotationIncrement],
559    !, abolish(tgif_file_version/1),
560    !, assert(tgif_file_version(FileVersion)).
561tgif_state(FileVersion,Obj,Parms) :-
562    (   var(Obj) -> OutputObj = true,
563        current_predicate(state,
564            state(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_))
565    ;   OutputObj = false
566    ),
567    Obj = state(_PageStyle,FileVersion,_PrintMag,_OrigX,_OrigY,_Zoom,
568        _EnglishGridSize,_Grid,_Color,_HoriAlign,_VertAlign,_LineWidth,
569        _Spline,_LineStyle,_ObjFill,_PenPat,_TextJust,_FontName,
570        _TextStyle,_FontSize,0,_Dash,_GridSystem,
571        _MetricGridSize,_TextVSpace,_ZoomIn,_GridShown,_MoveMode,
572        _TextRotate,_RCBoxRadius,_UseGray,_PageLayoutMode,_PageArg1,
573        _PageArg2,_PageLineShownInTileMode,_ColorDump,
574        _OnePageWidth,_OnePageHeight,_StretchableText,_TextRotation,
575        _RotationIncrement,_TransPat),
576    tgif_chk_output(OutputObj,Obj),
577    FileVersion >= 35,
578    (   (_PageLayoutMode == 0) -> % stack mode
579        _CurPageNum = _PageArg1, _LastPageNum = _PageArg2,
580        _PaperRow = 1, _PaperCol = 1
581    ;   _PaperCol = _PageArg1, _PaperRow = _PageArg2,
582        _CurPageNum = 1, _LastPageNum = 1
583    ),
584    Parms = [page_style=_PageStyle,file_version=FileVersion,
585        print_mag=_PrintMag,
586        orig_x=_OrigX,orig_y=_OrigY,zoom=_Zoom,
587        english_grid_size=_GridSize,snap_on=_Grid,color=_Color,
588        h_align=_HoriAlign,v_align=_VertAlign,line_width=_LineWidth,
589        line_type=_Spline,
590        line_style=_LineStyle,obj_fill=_ObjFill,pen_pat=_PenPat,
591        text_just=_TextJust,font_name=_FontName,text_style=_TextStyle,
592        _font_size_or_sz_unit=_FontSize,line_dash=_Dash,
593        grid_system=_GridSystem,metric_grid=_MetricGridSize,
594        text_v_space=_TextVSpace,zoom_in=_ZoomIn,grid_shown=_GridShown,
595        move_mode=_ModeMode,text_rotate=_TextRotate,
596        rcb_radius=_RCBoxRadius,use_gray=_UseGray,
597        page_layout_mode=_PageLayoutMode,
598        page_line_shown_in_tile_mode=_PageLineShownInTileMode,
599        papge_col=_PaperCol,papge_row=_PaperRow,
600        cur_page_num=_CurPageNum,last_page_num=_LastPageNum,
601        color_dump=_ColorDump,one_page_width=_OnePageWidth,
602        one_page_height=_OnePageHeight,
603        stretchable_text=_StretchableText,text_rotation=_TextRotation,
604        rotation_increment=_RotationIncrement,trans_pat=_TransPat],
605    FileVersion >= 35,
606    (   (FileVersion == 35) -> % stack mode
607        _font_size_or_sz_unit = 'font_size'
608    ;   _font_size_or_sz_unit = 'font_sz_unit'
609    ),
610    !, abolish(tgif_file_version/1),
611    !, assert(tgif_file_version(FileVersion)).
612
613% --------------------------------------------------------------------- %
614
615tgif_text(Obj) :- tgif_text(Obj,_).
616
617tgif_text(Obj,Parms) :-
618    current_predicate(tgif_file_version,tgif_file_version(_)),
619    tgif_file_version(FileVersion),
620    FileVersion =< 2, !,
621    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
622    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
623        StrList),
624    tgif_chk_output(OutputObj,Obj),
625    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
626        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
627        strs=StrList],
628    tgif_strs(StrList).
629tgif_text(Obj,Parms) :-
630    current_predicate(tgif_file_version,tgif_file_version(_)),
631    tgif_file_version(FileVersion),
632    FileVersion =< 6, !,
633    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
634    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
635        _TextRotate,_PenPat,StrList),
636    tgif_chk_output(OutputObj,Obj),
637    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
638        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
639        text_rotate=_TextRotate,pen_pat=_PenPat,strs=StrList],
640    tgif_strs(StrList).
641tgif_text(Obj,Parms) :-
642    current_predicate(tgif_file_version,tgif_file_version(_)),
643    tgif_file_version(FileVersion),
644    FileVersion =< 7, !,
645    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
646    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
647        _TextRotate,_PenPat,_BBoxW,_BBoxH,StrList),
648    tgif_chk_output(OutputObj,Obj),
649    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
650        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
651        text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
652        bbox_h=_BBoxH,strs=StrList],
653    tgif_strs(StrList).
654tgif_text(Obj,Parms) :-
655    current_predicate(tgif_file_version,tgif_file_version(_)),
656    tgif_file_version(FileVersion),
657    FileVersion =< 9, !,
658    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
659    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
660        _TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,_TextDPI,StrList),
661    tgif_chk_output(OutputObj,Obj),
662    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
663        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
664        text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
665        bbox_h=_BBoxH,id=_Id,text_dpi=_TextDPI,strs=StrList],
666    tgif_strs(StrList).
667tgif_text(Obj,Parms) :-
668    current_predicate(tgif_file_version,tgif_file_version(_)),
669    tgif_file_version(FileVersion),
670    FileVersion =< 10, !,
671    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
672    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
673        _TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,_TextDPI,_Asc,_Des,
674        StrList),
675    tgif_chk_output(OutputObj,Obj),
676    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
677        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
678        text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
679        bbox_h=_BBoxH,id=_Id,text_dpi=_TextDPI,asc=_Asc,des=_Des,
680        strs=StrList],
681    tgif_strs(StrList).
682tgif_text(Obj,Parms) :-
683    current_predicate(tgif_file_version,tgif_file_version(_)),
684    tgif_file_version(FileVersion),
685    FileVersion =< 12, !,
686    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
687    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
688        _TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,_TextDPI,_Asc,_Des,
689        _ObjFill,StrList),
690    tgif_chk_output(OutputObj,Obj),
691    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
692        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
693        text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
694        bbox_h=_BBoxH,id=_Id,text_dpi=_TextDPI,asc=_Asc,des=_Des,
695        obj_fill=_ObjFill,strs=StrList],
696    tgif_strs(StrList).
697tgif_text(Obj,Parms) :-
698    current_predicate(tgif_file_version,tgif_file_version(_)),
699    tgif_file_version(FileVersion),
700    FileVersion =< 13, !,
701    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
702    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
703        _TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,_TextDPI,_Asc,_Des,
704        _ObjFill,_VSpace,StrList),
705    tgif_chk_output(OutputObj,Obj),
706    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
707        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
708        text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
709        bbox_h=_BBoxH,id=_Id,text_dpi=_TextDPI,asc=_Asc,des=_Des,
710        obj_fill=_ObjFill,v_space=_VSpace,strs=StrList],
711    tgif_strs(StrList).
712tgif_text(Obj,Parms) :-
713    current_predicate(tgif_file_version,tgif_file_version(_)),
714    tgif_file_version(FileVersion),
715    FileVersion =< 25, !,
716    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
717    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
718        _TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,_TextDPI,_Asc,_Des,
719        _ObjFill,_VSpace,_Rotation,StrList),
720    tgif_chk_output(OutputObj,Obj),
721    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
722        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
723        text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
724        bbox_h=_BBoxH,id=_Id,text_dpi=_TextDPI,asc=_Asc,des=_Des,
725        obj_fill=_ObjFill,v_space=_VSpace,rotation=_Rotation,
726        strs=StrList],
727    tgif_strs(StrList).
728tgif_text(Obj,Parms) :-
729    current_predicate(tgif_file_version,tgif_file_version(_)),
730    tgif_file_version(FileVersion),
731    FileVersion =< 29, !,
732    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
733    Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust,
734        _TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,_TextDPI,_Asc,_Des,
735        _ObjFill,_VSpace,_Rotation,_Locked,StrList),
736    tgif_chk_output(OutputObj,Obj),
737    Parms = [color=_Color,x=_X,y=_Y,font=_Font,text_style=_TextStyle,
738        text_size=_TextSize,num_lines=_NumLines,text_just=_TextJust,
739        text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
740        bbox_h=_BBoxH,id=_Id,text_dpi=_TextDPI,asc=_Asc,des=_Des,
741        obj_fill=_ObjFill,v_space=_VSpace,rotation=_Rotation,
742        obj_locked=_Locked,strs=StrList],
743    tgif_strs(StrList).
744tgif_text(Obj,Parms) :-
745    current_predicate(tgif_file_version,tgif_file_version(_)),
746    tgif_file_version(FileVersion),
747    FileVersion =< 32, !,
748    % From version 30 on, the FontSize is the actual size;
749    %    the TextSize in older versions is a size index.
750    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
751    Obj = text(_Color,_X,_Y,_FontName,_TextStyle,_FontSize,_NumLines,
752        _TextJust,_TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,0,_Asc,_Des,
753        _ObjFill,_VSpace,_Rotation,_Locked,StrList),
754    tgif_chk_output(OutputObj,Obj),
755    Parms = [color=_Color,x=_X,y=_Y,font_name=_FontName,
756        text_style=_TextStyle,font_size=_FontSize,num_lines=_NumLines,
757        text_just=_TextJust,text_rotate=_TextRotate,pen_pat=_PenPat,
758        bbox_w=_BBoxW,bbox_h=_BBoxH,id=_Id,asc=_Asc,des=_Des,
759        obj_fill=_ObjFill,v_space=_VSpace,rotation=_Rotation,
760        obj_locked=_Locked,strs=StrList],
761    tgif_strs(StrList).
762tgif_text(Obj,Parms) :-
763    current_predicate(tgif_file_version,tgif_file_version(_)),
764    tgif_file_version(FileVersion),
765    FileVersion =< 33, !,
766    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
767    (   _Transformed = 0,
768        Obj = text(_Color,_X,_Y,_FontName,_TextStyle,_FontSize,
769            _NumLines,_TextJust,_TextRotate,_PenPat,_BBoxW,_BBoxH,
770            _Id,0,_Asc,_Des,_ObjFill,_VSpace,_Rotation,_Locked,
771            _UnderlineOn,_Underline,_MinLBearing,_MaxRExtra,
772            _DoubleByte,_Direction,_CustomFontName,_Compressed,
773            _Transformed,_Invisible,StrList),
774        tgif_chk_output(OutputObj,Obj),
775        Parms = [color=_Color,x=_X,y=_Y,font_name=_FontName,
776            text_style=_TextStyle,font_size=_FontSize,
777            num_lines=_NumLines,text_just=_TextJust,
778            text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
779            bbox_h=_BBoxH,id=_Id,asc=_Asc,des=_Des,
780            obj_fill=_ObjFill,v_space=_VSpace,rotation=_Rotation,
781            obj_locked=_Locked,underline_on=_UnderlineOn,
782            underline=_Underline,min_lbearing=_MinLBearing,
783            max_rextra=_MaxRExtra,double_byte=_DoubleByte,
784            direction=_Direction,custom_font_name=_CustomFontName,
785            compressed=_Compressed,transformed=_Transformed,
786            invisible=_Invisible,strs=StrList]
787    |   _Transformed = 1,
788        Obj = text(_Color,_X,_Y,_FontName,_TextStyle,_FontSize,
789            _NumLines,_TextJust,_TextRotate,_PenPat,_BBoxW,_BBoxH,
790            _Id,0,_Asc,_Des,_ObjFill,_VSpace,_Rotation,_Locked,
791            _UnderlineOn,_Underline,_MinLBearing,_MaxRExtra,
792            _DoubleByte,_Direction,_CustomFontName,_Compressed,
793            _Transformed,_Invisible,TransformSpec,StrList),
794        tgif_chk_output(OutputObj,Obj),
795        tgif_text_transform_spec(TransformSpec,TransformParms),
796        Parms = [color=_Color,x=_X,y=_Y,font_name=_FontName,
797            text_style=_TextStyle,font_size=_FontSize,
798            num_lines=_NumLines,text_just=_TextJust,
799            text_rotate=_TextRotate,pen_pat=_PenPat,bbox_w=_BBoxW,
800            bbox_h=_BBoxH,id=_Id,asc=_Asc,des=_Des,
801            obj_fill=_ObjFill,v_space=_VSpace,rotation=_Rotation,
802            obj_locked=_Locked,underline_on=_UnderlineOn,
803            underline=_Underline,min_lbearing=_MinLBearing,
804            max_rextra=_MaxRExtra,double_byte=_DoubleByte,
805            direction=_Direction,custom_font_name=_CustomFontName,
806            compressed=_Compressed,transformed=_Transformed,
807            invisible=_Invisible,transform_spec=TransformParms,
808            strs=StrList]
809    ),
810    tgif_strs(StrList).
811%
812% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
813%
814tgif_text(Obj,Parms) :-
815    current_predicate(tgif_file_version,tgif_file_version(_)),
816    tgif_file_version(FileVersion),
817    FileVersion >= 37, !,
818    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
819    (   _Transformed = 0,
820        (   Obj = text(_FillPatColor,_X,_Y,
821                _NumLines,_TextJust,_PenPat,_BBoxW,_BBoxH,_Id,
822                _Asc,_Des,_ObjFill,_VSpace,_Rotation,_Locked,_Underline,
823                _TextW,_TextH,_MinLBearing,_MaxRExtra,_CustomFontName,
824                _Compressed,_Transformed,_Invisible,_TransPat,_BaselineY,
825                MinilinesList),
826                _BgColor = ''
827        |   Obj = text(_FillPatColor,_X,_Y,
828                _NumLines,_TextJust,_PenPat,_BBoxW,_BBoxH,_Id,
829                _Asc,_Des,_ObjFill,_VSpace,_Rotation,_Locked,_Underline,
830                _TextW,_TextH,_MinLBearing,_MaxRExtra,_CustomFontName,
831                _Compressed,_Transformed,_Invisible,_TransPat,_BaselineY,
832                _BgColor,MinilinesList)
833        ),
834        tgif_chk_output(OutputObj,Obj),
835        Parms = [fill_pat_color=_FillPatColor,x=_X,y=_Y,num_lines=_NumLines,
836            text_just=_TextJust,pen_pat=_PenPat,bbox_w=_BBoxW,bbox_h=_BBoxH,
837            id=_Id,asc=_Asc,des=_Des,obj_fill=_ObjFill,v_space=_VSpace,
838            rotation=_Rotation,obj_locked=_Locked,underline=_Underline,
839            text_w=_TextW,text_h=_TextH,min_lbearing=_MinLBearing,
840            max_rextra=_MaxRExtra,custom_font_name=_CustomFontName,
841            compressed=_Compressed,transformed=_Transformed,
842            invisible=_Invisible,trans_pat=_TransPat,baseline_y=_BaselineY,
843            bg_color=_BgColor,minilines=MinilinesList]
844    |   _Transformed = 1,
845        (   Obj = text(_FillPatColor,_X,_Y,
846                _NumLines,_TextJust,_PenPat,_BBoxW,_BBoxH,_Id,
847                _Asc,_Des,_ObjFill,_VSpace,_Rotation,_Locked,_Underline,
848                _TextW,_TextH,_MinLBearing,_MaxRExtra,_CustomFontName,
849                _Compressed,_Transformed,_Invisible,_TransPat,_BaselineY,
850                TransformSpec,MinilinesList),
851                _BgColor = ''
852        |   Obj = text(_FillPatColor,_X,_Y,
853                _NumLines,_TextJust,_PenPat,_BBoxW,_BBoxH,_Id,
854                _Asc,_Des,_ObjFill,_VSpace,_Rotation,_Locked,_Underline,
855                _TextW,_TextH,_MinLBearing,_MaxRExtra,_CustomFontName,
856                _Compressed,_Transformed,_Invisible,_TransPat,_BaselineY,
857                _BgColor,TransformSpec,MinilinesList)
858        ),
859        tgif_chk_output(OutputObj,Obj),
860        tgif_text_transform_spec(TransformSpec,TransformParms),
861        Parms = [fill_pat_color=_FillPatColor,x=_X,y=_Y,num_lines=_NumLines,
862            text_just=_TextJust,pen_pat=_PenPat,bbox_w=_BBoxW,bbox_h=_BBoxH,
863            id=_Id,asc=_Asc,des=_Des,obj_fill=_ObjFill,v_space=_VSpace,
864            rotation=_Rotation,obj_locked=_Locked,underline=_Underline,
865            text_w=_TextW,text_h=_TextH,min_lbearing=_MinLBearing,
866            max_rextra=_MaxRExtra,custom_font_name=_CustomFontName,
867            compressed=_Compressed,transformed=_Transformed,
868            invisible=_Invisible,trans_pat=_TransPat,baseline_y=_BaselineY,
869            transform_spec=TransformParms,bg_color=_BgColor,
870            minilines=MinilinesList]
871    ),
872    tgif_minilines_list(MinilinesList).
873
874% --------------------------------------------------------------------- %
875
876tgif_box(Obj) :- tgif_box(Obj,_).
877
878tgif_box(Obj,Parms) :-
879    current_predicate(tgif_file_version,tgif_file_version(_)),
880    tgif_file_version(FileVersion),
881    FileVersion =< 7, !,
882    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
883    Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat),
884    tgif_chk_output(OutputObj,Obj),
885    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
886        obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat].
887tgif_box(Obj,Parms) :-
888    current_predicate(tgif_file_version,tgif_file_version(_)),
889    tgif_file_version(FileVersion),
890    FileVersion =< 8, !,
891    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
892    Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,_Id,
893        AttrList),
894    tgif_chk_output(OutputObj,Obj),
895    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
896        obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
897        id=_Id,attrs=AttrList],
898    tgif_attrs(AttrList).
899tgif_box(Obj,Parms) :-
900    current_predicate(tgif_file_version,tgif_file_version(_)),
901    tgif_file_version(FileVersion),
902    FileVersion =< 13, !,
903    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
904    Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,_Id,_Dash,
905        AttrList),
906    tgif_chk_output(OutputObj,Obj),
907    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
908        obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
909        id=_Id,line_dash=_Dash,attrs=AttrList],
910    tgif_attrs(AttrList).
911tgif_box(Obj,Parms) :-
912    current_predicate(tgif_file_version,tgif_file_version(_)),
913    tgif_file_version(FileVersion),
914    FileVersion =< 25, !,
915    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
916    Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,_Id,_Dash,
917        _Rotation,AttrList),
918    tgif_chk_output(OutputObj,Obj),
919    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
920        obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
921        id=_Id,line_dash=_Dash,rotation=_Rotation,attrs=AttrList],
922    tgif_attrs(AttrList).
923tgif_box(Obj,Parms) :-
924    current_predicate(tgif_file_version,tgif_file_version(_)),
925    tgif_file_version(FileVersion),
926    FileVersion =< 32, !,
927    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
928    Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,_Id,_Dash,
929        _Rotation,_Locked,AttrList),
930    tgif_chk_output(OutputObj,Obj),
931    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
932        obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
933        id=_Id,line_dash=_Dash,rotation=_Rotation,obj_locked=_Locked,
934        attrs=AttrList],
935    tgif_attrs(AttrList).
936tgif_box(Obj,Parms) :-
937    current_predicate(tgif_file_version,tgif_file_version(_)),
938    tgif_file_version(FileVersion),
939    FileVersion =< 33, !,
940    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
941    (   _Transformed = 0,
942        Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,
943            _Id,_Dash,_Rotation,_Locked,_Transformed,_Invisible,
944            _LineWidthSpec,AttrList),
945        tgif_chk_output(OutputObj,Obj),
946        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
947            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
948            id=_Id,line_dash=_Dash,rotation=_Rotation,
949            obj_locked=_Locked,transformed=_Transformed,
950            invisible=_Invisible,line_width_spec=_LineWidthSpec,
951            attrs=AttrList]
952    |   _Transformed = 1,
953        Obj = box(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,
954            _Id,_Dash,_Rotation,_Locked,_Transformed,_Invisible,
955            _LineWidthSpec,TransformSpec,AttrList),
956        tgif_chk_output(OutputObj,Obj),
957        tgif_obj_transform_spec(TransformSpec,TransformParms),
958        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
959            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
960            id=_Id,line_dash=_Dash,rotation=_Rotation,
961            obj_locked=_Locked,transformed=_Transformed,
962            invisible=_Invisible,line_width_spec=_LineWidthSpec,
963            transform_spec=TransformParms,attrs=AttrList]
964    ),
965    tgif_attrs(AttrList).
966%
967% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
968%
969tgif_box(Obj,Parms) :-
970    current_predicate(tgif_file_version,tgif_file_version(_)),
971    tgif_file_version(FileVersion),
972    FileVersion >= 37, !,
973    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
974    (   _Transformed = 0,
975        Obj = box(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,
976            _Id,_Dash,_Rotation,_Locked,_Transformed,_Invisible,
977            _LineWidthSpec,_TransPat,AttrList),
978        tgif_chk_output(OutputObj,Obj),
979        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
980            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
981            id=_Id,line_dash=_Dash,rotation=_Rotation,
982            obj_locked=_Locked,transformed=_Transformed,
983            invisible=_Invisible,line_width_spec=_LineWidthSpec,
984            trans_pat=_TransPat,attrs=AttrList]
985    |   _Transformed = 1,
986        Obj = box(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,
987            _Id,_Dash,_Rotation,_Locked,_Transformed,_Invisible,
988            _LineWidthSpec,_TransPat,TransformSpec,AttrList),
989        tgif_chk_output(OutputObj,Obj),
990        tgif_obj_transform_spec(TransformSpec,TransformParms),
991        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
992            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
993            id=_Id,line_dash=_Dash,rotation=_Rotation,
994            obj_locked=_Locked,transformed=_Transformed,
995            invisible=_Invisible,line_width_spec=_LineWidthSpec,
996            trans_pat=_TransPat,transform_spec=TransformParms,attrs=AttrList]
997    ),
998    tgif_attrs(AttrList).
999
1000% --------------------------------------------------------------------- %
1001
1002tgif_oval(Obj) :- tgif_oval(Obj,_).
1003
1004tgif_oval(Obj,Parms) :-
1005    current_predicate(tgif_file_version,tgif_file_version(_)),
1006    tgif_file_version(FileVersion),
1007    FileVersion =< 7, !,
1008    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1009    Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,_ObjFill,
1010        _LineWidth,_PenPat),
1011    tgif_chk_output(OutputObj,Obj),
1012    Parms = [color=_Color,ltx=_LeftTopX,lty=_LeftTopY,rbx=_RightBotX,
1013        rby=_RightBotY,obj_fill=_ObjFill,line_width=_LineWidth,
1014        pen_pat=_PenPat].
1015tgif_oval(Obj,Parms) :-
1016    current_predicate(tgif_file_version,tgif_file_version(_)),
1017    tgif_file_version(FileVersion),
1018    FileVersion =< 8, !,
1019    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1020    Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,_ObjFill,
1021        _LineWidth,_PenPat,_Id,AttrList),
1022    tgif_chk_output(OutputObj,Obj),
1023    Parms = [color=_Color,ltx=_LeftTopX,lty=_LeftTopY,rbx=_RightBotX,
1024        rby=_RightBotY,obj_fill=_ObjFill,line_width=_LineWidth,
1025        pen_pat=_PenPat,id=_Id,attrs=AttrList],
1026    tgif_attrs(AttrList).
1027tgif_oval(Obj,Parms) :-
1028    current_predicate(tgif_file_version,tgif_file_version(_)),
1029    tgif_file_version(FileVersion),
1030    FileVersion =< 13, !,
1031    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1032    Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,_ObjFill,
1033        _LineWidth,_PenPat,_Id,_Dash,AttrList),
1034    tgif_chk_output(OutputObj,Obj),
1035    Parms = [color=_Color,ltx=_LeftTopX,lty=_LeftTopY,rbx=_RightBotX,
1036        rby=_RightBotY,obj_fill=_ObjFill,line_width=_LineWidth,
1037        pen_pat=_PenPat,id=_Id,line_dash=_Dash,attrs=AttrList],
1038    tgif_attrs(AttrList).
1039tgif_oval(Obj,Parms) :-
1040    current_predicate(tgif_file_version,tgif_file_version(_)),
1041    tgif_file_version(FileVersion),
1042    FileVersion =< 25, !,
1043    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1044    Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,_ObjFill,
1045        _LineWidth,_PenPat,_Id,_Dash,_Rotation,AttrList),
1046    tgif_chk_output(OutputObj,Obj),
1047    Parms = [color=_Color,ltx=_LeftTopX,lty=_LeftTopY,rbx=_RightBotX,
1048        rby=_RightBotY,obj_fill=_ObjFill,line_width=_LineWidth,
1049        pen_pat=_PenPat,id=_Id,line_dash=_Dash,rotation=_Rotation,
1050        attrs=AttrList],
1051    tgif_attrs(AttrList).
1052tgif_oval(Obj,Parms) :-
1053    current_predicate(tgif_file_version,tgif_file_version(_)),
1054    tgif_file_version(FileVersion),
1055    FileVersion =< 32, !,
1056    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1057    Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,_ObjFill,
1058        _LineWidth,_PenPat,_Id,_Dash,_Rotation,_Locked,AttrList),
1059    tgif_chk_output(OutputObj,Obj),
1060    Parms = [color=_Color,ltx=_LeftTopX,lty=_LeftTopY,rbx=_RightBotX,
1061        rby=_RightBotY,obj_fill=_ObjFill,line_width=_LineWidth,
1062        pen_pat=_PenPat,id=_Id,line_dash=_Dash,rotation=_Rotation,
1063        obj_locked=_Locked,attrs=AttrList],
1064    tgif_attrs(AttrList).
1065tgif_oval(Obj,Parms) :-
1066    current_predicate(tgif_file_version,tgif_file_version(_)),
1067    tgif_file_version(FileVersion),
1068    FileVersion =< 33, !,
1069    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1070    (   _Transformed = 0,
1071        Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,
1072            _ObjFill,_LineWidth,_PenPat,_Id,_Dash,_Rotation,
1073            _Locked,_Transformed,_Invisible,_LineWidthSpec,
1074            AttrList),
1075        tgif_chk_output(OutputObj,Obj),
1076        Parms = [color=_Color,ltx=_LeftTopX,lty=_LeftTopY,
1077            rbx=_RightBotX,rby=_RightBotY,obj_fill=_ObjFill,
1078            line_width=_LineWidth,pen_pat=_PenPat,id=_Id,
1079            line_dash=_Dash,rotation=_Rotation,obj_locked=_Locked,
1080            transformed=_Transformed,invisible=_Invisible,
1081            line_width_spec=_LineWidthSpec,attrs=AttrList]
1082    |   _Transformed = 1,
1083        Obj = oval(_Color,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,
1084            _ObjFill,_LineWidth,_PenPat,_Id,_Dash,_Rotation,
1085            _Locked,_Transformed,_Invisible,_LineWidthSpec,
1086            TransformSpec,AttrList),
1087        tgif_chk_output(OutputObj,Obj),
1088        tgif_obj_transform_spec(TransformSpec,TransformParms),
1089        Parms = [color=_Color,ltx=_LeftTopX,lty=_LeftTopY,
1090            rbx=_RightBotX,rby=_RightBotY,obj_fill=_ObjFill,
1091            line_width=_LineWidth,pen_pat=_PenPat,id=_Id,
1092            line_dash=_Dash,rotation=_Rotation,obj_locked=_Locked,
1093            transformed=_Transformed,invisible=_Invisible,
1094            line_width_spec=_LineWidthSpec,
1095            transform_spec=TransformParms,attrs=AttrList]
1096    ),
1097    tgif_attrs(AttrList).
1098%
1099% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
1100%
1101tgif_oval(Obj,Parms) :-
1102    current_predicate(tgif_file_version,tgif_file_version(_)),
1103    tgif_file_version(FileVersion),
1104    FileVersion >= 37, !,
1105    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1106    (   _Transformed = 0,
1107        Obj = oval(_Color,_BgColor,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,
1108            _ObjFill,_LineWidth,_PenPat,_Id,_Dash,_Rotation,
1109            _Locked,_Transformed,_Invisible,_LineWidthSpec,_TransPat,
1110            AttrList),
1111        tgif_chk_output(OutputObj,Obj),
1112        Parms = [color=_Color,bg_color=_BgColor,ltx=_LeftTopX,lty=_LeftTopY,
1113            rbx=_RightBotX,rby=_RightBotY,obj_fill=_ObjFill,
1114            line_width=_LineWidth,pen_pat=_PenPat,id=_Id,
1115            line_dash=_Dash,rotation=_Rotation,obj_locked=_Locked,
1116            transformed=_Transformed,invisible=_Invisible,
1117            line_width_spec=_LineWidthSpec,trans_pat=_TransPat,attrs=AttrList]
1118    |   _Transformed = 1,
1119        Obj = oval(_Color,_BgColor,_LeftTopX,_LeftTopY,_RightBotX,_RightBotY,
1120            _ObjFill,_LineWidth,_PenPat,_Id,_Dash,_Rotation,
1121            _Locked,_Transformed,_Invisible,_LineWidthSpec,_TransPat,
1122            TransformSpec,AttrList),
1123        tgif_chk_output(OutputObj,Obj),
1124        tgif_obj_transform_spec(TransformSpec,TransformParms),
1125        Parms = [color=_Color,bg_color=_BgColor,ltx=_LeftTopX,lty=_LeftTopY,
1126            rbx=_RightBotX,rby=_RightBotY,obj_fill=_ObjFill,
1127            line_width=_LineWidth,pen_pat=_PenPat,id=_Id,
1128            line_dash=_Dash,rotation=_Rotation,obj_locked=_Locked,
1129            transformed=_Transformed,invisible=_Invisible,
1130            line_width_spec=_LineWidthSpec,trans_pat=_TransPat,
1131            transform_spec=TransformParms,attrs=AttrList]
1132    ),
1133    tgif_attrs(AttrList).
1134
1135% --------------------------------------------------------------------- %
1136
1137tgif_poly(Obj) :- tgif_poly(Obj,_).
1138
1139tgif_poly(Obj,Parms) :-
1140    current_predicate(tgif_file_version,tgif_file_version(_)),
1141    tgif_file_version(FileVersion),
1142    FileVersion =< 3, !,
1143    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1144    Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,
1145        AttrList),
1146    tgif_chk_output(OutputObj,Obj),
1147    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,line_style=_LineStyle,
1148        line_width=_LineWidth,pen_pat=_PenPat,id=_Id,attrs=AttrList],
1149    tgif_attrs(AttrList).
1150tgif_poly(Obj,Parms) :-
1151    current_predicate(tgif_file_version,tgif_file_version(_)),
1152    tgif_file_version(FileVersion),
1153    FileVersion =< 4, !,
1154    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1155    Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline,
1156        AttrList),
1157    tgif_chk_output(OutputObj,Obj),
1158    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,line_style=_LineStyle,
1159        line_width=_LineWidth,pen_pat=_PenPat,id=_Id,line_type=_Spline,
1160        attrs=AttrList],
1161    tgif_attrs(AttrList).
1162tgif_poly(Obj,Parms) :-
1163    current_predicate(tgif_file_version,tgif_file_version(_)),
1164    tgif_file_version(FileVersion),
1165    FileVersion =< 8, !,
1166    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1167    Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline,
1168        _ObjFill,AttrList),
1169    tgif_chk_output(OutputObj,Obj),
1170    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,line_style=_LineStyle,
1171        line_width=_LineWidth,pen_pat=_PenPat,id=_Id,line_type=_Spline,
1172        obj_fill=_ObjFill,attrs=AttrList],
1173    tgif_attrs(AttrList).
1174tgif_poly(Obj,Parms) :-
1175    current_predicate(tgif_file_version,tgif_file_version(_)),
1176    tgif_file_version(FileVersion),
1177    FileVersion =< 13, !,
1178    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1179    Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline,
1180        _ObjFill,_Dash,AttrList),
1181    tgif_chk_output(OutputObj,Obj),
1182    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,line_style=_LineStyle,
1183        line_width=_LineWidth,pen_pat=_PenPat,id=_Id,line_type=_Spline,
1184        obj_fill=_ObjFill,line_dash=_Dash,attrs=AttrList],
1185    tgif_attrs(AttrList).
1186tgif_poly(Obj,Parms) :-
1187    current_predicate(tgif_file_version,tgif_file_version(_)),
1188    tgif_file_version(FileVersion),
1189    FileVersion =< 16, !,
1190    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1191    Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline,
1192        _ObjFill,_Dash,_Rotation,AttrList),
1193    tgif_chk_output(OutputObj,Obj),
1194    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,line_style=_LineStyle,
1195        line_width=_LineWidth,pen_pat=_PenPat,id=_Id,line_type=_Spline,
1196        obj_fill=_ObjFill,line_dash=_Dash,rotation=_Rotation,
1197        attrs=AttrList],
1198    tgif_attrs(AttrList).
1199tgif_poly(Obj,Parms) :-
1200    current_predicate(tgif_file_version,tgif_file_version(_)),
1201    tgif_file_version(FileVersion),
1202    FileVersion =< 25, !,
1203    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1204    Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline,
1205        _ObjFill,_Dash,_Rotation,_ArrowHeadW,_ArrowHeadH,AttrList),
1206    tgif_chk_output(OutputObj,Obj),
1207    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,line_style=_LineStyle,
1208        line_width=_LineWidth,pen_pat=_PenPat,id=_Id,line_type=_Spline,
1209        obj_fill=_ObjFill,line_dash=_Dash,rotation=_Rotation,
1210        arrow_head_w=_ArrowHeadW,arrow_head_h=_ArrowHeadH,
1211        attrs=AttrList],
1212    tgif_attrs(AttrList).
1213tgif_poly(Obj,Parms) :-
1214    current_predicate(tgif_file_version,tgif_file_version(_)),
1215    tgif_file_version(FileVersion),
1216    FileVersion =< 30, !,
1217    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1218    Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline,
1219        _ObjFill,_Dash,_Rotation,_ArrowHeadW,_ArrowHeadH,_Locked,
1220        AttrList),
1221    tgif_chk_output(OutputObj,Obj),
1222    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,line_style=_LineStyle,
1223        line_width=_LineWidth,pen_pat=_PenPat,id=_Id,line_type=_Spline,
1224        obj_fill=_ObjFill,line_dash=_Dash,rotation=_Rotation,
1225        arrow_head_w=_ArrowHeadW,arrow_head_h=_ArrowHeadH,
1226        obj_locked=_Locked,attrs=AttrList],
1227    tgif_attrs(AttrList).
1228tgif_poly(Obj,Parms) :-
1229    current_predicate(tgif_file_version,tgif_file_version(_)),
1230    tgif_file_version(FileVersion),
1231    FileVersion =< 32, !,
1232    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1233    Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline,
1234        _ObjFill,_Dash,_Rotation,_ArrowHeadW,_ArrowHeadH,_Locked,
1235        _SmoothSpecStr,AttrList),
1236    tgif_chk_output(OutputObj,Obj),
1237    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,line_style=_LineStyle,
1238        line_width=_LineWidth,pen_pat=_PenPat,id=_Id,line_type=_Spline,
1239        obj_fill=_ObjFill,line_dash=_Dash,rotation=_Rotation,
1240        arrow_head_w=_ArrowHeadW,arrow_head_h=_ArrowHeadH,
1241        obj_locked=_Locked,smooth_spec=_SmoothSpecStr,attrs=AttrList],
1242    tgif_attrs(AttrList).
1243tgif_poly(Obj,Parms) :-
1244    current_predicate(tgif_file_version,tgif_file_version(_)),
1245    tgif_file_version(FileVersion),
1246    FileVersion =< 33, !,
1247    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1248    (   _Transformed = 0,
1249        Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,
1250            _Spline,_ObjFill,_Dash,_Rotation,_ArrowHeadW,
1251            _ArrowHeadH,_Locked,_Transformed,_Invisible,
1252            _LineWidthSpec,_ArrowHeadWSpec,_ArrowHeadHSpec,
1253            _SmoothSpecStr,AttrList),
1254        tgif_chk_output(OutputObj,Obj),
1255        Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,
1256            line_style=_LineStyle,line_width=_LineWidth,
1257            pen_pat=_PenPat,id=_Id,line_type=_Spline,
1258            obj_fill=_ObjFill,line_dash=_Dash,rotation=_Rotation,
1259            arrow_head_w=_ArrowHeadW,arrow_head_h=_ArrowHeadH,
1260            obj_locked=_Locked,transformed=_Transformed,
1261            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1262            arrow_head_w_spec=_ArrowHeadWSpec,
1263            arrow_head_h_spec=_ArrowHeadHSpec,
1264            smooth_spec=_SmoothSpecStr,attrs=AttrList]
1265    |   _Transformed = 1,
1266        Obj = poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,
1267            _Spline,_ObjFill,_Dash,_Rotation,_ArrowHeadW,
1268            _ArrowHeadH,_Locked,_Transformed,_Invisible,
1269            _LineWidthSpec,_ArrowHeadWSpec,_ArrowHeadHSpec,
1270            _SmoothSpecStr,TransformSpec,AttrList),
1271        tgif_chk_output(OutputObj,Obj),
1272        tgif_obj_transform_spec(TransformSpec,TransformParms),
1273        Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,
1274            line_style=_LineStyle,line_width=_LineWidth,
1275            pen_pat=_PenPat,id=_Id,line_type=_Spline,
1276            obj_fill=_ObjFill,line_dash=_Dash,rotation=_Rotation,
1277            arrow_head_w=_ArrowHeadW,arrow_head_h=_ArrowHeadH,
1278            obj_locked=_Locked,transformed=_Transformed,
1279            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1280            arrow_head_w_spec=_ArrowHeadWSpec,
1281            arrow_head_h_spec=_ArrowHeadHSpec,
1282            smooth_spec=_SmoothSpecStr,
1283            transform_spec=TransformParms,attrs=AttrList]
1284    ),
1285    tgif_attrs(AttrList).
1286%
1287% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
1288%
1289tgif_poly(Obj,Parms) :-
1290    current_predicate(tgif_file_version,tgif_file_version(_)),
1291    tgif_file_version(FileVersion),
1292    FileVersion >= 37, !,
1293    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1294    (   _Transformed = 0,
1295        Obj = poly(_Color,_BgColor,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,
1296            _Spline,_ObjFill,_Dash,_Rotation,_Locked,_Transformed,_Invisible,
1297            _LineWidthSpec,_TransPat,_LineCap,
1298            _SmoothSpecStr,_TensionSpec,LeftArrowSpec,RightArrowSpec,AttrList),
1299        tgif_chk_output(OutputObj,Obj),
1300        Parms = [color=_Color,bg_color=_BgColor,num_vs=_NumVs,vs=_Vs,
1301            line_style=_LineStyle,line_width=_LineWidth,
1302            pen_pat=_PenPat,id=_Id,line_type=_Spline,
1303            obj_fill=_ObjFill,line_dash=_Dash,rotation=_Rotation,
1304            obj_locked=_Locked,transformed=_Transformed,
1305            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1306            smooth_spec=_SmoothSpecStr,attrs=AttrList]
1307    |   _Transformed = 1,
1308        Obj = poly(_Color,_BgColor,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,
1309            _Spline,_ObjFill,_Dash,_Rotation,_Locked,_Transformed,_Invisible,
1310            _LineWidthSpec,_TransPat,_LineCap,
1311            _SmoothSpecStr,_TensionSpec,LeftArrowSpec,RightArrowSpec,
1312            TransformSpec,AttrList),
1313        tgif_chk_output(OutputObj,Obj),
1314        tgif_obj_transform_spec(TransformSpec,TransformParms),
1315        Parms = [color=_Color,bg_color=_BgColor,num_vs=_NumVs,vs=_Vs,
1316            line_style=_LineStyle,line_width=_LineWidth,
1317            pen_pat=_PenPat,id=_Id,line_type=_Spline,
1318            obj_fill=_ObjFill,line_dash=_Dash,rotation=_Rotation,
1319            obj_locked=_Locked,transformed=_Transformed,
1320            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1321            smooth_spec=_SmoothSpecStr,
1322            transform_spec=TransformParms,attrs=AttrList]
1323    ),
1324    tgif_arrow(LeftArrowSpec),
1325    tgif_arrow(RightArrowSpec),
1326    tgif_attrs(AttrList).
1327
1328% --------------------------------------------------------------------- %
1329
1330tgif_polygon(Obj) :- tgif_polygon(Obj,_).
1331
1332tgif_polygon(Obj,Parms) :-
1333    current_predicate(tgif_file_version,tgif_file_version(_)),
1334    tgif_file_version(FileVersion),
1335    FileVersion =< 3, !,
1336    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1337    Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat),
1338    tgif_chk_output(OutputObj,Obj),
1339    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1340        line_width=_LineWidth,pen_pat=_PenPat].
1341tgif_polygon(Obj,Parms) :-
1342    current_predicate(tgif_file_version,tgif_file_version(_)),
1343    tgif_file_version(FileVersion),
1344    FileVersion =< 7, !,
1345    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1346    Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,_Spline),
1347    tgif_chk_output(OutputObj,Obj),
1348    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1349        line_width=_LineWidth,pen_pat=_PenPat,line_type=_Spline].
1350tgif_polygon(Obj,Parms) :-
1351    current_predicate(tgif_file_version,tgif_file_version(_)),
1352    tgif_file_version(FileVersion),
1353    FileVersion =< 8, !,
1354    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1355    Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,_Spline,
1356        _Id,AttrList),
1357    tgif_chk_output(OutputObj,Obj),
1358    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1359        line_width=_LineWidth,pen_pat=_PenPat,line_type=_Spline,
1360        id=_Id,attrs=AttrList],
1361    tgif_attrs(AttrList).
1362tgif_polygon(Obj,Parms) :-
1363    current_predicate(tgif_file_version,tgif_file_version(_)),
1364    tgif_file_version(FileVersion),
1365    FileVersion =< 13, !,
1366    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1367    Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,_Spline,
1368        _Id,_Dash,AttrList),
1369    tgif_chk_output(OutputObj,Obj),
1370    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1371        line_width=_LineWidth,pen_pat=_PenPat,line_type=_Spline,
1372        id=_Id,line_dash=_Dash,attrs=AttrList],
1373    tgif_attrs(AttrList).
1374tgif_polygon(Obj,Parms) :-
1375    current_predicate(tgif_file_version,tgif_file_version(_)),
1376    tgif_file_version(FileVersion),
1377    FileVersion =< 25, !,
1378    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1379    Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,_Spline,
1380        _Id,_Dash,_Rotation,AttrList),
1381    tgif_chk_output(OutputObj,Obj),
1382    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1383        line_width=_LineWidth,pen_pat=_PenPat,line_type=_Spline,
1384        id=_Id,line_dash=_Dash,rotation=_Rotation,attrs=AttrList],
1385    tgif_attrs(AttrList).
1386tgif_polygon(Obj,Parms) :-
1387    current_predicate(tgif_file_version,tgif_file_version(_)),
1388    tgif_file_version(FileVersion),
1389    FileVersion =< 30, !,
1390    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1391    Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,_Spline,
1392        _Id,_Dash,_Rotation,_Locked,AttrList),
1393    tgif_chk_output(OutputObj,Obj),
1394    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1395        line_width=_LineWidth,pen_pat=_PenPat,line_type=_Spline,
1396        id=_Id,line_dash=_Dash,rotation=_Rotation,obj_locked=_Locked,
1397        attrs=AttrList],
1398    tgif_attrs(AttrList).
1399tgif_polygon(Obj,Parms) :-
1400    current_predicate(tgif_file_version,tgif_file_version(_)),
1401    tgif_file_version(FileVersion),
1402    FileVersion =< 32, !,
1403    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1404    Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,_Spline,
1405        _Id,_Dash,_Rotation,_Locked,_SmoothSpecStr,AttrList),
1406    tgif_chk_output(OutputObj,Obj),
1407    Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1408        line_width=_LineWidth,pen_pat=_PenPat,line_type=_Spline,
1409        id=_Id,line_dash=_Dash,rotation=_Rotation,obj_locked=_Locked,
1410        smooth_spec=_SmoothSpecStr,attrs=AttrList],
1411    tgif_attrs(AttrList).
1412tgif_polygon(Obj,Parms) :-
1413    current_predicate(tgif_file_version,tgif_file_version(_)),
1414    tgif_file_version(FileVersion),
1415    FileVersion =< 33, !,
1416    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1417    (   _Transformed = 0,
1418        Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,
1419            _Spline,_Id,_Dash,_Rotation,_Locked,_Transformed,
1420            _Invisible,_LineWidthSpec,_SmoothSpecStr,
1421            AttrList),
1422        tgif_chk_output(OutputObj,Obj),
1423        Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1424            line_width=_LineWidth,pen_pat=_PenPat,
1425            line_type=_Spline,id=_Id,line_dash=_Dash,
1426            rotation=_Rotation,obj_locked=_Locked,
1427            transformed=_Transformed,invisible=_Invisible,
1428            line_width_spec=_LineWidthSpec,
1429            smooth_spec=_SmoothSpecStr,attrs=AttrList]
1430    |   _Transformed = 1,
1431        Obj = polygon(_Color,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,
1432            _Spline,_Id,_Dash,_Rotation,_Locked,_Transformed,
1433            _Invisible,_LineWidthSpec,_SmoothSpecStr,TransformSpec,
1434            AttrList),
1435        tgif_chk_output(OutputObj,Obj),
1436        tgif_obj_transform_spec(TransformSpec,TransformParms),
1437        Parms = [color=_Color,num_vs=_NumVs,vs=_Vs,obj_fill=_ObjFill,
1438            line_width=_LineWidth,pen_pat=_PenPat,
1439            line_type=_Spline,id=_Id,line_dash=_Dash,
1440            rotation=_Rotation,obj_locked=_Locked,
1441            transformed=_Transformed,invisible=_Invisible,
1442            line_width_spec=_LineWidthSpec,
1443            smooth_spec=_SmoothSpecStr,
1444            transform_spec=TransformParms,attrs=AttrList]
1445    ),
1446    tgif_attrs(AttrList).
1447%
1448% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
1449%
1450tgif_polygon(Obj,Parms) :-
1451    current_predicate(tgif_file_version,tgif_file_version(_)),
1452    tgif_file_version(FileVersion),
1453    FileVersion >= 37, !,
1454    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1455    (   _Transformed = 0,
1456        Obj = polygon(_Color,_BgColor,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,
1457            _Spline,_Id,_Dash,_Rotation,_Locked,_Transformed,
1458            _Invisible,_LineWidthSpec,_TransPat,_SmoothSpecStr,
1459            AttrList),
1460        tgif_chk_output(OutputObj,Obj),
1461        Parms = [color=_Color,bg_color=_BgColor,num_vs=_NumVs,vs=_Vs,
1462            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1463            line_type=_Spline,id=_Id,line_dash=_Dash,
1464            rotation=_Rotation,obj_locked=_Locked,
1465            transformed=_Transformed,invisible=_Invisible,
1466            line_width_spec=_LineWidthSpec,trans_pat=_TransPat,
1467            smooth_spec=_SmoothSpecStr,attrs=AttrList]
1468    |   _Transformed = 1,
1469        Obj = polygon(_Color,_BgColor,_NumVs,_Vs,_ObjFill,_LineWidth,_PenPat,
1470            _Spline,_Id,_Dash,_Rotation,_Locked,_Transformed,
1471            _Invisible,_LineWidthSpec,_TransPat,_SmoothSpecStr,TransformSpec,
1472            AttrList),
1473        tgif_chk_output(OutputObj,Obj),
1474        tgif_obj_transform_spec(TransformSpec,TransformParms),
1475        Parms = [color=_Color,bg_color=_BgColor,num_vs=_NumVs,vs=_Vs,
1476            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1477            line_type=_Spline,id=_Id,line_dash=_Dash,
1478            rotation=_Rotation,obj_locked=_Locked,
1479            transformed=_Transformed,invisible=_Invisible,
1480            line_width_spec=_LineWidthSpec,trans_pat=_TransPat,
1481            smooth_spec=_SmoothSpecStr,
1482            transform_spec=TransformParms,attrs=AttrList]
1483    ),
1484    tgif_attrs(AttrList).
1485
1486% --------------------------------------------------------------------- %
1487
1488tgif_rcbox(Obj) :- tgif_rcbox(Obj,_).
1489
1490tgif_rcbox(Obj,Parms) :-
1491    current_predicate(tgif_file_version,tgif_file_version(_)),
1492    tgif_file_version(FileVersion),
1493    FileVersion =< 13, !,
1494    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1495    Obj = rcbox(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,_Dash,
1496        _Radius,_Id,AttrList),
1497    tgif_chk_output(OutputObj,Obj),
1498    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1499        obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1500        line_dash=_Dash,radius=_Radius,id=_Id,attrs=AttrList],
1501    tgif_attrs(AttrList).
1502tgif_rcbox(Obj,Parms) :-
1503    current_predicate(tgif_file_version,tgif_file_version(_)),
1504    tgif_file_version(FileVersion),
1505    FileVersion =< 25, !,
1506    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1507    Obj = rcbox(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,_Dash,
1508        _Radius,_Id,_Rotation,AttrList),
1509    tgif_chk_output(OutputObj,Obj),
1510    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1511        obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1512        line_dash=_Dash,radius=_Radius,id=_Id,rotation=_Rotation,
1513        attrs=AttrList],
1514    tgif_attrs(AttrList).
1515tgif_rcbox(Obj,Parms) :-
1516    current_predicate(tgif_file_version,tgif_file_version(_)),
1517    tgif_file_version(FileVersion),
1518    FileVersion =< 32, !,
1519    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1520    Obj = rcbox(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,_Dash,
1521        _Radius,_Id,_Rotation,_Locked,AttrList),
1522    tgif_chk_output(OutputObj,Obj),
1523    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1524        obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1525        line_dash=_Dash,radius=_Radius,id=_Id,rotation=_Rotation,
1526        obj_locked=_Locked,attrs=AttrList],
1527    tgif_attrs(AttrList).
1528tgif_rcbox(Obj,Parms) :-
1529    current_predicate(tgif_file_version,tgif_file_version(_)),
1530    tgif_file_version(FileVersion),
1531    FileVersion =< 33, !,
1532    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1533    (   _Transformed = 0,
1534        Obj = rcbox(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,
1535            _Dash,_Radius,_Id,_Rotation,_Locked,_Transformed,
1536            _Invisible,_LineWidthSpec,AttrList),
1537        tgif_chk_output(OutputObj,Obj),
1538        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1539            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1540            line_dash=_Dash,radius=_Radius,id=_Id,rotation=_Rotation,
1541            obj_locked=_Locked,transformed=_Transformed,
1542            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1543            attrs=AttrList]
1544    |   _Transformed = 1,
1545        Obj = rcbox(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,
1546            _Dash,_Radius,_Id,_Rotation,_Locked,_Transformed,
1547            _Invisible,_LineWidthSpec,TransformSpec,AttrList),
1548        tgif_chk_output(OutputObj,Obj),
1549        tgif_obj_transform_spec(TransformSpec,TransformParms),
1550        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1551            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1552            line_dash=_Dash,radius=_Radius,id=_Id,rotation=_Rotation,
1553            obj_locked=_Locked,transformed=_Transformed,
1554            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1555            transform_spec=TransformParms,attrs=AttrList]
1556    ),
1557    tgif_attrs(AttrList).
1558%
1559% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
1560%
1561tgif_rcbox(Obj,Parms) :-
1562    current_predicate(tgif_file_version,tgif_file_version(_)),
1563    tgif_file_version(FileVersion),
1564    FileVersion >= 37, !,
1565    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1566    (   _Transformed = 0,
1567        Obj = rcbox(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,
1568            _Dash,_Radius,_Id,_Rotation,_Locked,_Transformed,
1569            _Invisible,_LineWidthSpec,_TransPat,AttrList),
1570        tgif_chk_output(OutputObj,Obj),
1571        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1572            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1573            line_dash=_Dash,radius=_Radius,id=_Id,rotation=_Rotation,
1574            obj_locked=_Locked,transformed=_Transformed,
1575            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1576            trans_pat=_TransPat,attrs=AttrList]
1577    |   _Transformed = 1,
1578        Obj = rcbox(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_LineWidth,_PenPat,
1579            _Dash,_Radius,_Id,_Rotation,_Locked,_Transformed,
1580            _Invisible,_LineWidthSpec,_TransPat,TransformSpec,AttrList),
1581        tgif_chk_output(OutputObj,Obj),
1582        tgif_obj_transform_spec(TransformSpec,TransformParms),
1583        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1584            obj_fill=_ObjFill,line_width=_LineWidth,pen_pat=_PenPat,
1585            line_dash=_Dash,radius=_Radius,id=_Id,rotation=_Rotation,
1586            obj_locked=_Locked,transformed=_Transformed,
1587            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1588            trans_pat=_TransPat,transform_spec=TransformParms,attrs=AttrList]
1589    ),
1590    tgif_attrs(AttrList).
1591
1592% --------------------------------------------------------------------- %
1593
1594tgif_arc(Obj) :- tgif_arc(Obj,_).
1595
1596tgif_arc(Obj,Parms) :-
1597    current_predicate(tgif_file_version,tgif_file_version(_)),
1598    tgif_file_version(FileVersion),
1599    FileVersion =< 13, !,
1600    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1601    Obj = arc(_Color,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,_Xc,_Yc,
1602        _X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,AttrList),
1603    tgif_chk_output(OutputObj,Obj),
1604    Parms = [color=_Color,obj_fill=_ObjFill,line_width=_LineWidth,
1605        pen_pat=_PenPat,line_dash=_Dash,ltx=_LtX,lty=_LtY,
1606        xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,clock_wise=_Dir,
1607        major_axis=_W,minor_axis_H,angle1=_Angle1,angle2=_Angle2,
1608        id=_Id,attrs=AttrList],
1609    tgif_attrs(AttrList).
1610tgif_arc(Obj,Parms) :-
1611    current_predicate(tgif_file_version,tgif_file_version(_)),
1612    tgif_file_version(FileVersion),
1613    FileVersion =< 15, !,
1614    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1615    Obj = arc(_Color,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,_Xc,_Yc,
1616        _X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,_Rotation,
1617        AttrList),
1618    tgif_chk_output(OutputObj,Obj),
1619    Parms = [color=_Color,obj_fill=_ObjFill,line_width=_LineWidth,
1620        pen_pat=_PenPat,line_dash=_Dash,ltx=_LtX,lty=_LtY,
1621        xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,clock_wise=_Dir,
1622        major_axis=_W,minor_axis_H,angle1=_Angle1,angle2=_Angle2,
1623        id=_Id,rotation=_Rotation,attrs=AttrList],
1624    tgif_attrs(AttrList).
1625tgif_arc(Obj,Parms) :-
1626    current_predicate(tgif_file_version,tgif_file_version(_)),
1627    tgif_file_version(FileVersion),
1628    FileVersion =< 16, !,
1629    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1630    Obj = arc(_Color,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,_Xc,_Yc,
1631        _X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,_Rotation,
1632        _Style,AttrList),
1633    tgif_chk_output(OutputObj,Obj),
1634    Parms = [color=_Color,obj_fill=_ObjFill,line_width=_LineWidth,
1635        pen_pat=_PenPat,line_dash=_Dash,ltx=_LtX,lty=_LtY,
1636        xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,clock_wise=_Dir,
1637        major_axis=_W,minor_axis_H,angle1=_Angle1,angle2=_Angle2,
1638        id=_Id,rotation=_Rotation,line_style=_Style,attrs=AttrList],
1639    tgif_attrs(AttrList).
1640tgif_arc(Obj,Parms) :-
1641    current_predicate(tgif_file_version,tgif_file_version(_)),
1642    tgif_file_version(FileVersion),
1643    FileVersion =< 25, !,
1644    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1645    Obj = arc(_Color,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,_Xc,_Yc,
1646        _X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,_Rotation,
1647        _Style,_ArrowHeadW,_ArrowHeadH,AttrList),
1648    tgif_chk_output(OutputObj,Obj),
1649    Parms = [color=_Color,obj_fill=_ObjFill,line_width=_LineWidth,
1650        pen_pat=_PenPat,line_dash=_Dash,ltx=_LtX,lty=_LtY,
1651        xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,clock_wise=_Dir,
1652        major_axis=_W,minor_axis_H,angle1=_Angle1,angle2=_Angle2,
1653        id=_Id,rotation=_Rotation,line_style=_Style,
1654        arrow_head_w=_ArrowHeadW,arrow_head_h=_ArrowHeadH,
1655        attrs=AttrList],
1656    tgif_attrs(AttrList).
1657tgif_arc(Obj,Parms) :-
1658    current_predicate(tgif_file_version,tgif_file_version(_)),
1659    tgif_file_version(FileVersion),
1660    FileVersion =< 32, !,
1661    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1662    Obj = arc(_Color,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,_Xc,_Yc,
1663        _X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,_Rotation,
1664        _Style,_ArrowHeadW,_ArrowHeadH,_Locked,AttrList),
1665    tgif_chk_output(OutputObj,Obj),
1666    Parms = [color=_Color,obj_fill=_ObjFill,line_width=_LineWidth,
1667        pen_pat=_PenPat,line_dash=_Dash,ltx=_LtX,lty=_LtY,
1668        xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,clock_wise=_Dir,
1669        major_axis=_W,minor_axis_H,angle1=_Angle1,angle2=_Angle2,
1670        id=_Id,rotation=_Rotation,line_style=_Style,
1671        arrow_head_w=_ArrowHeadW,arrow_head_h=_ArrowHeadH,
1672        obj_locked=_Locked,attrs=AttrList],
1673    tgif_attrs(AttrList).
1674tgif_arc(Obj,Parms) :-
1675    current_predicate(tgif_file_version,tgif_file_version(_)),
1676    tgif_file_version(FileVersion),
1677    FileVersion =< 33, !,
1678    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1679    (   _Transformed = 0,
1680        Obj = arc(_Color,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,
1681            _Xc,_Yc,_X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,
1682            _Rotation,_Style,_ArrowHeadW,_ArrowHeadH,_Locked,
1683            _Transformed,_Invisible,_LineWidthSpec,_ArrowHeadWSpec,
1684            _ArrowHeadHSpec,AttrList),
1685        tgif_chk_output(OutputObj,Obj),
1686        Parms = [color=_Color,obj_fill=_ObjFill,line_width=_LineWidth,
1687            pen_pat=_PenPat,line_dash=_Dash,ltx=_LtX,lty=_LtY,
1688            xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,
1689            clock_wise=_Dir,major_axis=_W,minor_axis_H,
1690            angle1=_Angle1,angle2=_Angle2,id=_Id,rotation=_Rotation,
1691            line_style=_Style,arrow_head_w=_ArrowHeadW,
1692            arrow_head_h=_ArrowHeadH,obj_locked=_Locked,
1693            transformed=_Transformed,
1694            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1695            arrow_head_w_spec=_ArrowHeadWSpec,
1696            arrow_head_h_spec=_ArrowHeadHSpec,attrs=AttrList]
1697    |   _Transformed = 1,
1698        Obj = arc(_Color,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,
1699            _Xc,_Yc,_X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,
1700            _Rotation,_Style,_ArrowHeadW,_ArrowHeadH,_Locked,
1701            _Transformed,_Invisible,_LineWidthSpec,_ArrowHeadWSpec,
1702            _ArrowHeadHSpec,TransformSpec,AttrList),
1703        tgif_chk_output(OutputObj,Obj),
1704        tgif_obj_transform_spec(TransformSpec,TransformParms),
1705        Parms = [color=_Color,obj_fill=_ObjFill,line_width=_LineWidth,
1706            pen_pat=_PenPat,line_dash=_Dash,ltx=_LtX,lty=_LtY,
1707            xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,
1708            clock_wise=_Dir,major_axis=_W,minor_axis_H,
1709            angle1=_Angle1,angle2=_Angle2,id=_Id,rotation=_Rotation,
1710            line_style=_Style,arrow_head_w=_ArrowHeadW,
1711            arrow_head_h=_ArrowHeadH,obj_locked=_Locked,
1712            transformed=_Transformed,
1713            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1714            arrow_head_w_spec=_ArrowHeadWSpec,
1715            arrow_head_h_spec=_ArrowHeadHSpec,
1716            transform_spec=TransformParms,attrs=AttrList]
1717    ),
1718    tgif_attrs(AttrList).
1719%
1720% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
1721%
1722tgif_arc(Obj,Parms) :-
1723    current_predicate(tgif_file_version,tgif_file_version(_)),
1724    tgif_file_version(FileVersion),
1725    FileVersion >= 37, !,
1726    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1727    (   _Transformed = 0,
1728        Obj = arc(_Color,_BgColor,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,
1729            _Xc,_Yc,_X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,
1730            _Rotation,_Style,_ArrowHeadW,_ArrowHeadH,_Locked,
1731            _Transformed,_Invisible,_LineWidthSpec,_ArrowHeadWSpec,
1732            _ArrowHeadHSpec,_TransPat,AttrList),
1733        tgif_chk_output(OutputObj,Obj),
1734        Parms = [color=_Color,bg_color=_BgColor,obj_fill=_ObjFill,
1735            line_width=_LineWidth,pen_pat=_PenPat,line_dash=_Dash,
1736            ltx=_LtX,lty=_LtY,xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,
1737            clock_wise=_Dir,major_axis=_W,minor_axis_H,
1738            angle1=_Angle1,angle2=_Angle2,id=_Id,rotation=_Rotation,
1739            line_style=_Style,arrow_head_w=_ArrowHeadW,
1740            arrow_head_h=_ArrowHeadH,obj_locked=_Locked,
1741            transformed=_Transformed,
1742            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1743            arrow_head_w_spec=_ArrowHeadWSpec,
1744            arrow_head_h_spec=_ArrowHeadHSpec,trans_pat=_TransPat,
1745            attrs=AttrList]
1746    |   _Transformed = 1,
1747        Obj = arc(_Color,_BgColor,_ObjFill,_LineWidth,_PenPat,_Dash,_LtX,_LtY,
1748            _Xc,_Yc,_X1,_Y1,_X2,_Y2,_Dir,_W,_H,_Angle1,_Angle2,_Id,
1749            _Rotation,_Style,_ArrowHeadW,_ArrowHeadH,_Locked,
1750            _Transformed,_Invisible,_LineWidthSpec,_ArrowHeadWSpec,
1751            _ArrowHeadHSpec,_TransPat,TransformSpec,AttrList),
1752        tgif_chk_output(OutputObj,Obj),
1753        tgif_obj_transform_spec(TransformSpec,TransformParms),
1754        Parms = [color=_Color,bg_color=_BgColor,obj_fill=_ObjFill,
1755            line_width=_LineWidth,pen_pat=_PenPat,line_dash=_Dash,
1756            ltx=_LtX,lty=_LtY,xc=_Xc,yc=_Yc,x1=_X1,y1=_Y1,x2=_X2,y2=_Y2,
1757            clock_wise=_Dir,major_axis=_W,minor_axis_H,
1758            angle1=_Angle1,angle2=_Angle2,id=_Id,rotation=_Rotation,
1759            line_style=_Style,arrow_head_w=_ArrowHeadW,
1760            arrow_head_h=_ArrowHeadH,obj_locked=_Locked,
1761            transformed=_Transformed,
1762            invisible=_Invisible,line_width_spec=_LineWidthSpec,
1763            arrow_head_w_spec=_ArrowHeadWSpec,
1764            arrow_head_h_spec=_ArrowHeadHSpec,trans_pat=_TransPat,
1765            transform_spec=TransformParms,attrs=AttrList]
1766    ),
1767    tgif_attrs(AttrList).
1768
1769% --------------------------------------------------------------------- %
1770
1771tgif_xbm(Obj) :- tgif_xbm(Obj,_).
1772
1773tgif_xbm(Obj,Parms) :-
1774    current_predicate(tgif_file_version,tgif_file_version(_)),
1775    tgif_file_version(FileVersion),
1776    FileVersion =< 13, !,
1777    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1778    Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_BitmapStr,AttrList),
1779    tgif_chk_output(OutputObj,Obj),
1780    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,obj_fill=_ObjFill,
1781        id=_Id,xbm_str=_BitmapStr,attrs=AttrList],
1782    tgif_attrs(AttrList).
1783tgif_xbm(Obj,Parms) :-
1784    current_predicate(tgif_file_version,tgif_file_version(_)),
1785    tgif_file_version(FileVersion),
1786    FileVersion =< 22, !,
1787    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1788    Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,_BitmapStr,
1789        AttrList),
1790    tgif_chk_output(OutputObj,Obj),
1791    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,obj_fill=_ObjFill,
1792        id=_Id,rotation=_Rotation,xbm_str=_BitmapStr,attrs=AttrList],
1793    tgif_attrs(AttrList).
1794tgif_xbm(Obj,Parms) :-
1795    current_predicate(tgif_file_version,tgif_file_version(_)),
1796    tgif_file_version(FileVersion),
1797    FileVersion =< 23, !,
1798    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1799    Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,_ImageW,_ImageH,
1800        _Rotate,_Flip,_BitmapStr,AttrList),
1801    tgif_chk_output(OutputObj,Obj),
1802    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,obj_fill=_ObjFill,
1803        id=_Id,rotation=_Rotation,image_w=_ImageW,image_h=_ImageH,
1804        rotate=_Rotate,flip=_Flip,xbm_str=_BitmapStr,attrs=AttrList],
1805    tgif_attrs(AttrList).
1806tgif_xbm(Obj,Parms) :-
1807    current_predicate(tgif_file_version,tgif_file_version(_)),
1808    tgif_file_version(FileVersion),
1809    FileVersion =< 25, !,
1810    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1811    (   _RealType = 0, _NoBitmap = 0,
1812        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1813            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1814            _URX,_URY,_NoBitmap,_Date,_File,_BitmapStr,AttrList),
1815        tgif_chk_output(OutputObj,Obj),
1816        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1817            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1818            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1819            flip=_Flip,real_type='xbm',llx=_LLX,lly=_LLY,
1820            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,
1821            xbm_str=_BitmapStr,attrs=AttrList]
1822    |   _RealType = 1, _NoBitmap = 0,
1823        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1824            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1825            _URX,_URY,_NoBitmap,_Date,_File,_BitmapStr,AttrList),
1826        tgif_chk_output(OutputObj,Obj),
1827        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1828            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1829            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1830            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1831            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,
1832            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
1833    |   _RealType = 1, _NoBitmap = 1,
1834        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1835            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1836            _URX,_URY,_NoBitmap,_Date,_File,AttrList),
1837        tgif_chk_output(OutputObj,Obj),
1838        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1839            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1840            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1841            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1842            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,
1843            date=_Date,file=_File,attrs=AttrList]
1844    ),
1845    tgif_attrs(AttrList).
1846tgif_xbm(Obj,Parms) :-
1847    current_predicate(tgif_file_version,tgif_file_version(_)),
1848    tgif_file_version(FileVersion),
1849    FileVersion =< 28, !,
1850    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1851    (   _RealType = 0, _NoBitmap = 0,
1852        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1853            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1854            _URX,_URY,_NoBitmap,_Locked,_Date,_File,_BitmapStr,
1855            AttrList),
1856        tgif_chk_output(OutputObj,Obj),
1857        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1858            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1859            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1860            flip=_Flip,real_type='xbm',llx=_LLX,lly=_LLY,
1861            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1862            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
1863    |   _RealType = 1, _NoBitmap = 0,
1864        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1865            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1866            _URX,_URY,_NoBitmap,_Locked,_Date,_File,_BitmapStr,
1867            AttrList),
1868        tgif_chk_output(OutputObj,Obj),
1869        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1870            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1871            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1872            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1873            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1874            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
1875    |   _RealType = 1, _NoBitmap = 1,
1876        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1877            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1878            _URX,_URY,_NoBitmap,_Locked,_Date,_File,AttrList),
1879        tgif_chk_output(OutputObj,Obj),
1880        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1881            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1882            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1883            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1884            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1885            date=_Date,file=_File,attrs=AttrList]
1886    ),
1887    tgif_attrs(AttrList).
1888tgif_xbm(Obj,Parms) :-
1889    current_predicate(tgif_file_version,tgif_file_version(_)),
1890    tgif_file_version(FileVersion),
1891    FileVersion =< 32, !,
1892    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1893    (   _RealType = 0, _NoBitmap = 0, _SaveEPSF = 0,
1894        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1895            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1896            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
1897            _Date,_File,_BitmapStr,AttrList),
1898        tgif_chk_output(OutputObj,Obj),
1899        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1900            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1901            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1902            flip=_Flip,real_type='xbm',llx=_LLX,lly=_LLY,
1903            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1904            save_epsf=_SaveEPSF,
1905            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
1906    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 0,
1907        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1908            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1909            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
1910            _Date,_File,_BitmapStr,AttrList),
1911        tgif_chk_output(OutputObj,Obj),
1912        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1913            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1914            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1915            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1916            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1917            save_epsf=_SaveEPSF,
1918            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
1919    |   _RealType = 1, _NoBitmap = 1, _SaveEPSF = 0,
1920        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1921            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1922            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
1923            _Date,_File,AttrList),
1924        tgif_chk_output(OutputObj,Obj),
1925        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1926            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1927            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1928            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1929            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1930            save_epsf=_SaveEPSF,
1931            date=_Date,file=_File,attrs=AttrList]
1932    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 1,
1933        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1934            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1935            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
1936            _Date,_File,_NumEPSFLines,_EPSFLines,_BitmapStr,
1937            AttrList),
1938        tgif_chk_output(OutputObj,Obj),
1939        length(_EPSFLines,_NumEPSFLines),
1940        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1941            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1942            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1943            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1944            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1945            save_epsf=_SaveEPSF,num_epsf_lines=_NumEPSFLines,
1946            epsf_lines=_EPSFLines,date=_Date,file=_File,
1947            xbm_str=_BitmapStr,attrs=AttrList]
1948    ),
1949    tgif_attrs(AttrList).
1950tgif_xbm(Obj,Parms) :-
1951    current_predicate(tgif_file_version,tgif_file_version(_)),
1952    tgif_file_version(FileVersion),
1953    FileVersion =< 33, !,
1954    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
1955    (   _RealType = 0, _NoBitmap = 0, _SaveEPSF = 0, _Transformed = 0,
1956        % Just XBM
1957        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1958            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1959            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
1960            _Compressed,_Transformed,_Invisible,
1961            _Date,_File,_BitmapStr,AttrList),
1962        tgif_chk_output(OutputObj,Obj),
1963        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1964            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1965            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1966            flip=_Flip,real_type='xbm',llx=_LLX,lly=_LLY,
1967            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1968            save_epsf=_SaveEPSF,compressed=_Compressed,
1969            transformed=_Transformed,invisible=_Invisible,
1970            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
1971    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 0, _Transformed = 0,
1972        % What type is this?
1973        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1974            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1975            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
1976            _Compressed,_Transformed,_Invisible,
1977            _Date,_File,_BitmapStr,AttrList),
1978        tgif_chk_output(OutputObj,Obj),
1979        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1980            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1981            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1982            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1983            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
1984            save_epsf=_SaveEPSF,compressed=_Compressed,
1985            transformed=_Transformed,invisible=_Invisible,
1986            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
1987    |   _RealType = 1, _NoBitmap = 1, _SaveEPSF = 0, _Transformed = 0,
1988        % Linked EPS
1989        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
1990            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
1991            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
1992            _Compressed,_Transformed,_Invisible,
1993            _Date,_File,AttrList),
1994        tgif_chk_output(OutputObj,Obj),
1995        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
1996            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
1997            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
1998            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
1999            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2000            save_epsf=_SaveEPSF,compressed=_Compressed,
2001            transformed=_Transformed,invisible=_Invisible,
2002            date=_Date,file=_File,attrs=AttrList]
2003    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 1, _Transformed = 0,
2004        % Embeded EPS
2005        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2006            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2007            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2008            _Compressed,_Transformed,_Invisible,
2009            _Date,_File,_NumEPSFLines,_EPSFLines,_BitmapStr,
2010            AttrList),
2011        tgif_chk_output(OutputObj,Obj),
2012        length(_EPSFLines,_NumEPSFLines),
2013        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2014            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2015            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2016            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2017            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2018            save_epsf=_SaveEPSF,compressed=_Compressed,
2019            transformed=_Transformed,invisible=_Invisible,
2020            num_epsf_lines=_NumEPSFLines,epsf_lines=_EPSFLines,
2021            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
2022    |   _RealType = 0, _NoBitmap = 0, _SaveEPSF = 0, _Transformed = 1,
2023        % Just XBM
2024        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2025            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2026            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2027            _Compressed,_Transformed,_Invisible,
2028            _Date,_File,_BitmapStr,TransformSpec,AttrList),
2029        tgif_chk_output(OutputObj,Obj),
2030        tgif_obj_transform_spec(TransformSpec,TransformParms),
2031        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2032            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2033            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2034            flip=_Flip,real_type='xbm',llx=_LLX,lly=_LLY,
2035            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2036            save_epsf=_SaveEPSF,compressed=_Compressed,
2037            transformed=_Transformed,invisible=_Invisible,
2038            date=_Date,file=_File,xbm_str=_BitmapStr,
2039            transform_spec=TransformParms,attrs=AttrList]
2040    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 0, _Transformed = 1,
2041        % What type is this?
2042        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2043            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2044            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2045            _Compressed,_Transformed,_Invisible,
2046            _Date,_File,_BitmapStr,TransformSpec,AttrList),
2047        tgif_chk_output(OutputObj,Obj),
2048        tgif_obj_transform_spec(TransformSpec,TransformParms),
2049        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2050            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2051            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2052            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2053            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2054            save_epsf=_SaveEPSF,compressed=_Compressed,
2055            transformed=_Transformed,invisible=_Invisible,
2056            date=_Date,file=_File,xbm_str=_BitmapStr,
2057            transform_spec=TransformParms,attrs=AttrList]
2058    |   _RealType = 1, _NoBitmap = 1, _SaveEPSF = 0, _Transformed = 1,
2059        % Linked EPS
2060        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2061            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2062            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2063            _Compressed,_Transformed,_Invisible,
2064            _Date,_File,TransformSpec,AttrList),
2065        tgif_chk_output(OutputObj,Obj),
2066        tgif_obj_transform_spec(TransformSpec,TransformParms),
2067        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2068            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2069            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2070            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2071            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2072            save_epsf=_SaveEPSF,compressed=_Compressed,
2073            transformed=_Transformed,invisible=_Invisible,
2074            date=_Date,file=_File,transform_spec=TransformParms,
2075            attrs=AttrList]
2076    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 1, _Transformed = 1,
2077        % Embeded EPS
2078        Obj = xbm(_Color,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2079            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2080            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2081            _Compressed,_Transformed,_Invisible,
2082            _Date,_File,_NumEPSFLines,_EPSFLines,_BitmapStr,
2083            TransformSpec,AttrList),
2084        tgif_chk_output(OutputObj,Obj),
2085        tgif_obj_transform_spec(TransformSpec,TransformParms),
2086        length(_EPSFLines,_NumEPSFLines),
2087        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2088            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2089            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2090            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2091            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2092            save_epsf=_SaveEPSF,compressed=_Compressed,
2093            transformed=_Transformed,invisible=_Invisible,
2094            num_epsf_lines=_NumEPSFLines,epsf_lines=_EPSFLines,
2095            date=_Date,file=_File,xbm_str=_BitmapStr,
2096            transform_spec=TransformParms,attrs=AttrList]
2097    ),
2098    tgif_attrs(AttrList).
2099%
2100% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
2101%
2102tgif_xbm(Obj,Parms) :-
2103    current_predicate(tgif_file_version,tgif_file_version(_)),
2104    tgif_file_version(FileVersion),
2105    FileVersion >= 37, !,
2106    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2107    (   _RealType = 0, _NoBitmap = 0, _SaveEPSF = 0, _Transformed = 0,
2108        % Just XBM
2109        Obj = xbm(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2110            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2111            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2112            _Compressed,_Transformed,_Invisible,_TransPat,
2113            _Date,_File,_BitmapStr,AttrList),
2114        tgif_chk_output(OutputObj,Obj),
2115        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2116            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2117            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2118            flip=_Flip,real_type='xbm',llx=_LLX,lly=_LLY,
2119            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2120            save_epsf=_SaveEPSF,compressed=_Compressed,
2121            transformed=_Transformed,invisible=_Invisible,trans_pat=_TransPat,
2122            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
2123    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 0, _Transformed = 0,
2124        % What type is this?
2125        Obj = xbm(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2126            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2127            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2128            _Compressed,_Transformed,_Invisible,_TransPat,
2129            _Date,_File,_BitmapStr,AttrList),
2130        tgif_chk_output(OutputObj,Obj),
2131        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2132            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2133            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2134            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2135            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2136            save_epsf=_SaveEPSF,compressed=_Compressed,
2137            transformed=_Transformed,invisible=_Invisible,trans_pat=_TransPat,
2138            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
2139    |   _RealType = 1, _NoBitmap = 1, _SaveEPSF = 0, _Transformed = 0,
2140        % Linked EPS
2141        Obj = xbm(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2142            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2143            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2144            _Compressed,_Transformed,_Invisible,_TransPat,
2145            _Date,_File,AttrList),
2146        tgif_chk_output(OutputObj,Obj),
2147        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2148            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2149            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2150            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2151            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2152            save_epsf=_SaveEPSF,compressed=_Compressed,
2153            transformed=_Transformed,invisible=_Invisible,trans_pat=_TransPat,
2154            date=_Date,file=_File,attrs=AttrList]
2155    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 1, _Transformed = 0,
2156        % Embeded EPS
2157        Obj = xbm(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2158            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2159            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2160            _Compressed,_Transformed,_Invisible,_TransPat,
2161            _Date,_File,_NumEPSFLines,_EPSFLines,_BitmapStr,
2162            AttrList),
2163        tgif_chk_output(OutputObj,Obj),
2164        length(_EPSFLines,_NumEPSFLines),
2165        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2166            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2167            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2168            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2169            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2170            save_epsf=_SaveEPSF,compressed=_Compressed,
2171            transformed=_Transformed,invisible=_Invisible,trans_pat=_TransPat,
2172            num_epsf_lines=_NumEPSFLines,epsf_lines=_EPSFLines,
2173            date=_Date,file=_File,xbm_str=_BitmapStr,attrs=AttrList]
2174    |   _RealType = 0, _NoBitmap = 0, _SaveEPSF = 0, _Transformed = 1,
2175        % Just XBM
2176        Obj = xbm(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2177            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2178            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2179            _Compressed,_Transformed,_Invisible,_TransPat,
2180            _Date,_File,_BitmapStr,TransformSpec,AttrList),
2181        tgif_chk_output(OutputObj,Obj),
2182        tgif_obj_transform_spec(TransformSpec,TransformParms),
2183        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2184            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2185            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2186            flip=_Flip,real_type='xbm',llx=_LLX,lly=_LLY,
2187            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2188            save_epsf=_SaveEPSF,compressed=_Compressed,
2189            transformed=_Transformed,invisible=_Invisible,trans_pat=_TransPat,
2190            date=_Date,file=_File,xbm_str=_BitmapStr,
2191            transform_spec=TransformParms,attrs=AttrList]
2192    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 0, _Transformed = 1,
2193        % What type is this?
2194        Obj = xbm(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2195            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2196            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2197            _Compressed,_Transformed,_Invisible,_TransPat,
2198            _Date,_File,_BitmapStr,TransformSpec,AttrList),
2199        tgif_chk_output(OutputObj,Obj),
2200        tgif_obj_transform_spec(TransformSpec,TransformParms),
2201        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2202            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2203            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2204            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2205            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2206            save_epsf=_SaveEPSF,compressed=_Compressed,
2207            transformed=_Transformed,invisible=_Invisible,trans_pat=_TransPat,
2208            date=_Date,file=_File,xbm_str=_BitmapStr,
2209            transform_spec=TransformParms,attrs=AttrList]
2210    |   _RealType = 1, _NoBitmap = 1, _SaveEPSF = 0, _Transformed = 1,
2211        % Linked EPS
2212        Obj = xbm(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2213            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2214            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2215            _Compressed,_Transformed,_Invisible,_TransPat,
2216            _Date,_File,TransformSpec,AttrList),
2217        tgif_chk_output(OutputObj,Obj),
2218        tgif_obj_transform_spec(TransformSpec,TransformParms),
2219        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2220            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2221            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2222            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2223            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2224            save_epsf=_SaveEPSF,compressed=_Compressed,
2225            transformed=_Transformed,invisible=_Invisible,trans_pat=_TransPat,
2226            date=_Date,file=_File,transform_spec=TransformParms,
2227            attrs=AttrList]
2228    |   _RealType = 1, _NoBitmap = 0, _SaveEPSF = 1, _Transformed = 1,
2229        % Embeded EPS
2230        Obj = xbm(_Color,_BgColor,_X1,_Y1,_X2,_Y2,_ObjFill,_Id,_Rotation,
2231            _ImageW,_ImageH,_Rotate,_Flip,_RealType,_LLX,_LLY,
2232            _URX,_URY,_NoBitmap,_Locked,_SaveEPSF,
2233            _Compressed,_Transformed,_Invisible,_TransPat,
2234            _Date,_File,_NumEPSFLines,_EPSFLines,_BitmapStr,
2235            TransformSpec,AttrList),
2236        tgif_chk_output(OutputObj,Obj),
2237        tgif_obj_transform_spec(TransformSpec,TransformParms),
2238        length(_EPSFLines,_NumEPSFLines),
2239        Parms = [color=_Color,bg_color=_BgColor,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2240            obj_fill=_ObjFill,id=_Id,rotation=_Rotation,
2241            image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,
2242            flip=_Flip,real_type='eps',llx=_LLX,lly=_LLY,
2243            urx=_URX,ury=_URY,no_bitmap=_NoBitmap,obj_locked=_Locked,
2244            save_epsf=_SaveEPSF,compressed=_Compressed,
2245            transformed=_Transformed,invisible=_Invisible,trans_pat=_TransPat,
2246            num_epsf_lines=_NumEPSFLines,epsf_lines=_EPSFLines,
2247            date=_Date,file=_File,xbm_str=_BitmapStr,
2248            transform_spec=TransformParms,attrs=AttrList]
2249    ),
2250    tgif_attrs(AttrList).
2251
2252% --------------------------------------------------------------------- %
2253
2254tgif_xpm(Obj) :- tgif_xpm(Obj,_).
2255
2256tgif_xpm(Obj,Parms) :-
2257    current_predicate(tgif_file_version,tgif_file_version(_)),
2258    tgif_file_version(FileVersion),
2259    FileVersion =< 13, !,
2260    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2261    Obj = xpm(_Color,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,_Id,
2262        ColorNames,Pixels,AttrList),
2263    tgif_chk_output(OutputObj,Obj),
2264    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2265        obj_fill=_UnUsedObjFill,num_colors=_NumColors,id=_Id,
2266        color_names=ColorNames,pixels=Pixels,attrs=AttrList],
2267    tgif_color_info(ColorNames),
2268    tgif_pixels(Pixels),
2269    tgif_attrs(AttrList).
2270tgif_xpm(Obj,Parms) :-
2271    current_predicate(tgif_file_version,tgif_file_version(_)),
2272    tgif_file_version(FileVersion),
2273    FileVersion =< 14, !,
2274    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2275    Obj = xpm(_Color,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,_Id,
2276        _Rotation,ColorNames,Pixels,AttrList),
2277    tgif_chk_output(OutputObj,Obj),
2278    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2279        obj_fill=_UnUsedObjFill,num_colors=_NumColors,id=_Id,
2280        rotation=_Rotation,color_names=ColorNames,pixels=Pixels,
2281        attrs=AttrList],
2282    tgif_color_info(ColorNames),
2283    tgif_pixels(Pixels),
2284    tgif_attrs(AttrList).
2285tgif_xpm(Obj,Parms) :-
2286    current_predicate(tgif_file_version,tgif_file_version(_)),
2287    tgif_file_version(FileVersion),
2288    FileVersion =< 22, !,
2289    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2290    Obj = xpm(_Color,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,
2291        _CharsPerPixel,_FirstPixelIsBg,_Id,_Rotation,ColorNames,Pixels,
2292        AttrList),
2293    tgif_chk_output(OutputObj,Obj),
2294    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2295        obj_fill=_UnUsedObjFill,num_colors=_NumColors,
2296        chars_per_pixel=_CharsPerPixel,
2297        first_pixel_is_bg=_FirstPixelIsBg,id=_Id,
2298        rotation=_Rotation,color_names=ColorNames,pixels=Pixels,
2299        attrs=AttrList],
2300    tgif_color_info(ColorNames),
2301    tgif_pixels(Pixels),
2302    tgif_attrs(AttrList).
2303tgif_xpm(Obj,Parms) :-
2304    current_predicate(tgif_file_version,tgif_file_version(_)),
2305    tgif_file_version(FileVersion),
2306    FileVersion =< 25, !,
2307    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2308    Obj = xpm(_Color,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,
2309        _CharsPerPixel,_FirstPixelIsBg,_Id,_Rotation,_ImageW,_ImageH,
2310        _Rotate,_Flip,ColorNames,Pixels,AttrList),
2311    tgif_chk_output(OutputObj,Obj),
2312    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2313        obj_fill=_UnUsedObjFill,num_colors=_NumColors,
2314        chars_per_pixel=_CharsPerPixel,
2315        first_pixel_is_bg=_FirstPixelIsBg,id=_Id,rotation=_Rotation,
2316        image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,flip=_Flip,
2317        color_names=ColorNames,pixels=Pixels,attrs=AttrList],
2318    tgif_color_info(ColorNames),
2319    tgif_pixels(Pixels),
2320    tgif_attrs(AttrList).
2321tgif_xpm(Obj,Parms) :-
2322    current_predicate(tgif_file_version,tgif_file_version(_)),
2323    tgif_file_version(FileVersion),
2324    FileVersion =< 32, !,
2325    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2326    Obj = xpm(_Color,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,
2327        _CharsPerPixel,_FirstPixelIsBg,_Id,_Rotation,_ImageW,_ImageH,
2328        _Rotate,_Flip,_Locked,ColorNames,Pixels,AttrList),
2329    tgif_chk_output(OutputObj,Obj),
2330    Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2331        obj_fill=_UnUsedObjFill,num_colors=_NumColors,
2332        chars_per_pixel=_CharsPerPixel,
2333        first_pixel_is_bg=_FirstPixelIsBg,id=_Id,rotation=_Rotation,
2334        image_w=_ImageW,image_h=_ImageH,rotate=_Rotate,flip=_Flip,
2335        obj_locked=_Locked,color_names=ColorNames,pixels=Pixels,
2336        attrs=AttrList],
2337    tgif_color_info(ColorNames),
2338    tgif_pixels(Pixels),
2339    tgif_attrs(AttrList).
2340tgif_xpm(Obj,Parms) :-
2341    current_predicate(tgif_file_version,tgif_file_version(_)),
2342    tgif_file_version(FileVersion),
2343    FileVersion =< 33, !,
2344    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2345    (   _Transformed = 0,
2346        Obj = xpm(_Color,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,
2347            _CharsPerPixel,_FirstPixelIsBg,_Id,_Rotation,
2348            _ImageW,_ImageH,_Rotate,_Flip,_Locked,_Compressed,
2349            _Transformed,_Invisible,ColorNames,Pixels,AttrList),
2350        tgif_chk_output(OutputObj,Obj),
2351        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2352            obj_fill=_UnUsedObjFill,num_colors=_NumColors,
2353            chars_per_pixel=_CharsPerPixel,
2354            first_pixel_is_bg=_FirstPixelIsBg,id=_Id,
2355            rotation=_Rotation,image_w=_ImageW,image_h=_ImageH,
2356            rotate=_Rotate,flip=_Flip,obj_locked=_Locked,
2357            compressed=_Compressed,transformed=_Transformed,
2358            invisible=_Invisible,color_names=ColorNames,
2359            pixels=Pixels,attrs=AttrList]
2360    |   _Transformed = 1,
2361        Obj = xpm(_Color,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,
2362            _CharsPerPixel,_FirstPixelIsBg,_Id,_Rotation,
2363            _ImageW,_ImageH,_Rotate,_Flip,_Locked,_Compressed,
2364            _Transformed,_Invisible,TransformSpec,ColorNames,
2365            Pixels,AttrList),
2366        tgif_chk_output(OutputObj,Obj),
2367        tgif_obj_transform_spec(TransformSpec,TransformParms),
2368        Parms = [color=_Color,ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,
2369            obj_fill=_UnUsedObjFill,num_colors=_NumColors,
2370            chars_per_pixel=_CharsPerPixel,
2371            first_pixel_is_bg=_FirstPixelIsBg,id=_Id,
2372            rotation=_Rotation,image_w=_ImageW,image_h=_ImageH,
2373            rotate=_Rotate,flip=_Flip,obj_locked=_Locked,
2374            compressed=_Compressed,transformed=_Transformed,
2375            invisible=_Invisible,transform_spec=TransformParms,
2376            color_names=ColorNames,pixels=Pixels,attrs=AttrList]
2377    ),
2378    tgif_color_info(ColorNames),
2379    tgif_pixels(Pixels),
2380    tgif_attrs(AttrList).
2381%
2382% Note: FileVersions 34, 35, and 36 are skipped.  See check_file_version/1.
2383%
2384tgif_xpm(Obj,Parms) :-
2385    current_predicate(tgif_file_version,tgif_file_version(_)),
2386    tgif_file_version(FileVersion),
2387    FileVersion >= 37, !,
2388    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2389    (   _Transformed = 0,
2390        Obj = xpm(_Color,_TransColor,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,
2391            _CharsPerPixel,_FirstPixelIsBg,_Id,_Rotation,
2392            _ImageW,_ImageH,_Rotate,_Flip,_Locked,_Compressed,
2393            _Transformed,_Invisible,ColorNames,Pixels,AttrList),
2394        tgif_chk_output(OutputObj,Obj),
2395        Parms = [color=_Color,trans_color=_TransColor,
2396            ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,obj_fill=_UnUsedObjFill,
2397            num_colors=_NumColors,chars_per_pixel=_CharsPerPixel,
2398            first_pixel_is_bg=_FirstPixelIsBg,id=_Id,
2399            rotation=_Rotation,image_w=_ImageW,image_h=_ImageH,
2400            rotate=_Rotate,flip=_Flip,obj_locked=_Locked,
2401            compressed=_Compressed,transformed=_Transformed,
2402            invisible=_Invisible,color_names=ColorNames,
2403            pixels=Pixels,attrs=AttrList]
2404    |   _Transformed = 1,
2405        Obj = xpm(_Color,_TransColor,_X1,_Y1,_X2,_Y2,_UnUsedObjFill,_NumColors,
2406            _CharsPerPixel,_FirstPixelIsBg,_Id,_Rotation,
2407            _ImageW,_ImageH,_Rotate,_Flip,_Locked,_Compressed,
2408            _Transformed,_Invisible,TransformSpec,ColorNames,
2409            Pixels,AttrList),
2410        tgif_chk_output(OutputObj,Obj),
2411        tgif_obj_transform_spec(TransformSpec,TransformParms),
2412        Parms = [color=_Color,trans_color=_TransColor,
2413            ltx=_X1,lty=_Y1,rbx=_X2,rby=_Y2,obj_fill=_UnUsedObjFill,
2414            num_colors=_NumColors,chars_per_pixel=_CharsPerPixel,
2415            first_pixel_is_bg=_FirstPixelIsBg,id=_Id,
2416            rotation=_Rotation,image_w=_ImageW,image_h=_ImageH,
2417            rotate=_Rotate,flip=_Flip,obj_locked=_Locked,
2418            compressed=_Compressed,transformed=_Transformed,
2419            invisible=_Invisible,transform_spec=TransformParms,
2420            color_names=ColorNames,pixels=Pixels,attrs=AttrList]
2421    ),
2422    tgif_color_info(ColorNames),
2423    tgif_pixels(Pixels),
2424    tgif_attrs(AttrList).
2425
2426% --------------------------------------------------------------------- %
2427
2428tgif_group(Obj) :- tgif_group(Obj,_).
2429
2430tgif_group(Obj,Parms) :-
2431    current_predicate(tgif_file_version,tgif_file_version(_)),
2432    tgif_file_version(FileVersion),
2433    FileVersion =< 20, !,
2434    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2435    Obj = group(ObjList,AttrList),
2436    tgif_chk_output(OutputObj,Obj),
2437    Parms = [objs=ObjList,attrs=AttrList],
2438    tgif_objs(ObjList),
2439    tgif_attrs(AttrList).
2440tgif_group(Obj,Parms) :-
2441    current_predicate(tgif_file_version,tgif_file_version(_)),
2442    tgif_file_version(FileVersion),
2443    FileVersion =< 25, !,
2444    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2445    Obj = group(ObjList,_Id,AttrList),
2446    tgif_chk_output(OutputObj,Obj),
2447    Parms = [objs=ObjList,id=_Id,attrs=AttrList],
2448    tgif_objs(ObjList),
2449    tgif_attrs(AttrList).
2450tgif_group(Obj,Parms) :-
2451    current_predicate(tgif_file_version,tgif_file_version(_)),
2452    tgif_file_version(FileVersion),
2453    FileVersion =< 32, !,
2454    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2455    Obj = group(ObjList,_Id,_Locked,AttrList),
2456    tgif_chk_output(OutputObj,Obj),
2457    Parms = [objs=ObjList,id=_Id,obj_locked=_Locked,attrs=AttrList],
2458    tgif_objs(ObjList),
2459    tgif_attrs(AttrList).
2460tgif_group(Obj,Parms) :-
2461    current_predicate(tgif_file_version,tgif_file_version(_)),
2462    tgif_file_version(FileVersion),
2463    FileVersion >= 33, !,
2464    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2465    Obj = group(ObjList,_Id,_Locked,_Invisible,AttrList),
2466    tgif_chk_output(OutputObj,Obj),
2467    Parms = [objs=ObjList,id=_Id,obj_locked=_Locked,invisible=_Invisible,
2468        attrs=AttrList],
2469    tgif_objs(ObjList),
2470    tgif_attrs(AttrList).
2471
2472% --------------------------------------------------------------------- %
2473
2474tgif_sym(Obj) :- tgif_sym(Obj,_).
2475
2476tgif_sym(Obj,Parms) :-
2477    current_predicate(tgif_file_version,tgif_file_version(_)),
2478    tgif_file_version(FileVersion),
2479    FileVersion =< 20, !,
2480    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2481    Obj = sym(ObjList,AttrList),
2482    tgif_chk_output(OutputObj,Obj),
2483    Parms = [objs=ObjList,attrs=AttrList],
2484    tgif_objs(ObjList),
2485    tgif_attrs(AttrList).
2486tgif_sym(Obj,Parms) :-
2487    current_predicate(tgif_file_version,tgif_file_version(_)),
2488    tgif_file_version(FileVersion),
2489    FileVersion =< 25, !,
2490    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2491    Obj = sym(ObjList,_Id,AttrList),
2492    tgif_chk_output(OutputObj,Obj),
2493    Parms = [objs=ObjList,id=_Id,attrs=AttrList],
2494    tgif_objs(ObjList),
2495    tgif_attrs(AttrList).
2496tgif_sym(Obj,Parms) :-
2497    current_predicate(tgif_file_version,tgif_file_version(_)),
2498    tgif_file_version(FileVersion),
2499    FileVersion =< 32, !,
2500    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2501    Obj = sym(ObjList,_Id,_Locked,AttrList),
2502    tgif_chk_output(OutputObj,Obj),
2503    Parms = [objs=ObjList,id=_Id,obj_locked=_Locked,attrs=AttrList],
2504    tgif_objs(ObjList),
2505    tgif_attrs(AttrList).
2506tgif_sym(Obj,Parms) :-
2507    current_predicate(tgif_file_version,tgif_file_version(_)),
2508    tgif_file_version(FileVersion),
2509    FileVersion >= 33, !,
2510    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2511    Obj = sym(ObjList,_Id,_Locked,_Invisible,_AttrList),
2512    tgif_chk_output(OutputObj,Obj),
2513    Parms = [objs=ObjList,id=_Id,obj_locked=_Locked,invisible=_Invisible,
2514        attrs=AttrList],
2515    tgif_objs(ObjList),
2516    tgif_attrs(AttrList).
2517
2518% --------------------------------------------------------------------- %
2519
2520tgif_icon(Obj) :- tgif_icon(Obj,_).
2521
2522tgif_icon(Obj,Parms) :-
2523    current_predicate(tgif_file_version,tgif_file_version(_)),
2524    tgif_file_version(FileVersion),
2525    FileVersion =< 12, !,
2526    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2527    Obj = icon(ObjList,_Name,_Id,AttrList),
2528    tgif_chk_output(OutputObj,Obj),
2529    Parms = [name=_Name,id=_Id,objs=ObjList,attrs=AttrList],
2530    tgif_objs(ObjList),
2531    tgif_attrs(AttrList).
2532tgif_icon(Obj,Parms) :-
2533    current_predicate(tgif_file_version,tgif_file_version(_)),
2534    tgif_file_version(FileVersion),
2535    FileVersion =< 25, !,
2536    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2537    Obj = icon(ObjList,_Name,_Id,_Rotation,_Flip,AttrList),
2538    tgif_chk_output(OutputObj,Obj),
2539    Parms = [name=_Name,id=_Id,rotation=_Rotation,objs=ObjList,
2540        attrs=AttrList],
2541    tgif_objs(ObjList),
2542    tgif_attrs(AttrList).
2543tgif_icon(Obj,Parms) :-
2544    current_predicate(tgif_file_version,tgif_file_version(_)),
2545    tgif_file_version(FileVersion),
2546    FileVersion =< 32, !,
2547    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2548    Obj = icon(ObjList,_Name,_Id,_Rotation,_Flip,_Locked,AttrList),
2549    tgif_chk_output(OutputObj,Obj),
2550    Parms = [name=_Name,id=_Id,rotation=_Rotation,obj_locked=_Locked,
2551        objs=ObjList,attrs=AttrList],
2552    tgif_objs(ObjList),
2553    tgif_attrs(AttrList).
2554tgif_icon(Obj,Parms) :-
2555    current_predicate(tgif_file_version,tgif_file_version(_)),
2556    tgif_file_version(FileVersion),
2557    FileVersion >= 33, !,
2558    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2559    Obj = icon(ObjList,_Name,_Id,_Rotation,_Flip,_Locked,_Invisible,
2560        AttrList),
2561    tgif_chk_output(OutputObj,Obj),
2562    Parms = [name=_Name,id=_Id,rotation=_Rotation,obj_locked=_Locked,
2563        invisible=_Invisible,objs=ObjList,attrs=AttrList],
2564    tgif_objs(ObjList),
2565    tgif_attrs(AttrList).
2566
2567% ======================== support routines =========================== %
2568
2569tgif_clean :- tgif_clean(state).
2570
2571tgif_real_clean :-
2572    tgif_clean(state),
2573    tgif_clean(text), tgif_clean(box), tgif_clean(oval), tgif_clean(poly),
2574    tgif_clean(polygon), tgif_clean(rcbox), tgif_clean(arc),
2575    tgif_clean(xbm), tgif_clean(xpm),
2576    tgif_clean(group), tgif_clean(sym), tgif_clean(icon).
2577
2578tgif_clean(Type) :-
2579    current_predicate(Type,Term), functor(Term,_F,A), abolish(Type,A), fail.
2580tgif_clean(_Type) :- !.
2581
2582tgif_chk_output(true,Obj) :- !,
2583    functor(Obj,Functor,Arity), functor(DummyObj,Functor,Arity),
2584    current_predicate(Functor,DummyObj),
2585    !, call(Obj).
2586tgif_chk_output(_OutputObj,_Obj).
2587
2588% --------------------------------------------------------------------- %
2589
2590tgif_strs([]) :- !.
2591tgif_strs([Str|Strs]) :- atom_chars(_Line,Str), !, tgif_strs(Strs).
2592
2593% --------------------------------------------------------------------- %
2594
2595tgif_strseg(Obj) :- tgif_strseg(Obj,_).
2596
2597tgif_strseg(Obj,Parms) :-
2598    current_predicate(tgif_file_version,tgif_file_version(_)),
2599    tgif_file_version(FileVersion),
2600    FileVersion >= 37, !,
2601    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2602    Obj = str_seg(_Color,_FontName,_TextStyle,_FontSzUnit,
2603        _W,_Asc,_Des,_MinLBearing,_MaxRExtra,_UnderlineOn,
2604        _DoubleByte,_DBModBytes,_DBVertical,_Direction,Str),
2605    tgif_chk_output(OutputObj,Obj),
2606    Parms = [color=_Color,font_name=_FontName,text_style=_TextStyle,
2607        font_sz_unit=_FontSzUnit,w=_W,asc=_Asc,des=_Des,
2608        min_lbearing=_MinLBearing,max_rextra=_MaxRExtra,
2609        underline_on=_UnderlineOn,double_byte=_DoubleByte,
2610        db_mod_bytes=_DBModBytes,db_vertical=_DBVertical,direction=_Direction,
2611        str=Str],
2612    atom_chars(_Str,Str).
2613
2614% --------------------------------------------------------------------- %
2615
2616tgif_strblock_list([SimpleStrBlock]) :-
2617    !, tgif_simple_strblock(SimpleStrBlock).
2618tgif_strblock_list([SimpleStrBlock1,SimpleStrBlock2|StrBlocks]) :-
2619    tgif_simple_strblock(SimpleStrBlock1),
2620    tgif_simple_strblock(SimpleStrBlock2),
2621    !, tgif_strblock_list([SimpleStrBlock2|StrBlocks]).
2622tgif_strblock_list([SimpleStrBlock,ComplexStrBlock|StrBlocks]) :-
2623    tgif_simple_strblock(SimpleStrBlock),
2624    tgif_complex_strblock(ComplexStrBlock),
2625    !, tgif_strblock_list(StrBlocks).
2626
2627tgif_simple_strblock(StrBlock) :- tgif_simple_strblock(StrBlock,_).
2628
2629tgif_simple_strblock(Obj,Parms) :-
2630    current_predicate(tgif_file_version,tgif_file_version(_)),
2631    tgif_file_version(FileVersion),
2632    FileVersion >= 37,
2633    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2634    Obj = str_block(0,_W,_Asc,_Des,_MinLBearing,_MaxRExtra,_,_,_,
2635        [_StrSeg]),
2636    tgif_chk_output(OutputObj,Obj),
2637    Parms = [w=_W,asc=_Asc,des=_Des,min_lbearing=_MinLBearing,
2638        max_rextra=_MaxRExtra,str_seg=_StrSeg],
2639    tgif_strseg(_StrSeg).
2640
2641tgif_complex_strblock(StrBlock) :- tgif_complex_strblock(StrBlock,_).
2642
2643tgif_complex_strblock(StrBlock,Parms) :-
2644    tgif_space_strblock(StrBlock,Parms), !.
2645tgif_complex_strblock(StrBlock,Parms) :-
2646    tgif_center_supsub_strblock(StrBlock,Parms), !.
2647tgif_complex_strblock(StrBlock,Parms) :-
2648    tgif_leftright_supsub_strblock(StrBlock,Parms), !.
2649
2650tgif_space_strblock(Obj,Parms) :-
2651    current_predicate(tgif_file_version,tgif_file_version(_)),
2652    tgif_file_version(FileVersion),
2653    FileVersion >= 37,
2654    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2655    Obj = str_block(4,_W,_,_,_,_,_SpaceW,0,0),
2656    !, tgif_chk_output(OutputObj,Obj),
2657    Parms = [type=4,w=_W,space_w=_SpaceW].
2658
2659tgif_center_supsub_strblock(Obj,Parms) :-
2660    current_predicate(tgif_file_version,tgif_file_version(_)),
2661    tgif_file_version(FileVersion),
2662    FileVersion >= 37,
2663    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2664    Obj = str_block(2,_W,_Asc,_Des,_MinLBearing,_MaxRExtra,_,1,1,
2665        [_SupMinilines,_SubMinilines,_StrSeg]),
2666    !, tgif_chk_output(OutputObj,Obj),
2667    Parms = [type=2,w=_W,asc=_Asc,des=_Des,min_lbearing=_MinLBearing,
2668        max_rextra=_MaxRExtra,sup_minilines=_SupMinilines,
2669        _sub_minilines=_SubMinilines,str_seg=_StrSeg],
2670    !, tgif_minilines(_SupMinilines),
2671    !, tgif_minilines(_SubMinilines),
2672    !, tgif_strseg(_StrSeg).
2673
2674tgif_leftright_supsub_strblock(Obj,Parms) :-
2675    current_predicate(tgif_file_version,tgif_file_version(_)),
2676    tgif_file_version(FileVersion),
2677    FileVersion >= 37,
2678    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2679    Obj = str_block(_Type,_W,_Asc,_Des,_MinLBearing,_MaxRExtra,_,1,1,
2680        [_SupMinilines,_SubMinilines]),
2681    (   _Type == 1 | _Type == 3 ),
2682    !, tgif_chk_output(OutputObj,Obj),
2683    Parms = [type=_Type,w=_W,asc=_Asc,des=_Des,min_lbearing=_MinLBearing,
2684        max_rextra=_MaxRExtra,sup_minilines=_SupMinilines,
2685        _sub_minilines=_SubMinilines],
2686    !, tgif_minilines(_SupMinilines),
2687    !, tgif_minilines(_SubMinilines).
2688
2689% --------------------------------------------------------------------- %
2690
2691tgif_miniline_list([]) :- !.
2692tgif_miniline_list([Miniline|MinilineList]) :-
2693    tgif_miniline(Miniline), !, tgif_miniline_list(MinilineList).
2694
2695tgif_miniline(Obj) :- tgif_miniline(Obj,_).
2696
2697tgif_miniline(Obj,Parms) :-
2698    current_predicate(tgif_file_version,tgif_file_version(_)),
2699    tgif_file_version(FileVersion),
2700    FileVersion >= 37, !,
2701    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2702    Obj = mini_line(_W,_Asc,_Des,_MinLBearing,_MaxRExtra,_VGap,_StrBlockList),
2703    tgif_chk_output(OutputObj,Obj),
2704    Parms = [w=_W,asc=_Asc,des=_Des,min_lbearing=_MinLBearing,
2705        max_rextra=_MaxRExtra,v_gap=_VGap,
2706        miniline_list=_StrBlockList],
2707    tgif_strblock_list(_StrBlockList).
2708
2709% --------------------------------------------------------------------- %
2710
2711tgif_minilines_list([]) :- !.
2712tgif_minilines_list([Minilines|MinilinesList]) :-
2713    tgif_minilines(Minilines), !, tgif_minilines_list(MinilinesList).
2714
2715tgif_minilines(Obj) :- tgif_minilines(Obj,_).
2716
2717tgif_minilines(Obj,Parms) :-
2718    current_predicate(tgif_file_version,tgif_file_version(_)),
2719    tgif_file_version(FileVersion),
2720    FileVersion >= 37, !,
2721    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2722    Obj = minilines(_W,_H,_MinLBearing,_MaxRExtra,_Just,_VSpace,
2723        _BaselineOffset,_MiniLineList),
2724    tgif_chk_output(OutputObj,Obj),
2725    Parms = [w=_W,h=_H,min_lbearing=_MinLBearing,max_rextra=_MaxRExtra,
2726        just=_Just,v_space=_VSpace,baseline_offset=_BaselineOffset,
2727        miniline_list=_MiniLineList],
2728    tgif_miniline_list(_MiniLineList).
2729
2730% --------------------------------------------------------------------- %
2731
2732tgif_obj(Obj) :- var(Obj), !, tgif_obj(_,Obj).
2733tgif_obj(Obj) :- functor(Obj,Functor,_Arity), tgif_obj(Functor,Obj).
2734
2735tgif_obj(text,Obj) :- tgif_text(Obj).
2736tgif_obj(box,Obj) :- tgif_box(Obj).
2737tgif_obj(oval,Obj) :- tgif_oval(Obj).
2738tgif_obj(poly,Obj) :- tgif_poly(Obj).
2739tgif_obj(polygon,Obj) :- tgif_polygon(Obj).
2740tgif_obj(rcbox,Obj) :- tgif_rcbox(Obj).
2741tgif_obj(arc,Obj) :- tgif_arc(Obj).
2742tgif_obj(xbm,Obj) :- tgif_xbm(Obj).
2743tgif_obj(xpm,Obj) :- tgif_xpm(Obj).
2744tgif_obj(group,Obj) :- tgif_group(Obj).
2745tgif_obj(sym,Obj) :- tgif_sym(Obj).
2746tgif_obj(icon,Obj) :- tgif_icon(Obj).
2747
2748tgif_objs([]) :- !.
2749tgif_objs([Obj|Objs]) :- tgif_obj(Obj), !, tgif_objs(Objs).
2750
2751% --------------------------------------------------------------------- %
2752
2753tgif_attrs([]) :- !.
2754tgif_attrs([Attr|Attrs]) :- tgif_attr(Attr), !, tgif_attrs(Attrs).
2755
2756tgif_attr(Attr) :- tgif_attr(Attr,_).
2757
2758tgif_attr(Attr,Parms) :-
2759    Attr = attr(_Name,_Value,_ShowAll,_NameShown,_Inherited,TextObj),
2760    tgif_text(TextObj),
2761    Parms = [name=_Name,value=_Value,show_all=_ShowAll,
2762        name_shown=_NameShown,inherited=_Inherited,text_obj=TextObj],
2763    tgif_text(TextObj).
2764
2765% --------------------------------------------------------------------- %
2766
2767tgif_arrow(Obj) :- tgif_arrow(Obj,_).
2768
2769tgif_arrow(Obj,Parms) :-
2770    current_predicate(tgif_file_version,tgif_file_version(_)),
2771    tgif_file_version(FileVersion),
2772    FileVersion >= 37, !,
2773    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2774    Obj = [_ArrowHeadStyle,_ArrowHeadW,_ArrowHeadH,_ArrowHeadIndent,
2775        _ArrowHeadWSpec,_ArrowHeadHSpec,_ArrowHeadIndentSpec],
2776    tgif_chk_output(OutputObj,Obj),
2777    Parms = [arrow_head_style=_ArrowHeadStyle,
2778            arrow_head_w=_ArrowHeadW,arrow_head_h=_ArrowHeadH,
2779            arrow_head_indent=_ArrowHeadIndent,
2780            arrow_head_w_spec=_ArrowHeadWSpec,
2781            arrow_head_h_spec=_ArrowHeadHSpec,
2782            arrow_head_indent_spec=_ArrowHeadIndentSpec].
2783
2784% --------------------------------------------------------------------- %
2785
2786tgif_color_info([]) :- !.
2787tgif_color_info([ColorChar,ColorName,_Red,_Green,_Blue|ColorInfos]) :-
2788    atom_chars(_Char,ColorChar),
2789    atom_chars(_Color,ColorName),
2790    !, tgif_color_info(ColorInfos).
2791
2792% --------------------------------------------------------------------- %
2793
2794tgif_pixels([]) :- !.
2795tgif_pixels([_RowOfChar|Pixels]) :- !, tgif_pixels(Pixels).
2796
2797% --------------------------------------------------------------------- %
2798
2799tgif_obj_transform_spec(Spec,Parms) :-
2800    current_predicate(tgif_file_version,tgif_file_version(_)),
2801    tgif_file_version(FileVersion),
2802    FileVersion >= 33, !,
2803    Spec = [_OrigX,_OrigY,_OrigLtX,_OrigLtY,_OrigRbX,_OrigRbY,
2804        _CTM_SX,_CTM_SIN,_CTM_MSIN,_CTM_SY,_CTM_TX,_CTM_TY],
2805    Parms = [orig_x=_OrigX,orig_x=_OrigY,orig_ltx=_OrigLtX,
2806        orig_lty=_OrigLtY,orig_rbx=_OrigRbX,orig_rby=_OrigRbY,
2807        ctm_sx=_CTM_SX,ctm_sin=_CTM_SIN,ctm_msin=_CTM_MSIN,
2808        ctm_sy=_CTM_SY,ctm_tx=_CTM_TX,ctm_ty=_CTM_TY].
2809
2810tgif_text_transform_spec(Spec,Parms) :-
2811    current_predicate(tgif_file_version,tgif_file_version(_)),
2812    tgif_file_version(FileVersion),
2813    FileVersion >= 33, !,
2814    Spec = [_OrigX,_OrigY,
2815        _OrigOBBoxLtX,_OrigOBBoxLtY,_OrigOBBoxRbX,_OrigOBBoxRbY,
2816        _CTM_SX,_CTM_SIN,_CTM_MSIN,_CTM_SY,_CTM_TX,_CTM_TY,
2817        _OrigBBoxLtX,_OrigBBoxLtY,_OrigBBoxRbX,_OrigBBoxRbY],
2818    Parms = [orig_x=_OrigX,orig_x=_OrigY,orig_obbox_ltx=_OrigOBBoxLtX,
2819        orig_obbox_lty=_OrigOBBoxLtY,orig_obbox_rbx=_OrigOBBoxRbX,
2820        orig_obbox_rby=_OrigOBBoxRbY,
2821        ctm_sx=_CTM_SX,ctm_sin=_CTM_SIN,ctm_msin=_CTM_MSIN,
2822        ctm_sy=_CTM_SY,ctm_tx=_CTM_TX,ctm_ty=_CTM_TY,
2823        orig_bbox_ltx=_OrigBBoxLtX,orig_bbox_lty=_OrigBBoxLtY,
2824        orig_bbox_rbx=_OrigBBoxRbX,orig_bbox_rby=_OrigBBoxRbY].
2825
2826% ======================= non=graphical objects ======================= %
2827
2828% --------------------------------------------------------------------- %
2829
2830tgif_page(Obj) :- tgif_page(Obj,_).
2831
2832tgif_page(Obj,Parms) :-
2833    current_predicate(tgif_file_version,tgif_file_version(_)),
2834    tgif_file_version(FileVersion),
2835    FileVersion =< 32, !,
2836    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2837    Obj = page(_PageNum,_PageName),
2838    tgif_chk_output(OutputObj,Obj),
2839    Parms = [page_num=_PageNum,page_name=_PageName].
2840tgif_page(Obj,Parms) :-
2841    current_predicate(tgif_file_version,tgif_file_version(_)),
2842    tgif_file_version(FileVersion),
2843    FileVersion >= 33, !,
2844    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2845    (   Obj = page(_PageNum,_PageName,_)
2846    |   Obj = page(_PageNum,_PageName,_,_)
2847    ),
2848    tgif_chk_output(OutputObj,Obj),
2849    Parms = [page_num=_PageNum,page_name=_PageName].
2850
2851% --------------------------------------------------------------------- %
2852
2853tgif_unit(Obj) :- tgif_unit(Obj,_).
2854
2855tgif_unit(Obj,Parms) :-
2856    current_predicate(tgif_file_version,tgif_file_version(_)),
2857    tgif_file_version(FileVersion),
2858    FileVersion >= 33, !,
2859    ( var(Obj) -> OutputObj = true ; OutputObj = false ),
2860    Obj = unit(_UnitSpec),
2861    tgif_chk_output(OutputObj,Obj),
2862    Parms = [unit_spec=_UnitSpec].
2863