This file is indexed.

/usr/include/indigo.h is in libindigo-dev 1.1.12-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
/****************************************************************************
 * Copyright (C) 2010-2011 GGA Software Services LLC
 * 
 * This file is part of Indigo toolkit.
 * 
 * This file may be distributed and/or modified under the terms of the
 * GNU General Public License version 3 as published by the Free Software
 * Foundation and appearing in the file LICENSE.GPL included in the
 * packaging of this file.
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 ***************************************************************************/

#ifndef __indigo__
#define __indigo__

#if defined(_WIN32)  && !defined(__MINGW32__)
#define qword unsigned _int64
#else
#define qword unsigned long long
#endif

#ifndef EXPORT_SYMBOL
   #ifdef _WIN32
      #define EXPORT_SYMBOL __declspec(dllexport)
   #elif (defined __GNUC__ || defined __APPLE__)
      #define EXPORT_SYMBOL __attribute__ ((visibility ("default")))
   #else
      #define EXPORT_SYMBOL
   #endif
#endif

#ifndef CEXPORT
   #ifndef __cplusplus
      #define CEXPORT EXPORT_SYMBOL
   #else
      #define CEXPORT extern "C" EXPORT_SYMBOL
   #endif
#endif

#ifndef __byte_typedef__
#define __byte_typedef__
typedef unsigned char byte;
#endif

/* All integer and float functions return -1 on error. */
/* All string functions return zero pointer on error. */

/* Almost all string functions return the same pointer on success;
   you should not free() it, but rather strdup() it if you want to keep it. */

/* System */

CEXPORT const char * indigoVersion ();

// Allocate a new session. Each session has its own
// set of objects created and options set up.
CEXPORT qword indigoAllocSessionId   ();
// Switch to another session. The session, if was not allocated
// previously, is allocated automatically and initialized with
// empty set of objects and default options.
CEXPORT void  indigoSetSessionId     (qword id);
// Release session. The memory used by the released session
// is not freed, but the number will be reused on
// further allocations.
CEXPORT void  indigoReleaseSessionId (qword id);


// Get the last error message
CEXPORT const char * indigoGetLastError (void);

typedef void (*INDIGO_ERROR_HANDLER)(const char *message, void *context);
CEXPORT void indigoSetErrorHandler (INDIGO_ERROR_HANDLER handler, void *context);

// Free an object
CEXPORT int indigoFree (int handle);
// Clone an object
CEXPORT int indigoClone (int object);
// Count object currently allocated
CEXPORT int indigoCountReferences (void);

// Deallocate all the objects in the current session
CEXPORT int indigoFreeAllObjects ();

/* Options */

CEXPORT int indigoSetOption (const char *name, const char *value);
CEXPORT int indigoSetOptionInt (const char *name, int value);
CEXPORT int indigoSetOptionBool (const char *name, int value);
CEXPORT int indigoSetOptionFloat (const char *name, float value);
CEXPORT int indigoSetOptionColor (const char *name, float r, float g, float b);
CEXPORT int indigoSetOptionXY (const char *name, int x, int y);

/* Basic input-output */

// indigoRead*** return a new reader object.
// indigoLoad*** return a new reader object which already
// contains all the data and does not depend on the given
// string/buffer. All these functions are low-level and
// rarely needed to anyone.

CEXPORT int indigoReadFile   (const char *filename);
CEXPORT int indigoReadString (const char *str);
CEXPORT int indigoLoadString (const char *str);
CEXPORT int indigoReadBuffer (const char *buffer, int size);
CEXPORT int indigoLoadBuffer (const char *buffer, int size);

// indigoWrite*** return a new writer object.

CEXPORT int indigoWriteFile   (const char *filename);
CEXPORT int indigoWriteBuffer (void);

// Closes the file output stream but does not delete the object
CEXPORT int indigoClose (int output);

/* Iterators */

/* Iterators work in the following way:
 *
 * int item, iter = indigoIterate***(...)
 *
 * if (iter == -1)
 * {
 *    fprintf(stderr, "%s", indigoGetLastError());
 *    return;
 * }
 *
 * while (item = indigoNext(iter))
 * {
 *    if (item == -1)
 *    {
 *       fprintf(stderr, "%s", indigoGetLastError());
 *       break;
 *    }
 *
 *    printf("on item #%d\n", indigoIndex(item));
 *
 *    // do something with item
 *
 *    indigoFree(item);
 * }
 * indigoFree(iter);
 */

