Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Lex and Yac compilation CMake config errors on Windows #193

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/actions/test-khiops-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ runs:
touch test/LearningTest/TestCoclustering/Standard/Iris/results/time.log
touch test/LearningTest/TestKhiops/Standard/Iris/results/time.log
echo "Check test results"
cd test/LearningTest/cmd/python/
$PYTHON test_khiops.py Khiops nul Standard
$PYTHON test_khiops.py Coclustering nul Standard
$PYTHON apply_command.py errors ../../TestKhiops/Standard/ Iris | tee /tmp/khiops-log.txt
$PYTHON apply_command.py errors ../../TestCoclustering/Standard/ Iris | tee /tmp/coclustering-log.txt
cd test/LearningTestTool/py/
$PYTHON kht_test.py ../../LearningTest/TestKhiops/Standard/Iris check
$PYTHON kht_test.py ../../LearningTest/TestCoclustering/Standard/Iris check
$PYTHON kht_apply.py ../../LearningTest/TestKhiops/Standard/Iris errors | tee /tmp/khiops-log.txt
$PYTHON kht_apply.py ../../LearningTest/TestCoclustering/Standard/Iris errors | tee /tmp/khiops-log.txt
if (grep -q error /tmp/khiops-log.txt || grep -q error /tmp/coclustering-log.txt); then
echo "::error::Errors in Khiops run"
false
Expand Down
4 changes: 2 additions & 2 deletions src/Learning/KWData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
if(BUILD_LEX_YACC)
bison_target(KWCParser KWCYac.yac ${CMAKE_CURRENT_SOURCE_DIR}/KWCYac.cpp)
if(MSVC)
flex_target(KWCScanner KWCLex.lex KWCLex.inc COMPILE_FLAGS-- nounistd)
flex_target(JsonScanner JsonLex.lex JsonLex.inc COMPILE_FLAGS-- nounistd)
flex_target(KWCScanner KWCLex.lex KWCLex.inc COMPILE_FLAGS "--nounistd")
flex_target(JsonScanner JsonLex.lex JsonLex.inc COMPILE_FLAGS "--nounistd")
else()
flex_target(KWCScanner KWCLex.lex KWCLex.inc)
flex_target(JsonScanner JsonLex.lex JsonLex.inc)
Expand Down
47 changes: 22 additions & 25 deletions src/Learning/KWData/JsonLex.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#line 1 "JsonLex.inc"
#line 1 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/JsonLex.inc"

#line 3 "JsonLex.inc"
#line 3 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/JsonLex.inc"

#define YY_INT_ALIGNED short int

Expand Down Expand Up @@ -769,9 +769,6 @@ char *yytext;
#include <stdlib.h>
#include "JSONTokenizer.h"

// TODO MB: A tester pour mieux personnaliser la prise en compte de flex et bison dans Visual C++
// https://sourceforge.net/p/winflexbison/wiki/Visual%20Studio%20custom%20build%20rules/

// Valeur des tokens
static ALString sJsonTokenString;
static ALString sJsonTokenStringCopy;
Expand All @@ -783,9 +780,9 @@ static boolean bJsonTokenBoolean = false;
#pragma warning(disable : 4505) // C4505: la fonction locale non référencée a été supprimée
#pragma warning(disable : 4996) // C4996: warning for deprecated POSIX names isatty and fileno
#endif // __MSC__
#line 786 "JsonLex.inc"
#line 783 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/JsonLex.inc"
/* pour avoir acces aux numeros de lignes, et moins cher que le -l de la ligne de commande */
#line 788 "JsonLex.inc"
#line 785 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/JsonLex.inc"

#define INITIAL 0

Expand Down Expand Up @@ -994,10 +991,10 @@ YY_DECL
}

