"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/common.h" between
ragel-7.0.0.10.tar.gz and ragel-7.0.0.11.tar.gz

About: Ragel compiles executable finite state machines from regular languages (C, C++, Obj-C, C#, D, Java, Go and Ruby). Development version.

common.h  (ragel-7.0.0.10):common.h  (ragel-7.0.0.11)
/* /*
* Copyright 2001-2006, 2013 Adrian Thurston <thurston@colm.net> * Copyright 2001-2018 Adrian Thurston <thurston@colm.net>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the * deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is * sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in al l * The above copyright notice and this permission notice shall be included in al l
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
skipping to change at line 32 skipping to change at line 32
#ifndef _COMMON_H #ifndef _COMMON_H
#define _COMMON_H #define _COMMON_H
#include <fstream> #include <fstream>
#include <climits> #include <climits>
#include "dlist.h" #include "dlist.h"
struct colm_location; struct colm_location;
struct InputData;
struct CodeGenData;
struct HostLang;
struct CodeGenArgs;
enum RagelBackend
{
Direct,
Translated
};
enum BackendFeature
{
GotoFeature,
VarFeature
};
#define S8BIT_MIN -128 #define S8BIT_MIN -128
#define S8BIT_MAX 127 #define S8BIT_MAX 127
#define U8BIT_MIN 0 #define U8BIT_MIN 0
#define U8BIT_MAX 255 #define U8BIT_MAX 255
#define S16BIT_MIN -32768 #define S16BIT_MIN -32768
#define S16BIT_MAX 32767 #define S16BIT_MAX 32767
#define U16BIT_MIN 0 #define U16BIT_MIN 0
skipping to change at line 207 skipping to change at line 224
unsigned long long uMinVal; unsigned long long uMinVal;
unsigned long long uMaxVal; unsigned long long uMaxVal;
unsigned int size; unsigned int size;
}; };
struct HostLang struct HostLang
{ {
/* Target language. */ /* Target language. */
enum Lang enum Lang
{ {
C, Asm, C,
}; };
const char *name; const char *name;
const char *arg; const char *arg;
Lang lang; Lang _lang;
HostType *hostTypes; HostType *hostTypes;
int numHostTypes; int numHostTypes;
HostType *defaultAlphType; HostType *defaultAlphType;
bool explicitUnsigned; bool explicitUnsigned;
bool rlhcRequired; bool rlhcRequired;
const char *rlhcArg; const char *rlhcArg;
const char *(*defaultOutFn)( const char *inputFileName );
CodeGenData *(*makeCodeGen)( const HostLang *hostLang, const CodeGenArgs
&args );
RagelBackend backend;
BackendFeature feature;
}; };
extern const HostLang hostLangC; extern const HostLang hostLangC;
extern const HostLang hostLangAsm; extern const HostLang hostLangAsm;
extern const HostLang *hostLangs[]; extern const HostLang *hostLangs[];
extern const int numHostLangs; extern const int numHostLangs;
HostType *findAlphType( const HostLang *hostLang, const char *s1 ); HostType *findAlphType( const HostLang *hostLang, const char *s1 );
HostType *findAlphType( const HostLang *hostLang, const char *s1, const char *s2 ); HostType *findAlphType( const HostLang *hostLang, const char *s1, const char *s2 );
HostType *findAlphTypeInternal( const HostLang *hostLang, const char *s1 ); HostType *findAlphTypeInternal( const HostLang *hostLang, const char *s1 );
const char *c_defaultOutFn( const char *inputFileName );
extern HostType hostTypesC[];
/* An abstraction of the key operators that manages key operations such as /* An abstraction of the key operators that manages key operations such as
* comparison and increment according the signedness of the key. */ * comparison and increment according the signedness of the key. */
struct KeyOps struct KeyOps
{ {
/* Default to signed alphabet. */ /* Default to signed alphabet. */
KeyOps() KeyOps()
: :
isSigned(true) isSigned(true)
{} {}
skipping to change at line 366 skipping to change at line 390
} }
/* Increment. Needed only for ranges. */ /* Increment. Needed only for ranges. */
inline void CondKey::increment() inline void CondKey::increment()
{ {
key = key + 1; key = key + 1;
} }
/* Filter on the output stream that keeps track of the number of lines /* Filter on the output stream that keeps track of the number of lines
* output. */ * output. */
class output_filter : public std::filebuf class output_filter
:
public std::filebuf
{ {
public: public:
output_filter( const char *fileName ) output_filter( const char *fileName )
: :
fileName(fileName), fileName(fileName),
line(1), line(1),
level(0), level(0),
indent(false) indent(false)
{} {}
virtual int sync(); virtual int sync();
virtual std::streamsize xsputn(const char* s, std::streamsize n); virtual std::streamsize xsputn( const char* s, std::streamsize n );
std::streamsize countAndWrite( const char* s, std::streamsize n ); std::streamsize countAndWrite( const char* s, std::streamsize n );
const char *fileName; const char *fileName;
int line; int line;
int level; int level;
bool indent; bool indent;
}; };
class nullbuf
:
public std::streambuf
{
public:
virtual std::streamsize xsputn( const char * s, std::streamsize n )
{ return n; }
virtual int overflow( int c )
{ return 1; }
};
class cfilebuf : public std::streambuf class cfilebuf : public std::streambuf
{ {
public: public:
cfilebuf( char *fileName, FILE* file ) : fileName(fileName), file(file) { } cfilebuf( char *fileName, FILE* file ) : fileName(fileName), file(file) { }
char *fileName; char *fileName;
FILE *file; FILE *file;
int sync() int sync()
{ {
fflush( file ); fflush( file );
skipping to change at line 456 skipping to change at line 494
struct exit_object { }; struct exit_object { };
extern exit_object endp; extern exit_object endp;
void operator<<( std::ostream &out, exit_object & ); void operator<<( std::ostream &out, exit_object & );
enum RagelFrontend enum RagelFrontend
{ {
KelbtBased, KelbtBased,
ReduceBased ReduceBased
}; };
CodeGenData *makeCodeGen( const HostLang *hostLang, const CodeGenArgs &args );
CodeGenData *asm_makeCodeGen( const HostLang *hostLang, const CodeGenArgs &args
);
#endif #endif
 End of changes. 10 change blocks. 
5 lines changed or deleted 48 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)