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
|
/*
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* Copyright (c) Schrodinger, LLC.
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information.
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-*
-*
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_Parse
#define _H_Parse
char *ParseWordCopy(char *dst, char *src, int n);
char *ParseWordNumberCopy(char *dst, char *src, int n);
char *ParseWord(char *dst, char *src, int n);
char *ParseNTrim(char *q, char *p, int n);
char *ParseNTrimRight(char *q, char *p, int n);
char *ParseNSkip(char *p, int n);
char *ParseCommaCopy(char *q, char *p, int n);
char *ParseSkipEquals(char *p);
char *ParseIntCopy(char *q, char *p, int n);
char *ParseAlphaCopy(char *q, char *p, int n);
int ParseFloat3List(char *p, float *vals);
#ifdef _PYMOL_INLINE
__inline__ static char *ParseNextLine(char *p)
{
register char ch;
const char mask = -16; /* 0xF0 */
while((mask & p[0]) && (mask & p[1]) && (mask & p[2]) && (mask & p[3])) /* trusting short-circuit to avoid overrun */
p += 4;
while((ch = *p)) {
p++;
if(ch == 0xD) { /* Mac or PC */
if((*p) == 0xA) /* PC */
return p + 1;
return p;
} else if(ch == 0xA) { /* Unix */
return p;
}
}
return p;
}
__inline__ static char *ParseNCopy(char *q, char *p, int n)
{ /* n character copy */
register char ch;
while((ch = *p)) {
if((ch == 0xD) || (ch == 0xA)) /* don't copy end of lines */
break;
if(!n)
break;
n--;
p++;
*(q++) = ch;
}
*q = 0;
return p;
}
#else
char *ParseNextLine(char *p);
char *ParseNCopy(char *dst, char *src, int n);
#endif
#endif
|