{
#line 45 "JsonLex.lex"
#line 42 "JsonLex.lex"


#line 1000 "JsonLex.inc"
#line 997 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/JsonLex.inc"

while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
Expand Down Expand Up @@ -1066,53 +1063,53 @@ do_action: /* This label is used only to access EOF actions. */

case 1:
YY_RULE_SETUP
#line 47 "JsonLex.lex"
#line 44 "JsonLex.lex"
{return '{';}
YY_BREAK
case 2:
YY_RULE_SETUP
#line 48 "JsonLex.lex"
#line 45 "JsonLex.lex"
{return '}';}
YY_BREAK
case 3:
YY_RULE_SETUP
#line 49 "JsonLex.lex"
#line 46 "JsonLex.lex"
{return '[';}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 50 "JsonLex.lex"
#line 47 "JsonLex.lex"
{return ']';}
YY_BREAK
case 5:
YY_RULE_SETUP
#line 51 "JsonLex.lex"
#line 48 "JsonLex.lex"
{return ',';}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 52 "JsonLex.lex"
#line 49 "JsonLex.lex"
{return ':';}
YY_BREAK
case 7:
YY_RULE_SETUP
#line 53 "JsonLex.lex"
#line 50 "JsonLex.lex"
{bJsonTokenBoolean = true; return JSONTokenizer::Boolean;}
YY_BREAK
case 8:
YY_RULE_SETUP
#line 54 "JsonLex.lex"
#line 51 "JsonLex.lex"
{bJsonTokenBoolean = false; return JSONTokenizer::Boolean;}
YY_BREAK
case 9:
YY_RULE_SETUP
#line 55 "JsonLex.lex"
#line 52 "JsonLex.lex"
{return JSONTokenizer::Null;}
YY_BREAK
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
#line 59 "JsonLex.lex"
#line 56 "JsonLex.lex"
{
yytext[yyleng-1] = '\0';
JSONTokenizer::JsonToCString((char*)&yytext[1], sJsonTokenString);
Expand All @@ -1129,7 +1126,7 @@ YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
#line 73 "JsonLex.lex"
#line 70 "JsonLex.lex"
{
cJsonTokenDouble = KWContinuous::StringToContinuous((char*)yytext);
return(JSONTokenizer::Number);
Expand All @@ -1138,20 +1135,20 @@ YY_RULE_SETUP
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
#line 78 "JsonLex.lex"
#line 75 "JsonLex.lex"
{/*IGNORE*/}
YY_BREAK
case 13:
YY_RULE_SETUP
#line 80 "JsonLex.lex"
#line 77 "JsonLex.lex"
{sJsonTokenString = yytext; return JSONTokenizer::Error;}
YY_BREAK
case 14:
YY_RULE_SETUP
#line 82 "JsonLex.lex"
#line 79 "JsonLex.lex"
ECHO;
YY_BREAK
#line 1154 "JsonLex.inc"
#line 1151 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/JsonLex.inc"
case YY_STATE_EOF(INITIAL):
yyterminate();

Expand Down Expand Up @@ -2168,5 +2165,5 @@ void yyfree (void * ptr )

#define YYTABLES_NAME "yytables"

#line 82 "JsonLex.lex"
#line 79 "JsonLex.lex"

3 changes: 0 additions & 3 deletions src/Learning/KWData/JsonLex.lex
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#include <stdlib.h>
#include "JSONTokenizer.h"

// TODO MB: A tester pour mieux personnaliser la prise en compte de flex et bison dans Visual C++
// https://sourceforge.net/p/winflexbison/wiki/Visual%20Studio%20custom%20build%20rules/

// Valeur des tokens
static ALString sJsonTokenString;
static ALString sJsonTokenStringCopy;
Expand Down
12 changes: 6 additions & 6 deletions src/Learning/KWData/KWCLex.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#line 1 "KWCLex.inc"
#line 1 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/KWCLex.inc"

#line 3 "KWCLex.inc"
#line 3 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/KWCLex.inc"

#define YY_INT_ALIGNED short int

Expand Down Expand Up @@ -568,11 +568,11 @@ char *yytext;
#undef YYLMAX
#define YYLMAX 100000 /* token and pushback buffer size */

#line 571 "KWCLex.inc"
#line 571 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/KWCLex.inc"
/* pour avoir acces aux numeros de lignes, et moins cher que le -l de la ligne de commande */
/* Attention, la liste des mots cles du langage doit etre reprise dans la methode KWClass::IsStringKeyWord() */
/* si on veut autoriser des noms de variable en collision avec ces mots cles. */
#line 575 "KWCLex.inc"
#line 575 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/KWCLex.inc"

#define INITIAL 0

Expand Down Expand Up @@ -784,7 +784,7 @@ YY_DECL
#line 31 "KWCLex.lex"


#line 787 "KWCLex.inc"
#line 787 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/KWCLex.inc"

while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
Expand Down Expand Up @@ -1191,7 +1191,7 @@ YY_RULE_SETUP
#line 299 "KWCLex.lex"
ECHO;
YY_BREAK
#line 1194 "KWCLex.inc"
#line 1194 "D:/Users/miib6422/Documents/boullema/DevGit/khiops/src/Learning/KWData/KWCLex.inc"
case YY_STATE_EOF(INITIAL):
yyterminate();

Expand Down
Loading
Loading