script-fu-text-console.c 1.71 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
2 3
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7 8 9 10 11 12 13 14
 * (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
15
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16 17 18
 */

#include "config.h"
19

20
#include <stdio.h>
21 22
#include <errno.h>

23 24 25
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
26 27 28

#include "libgimp/gimp.h"

29
#include "scheme-wrapper.h"
30
#include "script-fu-text-console.h"
31 32

#include "script-fu-intl.h"
33 34

void
35
script_fu_text_console_run (const gchar      *name,
36 37 38 39
                            gint              nparams,
                            const GimpParam  *params,
                            gint             *nreturn_vals,
                            GimpParam       **return_vals)
40
{
41
  static GimpParam  values[1];
42

43
  /*  Enable Script-Fu output  */
44 45
  ts_register_output_func (ts_stdout_output_func, NULL);

46
  ts_print_welcome ();
47

48 49
  gimp_plugin_set_pdb_error_handler (GIMP_PDB_ERROR_HANDLER_PLUGIN);

50
  /*  Run the interface  */
51 52 53
  ts_interpret_stdin ();

  gimp_plugin_set_pdb_error_handler (GIMP_PDB_ERROR_HANDLER_INTERNAL);
54

55
  values[0].type          = GIMP_PDB_STATUS;
56
  values[0].data.d_status = GIMP_PDB_SUCCESS;
57 58 59

  *nreturn_vals = 1;
  *return_vals  = values;
60
}