Skip to content

Commit 60726e2

Browse files
author
Marc-Oliver Gewaltig
committed
ongoing work
1 parent 963daa1 commit 60726e2

File tree

7 files changed

+916
-3607
lines changed

7 files changed

+916
-3607
lines changed

base.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ OBJS= sli_array.o\
5858
sli_stack.o\
5959
sli_type_trie.o\
6060
sli_typecheck.o\
61-
sli_math.o
61+
sli_math.o\
62+
sli_io.o\
63+
sli_fdstream.o
6264

6365
SOURCES = ${OBJS:.o=.cpp}
6466

makefile

Lines changed: 890 additions & 3573 deletions
Large diffs are not rendered by default.

sli_control.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,8 +1407,8 @@ void Sleep_dFunction::execute(SLIInterpreter *i) const
14071407
i->require_stack_load(1);
14081408
i->require_stack_type(0,sli3::doubletype);
14091409
const long sec = 0;
1410-
const long usec =
1411-
static_cast<long>(i->pick(0).data_.long_val*1000000.);
1410+
const int usec =
1411+
static_cast<int>(i->pick(0).data_.long_val*1000000.);
14121412
struct timeval tv = { sec, usec };
14131413

14141414
if (usec>0)

sli_fdstream.cpp

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,18 @@
2020
*
2121
*/
2222

23-
#include "config.h"
24-
#include "fdstream.h"
25-
26-
#ifdef HAVE_ISTREAM
23+
#include "sli_config.h"
24+
#include "sli_fdstream.h"
2725

2826
std::streamsize const fdbuf::s_bufsiz;
2927

3028
fdbuf* fdbuf::open(const char* s, std::ios_base::openmode mode)
3129
{
3230
if (is_open())
3331
{
34-
// std::cerr<<"Is already open!"<<std::endl;
35-
return NULL;
32+
return 0;
3633
}
37-
// bool success=true;
34+
3835

3936
int oflag;
4037
std::ios_base::openmode open_mode =
@@ -55,17 +52,16 @@ fdbuf* fdbuf::open(const char* s, std::ios_base::openmode mode)
5552
oflag = (O_RDWR | O_TRUNC | O_CREAT);
5653
else
5754
{
58-
//std::cerr<<"bad flags!"<<std::endl;
59-
return NULL;
55+
return 0;
6056
}
6157

6258
m_fd=::open(s, oflag, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); // these file permissions are required by POSIX.1 (see Stevens 5.5)
6359

6460
if (m_fd==-1)
6561
{
6662
// std::cerr<<"::open failed!"<<std::endl;
67-
// perror(NULL);
68-
return NULL;
63+
// perror(0);
64+
return 0;
6965
}
7066

7167
// beware of operator precedence --- HEP
@@ -75,8 +71,8 @@ fdbuf* fdbuf::open(const char* s, std::ios_base::openmode mode)
7571
{
7672
close();
7773
// std::cerr<<"seek failed!"<<std::endl;
78-
// perror(NULL);
79-
return NULL;
74+
// perror(0);
75+
return 0;
8076
}
8177
};
8278

@@ -89,7 +85,7 @@ fdbuf* fdbuf::close()
8985
if (!is_open())
9086
{
9187
// std::cerr<<"File was not open."<<std::endl;
92-
return NULL;
88+
return 0;
9389
}
9490

9591
bool success=true;
@@ -101,18 +97,18 @@ fdbuf* fdbuf::close()
10197
}
10298
if (::close(m_fd)==-1)
10399
{
104-
// std::cerr<<"::close failed: "<<std::endl;perror(NULL);
100+
// std::cerr<<"::close failed: "<<std::endl;perror(0);
105101
success=false;
106102
}
107103

108104
m_isopen=false;
109105

110-
return (success ? this : NULL);
106+
return (success ? this : 0);
111107
}
112108

113109
void ofdstream::close()
114110
{
115-
if (rdbuf()->close() == NULL)
111+
if (rdbuf()->close() == 0)
116112
{
117113
setstate(failbit);
118114
}
@@ -121,19 +117,17 @@ void ofdstream::close()
121117

122118
void ifdstream::close()
123119
{
124-
if (rdbuf()->close() == NULL)
120+
if (rdbuf()->close() == 0)
125121
{
126122
setstate(failbit);
127123
}
128124
}
129125

130126
void fdstream::close()
131127
{
132-
if (rdbuf()->close() == NULL)
128+
if (rdbuf()->close() == 0)
133129
{
134130
setstate(failbit);
135131
}
136132
}
137133

138-
139-
#endif

sli_io.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <sstream>
3333
#include <cstdio>
3434

35-
#include "fdstream.h"
35+
#include "sli_fdstream.h"
3636
#include "sli_io.h"
3737
#include "sli_string.h"
3838
#include "sli_iostream.h"

sli_io.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,11 @@
2929
filesystem.h
3030
*************************************/
3131

32-
#include "sli_interpret.h"
32+
#include "sli_interpreter.h"
3333

34-
void init_sli_io(SLIInterpreter *);
35-
36-
class MathLinkPutStringFunction: public SLIFunction
34+
namespace sli3
3735
{
38-
public:
39-
MathLinkPutStringFunction() {}
40-
void execute(SLIInterpreter *) const;
41-
};
36+
void init_sli_io(SLIInterpreter *);
4237

4338
class IfstreamFunction: public SLIFunction
4439
{
@@ -366,6 +361,7 @@ ReadWordFunction() {}
366361
void execute(SLIInterpreter *) const;
367362
};
368363

364+
} // end of namespace
369365
#endif
370366

371367

sli_lockptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class lockPTR
8585
bool deletable;
8686
bool locked;
8787

88-
// forbid this constructor!
88+
//!< forbid this constructor!
8989
PointerObject(PointerObject const&){assert(false);}
9090

9191
public:

0 commit comments

Comments
 (0)