File: API.xs

package info (click to toggle)
swish-e 2.4.3-7
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,308 kB
  • ctags: 7,642
  • sloc: ansic: 47,402; sh: 8,508; perl: 5,281; makefile: 723; xml: 9
file content (928 lines) | stat: -rw-r--r-- 20,145 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

/* $Id: API.xs,v 1.16 2004/11/18 00:41:43 whmoseley Exp $ */

#include <swish-e.h>

#ifndef newSVuv
#   define newSVuv(i) newSViv(i)
#endif

#ifndef call_pv
#   define call_pv(i,j) perl_call_pv(i,j)
#endif

/* 
 * Create a typedef for managing the metanames objects. This allows storing
 * both the SV and the pointer to the parent object so its refcount can be
 * adjusted on DESTROY.  The other way is to provide a way to get to the
 * parent's SV in the swish-e library.  That means modifying the swish-e
 * library.  This is already done for most other objects -- the SV of the perl
 * swish handle is stored in the C SW_HANDLE struct -- see SwishSetRefPtr and
 * Swish*Parent functions.  It's actually much easier to provide a way to get
 * the SV via the C library since don't need to malloc and free an extra
 * structre.  But, done for the meta descriptions as an exercise.
 */

typedef struct {
    SV          *handle_sv;     /* Parent SV for DESTROY */
    SW_META     meta;           /* meta description C pointer */
} META_OBJ;






MODULE = SWISH::API        PACKAGE = SWISH::API    PREFIX = Swish



# Make sure that we have at least xsubpp version 1.922.
REQUIRE: 1.922

# This returns SW_HANDLE
void 
new(CLASS, index_file_list )
    char *CLASS
    char *index_file_list

    PREINIT:
        SW_HANDLE handle;

    PPCODE:
        SwishErrorsToStderr();
        handle = SwishInit( index_file_list );
        ST(0) = sv_newmortal();
        sv_setref_pv( ST(0), CLASS, (void *)handle );
        SwishSetRefPtr( handle, (void *)SvRV(ST(0)) );
        XSRETURN(1);



void
DESTROY(self)
        SW_HANDLE self;

    CODE:
        SwishClose( self );



void
SwishIndexNames(self)
    SW_HANDLE self

    PREINIT:
        const char **index_name;

    PPCODE:
        index_name = SwishIndexNames( self );
        while ( *index_name )
        {
            XPUSHs(sv_2mortal(newSVpv( (char *)*index_name ,0 )));
            index_name++;
        }

############################################
# set RankScheme
# karman - Wed Sep  1 09:22:50 CDT 2004

void
SwishRankScheme(self, scheme)
    SW_HANDLE self
    int scheme

#############################################


# added SwishFuzzy to give access directly from SW object
# karman - Wed Oct 27 11:16:45 CDT 2004
# This returns a fuzzy word object based on the result

SW_FUZZYWORD
SwishFuzzy(swobj, index_name, word)
    SW_HANDLE swobj;
    char * index_name;
    char * word;

    PREINIT:
        char * CLASS = "SWISH::API::FuzzyWord";

    CODE:
        RETVAL = SwishFuzzy(swobj, index_name, word);
		    
	    
    OUTPUT:
        RETVAL


void
SwishHeaderNames(self)
    SW_HANDLE self

    PREINIT:
        const char **name;

    PPCODE:
        name = SwishHeaderNames( self );
        while ( *name )
        {
            XPUSHs(sv_2mortal(newSVpv( (char *)*name ,0 )));
            name++;
        }



void
SwishHeaderValue(swish_handle, index_file, header_name)
    SW_HANDLE swish_handle
    char * index_file
    char * header_name

    PREINIT:
        SWISH_HEADER_TYPE  header_type;
        SWISH_HEADER_VALUE head_value;
        int i;

    PPCODE:
        head_value = SwishHeaderValue( swish_handle, index_file, header_name, &header_type );

        PUSHMARK(SP);
        XPUSHs((SV *)swish_handle);
        XPUSHs((SV *)&head_value);
        XPUSHs((SV *)&header_type);
        PUTBACK;
        i = call_pv( "SWISH::API::decode_header_value", G_ARRAY );
        SPAGAIN;