// Obtains the next element, returns zero if there is no next element
CEXPORT int indigoNext (int iter);
// Does not obtain the next element, just tells if there is one
CEXPORT int indigoHasNext (int iter);
// Returns the index of the element
CEXPORT int indigoIndex (int item);

// Removes the item from its container (usually a molecule)
CEXPORT int indigoRemove (int item);

/* Molecules, query molecules, SMARTS */

CEXPORT int indigoCreateMolecule (void);
CEXPORT int indigoCreateQueryMolecule (void);

CEXPORT int indigoLoadMolecule  (int source);
CEXPORT int indigoLoadMoleculeFromString (const char *string);
CEXPORT int indigoLoadMoleculeFromFile   (const char *filename);
CEXPORT int indigoLoadMoleculeFromBuffer (const char *buffer, int size);

CEXPORT int indigoLoadQueryMolecule (int source);
CEXPORT int indigoLoadQueryMoleculeFromString (const char *string);
CEXPORT int indigoLoadQueryMoleculeFromFile   (const char *filename);
CEXPORT int indigoLoadQueryMoleculeFromBuffer (const char *buffer, int size);

CEXPORT int indigoLoadSmarts (int source);
CEXPORT int indigoLoadSmartsFromString (const char *string);
CEXPORT int indigoLoadSmartsFromFile   (const char *filename);
CEXPORT int indigoLoadSmartsFromBuffer (const char *buffer, int size);

CEXPORT int indigoSaveMolfile (int molecule, int output);
CEXPORT int indigoSaveMolfileToFile (int molecule, const char *filename);
CEXPORT const char * indigoMolfile (int molecule);

// accepts molecules and reactions (but not query ones)
CEXPORT int indigoSaveCml (int object, int output);
CEXPORT int indigoSaveCmlToFile (int object, const char *filename);
CEXPORT const char * indigoCml (int object);

// the output must be a file or a buffer, but not a string
// (because MDLCT data usually contains zeroes)
CEXPORT int indigoSaveMDLCT (int item, int output);

/* Reactions, query reactions */
/*
 * Reaction centers
 */
enum
{
   INDIGO_RC_NOT_CENTER     = -1,
   INDIGO_RC_UNMARKED       =  0,
   INDIGO_RC_CENTER         =  1,
   INDIGO_RC_UNCHANGED      =  2,
   INDIGO_RC_MADE_OR_BROKEN =  4,
   INDIGO_RC_ORDER_CHANGED  =  8
};
CEXPORT int indigoLoadReaction  (int source);
CEXPORT int indigoLoadReactionFromString (const char *string);
CEXPORT int indigoLoadReactionFromFile   (const char *filename);
CEXPORT int indigoLoadReactionFromBuffer (const char *buffer, int size);

CEXPORT int indigoLoadQueryReaction (int source);
CEXPORT int indigoLoadQueryReactionFromString (const char *string);
CEXPORT int indigoLoadQueryReactionFromFile   (const char *filename);
CEXPORT int indigoLoadQueryReactionFromBuffer (const char *buffer, int size);

CEXPORT int indigoLoadReactionSmarts (int source);
CEXPORT int indigoLoadReactionSmartsFromString (const char *string);
CEXPORT int indigoLoadReactionSmartsFromFile   (const char *filename);
CEXPORT int indigoLoadReactionSmartsFromBuffer (const char *buffer, int size);


CEXPORT int indigoCreateReaction (void);
CEXPORT int indigoCreateQueryReaction (void);

CEXPORT int indigoAddReactant (int reaction, int molecule);
CEXPORT int indigoAddProduct  (int reaction, int molecule);
CEXPORT int indigoAddCatalyst (int reaction, int molecule);

CEXPORT int indigoCountReactants (int reaction);
CEXPORT int indigoCountProducts  (int reaction);
CEXPORT int indigoCountCatalysts (int reaction);
// Counts reactants, products, and catalysts.
CEXPORT int indigoCountMolecules (int reaction);
CEXPORT int indigoGetMolecule (int reaction, int index);

CEXPORT int indigoIterateReactants (int reaction);
CEXPORT int indigoIterateProducts  (int reaction);
CEXPORT int indigoIterateCatalysts (int reaction);
// Returns an iterator for reactants, products, and catalysts.
CEXPORT int indigoIterateMolecules (int reaction);

CEXPORT int indigoSaveRxnfile (int reaction, int output);
CEXPORT int indigoSaveRxnfileToFile (int reaction, const char *filename);
CEXPORT const char * indigoRxnfile (int reaction);

