diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2018-04-09 11:40:54 +0200 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2018-04-09 11:40:54 +0200 |
commit | ba8e3d516afefbb4a43227525ddb6525547a650e (patch) | |
tree | 22348b60954931253c062c79bd3b315e036bc400 | |
parent | e840508c39b8e85328875477bfdbe0417c4e0eb0 (diff) |
added support for tikz editing/parsing
-rw-r--r-- | src/data/edge.cpp | 10 | ||||
-rw-r--r-- | src/data/edge.h | 5 | ||||
-rw-r--r-- | src/data/graph.cpp | 1 | ||||
-rw-r--r-- | src/data/tikzdocument.cpp | 42 | ||||
-rw-r--r-- | src/data/tikzdocument.h | 3 | ||||
-rw-r--r-- | src/data/tikzlexer.l | 2 | ||||
-rw-r--r-- | src/data/tikzparserdefs.h | 2 | ||||
-rw-r--r-- | src/gui/edgeitem.cpp | 13 | ||||
-rw-r--r-- | src/gui/mainmenu.cpp | 11 | ||||
-rw-r--r-- | src/gui/mainmenu.h | 1 | ||||
-rw-r--r-- | src/gui/mainmenu.ui | 9 | ||||
-rw-r--r-- | src/gui/mainwindow.cpp | 37 | ||||
-rw-r--r-- | src/gui/mainwindow.h | 8 | ||||
-rw-r--r-- | src/gui/tikzscene.cpp | 34 | ||||
-rw-r--r-- | src/gui/tikzscene.h | 1 | ||||
-rw-r--r-- | src/tikzit.cpp | 5 | ||||
-rw-r--r-- | tikzlexer.h | 308 |
17 files changed, 392 insertions, 100 deletions
diff --git a/src/data/edge.cpp b/src/data/edge.cpp index 5c49aba..d0f0deb 100644 --- a/src/data/edge.cpp +++ b/src/data/edge.cpp @@ -329,6 +329,16 @@ void Edge::setWeight(float weight) _weight = weight; } +int Edge::tikzLine() const +{ + return _tikzLine; +} + +void Edge::setTikzLine(int tikzLine) +{ + _tikzLine = tikzLine; +} + QPointF Edge::mid() const { return _mid; diff --git a/src/data/edge.h b/src/data/edge.h index f010acd..7df899f 100644 --- a/src/data/edge.h +++ b/src/data/edge.h @@ -57,6 +57,9 @@ public: void setOutAngle(int outAngle); void setWeight(float weight); + int tikzLine() const; + void setTikzLine(int tikzLine); + signals: public slots: @@ -86,6 +89,8 @@ private: QPointF _cp1; QPointF _cp2; QPointF _mid; + + int _tikzLine; }; #endif // EDGE_H diff --git a/src/data/graph.cpp b/src/data/graph.cpp index 33af93d..dec992f 100644 --- a/src/data/graph.cpp +++ b/src/data/graph.cpp @@ -179,6 +179,7 @@ QString Graph::tikz() Edge *e; foreach (e, _edges) { + e->setTikzLine(line); e->updateData(); code << "\t\t\\draw "; diff --git a/src/data/tikzdocument.cpp b/src/data/tikzdocument.cpp index bf39f67..206ec5b 100644 --- a/src/data/tikzdocument.cpp +++ b/src/data/tikzdocument.cpp @@ -17,6 +17,7 @@ TikzDocument::TikzDocument(QObject *parent) : QObject(parent) _fileName = ""; _shortName = ""; _undoStack = new QUndoStack(); + _undoStack->setClean(); } TikzDocument::~TikzDocument() @@ -68,6 +69,8 @@ void TikzDocument::open(QString fileName) foreach (Node *n, _graph->nodes()) n->attachStyle(); foreach (Edge *e, _graph->edges()) e->updateControls(); _parseSuccess = true; + refreshTikz(); + setClean(); } else { delete newGraph; _parseSuccess = false; @@ -78,6 +81,18 @@ void TikzDocument::save() { if (_fileName == "") { saveAs(); } else { + MainWindow *win = tikzit->activeWindow(); + if (win != 0 && !win->tikzScene()->enabled()) { + win->tikzScene()->parseTikz(win->tikzSource()); + if (!win->tikzScene()->enabled()) { + auto resp = QMessageBox::question(0, + tr("Tikz failed to parse"), + tr("Cannot save file with invalid TiKZ source. Revert changes and save?")); + if (resp == QMessageBox::Yes) win->tikzScene()->setEnabled(true); + else return; // ABORT the save + } + } + refreshTikz(); QFile file(_fileName); QFileInfo fi(file); @@ -89,13 +104,23 @@ void TikzDocument::save() { QTextStream stream(&file); stream << _tikz; file.close(); - tikzit->activeWindow()->updateFileName(); + setClean(); } else { QMessageBox::warning(0, "Save Failed", "Could not open file: '" + _fileName + "' for writing."); } } } +bool TikzDocument::isClean() const +{ + return _undoStack->isClean(); +} + +void TikzDocument::setClean() +{ + _undoStack->setClean(); +} + void TikzDocument::setGraph(Graph *graph) { _graph = graph; @@ -103,6 +128,18 @@ void TikzDocument::setGraph(Graph *graph) } void TikzDocument::saveAs() { + MainWindow *win = tikzit->activeWindow(); + if (win != 0 && !win->tikzScene()->enabled()) { + win->tikzScene()->parseTikz(win->tikzSource()); + if (!win->tikzScene()->enabled()) { + auto resp = QMessageBox::question(0, + tr("Tikz failed to parse"), + tr("Cannot save file with invalid TiKZ source. Revert changes and save?")); + if (resp == QMessageBox::Yes) win->tikzScene()->setEnabled(true); + else return; // ABORT the save + } + } + QSettings settings("tikzit", "tikzit"); QString fileName = QFileDialog::getSaveFileName(tikzit->activeWindow(), tr("Save File As"), @@ -112,6 +149,9 @@ void TikzDocument::saveAs() { if (!fileName.isEmpty()) { _fileName = fileName; save(); + + // clean state might not change, so update title bar manually + tikzit->activeWindow()->updateFileName(); } } diff --git a/src/data/tikzdocument.h b/src/data/tikzdocument.h index 9b6893a..8f16a53 100644 --- a/src/data/tikzdocument.h +++ b/src/data/tikzdocument.h @@ -32,6 +32,9 @@ public: void saveAs(); void save(); + bool isClean() const; + void setClean(); + private: Graph *_graph; QString _tikz; diff --git a/src/data/tikzlexer.l b/src/data/tikzlexer.l index 0a7ff39..d90ad4b 100644 --- a/src/data/tikzlexer.l +++ b/src/data/tikzlexer.l @@ -97,7 +97,7 @@ to { return TO; } } <ycoord>\) { BEGIN(INITIAL); - return COORD; + return TCOORD; } /* when we see "[", change parsing mode */ diff --git a/src/data/tikzparserdefs.h b/src/data/tikzparserdefs.h index 1625136..5865739 100644 --- a/src/data/tikzparserdefs.h +++ b/src/data/tikzparserdefs.h @@ -17,6 +17,6 @@ struct noderef { char *anchor; }; -inline int isatty(void*) { return 0; } +inline int isatty(int) { return 0; } #endif // TIKZPARSERDEFS_H diff --git a/src/gui/edgeitem.cpp b/src/gui/edgeitem.cpp index 04ee7b6..f174186 100644 --- a/src/gui/edgeitem.cpp +++ b/src/gui/edgeitem.cpp @@ -34,9 +34,16 @@ void EdgeItem::readPos() QPainterPath path; path.moveTo (toScreen(_edge->tail())); - path.cubicTo(toScreen(_edge->cp1()), - toScreen(_edge->cp2()), - toScreen(_edge->head())); + + if (_edge->bend() != 0 || !_edge->basicBendMode()) { + path.cubicTo(toScreen(_edge->cp1()), + toScreen(_edge->cp2()), + toScreen(_edge->head())); + } + else { + path.lineTo(toScreen(_edge->head())); + } + setPath(path); _cp1Item->setPos(toScreen(_edge->cp1())); diff --git a/src/gui/mainmenu.cpp b/src/gui/mainmenu.cpp index 7ebb6af..7e2584c 100644 --- a/src/gui/mainmenu.cpp +++ b/src/gui/mainmenu.cpp @@ -1,6 +1,8 @@ #include "mainmenu.h" #include "tikzit.h" +#include <QDebug> + MainMenu::MainMenu() { ui.setupUi(this); @@ -109,6 +111,15 @@ void MainMenu::on_actionRevert_triggered() } } +void MainMenu::on_actionJump_to_Selection_triggered() +{ + MainWindow *win = tikzit->activeWindow(); + if (win != 0) { + qDebug() << "jump to selection on line:" << win->tikzScene()->lineNumberForSelection(); + win->setSourceLine(win->tikzScene()->lineNumberForSelection()); + } +} + // View void MainMenu::on_actionZoom_In_triggered() diff --git a/src/gui/mainmenu.h b/src/gui/mainmenu.h index 103a74a..bceb69d 100644 --- a/src/gui/mainmenu.h +++ b/src/gui/mainmenu.h @@ -36,6 +36,7 @@ public slots: // Tikz void on_actionParse_triggered(); void on_actionRevert_triggered(); + void on_actionJump_to_Selection_triggered(); // View void on_actionZoom_In_triggered(); diff --git a/src/gui/mainmenu.ui b/src/gui/mainmenu.ui index ccd6c38..6a2511e 100644 --- a/src/gui/mainmenu.ui +++ b/src/gui/mainmenu.ui @@ -44,6 +44,7 @@ </property> <addaction name="actionParse"/> <addaction name="actionRevert"/> + <addaction name="actionJump_to_Selection"/> </widget> <widget class="QMenu" name="menuView"> <property name="title"> @@ -190,6 +191,14 @@ <string>Revert Tikz</string> </property> </action> + <action name="actionJump_to_Selection"> + <property name="text"> + <string>Jump to Selection</string> + </property> + <property name="shortcut"> + <string>Ctrl+J</string> + </property> + </action> <addaction name="menuFile"/> <addaction name="menuEdit"/> <addaction name="menuView"/> diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 9436eb3..15b6943 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -13,6 +13,7 @@ #include <QMessageBox> #include <QFileDialog> #include <QTextEdit> +#include <QTextBlock> int MainWindow::_numWindows = 0; @@ -32,15 +33,9 @@ MainWindow::MainWindow(QWidget *parent) : _stylePalette = new StylePalette(this); addDockWidget(Qt::RightDockWidgetArea, _stylePalette); - - _tikzScene = new TikzScene(_tikzDocument, _toolPalette, _stylePalette, this); ui->tikzView->setScene(_tikzScene); - - _pristine = true; - - // TODO: check if each window should have a menu _menu = new MainMenu(); _menu->setParent(this); @@ -52,6 +47,10 @@ MainWindow::MainWindow(QWidget *parent) : sz[0] = sz[0] + sz[1]; sz[1] = 0; ui->splitter->setSizes(sz); + + _tikzDocument->refreshTikz(); + + connect(_tikzDocument->undoStack(), SIGNAL(cleanChanged(bool)), this, SLOT(updateFileName())); } MainWindow::~MainWindow() @@ -62,15 +61,16 @@ MainWindow::~MainWindow() void MainWindow::open(QString fileName) { - _pristine = false; _tikzDocument->open(fileName); - ui->tikzSource->setText(_tikzDocument->tikz()); + + //ui->tikzSource->setText(_tikzDocument->tikz()); if (_tikzDocument->parseSuccess()) { statusBar()->showMessage("TiKZ parsed successfully", 2000); - setWindowTitle("TiKZiT - " + _tikzDocument->shortName()); + //setWindowTitle("TiKZiT - " + _tikzDocument->shortName()); _tikzScene->setTikzDocument(_tikzDocument); + updateFileName(); } else { statusBar()->showMessage("Cannot read TiKZ source"); } @@ -102,9 +102,21 @@ QString MainWindow::tikzSource() return ui->tikzSource->toPlainText(); } +void MainWindow::setSourceLine(int line) +{ + QTextCursor cursor(ui->tikzSource->document()->findBlockByLineNumber(line)); + cursor.movePosition(QTextCursor::EndOfLine); + //ui->tikzSource->moveCursor(QTextCursor::End); + ui->tikzSource->setTextCursor(cursor); + ui->tikzSource->setFocus(); +} + void MainWindow::updateFileName() { - setWindowTitle("TiKZiT - " + _tikzDocument->shortName()); + QString nm = _tikzDocument->shortName(); + if (nm.isEmpty()) nm = "untitled"; + if (!_tikzDocument->isClean()) nm += "*"; + setWindowTitle("TiKZiT - " + nm); } void MainWindow::refreshTikz() @@ -140,11 +152,6 @@ TikzView *MainWindow::tikzView() const return ui->tikzView; } -bool MainWindow::pristine() const -{ - return _pristine; -} - void MainWindow::on_tikzSource_textChanged() { if (_tikzScene->enabled()) _tikzScene->setEnabled(false); diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index dc69fbc..1e05239 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -29,7 +29,6 @@ public: ~MainWindow(); void open(QString fileName); - bool pristine() const; int windowId() const; TikzView *tikzView() const; TikzScene *tikzScene() const; @@ -37,12 +36,12 @@ public: ToolPalette *toolPalette() const; StylePalette *stylePalette() const; QString tikzSource(); - - void updateFileName(); - void refreshTikz(); + void setSourceLine(int line); public slots: void on_tikzSource_textChanged(); + void updateFileName(); + void refreshTikz(); protected: void closeEvent(QCloseEvent *event); void changeEvent(QEvent *event); @@ -54,7 +53,6 @@ private: ToolPalette *_toolPalette; StylePalette *_stylePalette; Ui::MainWindow *ui; - bool _pristine; int _windowId; static int _numWindows; }; diff --git a/src/gui/tikzscene.cpp b/src/gui/tikzscene.cpp index a650961..b26c4ba 100644 --- a/src/gui/tikzscene.cpp +++ b/src/gui/tikzscene.cpp @@ -20,6 +20,7 @@ TikzScene::TikzScene(TikzDocument *tikzDocument, ToolPalette *tools, _edgeStartNodeItem = 0; _drawEdgeItem = new QGraphicsLineItem(); _rubberBandItem = new QGraphicsRectItem(); + _enabled = true; //setSceneRect(-310,-230,620,450); setSceneRect(-1000,-1000,2000,2000); @@ -72,6 +73,7 @@ void TikzScene::graphReplaced() } foreach (Node *n, graph()->nodes()) { + n->attachStyle(); NodeItem *ni = new NodeItem(n); _nodeItems.insert(n, ni); addItem(ni); @@ -366,19 +368,25 @@ void TikzScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) _rubberBandItem->setVisible(false); if (!_oldNodePositions.empty()) { - QMap<Node*,QPointF> newNodePositions; + QPointF shift = mousePos - _mouseDownPos; + shift = QPointF(round(shift.x()/GRID_SEP)*GRID_SEP, round(shift.y()/GRID_SEP)*GRID_SEP); - foreach (QGraphicsItem *gi, selectedItems()) { - if (NodeItem *ni = dynamic_cast<NodeItem*>(gi)) { - ni->writePos(); - newNodePositions.insert(ni->node(), ni->node()->point()); + if (shift.x() != 0 || shift.y() != 0) { + QMap<Node*,QPointF> newNodePositions; + + foreach (QGraphicsItem *gi, selectedItems()) { + if (NodeItem *ni = dynamic_cast<NodeItem*>(gi)) { + ni->writePos(); + newNodePositions.insert(ni->node(), ni->node()->point()); + } } - } - //qDebug() << _oldNodePositions; - //qDebug() << newNodePositions; + //qDebug() << _oldNodePositions; + //qDebug() << newNodePositions; + + _tikzDocument->undoStack()->push(new MoveCommand(this, _oldNodePositions, newNodePositions)); + } - _tikzDocument->undoStack()->push(new MoveCommand(this, _oldNodePositions, newNodePositions)); _oldNodePositions.clear(); } } @@ -483,6 +491,14 @@ void TikzScene::setEnabled(bool enabled) update(); } +int TikzScene::lineNumberForSelection() +{ + foreach (QGraphicsItem *gi, selectedItems()) { + if (NodeItem *ni = dynamic_cast<NodeItem*>(gi)) return ni->node()->tikzLine(); + if (EdgeItem *ei = dynamic_cast<EdgeItem*>(gi)) return ei->edge()->tikzLine(); + } +} + void TikzScene::applyActiveStyleToNodes() { ApplyStyleToNodesCommand *cmd = new ApplyStyleToNodesCommand(this, _styles->activeNodeStyleName()); diff --git a/src/gui/tikzscene.h b/src/gui/tikzscene.h index 3cc2e87..3b4a1e1 100644 --- a/src/gui/tikzscene.h +++ b/src/gui/tikzscene.h @@ -47,6 +47,7 @@ public: void parseTikz(QString tikz); bool enabled() const; void setEnabled(bool enabled); + int lineNumberForSelection(); public slots: void graphReplaced(); diff --git a/src/tikzit.cpp b/src/tikzit.cpp index e91976c..a55473e 100644 --- a/src/tikzit.cpp +++ b/src/tikzit.cpp @@ -92,7 +92,10 @@ void Tikzit::open() tr("TiKZ Files (*.tikz)")); if (!fileName.isEmpty()) { - if (_windows.size() == 1 && _windows[0]->pristine()) { + if (_windows.size() == 1 && + _windows[0]->tikzDocument()->isClean() && + _windows[0]->tikzDocument()->shortName().isEmpty()) + { _windows[0]->open(fileName); _windows[0]->show(); } else { diff --git a/tikzlexer.h b/tikzlexer.h index 73df7b6..0275165 100644 --- a/tikzlexer.h +++ b/tikzlexer.h @@ -2,9 +2,9 @@ #define yyHEADER_H 1 #define yyIN_HEADER 1 -#line 6 "tikzlexer.h" +#line 5 "tikzlexer.h" -#line 8 "tikzlexer.h" +#line 7 "tikzlexer.h" #define YY_INT_ALIGNED short int @@ -12,12 +12,36 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yyget_lval +#define yyget_lval_ALREADY_DEFINED +#else +#define yyget_lval yyget_lval +#endif + +#ifdef yyset_lval +#define yyset_lval_ALREADY_DEFINED +#else +#define yyset_lval yyset_lval +#endif + +#ifdef yyget_lloc +#define yyget_lloc_ALREADY_DEFINED +#else +#define yyget_lloc yyget_lloc +#endif + +#ifdef yyset_lloc +#define yyset_lloc_ALREADY_DEFINED +#else +#define yyset_lloc yyset_lloc +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -51,7 +75,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -59,7 +82,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -90,27 +112,23 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) +#endif /* ! C99 */ -#define YY_USE_CONST +#endif /* ! FLEXINT_H */ -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +/* begin standard C++ headers. */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* An opaque pointer. */ @@ -132,7 +150,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE @@ -157,12 +183,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -185,7 +211,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -196,23 +222,23 @@ struct yy_buffer_state }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ -void yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void yypop_buffer_state (yyscan_t yyscanner ); +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); -void *yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void yyfree (void * ,yyscan_t yyscanner ); +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); -#define yywrap(n) 1 +#define yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -233,49 +259,53 @@ void yyfree (void * ,yyscan_t yyscanner ); */ #include <unistd.h> #endif - + #define YY_EXTRA_TYPE TikzAssembler * int yylex_init (yyscan_t* scanner); -int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy (yyscan_t yyscanner ); +int yylex_destroy ( yyscan_t yyscanner ); + +int yyget_debug ( yyscan_t yyscanner ); + +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); -int yyget_debug (yyscan_t yyscanner ); +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); -void yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); -YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); +FILE *yyget_in ( yyscan_t yyscanner ); -void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); -FILE *yyget_in (yyscan_t yyscanner ); +FILE *yyget_out ( yyscan_t yyscanner ); -void yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); -FILE *yyget_out (yyscan_t yyscanner ); + int yyget_leng ( yyscan_t yyscanner ); -void yyset_out (FILE * out_str ,yyscan_t yyscanner ); +char *yyget_text ( yyscan_t yyscanner ); -yy_size_t yyget_leng (yyscan_t yyscanner ); +int yyget_lineno ( yyscan_t yyscanner ); -char *yyget_text (yyscan_t yyscanner ); +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); -int yyget_lineno (yyscan_t yyscanner ); +int yyget_column ( yyscan_t yyscanner ); -void yyset_lineno (int line_number ,yyscan_t yyscanner ); +void yyset_column ( int _column_no , yyscan_t yyscanner ); -YYSTYPE * yyget_lval (yyscan_t yyscanner ); +YYSTYPE * yyget_lval ( yyscan_t yyscanner ); -void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); +void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); - YYLTYPE *yyget_lloc (yyscan_t yyscanner ); + YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); - void yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -283,18 +313,18 @@ void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (yyscan_t yyscanner ); +extern "C" int yywrap ( yyscan_t yyscanner ); #else -extern int yywrap (yyscan_t yyscanner ); +extern int yywrap ( yyscan_t yyscanner ); #endif #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT @@ -303,7 +333,12 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Number of entries by which start-condition stack grows. */ @@ -318,7 +353,7 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #define YY_DECL_IS_OURS 1 extern int yylex \ - (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); #define YY_DECL int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) @@ -338,8 +373,153 @@ extern int yylex \ #undef YY_DECL #endif -#line 188 "src/data/tikzlexer.l" +#ifndef yy_create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef yy_delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef yy_scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef yy_scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef yy_scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef yy_init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef yy_flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef yy_load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef yy_switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef yypush_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef yypop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef yyensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef yylex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef yyrestart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef yylex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef yylex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef yylex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef yyget_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef yyset_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef yyget_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef yyset_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef yyget_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef yyset_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef yyget_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef yyset_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef yyget_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef yyget_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef yyget_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef yyset_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef yyget_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef yyset_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef yywrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef yyget_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef yyset_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef yyget_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef yyset_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef yyalloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef yyrealloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef yyfree_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef yytext_ALREADY_DEFINED +#undef yytext +#endif +#ifndef yyleng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef yyin_ALREADY_DEFINED +#undef yyin +#endif +#ifndef yyout_ALREADY_DEFINED +#undef yyout +#endif +#ifndef yy_flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef yylineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef yytables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef yytables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef yyTABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#line 191 "src\\data\\tikzlexer.l" -#line 344 "tikzlexer.h" +#line 523 "tikzlexer.h" #undef yyIN_HEADER #endif /* yyHEADER_H */ |