[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Graveman-cvs] Changes to graveman/current/src/tools.c
From: |
sylvain cresto |
Subject: |
[Graveman-cvs] Changes to graveman/current/src/tools.c |
Date: |
Wed, 16 Feb 2005 20:22:57 -0500 |
Index: graveman/current/src/tools.c
diff -u graveman/current/src/tools.c:1.12 graveman/current/src/tools.c:1.13
--- graveman/current/src/tools.c:1.12 Tue Feb 15 22:44:44 2005
+++ graveman/current/src/tools.c Thu Feb 17 01:22:53 2005
@@ -368,6 +368,88 @@
return Lstatus;
}
+/* ne retourne que les numeriques d'une chaine */
+gboolean get_only_numerics(gchar *Abuffer, gint Abufsize, gchar *Asource,
gchar Aend)
+{
+ gchar *s = Asource;
+ gchar *d = Abuffer;
+ gint Lnum = 0;
+
+ if (Abufsize<2) return FALSE;
+
+ *d=0;
+ while (*s && *s != Aend) {
+ if (isdigit(*s)) {
+ if (++Lnum == Abufsize-1) {
+ *Abuffer = 0;
+ return FALSE;
+ }
+ *(d++)=*s;
+ }
+ s++;
+ }
+ *d=0;
+
+ return TRUE;
+}
+
+/* retourne une chaine MM:SS en secondes */
+glong get_2time(gchar *Asource)
+{
+ gchar *s = Asource;
+ gchar *e;
+ glong Lret = 0;
+
+ while (*s && !isdigit(*s)) s++;
+ if (!*s) return -1;
+ e=s;
+
+ /* min */
+ while (isdigit(*s)) s++;
+ *(s++)=0;
+ Lret = atol(e) * 60;
+
+ /* sec */
+ while (*s && !isdigit(*s)) s++;
+ if (!*s) return -1;
+ e=s;
+ while (isdigit(*s)) s++;
+ *(s++)=0;
+ Lret += atol(e);
+
+ return Lret;
+}
+
+gdouble get_pourcent(gchar *Atotal, gchar *Aactu)
+{
+ glong Lnumtotal = atol(Atotal);
+ glong Lnumactu = atol(Aactu);
+
+ if (Lnumtotal == 0) return -1;
+
+ return (1.0/Lnumtotal) * Lnumactu;
+}
+
+gchar *next_no_numeric(gchar *Ade)
+{
+ gchar *Lret = Ade;
+
+ while (*Lret && isdigit(*Lret)) Lret++;
+
+ return *Lret ? Lret : NULL;
+}
+
+gchar *next_putzero(gchar *Asource, gchar Asrc)
+{
+ gchar *s;
+ if ((s=strchr(Asource, Asrc))) {
+ *(s++)=0;
+ return s;
+ }
+
+ return NULL;
+}
+
/*
* vim:et:ts=8:sts=2:sw=2
*/
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/05
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/07
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/10
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/12
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/12
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/12
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/15
- [Graveman-cvs] Changes to graveman/current/src/tools.c,
sylvain cresto <=
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/19
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/20
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/21
- [Graveman-cvs] Changes to graveman/current/src/tools.c, sylvain cresto, 2005/02/27