Commit Graph

800 Commits

Author SHA1 Message Date
Ray Greenwell d82a926ca1 Add an example to the docs.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5986 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-11-06 21:18:43 +00:00
Ray Greenwell ee27342a24 Proposed change to readObject().
The purpose is to
- Ensure type checking for "fail-fast" detection of streaming errors.
- But simplify it so that callers don't have to cast themselves and
  potentially screw up by using "String(obj)" or "Array(obj)", or miss out
  on the fail-fastyness by using "obj as SomeType".
- But, at the same time, allow for the sveltest code possible.
    // first one is a bit shorter!
    _name = ins.readObject(Name);
    _name = Name(ins.readObject());

    // first one is a bit shorter!
    _state = ins.readObject(String);
    _state = ins.readObject() as String;


So, to sum up: the code is the shortest and doesn't require special-casing
if you are reading a String, Number, int, uint, Boolean, or Array.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5984 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-11-06 01:27:03 +00:00
Ray Greenwell c16de5994e Moved these here to narya.
Lately I'm trying to do things more "actionscripty", and so we just
use the "natural" iteration on an object (either 'for' or 'for each').
Plus, we never use these Iterators anywhere except in presents-based code.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5983 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-10-27 00:57:48 +00:00
Ray Greenwell b124934a97 MethodQueue -> DelayUtil.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5981 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-10-21 21:49:17 +00:00
Nathan Curtis ea49d70129 * Add Msoy's MethodProfiler so I can use it in Riposte.
* Apparently, a couple of whitespace cleanups my gvim did awhile ago while I was looking around in
  here.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5971 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-24 20:40:48 +00:00
Ray Greenwell 1c538ac78e Drive-by logging modernization.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5970 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-24 20:18:14 +00:00
Ray Greenwell dae0f7f44f Fuckit, let's use uint paramters and make the default uint.MAX_VALUE.
Unless I have to roll this back because the like compiler in CS3
shits its pants trying to understand it (external references for
default parameter values seem to sometimes fail).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5969 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-24 20:13:39 +00:00
Ray Greenwell 3f2468e7a1 Oh crap, let's make ObjectOutputStream protect against fuckup, too.
Note that we're using ints instead of units for offset/length.
Does anyone really need a byte array larger than 2^31?
And if so, wouldn't you then also be within sight of busting 2^32?
Why not make it a Number and support up to 2^53?
Number is no guarantee of a desire for a floating-point value in
the flash libraries, see Graphics.lineStyle()'s first parameter.
Actionscript, you fail for not having long.
And... I said I wasn't going to bitch at Adobe/Macromedia any more
but this is a total FAIL.
0 is a valid length. Everyone knows this.
Can you imagine if they picked a different constant?
   length: the number of bytes to read, unless it's 9, in which case
   it reads *all* the bytes. Your code should check to see if you're
   about to read 9 bytes, and instead read 8 in one go and then
   a follow-on byte.
uint.MAX_VALUE would have made tons more sense.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5968 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-24 20:09:35 +00:00
Ray Greenwell 33d19f7a69 Another fix for potential streaming errors.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5967 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-24 19:37:34 +00:00
Ray Greenwell 730d448e40 As far as I can figure, ArrayMask objects are used even when
the Array length is 0, so let's make sure we don't cause any
streaming errors here.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5966 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-24 19:35:35 +00:00
Ray Greenwell f75d46f75f Add a better toString, for debugging.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5963 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-17 23:16:22 +00:00
Ray Greenwell 53f1dff95d These are all final.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5962 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-17 21:58:30 +00:00
Ray Greenwell f9bc385c99 Some examples.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5961 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-17 21:53:02 +00:00
Ray Greenwell a24b0d2d03 So, these classes like Integer and langBoolean exist solely for
streaming to our java server, so let's just make them streamable directly.
Does away with the need for custom Streamers.
Also made them Hashable, in case we read a StreamableHashMap containing
Integers as keys, for example.
Less code is better code.
(Why was BooleanStreamer added the other day? langBoolean was already Streamable
 and was already in Translations)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5960 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-17 21:42:25 +00:00