// Method for query optimizations for faster substructure search
// (works for both query molecules and query reactions)
CEXPORT int indigoOptimize (int query, const char *options);

// Methods for structure normalization
// It neutrailzes charges, resolves 5-valence Nitrogen, removes hydrogens and etc.
// Default options is empty.
CEXPORT int indigoNormalize (int structure, const char *options);

// Automatic reaction atom-to-atom mapping
// mode is one of the following (separated by a space):
//    "discard" : discards the existing mapping entirely and considers only
//                the existing reaction centers (the default)
//    "keep"    : keeps the existing mapping and maps unmapped atoms
//    "alter"   : alters the existing mapping, and maps the rest of the
//                reaction but may change the existing mapping
//    "clear"   : removes the mapping from the reaction.
//
//    "ignore_charges" : do not consider atom charges while searching
//    "ignore_isotopes" : do not consider atom isotopes while searching
//    "ignore_valence" : do not consider atom valence while searching
//    "ignore_radicals" : do not consider atom radicals while searching
CEXPORT int indigoAutomap (int reaction, const char *mode);

// Returns mapping number. It might appear that there is more them 
// one atom with the same number in AAM
// Value 0 means no mapping number has been specified.
CEXPORT int indigoGetAtomMappingNumber (int reaction, int reaction_atom);
CEXPORT int indigoSetAtomMappingNumber (int reaction, int reaction_atom, int number);

// Getters and setters for reacting centers
CEXPORT int indigoGetReactingCenter (int reaction, int reaction_bond, int*rc);
CEXPORT int indigoSetReactingCenter (int reaction, int reaction_bond, int rc);

// Clears all reaction AAM information 
CEXPORT int indigoClearAAM (int reaction);

// Corrects reacting centers according to AAM
CEXPORT int indigoCorrectReactingCenters (int reaction);


/* Accessing a molecule */

enum
{
   INDIGO_ABS = 1,
   INDIGO_OR = 2,
   INDIGO_AND = 3,
   INDIGO_EITHER = 4,
   INDIGO_UP = 5,
   INDIGO_DOWN = 6,
   INDIGO_CIS = 7,
   INDIGO_TRANS = 8,
   INDIGO_CHAIN = 9,
   INDIGO_RING = 10,
   INDIGO_ALLENE = 11,

   INDIGO_SINGLET = 101,
   INDIGO_DOUBLET = 102,
   INDIGO_TRIPLET = 103,
};

// Returns an iterator for all atoms of the given
// molecule, including r-sites and pseudoatoms.
CEXPORT int indigoIterateAtoms (int molecule);
CEXPORT int indigoIteratePseudoatoms (int molecule);
CEXPORT int indigoIterateRSites (int molecule);
CEXPORT int indigoIterateStereocenters (int molecule);
CEXPORT int indigoIterateAlleneCenters (int molecule);
CEXPORT int indigoIterateRGroups (int molecule);

CEXPORT int indigoIsPseudoatom (int atom);
CEXPORT int indigoIsRSite (int atom);

// returns INDIGO_{ABS,OR,AND,EITHER}
// or zero if the atom is not a stereoatom
CEXPORT int indigoStereocenterType (int atom);
CEXPORT int indigoChangeStereocenterType (int atom, int type);

CEXPORT int indigoStereocenterGroup (int atom);
CEXPORT int indigoSetStereocenterGroup (int atom, int group);

// returns 4 integers with atom indices that defines stereocenter pyramid
CEXPORT const int* indigoStereocenterPyramid (int atom);

CEXPORT int indigoSingleAllowedRGroup (int rsite);

CEXPORT int indigoAddStereocenter (int atom, int type, int v1, int v2, int v3, int v4);

// Applicable to an R-Group, but not to a molecule
CEXPORT int indigoIterateRGroupFragments (int rgroup);
// Applicable to an R-Group and to a molecule
// Returns maximal order of attachment points
CEXPORT int indigoCountAttachmentPoints (int item);
CEXPORT int indigoIterateAttachmentPoints (int item, int order);

CEXPORT const char * indigoSymbol (int atom);
CEXPORT int indigoDegree (int atom);

// Returns zero if the charge is ambiguous
// If the charge is nonambiguous, returns 1 and writes *charge
CEXPORT int indigoGetCharge (int atom, int *charge);
// Same as indigoGetCharge
CEXPORT int indigoGetExplicitValence (int atom, int *valence);

