add procedural_db_get_data_size and gimp_get_data_Size functions from Nick Lamb

-Yosh
This commit is contained in:
Manish Singh 1998-06-27 00:23:43 +00:00
parent 9904afe3b2
commit 2f7b84ae4d
4 changed files with 104 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Fri Jun 26 17:22:00 PDT 1998 Manish Singh <yosh@gimp.org>
* libgimp/gimp.[ch]
* app/procedural_db.c: add procedural_db_get_data_size and
gimp_get_data_Size functions from Nick Lamb
Fri Jun 26 11:00:35 PDT 1998 Manish Singh <yosh@gimp.org>
* plug-ins/script-fu/scripts.c: define DIVIDE here too (auf,

View File

@ -20,13 +20,14 @@
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
#include "regex.h"
#include "appenv.h"
#include "app_procs.h"
#include "general.h"
#include "gdisplay.h"
#include "plug_in.h"
#include "procedural_db.h"
#include "config.h"
#include "regex.h"
/* Query structure */
typedef struct _PDBQuery PDBQuery;
@ -62,6 +63,7 @@ static Argument * procedural_db_proc_info (Argument *);
static Argument * procedural_db_proc_arg (Argument *);
static Argument * procedural_db_proc_val (Argument *);
static Argument * procedural_db_get_data (Argument *);
static Argument * procedural_db_get_data_size (Argument *);
static Argument * procedural_db_set_data (Argument *);
static Argument * procedural_db_query (Argument *);
static void procedural_db_query_entry (gpointer, gpointer, gpointer);
@ -320,6 +322,47 @@ ProcRecord procedural_db_proc_val_proc =
};
/*********************************/
/* PROCEDURAL_DB_GET_DATA_SIZE */
static ProcArg procedural_db_get_data_size_args[] =
{
{ PDB_STRING,
"identifier",
"the identifier associated with data"
},
};
static ProcArg procedural_db_get_data_size_out_args[] =
{
{ PDB_INT32,
"bytes",
"the number of bytes in the data"
}
};
ProcRecord procedural_db_get_data_size_proc =
{
"gimp_procedural_db_get_data_size",
"Returns size of data associated with the specified identifier",
"This procedure returns the size of any data which may have been associated with the specified identifier. If no data has been associated with the identifier, an error is returned.",
"Nick Lamb",
"Nick Lamb",
"1998",
PDB_INTERNAL,
/* Input arguments */
1,
procedural_db_get_data_size_args,
/* Output arguments */
2,
procedural_db_get_data_size_out_args,
/* Exec method */
{ { procedural_db_get_data_size } },
};
/****************************/
/* PROCEDURAL_DB_GET_DATA */
@ -1012,6 +1055,33 @@ procedural_db_get_data (Argument *args)
return return_args;
}
static Argument *
procedural_db_get_data_size (Argument *args)
{
Argument *return_args;
PDBData *data;
char *identifier;
GList *list;
identifier = args[0].value.pdb_pointer;
list = data_list;
while (list)
{
data = (PDBData *) list->data;
list = list->next;
if (strcmp (data->identifier, identifier) == 0)
{
return_args = procedural_db_return_args (&procedural_db_get_data_size_proc, TRUE);
return_args[1].value.pdb_int = data->bytes;
return return_args;
}
}
return_args = procedural_db_return_args (&procedural_db_proc_val_proc, FALSE);
return return_args;
}
static Argument *
procedural_db_set_data (Argument *args)
{

View File

@ -150,6 +150,28 @@ gimp_set_data (gchar * id,
gimp_destroy_params (return_vals, nreturn_vals);
}
guint32
gimp_get_data_size (gchar * id)
{
GParam *return_vals;
int nreturn_vals;
guint32 length;
return_vals = gimp_run_procedure ("gimp_procedural_db_get_data_size",
&nreturn_vals,
PARAM_STRING, id,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
length= return_vals[1].data.d_int32;
else
length= 0;
gimp_destroy_params (return_vals, nreturn_vals);
return length;
}
void
gimp_get_data (gchar * id,
gpointer data)

View File

@ -191,6 +191,11 @@ void gimp_set_data (gchar * id,
void gimp_get_data (gchar * id,
gpointer data);
/* Get the size in bytes of the data stored by a gimp_get_data
* id. As size of zero may indicate that there is no such
* identifier in the database.
*/
guint32 gimp_get_data_size (gchar * id);
/* Initialize the progress bar with "message". If "message"
* is NULL, the message displayed in the progress window will