void
decode_header_value( swish_handle, header_value, header_type )
        SV *swish_handle
        SV *header_value
        SV *header_type


    PREINIT:
        const char **string_list;
        SWISH_HEADER_VALUE *head_value;

    PPCODE:
        head_value = (SWISH_HEADER_VALUE *)header_value;

        switch ( *(SWISH_HEADER_TYPE *)header_type )
        {
            case SWISH_STRING:
                if ( head_value->string &&  head_value->string[0] )
                    XPUSHs(sv_2mortal(newSVpv( (char *)head_value->string,0 )));
                else
                    ST(0) = &PL_sv_undef;
                break;

            case SWISH_NUMBER:
                XPUSHs(sv_2mortal(newSVuv( head_value->number )));
                break;

            case SWISH_BOOL:
                // how about pushing &PL_sv_yes and &PL_sv_no or using boolSV()?
                XPUSHs(sv_2mortal(newSViv( head_value->boolean ? 1 : 0 )));
                break;

            case SWISH_LIST:
                string_list = head_value->string_list;

                if ( !string_list ) /* Don't think this can happen */
                    XSRETURN_EMPTY;


                while ( *string_list )
                {
                    XPUSHs(sv_2mortal(newSVpv( (char *)*string_list ,0 )));
                    string_list++;
                }
                break;

            case SWISH_HEADER_ERROR:
                SwishAbortLastError( (SW_HANDLE)swish_handle );
                break;

            default:
                croak(" Unknown header type '%d'\n", header_type );
        }



# Error Management

void
SwishAbortLastError(self)
    SW_HANDLE self


int
SwishError(self)
    SW_HANDLE self



char *
SwishErrorString(self)
    SW_HANDLE self



char *
SwishLastErrorMsg(self)
    SW_HANDLE self

int
SwishCriticalError(self)
    SW_HANDLE self


# Return a search object  (uses a typemap to bless the return object)

SW_SEARCH
New_Search_Object(swish_handle, query = NULL)
    SW_HANDLE swish_handle
    char *query

    PREINIT:
        char * CLASS = "SWISH::API::Search";

    CODE:
        RETVAL = New_Search_Object( swish_handle, query );
        if ( RETVAL )
            SvREFCNT_inc( (SV *)SwishSearch_parent( RETVAL ) );

    OUTPUT:
        RETVAL

# Returns a SW_RESULTS object

void
SwishQuery( swish_handle, query = NULL )
    SW_HANDLE swish_handle
    char *query

    PREINIT:
        char * CLASS = "SWISH::API::Results";
        SW_RESULTS results;

    PPCODE:
        results = SwishQuery( swish_handle, query );
        if ( results )
        {
            SvREFCNT_inc( (SV *)SwishResults_parent( results ) );
            ST(0) = sv_newmortal();
            sv_setref_pv( ST(0), CLASS, (void *)results );
            ResultsSetRefPtr( results, (void *)SvRV(ST(0)) );
            XSRETURN(1);
        }


# Methods to return info about MetaNames and Properties
# The C API provided by Jamie Herre in March 2004

# Returns an array of SWISH::API::MetaName objects

void
SwishMetaList( swish_handle, index_name )
    SW_HANDLE swish_handle
    char *index_name

    PREINIT:
        SWISH_META_LIST meta_list;

    PPCODE:
        /* Grab the list of pointers */
        meta_list = SwishMetaList( swish_handle, index_name );

        PUSHMARK(SP) ;      /* always need to PUSHMARK, even w/o params */
        XPUSHs( (SV *)swish_handle );
        XPUSHs( (SV *)meta_list );
        XPUSHs( (SV *)"SWISH::API::MetaName");
        PUTBACK ;           /* lets perl know how many parameters are here */

        call_pv("SWISH::API::push_meta_list", G_ARRAY );
        SPAGAIN;

# Returns an array of SWISH::API::MetaName objects

void
SwishPropertyList( swish_handle, index_name )
    SW_HANDLE swish_handle
    char *index_name

    PREINIT:
        SWISH_META_LIST meta_list;

    PPCODE:
        /* Grab the list of pointers */
        meta_list = SwishPropertyList( swish_handle, index_name );
        PUSHMARK(SP) ;
        XPUSHs( (SV *)swish_handle );
        XPUSHs( (SV *)meta_list );
        XPUSHs( (SV *)"SWISH::API::PropertyName");
        PUTBACK ;

        call_pv("SWISH::API::push_meta_list", G_ARRAY );
        SPAGAIN;





