Send plymouth mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.freedesktop.org/mailman/listinfo/plymouth
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of plymouth digest..."


Today's Topics:

   1. [PATCH] [script] atan and substring (Richard)
   2. Re: [PATCH] [script] atan and substring (Charlie Brej)
   3. Re: [PATCH] [script] atan and substring (Richard)


----------------------------------------------------------------------

Message: 1
Date: Wed, 10 Mar 2010 16:42:52 +0000
From: Richard <[email protected]>
Subject: [PATCH] [script] atan and substring
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="utf-8"

Just a couple of script bindings. The single parameter atan function and a
substring function to flesh the string library out a bit. I wasn't sure if
it should finish with an error or finish with what it's already made if it
reached the end of the string while in the copy section.
diff --git a/src/plugins/splash/script/script-lib-math.c
b/src/plugins/splash/script/script-lib-math.c
index 383fe46..f614b18 100644
--- a/src/plugins/splash/script/script-lib-math.c
+++ b/src/plugins/splash/script/script-lib-math.c
@@ -85,6 +85,12 @@ script_lib_math_data_t *script_lib_math_setup
(script_state_t *state)
                               "value",
                               NULL);
   script_add_native_function (math_hash,
+                              "ATan",
+                              script_lib_math_double_from_double_function,
+                              atan,
+                              "value",
+                              NULL);
+  script_add_native_function (math_hash,
                               "ATan2",

script_lib_math_double_from_double_double_function,
                               atan2,
diff --git a/src/plugins/splash/script/script-lib-string.c
b/src/plugins/splash/script/script-lib-string.c
index 833a377..90c463b 100644
--- a/src/plugins/splash/script/script-lib-string.c
+++ b/src/plugins/splash/script/script-lib-string.c
@@ -62,6 +62,41 @@ static script_return_t script_lib_string_char_at
(script_state_t *state,
   return script_return_obj(script_obj_new_string (charstring));
 }

+static script_return_t script_lib_string_substring (script_state_t *state,
+                                                   void
*user_data)
+{
+  char *text = script_obj_as_string (state->this);
+  int start = script_obj_hash_get_number (state->local, "start");
+  int end = script_obj_hash_get_number (state->local, "end");
+  int text_count, substring_count;
+  char substring [end-start+1];
+
+  if (!text || start < 0 || end < start)
+    {
+      free (text);
+      return script_return_obj_null ();
+    }
+  for (text_count = 0; text_count < start; text_count++)
+    {
+      if (text[text_count] == '\0')
+        {
+          free (text);
+          return script_return_obj(script_obj_new_string (""));
+        }
+    }
+  for (text_count = start, substring_count = 0; text_count < end;
text_count++, substring_count++)
+    {
+      if (text[text_count] == '\0')
+        {
+          break;
+        }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/plymouth/attachments/20100310/23dd2c0f/attachment-0001.htm>

------------------------------

Message: 2
Date: Wed, 10 Mar 2010 17:25:42 +0000
From: Charlie Brej <[email protected]>
Subject: Re: [PATCH] [script] atan and substring
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed

On 10/03/10 16:42, Richard wrote:
> Just a couple of script bindings. The single parameter atan function and
> a substring function to flesh the string library out a bit. I wasn't
> sure if it should finish with an error or finish with what it's already
> made if it reached the end of the string while in the copy section.

Couple things, could you break up the patch into two and send them as files?



------------------------------

Message: 3
Date: Wed, 10 Mar 2010 17:51:26 +0000
From: Richard <[email protected]>
Subject: Re: [PATCH] [script] atan and substring
To: Charlie Brej <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="utf-8"

I wasn't sure if mailing lists accepted attachments.

On 10 March 2010 17:25, Charlie Brej <[email protected]> wrote:

> On 10/03/10 16:42, Richard wrote:
>
>> Just a couple of script bindings. The single parameter atan function and
>> a substring function to flesh the string library out a bit. I wasn't
>> sure if it should finish with an error or finish with what it's already
>> made if it reached the end of the string while in the copy section.
>>
>
> Couple things, could you break up the patch into two and send them as
> files?
>
> _______________________________________________
> plymouth mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/plymouth
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/plymouth/attachments/20100310/4b3673c8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atan.diff
Type: application/octet-stream
Size: 874 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/plymouth/attachments/20100310/4b3673c8/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: substring.diff
Type: application/octet-stream
Size: 2359 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/plymouth/attachments/20100310/4b3673c8/attachment-0003.obj>

------------------------------

_______________________________________________
plymouth mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/plymouth


End of plymouth Digest, Vol 17, Issue 4
***************************************

Reply via email to