1 2 3 /* 4 A* ------------------------------------------------------------------- 5 B* This file contains source code for the PyMOL computer program 6 C* Copyright (c) Schrodinger, LLC. 7 D* ------------------------------------------------------------------- 8 E* It is unlawful to modify or remove this copyright notice. 9 F* ------------------------------------------------------------------- 10 G* Please see the accompanying LICENSE file for further information. 11 H* ------------------------------------------------------------------- 12 I* Additional authors of this source file include: 13 -* 14 -* 15 -* 16 Z* ------------------------------------------------------------------- 17 */ 18 #ifndef _H_Util 19 #define _H_Util 20 21 #include "os_predef.h" 22 23 #include "PyMOLGlobals.h" 24 #include "Base.h" 25 #include <string> 26 27 void UtilZeroMem(void *ptr, ov_size howMuch); 28 void UtilCopyMem(void *dst, const void *src, ov_size howMuch); 29 void *UtilArrayCalloc(unsigned int *dim, ov_size ndim, ov_size atom_size); 30 char *UtilConcat(char *where,const char *what); 31 void UtilNConcat(char *dst, const char *str, ov_size n); 32 void UtilConcatVLA(char **vla, ov_size * cc, const char *str); 33 void UtilNPadVLA(char **vla, ov_size * cc, const char *str, ov_size len); 34 void UtilFillVLA(char **vla, ov_size * cc, char what, ov_size len); 35 void UtilNCopy(char *dst, const char *src, ov_size n); /* up to N-1 chars */ 36 void UtilNCopyToLower(char *dst, const char *src, ov_size n); /* up to N-1 chars */ 37 void UtilCleanStr(char *s); 38 std::string UtilCleanStdStr(const std::string& s); 39 void UtilStripANSIEscapes(char *s); 40 void UtilStripANSIEscapes(std::string& str); 41 int UtilCountStringVLA(char *vla); 42 43 double UtilGetSecondsEpoch(); 44 double UtilGetSeconds(PyMOLGlobals * G); 45 int UtilInit(PyMOLGlobals * G); 46 void UtilFree(PyMOLGlobals * G); 47 48 typedef int UtilOrderFn(const void *array, int l, int r); 49 void UtilSortIndex(int n, void *array, int *x, UtilOrderFn * fOrdered); 50 51 int UtilSemiSortFloatIndex(int n, float *array, int *x, int forward); 52 int UtilSemiSortFloatIndexWithNBins(int n, int nbins, float *array,int *x, int forward); 53 int UtilSemiSortFloatIndexWithNBinsImpl(int *start1, int n, int nbins, float *array, int *destx, int forward); 54 55 void UtilApplySortedIndices(int n, int *x, int rec_size, void *src, void *dst); 56 57 void UtilSortInPlace(PyMOLGlobals * G, void *array, int nItem, unsigned int itemSize, 58 UtilOrderFn * fOrdered); 59 60 void UtilExpandArrayElements(void *src, void *dst, int n_entries, int old_rec_size, 61 int new_rec_size); 62 typedef int UtilOrderFnGlobals(PyMOLGlobals * G, const void *array, int l, int r); 63 void UtilSortIndexGlobals(PyMOLGlobals * G, int n, const void *array, int *x, 64 UtilOrderFnGlobals * fOrdered); 65 66 int UtilShouldWePrintQuantity(int quantity); 67 68 #endif 69