mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
*** empty log message ***
This commit is contained in:
parent
689896a258
commit
4fa76ebd0b
@ -14,6 +14,8 @@
|
|||||||
downloadDb.cxx downloadDb.h \
|
downloadDb.cxx downloadDb.h \
|
||||||
downloader.I downloader.cxx downloader.h extractor.cxx extractor.h \
|
downloader.I downloader.cxx downloader.h extractor.cxx extractor.h \
|
||||||
hashVal.cxx hashVal.I hashVal.h \
|
hashVal.cxx hashVal.I hashVal.h \
|
||||||
|
multiplexStream.I multiplexStream.cxx multiplexStream.h \
|
||||||
|
multiplexStreamBuf.I multiplexStreamBuf.cxx multiplexStreamBuf.h \
|
||||||
patcher.cxx \
|
patcher.cxx \
|
||||||
patcher.h
|
patcher.h
|
||||||
|
|
||||||
@ -24,12 +26,18 @@
|
|||||||
#define IF_CRYPTO_SOURCES \
|
#define IF_CRYPTO_SOURCES \
|
||||||
crypto_utils.cxx crypto_utils.h
|
crypto_utils.cxx crypto_utils.h
|
||||||
|
|
||||||
#define INSTALL_HEADERS \
|
#define INSTALL_HEADERS \
|
||||||
downloader.h downloader.I \
|
asyncUtility.h asyncUtility.I \
|
||||||
config_downloader.h zcompressor.I zcompressor.h \
|
config_downloader.h \
|
||||||
asyncUtility.h asyncUtility.I decompressor.h \
|
decompressor.h \
|
||||||
extractor.h download_utils.h downloadDb.h downloadDb.I \
|
download_utils.h downloadDb.h downloadDb.I \
|
||||||
hashVal.I hashVal.h patcher.h
|
downloader.h downloader.I \
|
||||||
|
extractor.h \
|
||||||
|
hashVal.I hashVal.h \
|
||||||
|
multiplexStream.I multiplexStream.h \
|
||||||
|
multiplexStreamBuf.I multiplexStreamBuf.I \
|
||||||
|
patcher.h \
|
||||||
|
zcompressor.I zcompressor.h
|
||||||
|
|
||||||
#define IGATESCAN all
|
#define IGATESCAN all
|
||||||
|
|
||||||
|
5
panda/src/downloader/multiplexStreamBuf.I
Normal file
5
panda/src/downloader/multiplexStreamBuf.I
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Filename: multiplexStreamBuf.I
|
||||||
|
// Created by: drose (27Nov00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -108,25 +108,44 @@ MultiplexStreamBuf::
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: MultiplexStreamBuf::sync
|
// Function: MultiplexStreamBuf::add_output
|
||||||
// Access: Public, Virtual
|
// Access: Public
|
||||||
// Description: Called by the system ostream implementation when the
|
// Description: Adds the indicated output destinition to the set of
|
||||||
// buffer should be flushed to output (for instance, on
|
// things that will be written to when characters are
|
||||||
// destruction).
|
// output to the MultiplexStream.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
int MultiplexStreamBuf::
|
void MultiplexStreamBuf::
|
||||||
sync() {
|
add_output(MultiplexStreamBuf::BufferType buffer_type,
|
||||||
streamsize n = pptr() - pbase();
|
MultiplexStreamBuf::OutputType output_type,
|
||||||
|
ostream *out, FILE *fout, bool owns_obj) {
|
||||||
|
#ifdef HAVE_IPC
|
||||||
|
// Ensure that we have the mutex while we fiddle with the list of
|
||||||
|
// outputs.
|
||||||
|
mutex_lock m(_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
// We pass in false for the flush value, even though our
|
Output o;
|
||||||
// transmitting ostream said to sync. This allows us to get better
|
o._buffer_type = buffer_type;
|
||||||
// line buffering, since our transmitting ostream is often set
|
o._output_type = output_type;
|
||||||
// unitbuf, and might call sync multiple times in one line. We
|
o._out = out;
|
||||||
// still have an explicit flush() call to force the issue.
|
o._fout = fout;
|
||||||
write_chars(pbase(), n, false);
|
o._owns_obj = owns_obj;
|
||||||
pbump(-n);
|
_outputs.push_back(o);
|
||||||
|
}
|
||||||
|
|
||||||
return 0; // Return 0 for success, EOF to indicate write full.
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: MultiplexStreamBuf::flush
|
||||||
|
// Access: Public
|
||||||
|
// Description: Forces out all output that hasn't yet been written.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void MultiplexStreamBuf::
|
||||||
|
flush() {
|
||||||
|
#ifdef HAVE_IPC
|
||||||
|
mutex_lock m(_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
write_chars("", 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -137,6 +156,10 @@ sync() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
int MultiplexStreamBuf::
|
int MultiplexStreamBuf::
|
||||||
overflow(int ch) {
|
overflow(int ch) {
|
||||||
|
#ifdef HAVE_IPC
|
||||||
|
mutex_lock m(_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
streamsize n = pptr() - pbase();
|
streamsize n = pptr() - pbase();
|
||||||
|
|
||||||
if (n != 0) {
|
if (n != 0) {
|
||||||
@ -153,12 +176,42 @@ overflow(int ch) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: MultiplexStreamBuf::sync
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description: Called by the system ostream implementation when the
|
||||||
|
// buffer should be flushed to output (for instance, on
|
||||||
|
// destruction).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
int MultiplexStreamBuf::
|
||||||
|
sync() {
|
||||||
|
#ifdef HAVE_IPC
|
||||||
|
mutex_lock m(_lock);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
streamsize n = pptr() - pbase();
|
||||||
|
|
||||||
|
// We pass in false for the flush value, even though our
|
||||||
|
// transmitting ostream said to sync. This allows us to get better
|
||||||
|
// line buffering, since our transmitting ostream is often set
|
||||||
|
// unitbuf, and might call sync multiple times in one line. We
|
||||||
|
// still have an explicit flush() call to force the issue.
|
||||||
|
write_chars(pbase(), n, false);
|
||||||
|
pbump(-n);
|
||||||
|
|
||||||
|
return 0; // Return 0 for success, EOF to indicate write full.
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: MultiplexStreamBuf::write_chars
|
// Function: MultiplexStreamBuf::write_chars
|
||||||
// Access: Private
|
// Access: Private
|
||||||
// Description: An internal function called by sync() and overflow()
|
// Description: An internal function called by sync() and overflow()
|
||||||
// to store one or more characters written to the stream
|
// to store one or more characters written to the stream
|
||||||
// into the memory buffer.
|
// into the memory buffer.
|
||||||
|
//
|
||||||
|
// It is assumed that there is only one thread at a time
|
||||||
|
// running this code; it is the responsibility of the
|
||||||
|
// caller to grab the _lock mutex before calling this.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void MultiplexStreamBuf::
|
void MultiplexStreamBuf::
|
||||||
write_chars(const char *start, int length, bool flush) {
|
write_chars(const char *start, int length, bool flush) {
|
@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
#include <pandabase.h>
|
#include <pandabase.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_IPC
|
||||||
|
#include <ipc_mutex.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -33,12 +37,12 @@ public:
|
|||||||
OT_system_debug,
|
OT_system_debug,
|
||||||
};
|
};
|
||||||
|
|
||||||
INLINE void add_output(BufferType buffer_type, OutputType output_type,
|
void add_output(BufferType buffer_type, OutputType output_type,
|
||||||
ostream *out = (ostream *)NULL,
|
ostream *out = (ostream *)NULL,
|
||||||
FILE *fout = (FILE *)NULL,
|
FILE *fout = (FILE *)NULL,
|
||||||
bool owns_obj = false);
|
bool owns_obj = false);
|
||||||
|
|
||||||
INLINE void flush();
|
void flush();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int overflow(int c);
|
virtual int overflow(int c);
|
||||||
@ -64,6 +68,10 @@ private:
|
|||||||
Outputs _outputs;
|
Outputs _outputs;
|
||||||
|
|
||||||
string _line_buffer;
|
string _line_buffer;
|
||||||
|
|
||||||
|
#ifdef HAVE_IPC
|
||||||
|
mutex _lock;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "multiplexStreamBuf.I"
|
#include "multiplexStreamBuf.I"
|
@ -19,8 +19,6 @@
|
|||||||
littleEndian.cxx littleEndian.h memoryUsage.I memoryUsage.cxx \
|
littleEndian.cxx littleEndian.h memoryUsage.I memoryUsage.cxx \
|
||||||
memoryUsage.h memoryUsagePointers.I memoryUsagePointers.cxx \
|
memoryUsage.h memoryUsagePointers.I memoryUsagePointers.cxx \
|
||||||
memoryUsagePointers.h multifile.I multifile.cxx multifile.h \
|
memoryUsagePointers.h multifile.I multifile.cxx multifile.h \
|
||||||
multiplexStream.I multiplexStream.cxx multiplexStream.h \
|
|
||||||
multiplexStreamBuf.I multiplexStreamBuf.cxx multiplexStreamBuf.h \
|
|
||||||
namable.I namable.cxx namable.h numeric_types.h patchfile.I \
|
namable.I namable.cxx namable.h numeric_types.h patchfile.I \
|
||||||
patchfile.cxx patchfile.h pointerTo.I pointerTo.h referenceCount.I \
|
patchfile.cxx patchfile.h pointerTo.I pointerTo.h referenceCount.I \
|
||||||
referenceCount.cxx referenceCount.h tokenBoard.I tokenBoard.h \
|
referenceCount.cxx referenceCount.h tokenBoard.I tokenBoard.h \
|
||||||
@ -38,8 +36,6 @@
|
|||||||
indent.I indent.h littleEndian.I littleEndian.h \
|
indent.I indent.h littleEndian.I littleEndian.h \
|
||||||
memoryUsage.I memoryUsage.h memoryUsagePointers.I \
|
memoryUsage.I memoryUsage.h memoryUsagePointers.I \
|
||||||
memoryUsagePointers.h multifile.I multifile.h \
|
memoryUsagePointers.h multifile.I multifile.h \
|
||||||
multiplexStream.I multiplexStream.h \
|
|
||||||
multiplexStreamBuf.I multiplexStreamBuf.I \
|
|
||||||
numeric_types.h \
|
numeric_types.h \
|
||||||
pointerTo.I pointerTo.h referenceCount.I referenceCount.h \
|
pointerTo.I pointerTo.h referenceCount.I referenceCount.h \
|
||||||
tokenBoard.h trueClock.I trueClock.h typeHandle.I typeHandle.h \
|
tokenBoard.h trueClock.I trueClock.h typeHandle.I typeHandle.h \
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
// Filename: multiplexStreamBuf.I
|
|
||||||
// Created by: drose (27Nov00)
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: MultiplexStreamBuf::add_output
|
|
||||||
// Access: Public
|
|
||||||
// Description: Adds the indicated output destinition to the set of
|
|
||||||
// things that will be written to when characters are
|
|
||||||
// output to the MultiplexStream.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void MultiplexStreamBuf::
|
|
||||||
add_output(MultiplexStreamBuf::BufferType buffer_type,
|
|
||||||
MultiplexStreamBuf::OutputType output_type,
|
|
||||||
ostream *out, FILE *fout, bool owns_obj) {
|
|
||||||
Output o;
|
|
||||||
o._buffer_type = buffer_type;
|
|
||||||
o._output_type = output_type;
|
|
||||||
o._out = out;
|
|
||||||
o._fout = fout;
|
|
||||||
o._owns_obj = owns_obj;
|
|
||||||
_outputs.push_back(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: MultiplexStreamBuf::flush
|
|
||||||
// Access: Public
|
|
||||||
// Description: Forces out all output that hasn't yet been written.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void MultiplexStreamBuf::
|
|
||||||
flush() {
|
|
||||||
write_chars("", 0, true);
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user