CEXPORT int indigoSetExplicitValence (int atom, int valence);

// Returns a number of element from the periodic table.
// Returns zero on ambiguous atom.
// Can not be applied to pseudo-atoms and R-sites.
CEXPORT int indigoAtomicNumber (int atom);
// Returns zero on unspecified or ambiguous isotope
CEXPORT int indigoIsotope (int atom);
// Not applicable to query molecules.
CEXPORT int indigoValence (int atom);

// Applicable to atoms, query atoms, and molecules. Can fail
// (return zero) on query atoms where the number of hydrogens
// is not definitely known. Otherwise, returns one and writes *hydro.
CEXPORT int indigoCountHydrogens (int item, int *hydro);

// Applicable to non-query molecules and atoms.
CEXPORT int indigoCountImplicitHydrogens (int item);

// On success, returns always the same pointer to a 3-element array;
// you should not free() it, but rather memcpy() it if you want to keep it.
CEXPORT float * indigoXYZ (int atom);

CEXPORT int indigoSetXYZ (int atom, float x, float y, float z);

CEXPORT int indigoCountSuperatoms (int molecule);
CEXPORT int indigoCountDataSGroups (int molecule);
CEXPORT int indigoCountRepeatingUnits (int molecule);
CEXPORT int indigoCountMultipleGroups (int molecule);
CEXPORT int indigoCountGenericSGroups (int molecule);
CEXPORT int indigoIterateDataSGroups (int molecule);
CEXPORT int indigoIterateSuperatoms (int molecule);
CEXPORT int indigoIterateGenericSGroups (int molecule);
CEXPORT int indigoIterateRepeatingUnits (int molecule);
CEXPORT int indigoIterateMultipleGroups (int molecule);

CEXPORT int indigoGetSuperatom (int molecule, int index);
CEXPORT int indigoGetDataSGroup (int molecule, int index);
CEXPORT int indigoGetGenericSGroup (int molecule, int index);
CEXPORT int indigoGetMultipleGroup (int molecule, int index);
CEXPORT int indigoGetRepeatingUnit (int molecule, int index);

CEXPORT const char * indigoDescription (int data_sgroup);
CEXPORT const char * indigoData (int data_sgroup);

CEXPORT int indigoAddDataSGroup (int molecule, int natoms, int *atoms,
        int nbonds, int *bonds, const char *description, const char *data);

CEXPORT int indigoAddSuperatom (int molecule, int natoms, int *atoms, const char *name);

CEXPORT int indigoSetDataSGroupXY (int sgroup, float x, float y, const char *options);

CEXPORT int indigoResetCharge (int atom);
CEXPORT int indigoResetExplicitValence (int atom);
CEXPORT int indigoResetIsotope (int atom);

CEXPORT int indigoSetAttachmentPoint (int atom, int order);
CEXPORT int indigoClearAttachmentPoints (int item);

CEXPORT int indigoRemoveConstraints  (int item, const char *type);
CEXPORT int indigoAddConstraint      (int item, const char *type, const char *value);
CEXPORT int indigoAddConstraintNot   (int item, const char *type, const char *value);
CEXPORT int indigoAddConstraintOr    (int atom, const char* type, const char* value);

CEXPORT int indigoResetStereo (int item);
CEXPORT int indigoInvertStereo (int item);

CEXPORT int indigoCountAtoms (int molecule);
CEXPORT int indigoCountBonds (int molecule);
CEXPORT int indigoCountPseudoatoms (int molecule);
CEXPORT int indigoCountRSites (int molecule);

CEXPORT int indigoIterateBonds (int molecule);
// Returns 1/2/3 if the bond is a single/double/triple bond
// Returns 4 if the bond is an aromatic bond
// Returns zero if the bond is ambiguous (query bond)
CEXPORT int indigoBondOrder  (int bond);

// Returns INDIGO_{UP/DOWN/EITHER/CIS/TRANS},
// or zero if the bond is not a stereobond
CEXPORT int indigoBondStereo (int bond);

// Returns INDIGO_{CHAIN/RING},
CEXPORT int indigoTopology (int bond);

// Returns an iterator whose elements can be treated as atoms.
// At the same time, they support indigoBond() call.
CEXPORT int indigoIterateNeighbors (int atom);

// Applicable exclusively to the "atom neighbors iterator".
// Returns a bond to the neighbor atom.
CEXPORT int indigoBond (int nei);

