Browse code

TM callbacks, acc, flags

Jiri Kuthan authored on 13/05/2002 01:15:40
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,28 +0,0 @@
1
-/*
2
- * $Id$
3
- *
4
- * parser helper  functions
5
- *
6
- */
7
-
8
-#include  "parser_f.h"
9
-#include "ut.h"
10
-
11
-/* returns pointer to next line or after the end of buffer */
12
-char* eat_line(char* buffer, unsigned int len)
13
-{
14
-	char* nl;
15
-	char c;
16
-
17
-	/* jku .. replace for search with a library function; not conformant
18
- 		  as I do not care about CR
19
-	*/
20
-	nl=(char *)q_memchr( buffer, '\n', len );
21
-	if ( nl ) { 
22
-		c=* nl;
23
-		if ( nl + 1 < buffer+len)  nl++;
24
-		if (( nl+1<buffer+len) && * nl=='\r')  nl++;
25
-	} else  nl=buffer+len;
26
-	return nl;
27
-}
28
-
Browse code

#define clean-up

Jiri Kuthan authored on 05/12/2001 23:00:08
Showing 1 changed files
... ...
@@ -17,69 +17,12 @@ char* eat_line(char* buffer, unsigned int len)
17 17
 	/* jku .. replace for search with a library function; not conformant
18 18
  		  as I do not care about CR
19 19
 	*/
20
-#ifdef NOCR
21 20
 	nl=(char *)q_memchr( buffer, '\n', len );
22 21
 	if ( nl ) { 
23 22
 		c=* nl;
24 23
 		if ( nl + 1 < buffer+len)  nl++;
25 24
 		if (( nl+1<buffer+len) && * nl=='\r')  nl++;
26 25
 	} else  nl=buffer+len;
27
-#else
28
-	for(nl=buffer;(nl<buffer+len)&& (*nl!='\r')&&(*nl!='\n') ;nl++);
29
-	c=*nl;
30
-	if (nl+1<buffer+len)  nl++;
31
-	if ((nl+1<buffer+len) &&
32
-			((c=='\r' && *nl=='\n')|| (c=='\n' && *nl=='\r'))) 
33
-		nl++;
34
-#endif
35
-	
36
-	/* end of jku */
37 26
 	return nl;
38 27
 }
39 28
 
40
-
41
-
42
-/* returns pointer to first non  white char or after the end  of the buffer */
43
-
44
-/* MACROEATER no more optional */
45
-
46
-/*
47
-#ifndef MACROEATER
48
-
49
-char* eat_space(char* buffer, unsigned int len)
50
-{
51
-	char* p;
52
-
53
-	for(p=buffer;(p<buffer+len)&& (*p==' ' || *p=='\t') ;p++);
54
-	return p;
55
-}
56
-
57
-
58
-// returns pointer after the token (first whitespace char or CR/LF) 
59
-char* eat_token(char* buffer, unsigned int len)
60
-{
61
-	char *p;
62
-
63
-	for (p=buffer;(p<buffer+len)&&
64
-			(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r');
65
-		p++);
66
-	return p;
67
-}
68
-
69
-
70
-
71
-// returns pointer after the token (first delim char or CR/LF)
72
-char* eat_token2(char* buffer, unsigned int len, char delim)
73
-{
74
-	char *p;
75
-
76
-	for (p=buffer;(p<buffer+len)&&
77
-			(*p!=delim)&&(*p!='\n')&&(*p!='\r');
78
-		p++);
79
-	return p;
80
-}
81
-#endif
82
-*/
83
-
84
-/* EoMACROEATER */
85
-
Browse code

port numbers different now for remote and local

Jiri Kuthan authored on 20/11/2001 06:26:49
Showing 1 changed files
... ...
@@ -41,6 +41,9 @@ char* eat_line(char* buffer, unsigned int len)
41 41
 
42 42
 /* returns pointer to first non  white char or after the end  of the buffer */
43 43
 
