Beispiel #1
0
/*
**  do_comments ()
*/
char
do_comments()
{
    char                   menu_ans ;

    do
    {
        if (canonAns == EOS)
        {
            disp_prompt(NEW_CANON,&menu_ans,NEW_CANON_A);
        }
        else
        {
            menu_ans = canonAns;
        }

        if ((menu_ans == 'c')||(menu_ans == 'C'))
        {
            create_comment();
        }

    } while ((menu_ans == 'c')||(menu_ans == 'C'));

    insert_comment();
    return(menu_ans);
} /* end of do_comments () */
Beispiel #2
0
/*
**	page_up
*/
STATUS
page_up()
{
    STATUS                 ret_val = OK ;
    char                   junk ;

    if (myPages == NULL || myPages->previous == NULL)
	disp_prompt(ERx("TOF reached"),&junk,NULL);
    else
    {
	myPages = myPages->previous;
	SIfseek(diffPtr, myPages->file_pos, SI_P_START);
	display_lines();
    }

    return (ret_val);
}
Beispiel #3
0
STATUS
create_canon_fe(SEPFILE *res_ptr)
{
    STATUS                 ret_val = OK ;   /* if OK, refresh FE screen */
    char                   do_com_result ;

#ifdef VMS
    if (SEPtcsubs < 4)
	PCsleep(1000);
#endif
    show_cursor();

    do_com_result = do_comments();
    append_line(OPEN_CANON,1);
    switch (do_com_result)
    {
       case 'R':
       case 'r':
		append_sepfile(res_ptr);
		break;
       case 'E':
       case 'e':
		break;
       case 'I':
       case 'i':
		append_line(SKIP_SYMBOL,1);
		break;
    }
    append_line(CLOSE_CANON,1);
    kfe_ptr = kfebuffer;                /* reset counter for key buffer */

    if (canonAns == EOS)
    {
	disp_prompt(NULLSTR,NULL,NULL);	/* erase prompt */
    }
    else
    {
	CMnext(kfe_ptr);
	ret_val = FAIL;			/* don't refresh FE screen */
    }
    return (ret_val);
}
Beispiel #4
0
STATUS
page_down(i4 update)
{
    struct page_chain     *newpage = NULL ;
    char                   junk ;

    if ( (myPages) && (myPages->final_page) )
    {
	disp_prompt(ERx("EOF reached"),&junk,NULL);
	return(OK);
    }
    if ( (myPages == NULL) || (myPages->next == NULL) )
    {
	newpage = (struct page_chain *)
		   SEP_MEalloc(SEP_ME_TAG_PAGES, sizeof(struct page_chain),
			       TRUE, (STATUS *) NULL);

	newpage->file_pos = SIftell(diffPtr );
	newpage->final_page = FALSE;
	newpage->next = NULL;
	if (myPages)
        {
	    newpage->previous = myPages;
	    myPages->next = newpage;
	}
	else
	    newpage->previous = NULL;

	myPages = newpage;
    }
    else
	myPages = myPages->next;

    TDerase(diffW);
    return(display_lines());
} /* page_down */
Beispiel #5
0
STATUS
create_canon(SEPFILE *res_ptr)
{
    STATUS                 ret_val ;
    char                   do_com_result ;

    if ((ret_val = disp_res(res_ptr)) == OK)
    {
	put_message(statusW, NULLSTR);

	do_com_result = do_comments();
	append_line(OPEN_CANON,1);
	switch (do_com_result)
	{
	   case 'R':
	   case 'r':
			append_sepfile(res_ptr);
			break;
	   case 'E':
	   case 'e':
			break;
	   case 'I':
	   case 'i':
			append_line(SKIP_SYMBOL,1);
			break;
	}
	append_line(CLOSE_CANON,1);

	if (canonAns == EOS)
	{
	    disp_prompt(NULLSTR,NULL,NULL);
	}
	fix_cursor();
    }
    return (ret_val);
}
Beispiel #6
0
STATUS
disp_diff(STATUS acmmt,i4 canons)
{
    STATUS                 ioerr ;
    STATUS                 up_canon = FAIL ;
    char                   cmmtfile [50] ;
    char                   canon_upd = '\0' ;
    char                   junk ;
    char                   menu_ans ;
    bool                   conditional_exp ;

    /* initialize diff window */

    conditional_exp = FALSE;
#ifndef NT_GENERIC
    TEwrite(CL,STlength(CL));
    TEflush();
#endif
    diffW = TDnewwin(MAIN_ROWS,MAIN_COLS,FIRST_MAIN_ROW,FIRST_MAIN_COL);
    diffstW = TDnewwin(STATUS_ROWS,STATUS_COLS,FIRST_STAT_ROW,FIRST_MAIN_COL);
    TDrefresh(diffstW);
    TDrefresh(diffW);

    screenLine = 0;
    old_page = 0;
    bottom_page = 0;
    myPages = NULL;
    ioerr = OK;

    STprintf(cmmtfile,ERx("ct%s.stf"),SEPpidstr);
    diffPtr = sepDiffer->_fptr;

    /*
    **	display diff
    */

    page_down(0);
    if (updateMode)
	    up_canon = OK;

    for (;;)
    {
	if (updateMode)
	{
	    if (editCAns == '\0')
		disp_prompt(DIFF_MENU_M,&menu_ans,DIFF_MENU_AM);
	    else
		menu_ans = 'e';
	}
	else
	    disp_prompt(DIFF_MENU,&menu_ans,DIFF_MENU_A);

	switch (menu_ans)
	{
	   case 'A': case 'a':
		    ioerr = FAIL;
		    break;
	   case 'P': case 'p':
		    page_up();
		    break;
	   case 'N': case 'n':
		    page_down(0);
		    break;
	   case 'C': case 'c':
		    if (acmmt == FAIL && !updateMode)
			disp_prompt(ERx("no comments attached to this command"),
			    &junk,NULL);
		    else
		    {
			edit_file(cmmtfile);
			TDtouchwin(diffW);
			TDrefresh(diffW);
		    }
		    break;
	   case 'E': case 'e':
		    if (up_canon == OK)
		    {
			if (editCAns == '\0')
			{
			    disp_prompt(UPD_CANON,&canon_upd,UPD_CANON_A);
			}
			else
			{
			    canon_upd = editCAns;
			    menu_ans = 'q';
			}

			if (canon_upd == 'M' || canon_upd == 'A' ||
			    canon_upd == 'm' || canon_upd == 'a' )
			    conditional_exp = ask_for_conditional(diffstW,
								  editCAns);

			up_canon = FAIL;
		    }
		    break;
	}
	if (menu_ans == 'Q' || menu_ans == 'q' ||
	    menu_ans == 'A' || menu_ans == 'a' ||
	    menu_ans == 'D' || menu_ans == 'd')
	{
	    disp_prompt(NULLSTR,NULL,NULL);
	    SEPdisconnect = (menu_ans == 'A' || menu_ans == 'a' ||
			     menu_ans == 'D' || menu_ans == 'd');
	    break;
	}
    }

    /*
    **	update test
    */

    if (updateMode)
    {
	LOCATION	cmmtloc;
	short	count;

	/* add comments */

	LOfroms(FILENAME & PATH,cmmtfile,&cmmtloc);
	if (SEP_LOexists(&cmmtloc))
	{
	    append_line(OPEN_COMMENT,1);
	    append_file(cmmtfile);
	    append_line(CLOSE_COMMENT,1);
	    LOdelete(&cmmtloc);
	}

	/* add canons   */
	    
	switch (canon_upd)
	{
	   case 'I':
	   case 'i':
		    append_line(OPEN_CANON,1);
		    append_line(SKIP_SYMBOL,1);
		    append_line(CLOSE_CANON,1);
		    break;
	   case 'M':
	   case 'm':
		    SEPrewind(sepResults, FALSE);
		    if (conditional_exp == TRUE)
		    {
			append_line(OPEN_CANON,0);
			append_line(conditional_prompt,1);
		    }
 		    else
			append_line(OPEN_CANON,1);

		    append_sepfile(sepResults);
		    append_line(CLOSE_CANON,1);
		    append_sepfile(sepGCanons);
		    break;
	   case 'O':
	   case 'o':
		    SEPrewind(sepResults, FALSE);
		    append_line(OPEN_CANON,1);
		    append_sepfile(sepResults);
		    append_line(CLOSE_CANON,1);
		    break;
	   case '\0':
	   case 'E':
	   case 'e':
		    append_sepfile(sepGCanons);
		    break;
	   case 'A':
	   case 'a':
		    append_sepfile(sepGCanons);
		    SEPrewind(sepResults, FALSE);
		    if (conditional_exp == TRUE)
		    {
			append_line(OPEN_CANON,0);
			append_line(conditional_prompt,1);
		    }
		    else
			append_line(OPEN_CANON,1);

		    append_sepfile(sepResults);
		    append_line(CLOSE_CANON,1);
		    break;
	}
    }
    MEtfree(SEP_ME_TAG_PAGES);
    TDdelwin(diffW);
    TDdelwin(diffstW);
    return(ioerr);
}
Beispiel #7
0
VOID
get_string(WINDOW *wndow,char *question,char *ansbuff)
{
    char                  *prompt = NULL ;
    char                   tempBuffer [TERM_LINE] ;
    char                  *cp = ansbuff ;
    char                  *cptr = NULL ;
    i4                     clen ;
    register i4            i ;

    prompt = SEP_MEalloc(SEP_ME_TAG_NODEL, STlength(question)+5, TRUE,
			 (STATUS *) NULL);

    STprintf(prompt, ERx("%s "), question);
    put_message(wndow, prompt);    
    getstr(wndow, tempBuffer, FALSE);

    /* check if continuation character was entered */

    cptr = SEP_CMlastchar(tempBuffer,0);

    if (CMcmpcase(cptr,cont_char) == 0)
    {
	*cptr = EOS;
	STcopy(tempBuffer,cp);

	clen = SEP_CMstlen(tempBuffer,0);
	for (i=0; i<clen; i++)
	    CMnext(cp);

	TDerase(wndow);
	STprintf(tempBuffer, ERx("%s%s"), prompt, ansbuff);
	SEPprintw(wndow, PROMPT_ROW - 1, PROMPT_COL, tempBuffer);
	STprintf(prompt, ERx("%s%s"), question, cont_char);
	SEPprintw(wndow, PROMPT_ROW, PROMPT_COL, prompt);
	TDrefresh(wndow);
	getstr(wndow,tempBuffer,FALSE);

	/* check if continuation character was entered */

	cptr = SEP_CMlastchar(tempBuffer,0);

	if (CMcmpcase(cptr,cont_char) == 0)
	{
	    i4	    temp;

	    *cptr = EOS;
	    STprintf(prompt, ERx("%s %s"), question, tempBuffer);
	    SEPprintw(wndow, PROMPT_ROW, PROMPT_COL, prompt);
	    STcopy(tempBuffer, cp);

	    STprintf(prompt, ERx("%s%s"), question, cont_char);
	    SEPprintw(wndow, PROMPT_ROW + 1, PROMPT_COL, prompt);
	    /*
	    **	ugly fix to prevent the screen from scrolling when
	    **	typing to the last line of the screen. It will hopefully
	    **	be changed in the future for a more elegant solution
	    */
	    temp = LINES;
	    LINES++;
	    TDrefresh(wndow);
	    getstr(wndow, tempBuffer, FALSE);
	    disp_prompt((char *)NULLSTR, (char *)NULL, (char *)NULL);
	    LINES = temp;
	}
    }
    MEfree(prompt);
    STcopy(tempBuffer, cp);
    TDerase(wndow);
    TDrefresh(wndow);
}