// Accessing atoms and bonds by index
CEXPORT int indigoGetAtom (int molecule, int idx);
CEXPORT int indigoGetBond (int molecule, int idx);

CEXPORT int indigoSource (int bond);
CEXPORT int indigoDestination (int bond);

CEXPORT int indigoClearCisTrans (int handle);
CEXPORT int indigoClearStereocenters (int handle);
CEXPORT int indigoCountStereocenters (int molecule);
CEXPORT int indigoClearAlleneCenters (int molecule);
CEXPORT int indigoCountAlleneCenters (int molecule);

CEXPORT int indigoResetSymmetricCisTrans (int handle);
CEXPORT int indigoResetSymmetricStereocenters (int handle);
CEXPORT int indigoMarkEitherCisTrans (int handle);
CEXPORT int indigoMarkStereobonds (int handle);

CEXPORT int indigoValidateChirality (int handle);

// Accepts a symbol from the periodic table (like "C" or "Br"),
// or a pseudoatom symbol, like "Pol". Returns the added atom.
CEXPORT int indigoAddAtom (int molecule, const char *symbol);
// Set a new atom instead of specified
CEXPORT int indigoResetAtom (int atom, const char *symbol);

// Accepts Rsite name "R" (or just ""), "R1", "R2" or list with names "R1 R3"
CEXPORT int indigoAddRSite (int molecule, const char *name);
CEXPORT int indigoSetRSite (int atom, const char *name);

CEXPORT int indigoSetCharge (int atom, int charge);
CEXPORT int indigoSetIsotope (int atom, int isotope);

// If the radical is nonambiguous, returns 1 and writes *electrons
CEXPORT int indigoGetRadicalElectrons (int atom, int *electrons);
// If the radical is nonambiguous, returns 1 and writes *radical
CEXPORT int indigoGetRadical (int atom, int *radical);
CEXPORT int indigoSetRadical (int atom, int radical);
CEXPORT int indigoResetRadical (int atom);

// Used for hacks with aromatic molecules; not recommended to use
// in other situations
CEXPORT int indigoSetImplicitHCount (int atom, int impl_h);

// Accepts two atoms (source and destination) and the order of the new bond
// (1/2/3/4 = single/double/triple/aromatic). Returns the added bond.
CEXPORT int indigoAddBond (int source, int destination, int order);

CEXPORT int indigoSetBondOrder (int bond, int order);

CEXPORT int indigoMerge (int where_to, int what);

/* Highlighting */

// Access atoms and bonds
CEXPORT int indigoHighlight (int item);

// Access atoms, bonds, molecules, and reactions
CEXPORT int indigoUnhighlight (int item);

// Access atoms and bonds
CEXPORT int indigoIsHighlighted (int item);

/* Connected components of molecules */

CEXPORT int indigoCountComponents (int molecule);
CEXPORT int indigoComponentIndex (int atom);
CEXPORT int indigoIterateComponents (int molecule);

// Returns a 'molecule component' object, which can not be used as a
// [query] molecule, but supports the indigo{Count,Iterate}{Atoms,Bonds} calls,
// and also the indigoClone() call, which returns a [query] molecule.
CEXPORT int indigoComponent (int molecule, int index);

/* Smallest Set of Smallest Rings */

CEXPORT int indigoCountSSSR (int molecule);
CEXPORT int indigoIterateSSSR (int molecule);

CEXPORT int indigoIterateSubtrees (int molecule, int min_atoms, int max_atoms);
CEXPORT int indigoIterateRings (int molecule, int min_atoms, int max_atoms);
CEXPORT int indigoIterateEdgeSubmolecules (int molecule, int min_bonds, int max_bonds);

/* Calculation on molecules */

CEXPORT int   indigoCountHeavyAtoms (int molecule);
CEXPORT int   indigoGrossFormula    (int molecule);
CEXPORT float indigoMolecularWeight (int molecule);
CEXPORT float indigoMostAbundantMass (int molecule);
CEXPORT float indigoMonoisotopicMass (int molecule);

CEXPORT const char * indigoCanonicalSmiles (int molecule);
CEXPORT const char * indigoLayeredCode (int molecule);

CEXPORT const int * indigoSymmetryClasses (int molecule, int *count_out);

CEXPORT int indigoHasCoord (int molecule);
CEXPORT int indigoHasZCoord (int molecule);
CEXPORT int indigoIsChiral (int molecule);