void
push_meta_list( s_handle, m_list, m_class )
    SV *s_handle
    SV *m_list
    SV *m_class

    PREINIT:
        SW_HANDLE swish_handle;
        SWISH_META_LIST meta_list;
        char *class;

    PPCODE:
        class = (char *)m_class;
        swish_handle = (SW_HANDLE)s_handle;
        meta_list = (SWISH_META_LIST)m_list;

        /* Check for an error -- typically this would be an invalid index name */
        /* Fix: calling with an invalid swish_handle will call progerr */
        if ( SwishError( swish_handle ) )
            croak("%s %s", SwishErrorString( swish_handle ), SwishLastErrorMsg( swish_handle ) );

        /* Make sure a list is returned and it's not empty */
        if ( !meta_list || !*meta_list )
            XSRETURN_EMPTY;


        while ( *meta_list )
        {
            SV *o;

            /* Create a new structure for storing the meta description and the parent SV */
            META_OBJ *object = (META_OBJ *)safemalloc(sizeof(META_OBJ));

            /* Store the meta entry */
            object->meta = *meta_list;

            /* Store the and bump the swish_handle SV */
            object->handle_sv = (SV *)SwishGetRefPtr( swish_handle );
            SvREFCNT_inc( object->handle_sv );

            /* And create the Perl object and assign the object to it */
            o = sv_newmortal();
            sv_setref_pv( o, class, (void *)object );

            /* and push onto list */
            XPUSHs( o );

            meta_list++;
        }





# Misc utility routines

void
SwishWordsByLetter(handle, filename, c)
     SW_HANDLE handle
     char *filename
     char c

     PREINIT:
         char *Words,*tmp;
         int c2;

     PPCODE:

         if(c=='*')
         {
            for(c2=1;c2<256;c2++)
            {
               Words=(char *)SwishWordsByLetter(handle,filename,(unsigned char)c2);
               for(tmp=Words;tmp && tmp[0];tmp+=strlen(tmp)+1)
               {
                  XPUSHs(sv_2mortal(newSVpv(tmp,0)));
               }
            }
         } else {
            Words=(char *)SwishWordsByLetter(handle,filename,c);
            for(tmp=Words;tmp && tmp[0];tmp+=strlen(tmp)+1)
            {
               XPUSHs(sv_2mortal(newSVpv(tmp,0)));
            }
         }



char *
SwishStemWord(handle, word)
     SW_HANDLE handle
     char *word




# **************************************************************
# 
#             SWISH::API::Search
# 
# ***************************************************************


MODULE = SWISH::API        PACKAGE = SWISH::API::Search    PREFIX = Swish


void
DESTROY(search)
    SW_SEARCH search

    CODE:
        if ( search )
        {
            SV *parent = (SV *)SwishSearch_parent( search );
            Free_Search_Object( search );
            SvREFCNT_dec( parent );
        }


void
SwishSetQuery(search,query)
    SW_SEARCH search
    char * query


void
SwishSetStructure(search, structure)
    SW_SEARCH search
    int structure


void
SwishPhraseDelimiter(search, delimiter)
    SW_SEARCH search
    char * delimiter

    CODE:
        SwishPhraseDelimiter(search, delimiter[0] );


void
SwishSetSearchLimit(search, property, low, high)
    SW_SEARCH search
    char * property
    char * low
    char * high


void
SwishResetSearchLimit(search)
    SW_SEARCH search


void
SwishSetSort(search, sort_string)
    SW_SEARCH search
    char *sort_string


# Returns a SW_RESULTS object

void
SwishExecute( search, query = NULL )
    SW_SEARCH search
    char *query

    PREINIT:
        char * CLASS = "SWISH::API::Results";
        SW_RESULTS results;

    PPCODE:
        results = SwishExecute( search, query );
        {
            SvREFCNT_inc( (SV *)SwishResults_parent( results ) );
            ST(0) = sv_newmortal();
            sv_setref_pv( ST(0), CLASS, (void *)results );
            ResultsSetRefPtr( results, (void *)SvRV(ST(0)) );
            XSRETURN(1);
        }



# **************************************************************
#
#            SWISH::API::Results
#
# ***************************************************************


MODULE = SWISH::API        PACKAGE = SWISH::API::Results    PREFIX = Swish



void
DESTROY(results)
    SW_RESULTS results

    CODE:
        if ( results )
        {
            SV *parent = (SV *)SwishResults_parent( results );
            Free_Results_Object( results );
            SvREFCNT_dec( parent );
        } 

