-+-+-+-+-+-+-+-+ START OF PART 245 -+-+-+-+-+-+-+-+ X `7D X else X phigserror(PTKEINFORM, err); X `7D X`7D /* do_pinqwsclass */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void do_pinqwsconntype() X`7B X Pint wsid, err, totsize; X Pchar *buffer; X Pconnid connid; X X wsid = readinteger("workstation identifier ? "); X pinqwsconntype(wsid, 0, &err, buffer, &connid, &totsize, &wst); X buffer = (Pchar *)malloc(totsize); X pinqwsconntype(wsid, totsize, &err, buffer, &connid, &totsize, &wst); X if (writeinform) X `7B X phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist`5Bactivefunction`5D V); X if (err == 0) X `7B X phinprintf(PTKEINFORM, "connection identifier = %s\n",`20 X (Pchar *)connid); X phinprintf(PTKEINFORM, "size of wstype buffer = "); X writeinteger(PTKEINFORM, totsize); X `7D X else X phigserror(PTKEINFORM, err); X `7D X free(buffer); X`7D /* do_pinqwsconntype */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void do_pinqwsst() X`7B X Pwsstate state; X X pinqwsst(&state); X if (writeinform) X `7B X phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist`5Bactivefunction`5D V); X phinprintf(PTKEINFORM, "workstation state = "); X writephigsenum(PTKEINFORM, PTKEWSSTATE, state); X `7D X`7D /* do_pinqwsst */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void do_pinqwssttable() X`7B X Pwstype wstype; X Pint err; X Pwstables lengths; X X readwstype(&wstype); X pinqwssttable(wstype, &err, &lengths); X if (writeinform) X `7B X phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist`5Bactivefunction`5D V); X if (err == 0) X `7B X phinprintf(PTKEINFORM, "lengths of workstation state tables:\n"); X phinprintf(PTKEINFORM, "line = "); X writeinteger(PTKEINFORM, lengths.line); X phinprintf(PTKEINFORM, "marker = "); X writeinteger(PTKEINFORM, lengths.mark); X phinprintf(PTKEINFORM, "text = "); X writeinteger(PTKEINFORM, lengths.text); X phinprintf(PTKEINFORM, "interior = "); X writeinteger(PTKEINFORM, lengths.interior); X phinprintf(PTKEINFORM, "edge = "); X writeinteger(PTKEINFORM, lengths.edge); X phinprintf(PTKEINFORM, "pattern = "); X writeinteger(PTKEINFORM, lengths.pat); X phinprintf(PTKEINFORM, "colour = "); X writeinteger(PTKEINFORM, lengths.colour); X phinprintf(PTKEINFORM, "view = "); X writeinteger(PTKEINFORM, lengths.view); X `7D X else X phigserror(PTKEINFORM, err); X `7D X`7D /* do_pinqwssttable */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void do_pinqwstran() X`7B X Pint wsid, err; X Pwstran wsxform; X X wsid = readinteger("workstation identifier ? "); X pinqwstran(wsid, &err, &wsxform); X if (writeinform) X `7B X phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist`5Bactivefunction`5D V); X if (err == 0) X `7B X phinprintf(PTKEINFORM, "workstation transformation:\n"); X phinprintf(PTKEINFORM, "update state = "); X writephigsenum(PTKEINFORM, PTKEUPDATEST, wsxform.state); X phinprintf(PTKEINFORM, "requested workstation window:\n"); X writelimit(PTKEINFORM, &wsxform.req_window); X phinprintf(PTKEINFORM, "current workstation window:\n"); X writelimit(PTKEINFORM, &wsxform.cur_window); X phinprintf(PTKEINFORM, "requested workstation viewport:\n"); X writelimit(PTKEINFORM, &wsxform.req_viewport); X phinprintf(PTKEINFORM, "current workstation viewport:\n"); X writelimit(PTKEINFORM, &wsxform.cur_viewport); X `7D X else X phigserror(PTKEINFORM, err); X `7D X`7D /* do_pinqwstran */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void do_pinqwstran3() X`7B X Pint wsid, err; X Pwstran3 wsxform; X X wsid = readinteger("workstation identifier ? "); X pinqwstran3(wsid, &err, &wsxform); X if (writeinform) X `7B X phinprintf(PTKEINFORM, "--- %s ---\n", phigsnamelist`5Bactivefunction`5D V); X if (err == 0) X `7B X phinprintf(PTKEINFORM, "workstation transformation:\n"); X phinprintf(PTKEINFORM, "update state = "); X writephigsenum(PTKEINFORM, PTKEUPDATEST, wsxform.state); X phinprintf(PTKEINFORM, "requested workstation window:\n"); X writelimit3(PTKEINFORM, &wsxform.req_window); X phinprintf(PTKEINFORM, "current workstation window:\n"); X writelimit3(PTKEINFORM, &wsxform.cur_window); X phinprintf(PTKEINFORM, "requested workstation viewport:\n"); X writelimit3(PTKEINFORM, &wsxform.req_viewport); X phinprintf(PTKEINFORM, "current workstation viewport:\n"); X writelimit3(PTKEINFORM, &wsxform.cur_viewport); X `7D X else X phigserror(PTKEINFORM, err); X `7D X`7D /* do_pinqwstran3 */ X X/*-------------------------------------------------------------------------- V*/ X X/* end of pinqfns.c */ $ CALL UNPACK [.SOURCE.LIBRARY]PINQFNS.C;1 1912846567 $ create 'f' X/*-------------------------------------------------------------------------- V-- X X Module name: phigslib. X X Author: Toby Howard. X X Function: This module contains a collection of X useful routines, built on top of KRT3. X See document KRT3/57 for detailed specs. X X Dependencies: machine.h. X X Internal function list: ptk_setstringprompt, inelemlist, testpoint, `20 X ptk_redistributepriorities, ptk_findpriority, traversestruct, box X X External function list: ptk_readint, ptk_readfloat,`20 X ptk_readstring, ptk_stackstruct, ptk_unstackstruct, X ptk_openstruct, ptk_closestruct,`20 X ptk_getpickid, ptk_elemcount, ptk_structexists,`20 X ptk_getelemtype, ptk_getelemtypename, ptk_copyelem,`20 X ptk_getprimname, ptk_removestruct, ptk_findelemtype,`20 X ptk_countchildren, ptk_structsummary,`20 X ptk_setattrasf, ptk_setallattrasf, ptk_setedgebundlerec, X ptk_setinteriorbundlerec, ptk_setpolylinebundlerec, X ptk_setpolymarkerbundlerec, ptk_settextbundlerec, X ptk_setstandardviewport, ptk_poststruct, ptk_postrelative,`20 X ptk_changepostpriority, ptk_readrgb, X ptk_setrgbcolourtable, ptk_readsetrgbcolourtable,`20 X ptk_drawcolourtable, ptk_inqmaxdevicecoords, ptk_inqmaxdevicecoords3,`20 X ptk_inqstructviewind, ptk_inqstructlineind, ptk_inqstructmarkerind, X ptk_inqstructtextind, ptk_inqstructintind, ptk_inqstructedgeind, X ptk_arrow, ptk_grid, ptk_error X X Hashtables used: "structureid". X X Modification history: (Version), (Date), (name), (Description). X X 1.0, ?????, T. Howard, First version. X X 1.1, 15th July 1988, S. Larkin, Modified to work with VAX PHIGS. X X 1.2, 24th August 1988, S. Larkin, Procedure ptk_drawcolourtable added. X X 2.0, 8th January 1991, G. Williams, Converted from Pascal to C. removed X obsolete functions. X X 2.1, 15th February 1991, G. Williams, Function ptk_findelemtype added. X X 2.2, 2nd May 1991, G. Williams, Bundled attribute functions added: X ptk_setattrasf, ptk_setallattrasf, ptk_setedgebundlerec, X ptk_setinteriorbundlerec, ptk_setpolylinebundlerec, X ptk_setpolymarkerbundlerec, ptk_settextbundlerec. X X---------------------------------------------------------------------------- V*/ X X#include X#include X#include X#include X#include "ptk.h" X X#ifdef SUN X#define NUMPHIGSELEMS 70 X#endif X#ifdef VMS X#define NUMPHIGSELEMS 71 X#endif X Xtypedef struct ptksstructstack`20 X`7B X Pint structid; X Pint elemptr; X struct ptksstructstack *next; X`7D ptksstructstack; X Xtypedef struct ptkseditmodestack`20 X`7B X Peditmode editmode; X struct ptkseditmodestack *next; X`7D ptkseditmodestack; X Xstatic ptksstructstack *structstack = NULL; Xstatic ptkseditmodestack *editmodestack = NULL; X Xstatic Pchar *elemlist`5B`5D =`20 X`7B X"nil", X"polyline3", X"polyline", X"polymarker3", X"polymarker", X"text3", X"text", X#ifdef VMS X"annotation_text_fixed3", X"annotation_text_fixed", X#endif X"annotation_text_relative3", X"annotation_text_relative", X"fill_area3", X"fill_area", X"fill_area_set3", X"fill_area_set", X"cell_array3", X"cell_array", X"generalized_drawing_primitive3", X"generalized_drawing_primitive", X"set_polyline_index", X"set_polymarker_index", X"set_text_index", X"set_interior_index", X"set_edge_index", X"set_linetype", X"set_linewidth_scale_factor", X"set_polyline_colour_index", X"set_marker_type", X"set_marker_size_scale_factor", X"set_polymarker_colour_index", X"set_text_font", X"set_text_precision", X"set_character_expansion_factor", X"set_character_spacing", X"set_text_colour_index", X"set_character_height", X"set_character_up_vector", X"set_text_path", X"set_text_alignment", X"set_annotation_text_character_height", X"set_annotation_text_character_up_vector", X"set_annotation_text_path", X"set_annotation_text_alignment", X"set_annotation_style", X"set_interior_style", X"set_interior_style_index", X"set_interior_colour_index", X"set_edge_flag", X"set_edgetype", X"set_edgewidth_scale_factor", X"set_edge_colour_index", X"set_pattern_size", X"set_pattern_reference_point_and_vectors", X"set_pattern_reference_point", X"add_names_to_set", X"remove_names_from_set", X"set_individual_asf", X"set_hlhsr_identifier", X"set_local_transformation3", X"set_local_transformation", X"set_global_transformation3", X"set_global_transformation", X#ifdef SUN X"set_modelling_clipping_volume3", X#endif X"set_modelling_clipping_volume", X"set_modelling_clipping_indicator", X"restore_modelling_clipping_volume", X"set_view_index", X"execute_structure", X"label", X"application_data", X"generalized_structure_element", X"set_pick_identifier", X`7D; X Xstatic Pchar *attrlist`5B`5D = X`7B X"polyline", X"polymarker", X"text", X"interior", X"edge" X`7D; X X/*-------------------------------------------------------------------------- V*/ X/*---------------------- Input Functions ----------------------------------- V*/ X Xstatic void ptk_setstringprompt(C(Pint) ws, C(Pchar *) prompt,`20 X C(Plimit *) echoarea) XPreANSI(Pint ws) XPreANSI(Pchar *prompt) XPreANSI(Plimit *echoarea) X/* X** \parambegin X** \param`7B`7D`7Bws`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7B`7D`7Bsize`7D`7Bsize of the device buffer`7D`7BIN`7D X** \param`7B`7D`7Bprompt`7D`7Bprompt string`7D`7BIN`7D X** \paramend X** \blurb`7BInitialises the string device to use prompt 'prompt'.`7D X*/ X`7B X Pstringrec stringrec; X X stringrec.stringpet1_datarec.bufsiz = 80; X stringrec.stringpet1_datarec.position = strlen(prompt) + 1; X#ifdef VMS X stringrec.stringpet1_datarec.title_string = (Pchar *)0; X stringrec.stringpet1_datarec.title_length = 0; X#endif X /* set the echo area to be sensible percentage of device space */ X pinitstring(ws, 1, prompt, 1, echoarea, &stringrec); X psetstringmode(ws, 1, PREQUEST, PES_ECHO); X`7D /* ptk_setstringprompt */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern Pint ptk_readint(C(Pint) ws, C(Pint) defint, C(Pchar *) prompt, X C(Plimit *) echoarea) XPreANSI(Pint ws) XPreANSI(Pint defint) XPreANSI(Pchar *prompt) XPreANSI(Plimit *echoarea) X/* X** \parambegin X** \param`7BPint`7D`7Bws`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bdefint`7D`7Bdefault integer`7D`7BIN`7D X** \param`7BPchar *`7D`7Bprompt`7D`7Bprompt string`7D`7BIN`7D X** \param`7BPlimit *`7D`7Bechoarea`7D`7Bstring echo area`7D`7BIN`7D X** \paramend X** \blurb`7BThis function reads and returns an integer from`20 X** string device 1 on workstation \pardesc`7Bws`7D, X** using \pardesc`7Bprompt`7D as a prompt string. X** If the user types a carriage-return instead of supplying an X** integer, the function returns the specified default value \pardesc`7Bdefi Vnt`7D. X** \pardesc`7Bechoarea`7D specifies the echo area to use for the string devi Vce.`7D X*/ X`7B X Pqstring str; X Pint val; X Pint size; X Pint pos; X X ptk_setstringprompt(ws, prompt, echoarea); X pos = strlen(prompt); X str.string = NULL; X size = 80; X str.string = (Pchar *)malloc(size); `20 X preqstring(ws, 1, &str); X if (str.status == PSTAT_OK) X `7B X if (str.string`5Bpos`5D == '\0') X val = defint; X else X val = atoi(&str.string`5Bpos`5D); X free(str.string); X return val; X `7D X else X `7B X free(str.string); X return defint;`20 X `7D X`7D /* ptk_readint */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern Pfloat ptk_readfloat(C(Pint) ws, C(Pfloat) defreal, X C(Pchar *) prompt, C(Plimit *) echoarea) XPreANSI(Pint ws) XPreANSI(Pfloat defreal) XPreANSI(Pchar *prompt) XPreANSI(Plimit *echoarea) X/* X** \parambegin X** \param`7BPint`7D`7Bws`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPfloat`7D`7Bdefreal`7D`7Bdefault floating point number`7D`7BIN`7 VD X** \param`7BPchar *`7D`7Bprompt`7D`7Bprompt string`7D`7BIN`7D X** \param`7BPlimit *`7D`7Bechoarea`7D`7Bstring echo area`7D`7BIN`7D X** \paramend X** \blurb`7BThis function reads and returns a real number from`20 X** string device 1 on workstation \pardesc`7Bws`7D, X** using \pardesc`7Bprompt`7D as a prompt string. X** If the user types a carriage-return instead of supplying an X** real value, the function returns the specified default value \pardesc`7Bd Vefreal`7D. X** \pardesc`7Bechoarea`7D specifies the echo area to use for the string devi Vce.`7D X*/ X`7B X Pqstring str; X Pfloat val; X Pint size; X Pint pos; X X ptk_setstringprompt(ws, prompt, echoarea); X pos = strlen(prompt); X str.string = NULL; X size = 80; X str.string = (Pchar *)malloc(size); `20 X preqstring(ws, 1, &str); X if (str.status == PSTAT_OK) X `7B X if (str.string`5Bpos`5D == '\0') X val = defreal; X else X val = atof(&str.string`5Bpos`5D); X free(str.string); X return val; X `7D X else X `7B X free(str.string); X return defreal;`20 X `7D X`7D /* ptk_readfloat */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ +-+-+-+-+-+-+-+- END OF PART 245 +-+-+-+-+-+-+-+-