namespace, copyright headers, indentation, formatting, everything...
2008-09-11 Michael Natterer <mitch@gimp.org> * plug-ins/script-fu/script-fu-regex.[ch]: namespace, copyright headers, indentation, formatting, everything... * plug-ins/script-fu/scheme-wrapper.c: changed accordingly. Some formatting cleanup here too. svn path=/trunk/; revision=26925
This commit is contained in:
committed by
Michael Natterer
parent
5b8abde69f
commit
5c6132b8cb
@ -1,3 +1,11 @@
|
||||
2008-09-11 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/script-fu/script-fu-regex.[ch]: namespace, copyright
|
||||
headers, indentation, formatting, everything...
|
||||
|
||||
* plug-ins/script-fu/scheme-wrapper.c: changed accordingly. Some
|
||||
formatting cleanup here too.
|
||||
|
||||
2008-09-11 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimp/gimpexport.c (struct ExportAction): make string members
|
||||
|
||||
@ -104,9 +104,10 @@ struct named_constant const script_constants[] =
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/* The following constants are deprecated. They are */
|
||||
/* included to keep backwards compatability with */
|
||||
/* older scripts used with version 2.0 of GIMP. */
|
||||
/* The following constants are deprecated. They are
|
||||
* included to keep backwards compatability with
|
||||
* older scripts used with version 2.0 of GIMP.
|
||||
*/
|
||||
struct named_constant const old_constants[] =
|
||||
{
|
||||
{ "NORMAL", GIMP_NORMAL_MODE },
|
||||
@ -239,7 +240,7 @@ ts_interpret_string (const gchar *expr)
|
||||
sc.tracing = 1;
|
||||
#endif
|
||||
|
||||
sc.vptr->load_string (&sc, (char *)expr);
|
||||
sc.vptr->load_string (&sc, (char *) expr);
|
||||
|
||||
return sc.retcode;
|
||||
}
|
||||
@ -247,8 +248,8 @@ ts_interpret_string (const gchar *expr)
|
||||
const gchar *
|
||||
ts_get_success_msg (void)
|
||||
{
|
||||
if (sc.vptr->is_string(sc.value))
|
||||
return sc.vptr->string_value(sc.value);
|
||||
if (sc.vptr->is_string (sc.value))
|
||||
return sc.vptr->string_value (sc.value);
|
||||
|
||||
return "Success";
|
||||
}
|
||||
@ -278,7 +279,7 @@ tinyscheme_init (const gchar *path,
|
||||
|
||||
/* Initialize the TinyScheme extensions */
|
||||
init_ftx (&sc);
|
||||
init_re (&sc);
|
||||
script_fu_regex_init (&sc);
|
||||
|
||||
/* register in the interpreter the gimp functions and types. */
|
||||
init_constants ();
|
||||
@ -343,7 +344,7 @@ set_run_mode_constant (GimpRunMode run_mode)
|
||||
symbol = sc.vptr->mk_symbol (&sc, "SF-RUN-MODE");
|
||||
sc.vptr->scheme_define (&sc, sc.global_env, symbol,
|
||||
sc.vptr->mk_integer (&sc, run_mode));
|
||||
sc.vptr->setimmutable(symbol);
|
||||
sc.vptr->setimmutable (symbol);
|
||||
}
|
||||
|
||||
static void convert_string (gchar *str);
|
||||
|
||||
@ -1,8 +1,30 @@
|
||||
/* re.c */
|
||||
/* Henry Spencer's implementation of Regular Expressions,
|
||||
used for TinyScheme */
|
||||
/* Refurbished by Stephen Gildea */
|
||||
/* Ported to GRegex by Michael Natterer */
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Based on re.c
|
||||
*
|
||||
* Henry Spencer's implementation of Regular Expressions,
|
||||
* used for TinyScheme
|
||||
*
|
||||
* Refurbished by Stephen Gildea
|
||||
*
|
||||
* Ported to GRegex and de-uglified by Michael Natterer
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@ -10,6 +32,8 @@
|
||||
#include "script-fu-regex.h"
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static pointer foreign_re_match (scheme *sc,
|
||||
pointer args);
|
||||
static void set_vector_elem (pointer vec,
|
||||
@ -17,24 +41,10 @@ static void set_vector_elem (pointer vec,
|
||||
pointer newel);
|
||||
|
||||
|
||||
#if 0
|
||||
static char* utilities=";; return the substring of STRING matched in MATCH-VECTOR, \n"
|
||||
";; the Nth subexpression match (default 0).\n"
|
||||
"(define (re-match-nth string match-vector . n)\n"
|
||||
" (let ((n (if (pair? n) (car n) 0)))\n"
|
||||
" (substring string (car (vector-ref match-vector n))\n"
|
||||
" (cdr (vector-ref match-vector n)))))\n"
|
||||
"(define (re-before-nth string match-vector . n)\n"
|
||||
" (let ((n (if (pair? n) (car n) 0)))\n"
|
||||
" (substring string 0 (car (vector-ref match-vector n)))))\n"
|
||||
"(define (re-after-nth string match-vector . n)\n"
|
||||
" (let ((n (if (pair? n) (car n) 0)))\n"
|
||||
" (substring string (cdr (vector-ref match-vector n))\n"
|
||||
" (string-length string))))\n";
|
||||
#endif
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
init_re (scheme *sc)
|
||||
script_fu_regex_init (scheme *sc)
|
||||
{
|
||||
sc->vptr->scheme_define (sc,
|
||||
sc->global_env,
|
||||
@ -42,10 +52,28 @@ init_re (scheme *sc)
|
||||
sc->vptr->mk_foreign_func(sc, foreign_re_match));
|
||||
|
||||
#if 0
|
||||
sc->vptr->load_string (sc,utilities);
|
||||
sc->vptr->load_string
|
||||
(sc,
|
||||
";; return the substring of STRING matched in MATCH-VECTOR,\n"
|
||||
";; the Nth subexpression match (default 0).\n"
|
||||
"\n"
|
||||
"(define (re-match-nth string match-vector . n)\n"
|
||||
" (let ((n (if (pair? n) (car n) 0)))\n"
|
||||
" (substring string (car (vector-ref match-vector n))\n"
|
||||
" (cdr (vector-ref match-vector n)))))\n"
|
||||
"(define (re-before-nth string match-vector . n)\n"
|
||||
" (let ((n (if (pair? n) (car n) 0)))\n"
|
||||
" (substring string 0 (car (vector-ref match-vector n)))))\n"
|
||||
"(define (re-after-nth string match-vector . n)\n"
|
||||
" (let ((n (if (pair? n) (car n) 0)))\n"
|
||||
" (substring string (cdr (vector-ref match-vector n))\n"
|
||||
" (string-length string))))\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static pointer
|
||||
foreign_re_match (scheme *sc,
|
||||
pointer args)
|
||||
|
||||
@ -1,2 +1,26 @@
|
||||
/* This function gets called when TinyScheme is initializing the extension */
|
||||
void init_re (scheme *sc);
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SCRIPT_FU_REGEX_H__
|
||||
#define __SCRIPT_FU_REGEX_H__
|
||||
|
||||
|
||||
void script_fu_regex_init (scheme *sc);
|
||||
|
||||
|
||||
#endif /* __SCRIPT_FU_REGEX_H__ */
|
||||
|
||||
Reference in New Issue
Block a user