44
+/* MACROEATER no more optional */
45
+
46
+/*
44 47
 #ifndef MACROEATER
45 48
 
46 49
 char* eat_space(char* buffer, unsigned int len)
... ...
@@ -52,7 +55,7 @@ char* eat_space(char* buffer, unsigned int len)
52 55
 }
53 56
 
54 57
 
55
-/* returns pointer after the token (first whitespace char or CR/LF) */
58
+// returns pointer after the token (first whitespace char or CR/LF) 
56 59
 char* eat_token(char* buffer, unsigned int len)
57 60
 {
58 61
 	char *p;
... ...
@@ -65,7 +68,7 @@ char* eat_token(char* buffer, unsigned int len)
65 68
 
66 69
 
67 70
 
68
-/* returns pointer after the token (first delim char or CR/LF) */
71
+// returns pointer after the token (first delim char or CR/LF)
69 72
 char* eat_token2(char* buffer, unsigned int len, char delim)
70 73
 {
71 74
 	char *p;
... ...
@@ -75,18 +78,8 @@ char* eat_token2(char* buffer, unsigned int len, char delim)
75 78
 		p++);
76 79
 	return p;
77 80
 }
78
-
79
-/* EoMACROEATER */
80 81
 #endif
82
+*/
81 83
 
84
+/* EoMACROEATER */
82 85
 
83
-
84
-/* returns true if line started  at buffer contains only white space */
85
-int is_empty(char* buffer, unsigned int len)
86
-{
87
-	char *p;
88
-	
89
-	p=eat_space(buffer, len);
90
-	if ((p < buffer+len ) && (*p=='\r' || *p=='\n')) return 1;
91
-	return 0;
92
-}
Browse code

- replaced memchr w/ q_memchr (inline version).

Andrei Pelinescu-Onciul authored on 16/11/2001 00:20:54
Showing 1 changed files
... ...
@@ -6,6 +6,7 @@
6 6
  */
7 7
 
8 8
 #include  "parser_f.h"
9
+#include "ut.h"
9 10
 
10 11
 /* returns pointer to next line or after the end of buffer */
11 12
 char* eat_line(char* buffer, unsigned int len)
... ...
@@ -17,7 +18,7 @@ char* eat_line(char* buffer, unsigned int len)
17 18
  		  as I do not care about CR
18 19
 	*/
19 20
 #ifdef NOCR
20
-	nl=(char *)memchr( buffer, '\n', len );
21
+	nl=(char *)q_memchr( buffer, '\n', len );
21 22
 	if ( nl ) { 
22 23
 		c=* nl;
23 24
 		if ( nl + 1 < buffer+len)  nl++;
Browse code

Added NOCR and MACROEATER compile-time speed-up options. NOCR replaces a 'for' cycle with 'memchr' and MACROEATER replaces 'eater' functions with macros. The -V command-line options shows now which of these options are enabled. A signal handler is added which calls exit(0) on INT signal ... good for profiling.

-Jiri

Jiri Kuthan authored on 06/10/2001 22:17:53
Showing 1 changed files
... ...
@@ -13,18 +13,35 @@ char* eat_line(char* buffer, unsigned int len)
13 13
 	char* nl;
14 14
 	char c;
15 15
 
16
+	/* jku .. replace for search with a library function; not conformant
17
+ 		  as I do not care about CR
18
+	*/
19
+#ifdef NOCR
20
+	nl=(char *)memchr( buffer, '\n', len );
21
+	if ( nl ) { 
22
+		c=* nl;
23
+		if ( nl + 1 < buffer+len)  nl++;
24
+		if (( nl+1<buffer+len) && * nl=='\r')  nl++;
25
+	} else  nl=buffer+len;
26
+#else
16 27
 	for(nl=buffer;(nl<buffer+len)&& (*nl!='\r')&&(*nl!='\n') ;nl++);
17 28
 	c=*nl;
18 29
 	if (nl+1<buffer+len)  nl++;
19 30
 	if ((nl+1<buffer+len) &&
20 31
 			((c=='\r' && *nl=='\n')|| (c=='\n' && *nl=='\r'))) 
21 32
 		nl++;
33
+#endif
34
+	
35
+	/* end of jku */
22 36
 	return nl;
23 37
 }
24 38
 
25 39
 
26 40
 