CEXPORT int indigoCreateSubmolecule (int molecule, int nvertices, int *vertices);
CEXPORT int indigoCreateEdgeSubmolecule (int molecule, int nvertices, int *vertices, int nedges, int *edges);

CEXPORT int indigoGetSubmolecule (int molecule, int nvertices, int *vertices);

CEXPORT int indigoRemoveAtoms (int molecule, int nvertices, int *vertices);
CEXPORT int indigoRemoveBonds (int molecule, int nbonds, int *bonds);

// Determines and applies the best transformation to the given molecule
// so that the specified atoms move as close as possible to the desired
// positions. The size of desired_xyz is equal to 3 * natoms.
// The return value is the root-mean-square measure of the difference
// between the desired and obtained positions.
CEXPORT float indigoAlignAtoms (int molecule, int natoms, int *atom_ids, float *desired_xyz);

/* Things that work for both molecules and reactions */

CEXPORT int indigoAromatize (int item);
CEXPORT int indigoDearomatize (int item);

CEXPORT int indigoFoldHydrogens (int item);
CEXPORT int indigoUnfoldHydrogens (int item);

CEXPORT int indigoLayout (int object);

CEXPORT const char * indigoSmiles (int item);

// Returns a "mapping" if there is an exact match, zero otherwise
// The flags string consists of space-separated flags.
// The more flags, the more restrictive matching is done.
// "ELE": Distribution of electrons: bond types, atom charges, radicals, valences
// "MAS": Atom isotopes
// "STE": Stereochemistry: chiral centers, stereogroups, and cis-trans bonds
// "FRA": Connected fragments: disallows match of separate ions in salts
// "ALL": All of the above
// By default (with null or empty flags string) all flags are on.
CEXPORT int indigoExactMatch (int item1, int item2, const char *flags);

// "beg" and "end" refer to the two ends of the tautomeric chain. Allowed
// elements are separated by commas. '1' at the beginning means an aromatic
// atom, while '0' means an aliphatic atom.
CEXPORT int indigoSetTautomerRule (int id, const char *beg, const char *end);

CEXPORT int indigoRemoveTautomerRule (int id);

CEXPORT int indigoClearTautomerRules ();

CEXPORT const char * indigoName (int handle);
CEXPORT int indigoSetName (int handle, const char *name);

// You should not free() the obtained buffer, but rather memcpy() it if you want to keep it
CEXPORT int indigoSerialize (int handle, byte **buf, int *size);

CEXPORT int indigoUnserialize (const byte *buf, int size);

// Applicable to molecules/reactions obtained from SDF or RDF files,
// and to their clones, and to their R-Group deconvolutions.
CEXPORT int indigoHasProperty (int handle, const char *prop);
CEXPORT const char * indigoGetProperty (int handle, const char *prop);

// Applicable to newly created or cloned molecules/reactions,
// and also to molecules/reactions obtained from SDF or RDF files.
// If the property with the given name does not exist, it is created automatically.
CEXPORT int indigoSetProperty (int item, const char *prop, const char *value);

// Does not raise an error if the given property does not exist
CEXPORT int indigoRemoveProperty (int item, const char *prop);

// Returns an iterator that one can pass to indigoName() to
// know the name of the property. The value of the property can be
// obtained via indigoGetProperty() call to the object
CEXPORT int indigoIterateProperties (int handle);

// Clears all properties of the molecule
CEXPORT int indigoClearProperties (int handle);

// Accepts a molecule or reaction (but not query molecule or query reaction).
// Returns a string describing the first encountered mistake with valence.
// Returns an empty string if the input molecule/reaction is fine.
CEXPORT const char * indigoCheckBadValence (int handle);

// Accepts a molecule or reaction (but not query molecule or query reaction).
// Returns a string describing the first encountered mistake with ambiguous H counter.
// Returns an empty string if the input molecule/reaction is fine.
CEXPORT const char * indigoCheckAmbiguousH (int handle);

/* Fingerprints */

// Returns a 'fingerprint' object, which can then be passed to:
//   indigoToString() -- to get hexadecimal representation
//   indigoToBuffer() -- to get raw byte data
//   indigoSimilarity() -- to calculate similarity with another fingerprint
// The following fingerprint types are available:
//   "sim"     -- "Similarity fingerprint", useful for calculating
//                 similarity measures (the default)
//   "sub"     -- "Substructure fingerprint", useful for substructure screening
//   "sub-res" -- "Resonance substructure fingerprint", useful for resonance
//                 substructure screening
//   "sub-tau" -- "Tautomer substructure fingerprint", useful for tautomer
//                 substructure screening
//   "full"    -- "Full fingerprint", which has all the mentioned
//                 fingerprint types included
CEXPORT int indigoFingerprint (int item, const char *type);

