Esempio n. 1
0
R_API RCons *r_cons_free () {
	if (I.line) {
		r_line_free (I.line);
		I.line = NULL;
	}
	if (I.buffer) {
		free (I.buffer);
		I.buffer = NULL;
	}
	return NULL;
}
Esempio n. 2
0
R_API RCons *r_cons_free () {
	I.refcnt--;
	if (I.refcnt != 0)
		return NULL;
	if (I.line) {
		r_line_free ();
		I.line = NULL;
	}
	if (I.buffer) {
		free (I.buffer);
		I.buffer = NULL;
	}
	return NULL;
}
Esempio n. 3
0
R_API RCons *r_cons_free() {
	I.refcnt--;
	if (I.refcnt != 0) {
		return NULL;
	}
	r_cons_pal_free ();
	if (I.line) {
		r_line_free ();
		I.line = NULL;
	}
	if (I.buffer) {
		free (I.buffer);
		I.buffer = NULL;
	}
	r_stack_free (I.cons_stack);	
	return NULL;
}
Esempio n. 4
0
int main() {
	const char *str;
	RLine *line = r_line_new ();
	r_cons_new ();
	line->completion.run = (RLineCallback) complete;
#if 0
	if (!r_line_init ()) {
		printf ("Cannot initizalize r_line\n");
		return 0;
	}
#endif
	for (;;) {
		str = r_line_readline (0, NULL);
		if (str == NULL) // catch eof
			break;
		printf ("%s\n", str);
		r_line_hist_add (str);
	}
	r_line_free ();
	return 0;
}