Ray Greenwell 055aac9b55 Use Joiner instead of StringBuilder, in some places.
Use String concatination in others (it's faster in actionscript than in Java)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5959 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-16 21:13:07 +00:00
Ray Greenwell 9f967dd575 This is already output by SimpleStreamableObject...
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5958 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-16 20:03:53 +00:00
Tom Conkling e0a4340947 add missing BooleanStreamer
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5957 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-15 21:53:26 +00:00
Ray Greenwell 32db838be2 Hmm don't throw the ArgumentError inside our own catch, even though
we should have re-thrown it.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5951 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-11 16:49:37 +00:00
Ray Greenwell 4fe12a043d Even when fed an object graph with no loops we could have a stack
overflow in our recursive checking. Try to catch it and cope.
I have a bad feeling this won't actually work in some envs.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5950 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-11 15:30:43 +00:00
Tom Conkling f4ab06b619 Integers and Booleans are final. This fixes the Integer[] streaming problem I was having with Bite Me.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5949 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-09-11 02:13:03 +00:00
Ray Greenwell 3aec11f519 This is cloggin' the bureau loggin'.
I'm pretty sure it's the BaseGameConfig.
Typically, clients don't add directly to a StreamableHashMap received
from the server, why would they? So let's just treat it as a String-key map
and shut it up.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5937 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-30 20:40:37 +00:00
Ray Greenwell 2b5b0389e0 These classes moved from flash-utils back into narya.
Not generally useful to your everyday flash coder.
MessageBundle and MessageManager are built on top of Flex Resources,
and were already being excluded from our asdocs, and TimeUtil uses MessageBundle.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5932 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-25 19:42:47 +00:00
Ray Greenwell da0e42a2b4 Inline references to other classes? That is not the actionscript way.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5931 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-25 19:24:21 +00:00
Ray Greenwell 5e0eb1d970 Fix the asdocs here. But wait, why is this even showing up in the SDK docs?
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5930 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-25 18:56:18 +00:00
Ray Greenwell 1083490e73 Use newMapOf().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5929 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-24 21:36:19 +00:00
Ray Greenwell f8d5e679fd We use StreamableHashMap sensible and only store one kind of key.
Let's guess the type based on the first key unserialized, and guess if it
was empty.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5928 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-24 05:22:05 +00:00
Ray Greenwell c9ea3709f7 Use new Maps factory.
The old HashMap class was a frankenstein one-size-fits-all mess of:
- storing simple objects
- storing Hashables
- having the capability to provide external functions to hash and check
equality of any other type of key.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5927 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-24 02:54:23 +00:00
Ray Greenwell 44480ada4a Use ClassUtil.isAssignableAs().
It works in thane now.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5922 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-21 22:45:36 +00:00
Ray Greenwell 4848fe4b29 Now that ByteEnum has been liberated from depot, lets
support streaming them as bytes.
It's better than writing a modified UTF String, but
it'd be even nicer if we could avoid the short to read the class name
(Enums are final), but I suppose we still have to know whether one is null
or not. Hm.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5920 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-19 02:18:14 +00:00
Ray Greenwell 00416168bb Nix some warnings. One shouldn't be coped with, and so let's let it NPE.
The other happens now in normal circumstances in msoy, and I'd rather
not surround the call to super with an if to avoid this warning, and
potentially kablooie in the future if other functionality is added
to leftLocation in this base class...


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5918 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-18 21:34:51 +00:00
Ray Greenwell a3b20e176b Scratched an itch...
Removed the unholy 'alreadyDisplayed' hack and associated return value
from ChatDisplay.
The localtype should be used to determine whether something should be
displayed. If not, why should ChatDisplay registration order matter?
It shouldn't. If there are two ChatDisplays that could potentially
show the same message and you only want one of them to, sort that
out in your own fuckin' code.
I'm not changing the Java side right now because I'd have to patch-up
a bunch of projects...


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5916 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-15 00:06:12 +00:00
Ray Greenwell 1b17350ee0 Allow command handlers to be unregistered.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5915 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-14 23:45:47 +00:00
Ray Greenwell 4a734d00ef Drive-by logging varargification.
Don't ask what I'm doing driving in this neighborhood.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5913 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-14 22:12:56 +00:00
Ray Greenwell 04316d8620 My actionscript-fu has improved since I originally wrote this.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5911 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-14 03:10:48 +00:00
Ray Greenwell 49f5d7fed8 We don't read creds on the client.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5910 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-13 23:34:12 +00:00
Ray Greenwell e469bb4abc I'm pretty sure we never read Credentials on the client...
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5909 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-13 23:32:30 +00:00
Ray Greenwell 7489a64555 Every byte is precious!
No need to tell the server the callerOid, it already knows it.
This saves 4 bytes for every listener you pass into an invocation request.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5908 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-13 19:15:21 +00:00
Ray Greenwell 8284198e57 Don't do it twice. Yes, I'm embracing making things more "actionscripty",
including some implicit coercian to a Boolean, which can actually
be quite dangerous... but only with Strings and Numbers and whatnot.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5907 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-13 06:23:27 +00:00
Ray Greenwell ac2a633047 Regenerated services, and the callers that love them.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5906 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-13 06:18:26 +00:00
Ray Greenwell fe3d89132d A little bit of tweakery so that the invocation director to use
is known by any invocation marshaller, and so the client does
not need to be passed in.

Just here on the actionscript side for now, but this change may
make its way to Java.

Other changes may follow...


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5904 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-13 06:17:28 +00:00
Jamie Doornbos 5d8a93632e Allow callers to detect when a client is about to die even though it is connected and logged on. This allows handling of the edge case where a client is getting throttled.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5897 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-08-05 22:12:16 +00:00
Michael Bayne d0d5c2805e StringUtil got moved to flash-utils.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5892 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-30 21:55:40 +00:00
Michael Bayne 805ef99374 Various utility classes moved to flash-utils.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5889 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-21 20:56:35 +00:00
Tom Conkling eceae381af Move ObjectSet to narya from contrib
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5876 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-17 18:58:45 +00:00
Tom Conkling 7e5f28042f I thought I compiled this before committing but apparnetly not
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5875 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-17 18:44:34 +00:00
Tom Conkling d4c3964b22 ObjectMap
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5874 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-17 18:37:38 +00:00
Ray Greenwell 83ce3f004e Added ByteEnum interface to ActionScript, and ByteEnumUtil.
Use this if you want your enums to persist to a byte reliably.
Coming soonesque: narya streaming support for ByteEnum.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5859 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-11 00:08:41 +00:00
Ray Greenwell 6dbdf8d413 Killed fromOrdinal().
Not available in Java, and generally a bad idea.
Pretend ordinal() doesn't exist, unless you're writing EnumSet, or something.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5858 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-11 00:06:23 +00:00
Tom Conkling 10c1da22bd case-insensitive String comparison util
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5857 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-10 20:24:45 +00:00
Tom Conkling c260457c6e Whoops
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5850 542714f4-19e9-0310-aa3c-eee0fc999fb1
2009-07-04 23:06:07 +00:00