// Counts the nonzero (i.e. one) bits in a fingerprint
CEXPORT int indigoCountBits (int fingerprint);

// Counts the number of the coinincident in two fingerprints
CEXPORT int indigoCommonBits (int fingerprint1, int fingerprint2);

// Accepts two molecules, two reactions, or two fingerprints.
// Returns the similarity measure between them.
// Metrics: "tanimoto", "tversky", "tversky <alpha> <beta>", "euclid-sub" or "normalized-edit"
// Zero pointer or empty string defaults to "tanimoto".
// "tversky" without numbers defaults to alpha = beta = 0.5
CEXPORT float indigoSimilarity (int item1, int item2, const char *metrics);

/* Working with SDF/RDF/SMILES/CML files  */

CEXPORT int indigoIterateSDF    (int reader);
CEXPORT int indigoIterateRDF    (int reader);
CEXPORT int indigoIterateSmiles (int reader);
CEXPORT int indigoIterateCML    (int reader);

CEXPORT int indigoIterateSDFile     (const char *filename);
CEXPORT int indigoIterateRDFile     (const char *filename);
CEXPORT int indigoIterateSmilesFile (const char *filename);
CEXPORT int indigoIterateCMLFile    (const char *filename);

// Applicable to items returned by SDF/RDF iterators.
// Returns the content of SDF/RDF item.
CEXPORT const char * indigoRawData (int item);

// Applicable to items returned by SDF/RDF iterators.
// Returns the offset in the SDF/RDF file.
CEXPORT int indigoTell (int handle);

// Saves the molecule to an SDF output stream
CEXPORT int indigoSdfAppend (int output, int item);
// Saves the molecule to a multiline SMILES output stream
CEXPORT int indigoSmilesAppend (int output, int item);

// Similarly for RDF files, except that the header should be written first
CEXPORT int indigoRdfHeader (int output);
CEXPORT int indigoRdfAppend (int output, int item);

// Similarly for CML files, except that they have both header and footer
CEXPORT int indigoCmlHeader (int output);
CEXPORT int indigoCmlAppend (int output, int item);
CEXPORT int indigoCmlFooter (int output);

// Create saver objects that can be used to save molecules or reactions
// Supported formats: 'sdf', 'smi' or 'smiles', 'cml', 'rdf'
// Format argument is case-insensitive
// Saver should be closed with indigoClose function
CEXPORT int indigoCreateSaver (int output, const char *format);
CEXPORT int indigoCreateFileSaver (const char *filename, const char *format);

// Append object to a specified saver stream
CEXPORT int indigoAppend (int saver, int object);

/* Arrays */

CEXPORT int indigoCreateArray ();
// Note: a clone of the object is added, not the object itself
CEXPORT int indigoArrayAdd (int arr, int object);
CEXPORT int indigoAt (int item, int index);
CEXPORT int indigoCount (int item);
CEXPORT int indigoClear (int arr);
CEXPORT int indigoIterateArray (int arr);

/* Substructure matching */

// Returns a new 'matcher' object
// 'mode' is reserved for future use; currently its value is ignored
CEXPORT int indigoSubstructureMatcher (int target, const char *mode);

// Ignore target atom in the substructure matcher
CEXPORT int indigoIgnoreAtom (int matcher, int atom_object);

// Ignore target atom in the substructure matcher
CEXPORT int indigoUnignoreAtom (int matcher, int atom_object);

// Clear list of ignored target atoms in the substructure matcher
CEXPORT int indigoUnignoreAllAtoms (int matcher);

// Returns a new 'match' object on success, zero on fail
//    matcher is an matcher object returned by indigoSubstructureMatcher
CEXPORT int indigoMatch (int matcher, int query);                                                      

// Counts the number of embeddings of the query structure into the target
CEXPORT int indigoCountMatches (int matcher, int query);

// Counts the number of embeddings of the query structure into the target
// If number of embeddings is more then limit then limit is returned
CEXPORT int indigoCountMatchesWithLimit (int matcher, int query, int embeddings_limit);

// Returns substructure matches iterator
CEXPORT int indigoIterateMatches (int matcher, int query);

// Accepts a 'match' object obtained from indigoMatchSubstructure.
// Returns a new molecule which has the query highlighted.
CEXPORT int indigoHighlightedTarget (int match);

