casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ds9lex.h
Go to the documentation of this file.
00001 #ifndef DISPLAY_DS9_DS9LEX_H_
00002 #define DISPLAY_DS9_DS9LEX_H_
00003 
00004 // Flex expects the signature of yylex to be defined in the macro YY_DECL, and
00005 // the C++ parser expects it to be declared. We can factor both as follows.
00006 #ifndef YY_DECL
00007 
00008 #define YY_DECL                                                                 \
00009     casa::viewer::ds9parse::token_type                                          \
00010     casa::viewer::ds9lex::lex( casa::viewer::ds9parse::semantic_type* yylval,   \
00011                                casa::viewer::ds9parse::location_type* yylloc    \
00012                              )
00013 #endif
00014 
00015 // including without guard results in yyFlexLexer being multiply defined when
00016 // compiling the scanner...
00017 #ifndef __FLEX_LEXER_H
00018 #define yyFlexLexer ds9lex_FlexLexer
00019 #include <display/ds9/ds9FlexLexer.h>
00020 #undef yyFlexLexer
00021 #endif
00022 
00023 #include <display/ds9/ds9context.h>
00024 #include <display/ds9/ds9parse.hh>
00025 
00026 namespace casa {
00027     namespace viewer {
00028 
00029         class Region;
00030 
00031         // Scanner is a derived class to add some extra function to the scanner
00032         // class. Flex itself creates a class named yyFlexLexer, which is renamed using
00033         // macros to ds9lex_FlexLexer. However we change the context of the generated
00034         // yylex() function to be contained within the ds9lex class. This is required
00035         // because the yylex() defined in ds9lex_display/ds9/ds9FlexLexer.has no parameters. */
00036         class ds9lex : public ds9lex_FlexLexer {
00037             public:
00038                 // Create a new scanner object. The streams arg_yyin and arg_yyout default
00039                 // to cin and cout, but that assignment is only made when initializing in
00040                 // yylex().
00041                 ds9lex( std::istream* yyin=0, std::ostream* yyout=0 ) : ds9lex_FlexLexer( yyin, yyout ) { }
00042                 ~ds9lex( ) { }
00043 
00044                 // This is the main lexing function. It is generated by flex according to
00045                 // the macro declaration YY_DECL above. The generated bison parser then
00046                 // calls this virtual function to fetch new tokens.
00047                 virtual ds9parse::token_type lex( ds9parse::semantic_type* yylval, ds9parse::location_type* yylloc );
00048 
00049                 void begin(int,int);
00050 
00051                 // Enable debug output (via arg_yyout) if compiled into the scanner.
00052                 void set_debug(bool b);
00053 
00054                 void discard( int );
00055         };
00056     }
00057 }
00058 
00059 
00060 class CallBack {
00061     public:
00062         enum { SELECTCB, UNSELECTCB, HIGHLITECB, UNHIGHLITECB,
00063                MOVEBEGINCB, MOVECB, MOVEENDCB, EDITBEGINCB,
00064                EDITCB, EDITENDCB, ROTATEBEGINCB, ROTATECB,
00065                ROTATEENDCB, DELETECB, TEXTCB, COLORCB,
00066                LINEWIDTHCB, PROPERTYCB, FONTCB, KEYCB,
00067                UPDATECB
00068         };
00069 };
00070 
00071 class Marker {
00072     public:
00073         // Select-- user may select the marker
00074         // Highlite-- user may highlite the marker
00075         // Edit-- user may edit the marker
00076         // Move-- user may move the marker
00077         // Rotate-- user may rotate the marker
00078         // Delete-- user may delete the marker
00079         // Fixed-- marker is fixed in size (not scaled based on zoom)
00080         // Include-- marker is 'included' or 'excluded' ie '+' or '-'
00081         // Source-- marker is a 'source' or 'background' marker
00082         // Dash-- render with dashed line
00083         enum Property { NONE=0, SELECT=1, HIGHLITE=2, EDIT=4, MOVE=8, ROTATE=16, 
00084                         DELETE=32, FIXED=64, INCLUDE=128, SOURCE=256, DASH=512 };
00085 };
00086 
00087 
00088 typedef std::list<casa::viewer::Region*> bison_region_list;
00089 #endif