Commit Graph

4083 Commits

Author SHA1 Message Date
Thomas Geymayer
5258699f20 cppbind: convert Nasal functions to C++ boost::function. 2013-10-15 17:46:31 +02:00
Thomas Geymayer
483bebb003 cppbind: fix bad class hierarchy for bad_nasal_cast. 2013-10-15 16:38:38 +02:00
Thomas Geymayer
8ca8052a8d Nasal: use correct function pointer in naCall (with user data) 2013-10-15 14:21:45 +02:00
Thomas Geymayer
d68b1144b8 Nasal: recursive method calling.
New functions naCallMethodCtx and naCallMethod to replace
NasalSystem::callMethod from FlightGear. This has just added an
unneeded level of indirection and fits better directly into Nasal.
naSetErrorHandler can be used to register an error handler/logging
function.
2013-10-15 12:08:42 +02:00
Thomas Geymayer
42c39b6be3 Canvas: use new naGCSave/naGCRelease functions. 2013-10-15 00:49:13 +02:00
Thomas Geymayer
bb82b9d168 Nasal: add naGCSave/naGCRelease for preventing objects being garbage collected.
These new functions are meant to replace the gcSave/gcRelease
methods of the NasalSystem class in FlightGear, as passing an
adapter to SimGear from FlightGear is quite a lot of useless work
just for being able to save objects.
2013-10-15 00:19:32 +02:00
Thomas Geymayer
b1f865d461 cppbind: add to_nasal_helper for enums. 2013-10-14 23:03:36 +02:00
Thomas Geymayer
8e75c6be50 HTTP: check url for scheme and report instead of failing with assert. 2013-10-13 12:06:17 +02:00
Thomas Geymayer
06a5f9188d Don't let exceptions escape from commands. 2013-10-13 12:00:52 +02:00
Thomas Geymayer
370a991208 cppbind: Catch exceptions before reaching C code. 2013-10-13 11:40:27 +02:00
Thomas Geymayer
6deb77dd4d Canvas: allow also C++ callable entities as event callbacks. 2013-10-12 00:29:37 +02:00
James Turner
9e3172cb04 Another attempt to make MSVC happy!
C89 requires variable declarations upfront.
2013-10-09 12:26:29 +02:00
James Turner
426c6b9a72 Linux needs <cstring> 2013-10-09 11:58:51 +02:00
James Turner
d148bdedcd Fix MSVC build, no C99 so no round().
(Doesn't use SGMisc<T>::round, since Nasal is pure C)
2013-10-09 11:52:54 +02:00
James Turner
23140e3bf7 Avoid a data copy decoding base64 data.
Use an out parameter to avoid a buffer alloc/copy/free cycle
when returning base64-decoded data.
2013-10-09 10:03:30 +02:00
James Turner
2f023803e7 Refactor HTTP content-encoding support.
Move content-encoding handler into its own file, which 
simplifies the main code. As part of this, fix a bug where we
didn't flush the ZLIB buffers on response completion.
2013-10-09 10:03:28 +02:00
James Turner
d658b5fc38 Use std::string.append, avoid string copying.
Removes a hot-spot on the SVN update path.
2013-10-09 10:03:27 +02:00
James Turner
68cd84c330 Make base64 decode significantly faster.
Use a reverse lookup table instead of a call to string.find for
each input byte, much speedier.
2013-10-09 10:03:27 +02:00
James Turner
0bd82a43d3 Check for DAV status parse failures. 2013-10-09 10:03:26 +02:00
James Turner
7fdf42b699 Reset: Nasal additions to force GC, clear saved refs. 2013-10-09 09:59:50 +02:00
James Turner
aeb0e9aac3 Reset: event manager can be unbound. 2013-10-09 09:59:40 +02:00
James Turner
1099a3bdf0 Reset: model placement can drop OSG nodes. 2013-10-09 09:59:33 +02:00
James Turner
aa3458f69c Reset: model lib can drop static root. 2013-10-09 09:59:21 +02:00
Stanislaw Halik
0186cbb7b7 cmake: prevent Boost barfing out too many warns 2013-10-03 21:49:38 +01:00
Stanislaw Halik
fa36e94c4b fix static build with recent GNU binutils
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
2013-10-03 21:49:38 +01:00
James Turner
ad83e70cf5 Extend built-in Nasal math.
- rename mod() to fmod() to prevent collisions with the
version in math.nas (which has different handling of negatives)
- implement pow, tan, acos and asin natively
- add round(x, [p]), which rounds away from 0.0, and takes an
option precision. I.e you can round(479, 50) and get '500'; useful
in many digital cockpit displays.
2013-10-03 17:40:17 +01:00
James Turner
4a0377c0a1 Rename WaitingSyncItem -> SyncItem.
More accurate name (we have these for items which are not waiting),
and also shorter.
2013-09-30 21:59:18 +01:00
James Turner
83a3241830 Fix a signed/unsigned compare warning 2013-09-30 16:44:04 +01:00
James Turner
f299b351e3 Expose active tiles via API, sync by SGBucket.
Provide an API to query which tiles are currently being synced. This
allows the higher levels (TileManager in FlightGear) to safely wait on
TerraSync before loading tiles.

Doing this exposed some bugs in scheduling tiles to sync by integer
lat/lon, related to round-towards-zero with -ve values (western /
souther hemispheres). To resolve these, and also reduce spurious
syncs, switch to an explicit API for requesting tiles by SGBucket.
This keeps TerraSync fully aligned with the TileManager queue, which
has many benefits for both high and low visibility situations.
2013-09-30 16:35:45 +01:00
James Turner
3880e4ef47 Say which ocean tile we generated. 2013-09-30 12:08:10 +01:00
James Turner
f205e918d9 sprintf -> snprintf in bucket code. 2013-09-30 12:07:57 +01:00
James Turner
42b0b9306b Make code quieter at log-level=DEBUG. 2013-09-28 14:45:30 +01:00
James Turner
483659c319 HTTP: adjust request-connection assignment.
Prefer existing, idle connections to creating new connections,
even when below the max-connection limit. Gives much better re-use
and pipeline-ing, and hence reduced setup time/trips.
2013-09-28 14:03:39 +01:00
James Turner
add14dd27c Reposition hook for terrasync.
When re-init-ing the sim, tell TerraSync what's going on (we don't want
to actually reset it, since that would disturb in-flight downloads).
Add an explicit method so it can reset its last lon/lat, and hence do
the initial sync at the new location correctly.
2013-09-27 20:28:43 +01:00
James Turner
61516a5e97 Terrasync: Expose transfer rate as a property. 2013-09-27 18:23:51 +01:00
James Turner
17418039e1 HTTP bugfix + enhancement.
Track 'waiting for response' state explicitly, so we don't
falsely report IDLE when waiting for a response.

