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,64 +104,65 @@ 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 },
|
||||
{ "DISSOLVE", GIMP_DISSOLVE_MODE },
|
||||
{ "BEHIND", GIMP_BEHIND_MODE },
|
||||
{ "MULTIPLY", GIMP_MULTIPLY_MODE },
|
||||
{ "SCREEN", GIMP_SCREEN_MODE },
|
||||
{ "OVERLAY", GIMP_OVERLAY_MODE },
|
||||
{ "DIFFERENCE", GIMP_DIFFERENCE_MODE },
|
||||
{ "ADDITION", GIMP_ADDITION_MODE },
|
||||
{ "SUBTRACT", GIMP_SUBTRACT_MODE },
|
||||
{ "DARKEN-ONLY", GIMP_DARKEN_ONLY_MODE },
|
||||
{ "LIGHTEN-ONLY", GIMP_LIGHTEN_ONLY_MODE },
|
||||
{ "HUE", GIMP_HUE_MODE },
|
||||
{ "SATURATION", GIMP_SATURATION_MODE },
|
||||
{ "COLOR", GIMP_COLOR_MODE },
|
||||
{ "VALUE", GIMP_VALUE_MODE },
|
||||
{ "DIVIDE", GIMP_DIVIDE_MODE },
|
||||
{ "NORMAL", GIMP_NORMAL_MODE },
|
||||
{ "DISSOLVE", GIMP_DISSOLVE_MODE },
|
||||
{ "BEHIND", GIMP_BEHIND_MODE },
|
||||
{ "MULTIPLY", GIMP_MULTIPLY_MODE },
|
||||
{ "SCREEN", GIMP_SCREEN_MODE },
|
||||
{ "OVERLAY", GIMP_OVERLAY_MODE },
|
||||
{ "DIFFERENCE", GIMP_DIFFERENCE_MODE },
|
||||
{ "ADDITION", GIMP_ADDITION_MODE },
|
||||
{ "SUBTRACT", GIMP_SUBTRACT_MODE },
|
||||
{ "DARKEN-ONLY", GIMP_DARKEN_ONLY_MODE },
|
||||
{ "LIGHTEN-ONLY", GIMP_LIGHTEN_ONLY_MODE },
|
||||
{ "HUE", GIMP_HUE_MODE },
|
||||
{ "SATURATION", GIMP_SATURATION_MODE },
|
||||
{ "COLOR", GIMP_COLOR_MODE },
|
||||
{ "VALUE", GIMP_VALUE_MODE },
|
||||
{ "DIVIDE", GIMP_DIVIDE_MODE },
|
||||
|
||||
{ "BLUR", GIMP_BLUR_CONVOLVE },
|
||||
{ "SHARPEN", GIMP_SHARPEN_CONVOLVE },
|
||||
{ "BLUR", GIMP_BLUR_CONVOLVE },
|
||||
{ "SHARPEN", GIMP_SHARPEN_CONVOLVE },
|
||||
|
||||
{ "WHITE-MASK", GIMP_ADD_WHITE_MASK },
|
||||
{ "BLACK-MASK", GIMP_ADD_BLACK_MASK },
|
||||
{ "ALPHA-MASK", GIMP_ADD_ALPHA_MASK },
|
||||
{ "SELECTION-MASK", GIMP_ADD_SELECTION_MASK },
|
||||
{ "COPY-MASK", GIMP_ADD_COPY_MASK },
|
||||
{ "WHITE-MASK", GIMP_ADD_WHITE_MASK },
|
||||
{ "BLACK-MASK", GIMP_ADD_BLACK_MASK },
|
||||
{ "ALPHA-MASK", GIMP_ADD_ALPHA_MASK },
|
||||
{ "SELECTION-MASK", GIMP_ADD_SELECTION_MASK },
|
||||
{ "COPY-MASK", GIMP_ADD_COPY_MASK },
|
||||
|
||||
{ "ADD", GIMP_CHANNEL_OP_ADD },
|
||||
{ "SUB", GIMP_CHANNEL_OP_SUBTRACT },
|
||||
{ "REPLACE", GIMP_CHANNEL_OP_REPLACE },
|
||||
{ "INTERSECT", GIMP_CHANNEL_OP_INTERSECT },
|
||||
{ "ADD", GIMP_CHANNEL_OP_ADD },
|
||||
{ "SUB", GIMP_CHANNEL_OP_SUBTRACT },
|
||||
{ "REPLACE", GIMP_CHANNEL_OP_REPLACE },
|
||||
{ "INTERSECT", GIMP_CHANNEL_OP_INTERSECT },
|
||||
|
||||
{ "FG-BG-RGB", GIMP_FG_BG_RGB_MODE },
|
||||
{ "FG-BG-HSV", GIMP_FG_BG_HSV_MODE },
|
||||
{ "FG-TRANS", GIMP_FG_TRANSPARENT_MODE },
|
||||
{ "CUSTOM", GIMP_CUSTOM_MODE },
|
||||
{ "FG-BG-RGB", GIMP_FG_BG_RGB_MODE },
|
||||
{ "FG-BG-HSV", GIMP_FG_BG_HSV_MODE },
|
||||
{ "FG-TRANS", GIMP_FG_TRANSPARENT_MODE },
|
||||
{ "CUSTOM", GIMP_CUSTOM_MODE },
|
||||
|
||||
{ "FG-IMAGE-FILL", GIMP_FOREGROUND_FILL },
|
||||
{ "BG-IMAGE-FILL", GIMP_BACKGROUND_FILL },
|
||||
{ "WHITE-IMAGE-FILL", GIMP_WHITE_FILL },
|
||||
{ "TRANS-IMAGE-FILL", GIMP_TRANSPARENT_FILL },
|
||||
{ "FG-IMAGE-FILL", GIMP_FOREGROUND_FILL },
|
||||
{ "BG-IMAGE-FILL", GIMP_BACKGROUND_FILL },
|
||||
{ "WHITE-IMAGE-FILL", GIMP_WHITE_FILL },
|
||||
{ "TRANS-IMAGE-FILL", GIMP_TRANSPARENT_FILL },
|
||||
|
||||
{ "APPLY", GIMP_MASK_APPLY },
|
||||
{ "DISCARD", GIMP_MASK_DISCARD },
|
||||
{ "APPLY", GIMP_MASK_APPLY },
|
||||
{ "DISCARD", GIMP_MASK_DISCARD },
|
||||
|
||||
{ "HARD", GIMP_BRUSH_HARD },
|
||||
{ "SOFT", GIMP_BRUSH_SOFT },
|
||||
{ "HARD", GIMP_BRUSH_HARD },
|
||||
{ "SOFT", GIMP_BRUSH_SOFT },
|
||||
|
||||
{ "CONTINUOUS", GIMP_PAINT_CONSTANT },
|
||||
{ "INCREMENTAL", GIMP_PAINT_INCREMENTAL },
|
||||
{ "CONTINUOUS", GIMP_PAINT_CONSTANT },
|
||||
{ "INCREMENTAL", GIMP_PAINT_INCREMENTAL },
|
||||
|
||||
{ "HORIZONTAL", GIMP_ORIENTATION_HORIZONTAL },
|
||||
{ "VERTICAL", GIMP_ORIENTATION_VERTICAL },
|
||||
{ "UNKNOWN", GIMP_ORIENTATION_UNKNOWN },
|
||||
{ "HORIZONTAL", GIMP_ORIENTATION_HORIZONTAL },
|
||||
{ "VERTICAL", GIMP_ORIENTATION_VERTICAL },
|
||||
{ "UNKNOWN", GIMP_ORIENTATION_UNKNOWN },
|
||||
|
||||
{ "LINEAR", GIMP_GRADIENT_LINEAR },
|
||||
{ "BILINEAR", GIMP_GRADIENT_BILINEAR },
|
||||
@ -175,11 +176,11 @@ struct named_constant const old_constants[] =
|
||||
{ "SPIRAL-CLOCKWISE", GIMP_GRADIENT_SPIRAL_CLOCKWISE },
|
||||
{ "SPIRAL-ANTICLOCKWISE", GIMP_GRADIENT_SPIRAL_ANTICLOCKWISE },
|
||||
|
||||
{ "VALUE-LUT", GIMP_HISTOGRAM_VALUE },
|
||||
{ "RED-LUT", GIMP_HISTOGRAM_RED },
|
||||
{ "GREEN-LUT", GIMP_HISTOGRAM_GREEN },
|
||||
{ "BLUE-LUT", GIMP_HISTOGRAM_BLUE },
|
||||
{ "ALPHA-LUT", GIMP_HISTOGRAM_ALPHA },
|
||||
{ "VALUE-LUT", GIMP_HISTOGRAM_VALUE },
|
||||
{ "RED-LUT", GIMP_HISTOGRAM_RED },
|
||||
{ "GREEN-LUT", GIMP_HISTOGRAM_GREEN },
|
||||
{ "BLUE-LUT", GIMP_HISTOGRAM_BLUE },
|
||||
{ "ALPHA-LUT", GIMP_HISTOGRAM_ALPHA },
|
||||
|
||||
{ NULL, 0 }
|
||||
};
|
||||
@ -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