-+-+-+-+-+-+-+-+ START OF PART 236 -+-+-+-+-+-+-+-+ X break; X X case PEL_GDP3: do_pgdp3(); X break; X X case PEL_GDP: do_pgdp(); X break; X X case PEL_POLYLINE_INDEX: do_psetlineind(); X break; X X case PEL_POLYMARKER_INDEX: do_psetmarkerind(); X break; X X case PEL_TEXT_INDEX: do_psettextind(); X break; X X case PEL_INTERIOR_INDEX: do_psetintind(); X break; X X case PEL_EDGE_INDEX: do_psetedgeind(); X break; X X case PEL_LINETYPE: do_psetlinetype(); X break; X X case PEL_POLYLINE_COLOUR_INDEX: do_psetlinecolourind(); X break; X X case PEL_MARKER_TYPE: do_psetmarkertype(); X break; X X case PEL_MARKER_COLOUR_INDEX: do_psetmarkercolourind(); X break; X X case PEL_TEXT_FONT: do_psettextfont(); X break; X X case PEL_TEXT_COLOUR_INDEX: do_psettextcolourind(); X break; X X case PEL_ANNOTATION_STYLE: do_psetannotationstyle(); X break; X X case PEL_INTERIOR_STYLE_INDEX: do_psetintstyleind(); X break; X X case PEL_INTERIOR_COLOUR_INDEX: do_psetintcolourind(); X break; X X case PEL_EDGETYPE: do_psetedgetype(); X break; X X case PEL_EDGE_COLOUR_INDEX: do_psetedgecolourind(); X break; X X case PEL_HLHSR_IDENTIFIER: do_psethlhsrid(); X break; X X case PEL_VIEW_INDEX: do_psetviewind(); X break; X X case PEL_LABEL: do_plabel(); X break; X X case PEL_PICK_ID: do_psetpickid(); X break; X X case PEL_LINEWIDTH_SCALE_FACTOR: do_psetlinewidth(); X break; X X case PEL_MARKER_SIZE_SCALE_FACTOR: do_psetmarkersize(); X break; X X case PEL_CHARACTER_EXPANSION_FACTOR: do_psetcharexpan(); X break; X X case PEL_CHARACTER_SPACING: do_psetcharspace(); X break; X X case PEL_CHARACTER_HEIGHT: do_psetcharheight(); X break; X X case PEL_ANNOTATION_TEXT_CHARACTER_HEIGHT: do_psetannotationcharheight() V; X break; X X case PEL_EDGEWIDTH_SCALE_FACTOR: do_psetedgewidth(); X break; X X case PEL_EXECUTE_STRUCTURE: do_pexecutestruct(); X break; X `20 X case PEL_TEXT_PRECISION: do_psettextprec(); X break; X X case PEL_CHARACTER_UP_VECTOR: do_psetcharup(); X break; X X case PEL_ANNOTATION_TEXT_CHARACTER_UP_VECTOR: do_psetannotationcharup(); X break; X X case PEL_TEXT_PATH: do_psettextpath(); X break; X X case PEL_ANNOTATION_TEXT_PATH: do_psetannotationpath(); X break; X X case PEL_TEXT_ALIGNMENT: do_psettextalign(); X break; X X case PEL_ANNOTATION_TEXT_ALIGNMENT: do_psetannotationalign(); X break; X X case PEL_INTERIOR_STYLE: do_psetintstyle(); X break; X X case PEL_EDGE_FLAG: do_psetedgeflag(); X break; X X case PEL_PATTERN_SIZE: do_psetpatsize(); X break; X X case PEL_PATTERN_REFERENCE_POINT: do_psetpatrefpt(); X break; X X case PEL_PATTERN_REFERENCE_POINT_AND_VECTORS: do_psetpatrefptvectors(); X break; X X case PEL_ADD_NAMES_TO_SET: do_paddnameset(); X break; X X case PEL_REMOVE_NAMES_FROM_SET: do_premovenameset(); X break; X X case PEL_INDIVIDUAL_ASF: do_psetindivasf(); X break; X X case PEL_LOCAL_MODELLING_TRANSFORMATION3: do_psetlocaltran3(); X break; X X case PEL_LOCAL_MODELLING_TRANSFORMATION: do_psetlocaltran(); X break; X X case PEL_GLOBAL_MODELLING_TRANSFORMATION3: do_psetglobaltran3(); X break; X X case PEL_GLOBAL_MODELLING_TRANSFORMATION: do_psetglobaltran(); X break; X X#ifdef SUN X case PEL_MODELLING_CLIPPING_VOLUME3: do_psetmodelclipvolume3(); X break; X X case PEL_MODELLING_CLIPPING_VOLUME: do_psetmodelclipvolume(); X break; X X case PEL_MODELLING_CLIPPING_INDICATOR: do_psetmodelclipindicator(); X break; X X case PEL_RESTORE_MODELLING_CLIPPING_VOLUME: do_prestoremodelclipvolume() V; X break; X#endif X X case PEL_APPLICATION_DATA: do_papplicationdata(); X break; X X case PEL_GSE: do_pgse(); X break; X X `7D X`7D /* ptk_readelem */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void read_string(C(Pchar *) str) XPreANSI(Pchar *str) X/* X** description:`20 X** input params:`20 X** output params:`20 X** return value:`20 X*/ X`7B X /* Reads a string. if the first non-blank character found is X a double quote ("), the string is assumed to quoted, and must X be "string", on one line. otherwise, the next sequence of X non-blank characters will be returned as the string */ X Pint wi; X Pint ch; X ptkboolean finished; X X wi = 0; X finished = FALSE; X ch = getc(stdin); X while (ch == ' ' `7C`7C ch == '\n') X ch = getc(stdin); X while (!finished) X `7B X str`5Bwi`5D = ch; X wi++; X if (ch == '\0') X finished = TRUE; X else X if (ch == '\n' `7C`7C ch == ' ') X `7B X finished = TRUE; X wi--; X `7D X else X ch = getc(stdin); X `7D X str`5Bwi`5D = '\0'; X`7D /* read_string */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_callphinter(C(void)) X/*PreANSI()*/ X/* X** \blurb`7BThis function provides an interface to phinter and its related X** functions. The available commands are as follows: X** \begin`7Bdescription`7D X** \item`5Bhelp`5D`7Boutput this list.`7D X** \item`5Binteractive`5D`7Bcall phinter with stdin for input script.`7D X** \item`5Bstringinput`5D`7Bcall phinter using string device for input`20 X** and terminal windows for output.`7D X** \item`5Bread`5D`7Bcall phinter with a given input script.`7D X** \item`5Boutputfile`5D`7Bset output script filename.`7D X** \item`5Binformfile`5D`7Bset information filename.`7D X** \item`5Boutputterm`5D`7Bset output terminal window identifier.`7D X** \item`5Binformterm`5D`7Bset information terminal window identifier.`7D X** \item`5Bwritestruct`5D`7Bwrite contents of structures to output file.`7D X** \item`5Bwritestruct`5D`7Bwrite contents of structure networks X** to output file.`7D X** \item`5Bwritestruct`5D`7Bwrite contents of all structures to X** output file.`7D X** \item`5Bquit or exit`5D`7Bleave callphinter.`7D X** \end`7Bdescription`7D\`20 X** `7D X*/ X`7B X FILE *f, *inf, *outf; X Pint lencom; X ptkboolean finished; X Pchar filename`5B255`5D, command`5B30`5D; X Pint outterm, infterm; X X fileswitch = TRUE; X finished = FALSE; X inf = stdout; X outf = NULL; X while (!finished) X `7B X inputscript = stdin; X interactive = TRUE; X printf("callphinter> "); X read_string(command); X lencom = strlen(command); X if (strncmp(command, "help", lencom) == 0) X `7B X printf("commands\n--------\n"); X printf("help -- output this list.\n"); X printf("interactive -- call phinter with stdin for input script.\n"); X printf("stringinput -- call phinter using string device for input\n"); X printf(" and terminal windows for output.\n"); X printf("read -- call phinter with a given input script.\n"); X printf("outputfile -- set output script filename.\n"); X printf("informfile -- set information filename.\n"); X printf("outputterm -- set output terminal window identifier.\n"); X printf("informterm -- set information terminal window identifier.\n"); X printf("writestruct -- write contents of structures to output file.\n" V); X printf("writestruct -- write contents of structure networks\n"); X printf(" to output file.\n"); X printf("writestruct -- write contents of all structures to \n"); X printf(" output file.\n"); X printf("quit or exit -- leave callphinter.\n"); X `7D X else X if (strncmp(command, "interactive", lencom) == 0) X `7B X ptk_phinter(stdin, outf, inf); X `7D X else X if (strncmp(command, "stringinput", lencom) == 0) X `7B X Pint ws; X Plimit echoarea; X X ws = readinteger("workstation identifier"); X echoarea = readlimit("echo area"); X ptk_strphinter(ws, &echoarea, outterm, infterm); X fileswitch = TRUE; X `7D X else X if (strncmp(command, "read", lencom) == 0) X `7B X printf("filename > "); X read_string(filename); X f = fopen(filename, "r"); X if (f == NULL) X `7B X printf("couldn't find file %s\n", filename); X `7D X else X `7B X rewind(f); X ptk_phinter(f, outf, inf); X fclose(f); X `7D X `7D X else X if (strncmp(command, "informfile", lencom) == 0) X `7B X FILE *tempf; X X printf("information filename > "); X read_string(filename); X if (strncmp(filename, "stdout", 6) == 0) X `7B X if (inf != stdout) X fclose(inf); X inf = stdout; `20 X `7D X else X `7B X tempf = fopen(filename, "w+"); X if (tempf == NULL) X`09`7B X printf("couldn't find file %s\n", filename); X `7D X else X`09`7B X if (inf != stdout) X fclose(inf); X inf = tempf; X `7D X `7D X `7D X else X if (strncmp(command, "outputfile", lencom) == 0) X `7B X FILE *tempf; X X printf("output script filename > "); X read_string(filename); X if (strncmp(filename, "stdout", 6) == 0) X `7B X if (outf != stdout) X fclose(outf); X outf = stdout; `20 X `7D X else X `7B X tempf = fopen(filename, "w+"); X if (tempf == NULL) X`09`7B X printf("couldn't find file %s\n", filename); X `7D X else X`09`7B X if (outf != stdout) X fclose(outf); X outf = tempf; X `7D X `7D X `7D X else X if (strncmp(command, "outputterm", lencom) == 0) X `7B X outterm = readinteger("output script terminal window identifier"); X `7D X else X if (strncmp(command, "informterm", lencom) == 0) X `7B X infterm = readinteger("information terminal window identifier"); X `7D X else X if (strncmp(command, "writestruct", lencom) == 0) X `7B X Pint i; X Pintlst stids; X X stids.number = readinteger("number of structures"); X stids.integers = (Pint *)calloc(stids.number, sizeof(Pint)); X for (i = 0; i < stids.number; i++) X stids.integers`5Bi`5D = readintvalue("structure identifier",`20 X PTKESTRUCTID); X printf("writing structures...\n"); X ptk_writestruct(outf, &stids); X free(stids.integers); X `7D X else X if (strncmp(command, "writestructnet", lencom) == 0) X `7B X Pint i; X Pintlst stids; X X stids.number = readinteger("number of structure networks"); X stids.integers = (Pint *)calloc(stids.number, sizeof(Pint)); X for (i = 0; i < stids.number; i++) X stids.integers`5Bi`5D = readintvalue("root structure identifier",`20 X PTKESTRUCTID); X printf("writing structure networks...\n"); X ptk_writestructnet(outf, &stids); X free(stids.integers); X `7D X else X if (strncmp(command, "writeallstruct", lencom) == 0) X `7B X printf("writing all structures...\n"); X ptk_writeallstruct(outf); X `7D X else X if ((strncmp(command, "quit", lencom) == 0) `7C`7C X (strncmp(command, "exit", lencom) == 0)) X `7B X finished = TRUE; X `7D X `7D X if (inf != stdout) X fclose(inf); X if (outf != stdout) X fclose(outf); X`7D /* ptk_callphinter */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern ptkboolean ptk_elemcontent(C(Pint) stid, C(Pint) elemid, C(Pint) term Vid, X C(Pint *) error) XPreANSI(Pint stid) XPreANSI(Pint elemid) XPreANSI(Pint termid) XPreANSI(Pint *error) X/*`20 X** \parambegin X** \param`7BPint`7D`7Bstid`7D`7Bstructure identifier`7D`7BIN`7D X** \param`7BPint`7D`7Belemid`7D`7Belement number`7D`7BIN`7D X** \param`7BPint`7D`7Btermid`7D`7Bterminal window identifier`7D`7BIN`7D X** \param`7BPInt *`7D`7Berror`7D`7Berror code`7D`7BOUT`7D X** \paramend X** \blurb`7BThis function writes the contents of an element in a`20 X** terminal window. If the element is an output primitive then X** it is inserted into the currently open structure at the current X** editing position and the function returns TRUE, otherwise FALSE.`7D X*/ X`7B X Pint ecount, namelen, i, numpts, err, name; X ptkselcontent elcont; X Pchar *buffer; X Pstructstatus stat; X Pchar elemname`5B50`5D; X ptkboolean inserted; X Popenstructstatus structst; X X fileswitch = FALSE; X outputterm = termid; X writingscript = FALSE; X writeinform = FALSE; X *error = 0; X inserted = FALSE; X pinqstructstatus(stid, error, &stat); X ecount = ptk_elemcount(stid); X if (stat == PSTAT_NON_EXISTENT)`20 X `7B X *error = 1; /* structure does not exist */ X return inserted; X `7D X if ((elemid <= 0) `7C`7C (elemid > ecount))`20 X `7B X *error = 2; /* element does not exist */ X return inserted; X `7D X ptk_inqelemtypesizecontent(stid, elemid, error, &buffer, &elcont); X /* write element content to terminal window */ X writeelemcontent(PTKEOUTPUT, &elcont); X pinqopenstruct(&err, &structst, &name); X if (structst == PSTRUCT_OPEN)`20 X `7B X switch (elcont.eltype) X `7B X case PEL_POLYLINE3: X case PEL_POLYMARKER3: X case PEL_FILL_AREA3: X case PEL_POLYLINE: X case PEL_POLYMARKER: X case PEL_FILL_AREA: X case PEL_TEXT3: X case PEL_TEXT: X case PEL_ANNOTATION_TEXT_RELATIVE3: X case PEL_ANNOTATION_TEXT_RELATIVE: X case PEL_FILL_AREA_SET3: X case PEL_FILL_AREA_SET: X case PEL_CELL_ARRAY3: X case PEL_CELL_ARRAY: X ptk_executeelem(&elcont); X inserted = TRUE; X break; X `7D X `7D X free(buffer); X return inserted; X`7D /* ptk_elemcontent*/ X X/*-------------------------------------------------------------------------- V*/ X X/* end of phin.c */ $ CALL UNPACK [.SOURCE.LIBRARY]PHIN.C;3 1361358871 $ create 'f' X/*-------------------------------------------------------------------------- +-+-+-+-+-+-+-+- END OF PART 236 +-+-+-+-+-+-+-+-