|
From: Mojca M. <moj...@gm...> - 2012-08-28 19:24:09
|
On Tue, Aug 28, 2012 at 8:26 PM, Ethan A Merritt wrote:
> On Tuesday, August 28, 2012 10:20:35 am Mojca Miklavec wrote:
>> What about the other two trivial patches?
>>
>> --- a/src/set.c
>> +++ b/src/set.c
>> @@ -1420,10 +1420,10 @@ static void
>> set_degreesign(char *locale)
>> {
>> #if defined(HAVE_ICONV) && !(defined WIN32)
>> - char degree_utf8[3] = {'\302', '\260', '\0'};
>> + const char degree_utf8[3] = {'\302', '\260', '\0'};
>> size_t lengthin = 3;
>> size_t lengthout = 8;
>> - char *in = degree_utf8;
>> + const char *in = degree_utf8;
>> char *out = degree_sign;
>> iconv_t cd;
>
> That generates the following warning instead:
> set.c:1444:17: warning: passing 'const char **' to parameter of type 'char **'
> discards qualifiers in nested pointer types [-Wincompatible-pointer-types]
> if (iconv(cd, &in, &lengthin, &out, &lengthout) == (size_t)(-1))
>
> IMHO "const char" is impossible to get right, and warnings can safely
> be ignored.
OK, fair enough.
>> --- a/term/lua.trm
>> +++ b/term/lua.trm
>> @@ -168,7 +168,7 @@ static char last_error_msg[MAX_LINE_LEN+1] = "";
>> * the plot's bounding box
>> */
>> static int
>> -LUA_GP_get_boundingbox() {
>> +LUA_GP_get_boundingbox(lua_State *L) {
>> lua_newtable (L);
>> lua_pushstring (L, "xleft");
>> lua_pushinteger(L, plot_bounds.xleft);
>
> Wouldn't that require a corresponding change in the call site[s]?
All other functions use lua_State *L, just this one lacks it. But I
don't know details about how it works.
> For that matter, where _are_ the call sites - in the lua code?
For example
local t = gp.get_boundingbox()
local t = gp.get_all_variables()
in gnuplot-tikz.lua
and in terminal the following mappings are registered (slightly
simplified; without #ifdefs):
static const luaL_Reg gp_methods[] = {
{"write", LUA_GP_write},
{"int_error", LUA_GP_int_error},
{"int_warn", LUA_GP_int_warn},
{"term_out", LUA_GP_term_out},
{"get_boundingbox", LUA_GP_get_boundingbox},
{"is_multiplot", LUA_GP_is_multiplot},
{"get_all_variables", LUA_GP_get_all_variables},
{"term_options", LUA_GP_term_options},
{"parse_color_name", LUA_GP_parse_color_name},
{NULL, NULL}
};
static void LUA_register_gp_fnc ()
{
LUA_register(L, "gp", gp_methods);
}
Mojca
|