Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008 #pragma once
00009
00010 #include "Strings.h"
00011 class FileStream;
00012
00013 #define PIPE_BUF_SIZE 512
00014
00015
00016
00017
00018
00019
00020
00021 class src_info
00022 {
00023 public:
00024 src_info* next;
00025 MCHAR* start;
00026 Value* file;
00027 unsigned int offset;
00028 unsigned int linenumber;
00029
00030
00031 src_info();
00032 ~src_info();
00033 };
00034
00035
00036 class Pipe : public CharStream
00037 {
00038 private:
00039 unsigned int read_source_offset;
00040 CRITICAL_SECTION pipe_update;
00041 public:
00042 MCHAR* write_buffer;
00043 MCHAR* write_cursor;
00044 MCHAR* read_buffer;
00045 MCHAR* read_cursor;
00046 int ungetch_count;
00047
00048 HANDLE pipe_event;
00049 HANDLE restart_event;
00050 bool waiting;
00051 bool stopped;
00052
00053 FileStream* log;
00054
00055 src_info* markers;
00056 src_info* marker_tail;
00057 MCHAR* next_source_start;
00058 Value* write_source_file;
00059 unsigned int write_source_offset;
00060
00061 MCHAR lastCharacterOfLastBuffer;
00062
00063
00064 Pipe();
00065 ~Pipe();
00066
00067 # define is_pipe(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == INTERNAL_PIPE_TAG)
00068 void collect();
00069 void gc_trace();
00070
00071 MCHAR get_char();
00072 void unget_char(MCHAR c);
00073 MCHAR peek_char();
00074 int at_eos();
00075 unsigned int pos();
00076 unsigned int line();
00077 void rewind();
00078 void flush_to_eol();
00079 void flush_to_eobuf();
00080
00081 void put_char(const MCHAR c, Value* source_file = NULL, unsigned int offset = 0, unsigned int line = 1);
00082 void put_str(const MCHAR* str, Value* source_file = NULL, unsigned int offset = 0, unsigned int line = 1);
00083 void put_buf(const MCHAR* str, UINT count, Value* source_file = NULL, unsigned int offset = 0, unsigned int line = 1);
00084 void new_write_buffer();
00085 void check_write_source_change(Value* file, unsigned int offset, unsigned int line, int new_len);
00086 void read_source_change();
00087 void clear_source();
00088 void stop();
00089 void go();
00090
00091 const MCHAR* puts(const MCHAR* str);
00092 int printf(const MCHAR *format, ...);
00093 void flag_eos();
00094
00095 void log_to(FileStream* log);
00096 void close_log();
00097 CharStream* get_log() { return log; }
00098 };
00099