-+-+-+-+-+-+-+-+ START OF PART 246 -+-+-+-+-+-+-+-+ Xextern void ptk_readstring(C(Pint) ws, C(Pchar *) defstring, X C(Pchar *) prompt, C(Plimit *) echoarea, X C(Pint) len, C(Pchar *) instr, C(Pint *) inlen) XPreANSI(Pint ws) XPreANSI(Pchar *defstring) XPreANSI(Pchar *prompt) XPreANSI(Plimit *echoarea) XPreANSI(Pint len) XPreANSI(Pchar *instr)`20 XPreANSI(Pint *inlen) X/* X** \parambegin X** \param`7BPint`7D`7Bws`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPchar *`7D`7Bdefstring`7D`7Bdefault string`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** \param`7BPint`7D`7Blen`7D`7Bnumber of characters allocated for input stri Vng`7D`7BIN`7D X** \param`7BPchar *`7D`7Binstr`7D`7Binput string`7D`7BOUT`7D X** \param`7BPint *`7D`7Binlen`7D`7Blength of input string`7D`7BOUT`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 a X** string, the function returns the specified default value \pardesc`7Bdefst Vring`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 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); X preqstring(ws, 1, &str); X if (str.status == PSTAT_OK) X `7B X if (str.string`5Bpos`5D == '\0') X `7B X strncpy(instr, defstring, len); X *inlen = strlen(defstring); X free(str.string); X `7D X else X `7B X strncpy(instr, &str.string`5Bpos`5D, len); X *inlen = strlen(instr); X free(str.string); X `7D X `7D X else X `7B X strncpy(instr, defstring, len); X *inlen = strlen(defstring); X free(str.string); X `7D X`7D /* ptk_readstring */ X X/*-------------------------------------------------------------------------- V*/ X/*------------------------ Structure Functions ----------------------------- V*/ X X/*function:external*/ Xextern void ptk_stackstruct(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function stores the name X** of the currently open structure, and the position of the element pointer V on the X** structure X** stack, and closes the structure`7D X*/ X`7B X Pint err, stid; X Popenstructstatus structstatus; X ptksstructstack *stackitem; X X pinqopenstruct(&err, &structstatus, &stid); X if ((err == 0) && (structstatus == PSTRUCT_OPEN)) X `7B X stackitem = (ptksstructstack *)malloc(sizeof(ptksstructstack)); X stackitem->next = structstack; X structstack = stackitem; X stackitem->structid = stid; X pinqelemptr(&err, &stackitem->elemptr); X pclosestruct(); X `7D X`7D /* ptk_stackstruct */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_unstackstruct(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function pops the structure stack, X** opens the structure and sets the element pointer.`7D X*/ X`7B X ptksstructstack *stackitem; X X if (structstack != NULL) X `7B X popenstruct(structstack->structid); X psetelemptr(structstack->elemptr); X stackitem = structstack->next; X free(structstack); X structstack = stackitem; X `7D X`7D /* ptk_unstackstruct */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_openstruct(C(Pint) structid) XPreANSI(Pint structid) X/* X** \parambegin X** \param`7BPint`7D`7Bstructid`7D`7Bstructure identifier`7D`7BIN`7D X** \paramend X** \blurb`7BThis function stores the currently open structure and element X** pointer on a stack and opens the structure `7B\tt structid`7D.`7D X*/ X`7B X Pint err, stid; X Popenstructstatus structstatus; X ptksstructstack *stackitem; X X ptk_stackstruct(); X popenstruct(structid); X`7D /* ptk_openstruct */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_closestruct(C(void)) X/* PreANSI() */ X/* X** \blurb`7BThis function closes the currently open structure, and restores V the open X** structure and element pointer from the structure stack.`7D X*/ X`7B X pclosestruct(); X ptk_unstackstruct(); X`7D /* ptk_closestruct */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_seteditmode(C(Peditmode) editmode) XPreANSI(Peditmode editmode) X/* X** \parambegin X** \param`7BPeditmode`7D`7Beditmode`7D`7Bedit mode`7D`7BIN`7D X** \paramend X** \blurb`7BThis function stores X** the current edit mode on the editmode stack and then sets the edit mode X** to given value.`7D X*/ X`7B X Pint err; X Peditmode emode; X Popenstructstatus structstatus; X ptkseditmodestack *stackitem; X X pinqeditmode(&err, &emode); X if (err == 0) X `7B X stackitem = (ptkseditmodestack *)malloc(sizeof(ptkseditmodestack)); X stackitem->next = editmodestack; X editmodestack = stackitem; X stackitem->editmode = emode; X `7D X pseteditmode(editmode); X`7D /* ptk_seteditmode */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_unseteditmode(C(void)) X/* PreANSI() */ X/* X** \parambegin X** \paramend X** \blurb`7BThis function restores the current edit mode from the edit mode V stack.`7D X*/ X`7B X ptkseditmodestack *stackitem; X X if (editmodestack != NULL) X `7B X pseteditmode(editmodestack->editmode); X stackitem = editmodestack->next; X free(editmodestack); X editmodestack = stackitem; X `7D X`7D /* ptk_unseteditmode */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_getpickid(C(Pint) stid, C(Pint) elptr, C(Pint *) picki Vd) XPreANSI(Pint stid) XPreANSI(Pint elptr) XPreANSI(Pint *pickid) X/* X** \parambegin X** \param`7BPint`7D`7Bstid`7D`7Bstructure identifier`7D`7BIN`7D X** \param`7BPint`7D`7Belptr`7D`7Belement pointer value`7D`7BIN`7D X** \param`7BPint *`7D`7Bpickid`7D`7Bpick identifier`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function inquires the pick identifier at the element positi Von X** specified by \pardesc`7Belptr`7D in X** structure \pardesc`7Bstid`7D. X** The result of the function is TRUE if the element was a pick X** identifier, otherwise FALSE.`7D X*/ X`7B X ptkboolean result; X Pint err; X Pchar *buffer; X ptkselcontent elcont; X X ptk_inqelemtypesizecontent(stid, elptr, &err, &buffer, &elcont); X if (elcont.eltype == PEL_PICK_ID)`20 X `7B X result = TRUE; X *pickid = elcont.eldata.idata; X `7D`20 X else X result = FALSE; X free(buffer); X return result; X`7D /* ptk_getpickid */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_getexecuteid(C(Pint) stid, C(Pint) elptr, C(Pint *) ex Vecid) XPreANSI(Pint stid) XPreANSI(Pint elptr) XPreANSI(Pint *execid) X/* X** \parambegin X** \param`7BPint`7D`7Bstid`7D`7Bstructure identifier`7D`7BIN`7D X** \param`7BPint`7D`7Belptr`7D`7Belement pointer value`7D`7BIN`7D X** \param`7BPint *`7D`7Bexecid`7D`7Bexecute structure identifier`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function inquires the execute element X** identifier at the element position X** specified by \pardesc`7Belptr`7D in X** structure \pardesc`7Bstid`7D. X** The result of the function is TRUE if the element was an execute X** element, otherwise FALSE..`7D X*/ X`7B X ptkboolean result; X Pint err; X Pchar *buffer; X ptkselcontent elcont; X X ptk_inqelemtypesizecontent(stid, elptr, &err, &buffer, &elcont); X if (elcont.eltype == PEL_EXECUTE_STRUCTURE)`20 X `7B X result = TRUE; X *execid = elcont.eldata.idata; X `7D`20 X else X result = FALSE; X free(buffer); X return result; X`7D /* ptk_getexecuteid */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern Pint ptk_elemcount(C(Pint) stid) XPreANSI(Pint stid) X/* X** \parambegin X** \param`7BPint`7D`7Bstid`7D`7Bstructure identifier`7D`7BIN`7D X** \paramend X** \blurb`7BThis functions counts the number of elements`20 X** in structure \pardesc`7Bstid`7D, X** returning the number of elements, or -1 if the structure does X** not exist.`7D X*/ X`7B X Pint result; X Pstructstatus stat; X Pint openst; X Popenstructstatus openstat; X Pint err, p, oldp; X X result = 0; X pinqstructstatus(stid, &err, &stat); X if (stat == PSTAT_NON_EXISTENT) X return -1; X if (stat == PSTAT_EMPTY) X return 0; X ptk_openstruct(stid); X pinqelemptr(&err, &p); X result = p; X ptk_closestruct(); X return result; X`7D /* ptk_elemcount */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_structexists(C(Pint) stid) XPreANSI(Pint stid) X/* X** \parambegin X** \param`7BPint`7D`7Bstid`7D`7Bstructure identifier`7D`7BIN`7D X** \paramend X** \blurb`7BThis function checks if structure \pardesc`7Bstid`7D exists in t Vhe CSS, X** returning TRUE if it exists, otherwise FALSE.`7D X*/ X`7B X Pstructstatus structstat; X Pint err; X X pinqstructstatus(stid, &err, &structstat); X if (err == 0) X return (structstat != PSTAT_NON_EXISTENT); X else X return FALSE; X`7D /* ptk_structexists */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_getelemtype(C(Pchar *) elemstr, C(Peltype *) eltype) XPreANSI(Pchar *elemstr) XPreANSI(Peltype *eltype) X/* X** \parambegin X** \param`7BPchar *`7D`7Belemstr`7D`7Bstring giving element type`7D`7BIN`7D X** \param`7BPeltype *`7D`7Beltype`7D`7Belement type`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function converts the string \pardesc`7Belemstr`7D X** into its corresponding element type. For example the element type for X** "polyline3", would be PEL\_POLYLINE3.`7D X*/ X`7B `20 X Pint ind; X X ind = instrlist(elemlist, NUMPHIGSELEMS, elemstr); X if (ind >= 0) X *eltype = (Peltype)ind; X else X *eltype = PEL_NIL; X`7D /* ptk_getelemtype */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_getelemtypename(C(Peltype) eltype, C(Pint) size,`20 X C(Pchar *) elemstr, C(Pint *) totalsize) XPreANSI(Peltype eltype) XPreANSI(Pint size) XPreANSI(Pchar *elemstr) XPreANSI(Pint *totalsize) X/* X** \parambegin X** \param`7BPeltype`7D`7Beltype`7D`7Belement type`7D`7BIN`7D X** \param`7BPint`7D`7Bsize`7D`7Bsize of buffer allocated by application`7D`7 VBIN`7D X** \param`7BPchar *`7D`7Belemstr`7D`7Bstring giving element type`7D`7BOUT`7D X** \param`7BPint *`7D`7Btotalsize`7D`7Blength of string`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function converts element type \pardesc`7Beltype`7D X** into the corresponding character string, which is returned in X** \pardesc`7Belemstr`7D. For example, the string corresponding to X** PE\_POLYLINE3 would be "polyline3".`7D X*/ X`7B X *totalsize = strlen(elemlist`5B(Pint)eltype`5D) + 1; X if (*totalsize <= size) X strncpy(elemstr, elemlist`5B(Pint)eltype`5D, *totalsize); `20 X`7D /* ptk_getelemtypename */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_executeelem(C(ptkselcontent *) elcont) XPreANSI(ptkselcontent *elcont) X/* X** \parambegin X** \param`7Bptkselcontent *`7D`7Belcont`7D`7Belement content`7D`7BIN`7D X** \paramend X** \blurb`7BThis function creates a structure element which has the X** contents \pardesc`7Belcont`7D. The element is inserted into the currentl Vy open X** structure.`7D X*/ X`7B X switch (elcont->eltype)`20 X `7B X case PEL_POLYLINE3: X#ifdef VMS `20 X ppolyline3(elcont->size, elcont->eldata.pts3); X#endif X#ifdef SUN X ppolyline3(elcont->eldata.pts3.number, elcont->eldata.pts3.points); X#endif X break; X X case PEL_POLYLINE: X#ifdef VMS `20 X ppolyline(elcont->size, elcont->eldata.pts); X#endif X#ifdef SUN X ppolyline(elcont->eldata.pts.number, elcont->eldata.pts.points); X#endif X break; X X case PEL_POLYMARKER3: X#ifdef VMS X ppolymarker3(elcont->size, elcont->eldata.pts3); X#endif X#ifdef SUN X ppolymarker3(elcont->eldata.pts3.number, elcont->eldata.pts3.points) V; X#endif X break; X X case PEL_POLYMARKER: X#ifdef VMS X ppolymarker(elcont->size, elcont->eldata.pts); X#endif X#ifdef SUN X ppolymarker(elcont->eldata.pts.number, elcont->eldata.pts.points); X#endif X break; X X case PEL_TEXT3: X#ifdef VMS X ptext3(&elcont->eldata.text3.pt, elcont->eldata.text3.dir,`20 X elcont->eldata.text3.string); X#endif X#ifdef SUN X ptext3(&elcont->eldata.text3.pt, elcont->eldata.text3.dir,`20 X elcont->eldata.text3.str); X#endif X break; X X case PEL_TEXT: X#ifdef VMS X ptext(&elcont->eldata.text.pt, elcont->eldata.text.string); X#endif X#ifdef SUN X ptext(&elcont->eldata.tx.pt, elcont->eldata.tx.str); X#endif X break; X X case PEL_ANNOTATION_TEXT_RELATIVE3: X#ifdef VMS X pannotationtextrelative3(&elcont->eldata.atext3.ref_pt,`20 X &elcont->eldata.atext3.anno,`20 X elcont->eldata.atext3.string); X#endif X#ifdef SUN X pannotationtextrelative3(&elcont->eldata.atx3.ref_pt,`20 X &elcont->eldata.atx3.anno,`20 X elcont->eldata.atx3.str); X#endif X break; X X case PEL_ANNOTATION_TEXT_RELATIVE: X#ifdef VMS X pannotationtextrelative(&elcont->eldata.atext.ref_pt,`20 X &elcont->eldata.atext.anno,`20 X elcont->eldata.atext.string); X#endif X#ifdef SUN +-+-+-+-+-+-+-+- END OF PART 246 +-+-+-+-+-+-+-+-