27 41
 /* returns pointer to first non  white char or after the end  of the buffer */
42
+
43
+#ifndef MACROEATER
44
+
28 45
 char* eat_space(char* buffer, unsigned int len)
29 46
 {
30 47
 	char* p;
... ...
@@ -34,7 +51,6 @@ char* eat_space(char* buffer, unsigned int len)
34 51
 }
35 52
 
36 53
 
37
-
38 54
 /* returns pointer after the token (first whitespace char or CR/LF) */
39 55
 char* eat_token(char* buffer, unsigned int len)
40 56
 {
... ...
@@ -59,6 +75,9 @@ char* eat_token2(char* buffer, unsigned int len, char delim)
59 75
 	return p;
60 76
 }
61 77
 
78
+/* EoMACROEATER */
79
+#endif
80
+
62 81
 
63 82
 
64 83
 /* returns true if line started  at buffer contains only white space */
Browse code

- small bug fixes - now works with the 3com sip phone

Andrei Pelinescu-Onciul authored on 05/09/2001 18:55:40
Showing 1 changed files
... ...
@@ -7,7 +7,7 @@
7 7
 
8 8
 #include  "parser_f.h"
9 9
 
10
-/* returns pointer to next line or end of buffer */
10
+/* returns pointer to next line or after the end of buffer */
11 11
 char* eat_line(char* buffer, unsigned int len)
12 12
 {
13 13
 	char* nl;
... ...
@@ -24,7 +24,7 @@ char* eat_line(char* buffer, unsigned int len)
24 24
 
25 25
 
26 26
 
27
-/* returns pointer to first non  white char or to the end  of the buffer */
27
+/* returns pointer to first non  white char or after the end  of the buffer */
28 28
 char* eat_space(char* buffer, unsigned int len)
29 29
 {
30 30
 	char* p;
Browse code

Initial revision

Andrei Pelinescu-Onciul authored on 03/09/2001 21:27:11
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,72 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * parser helper  functions
5
+ *
6
+ */
7
+
8
+#include  "parser_f.h"
9
+
10
+/* returns pointer to next line or end of buffer */
11
+char* eat_line(char* buffer, unsigned int len)
12
+{
13
+	char* nl;
14
+	char c;
15
+
16
+	for(nl=buffer;(nl<buffer+len)&& (*nl!='\r')&&(*nl!='\n') ;nl++);
17
+	c=*nl;
18
+	if (nl+1<buffer+len)  nl++;
19
+	if ((nl+1<buffer+len) &&
20
+			((c=='\r' && *nl=='\n')|| (c=='\n' && *nl=='\r'))) 
21
+		nl++;
22
+	return nl;
23
+}
24
+
25
+
26
+
27
+/* returns pointer to first non  white char or to the end  of the buffer */
28
+char* eat_space(char* buffer, unsigned int len)
29
+{
30
+	char* p;
31
+
32
+	for(p=buffer;(p<buffer+len)&& (*p==' ' || *p=='\t') ;p++);
33
+	return p;
34
+}
35
+
36
+
37
+
38
+/* returns pointer after the token (first whitespace char or CR/LF) */
39
+char* eat_token(char* buffer, unsigned int len)
40
+{
41
+	char *p;
42
+
43
+	for (p=buffer;(p<buffer+len)&&
44
+			(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r');
45
+		p++);
46
+	return p;
47
+}
48
+
49
+
50
+
51
+/* returns pointer after the token (first delim char or CR/LF) */
52
+char* eat_token2(char* buffer, unsigned int len, char delim)
53
+{
54
+	char *p;
55
+
56
+	for (p=buffer;(p<buffer+len)&&
57
+			(*p!=delim)&&(*p!='\n')&&(*p!='\r');
58
+		p++);
59
+	return p;
60
+}
61
+
62
+
63
+
64
+/* returns true if line started  at buffer contains only white space */
65
+int is_empty(char* buffer, unsigned int len)
66
+{
67
+	char *p;
68
+	
69
+	p=eat_space(buffer, len);
70
+	if ((p < buffer+len ) && (*p=='\r' || *p=='\n')) return 1;
71
+	return 0;
72
+}