Skip to content

Commit

Permalink
Util.mo
Browse files Browse the repository at this point in the history
- fix testsuite on Windows (replace \ with / so relative paths are the same)

Other c files:
- get rid of some warnings
- spell checking

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15127 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Feb 9, 2013
1 parent 119c330 commit f668310
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
18 changes: 16 additions & 2 deletions Compiler/Util/Util.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3707,17 +3707,31 @@ protected function testsuiteFriendly2 "Testsuite friendly name (start after test
input String name;
output String friendly;
algorithm
friendly := match (cond,name)
friendly := matchcontinue (cond,name)
local
Integer i;
list<String> strs;
String newName;

case (true,_)
equation
true = "Windows_NT" ==& System.os();
// replace \\ with / for Windows.
newName = System.stringReplace(name, "\\", "/");
(i,strs) = System.regex(newName, "^(.*/testsuite/)?(.*/build/)?(.*)$", 4, true, false);
friendly = listGet(strs,i);
then
friendly;

case (true,_)
equation
false = "Windows_NT" ==& System.os();
(i,strs) = System.regex(name, "^(.*/testsuite/)?(.*/build/)?(.*)$", 4, true, false);
friendly = listGet(strs,i);
then friendly;

else name;
end match;
end matchcontinue;
end testsuiteFriendly2;

end Util;
4 changes: 2 additions & 2 deletions Compiler/runtime/printimpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
/* adrpo: this is defined in errorext. (enabled with omc +showErrorMessages) */
extern int showErrorMessages;

#define GROWTH_FACTOR 1.4 /* According to some roumours of buffer growth */
#define GROWTH_FACTOR 1.4 /* According to some rumors of buffer growth */
#define INITIAL_BUFSIZE 4000 /* Seems reasonable */
#define MAXSAVEDBUFFERS 10 /* Seems reasonable */
#define MAXSAVEDBUFFERS 10 /* adrpo: added this so it compiles again! MathCore can change it later */

#define buf Print_var_buf
#define errorBuf Print_var_errorBuf
Expand Down
14 changes: 7 additions & 7 deletions SimulationRuntime/c/ModelicaExternalC/ModelicaInternal.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ void ModelicaNotExistError(const char* name) {
# include <direct.h>
# include <sys/types.h>
# include <sys/stat.h>
#if defined(__MINGW32__) /* mingw has dirent */
#include <sys/types.h>
#include <dirent.h>
#else
/* include the opendir/readdir/closedir implementation for _WIN32 */
# include "win32_dirent.c"
#endif
char *realpath(const char *path, char *resolved_path); /* define realpath */
# if defined(__MINGW32__) /* mingw has dirent */
# include <sys/types.h>
# include <dirent.h>
# else /* include the opendir/readdir/closedir implementation for _WIN32 */
# include "win32_dirent.c"
# endif
# elif defined(_POSIX_)
# include <dirent.h>
# include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/util/omc_msvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int asprintf(char **strp, const char *fmt, ...) {

len = vsnprintf(NULL, 0, fmt, ap);
*strp = malloc(len+1);
len = snprintf(strp, len+1, fmt, ap);
len = snprintf(*strp, len+1, fmt, ap);

va_end(ap);
return len;
Expand Down

0 comments on commit f668310

Please sign in to comment.