Example #1
0
File: mem.c Project: Ntools/n
int markcpy(void)
{
	unsigned char *p,buf[BUFSIZ];
	SCRN *lp;
	int i;
	extern posflag;

	posflag= ON;
	if((lp = search_mark()) == NULL) {
		msg("Can't store to buffer !!");
		return(NG);
	}
	if(lp->num > line->num) {
		msg("Illegal oparation");
		return(NG);
	}
	markcp = lp;
	p = &lp->buffer[mark.posx];
	cutcnt= 0;
	cutcpy("");
	while(memerr == OK) {
		for(i = 0;*p != '\0' && p != &line->buffer[curposx];++i,++p) buf[i] = *p;
		if(p != &line->buffer[curposx]) buf[i++] = '\n';
		buf[i] = '\0';
		cutcat(buf); ++cutcnt;
		if(lp == line) break;
		lp= lp->fwd; p= lp->buffer;
		if(lp == NULL) {
			msg("Can't store to buffer !!");
			return(NG);
		}
	}
	return(NG);
}
Example #2
0
// --------------------------------------------------------------------------
int DecoderPE::find_burst(int *burst_start)
{
	int preamble_start = 0;
	int mark_start = 0;
	int preamble_result = B_FAIL;
	int mark_result = B_FAIL;

	while (1) {
		int pulse_start;
		int pulse = td->read(&pulse_start, td->cfg.deskew, td->cfg.edge_sens);
		if (pulse < VT_OK) {
			return pulse;
		}

		mark_result = search_mark(pulse, pulse_start);
		preamble_result = search_preamble(pulse, pulse_start);

		if (preamble_result == B_CONT) {
			if (!preamble_start) {
				preamble_start = pulse_start;
			}
		} else if (preamble_result == B_DONE) {
			*burst_start = preamble_start;
			return C_BLOCK;
		}

		if (mark_result == B_CONT) {
			if (!mark_start) {
				mark_start = pulse_start;
			}
		} else if (mark_result == B_DONE) {
			*burst_start = mark_start;
			return C_MARK;
		}
	}

	return VT_OK;
}