Expose bytes-per-second download rate as metric.
2013-09-27 18:20:03 +01:00
James Turner
25cae61211 Allow TerraSync to be inited early.
Add explicit subsystem state tracking so we can safely init()
terrasync very early during startup, and hence overlap lengthy operations
(Shared Models sync and initial NavCache build)
2013-09-26 12:11:48 +01:00
James Turner
db98c7440e Parallel sync of items.
When using built-in sync code, separate items into distinct slots.
Slots process items sequentially, but each slot works in parallel (using 
a single shared HTTP engine). This allows tiles to be synced in parallel
with airports/shared models data, greatly increasing responsiveness
to get tiles synced on initial launch.
2013-09-25 16:31:10 +01:00
James Turner
3783ae2234 Rename WaitingTile to WaitingSyncItem.
We already synchronise other things besides tiles, and will soon want different
behaviour based on the type of item we're syncing (so we can synchronize some items in parallel). Rename the struct to be clearer, and add an enum encoding the type of item for future use.
2013-09-23 18:20:16 +01:00
James Turner
3e8732b230 Libsvn / APR dependency is removed.
Remove any use of libsubversion / API in Simgear, and always
compile the built-in SVN client code.
2013-09-23 18:05:37 +01:00
James Turner
b39bca9458 Fix no-svn build (Win64 only at present) 2013-09-20 09:18:43 +01:00
James Turner
d263334030 Attempting to fix import/export linkage on Windows.
Hopefully this tells the Expat headers not to do any clever
declspec(import) or export stuff, which we don't want since we only
use the symbols within SimGearCore, and don't export them.
2013-09-19 22:07:41 +01:00
James Turner
b2cea62189 Even more forcing of include file names.
(It's a good thing Windows doesn't ship Expat, since apparently
every other platform does)
2013-09-19 21:58:23 +01:00
James Turner
d6b886c69b Change got lost in the move/rename, not good. 2013-09-19 21:47:40 +01:00
James Turner
38fb9ea41e Intermediate static libs have issues.
Switch back to including the bundled expat sources directly in the
targets, since transitive linking of static libs is very awkward.
Makes static build happy again (let's see what else breaks)
2013-09-19 21:42:28 +01:00
James Turner
a922aaa68e Move bundled Expat to new home.
Renamed bundled Expat headers to avoid any
possibility of accidental including system headers when
using bundled Expat, or vice-versa. Should help with SVN
crashes reported by Thomas.
2013-09-19 20:12:32 +01:00
James Turner
4f2e36ca46 rand(), not random(), for Windows. 2013-09-19 08:57:34 +01:00
James Turner
f367627cac Fix HTTP unit test.
Also fix a signed/unsigned warning I caused.
2013-09-18 22:55:11 +01:00
James Turner
7a7fcf10ad Fix missing include for non-Mac 2013-09-18 22:13:04 +01:00
James Turner
b9bd2734eb Persistent SVN update cache.
Make the already present cache of updated URLs persistent, with a
definable lifetime, currently 24 hours. This ensures terrasync-ed
resources are checked less often (max once per day) instead of each
FGFS launch, which should greatly cut down requests to the backend.
2013-09-18 21:40:35 +01:00