Fix memory leak
[idzebra-moved-to-github.git] / perl / IDZebra.i
index 6a9c75d..020e8db 100644 (file)
@@ -149,10 +149,21 @@ void DESTROY (void);
 
 /* == Logging facilities (yaz/log.h) ======================================= */
 
-void logLevel (int level);
-void logFile (const char *fname);
+%name(logLevel) 
+void yaz_log_init_level (int level);
+
+%name(logFile)
+void yaz_log_init_file (const char *fname);
+
+%name(logMsg)
 void logMsg  (int level, const char *message);
 
+%name(logPrefix)   
+void yaz_log_init_prefix (const char *prefix);
+
+%name(logPrefix2)   
+void yaz_log_init_prefix2 (const char *prefix);
+
 #define LOG_FATAL  0x0001
 #define LOG_DEBUG  0x0002
 #define LOG_WARN   0x0004
@@ -263,13 +274,13 @@ int  zebra_init (ZebraHandle zh);
 int  zebra_compact (ZebraHandle zh);
 
 %name(repository_update)   
-void zebra_repository_update (ZebraHandle zh);
+void zebra_repository_update (ZebraHandle zh, const char *path);
 
 %name(repository_delete)   
-void zebra_repository_delete (ZebraHandle zh);
+void zebra_repository_delete (ZebraHandle zh, const char *path);
 
 %name(repository_show)     
-void zebra_repository_show (ZebraHandle zh); 
+void zebra_repository_show (ZebraHandle zh, const char *path); 
 
 
 /* == Record update/delete (zebra_api_ext.c) =============================== */
@@ -278,22 +289,20 @@ void zebra_repository_show (ZebraHandle zh);
    If not, and match_criteria is provided, then sysno is guessed
    If not, and a record is provided, then sysno is got from there */
 
+%apply int *REFERENCE { int *sysno };
 %name(insert_record)       
 int zebra_insert_record (ZebraHandle zh, 
-                        recordGroup *rGroup, 
                         const char *recordType,
-                        int sysno, 
+                        int *sysno, 
                         const char *match, 
                         const char *fname,
                         const char *buf, 
-                        int buf_size,
-                        int force_update);
+                        int buf_size);
 
 %name(update_record)       
 int zebra_update_record (ZebraHandle zh, 
-                        recordGroup *rGroup, 
                         const char *recordType,
-                        int sysno, 
+                        int *sysno, 
                         const char *match, 
                         const char *fname,
                         const char *buf, 
@@ -302,24 +311,22 @@ int zebra_update_record (ZebraHandle zh,
      
 %name(delete_record)       
 int zebra_delete_record (ZebraHandle zh, 
-                        recordGroup *rGroup, 
                         const char *recordType,
-                        int sysno, 
+                        int *sysno, 
                         const char *match, 
                         const char *fname,
                         const char *buf, 
                         int buf_size,
                         int force_update);
 
-
-/* == Search (zebra_api_ext.c) ============================================= */
-
+/* == Search (zebraapi.c) ================================================== */
+%include "typemaps.i"
+%apply int *REFERENCE { int *hits };
 %name(search_PQF) 
 int zebra_search_PQF (ZebraHandle zh, 
-                     ODR odr_input, ODR odr_output, 
                      const char *pqf_query,
-                     const char *setname);
-
+                     const char *setname,
+                     int *hits);
 
 /* == YAZ - query tools ==================================================== */
 
@@ -361,8 +368,15 @@ int zebra_deleleResultSet(ZebraHandle zh, int function,
                          int *statuses);
 
 
+/* Resultset terms */
+%name(resultSetTerms)
+int zebra_resultSetTerms (ZebraHandle zh, const char *setname, 
+                          int no, int *REFERENCE, 
+                          int *REFERENCE, char *out, int *REFERENCE);
+
 /* == Sort ================================================================= */
-int sort (ZebraHandle zh, 
+%name(sort)
+int zebra_sort_by_specstr (ZebraHandle zh, 
          ODR stream,
          const char *sort_spec,
          const char *output_setname,
@@ -378,6 +392,10 @@ void zebra_scan_PQF (ZebraHandle zh,
 
 scanEntry *getScanEntry(ScanObj *so, int pos);
 
+%typemap(in) int * (int dvalue);
+%typemap(argout) int *;
+
+
 /* Admin functionality */
 /*
 %name(admin_start)         void zebra_admin_start (ZebraHandle zh);