summaryrefslogtreecommitdiff
path: root/indra/llcommon
AgeCommit message (Collapse)Author
2011-02-18Introduce and use new sendReply() function for LLEventAPI methods.Nat Goodspeed
Each LLEventAPI method that generates a reply needs to extract the name of the reply LLEventPump from the request, typically from a ["reply"] key, copy the ["reqid"] value from request to reply, locate the reply LLEventPump and send the enriched reply object. Encapsulate in sendReply() function before we proliferate doing all that by hand too many more times.
2011-02-17Automated merge with ↵Nat Goodspeed
http://pdp47.lindenlab.com/cgi-bin/hgwebdir.cgi/brad/viewer-development/
2011-02-14bump version number to 2.7.0Oz Linden
2011-02-14Automated merge with http://hg.secondlife.com/viewer-developmentNat Goodspeed
2011-02-09Add test to call map-style functions with full map/array params.Nat Goodspeed
Test also passes overlong arrays and maps with extraneous keys; in all cases we expect the same set of values to be passed to the registered functions.
2011-02-07For test purposes, capture at registration each function's Vars*.Nat Goodspeed
We'd introduced FunctionsTriple to associate a pair of registered function names with the Vars* on which those functions should operate. But with more different tests coming up, it became clear that restating the Vars* every time a given function name appeared in any such context was redundant. Instead, extended addf() to accept and store the relevant Vars* for each registered function, be it the global Vars for the free functions and static methods or the stack Vars for the non-static methods. Added varsfor() function to retrieve and validate the Vars* for a given function name. Eliminated array_funcs() function, restating aggregates of names to test as LLSD collections. Where before these were coerced into a separate LLSD map with ["a"] and ["b"] keys, that map can now be part of the original structure.
2011-02-06Untested support for passing array to map-registered function.Nat Goodspeed
An array-registered function has no param names, so you can only pass an array: a map would be meaningless. Initial implementation of map-registered functions assumed that since you CAN pass a map, you MUST pass a map. But in fact it's meaningful to pass an array as well -- for whatever reason -- and easy to implement, so there you are. Tests to follow.
2011-02-06Add test verifying passing LLSD() to const char* parameter.Nat Goodspeed
LLSDParam<const char*> is coded to pass NULL for an isUndefined() LLSD value, so event-based caller can choose whether to pass NULL, "" or whatever string value to such a parameter. Ensure this behavior.
2011-02-05Introduce zipmap() function and use it in place of frequent loops.Nat Goodspeed
One operation we often use is to take an LLSD array of param names, a corresponding LLSD array of values, and create from them a name=value LLSD map. Instead of doing that "by hand" every time, use a function.
2011-02-05Make array-funcs success test exercise args-array-too-long case too.Nat Goodspeed
Streamline a bit more redundancy from the code in that test.
2011-02-05Consolidate paramsa, paramsb, et al., into ["a"], ["b"] arrays.Nat Goodspeed
Following the C++ convention of having two distinct somethigna, somethingb names, initially we introduced paramsa, paramsb LLSD arrays, following that convention all the way down the line. This led to two distinct loops every time we wanted to walk both arrays, since we didn't want to assume that they were both the same size. But leveraging the fact that distinct LLSD arrays stored in the same LLSD container can in fact be of different lengths, refactored all the pairs of vars into top-level LLSD maps keyed by ["a"] and ["b"]. That lets us perform nested loops rather than duplicating the logic, making test code much less messy.
2011-02-05Fix Vars::cp dangling-pointer problem.Nat Goodspeed
Naively storing a const char* param in a const char* data member ignores the fact that once the caller's done, the string data referenced by that pointer will probably be freed. Store the referenced string in a std::string instead.
2011-02-05Add successful calls to array-style functions.Nat Goodspeed
2011-02-04Change FunctionsTriple refs to pointers to facilitate passing.Nat Goodspeed
A certain popular-but-dumb compiler seems to think that initializing a std::vector from a pair of iterators requires assignment. A struct containing a reference cannot be assigned. Pointers get us past this issue.
2011-02-04Move FunctionsTriple data to function returning vector<same>.Nat Goodspeed
We want to break out a couple different test methods that both need the same data. While we could define a std::vector<FunctionsTriple> in the lleventdispatcher_data class and initialize it using a classic {} initializer as in array_funcs(), using a separate function puts it closer to the tests consuming that data, and helps reduce clutter in the central data class. Either way, it's cool that BOOST_FOREACH() handles the gory details of iterating over a std::vector vs. a classic-C array.
2011-02-03BOOST_FOREACH(LLSD) helpers more readable with 'using namespace'.Nat Goodspeed
2011-02-03Introduce BOOST_FOREACH() helpers for LLSD in llsdutil.h.Nat Goodspeed
You can't directly write: BOOST_FOREACH(LLSD item, someLLSDarray) { ... } because LLSD has two distinct iteration mechanisms, one for arrays and one for maps, neither using the standard [const_]iterator typedefs or begin()/end() methods. But with these helpers, you can write: BOOST_FOREACH(LLSD item, llsd::inArray(someLLSDarray)) { ... } or BOOST_FOREACH(const llsd::MapEntry& pair, llsd::inMap(someLLSDmap)) { ... } These are in namespace llsd instead of being (e.g.) llsd_inMap because with a namespace at least your .cpp file can have a local 'using': using namespace llsd; BOOST_FOREACH(LLSD item, inArray(someLLSDarray)) { ... } It's namespace llsd rather than LLSD because LLSD can't be both a namespace and a class name.
2011-02-03Add test to call array-style functions with too-short array.Nat Goodspeed
Also, finally got sick of hand-writing the official iterator-loop idiom and dragged in BOOST_FOREACH(). Because LLSD has two completely different iteration styles, added inArray and inMap helper classes to be able to write: BOOST_FOREACH(LLSD item, inArray(someArray)) { ... }
2011-02-02Add test to call no-args functions using (map | array)-style callsNat Goodspeed
2011-02-02Add test to exercise map/array args mismatch validation.Nat Goodspeed
2011-02-02First few LLEventDispatcher call cases: try_call(), call CallablesNat Goodspeed
2011-02-01Replace boost::ptr_map<name, etc> with std::map<name, shared_ptr>.Nat Goodspeed
On Windows, unlike on Mac or Linux, boost::ptr_map<> started insisting on this concept of clonability. In other words, it wants to own a unique instance of the pointee; if you copy a value_type -- even to dereference an iterator! -- it wants to construct a whole new instance of the mapped_type. That's nuts. A std::map<..., boost::shared_ptr<>> has the property I want (the mapped_type goes away when the entry is erased), plus it's willing to pass around the shared_ptr to the same instance of the mapped_type. This change also permits simplifying a couple awkward kludges I'd already had to make to accommodate ptr_map's idiosyncracies.
2011-02-01Replace ad-hoc test functions/methods with systematic enumeration.Nat Goodspeed
Previous tests involved a small handful of functions with only a couple different parameter types. Now we exhaustively invoke every registration case, plus every metadata query case. Call cases still pending.
2011-01-31Fix crash bug in array-style metadata query for nullary functions.Nat Goodspeed
The shortcut way to construct an LLSD array of size n is to assign LLSD() to array[n-1]. That's fine -- as long as you remember not to do it for n == 0.
2011-01-31Resolve LLEventDispatcher::add(function(const LLSD&)) ambiguity.Nat Goodspeed
A free function or static method accepting(const LLSD&) was being intercepted by the free-function-with-arbitrary-parameters overload instead of the original Callable overload. Added an overload that specifically redirects that case. Documented limit of ~6 arbitrary parameters for directly-called functions (5 for methods). Beyond that many, you have to write a Callable wrapper function and unpack the parameters from the LLSD by hand.
2011-01-31Fix a couple gotchas in LLSDArray, LLSDParam, llsd_equals().Nat Goodspeed
Nested LLSDArray expressions, e.g.: LLSD array_of_arrays(LLSDArray(LLSDArray(17)(34)) (LLSDArray("x")("y"))); would quietly produce bad results because the outermost LLSDArray was being constructed with the compiler's implicit LLSDArray(const LLSDArray&) rather than LLSDArray(const LLSD&) as the reader assumes. Fixed with an explicit copy constructor to Do The Right Thing. Generalized LLSDParam<float> specialization into a macro to resolve similar conversion ambiguities for float, LLUUID, LLDate, LLURI and LLSD::Binary. Added optional bits= argument to llsd_equals() to permit comparing embedded Real values using is_approx_equal_fraction() rather than strictly bitwise. Omitting bits= retains current bitwise-comparison behavior.
2011-01-28Extend LLEventAPI to directly call other functions & methods.Nat Goodspeed
Until now, LLEventAPI has only been able to register functions specifically accepting(const LLSD&). Typically you add a wrapper method to your LLEventAPI subclass, register that, have it extract desired params from the incoming LLSD and then call the actual function of interest. With help from Alain, added new LLEventAPI::add() methods capable of registering functions/methods with arbitrary parameter signatures. The code uses boost::fusion magic to implicitly match incoming LLSD arguments to the function's formal parameter list, bypassing the need for an explicit helper method. New add() methods caused an ambiguity with a previous convenience overload. Removed that overload and fixed the one existing usage. Replaced LLEventDispatcher::get() with try_call() -- it's no longer easy to return a Callable for caller to call directly. But the one known use of that feature simply used it to avoid fatal LL_ERRS on unknown function-name string, hence the try_call() approach actually addresses that case more directly. Added indra/common/lleventdispatcher_test.cpp to exercise new functionality.
2011-01-28Introduce LLSDArray, LLSDMap, LLSDParam.Nat Goodspeed
LLSDArray is a helper to construct an LLSD::Array value inline. LLSDMap is a helper to construct an LLSD::Map value inline. LLSDParam is a customization point, a way for generic code to support unforseen parameter types as conversion targets for LLSD values.
2011-01-19pull changes back from betaOz Linden
2011-01-15renamed temp name flag member in name cache to avoid confusion with similar ↵Oz Linden
names in other classes
2011-01-07Merge from viewer-developmentDon Kjer
2011-01-07increment minor revision number to make version "2.6.0"Oz Linden
2010-12-30STORM-955: VWR-24312: Massively duplicated objectsAleric Inglewood
Turns out that most of my SNOW-800 patch was included in Viewer 2 (albeit without crediting me). However, not everything was used and some more cleaning up was possible. After this patch, and when compiling with optimization, there are no duplicates left anymore that shouldn't be there in the first place. Apart from the debug stream iostream guard variable, there are several static variables with the same name (r, r1, r2, etc) but that indeed actually different symbol objects. Then there are a few constant POD arrays that are duplicated a hand full of times because they are accessed with a variable index (so optimizing them away is not possible). I left them like that (although defining those as extern as well would have been more consistent and not slower; in fact it would be faster theoretically because those arrays could share the same cache page then).
2011-01-28trivial: convert to "unix return"Xiaohong Bao
2011-01-26add "pause" function for SH-846: design and implement the debug code to ↵Xiaohong Bao
locate memory leaking
2011-01-26for SH-846: design and implement the debug code to locate memory leakingXiaohong Bao
2010-12-22Merge with viewer-developmentDon Kjer
2010-12-21Merge from trunkAndrew A. de Laix
2010-12-17Merge from viewer-development post 2.4 releaseMonty Brandenberg
2010-12-15Merge from don_linden/viewer-sandboxDon Kjer
2010-12-15pulling fixes back from viewer-betaOz Linden
2010-12-14Automated merge with https://bitbucket.org/mani_linden/viewer-developmentNat Goodspeed
2010-12-14SWAT-352: when loading lleventhost, call apr_dso_error() function.Nat Goodspeed
In addition to its usual apr_sterror() function, APR defines a special function specifically for errors relating to the apr_dso_*() functions. Introduce ll_apr_warn_status() and ll_apr_assert_status() overloads accepting apr_dso_handle_t* to call apr_dso_error() as well as apr_strerror() and log its output. Use new ll_apr_warn_status() in LLAppViewer::loadEventHostModule() for apr_dso_load() and apr_dso_sym() calls. Instead of shorthand ll_apr_assert_status(), use with llassert_always() so check is still performed even in Release build. Add more lleventhost-related debugging output, e.g. full pathname of the DLL. On Mac and Linux, call 'file' command to report nature of the DLL too.
2010-12-14Mergebrad kittenbrink
2010-12-13permit flush when disabled.Andrew A. de Laix
2010-12-13Merge from viewer-developmentDon Kjer
2010-12-10Automated merge with https://bitbucket.org/mani_linden/viewer-development/Andrew A. de Laix
2010-12-10fix possible crash on shutdown in event queue flush.Andrew A. de Laix
2010-12-10fix working directory in install script and remove dependency on open option ↵Andrew A. de Laix
--args which is 10.6 only. Also fix erroneous check in process launcher which was mistakenly reporting a failed execution of the new updater script.
2010-12-10fix crash if posting event during shutdown.Andrew A. de Laix