Skip to content
Browse files

"changes to compile on Cygwin (built but did't run)"

  • Loading branch information...
1 parent aaf4f01 commit 7a38b70919ba6c8b71bdadb7259325078b6888b4 johnston committed with Barak A. Pearlmutter Nov 6, 2009
View
2 MANIFEST
@@ -804,7 +804,7 @@ ivtools-1.2/src/Time/Date.h
ivtools-1.2/src/Time/Imakefile
ivtools-1.2/src/Time/Makefile
ivtools-1.2/src/Time/Time.c
-ivtools-1.2/src/Time/Time.h
+ivtools-1.2/src/Time/Time_.h
ivtools-1.2/src/Time/obstime.c
ivtools-1.2/src/Time/obstime.h
ivtools-1.2/src/Time/timeglyph.c
View
2 MANIFEST.perceps
@@ -225,7 +225,7 @@ TIFF/tif_fax3.h
TIFF/tiffcompat.h
TIFF/tiffioP.h
Time/Date.h
-Time/Time.h
+Time/Time_.h
Time/obstime.h
Time/timeglyph.h
TopoFace/fgeomobjs.h
View
4 src/ComTerp/comterp.c
@@ -193,7 +193,9 @@ boolean ComTerp::read_expr() {
save_parser_client();
postfix_echo();
- return status==0 && _pfbuf[_pfnum-1].type != TOK_EOF && _buffer[0] != '\0';
+ return status==0
+ && (_pfnum==0 || _pfbuf[_pfnum-1].type != TOK_EOF)
+ && _buffer[0] != '\0';
}
boolean ComTerp::eof() {
View
5 src/ComTerp/comterpserv.c
@@ -514,9 +514,12 @@ ComValue ComTerpServ::run(postfix_token* tokens, int ntokens) {
}
postfix_token* ComTerpServ::gen_code(const char* script, int& ntoken) {
+ push_servstate();
load_string(script);
read_expr();
- return copy_postfix_tokens(ntoken);
+ postfix_token* copied_tokens = copy_postfix_tokens(ntoken);
+ pop_servstate();
+ return copied_tokens;
}
void ComTerpServ::read_string(const char* script) {
View
3 src/ComTerp/ctrlfunc.c
@@ -221,7 +221,7 @@ void RemoteFunc::execute() {
}
/*****************************************************************************/
-
+#ifdef HAVE_ACE
int SocketObj::_symid = -1;
SocketObj::SocketObj(const char* host, unsigned short port) {
@@ -253,6 +253,7 @@ int SocketObj::close() {
int SocketObj::get_handle() {
return _socket->get_handle();
}
+#endif
/*****************************************************************************/
View
2 src/ComTerp/ctrlfunc.h
@@ -111,6 +111,7 @@ class SocketObj {
CLASS_SYMID("SocketObj");
};
+#endif
//: create socket object
// sockobj=socket(hoststr portnum) -- create and open socket object
@@ -123,7 +124,6 @@ class SocketFunc : public ComFunc {
virtual const char* docstring() {
return "%s(hoststr portnum ) -- create and open socket object"; }
};
-#endif
//: eval string command for ComTerp.
// str|lst=eval(cmdstr [cmdstr ...] :symret) -- evaluate string as commands, optionally returning symbol instead of nil.
View
11 src/ComTerp/randfunc.c
@@ -51,6 +51,12 @@ void RandFunc::execute() {
}
}
+ ComValue retval(RandFunc::drand(minval, maxval));
+ push_stack(retval);
+
+}
+
+double RandFunc::drand(double minval, double maxval) {
#ifndef RAND_MAX
#include <sys/limits.h>
#define RAND_MAX INT_MAX
@@ -61,11 +67,10 @@ void RandFunc::execute() {
int rnum = rand();
double rval = rnum*gain+bias;
- ComValue retval(rval);
- push_stack(retval);
-
+ return rval;
}
+
/*****************************************************************************/
SRandFunc::SRandFunc(ComTerp* comterp) : ComFunc(comterp) {
View
2 src/ComTerp/randfunc.h
@@ -42,6 +42,8 @@ class RandFunc : public ComFunc {
virtual const char* docstring() {
return "val=%s([minval,maxval]) -- return random number between 0 and 1 or minval,maxval"; }
+ static double drand(double minval, double maxval);
+
};
//: command to seed ComTerp random number generator.
View
1 src/ComUnidraw/grfunc.c
@@ -939,6 +939,7 @@ void SelectFunc::execute() {
Selection* sel = _ed->GetViewer()->GetSelection();
if (clear_flag) {
sel->Clear();
+ unidraw->Update();
reset_stack();
return;
}
View
2 src/Dispatch/dispatcher.c
@@ -659,7 +659,7 @@ int Dispatcher::waitFor(
#endif
#else
#ifdef SA_NOCLDSTOP /* POSIX */
-#if defined(hpux) || defined(linux) || defined(sun) && defined(__svr4__)
+#if defined(__CYGWIN__) || defined(hpux) || defined(linux) || defined(sun) && defined(__svr4__)
sa.sa_handler = (void (*)(int))(&Dispatcher::sigCLD);
#else
sa.sa_handler = fxSIGACTIONHANDLER(&Dispatcher::sigCLD);
View
2 src/DrawServ/drawfunc.c
@@ -90,7 +90,7 @@ void DrawLinkFunc::execute() {
((DrawServ*)unidraw)->cycletest
(sidv.uint_val(), hostv.string_ptr(), userv.string_ptr(), pidv.int_val())) {
#if 1
-#if __GNUC__<4
+#if __GNUC__<4 && !defined(__CYGWIN__)
fileptr_filebuf obuf(comterp()->handler()->get_handle(), ios_base::out, false, static_cast<size_t>(BUFSIZ));
#else
fileptr_filebuf obuf(comterp()->handler()->get_handle(), ios_base::out, static_cast<size_t>(BUFSIZ));
View
2 src/DrawServ/drawlink.c
@@ -99,7 +99,7 @@ int DrawLink::open() {
if (ComterpHandler::reactor_singleton()->register_handler(ackhandler(), ACE_Event_Handler::READ_MASK|ACE_Event_Handler::TIMER_MASK)==-1)
fprintf(stderr, "drawserv: error registering ackback handler (handle==%d)\n", _socket->get_handle());
-#if __GNUC__<4
+#if __GNUC__<4 && !defined(__CYGWIN__)
fileptr_filebuf obuf(_socket->get_handle(), ios_base::out, false, static_cast<size_t>(BUFSIZ));
#else
fileptr_filebuf obuf(_socket->get_handle(), ios_base::out, static_cast<size_t>(BUFSIZ));
View
4 src/DrawServ/drawserv.c
@@ -368,7 +368,7 @@ void DrawServ::DistributeCmdString(const char* cmdstring, DrawLink* orglink) {
if (link && link != orglink && link->state()==DrawLink::two_way) {
int fd = link->handle();
if (fd>=0) {
-#if __GNUC__<4
+#if __GNUC__<4 && !defined(__CYGWIN__)
fileptr_filebuf fbuf(fd, ios_base::out, false, static_cast<size_t>(BUFSIZ));
#else
fileptr_filebuf fbuf(fd, ios_base::out, static_cast<size_t>(BUFSIZ));
@@ -390,7 +390,7 @@ void DrawServ::SendCmdString(DrawLink* link, const char* cmdstring) {
if (link) {
int fd = link->handle();
if (fd>=0) {
-#if __GNUC__<4
+#if __GNUC__<4 && !defined(__CYGWIN__)
fileptr_filebuf fbuf(fd, ios_base::out, false, static_cast<size_t>(BUFSIZ));
#else
fileptr_filebuf fbuf(fd, ios_base::out, static_cast<size_t>(BUFSIZ));
View
7 src/OverlayUnidraw/ovunidraw.c
@@ -73,6 +73,7 @@ OverlayUnidraw::OverlayUnidraw (Catalog* c, int& argc, char** argv,
_ovviewer = nil;
_comterp = nil;
_npause = 0;
+ _run_once = 0;
/* replace default Painter with an OverlayPainter */
OverlayGraphic::new_painter();
@@ -84,6 +85,7 @@ OverlayUnidraw::OverlayUnidraw (Catalog* c, World* w)
_ovviewer = nil;
_comterp = nil;
_npause = 0;
+ _run_once = 0;
}
OverlayUnidraw::~OverlayUnidraw ()
@@ -145,6 +147,11 @@ void OverlayUnidraw::Run () {
if (updated()) {
Update(true);
}
+
+ if(run_once()) {
+ _run_once--;
+ break;
+ }
}
_npause = _comterp ? _comterp->npause() : 0;
View
6 src/OverlayUnidraw/ovunidraw.h
@@ -80,8 +80,14 @@ class OverlayUnidraw : public Unidraw {
static void deferred_notifications(boolean flag) { _deferred_notifications = flag; }
// set flag that indicates deferred notifications
+
+ void run_once(int flag) { _run_once = true; }
+ int run_once() { return _run_once; }
+ virtual void RunOnce() { run_once(10);Run(); }
+ // run OverlayUnidraw just once
protected:
+ int _run_once;
static MacroCmd* _cmdq;
static boolean* _updated_ptr;
OverlayViewer* _ovviewer;
View
2 src/Time/Date.c
@@ -61,7 +61,7 @@ Log: Date.c,v
*/
#include <Time/Date.h>
-#include <Time/Time.h>
+#include <Time/Time_.h>
#include <OS/string.h>
#include <iomanip>
View
2 src/Time/Time.c
@@ -29,7 +29,7 @@ seconds since January 1, 1901, GMT.
*/
#include <Time/Date.h>
-#include <Time/Time.h>
+#include <Time/Time_.h>
#include <iomanip>
using namespace std;
View
160 src/Time/Time.h
@@ -1,160 +0,0 @@
-
-/* Time.h -- declarations for class Time
- THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
- "UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE
- AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT
- CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE
- PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
- RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
-
-Author:
- K. E. Gorlen
- Computer Systems Laboratory, DCRT
- National Institutes of Health
- Bethesda, MD 20892
-
-/* Log: Time.h,v
- * Revision 3.11 92/07/26 14:33:59 sandy
- * include directive in form '#include <nihcl/foo.h>'
- *
- * Revision 3.10 91/02/18 21:08:49 kgorlen
- * Release for 3rd printing of 1st edition.
- *
- * Revision 3.1 90/12/22 08:58:38 kgorlen
- * Change NESTED_TYPES to NO_NESTED_TYPES.
- *
- * Revision 3.0 90/05/20 00:21:46 kgorlen
- * Release for 1st edition.
- *
-*/
-
-#ifndef TIME_H
-#define TIME_H
-
-
-#if defined(SYSV) && ! defined(hpux)
-
-#include <time.h>
-
-#define TIME_ZONE timezone
-#define DST_OBSERVED daylight
-#define BASE_CLASSES BASE::desc()
-#define MEMBER_CLASSES
-#define VIRTUAL_BASE_CLASSES Object::desc()
-
-#endif
-
-//moved from Time.c
-
-#if defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
-
-#if defined(__APPLE__)
-#include_next <time.h>
-#endif
-
-#include <sys/time.h>
- #if defined(__NetBSD__)
- #include </usr/include/sys/time.h>
- #endif
-
-#endif
-
-
-#if defined(hpux)
- #include <time.h>
-#endif
-
-
-#if defined(linux) || defined(__sun) || defined(__alpha) || defined(__CYGWIN__)
-#include <sys/time.h>
-
- #if defined(__DECCXX) || (defined(__sun) && !defined(__svr4__))
- extern "C" {
- int gettimeofday(struct timeval *tp, struct timezone *tzp);
- }
- #endif
-#endif
-
-// END of edits
-
-
-/*
- Modified by Vectaport, Inc.
-*/
-
-#include <OS/types.h>
-#if !defined(__APPLE_)
-#include <iostream.h>
-#include_next <time.h>
-#else
-#include <iosfwd>
-#include <iostream>
-#endif
-
-#define NO_NESTED_TYPES 1
-
-class Date;
-
-#ifdef NO_NESTED_TYPES
-typedef unsigned short hourTy;
-typedef unsigned short minuteTy;
-typedef unsigned short secondTy;
-typedef unsigned long clockTy;
-#endif
-
-using std::cout;
-
-class Time {
-
-public: // type definitions
-#ifndef NO_NESTED_TYPES
- typedef unsigned short hourTy;
- typedef unsigned short minuteTy;
- typedef unsigned short secondTy;
- typedef unsigned long clockTy;
-#endif
-private:
- clockTy sec; /* seconds since 1/1/1901 */
- boolean isDST() const;
- Time localTime() const;
-private: // static member functions
- static Time localTime(const Date& date, hourTy h=0, minuteTy m=0, secondTy s=0);
- static Time beginDST(unsigned year);
- static Time endDST(unsigned year);
-public:
- Time(); // current time
- Time(clockTy s) { sec = s; }
- Time(hourTy h, minuteTy m, secondTy s =0, boolean dst =false);
- Time(const Date&, hourTy h =0, minuteTy m =0, secondTy s=0, boolean dst =false);
- Date date() const;
- boolean operator<(const Time& t) const { return sec < t.sec; }
- boolean operator<=(const Time& t) const { return sec <= t.sec; }
- boolean operator>(const Time& t) const { return sec > t.sec; }
- boolean operator>=(const Time& t) const { return sec >= t.sec; }
- boolean operator==(const Time& t) const { return sec == t.sec; }
- boolean operator!=(const Time& t) const { return sec != t.sec; }
- friend Time operator+(const Time& t, long s) { return Time(t.sec+s); }
- friend Time operator+(long s, const Time& t) { return Time(t.sec+s); }
- long operator-(const Time& t) const { return sec - t.sec; }
- Time operator-(long s) const { return Time(sec-s); }
- void operator+=(long s) { sec += s; }
- void operator-=(long s) { sec -= s; }
- boolean between(const Time& a, const Time& b) const;
- hourTy hour() const; // hour in local time
- hourTy hourGMT() const; // hour in GMT
- minuteTy minute() const; // minute in local time
- minuteTy minuteGMT() const; // minute in GMT
- secondTy second() const; // second in local time or GMT
- clockTy seconds() const { return sec; }
-
-#undef min
-#undef max
-
- Time max(const Time&) const;
- Time min(const Time&) const;
- virtual void printOn(ostream& strm =cout) const;
-
- friend ostream& operator << (ostream& s, const Time&);
-};
-
-#endif /* TIMEH */
View
2 src/Time/obstime.h
@@ -25,7 +25,7 @@
#define obstime_h
#include <InterViews/observe.h>
-#include <Time/Time.h>
+#include <Time/Time_.h>
class ObservableTime : public Observable {
public:
View
2 src/Time/timeglyph.c
@@ -22,7 +22,7 @@
*/
#include <InterViews/enter-scope.h>
-#include <Time/Time.h>
+#include <Time/Time_.h>
#include <Time/Date.h>
#include <Time/obstime.h>
#include <Time/timeglyph.h>

0 comments on commit 7a38b70

Please sign in to comment.
Something went wrong with that request. Please try again.