Ejemplo n.º 1
0
/*------------------------------------------------------------------------*/
BOOL HistoryFile::setDefaultFilename(void)
{
    const ScilabPreferences* prefs = getScilabPreferences();
    if (prefs != NULL && prefs->historyFile != NULL)
    {
        const char* prefHistoryFile = prefs->historyFile;
        this->setFilename(expandPathVariable((char*)prefHistoryFile));
        return TRUE;
    }
    else
    {
        std::string filename(DEFAULT_HISTORY_FILE);
        char *SCIHOME = getSCIHOME();
        if (SCIHOME)
        {
            std::string scihome(SCIHOME);
            std::string sep(DIR_SEPARATOR);
            this->setFilename(scihome + sep + filename);
            return TRUE;
        }
        else
        {
            this->setFilename(filename);
            return FALSE;
        }
    }
}
Ejemplo n.º 2
0
unsigned long GetLargestFreeMemoryRegion(void)
{

#if _WIN64

    const ScilabPreferences* prefs =  getScilabPreferences();
    /* we need to limit values to 32 bits for Scilab :( */

    /* Bug 10439 JVM reserves some space in 32 bit space */
    /* "Empiric" value for a Java Heap space to 256mb */
    /* It is not really a good workaround :/ */
    unsigned long SECURITY_FREE_MEMORY = (atoi(prefs->heapSize) + 85) * (1024 * 1024);
#else
#define SECURITY_FREE_MEMORY 1040000
#endif

    unsigned long realSize = 0;

    //due to scilab stack limitation this value must not be > MAX_INT
    realSize = 0x7fffffff;

    if (realSize > SECURITY_FREE_MEMORY)
    {
        realSize -= SECURITY_FREE_MEMORY;
    }
    return realSize;
}
Ejemplo n.º 3
0
/*--------------------------------------------------------------------------*/
char * getJavaHeapSize(void)
{
    const char * value = getScilabPreferences()->heapSize;
    char * rvalue = NULL;
    int ivalue;

    if (value)
    {
        ivalue = (int)atof(value);
        if (ivalue > 0)
        {
            rvalue = (char *)MALLOC(24 * sizeof(char));
            sprintf(rvalue, "-Xmx%dm", ivalue);
        }
    }

    return rvalue;
}