int
SwishHits(self)
    SW_RESULTS self




int
SwishSeekResult(self, position)
    SW_RESULTS self
    int position



SW_RESULT
SwishNextResult(results)
    SW_RESULTS results

    PREINIT:
        char * CLASS = "SWISH::API::Result";

    CODE:
        RETVAL = SwishNextResult(results);
        if ( RETVAL )
            SvREFCNT_inc( (SV *)SwishResult_parent( RETVAL ));
    OUTPUT:
        RETVAL


void
SwishRemovedStopwords(results, index_name)
    SW_RESULTS results
    char * index_name


    PREINIT:
        SW_HANDLE swish_handle;
        SWISH_HEADER_TYPE  header_type;
        SWISH_HEADER_VALUE head_value;
        int i;

    PPCODE:
        swish_handle = SW_ResultsToSW_HANDLE( results );
        header_type = SWISH_LIST;
        head_value = SwishRemovedStopwords( results, index_name );

        PUSHMARK(SP);
        XPUSHs((SV *)swish_handle);
        XPUSHs((SV *)&head_value);
        XPUSHs((SV *)&header_type);
        PUTBACK;
        i = call_pv( "SWISH::API::decode_header_value", G_ARRAY );
        SPAGAIN;
#        PUTBACK;


void
SwishParsedWords(results, index_name)
    SW_RESULTS results
    char * index_name


    PREINIT:
        SW_HANDLE swish_handle;
        SWISH_HEADER_TYPE  header_type;
        SWISH_HEADER_VALUE head_value;
        int i;

    PPCODE:
        swish_handle = SW_ResultsToSW_HANDLE( results );
        header_type = SWISH_LIST;
        head_value = SwishParsedWords( results, index_name );

        PUSHMARK(SP);
        XPUSHs((SV *)swish_handle);
        XPUSHs((SV *)&head_value);
        XPUSHs((SV *)&header_type);
        PUTBACK;
        i = call_pv( "SWISH::API::decode_header_value", G_ARRAY );
        SPAGAIN;
#        PUTBACK;






# **************************************************************
#
#            SWISH::API::Result (single result)
#
#
# ***************************************************************


MODULE = SWISH::API        PACKAGE = SWISH::API::Result    PREFIX = Swish

void
DESTROY(result)
    SW_RESULT result

    CODE:
        if ( result )
        {
            SV *parent = (SV *)SwishResult_parent(result);
            SvREFCNT_dec( parent );
        }

void
SwishProperty(result, property)
    SW_RESULT result
    char *property

    PREINIT:
         PropValue *pv;


    PPCODE:
        # This will abort swish-e if result is NULL
        pv = getResultPropValue( result, property, 0 );

        if ( !pv )
        {
            # this is always the case
            SW_HANDLE h = SW_ResultToSW_HANDLE( result );
            if ( SwishError( h ) )
                croak("%s %s", SwishErrorString( h ), SwishLastErrorMsg( h ) );

            XSRETURN_UNDEF;
        }


        switch (pv->datatype)
        {
            case PROP_INTEGER:
                PUSHs(sv_2mortal(newSViv(pv->value.v_int)));
                break;

            case PROP_ULONG:
                PUSHs(sv_2mortal(newSViv(pv->value.v_ulong)));
                break;

            case PROP_STRING:
                PUSHs(sv_2mortal(newSVpv(pv->value.v_str,0)));
                break;

            case PROP_DATE:
                PUSHs(sv_2mortal(newSViv(pv->value.v_date)));
                break;

            case PROP_UNDEFINED:
                freeResultPropValue(pv);
                XSRETURN_UNDEF;
                break;

            default:
                croak("Unknown property data type '%d' for property '%s'\n", pv->datatype, property);
        }

        freeResultPropValue(pv);


char *
SwishResultPropertyStr( result, pname)
    SW_RESULT result
    char * pname



void
SwishResultIndexValue(self, header_name)
    SW_RESULT self
    char * header_name


    PREINIT:
        SW_HANDLE swish_handle;
        SWISH_HEADER_TYPE  header_type;
        SWISH_HEADER_VALUE head_value;
        int i;

    PPCODE:
        swish_handle = SW_ResultToSW_HANDLE( self );
        head_value = SwishResultIndexValue( self, header_name, &header_type );

        PUSHMARK(SP);
        XPUSHs((SV *)swish_handle);
        XPUSHs((SV *)&head_value);
        XPUSHs((SV *)&header_type);
        PUTBACK;
        i = call_pv( "SWISH::API::decode_header_value", G_ARRAY );
        SPAGAIN;
