Example #1
0
STATUS
s_srem_set()
{
    char	*s;
    char	*send;
    i4		pos;
    i4		n;
    char	short_remark[OOSHORTREMSIZE+1];

    if (St_sr_given)
    {
	s_error(0x3A8, NONFATAL, NULL);
	s_cmd_skip();
	return FAIL;
    }
    if (Cact_ren == NULL)
    {
	    s_error(0x38A, FATAL, NULL);
    }

    St_sr_given = TRUE;

    Tokchar++;
    while (CMspace(Tokchar) || *Tokchar == '\t')
    {
	CMnext(Tokchar);
    }

    s = short_remark;
    send = s + OOSHORTREMSIZE;
    while (*Tokchar != '\n' && *Tokchar != EOS)
    {
        if (s <= send-CMbytecnt(Tokchar))
	{
	    if (*Tokchar == '\t')
	    {
		/* if tab, replace it with the one blank */
		*s = ' ';
		s++;
		Tokchar++;
	    }
	    else
	    {
		CMcpyinc(Tokchar, s);
	    }
	}
	else
	{
	    CMnext(Tokchar);
	}
    }

    *s = EOS;
    Cact_ren->ren_shortrem = STalloc(short_remark);

    return OK;
}
Example #2
0
VOID
s_break()
{
	/* internal declarations */

	i4		tok_type;		/* next token type */
	i4		rtn_char;		/*
						** dummy variable for s_g_skip()
						** and real variable for
						** s_g_ident().
						*/
	char		*name;			/* break name */
	bool		err;
	char		nrml_buf[(FE_MAXNAME + 1)];

	/* start of routine */

	if (St_b_given)
	{
		s_error(0x3A6, NONFATAL, NULL);
		s_cmd_skip();
		return;
	}
	St_b_given = TRUE;

	save_em();		/* store aside the values of Command fields */

	/* Initialize the fields in Command */

	STcopy(NAM_BREAK, Ctype);
	STcopy(ERx(" "), Csection);
	STcopy(ERx(" "), Ccommand);
	if (Cact_ren == NULL)
	{
		s_error(0x38A, FATAL, NULL);
	}

	Csequence = Cact_ren->ren_bcount;

	err = FALSE;
	while (!err)
	{
		tok_type = s_g_skip(TRUE, &rtn_char);

		switch (tok_type)
		{
			case TK_ENDFILE:
			case TK_PERIOD:
				goto allexit;

			case TK_COMMA:
				break;

			case TK_ALPHA:
			case TK_QUOTE:
			case TK_DOLLAR:
				if (tok_type == TK_ALPHA)
				{
					name = s_g_ident(FALSE,&rtn_char,
							 FALSE);
					if  (rtn_char != UI_REG_ID)
					{
						s_error(0x39D,NONFATAL,
							name,NULL);
						s_cmd_skip();
						err = TRUE;
						break;
					}
					IIUGdbo_dlmBEobject(name,FALSE);
				}
				else if (tok_type == TK_QUOTE)	/* Delim ID */
				{
					if  (!St_xns_given)
					{
						s_error(0x39D,NONFATAL,
							name,NULL);
						s_cmd_skip();
						err = TRUE;
						break;
					}
					name = s_g_ident(FALSE,&rtn_char,
							 FALSE);
					if  (rtn_char != UI_DELIM_ID)
					{
						s_error(0x39D,NONFATAL,
							name,NULL);
						s_cmd_skip();
						err = TRUE;
						break;
					}
					_VOID_ IIUGdlm_ChkdlmBEobject(name,
								&nrml_buf[0],
								FALSE);
					name = &nrml_buf[0];
				}
				else
				{
					name = s_g_name(FALSE);
					IIUGdbo_dlmBEobject(name,FALSE);
				}
				if (s_sbr_find(name) != NULL)
				{	/* already specified */
					s_error(0x39E, NONFATAL, name, NULL);
					s_cmd_skip();
					err = TRUE;
					break;
				}

				/* name not specified.	Add it */

				s_sbr_add(name);
				STcopy(name,Cattid);
				_VOID_ s_w_row();
				break;

			default:
				s_error(0x39D, NONFATAL, NULL);
				s_cmd_skip();
				err = TRUE;
				break;

		}
	}

    allexit:
	get_em();
}
Example #3
0
STATUS
s_lrem_set()
{
    char	*b;
    char	*bend;
    i4		pos;
    i4		n;
    i4		length;
    # ifdef UNIX
    char	word[OOLONGREMSIZE+1]; 
    # else
    char        word[MAXCMD+1];
    # endif
    i4		code;
    i4		count;
    char	*save_Tokchar;
    char	long_remark[OOLONGREMSIZE+1];
    i4          rtn_char;               /* dummy variable for sgskip */

    if (St_lr_given)
    {
	s_error(0x3A9, NONFATAL, NULL);
	s_cmd_skip();
	return FAIL;
    }
    if (Cact_ren == NULL)
    {
	    s_error(0x38A, FATAL, NULL);
    }
    St_lr_given = TRUE;

    /* skip leading white space */

    s_g_skip(TRUE, &rtn_char);

    /* handle rest of remark up to the .ENDREMARK */

    code = S_ERROR;
    b = long_remark;
    bend = b + OOLONGREMSIZE;

    for (;;)
    {
	while (*Tokchar != '\n' && *Tokchar != EOS)
	{
	    if (*Tokchar == '.' && CMalpha(Tokchar+1))
	    {
		/* check for .ENDREMARK */

		save_Tokchar = Tokchar;
		Tokchar++;
		r_gt_word(word);
		CVlower(word);
		code = s_get_scode(word);
		if (code == S_ENDREMARK)
		{
		    break;
		}
		else
		{
		    Tokchar = save_Tokchar;
		}
	    }

	    if (b <= bend-CMbytecnt(Tokchar))
	    {
		if (*Tokchar == '\t')
		{
			/* if tab, replace it with the one blank */
			*b = ' ';
			b++;
			Tokchar++;
		}
		else
		{
		    CMcpyinc(Tokchar, b);
		}
	    }
	    else
	    {
		CMnext(Tokchar);
	    }
	}

	if (code == S_ENDREMARK)
	{
	    *b = EOS;
	    Cact_ren->ren_longrem = STalloc(long_remark);
	    break;
	}
	else
	{
	    if (b < bend)
	    {
	        *b++ = ' ';
	    }
	    count = s_next_line();
	    if (count == 0)
	    {
		/* ERROR: EOF in middle of remark */
		s_error(0x3A3, FATAL, NULL);
		break;
	    }
	}
    }

    return OK;
}