Skip to content

Commit

Permalink
Add return code to genere
Browse files Browse the repository at this point in the history
Genere tool now returns EXIT_SUCCESS or EXIT_FAILURE.

Clean code from _imp__JNI_CreateJavaVM (previoulsy used to avoid linking with java, now deprecated)
- genere.cpp
- MODL_dll.cpp
- MODL_Coclustering_dll.cpp
  • Loading branch information
marcboulle committed Oct 4, 2023
1 parent 43f66b1 commit 3c3314f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 121 deletions.
34 changes: 0 additions & 34 deletions src/Learning/MODL/MODL_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,37 +99,3 @@ KHIOPS_API int StartKhiops(const char* sInputScenario, const char* sLogFileName,
delete[] argv;
return EXIT_SUCCESS;
}

/********************************************************************
* Le source suivant permet de compiler des sources developpes avec *
* l'environnement Norm, d'utiliser le mode UIObject::Textual et *
* de ne pas linker avec jvm.lib (a eviter absoluement). *
* Moyennant ces conditions, on peut livrer un executable en mode *
* textuel ne necessitant pas l'installation prealable du JRE Java *
********************************************************************/

extern "C"
{
#ifdef _WIN32
// Version 32 bits
int __stdcall _imp__JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}

// Version 64 bits
int __stdcall __imp_JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}
#else

#ifndef __ANDROID__
int JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}
#endif // __ANDROID__

#endif // _WIN32
}
34 changes: 0 additions & 34 deletions src/Learning/MODL_Coclustering/MODL_Coclustering_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,37 +93,3 @@ KHIOPS_COCLUSTERING_API int StartKhiopsCoclustering(const char* sInputScenario,
delete[] argv;
return EXIT_SUCCESS;
}

/********************************************************************
* Le source suivant permet de compiler des sources developpes avec *
* l'environnement Norm, d'utiliser le mode UIObject::Textual et *
* de ne pas linker avec jvm.lib (a eviter absoluement). *
* Moyennant ces conditions, on peut livrer un executable en mode *
* textuel ne necessitant pas l'installation prealable du JRE Java *
********************************************************************/

extern "C"
{
#ifdef _WIN32
// Version 32 bits
int __stdcall _imp__JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}

// Version 64 bits
int __stdcall __imp_JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}
#else

#ifndef __ANDROID__
int JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}
#endif // __ANDROID__

#endif // _WIN32
}
79 changes: 26 additions & 53 deletions src/Norm/genere/genere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ void CommandLineError()
cout << "\t -outputdir <DirName>\n";
cout << "\t ouput directory for generation (default: current directory)";
cout << endl;
exit(0);
}

void Genere(int argc, char** argv)
int Genere(int argc, char** argv)
{
boolean bOk = true;
TableGenerator tgTest;
ALString sOption;
ALString sClassName;
Expand Down Expand Up @@ -82,72 +82,45 @@ void Genere(int argc, char** argv)
cout << "ouputdir <" << tgTest.GetOutputDir()
<< "> is not a valid directory\n";
CommandLineError();
bOk = false;
break;
}
}
}
else
{
cout << sOption << " is not a valid option\n";
CommandLineError();
bOk = false;
break;
}
}
sClassName = argv[argc - 3];
sClassUserLabel = argv[argc - 2];
sAttributeFileName = argv[argc - 1];
cout << "Genere " << sClassName << " " << sClassUserLabel << " " << sAttributeFileName << endl;
tgTest.GenereWith(sClassName, sSpecificModelClassName, sSuperClassName, sClassUserLabel,
sAttributeFileName);
cout << endl;
if (bOk)
{
sClassName = argv[argc - 3];
sClassUserLabel = argv[argc - 2];
sAttributeFileName = argv[argc - 1];
cout << "Genere " << sClassName << " " << sClassUserLabel << " " << sAttributeFileName << endl;
tgTest.GenereWith(sClassName, sSpecificModelClassName, sSuperClassName, sClassUserLabel,
sAttributeFileName);
cout << endl;
}
}
else
{
CommandLineError();
bOk = false;
}

// On renvoie 0 si tout s'est bien passe, 1 si il y eu au moins une erreur
if (not bOk or Global::IsAtLeastOneError())
return EXIT_FAILURE;
else
return EXIT_SUCCESS;
}

// Portage unix void->int
int main(int argc, char** argv)
{
Genere(argc, argv);
return 0;
}

/********************************************************************
* Le source suivant permet de compiler des sources developpes avec *
* l'environnement Norm, d'utiliser le mode UIObject::Textual et *
* de ne pas linker avec jvm.lib (a eviter absoluement). *
* Moyennant ces conditions, on peut livrer un executable en mode *
* textuel ne necessitant pas l'installation prealable du JRE Java *
********************************************************************/

extern "C"
{
#ifdef _WIN32
// Version 32 bits
int __stdcall _imp__JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}
int __stdcall _imp__JNI_GetCreatedJavaVMs(void**, long, long*)
{
exit(11);
}

// Version 64 bits
int __stdcall __imp_JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}
int __stdcall __imp_JNI_GetCreatedJavaVMs(void**, long, long*)
{
exit(11);
}
#else
int JNI_CreateJavaVM(void** pvm, void** penv, void* args)
{
exit(11);
}
int JNI_GetCreatedJavaVMs(void** pvm, void** penv, void* args)
{
exit(11);
}
#endif // _WIN32
return Genere(argc, argv);
}

0 comments on commit 3c3314f

Please sign in to comment.