#        PUTBACK;

# This returns a fuzzy word object based on the result

SW_FUZZYWORD
SwishFuzzyWord(result, word)
    SW_RESULT result
    char *word

    PREINIT:
        char * CLASS = "SWISH::API::FuzzyWord";

    CODE:
        RETVAL = SwishFuzzyWord(result,word);

    OUTPUT:
        RETVAL



# This returns the name of the stemmer used for this index

const char*
SwishFuzzyMode(result)
    SW_RESULT result



MODULE = SWISH::API        PACKAGE = SWISH::API::Result    PREFIX = SwishResult

void
SwishResultMetaList(result)
    SW_RESULT result

    PREINIT:
        SWISH_META_LIST meta_list;
        SW_HANDLE swish_handle;

    PPCODE:
        meta_list = SwishResultMetaList( result );
        swish_handle = SW_ResultToSW_HANDLE( result );

        PUSHMARK(SP) ;
        XPUSHs( (SV *)swish_handle );
        XPUSHs( (SV *)meta_list );
        XPUSHs( (SV *)"SWISH::API::MetaName");
        PUTBACK ;

        call_pv("SWISH::API::push_meta_list", G_ARRAY );
        SPAGAIN;

void
SwishResultPropertyList(result)
    SW_RESULT result

    PREINIT:
        SWISH_META_LIST meta_list;
        SW_HANDLE swish_handle;

    PPCODE:
        meta_list = SwishResultPropertyList( result );
        swish_handle = SW_ResultToSW_HANDLE( result );

        PUSHMARK(SP) ;
        XPUSHs( (SV *)swish_handle );
        XPUSHs( (SV *)meta_list );
        XPUSHs( (SV *)"SWISH::API::PropertyName");
        PUTBACK ;

        call_pv("SWISH::API::push_meta_list", G_ARRAY );
        SPAGAIN;



# **************************************************************
#
#            SWISH::API::FuzzyWord
#
# Methods for accessing a SW_FUZZYWORD structure
#
# ***************************************************************


MODULE = SWISH::API        PACKAGE = SWISH::API::FuzzyWord    PREFIX = SwishFuzzy



# method to automatically free memory when object goes out of scope
void
DESTROY(fw)
    SW_FUZZYWORD fw

    CODE:
        if ( fw )
            SwishFuzzyWordFree( fw );

# returns number of words in the fuzzy structure

int
SwishFuzzyWordCount( fw )
    SW_FUZZYWORD fw

# returns return value from stemmer

int
SwishFuzzyWordError( fw )
    SW_FUZZYWORD fw


# returns an array of stemmed (or not) words.  
# The "or not" is because the word might not have been stemmed.

void
SwishFuzzyWordList( fw )
    SW_FUZZYWORD fw

    PREINIT:
        const char **list;

    PPCODE:
        list = SwishFuzzyWordList( fw );

        while ( *list )
        {
            XPUSHs(sv_2mortal( newSVpv( (char *)*list, 0 ) ));
            list++;
        }



# ********************************************************************
#
#                   SWISH::API::MetaName
#
#  Methods for accessing data about metanames
#
# ********************************************************************

MODULE = SWISH::API       PACKAGE = SWISH::API::MetaName  PREFIX = SwishMeta

void
DESTROY ( self )
    META_OBJ *self
    CODE:
        SvREFCNT_dec( self->handle_sv );
        safefree( self );


const char *
SwishMetaName( meta )
    SW_META meta

int
SwishMetaType( meta )
    SW_META meta

int
SwishMetaID( meta )
    SW_META meta


# ********************************************************************
#
#                   SWISH::API::PropertyName
#
#  Methods for accessing data about metanames
#  Should set a base class for both, but they are small classes
#  and may want different behavior in the future.
#
# ********************************************************************

MODULE = SWISH::API       PACKAGE = SWISH::API::PropertyName  PREFIX = SwishMeta

void
DESTROY ( self )
    META_OBJ *self
    CODE:
        SvREFCNT_dec( self->handle_sv );
        safefree( self );



const char *
SwishMetaName( meta )
    SW_META meta

int
SwishMetaType( meta )
    SW_META meta

int
SwishMetaID( meta )
    SW_META meta