void TKFSegmentEnd (save_seg)

void TKFSegmentStart (void)

LPLT.C Level 3
 
int save_seg 0 = DISCARD_SEGMENT = Don't save the TKF segment.
1 = SAVE_SEGMENT = Save the TKF segment.
 
These two routines allow you to divert the metafile commands created by GraphiC to a temporary file that you can later choose to delete or to add to the end of your main TKF file [the one specified in bgnplot()]. 
TKFSegmentStart() opens a temporary new file for storing future plot information. When a call to TKFSegmentEnd() occurs, if the argument is SAVE_SEGMENT, the temporary file will be closed and the information will be added to the end of the main TKF file. Otherwise, the temporary file is closed and removed.

For example, when a temporary segment is open, and if you delete the temporary file, nothing that is drawn on the screen will appear in a print made from the TKF file. You can use this feature to put GraphiC text on the screen to give prompts etc. without the text being part of the permenant picture. You can also use this technique to draw and erase 
curves as illustrated in the code fragment below.

startplot(BRT_WHITE);     /* Bright white background. */
for(;;) {
    TKFSegmentStart();   /* start a new TKF segment. */
    color(blue);
    npoints = getdata(x, y);   /* data generation. */
    curve(x, y, npoints, 0);   /* draw curve. */
    what_next = ciq();    /* get user response. */
    if (what_next == 'c') {    /* 'c' for continue. */

    color(BRT_WHITE);  /* set drawing color to background
    curve(x, y, npoints);  /* erase curve. */
    TKFSegmentEnd(0);  /* end segment without saving. */
    continue();    /* prepare for new curve. */
}

else {
    TKFSegmentEnd(SAVE_SEGMENT);  /* add segment to the TKF file */
    break;     /* completed plot. */
}

}
endplot();