[Flightgear-devel] Flight Gear

2010-12-20 Thread Grant
Hey guys, I have had flight gear for about 3 months now, I really enjoy playing 
offline but only just recently ive had the urge to want to play online, i try 
connecting online to on my Mac but the fgfs app in the exec app in the dock 
closes immediatly but flight gear stays open, this does not happen when i play 
offline, can any one help please? email me back if you need other information 
regarding this

Cheers
Grant
--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] simgear: win32 fix, iolib.c errors

2009-02-19 Thread john grant
Hi,
In today's CVS, the type 'mode_t' was not defined in simgear/nasal/iolib.c.  I 
noticed this type was defined in a C++ header file (simgear/misc/sg_path.hxx), 
but this could not included in the C file in question.  Borrowing from that 
header, pasting these lines near the top of iolib.c, fixes the compile error.

#ifdef _MSC_VER
  typedef int mode_t;
#endif

Thanks for the simulator!
John


  #include 
#include 
#include 
#include 
#include 
#include "data.h"
#include "iolib.h"


#ifdef _MSC_VER
  typedef int mode_t;
#endif

static void ghostDestroy(void* g);
naGhostType naIOGhostType = { ghostDestroy, "iofile" };

static struct naIOGhost* ioghost(naRef r)
{
if(naGhost_type(r) == &naIOGhostType && IOGHOST(r)->handle)
return naGhost_ptr(r);
return 0;
}

static naRef f_close(naContext c, naRef me, int argc, naRef* args)
{
struct naIOGhost* g = argc==1 ? ioghost(args[0]) : 0;
if(!g) naRuntimeError(c, "bad argument to close()");
if(g->handle) g->type->close(c, g->handle);
g->handle = 0;
return naNil();
}

static naRef f_read(naContext c, naRef me, int argc, naRef* args)
{
struct naIOGhost* g = argc > 0 ? ioghost(args[0]) : 0;
naRef str = argc > 1 ? args[1] : naNil();
naRef len = argc > 2 ? naNumValue(args[2]) : naNil();
if(!g || !MUTABLE(str) || !IS_NUM(len))
naRuntimeError(c, "bad argument to read()");
if(naStr_len(str) < (int)len.num)
naRuntimeError(c, "string not big enough for read");
return naNum(g->type->read(c, g->handle, naStr_data(str),
   (int)len.num));
}

static naRef f_write(naContext c, naRef me, int argc, naRef* args)
{
struct naIOGhost* g = argc > 0 ? ioghost(args[0]) : 0;
naRef str = argc > 1 ? args[1] : naNil();
if(!g || !IS_STR(str))
naRuntimeError(c, "bad argument to write()");
return naNum(g->type->write(c, g->handle, naStr_data(str),
naStr_len(str)));
}

static naRef f_seek(naContext c, naRef me, int argc, naRef* args)
{
struct naIOGhost* g = argc > 0 ? ioghost(args[0]) : 0;
naRef pos = argc > 1 ? naNumValue(args[1]) : naNil();
naRef whn = argc > 2 ? naNumValue(args[2]) : naNil();
if(!g || !IS_NUM(pos) || !IS_NUM(whn))
naRuntimeError(c, "bad argument to seek()");
g->type->seek(c, g->handle, (int)pos.num, (int)whn.num);
return naNil();
}

static naRef f_tell(naContext c, naRef me, int argc, naRef* args)
{
struct naIOGhost* g = argc==1 ? ioghost(args[0]) : 0;
if(!g)
naRuntimeError(c, "bad argument to tell()");
return naNum(g->type->tell(c, g->handle));
}

static naRef f_flush(naContext c, naRef me, int argc, naRef* args)
{
struct naIOGhost* g = argc==1 ? ioghost(args[0]) : 0;
if(!g)
naRuntimeError(c, "bad argument to flush()");
g->type->flush(c, g->handle);
return naNil();
}

static void ghostDestroy(void* g)
{
struct naIOGhost* io = (struct naIOGhost*)g;
io->type->destroy(io->handle);
naFree(io);
}


// stdio library implementation below:

static void ioclose(naContext c, void* f)
{
if(f)
if(fclose(f) != 0 && c) naRuntimeError(c, strerror(errno));
}

static int ioread(naContext c, void* f, char* buf, unsigned int len)
{
int n;
naModUnlock(); n = fread(buf, 1, len, f); naModLock();
if(n < len && !feof((FILE*)f)) naRuntimeError(c, strerror(errno));
return n;
}

static int iowrite(naContext c, void* f, char* buf, unsigned int len)
{
int n;
naModUnlock(); n = fwrite(buf, 1, len, f); naModLock();
if(ferror((FILE*)f)) naRuntimeError(c, strerror(errno));
return n;
}

static void ioseek(naContext c, void* f, unsigned int off, int whence)
{
if(fseek(f, off, whence) != 0) naRuntimeError(c, strerror(errno));
}

static int iotell(naContext c, void* f)
{
int n = ftell(f);
if(n < 0) naRuntimeError(c, strerror(errno));
return n;
}

static void ioflush(naContext c, void* f)
{
if(fflush(f)) naRuntimeError(c, strerror(errno));
}

static void iodestroy(void* f)
{
if(f != stdin && f != stdout && f != stderr)
ioclose(0, f);
}

struct naIOType naStdIOType = { ioclose, ioread, iowrite, ioseek,
iotell, ioflush, iodestroy };

naRef naIOGhost(naContext c, FILE* f)
{
struct naIOGhost* ghost = naAlloc(sizeof(struct naIOGhost));
ghost->type = &naStdIOType;
ghost->handle = f;
return naNewGhost(c, &naIOGhostType, ghost);
}

static naRef f_open(naContext c, naRef me, int argc, naRef* args)
{
FILE* f;
naRef file = argc > 0 ? naStringValue(c, args[0]) : naNil();
naRef mode = argc > 1 ? naStringValue(c, args[1]) : naNil();
if(!IS_STR(file)) naRuntimeError(c, "bad argument to open()");
f = fopen(naStr_data(file), IS_STR(mode) ? naStr_data(mode) : "rb");
if(!f) naRuntimeError(c, strerror(errno));
return naIOGhost(c, f);
}

// frees buffer before tossing