Skip to content

Commit

Permalink
- Removed the static keywords from the ModelicaExternalC C-files inst…
Browse files Browse the repository at this point in the history
…ead of using preprocessor macros since that messes with OSX

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11051 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 9, 2012
1 parent fdb8583 commit 35b0ff2
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion SimulationRuntime/c/ModelicaExternalC/Makefile.in
Expand Up @@ -7,7 +7,7 @@
CC = @CC@
CXX = @CXX@
CFLAGS := @CFLAGS@ -I../util
CPPFLAGS := @CPPFLAGS@ -I.. -Dlinux -Dstatic=
CPPFLAGS := @CPPFLAGS@ -I.. -Dlinux

include Makefile.common

Expand Down
86 changes: 43 additions & 43 deletions SimulationRuntime/c/ModelicaExternalC/ModelicaInternal.c
Expand Up @@ -50,7 +50,7 @@
#include <string.h>
#include "ModelicaUtilities.h"

static void ModelicaNotExistError(const char* name) {
void ModelicaNotExistError(const char* name) {
/* Print error message if a function is not implemented */
ModelicaFormatError("C-Function \"%s\" is called\n"
"but is not implemented for the actual environment\n"
Expand All @@ -59,41 +59,41 @@ static void ModelicaNotExistError(const char* name) {
}

#if NO_FILE_SYSTEM
static void ModelicaInternal_mkdir(const char* directoryName) {
void ModelicaInternal_mkdir(const char* directoryName) {
ModelicaNotExistError("ModelicaInternal_mkdir"); }
static void ModelicaInternal_rmdir(const char* directoryName) {
void ModelicaInternal_rmdir(const char* directoryName) {
ModelicaNotExistError("ModelicaInternal_rmdir"); }
static int ModelicaInternal_stat(const char* name) {
int ModelicaInternal_stat(const char* name) {
ModelicaNotExistError("ModelicaInternal_stat"); return 0; }
static void ModelicaInternal_rename(const char* oldName, const char* newName) {
void ModelicaInternal_rename(const char* oldName, const char* newName) {
ModelicaNotExistError("ModelicaInternal_rename"); }
static void ModelicaInternal_removeFile(const char* file) {
void ModelicaInternal_removeFile(const char* file) {
ModelicaNotExistError("ModelicaInternal_removeFile"); }
static void ModelicaInternal_copyFile(const char* oldFile, const char* newFile) {
void ModelicaInternal_copyFile(const char* oldFile, const char* newFile) {
ModelicaNotExistError("ModelicaInternal_copyFile"); }
static void ModelicaInternal_readDirectory(const char* directory, int nFiles, const char* files[]) {
void ModelicaInternal_readDirectory(const char* directory, int nFiles, const char* files[]) {
ModelicaNotExistError("ModelicaInternal_readDirectory"); }
static int ModelicaInternal_getNumberOfFiles(const char* directory) {
int ModelicaInternal_getNumberOfFiles(const char* directory) {
ModelicaNotExistError("ModelicaInternal_getNumberOfFiles"); return 0; }
static const char* ModelicaInternal_fullPathName(const char* name) {
const char* ModelicaInternal_fullPathName(const char* name) {
ModelicaNotExistError("ModelicaInternal_fullPathName"); return 0; }
static const char* ModelicaInternal_temporaryFileName() {
const char* ModelicaInternal_temporaryFileName() {
ModelicaNotExistError("ModelicaInternal_temporaryFileName"); return 0; }
static void ModelicaInternal_print(const char* string, const char* fileName) {
void ModelicaInternal_print(const char* string, const char* fileName) {
ModelicaNotExistError("ModelicaInternal_print"); }
static int ModelicaInternal_countLines(const char* fileName) {
int ModelicaInternal_countLines(const char* fileName) {
ModelicaNotExistError("ModelicaInternal_countLines"); return 0; }
static void ModelicaInternal_readFile(const char* fileName, const char* string[], size_t nLines) {
void ModelicaInternal_readFile(const char* fileName, const char* string[], size_t nLines) {
ModelicaNotExistError("ModelicaInternal_readFile"); }
static const char* ModelicaInternal_readLine(const char* fileName, int lineNumber, int* endOfFile) {
const char* ModelicaInternal_readLine(const char* fileName, int lineNumber, int* endOfFile) {
ModelicaNotExistError("ModelicaInternal_readLine"); return 0; }
static void ModelicaInternal_chdir(const char* directoryName) {
void ModelicaInternal_chdir(const char* directoryName) {
ModelicaNotExistError("ModelicaInternal_chdir"); }
static const char* ModelicaInternal_getcwd(int dummy) {
const char* ModelicaInternal_getcwd(int dummy) {
ModelicaNotExistError("ModelicaInternal_getcwd"); return 0; }
static const char* ModelicaInternal_getenv(const char* name, int convertToSlash, int* exist) {
const char* ModelicaInternal_getenv(const char* name, int convertToSlash, int* exist) {
ModelicaNotExistError("ModelicaInternal_getenv"); return 0; }
static void ModelicaInternal_setenv(const char* name, const char* value, int convertFromSlash) {
void ModelicaInternal_setenv(const char* name, const char* value, int convertFromSlash) {
ModelicaNotExistError("ModelicaInternal_setenv"); }
#else

Expand Down Expand Up @@ -121,7 +121,7 @@ static void ModelicaNotExistError(const char* name) {
# endif

#define BUFFER_LENGTH 1000
static char buffer[BUFFER_LENGTH]; /* Buffer for temporary storage */
char buffer[BUFFER_LENGTH]; /* Buffer for temporary storage */

typedef enum {
FileType_NoFile = 1,
Expand All @@ -134,7 +134,7 @@ typedef enum {

/* Convert to Unix directory separators: */
#if defined(_WIN32)
static void ModelicaConvertToUnixDirectorySeparator(char* string) {
void ModelicaConvertToUnixDirectorySeparator(char* string) {
/* convert to Unix directory separators */
char* c = string;
while ( *c ) {
Expand All @@ -143,7 +143,7 @@ typedef enum {
}
};

static void ModelicaConvertFromUnixDirectorySeparator(char* string) {
void ModelicaConvertFromUnixDirectorySeparator(char* string) {
/* convert from Unix directory separators */
char* c = string;
while ( *c ) {
Expand All @@ -159,7 +159,7 @@ typedef enum {

/* --------------------- Modelica_Utilities.Internal --------------------------------- */

static void ModelicaInternal_mkdir(const char* directoryName)
void ModelicaInternal_mkdir(const char* directoryName)
{
/* Create directory */

Expand All @@ -179,7 +179,7 @@ static void ModelicaInternal_mkdir(const char* directoryName)
}


static void ModelicaInternal_rmdir(const char* directoryName)
void ModelicaInternal_rmdir(const char* directoryName)
{
#if defined(__WATCOMC__)
int result = rmdir(directoryName);
Expand All @@ -199,7 +199,7 @@ static void ModelicaInternal_rmdir(const char* directoryName)
}


static int ModelicaInternal_stat(const char* name)
int ModelicaInternal_stat(const char* name)
{
/* Inquire type of file */
ModelicaFileType type = FileType_NoFile;
Expand Down Expand Up @@ -234,7 +234,7 @@ static int ModelicaInternal_stat(const char* name)



static void ModelicaInternal_rename(const char* oldName, const char* newName) {
void ModelicaInternal_rename(const char* oldName, const char* newName) {
/* Changes the name of a file or of a directory */

if ( rename(oldName, newName) != 0 ) {
Expand All @@ -244,7 +244,7 @@ static void ModelicaInternal_rename(const char* oldName, const char* newName) {
}


static void ModelicaInternal_removeFile(const char* file) {
void ModelicaInternal_removeFile(const char* file) {
/* Remove file. */
if ( remove(file) != 0 ) {
ModelicaFormatError("Not possible to remove file \"%s\":\n%s",
Expand All @@ -254,7 +254,7 @@ static void ModelicaInternal_removeFile(const char* file) {



static void ModelicaInternal_copyFile(const char* oldFile, const char* newFile) {
void ModelicaInternal_copyFile(const char* oldFile, const char* newFile) {
/* Copy file */
#ifdef _WIN32
const char* modeOld = "rb";
Expand Down Expand Up @@ -307,7 +307,7 @@ static void ModelicaInternal_copyFile(const char* oldFile, const char* newFile)
}


static void ModelicaInternal_readDirectory(const char* directory, int nFiles,
void ModelicaInternal_readDirectory(const char* directory, int nFiles,
const char** files) {
/* Get all file and directory names in a directory in any order
(must be very careful, to call closedir if an error occurs)
Expand Down Expand Up @@ -388,7 +388,7 @@ static void ModelicaInternal_readDirectory(const char* directory, int nFiles,



static int ModelicaInternal_getNumberOfFiles(const char* directory) {
int ModelicaInternal_getNumberOfFiles(const char* directory) {
/* Get number of files and directories in a directory */

#if defined(_WIN32) || defined(_POSIX_)
Expand Down Expand Up @@ -424,7 +424,7 @@ ERROR: ModelicaFormatError("Not possible to get number of files in \"%s\":\n%s",

/* --------------------- Modelica_Utilities.Files ------------------------------------- */

static const char* ModelicaInternal_fullPathName(const char* name)
const char* ModelicaInternal_fullPathName(const char* name)
{
/* Get full path name of file or directory */

Expand Down Expand Up @@ -456,7 +456,7 @@ static const char* ModelicaInternal_fullPathName(const char* name)
return fullName;
}

static const char* ModelicaInternal_temporaryFileName()
const char* ModelicaInternal_temporaryFileName()
{
/* Get full path name of a temporary */

Expand All @@ -480,7 +480,7 @@ static const char* ModelicaInternal_temporaryFileName()

/* Needs to be improved for cashing of the open files */

static FILE* ModelicaStreams_openFileForReading(const char* fileName) {
FILE* ModelicaStreams_openFileForReading(const char* fileName) {
/* Open text file for reading */
FILE* fp;

Expand All @@ -494,7 +494,7 @@ static FILE* ModelicaStreams_openFileForReading(const char* fileName) {
}


static FILE* ModelicaStreams_openFileForWriting(const char* fileName) {
FILE* ModelicaStreams_openFileForWriting(const char* fileName) {
/* Open text file for writing (with append) */
FILE* fp;

Expand All @@ -513,14 +513,14 @@ static FILE* ModelicaStreams_openFileForWriting(const char* fileName) {
return fp;
}

static void ModelicaStreams_closeFile(const char* fileName) {
void ModelicaStreams_closeFile(const char* fileName) {
/* close file */
}


/* --------------------- Modelica_Utilities.Streams ----------------------------------- */

static void ModelicaInternal_print(const char* string, const char* fileName) {
void ModelicaInternal_print(const char* string, const char* fileName) {
/* Write string to terminal or to file */

if ( fileName[0] == '\0' ) {
Expand All @@ -541,7 +541,7 @@ static void ModelicaInternal_print(const char* string, const char* fileName) {
}


static int ModelicaInternal_countLines(const char* fileName)
int ModelicaInternal_countLines(const char* fileName)
/* Get number of lines of a file */
{
int c;
Expand All @@ -563,7 +563,7 @@ static int ModelicaInternal_countLines(const char* fileName)
return nLines;
}

static void ModelicaInternal_readFile(const char* fileName, const char* string[], size_t nLines) {
void ModelicaInternal_readFile(const char* fileName, const char* string[], size_t nLines) {
/* Read file into string vector string[nLines] */
FILE* fp = ModelicaStreams_openFileForReading(fileName);
char* line;
Expand Down Expand Up @@ -614,7 +614,7 @@ static void ModelicaInternal_readFile(const char* fileName, const char* string[]
}


static const char* ModelicaInternal_readLine(const char* fileName, int lineNumber, int* endOfFile) {
const char* ModelicaInternal_readLine(const char* fileName, int lineNumber, int* endOfFile) {
/* Read line lineNumber from file fileName */
FILE* fp = ModelicaStreams_openFileForReading(fileName);
char* line;
Expand Down Expand Up @@ -671,7 +671,7 @@ static const char* ModelicaInternal_readLine(const char* fileName, int lineNumbe

/* --------------------- Modelica_Utilities.System ------------------------------------ */

static void ModelicaInternal_chdir(const char* directoryName)
void ModelicaInternal_chdir(const char* directoryName)
{
/* Change current working directory. */
#if defined(__WATCOMC__)
Expand All @@ -692,7 +692,7 @@ static void ModelicaInternal_chdir(const char* directoryName)
}


static const char* ModelicaInternal_getcwd(int dummy)
const char* ModelicaInternal_getcwd(int dummy)
{
const char* cwd;
char* directory;
Expand All @@ -719,7 +719,7 @@ static const char* ModelicaInternal_getcwd(int dummy)
}


static const char* ModelicaInternal_getenv(const char* name, int convertToSlash, int* exist)
const char* ModelicaInternal_getenv(const char* name, int convertToSlash, int* exist)
{
/* Get content of environment variable */
char* value = getenv(name);
Expand All @@ -739,7 +739,7 @@ static const char* ModelicaInternal_getenv(const char* name, int convertToSlash,
}


static void ModelicaInternal_setenv(const char* name, const char* value, int convertFromSlash)
void ModelicaInternal_setenv(const char* name, const char* value, int convertFromSlash)
{
#if defined(_WIN32) || defined(_POSIX_)
int valueStart;
Expand Down
24 changes: 12 additions & 12 deletions SimulationRuntime/c/ModelicaExternalC/ModelicaStrings.c
Expand Up @@ -31,7 +31,7 @@
#include "ModelicaUtilities.h"


static const char* ModelicaStrings_substring(const char* string, int startIndex, int endIndex) {
const char* ModelicaStrings_substring(const char* string, int startIndex, int endIndex) {

/* Return string1(startIndex:endIndex) if endIndex >= startIndex,
or return string1(startIndex:startIndex), if endIndex = 0.
Expand Down Expand Up @@ -68,14 +68,14 @@ static const char* ModelicaStrings_substring(const char* string, int startIndex,
};


static int ModelicaStrings_length(const char* string)
int ModelicaStrings_length(const char* string)
/* Returns the number of characters "string" */
{
return strlen(string);
}


static int ModelicaStrings_compare(const char* string1, const char* string2, int caseSensitive)
int ModelicaStrings_compare(const char* string1, const char* string2, int caseSensitive)
/* compares two strings, optionally ignoring case */
{
int result;
Expand Down Expand Up @@ -104,7 +104,7 @@ static int ModelicaStrings_compare(const char* string1, const char* string2, int

#define MAX_TOKEN_SIZE 100

static int ModelicaStrings_skipWhiteSpace(const char* string, int i)
int ModelicaStrings_skipWhiteSpace(const char* string, int i)
/* Return index in string after skipping ws, or position of terminating nul. */
{
while (string[i-1] != '\0' && isspace(string[i-1]))
Expand All @@ -115,13 +115,13 @@ static int ModelicaStrings_skipWhiteSpace(const char* string, int i)

/* ----------------- utility functions used in scanXXX functions ----------- */

static int InSet(const char* string, int i, const char* separators)
int InSet(const char* string, int i, const char* separators)
/* Returns true if string[i] is one of the characters in separators. */
{
return strchr(separators, string[i-1]) != NULL;
}

static int SkipNonWhiteSpaceSeparator(const char* string, int i, const char* separators)
int SkipNonWhiteSpaceSeparator(const char* string, int i, const char* separators)
/* Return index in string of first character which is ws or character in separators,
or position of terminating nul. */
{
Expand All @@ -130,7 +130,7 @@ static int SkipNonWhiteSpaceSeparator(const char* string, int i, const char* sep
return i;
}

static int get_token(const char* string, int startIndex, const char* separators,
int get_token(const char* string, int startIndex, const char* separators,
int* output_index, int* token_start, int* token_length)
{
int past_token;
Expand Down Expand Up @@ -159,7 +159,7 @@ static int get_token(const char* string, int startIndex, const char* separators,
return 1; /* ok */
}

static int MatchUnsignedInteger(const char* string, int start)
int MatchUnsignedInteger(const char* string, int start)
/* Starts matching character which make an unsigned integer. The matching
begins at the start index (first char has index 1). Returns the number
of characters that could be matched, or zero if the first character
Expand All @@ -175,7 +175,7 @@ static int MatchUnsignedInteger(const char* string, int start)
/* --------------- end of utility functions used in scanXXX functions ----------- */


static void ModelicaStrings_scanIdentifier(const char* string, int startIndex, int* nextIndex, const char** identifier)
void ModelicaStrings_scanIdentifier(const char* string, int startIndex, int* nextIndex, const char** identifier)
{
int token_length=0;

Expand Down Expand Up @@ -209,7 +209,7 @@ static void ModelicaStrings_scanIdentifier(const char* string, int startIndex, i
return;
}

static void ModelicaStrings_scanInteger(const char* string, int startIndex, int unsignedNumber,
void ModelicaStrings_scanInteger(const char* string, int startIndex, int unsignedNumber,
int* nextIndex, int* integerNumber)
{
int number_length=0;
Expand Down Expand Up @@ -258,7 +258,7 @@ static void ModelicaStrings_scanInteger(const char* string, int startIndex, int
return;
}

static void ModelicaStrings_scanReal(const char* string, int startIndex, int unsignedNumber,
void ModelicaStrings_scanReal(const char* string, int startIndex, int unsignedNumber,
int* nextIndex, double* number)
{
/*
Expand Down Expand Up @@ -343,7 +343,7 @@ static void ModelicaStrings_scanReal(const char* string, int startIndex, int uns
}


static void ModelicaStrings_scanString(const char* string, int startIndex,
void ModelicaStrings_scanString(const char* string, int startIndex,
int* nextIndex, const char** result)
{
int i, token_start, past_token, token_length;
Expand Down

0 comments on commit 35b0ff2

Please sign in to comment.