#define BUFSIZE 1024
-void test( char *buf )
+void test( const char *buf )
{
CallTest test;
%% write data noerror;
-void test( int i, int j, char *str )
+void test( int i, int j, const char *str )
{
int cs = foo_start;
- char *p = str;
- char *pe = str + strlen( str );
+ const char *p = str;
+ const char *pe = str + strlen( str );
cout << "run:" << endl;
%% write exec;
%% write data noerror;
-void test( char *str )
+void test( const char *str )
{
int cs = foo_start;
int c = 0;
- char *p = str;
- char *pe = str + strlen( str );
+ const char *p = str;
+ const char *pe = str + strlen( str );
cout << "run:" << endl;
%% write exec;
write data noerror;
}%%
-void test( char *str )
+void test( const char *str )
{
int cs = foo_start;
int c = 0;
- char *p = str;
- char *pe = str + strlen( str );
+ const char *p = str;
+ const char *pe = str + strlen( str );
char last = '0';
cout << "run:";
write data noerror;
}%%
-void test( char *str )
+void test( const char *str )
{
int cs = cond_start, n = 0;
- char *p = str;
- char *pe = str + strlen( str );
+ const char *p = str;
+ const char *pe = str + strlen( str );
%%{
comment = '(' @{n=0;}
#define _CPPSCAN1_H
#include <iostream>
+#include <malloc.h>
+#include <string.h>
using namespace std;
// the data, the machine is in the error state and can never accept, 0 if
// the machine is in a non-accepting state and 1 if the machine is in an
// accepting state.
- int execute( char *data, int len );
+ int execute( const char *data, int len );
// Indicate that there is no more data. Returns -1 if the machine finishes
// in the error state and does not accept, 0 if the machine finishes
%% write init;
}
-int Scanner::execute( char *data, int len )
+int Scanner::execute( const char *data, int len )
{
Scanner *fsm = this;
- char *p = data;
- char *pe = data + len;
- char *eof = pe;
+ const char *p = data;
+ const char *pe = data + len;
+ const char *eof = pe;
%% write exec;
if ( cs == Scanner_error )
allocated = len;
}
-void test( char *buf )
+void test( const char *buf )
{
Scanner scanner(cout);
scanner.init();
*/
#include <iostream>
+#include <string.h>
using namespace std;
#define TK_Dlit 192
#define BUFSIZE 4096
int tok;
-char buf[BUFSIZE], *tokstart, *tokend;
-void token( char *data, int len );
+char buf[BUFSIZE];
+const char *tokstart, *tokend;
+void token( const char *data, int len );
bool discard = false;
struct Scanner
// the data, the machine is in the error state and can never accept, 0 if
// the machine is in a non-accepting state and 1 if the machine is in an
// accepting state.
- int execute( char *data, int len );
+ int execute( const char *data, int len );
// Indicate that there is no more data. Returns -1 if the machine finishes
// in the error state and does not accept, 0 if the machine finishes
action onError {
if ( tok != 0 ) {
- char *rst_data;
+ const char *rst_data;
if ( tok == TK_Comment || tok == TK_Whitespace ) {
/* Reset comment status, don't send. */
return 1;
}
-int Scanner::execute( char *data, int len )
+int Scanner::execute( const char *data, int len )
{
- char *p = data;
- char *pe = data + len;
- char *eof = pe;
+ const char *p = data;
+ const char *pe = data + len;
+ const char *eof = pe;
%% write exec;
}
-void token( char *data, int len )
+void token( const char *data, int len )
{
cout << "<" << tok << "> ";
for ( int i = 0; i < len; i++ )
cout << '\n';
}
-void test( char * data )
+void test( const char * data )
{
Scanner scanner;
scanner.init();
struct Scanner
{
int cs, act;
- char *tokstart, *tokend;
+ const char *tokstart, *tokend;
void token( int tok );
void run();
void init( );
- void execute( char *data, int len );
+ void execute( const char *data, int len );
int finish( );
};
/* Returns the count of bytes still in the buffer
* (shifted to the biginning) */
-void Scanner::execute( char *data, int len )
+void Scanner::execute( const char *data, int len )
{
- char *p = data;
- char *pe = data + len;
- char *eof = pe;
+ const char *p = data;
+ const char *pe = data + len;
+ const char *eof = pe;
%% write exec;
cout << '\n';
}
-void test( char *buf )
+void test( const char *buf )
{
int len = strlen( buf );
std::ios::sync_with_stdio(false);
struct LangEl
{
int key;
- char *name;
+ const char *name;
};
struct Fsm
#define BUFSIZE 1024
-void test( char *buf )
+void test( const char *buf )
{
ErrAct errAct;
errAct.init();
struct Scanner
{
int cs, act;
- char *tokstart, *tokend;
+ const char *tokstart, *tokend;
bool isCxx;
void token( int tok );
- void run( char *buf );
+ void run( const char *buf );
};
cout << '\n';
}
-void Scanner::run( char *buf )
+void Scanner::run( const char *buf )
{
int len = strlen( buf );
%% write init;
- char *p = buf;
- char *pe = buf + len;
- char *eof = pe;
+ const char *p = buf;
+ const char *pe = buf + len;
+ const char *eof = pe;
%% write exec;
if ( cs == Scanner_error ) {
// the data, the machine is in the error state and can never accept, 0 if
// the machine is in a non-accepting state and 1 if the machine is in an
// accepting state.
- void execute( char *data, int len );
+ void execute( const char *data, int len );
// Indicate that there is no more data. Returns -1 if the machine finishes
// in the error state and does not accept, 0 if the machine finishes
%% write init;
}
-void MBox::execute( char *data, int len )
+void MBox::execute( const char *data, int len )
{
MBox *fsm = this;
- char *p = data;
- char *pe = data + len;
+ const char *p = data;
+ const char *pe = data + len;
%%{
access fsm->;
write exec;
MBox mbox;
-void test( char *buf )
+void test( const char *buf )
{
int len = strlen( buf );
mbox.init();
#define BUFSIZE 8192
-void test( char *buf )
+void test( const char *buf )
{
int cs, len = strlen( buf );
- char *preserve = 0, *ws = 0;
+ const char *preserve = 0, *ws = 0;
%% write init;
- char *p = buf;
- char *pe = p + len;
+ const char *p = buf;
+ const char *pe = p + len;
%% write exec;
if ( cs == mailbox_error )
#define BUFSIZE 8192
-void test( char *buf )
+void test( const char *buf )
{
int cs, len = strlen( buf );
- char *preserve = 0, *ws = 0;
+ const char *preserve = 0, *ws = 0;
int hlen = 0;
%% write init;
- char *p = buf;
- char *pe = p + len;
+ const char *p = buf;
+ const char *pe = p + len;
%% write exec;
if ( cs < mailbox_first_final ) {
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
using namespace std;
return 0;
}
-void test( char *buf )
+void test( const char *buf )
{
Rep rep;
int len = strlen( buf );
using namespace std;
-void escapeXML( char *data )
+void escapeXML( const char *data )
{
while ( *data != 0 ) {
switch ( *data ) {
}
}
-void escapeXML( char *data, int len )
+void escapeXML( const char *data, int len )
{
- for ( char *end = data + len; data != end; data++ ) {
+ for ( const char *end = data + len; data != end; data++ ) {
switch ( *data ) {
case '<': cout << "<"; break;
case '>': cout << ">"; break;
}
}
-inline void write( char *data )
+inline void write( const char *data )
{
cout << data;
}
cout << c;
}
-inline void write( char *data, int len )
+inline void write( const char *data, int len )
{
cout.write( data, len );
}
%% write data nofinal;
-void test( char *data )
+void test( const char *data )
{
std::ios::sync_with_stdio(false);
int cs, act;
- char *tokstart, *tokend;
+ const char *tokstart, *tokend;
int stack[1], top;
bool single_line = false;
%% write init;
/* Read in a block. */
- char *p = data;
- char *pe = data + strlen( data );
- char *eof = pe;
+ const char *p = data;
+ const char *pe = data + strlen( data );
+ const char *eof = pe;
%% write exec;
if ( cs == RagelScan_error ) {
[ -z "$allow_minflags" ] && allow_minflags="-n -m -l -e"
case $lang in
- c|obj-c|c++|d)
+ c|c++|d)
# Using genflags, get the allowed gen flags from the test case. If the
# test case doesn't specify assume that all gen flags are allowed.
allow_genflags=`sed '/@ALLOW_GENFLAGS:/s/^.*: *//p;d' $test_case`
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
using namespace std;
return 0;
}
-void test( char *buf )
+void test( const char *buf )
{
Concurrent concurrent;
concurrent.init();