// Accepts an atom from the query, not an atom index.
//   You can use indigoGetAtom() to obtain the atom by its index.
// Returns the corresponding target atom, not an atom index. If query 
// atom doesn't match particular atom in the target (R-group or explicit 
// hydrogen) then return value is zero.
//   You can use indigoIndex() to obtain the index of the returned atom.
CEXPORT int indigoMapAtom (int handle, int atom);

// Accepts a bond from the query, not a bond index.
//   You can use indigoGetBond() to obtain the bond by its index.
// Returns the corresponding target bond, not a bond index. If query
// bond doesn't match particular bond in the target (R-group or explicit
// hydrogen) then return value is zero.
//   You can use indigoIndex() to obtain the index of the returned bond.
CEXPORT int indigoMapBond (int handle, int bond);

// Accepts a molecule from the query reaction, not a molecule index.
//   You can use indigoGetMolecule() to obtain the bond by its index.
// Returns the corresponding target molecule, not a reaction index. If query
// molecule doesn't match particular molecule in the target then return 
// value is zero.
//   You can use indigoIndex() to obtain the index of the returned molecule.
CEXPORT int indigoMapMolecule (int handle, int molecule);

/* Scaffold detection */

// Returns zero if no common substructure is found.
// Otherwise, it returns a new object, which can be
//   (i) treated as a structure: the maximum (by the number of rings) common
//       substructure of the given structures.
//  (ii) passed to indigoAllScaffolds()
CEXPORT int indigoExtractCommonScaffold (int structures, const char *options);

// Returns an array of all possible scaffolds.
// The input parameter is the value returned by indigoExtractCommonScaffold().
CEXPORT int indigoAllScaffolds (int extracted);

/* R-Group deconvolution */

// Returns a ``decomposition'' object that can be passed to
// indigoDecomposedMoleculeScaffold() and
// indigoIterateDecomposedMolecules()
CEXPORT int indigoDecomposeMolecules (int scaffold, int structures);

// Returns a scaffold molecule with r-sites marking the place
// for substituents to add to form the structures given above.
CEXPORT int indigoDecomposedMoleculeScaffold (int decomp);

// Returns an iterator which corresponds to the given collection of structures.
// indigoDecomposedMoleculeHighlighted() and
// indigoDecomposedMoleculeWithRGroups() are applicable to the
// values returned by the iterator.
CEXPORT int indigoIterateDecomposedMolecules (int decomp);

// Returns a molecule with highlighted scaffold
CEXPORT int indigoDecomposedMoleculeHighlighted (int decomp);

// Returns a query molecule with r-sites and "R1=...", "R2=..."
// substituents defined. The 'scaffold' part of the molecule
// is identical to the indigoDecomposedMoleculeScaffold()
CEXPORT int indigoDecomposedMoleculeWithRGroups (int decomp);

/*
 * Decomposition Iteration API
 */
// Returns a 'decomposition' object
CEXPORT int indigoCreateDecomposer(int scaffold);
// Returns a 'decomposition' item
CEXPORT int indigoDecomposeMolecule(int decomp, int mol);
// Returns decomposition iterator
CEXPORT int indigoIterateDecompositions(int deco_item);
// Adds the input decomposition to a full scaffold
CEXPORT int indigoAddDecomposition(int decomp, int q_match);

/*
 * Abbreviations
 */
CEXPORT int indigoExpandAbbreviations (int molecule);

/* Other */

CEXPORT const char * indigoToString (int handle);
CEXPORT int indigoToBuffer (int handle, char **buf, int *size);

/* Reaction products enumeration */

// Accepts a query reaction with markd R-sites, and array of arrays
// of substituents corresponding to the R-Sites. Returns an array of
// reactions with R-Sites replaced by the actual substituents.
CEXPORT int indigoReactionProductEnumerate (int reaction, int monomers);

CEXPORT int indigoTransform (int reaction, int monomers);

/* Debug functionality */

// Returns internal type of an object
CEXPORT const char * indigoDbgInternalType (int object);

// Internal breakpoint
CEXPORT void indigoDbgBreakpoint (void);

// Methods that returns profiling infromation in a human readable format
CEXPORT const char * indigoDbgProfiling (int /*bool*/ whole_session);

// Reset profiling counters either for the current state or for the whole session
CEXPORT int indigoDbgResetProfiling (int /*bool*/ whole_session);

#endif