PageRenderTime 73ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/chemtool-1.6.13/src-cht/cht-2.7.c

#
C | 3575 lines | 3180 code | 319 blank | 76 comment | 958 complexity | 7d5e2bf2ff5436901d328909105c6e48 MD5 | raw file
Possible License(s): GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. /* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */
  2. /* From input file "cht-1.7.pp" */
  3. #ifdef HAVE_CONFIG_H
  4. #include <config.h>
  5. #endif
  6. #ifndef P2C_H
  7. #define P2C_H
  8. /* Header file for code generated by "p2c", the Pascal-to-C translator */
  9. /* "p2c" Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation.
  10. * By Dave Gillespie, daveg@synaptics.com. Version 1.21alpha-07.Dec.93.
  11. * This file may be copied, modified, etc. in any way. It is not restricted
  12. * by the licence agreement accompanying p2c itself.
  13. */
  14. #include <stdio.h>
  15. #include <unistd.h>
  16. #define DOUBLE double
  17. /* If the following heuristic fails, compile -DBSD=0 for non-BSD systems,
  18. or -DBSD=1 for BSD systems. */
  19. #ifdef M_XENIX
  20. # define BSD 0
  21. #endif
  22. #ifdef vms
  23. # define BSD 0
  24. # ifndef __STDC__
  25. # define __STDC__ 1
  26. # endif
  27. #endif
  28. #ifdef __TURBOC__
  29. # define MSDOS 1
  30. #endif
  31. #ifdef MSDOS
  32. # define BSD 0
  33. #endif
  34. #ifdef FILE /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */
  35. # ifndef BSD /* (a convenient, but horrible kludge!) */
  36. # define BSD 1
  37. # endif
  38. #endif
  39. #ifdef BSD
  40. # if !BSD
  41. # undef BSD
  42. # endif
  43. #endif
  44. #if (defined(__STDC__) && !defined(M_XENIX)) || defined(__TURBOC__)
  45. # include <stdlib.h>
  46. # include <stddef.h>
  47. # define HAS_STDLIB
  48. # if defined(vms) || defined(__TURBOC__)
  49. # define NON_ANSI_CAT
  50. # endif
  51. #else
  52. # ifndef BSD
  53. # ifndef __TURBOC__
  54. # include <memory.h>
  55. # endif
  56. # endif
  57. # ifdef hpux
  58. # ifdef _INCLUDE__STDC__
  59. # include <stddef.h>
  60. # include <stdlib.h>
  61. # define HAS_STDLIB
  62. # endif
  63. # endif
  64. # include <sys/types.h>
  65. # if !defined(MSDOS) || defined(__TURBOC__)
  66. # define NON_ANSI_CAT
  67. # endif
  68. #endif
  69. #if defined(NON_ANSI_CAT) && !defined(ANSI_CAT)
  70. # ifdef NON_ANSI_CAT_ALTERNATE
  71. # define __CAT__(a,b)a/**/b
  72. # else
  73. # define __ID__(a)a
  74. # define __CAT__(a,b)__ID__(a)b
  75. # endif
  76. #else
  77. # define __CAT__(a,b)a##b
  78. #endif
  79. #ifdef BSD
  80. # include <strings.h>
  81. # define strchr(s,c) index(s,c)
  82. # define strrchr(s,c) rindex(s,c)
  83. #else
  84. # include <string.h>
  85. #endif
  86. #include <ctype.h>
  87. #include <math.h>
  88. #include <setjmp.h>
  89. #include <assert.h>
  90. #ifndef NO_LACK
  91. #ifdef vms
  92. #define LACK_LABS
  93. #define LACK_MEMMOVE
  94. #define LACK_MEMCPY
  95. #else
  96. #define LACK_LABS /* Undefine these if your library has these */
  97. #define LACK_MEMMOVE
  98. #endif
  99. #endif
  100. typedef struct __p2c_jmp_buf {
  101. struct __p2c_jmp_buf *next;
  102. jmp_buf jbuf;
  103. } __p2c_jmp_buf;
  104. /* Warning: The following will not work if setjmp is used simultaneously.
  105. This also violates the ANSI restriction about using vars after longjmp,
  106. but a typical implementation of longjmp will get it right anyway. */
  107. #ifndef FAKE_TRY
  108. # define TRY(x) do { __p2c_jmp_buf __try_jb; \
  109. __try_jb.next = __top_jb; \
  110. if (!setjmp((__top_jb = &__try_jb)->jbuf)) {
  111. # define RECOVER(x) __top_jb = __try_jb.next; } else {
  112. # define RECOVER2(x,L) __top_jb = __try_jb.next; } else { \
  113. if (0) { L: __top_jb = __try_jb.next; }
  114. # define ENDTRY(x) } } while (0)
  115. #else
  116. # define TRY(x) if (1) {
  117. # define RECOVER(x) } else do {
  118. # define RECOVER2(x,L) } else do { L: ;
  119. # define ENDTRY(x) } while (0)
  120. #endif
  121. #ifdef M_XENIX /* avoid compiler bug */
  122. # define SHORT_MAX (32767)
  123. # define SHORT_MIN (-32768)
  124. #endif
  125. /* The following definitions work only on twos-complement machines */
  126. #ifndef SHORT_MAX
  127. # define SHORT_MAX ((short)(((unsigned short) -1) >> 1))
  128. # define SHORT_MIN (~SHORT_MAX)
  129. #endif
  130. #ifndef INT_MAX
  131. # define INT_MAX ((int)(((unsigned int) -1) >> 1))
  132. # define INT_MIN (~INT_MAX)
  133. #endif
  134. #ifndef LONG_MAX
  135. # define LONG_MAX ((long)(((unsigned long) -1) >> 1))
  136. # define LONG_MIN (~LONG_MAX)
  137. #endif
  138. #ifndef SEEK_SET
  139. # define SEEK_SET 0
  140. # define SEEK_CUR 1
  141. # define SEEK_END 2
  142. #endif
  143. #ifndef EXIT_SUCCESS
  144. # ifdef vms
  145. # define EXIT_SUCCESS 1
  146. # define EXIT_FAILURE (02000000000L)
  147. # else
  148. # define EXIT_SUCCESS 0
  149. # define EXIT_FAILURE 1
  150. # endif
  151. #endif
  152. #define SETBITS 32
  153. #if defined(__STDC__) || defined(__TURBOC__)
  154. # if !defined(vms) && !defined(M_LINT)
  155. # define Signed signed
  156. # else
  157. # define Signed
  158. # endif
  159. # define Void void /* Void f() = procedure */
  160. # ifndef Const
  161. # define Const const
  162. # endif
  163. # ifndef Volatile
  164. # define Volatile volatile
  165. # endif
  166. # ifdef M_LINT
  167. # define PP(x) ()
  168. # define PV() ()
  169. typedef char *Anyptr;
  170. # else
  171. # define PP(x) x /* function prototype */
  172. # define PV() (void) /* null function prototype */
  173. typedef void *Anyptr;
  174. # endif
  175. #else
  176. # define Signed
  177. # define Void void
  178. # ifndef Const
  179. # define Const
  180. # endif
  181. # ifndef Volatile
  182. # define Volatile
  183. # endif
  184. # define PP(x) ()
  185. # define PV() ()
  186. typedef char *Anyptr;
  187. #endif
  188. #ifdef __GNUC__
  189. # define Inline inline
  190. #else
  191. # define Inline
  192. #endif
  193. #define Register register /* Register variables */
  194. #define Char char /* Characters (not bytes) */
  195. #ifndef Static
  196. # define Static static /* Private global funcs and vars */
  197. #endif
  198. #ifndef Local
  199. # define Local static /* Nested functions */
  200. #endif
  201. typedef Signed char schar;
  202. typedef unsigned char uchar;
  203. typedef unsigned char boolean;
  204. #ifndef NO_DECLARE_ALFA
  205. typedef Char alfa[10];
  206. #endif
  207. #ifndef true
  208. # define true 1
  209. # define false 0
  210. #endif
  211. #ifndef TRUE
  212. # define TRUE 1
  213. # define FALSE 0
  214. #endif
  215. typedef struct {
  216. Anyptr proc, link;
  217. } _PROCEDURE;
  218. #ifndef _FNSIZE
  219. # define _FNSIZE 120
  220. #endif
  221. extern Void PASCAL_MAIN PP( (int, Char **) );
  222. extern Char **P_argv;
  223. extern int P_argc;
  224. extern short P_escapecode;
  225. extern int P_ioresult;
  226. extern __p2c_jmp_buf *__top_jb;
  227. #ifdef P2C_H_PROTO /* if you have Ansi C but non-prototyped header files */
  228. extern Char *strcat PP( (Char *, Const Char *) );
  229. extern Char *strchr PP( (Const Char *, int) );
  230. extern int strcmp PP( (Const Char *, Const Char *) );
  231. extern Char *strcpy PP( (Char *, Const Char *) );
  232. extern size_t strlen PP( (Const Char *) );
  233. extern Char *strncat PP( (Char *, Const Char *, size_t) );
  234. extern int strncmp PP( (Const Char *, Const Char *, size_t) );
  235. extern Char *strncpy PP( (Char *, Const Char *, size_t) );
  236. extern Char *strrchr PP( (Const Char *, int) );
  237. extern int atoi PP( (Const Char *) );
  238. extern double atof PP( (Const Char *) );
  239. extern long atol PP( (Const Char *) );
  240. extern double strtod PP( (Const Char *, Char **) );
  241. extern long strtol PP( (Const Char *, Char **, int) );
  242. #endif /*P2C_H_PROTO*/
  243. #ifndef HAS_STDLIB
  244. #ifndef NO_DECLARE_MALLOC
  245. extern Anyptr malloc PP( (size_t) );
  246. extern Void free PP( (Anyptr) );
  247. #endif
  248. #endif
  249. extern int _OutMem PV();
  250. extern int _CaseCheck PV();
  251. extern int _NilCheck PV();
  252. extern int _Escape PP( (int) );
  253. extern int _EscIO PP( (int) );
  254. extern int _EscIO2 PP( (int, Char *) );
  255. extern long ipow PP( (long, long) );
  256. extern long P_imax PP( (long, long) );
  257. extern long P_imin PP( (long, long) );
  258. extern double P_rmax PP( (double, double) );
  259. extern double P_rmin PP( (double, double) );
  260. extern Char *strsub PP( (Char *, Char *, int, int) );
  261. extern Char *strltrim PP( (Char *) );
  262. extern Char *strrtrim PP( (Char *) );
  263. extern Char *strrpt PP( (Char *, Char *, int) );
  264. extern Char *strpad PP( (Char *, Char *, int, int) );
  265. extern int strpos2 PP( (Char *, Char *, int) );
  266. extern long memavail PV();
  267. extern int P_peek PP( (FILE *) );
  268. extern int P_eof PP( (FILE *) );
  269. extern int P_eoln PP( (FILE *) );
  270. extern Void P_readpaoc PP( (FILE *, Char *, int) );
  271. extern Void P_readlnpaoc PP( (FILE *, Char *, int) );
  272. extern long P_maxpos PP( (FILE *) );
  273. extern Char *P_trimname PP( (Char *, int) );
  274. extern long *P_setunion PP( (long *, long *, long *) );
  275. extern long *P_setint PP( (long *, long *, long *) );
  276. extern long *P_setdiff PP( (long *, long *, long *) );
  277. extern long *P_setxor PP( (long *, long *, long *) );
  278. extern int P_inset PP( (unsigned, long *) );
  279. extern int P_setequal PP( (long *, long *) );
  280. extern int P_subset PP( (long *, long *) );
  281. extern long *P_addset PP( (long *, unsigned) );
  282. extern long *P_addsetr PP( (long *, unsigned, unsigned) );
  283. extern long *P_remset PP( (long *, unsigned) );
  284. extern long *P_expset PP( (long *, long) );
  285. extern long P_packset PP( (long *) );
  286. extern FILE *_skipspaces PP( (FILE *) );
  287. extern FILE *_skipnlspaces PP( (FILE *) );
  288. /* I/O error handling */
  289. #define _CHKIO(cond,ior,val,def) ((cond) ? P_ioresult=0,(val) \
  290. : P_ioresult=(ior),(def))
  291. #define _SETIO(cond,ior) (P_ioresult = (cond) ? 0 : (ior))
  292. /* Following defines are suitable for the HP Pascal operating system */
  293. #define FileNotFound 10
  294. #define FileNotOpen 13
  295. #define FileWriteError 38
  296. #define BadInputFormat 14
  297. #define EndOfFile 30
  298. #define FILENOTFOUND 10
  299. #define FILENOTOPEN 13
  300. #define FILEWRITEERROR 38
  301. #define BADINPUTFORMAT 14
  302. #define ENDOFFILE 30
  303. /* Creating temporary files */
  304. #if (defined(BSD) || defined(NO_TMPFILE)) && !defined(HAVE_TMPFILE)
  305. # define tmpfile() (fopen(tmpnam(NULL), "w+"))
  306. #endif
  307. /* File buffers */
  308. #define FILEBUF(f,sc,type) sc int __CAT__(f,_BFLAGS); \
  309. sc type __CAT__(f,_BUFFER)
  310. #define FILEBUFNC(f,type) int __CAT__(f,_BFLAGS); \
  311. type __CAT__(f,_BUFFER)
  312. #define RESETBUF(f,type) (__CAT__(f,_BFLAGS) = 1)
  313. #define SETUPBUF(f,type) (__CAT__(f,_BFLAGS) = 0)
  314. #define GETFBUF(f,type) (*((__CAT__(f,_BFLAGS) == 1 && \
  315. ((__CAT__(f,_BFLAGS) = 2), \
  316. fread(&__CAT__(f,_BUFFER), \
  317. sizeof(type),1,(f)))),\
  318. &__CAT__(f,_BUFFER)))
  319. #define AGETFBUF(f,type) ((__CAT__(f,_BFLAGS) == 1 && \
  320. ((__CAT__(f,_BFLAGS) = 2), \
  321. fread(__CAT__(f,_BUFFER), \
  322. sizeof(type),1,(f)))),\
  323. __CAT__(f,_BUFFER))
  324. #define PUTFBUF(f,type,v) (GETFBUF(f,type) = (v))
  325. #define CPUTFBUF(f,v) (PUTFBUF(f,char,v))
  326. #define GET(f,type) (__CAT__(f,_BFLAGS) == 1 ? \
  327. fread(&__CAT__(f,_BUFFER),sizeof(type),1,(f)) : \
  328. (__CAT__(f,_BFLAGS) = 1))
  329. #define PUT(f,type) (fwrite(&__CAT__(f,_BUFFER),sizeof(type),1,(f)), \
  330. (__CAT__(f,_BFLAGS) = 0))
  331. #define CPUT(f) (PUT(f,char))
  332. #define BUFEOF(f) (__CAT__(f,_BFLAGS) != 2 && P_eof(f))
  333. #define BUFFPOS(f) (ftell(f) - (__CAT__(f,_BFLAGS) == 2))
  334. typedef struct {
  335. FILE *f;
  336. int f_BFLAGS; /* FILEBUFNC(f,Char); */
  337. Char f_BUFFER;
  338. Char name[_FNSIZE];
  339. } _TEXT;
  340. /* Memory allocation */
  341. #ifdef __GCC__
  342. # define Malloc(n) (malloc(n) ?: (Anyptr)_OutMem())
  343. #else
  344. extern Anyptr __MallocTemp__;
  345. # define Malloc(n) ((__MallocTemp__ = malloc(n)) ? __MallocTemp__ : (Anyptr)_OutMem())
  346. #endif
  347. #define FreeR(p) (free((Anyptr)(p))) /* used if arg is an rvalue */
  348. #define Free(p) (free((Anyptr)(p)), (p)=NULL)
  349. /* sign extension */
  350. #define SEXT(x,n) ((x) | -(((x) & (1L<<((n)-1))) << 1))
  351. /* packed arrays */ /* BEWARE: these are untested! */
  352. #define P_getbits_UB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] >> \
  353. (((~(i))&((1<<(L)-(n))-1)) << (n)) & \
  354. (1<<(1<<(n)))-1))
  355. #define P_getbits_SB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] << \
  356. (16 - ((((~(i))&((1<<(L)-(n))-1))+1) <<\
  357. (n)) >> (16-(1<<(n))))))
  358. #define P_putbits_UB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \
  359. (x) << (((~(i))&((1<<(L)-(n))-1)) << (n)))
  360. #define P_putbits_SB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \
  361. ((x) & (1<<(1<<(n)))-1) << \
  362. (((~(i))&((1<<(L)-(n))-1)) << (n)))
  363. #define P_clrbits_B(a,i,n,L) ((a)[(i)>>(L)-(n)] &= \
  364. ~( ((1<<(1<<(n)))-1) << \
  365. (((~(i))&((1<<(L)-(n))-1)) << (n))) )
  366. /* small packed arrays */
  367. #define P_getbits_US(v,i,n) ((int)((v) >> ((i)<<(n)) & (1<<(1<<(n)))-1))
  368. #define P_getbits_SS(v,i,n) ((int)((long)(v) << (SETBITS - (((i)+1) << (n))) >> (SETBITS-(1<<(n)))))
  369. #define P_putbits_US(v,i,x,n) ((v) |= (x) << ((i) << (n)))
  370. #define P_putbits_SS(v,i,x,n) ((v) |= ((x) & (1<<(1<<(n)))-1) << ((i)<<(n)))
  371. #define P_clrbits_S(v,i,n) ((v) &= ~( ((1<<(1<<(n)))-1) << ((i)<<(n)) ))
  372. #define P_max(a,b) ((a) > (b) ? (a) : (b))
  373. #define P_min(a,b) ((a) < (b) ? (a) : (b))
  374. /* Fix ANSI-isms */
  375. #ifdef LACK_LABS
  376. # ifndef labs
  377. # define labs my_labs
  378. extern long my_labs PP( (long) );
  379. # endif
  380. #endif
  381. /* Fix toupper/tolower on Suns and other stupid BSD systems */
  382. #ifdef toupper
  383. # undef toupper
  384. # undef tolower
  385. # define toupper(c) my_toupper(c)
  386. # define tolower(c) my_tolower(c)
  387. #endif
  388. #ifndef _toupper
  389. # if 'A' == 65 && 'a' == 97
  390. # define _toupper(c) ((c)-'a'+'A')
  391. # define _tolower(c) ((c)-'A'+'a')
  392. # else
  393. # ifdef toupper
  394. # undef toupper /* hope these are shadowing real functions, */
  395. # undef tolower /* because my_toupper calls _toupper! */
  396. # endif
  397. # define _toupper(c) toupper(c)
  398. # define _tolower(c) tolower(c)
  399. # endif
  400. #endif
  401. #endif /* P2C_H */
  402. /* End. */
  403. /* Run-time library for use with "p2c", the Pascal to C translator */
  404. /* "p2c" Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation.
  405. * By Dave Gillespie, daveg@synaptics.com. Version --VERSION--.
  406. * This file may be copied, modified, etc. in any way. It is not restricted
  407. * by the licence agreement accompanying p2c itself.
  408. */
  409. #ifndef NO_TIME
  410. # include <time.h>
  411. #endif
  412. #define Isspace(c) isspace(c) /* or "((c) == ' ')" if preferred */
  413. int P_argc;
  414. char **P_argv;
  415. short P_escapecode;
  416. int P_ioresult;
  417. long EXCP_LINE; /* Used by Pascal workstation system */
  418. Anyptr __MallocTemp__;
  419. __p2c_jmp_buf *__top_jb;
  420. void PASCAL_MAIN(argc, argv)
  421. int argc;
  422. char **argv;
  423. {
  424. P_argc = argc;
  425. P_argv = argv;
  426. __top_jb = NULL;
  427. #ifdef LOCAL_INIT
  428. LOCAL_INIT();
  429. #endif
  430. }
  431. /* In case your system lacks these... */
  432. long my_labs(x)
  433. long x;
  434. {
  435. return((x > 0) ? x : -x);
  436. }
  437. int my_toupper(c)
  438. int c;
  439. {
  440. if (islower(c))
  441. return _toupper(c);
  442. else
  443. return c;
  444. }
  445. int my_tolower(c)
  446. int c;
  447. {
  448. if (isupper(c))
  449. return _tolower(c);
  450. else
  451. return c;
  452. }
  453. long ipow(a, b)
  454. long a, b;
  455. {
  456. long v;
  457. if (a == 0 || a == 1)
  458. return a;
  459. if (a == -1)
  460. return (b & 1) ? -1 : 1;
  461. if (b < 0)
  462. return 0;
  463. if (a == 2)
  464. return 1L << b;
  465. v = (b & 1) ? a : 1;
  466. while ((b >>= 1) > 0) {
  467. a *= a;
  468. if (b & 1)
  469. v *= a;
  470. }
  471. return v;
  472. }
  473. long P_imax(a, b)
  474. long a, b;
  475. {
  476. if (a > b)
  477. return a;
  478. else
  479. return b;
  480. }
  481. long P_imin(a, b)
  482. long a, b;
  483. {
  484. if (a < b)
  485. return a;
  486. else
  487. return b;
  488. }
  489. double P_rmax(a, b)
  490. double a, b;
  491. {
  492. if (a > b)
  493. return a;
  494. else
  495. return b;
  496. }
  497. double P_rmin(a, b)
  498. double a, b;
  499. {
  500. if (a < b)
  501. return a;
  502. else
  503. return b;
  504. }
  505. /* Common string functions: */
  506. /* Store in "ret" the substring of length "len" starting from "pos" (1-based).
  507. Store a shorter or null string if out-of-range. Return "ret". */
  508. char *strsub(ret, s, pos, len)
  509. register char *ret, *s;
  510. register int pos, len;
  511. {
  512. register char *s2;
  513. if (--pos < 0 || len <= 0) {
  514. *ret = 0;
  515. return ret;
  516. }
  517. while (pos > 0) {
  518. if (!*s++) {
  519. *ret = 0;
  520. return ret;
  521. }
  522. pos--;
  523. }
  524. s2 = ret;
  525. while (--len >= 0) {
  526. if (!(*s2++ = *s++))
  527. return ret;
  528. }
  529. *s2 = 0;
  530. return ret;
  531. }
  532. /* Return the index of the first occurrence of "pat" as a substring of "s",
  533. starting at index "pos" (1-based). Result is 1-based, 0 if not found. */
  534. int strpos2(s, pat, pos)
  535. char *s;
  536. register char *pat;
  537. register int pos;
  538. {
  539. register char *cp, ch;
  540. register int slen;
  541. if (--pos < 0)
  542. return 0;
  543. slen = (int)strlen(s) - pos;
  544. cp = s + pos;
  545. if (!(ch = *pat++))
  546. return 0;
  547. pos = (int)strlen(pat);
  548. slen -= pos;
  549. while (--slen >= 0) {
  550. if (*cp++ == ch && !strncmp(cp, pat, (size_t)pos))
  551. return cp - s;
  552. }
  553. return 0;
  554. }
  555. /* Case-insensitive version of strcmp. */
  556. int strcicmp(s1, s2)
  557. register char *s1, *s2;
  558. {
  559. register unsigned char c1, c2;
  560. while (*s1) {
  561. if (*s1++ != *s2++) {
  562. if (!s2[-1])
  563. return 1;
  564. c1 = (unsigned char)toupper(s1[-1]);
  565. c2 = (unsigned char)toupper(s2[-1]);
  566. if (c1 != c2)
  567. return c1 - c2;
  568. }
  569. }
  570. if (*s2)
  571. return -1;
  572. return 0;
  573. }
  574. /* HP and Turbo Pascal string functions: */
  575. /* Trim blanks at left end of string. */
  576. char *strltrim(s)
  577. register char *s;
  578. {
  579. while (Isspace(*s++)) ;
  580. return s - 1;
  581. }
  582. /* Trim blanks at right end of string. */
  583. char *strrtrim(s)
  584. register char *s;
  585. {
  586. register char *s2 = s;
  587. if (!*s)
  588. return s;
  589. while (*++s2) ;
  590. while (s2 > s && Isspace(*--s2))
  591. *s2 = 0;
  592. return s;
  593. }
  594. /* Store in "ret" "num" copies of string "s". Return "ret". */
  595. char *strrpt(ret, s, num)
  596. char *ret;
  597. register char *s;
  598. register int num;
  599. {
  600. register char *s2 = ret;
  601. register char *s1;
  602. while (--num >= 0) {
  603. s1 = s;
  604. while ((*s2++ = *s1++)) ;
  605. s2--;
  606. }
  607. return ret;
  608. }
  609. /* Store in "ret" string "s" with enough pad chars added to reach "size". */
  610. char *strpad(ret, s, padchar, num)
  611. char *ret;
  612. register char *s;
  613. register int padchar, num;
  614. {
  615. register char *d = ret;
  616. if (s == d) {
  617. while (*d++) ;
  618. } else {
  619. while ((*d++ = *s++)) ;
  620. }
  621. num -= (--d - ret);
  622. while (--num >= 0)
  623. *d++ = padchar;
  624. *d = 0;
  625. return ret;
  626. }
  627. /* Copy the substring of length "len" from index "spos" of "s" (1-based)
  628. to index "dpos" of "d", lengthening "d" if necessary. Length and
  629. indices must be in-range. */
  630. void strmove(len, s, spos, d, dpos)
  631. register char *s, *d;
  632. register int len, spos, dpos;
  633. {
  634. s += spos - 1;
  635. d += dpos - 1;
  636. while (*d && --len >= 0)
  637. *d++ = *s++;
  638. if (len > 0) {
  639. while (--len >= 0)
  640. *d++ = *s++;
  641. *d = 0;
  642. }
  643. }
  644. /* Delete the substring of length "len" at index "pos" from "s".
  645. Delete less if out-of-range. */
  646. void strdelete(s, pos, len)
  647. register char *s;
  648. register int pos, len;
  649. {
  650. register int slen;
  651. if (--pos < 0)
  652. return;
  653. slen = (int)strlen(s) - pos;
  654. if (slen <= 0)
  655. return;
  656. s += pos;
  657. if (slen <= len) {
  658. *s = 0;
  659. return;
  660. }
  661. while ((*s = s[len])) s++;
  662. }
  663. /* Insert string "src" at index "pos" of "dst". */
  664. void strinsert(src, dst, pos)
  665. register char *src, *dst;
  666. register int pos;
  667. {
  668. register int slen, dlen;
  669. if (--pos < 0)
  670. return;
  671. dlen = (int)strlen(dst);
  672. dst += dlen;
  673. dlen -= pos;
  674. if (dlen <= 0) {
  675. strcpy(dst, src);
  676. return;
  677. }
  678. slen = (int)strlen(src);
  679. do {
  680. dst[slen] = *dst;
  681. --dst;
  682. } while (--dlen >= 0);
  683. dst++;
  684. while (--slen >= 0)
  685. *dst++ = *src++;
  686. }
  687. /* File functions */
  688. /* Peek at next character of input stream; return EOF at end-of-file. */
  689. int P_peek(f)
  690. FILE *f;
  691. {
  692. int ch;
  693. ch = getc(f);
  694. if (ch == EOF)
  695. return EOF;
  696. ungetc(ch, f);
  697. return (ch == '\n') ? ' ' : ch;
  698. }
  699. /* Check if at end of file, using Pascal "eof" semantics. End-of-file for
  700. stdin is broken; remove the special case for it to be broken in a
  701. different way. */
  702. int P_eof(f)
  703. FILE *f;
  704. {
  705. register int ch;
  706. if (feof(f))
  707. return 1;
  708. #ifdef HAVE_ISATTY
  709. if (isatty(fileno(f)))
  710. #else
  711. if (f == stdin)
  712. #endif
  713. return 0; /* not safe to look-ahead on the keyboard! */
  714. ch = getc(f);
  715. if (ch == EOF)
  716. return 1;
  717. ungetc(ch, f);
  718. return 0;
  719. }
  720. /* Check if at end of line (or end of entire file). */
  721. int P_eoln(f)
  722. FILE *f;
  723. {
  724. register int ch;
  725. ch = getc(f);
  726. if (ch == EOF)
  727. return 1;
  728. ungetc(ch, f);
  729. return (ch == '\n');
  730. }
  731. /* Skip whitespace (including newlines) in a file. */
  732. FILE *_skipnlspaces(f)
  733. FILE *f;
  734. {
  735. register int ch;
  736. do {
  737. ch = getc(f);
  738. } while (ch == ' ' || ch == '\t' || ch == '\n');
  739. if (ch != EOF)
  740. ungetc(ch, f);
  741. return f;
  742. }
  743. /* Skip whitespace (not including newlines) in a file. */
  744. FILE *_skipspaces(f)
  745. FILE *f;
  746. {
  747. register int ch;
  748. do {
  749. ch = getc(f);
  750. } while (ch == ' ' || ch == '\t');
  751. if (ch != EOF)
  752. ungetc(ch, f);
  753. return f;
  754. }
  755. /* Read a packed array of characters from a file. */
  756. Void P_readpaoc(f, s, len)
  757. FILE *f;
  758. char *s;
  759. int len;
  760. {
  761. int ch;
  762. for (;;) {
  763. if (len <= 0)
  764. return;
  765. ch = getc(f);
  766. if (ch == EOF || ch == '\n')
  767. break;
  768. *s++ = ch;
  769. --len;
  770. }
  771. while (--len >= 0)
  772. *s++ = ' ';
  773. if (ch != EOF)
  774. ungetc(ch, f);
  775. }
  776. Void P_readlnpaoc(f, s, len)
  777. FILE *f;
  778. char *s;
  779. int len;
  780. {
  781. int ch;
  782. for (;;) {
  783. ch = getc(f);
  784. if (ch == EOF || ch == '\n')
  785. break;
  786. if (len > 0) {
  787. *s++ = ch;
  788. --len;
  789. }
  790. }
  791. while (--len >= 0)
  792. *s++ = ' ';
  793. }
  794. /* Compute maximum legal "seek" index in file (0-based). */
  795. long P_maxpos(f)
  796. FILE *f;
  797. {
  798. long savepos = ftell(f);
  799. long val;
  800. if (fseek(f, 0L, SEEK_END))
  801. return -1;
  802. val = ftell(f);
  803. if (fseek(f, savepos, SEEK_SET))
  804. return -1;
  805. return val;
  806. }
  807. /* Use packed array of char for a file name. */
  808. Char *P_trimname(fn, len)
  809. register Char *fn;
  810. register int len;
  811. {
  812. static Char fnbuf[256];
  813. register Char *cp = fnbuf;
  814. while (--len >= 0 && *fn && !isspace(*fn))
  815. *cp++ = *fn++;
  816. *cp = 0;
  817. return fnbuf;
  818. }
  819. /* Pascal's "memavail" doesn't make much sense in Unix with virtual memory.
  820. We fix memory size as 10Meg as a reasonable compromise. */
  821. long memavail()
  822. {
  823. return 10000000; /* worry about this later! */
  824. }
  825. long maxavail()
  826. {
  827. return memavail();
  828. }
  829. /* Sets are stored as an array of longs. S[0] is the size of the set;
  830. S[N] is the N'th 32-bit chunk of the set. S[0] equals the maximum
  831. I such that S[I] is nonzero. S[0] is zero for an empty set. Within
  832. each long, bits are packed from lsb to msb. The first bit of the
  833. set is the element with ordinal value 0. (Thus, for a "set of 5..99",
  834. the lowest five bits of the first long are unused and always zero.) */
  835. /* (Sets with 32 or fewer elements are normally stored as plain longs.) */
  836. long *P_setunion(d, s1, s2) /* d := s1 + s2 */
  837. register long *d, *s1, *s2;
  838. {
  839. long *dbase = d++;
  840. register int sz1 = *s1++, sz2 = *s2++;
  841. while (sz1 > 0 && sz2 > 0) {
  842. *d++ = *s1++ | *s2++;
  843. sz1--, sz2--;
  844. }
  845. while (--sz1 >= 0)
  846. *d++ = *s1++;
  847. while (--sz2 >= 0)
  848. *d++ = *s2++;
  849. *dbase = d - dbase - 1;
  850. return dbase;
  851. }
  852. long *P_setint(d, s1, s2) /* d := s1 * s2 */
  853. register long *d, *s1, *s2;
  854. {
  855. long *dbase = d++;
  856. register int sz1 = *s1++, sz2 = *s2++;
  857. while (--sz1 >= 0 && --sz2 >= 0)
  858. *d++ = *s1++ & *s2++;
  859. while (--d > dbase && !*d) ;
  860. *dbase = d - dbase;
  861. return dbase;
  862. }
  863. long *P_setdiff(d, s1, s2) /* d := s1 - s2 */
  864. register long *d, *s1, *s2;
  865. {
  866. long *dbase = d++;
  867. register int sz1 = *s1++, sz2 = *s2++;
  868. while (--sz1 >= 0 && --sz2 >= 0)
  869. *d++ = *s1++ & ~*s2++;
  870. if (sz1 >= 0) {
  871. while (sz1-- >= 0)
  872. *d++ = *s1++;
  873. }
  874. while (--d > dbase && !*d) ;
  875. *dbase = d - dbase;
  876. return dbase;
  877. }
  878. long *P_setxor(d, s1, s2) /* d := s1 / s2 */
  879. register long *d, *s1, *s2;
  880. {
  881. long *dbase = d++;
  882. register int sz1 = *s1++, sz2 = *s2++;
  883. while (sz1 > 0 && sz2 > 0) {
  884. *d++ = *s1++ ^ *s2++;
  885. sz1--, sz2--;
  886. }
  887. while (--sz1 >= 0)
  888. *d++ = *s1++;
  889. while (--sz2 >= 0)
  890. *d++ = *s2++;
  891. while (--d > dbase && !*d) ;
  892. *dbase = d - dbase;
  893. return dbase;
  894. }
  895. int P_inset(val, s) /* val IN s */
  896. register unsigned val;
  897. register long *s;
  898. {
  899. register int bit;
  900. bit = (int) (val % SETBITS);
  901. val /= SETBITS;
  902. if ((long)val < *s++ && ((1L<<bit) & s[val]))
  903. return 1;
  904. return 0;
  905. }
  906. long *P_addset(s, val) /* s := s + [val] */
  907. register long *s;
  908. register unsigned val;
  909. {
  910. register long *sbase = s;
  911. register int bit, size;
  912. bit = (int) (val % SETBITS);
  913. val /= SETBITS;
  914. size = (int)*s;
  915. if (++val >(unsigned) size) {
  916. s += size;
  917. while (val > (unsigned)size)
  918. *++s = 0, size++;
  919. *sbase = size;
  920. } else
  921. s += val;
  922. *s |= 1L<<bit;
  923. return sbase;
  924. }
  925. long *P_addsetr(s, v1, v2) /* s := s + [v1..v2] */
  926. register long *s;
  927. register unsigned v1, v2;
  928. {
  929. register long *sbase = s;
  930. register int b1, b2, size;
  931. if ((int)v1 > (int)v2)
  932. return sbase;
  933. b1 = (int) (v1 % SETBITS);
  934. v1 /= SETBITS;
  935. b2 = (int) (v2 % SETBITS);
  936. v2 /= SETBITS;
  937. size = *s;
  938. v1++;
  939. if (++v2 > (unsigned)size) {
  940. while (v2 > (unsigned)size)
  941. s[++size] = 0;
  942. s[v2] = 0;
  943. *s = (long)v2;
  944. }
  945. s += v1;
  946. if (v1 == v2) {
  947. *s |= (~((-2L)<<(b2-b1))) << b1;
  948. } else {
  949. *s++ |= (-1L) << b1;
  950. while (++v1 < v2)
  951. *s++ = -1;
  952. *s |= ~((-2L) << b2);
  953. }
  954. return sbase;
  955. }
  956. long *P_remset(s, val) /* s := s - [val] */
  957. register long *s;
  958. register unsigned val;
  959. {
  960. register int bit;
  961. bit = (int) (val % SETBITS);
  962. val /= SETBITS;
  963. if ((long)++val <= *s) {
  964. if (!(s[val] &= ~(1L<<bit)))
  965. while (*s && !s[*s])
  966. (*s)--;
  967. }
  968. return s;
  969. }
  970. int P_setequal(s1, s2) /* s1 = s2 */
  971. register long *s1, *s2;
  972. {
  973. register int size = *s1++;
  974. if (*s2++ != size)
  975. return 0;
  976. while (--size >= 0) {
  977. if (*s1++ != *s2++)
  978. return 0;
  979. }
  980. return 1;
  981. }
  982. int P_subset(s1, s2) /* s1 <= s2 */
  983. register long *s1, *s2;
  984. {
  985. register int sz1 = *s1++, sz2 = *s2++;
  986. if (sz1 > sz2)
  987. return 0;
  988. while (--sz1 >= 0) {
  989. if (*s1++ & ~*s2++)
  990. return 0;
  991. }
  992. return 1;
  993. }
  994. /* s is a "smallset", i.e., a 32-bit or less set stored
  995. directly in a long. */
  996. long *P_expset(d, s) /* d := s */
  997. register long *d;
  998. register long s;
  999. {
  1000. if (s) {
  1001. d[1] = s;
  1002. *d = 1;
  1003. } else
  1004. *d = 0;
  1005. return d;
  1006. }
  1007. long P_packset(s) /* convert s to a small-set */
  1008. register long *s;
  1009. {
  1010. if (*s++)
  1011. return *s;
  1012. else
  1013. return 0;
  1014. }
  1015. int _OutMem()
  1016. {
  1017. return _Escape(-2);
  1018. }
  1019. int _CaseCheck()
  1020. {
  1021. return _Escape(-9);
  1022. }
  1023. int _NilCheck()
  1024. {
  1025. return _Escape(-3);
  1026. }
  1027. /* The following is suitable for the HP Pascal operating system.
  1028. It might want to be revised when emulating another system. */
  1029. char *_ShowEscape(buf, code, ior, prefix)
  1030. char *buf, *prefix;
  1031. int code, ior;
  1032. {
  1033. char *bufp;
  1034. if (prefix && *prefix) {
  1035. strcpy(buf, prefix);
  1036. strcat(buf, ": ");
  1037. bufp = buf + strlen(buf);
  1038. } else {
  1039. bufp = buf;
  1040. }
  1041. if (code == -10) {
  1042. snprintf(bufp,80, "Pascal system I/O error %d", ior);
  1043. switch (ior) {
  1044. case 3:
  1045. strcat(buf, " (illegal I/O request)");
  1046. break;
  1047. case 7:
  1048. strcat(buf, " (bad file name)");
  1049. break;
  1050. case FileNotFound: /*10*/
  1051. strcat(buf, " (file not found)");
  1052. break;
  1053. case FileNotOpen: /*13*/
  1054. strcat(buf, " (file not open)");
  1055. break;
  1056. case BadInputFormat: /*14*/
  1057. strcat(buf, " (bad input format)");
  1058. break;
  1059. case 24:
  1060. strcat(buf, " (not open for reading)");
  1061. break;
  1062. case 25:
  1063. strcat(buf, " (not open for writing)");
  1064. break;
  1065. case 26:
  1066. strcat(buf, " (not open for direct access)");
  1067. break;
  1068. case 28:
  1069. strcat(buf, " (string subscript out of range)");
  1070. break;
  1071. case EndOfFile: /*30*/
  1072. strcat(buf, " (end-of-file)");
  1073. break;
  1074. case FileWriteError: /*38*/
  1075. strcat(buf, " (file write error)");
  1076. break;
  1077. }
  1078. } else {
  1079. snprintf(bufp,80, "Pascal system error %d", code);
  1080. switch (code) {
  1081. case -2:
  1082. strcat(buf, " (out of memory)");
  1083. break;
  1084. case -3:
  1085. strcat(buf, " (reference to NIL pointer)");
  1086. break;
  1087. case -4:
  1088. strcat(buf, " (integer overflow)");
  1089. break;
  1090. case -5:
  1091. strcat(buf, " (divide by zero)");
  1092. break;
  1093. case -6:
  1094. strcat(buf, " (real math overflow)");
  1095. break;
  1096. case -8:
  1097. strcat(buf, " (value range error)");
  1098. break;
  1099. case -9:
  1100. strcat(buf, " (CASE value range error)");
  1101. break;
  1102. case -12:
  1103. strcat(buf, " (bus error)");
  1104. break;
  1105. case -20:
  1106. strcat(buf, " (stopped by user)");
  1107. break;
  1108. }
  1109. }
  1110. return buf;
  1111. }
  1112. int _Escape(code)
  1113. int code;
  1114. {
  1115. char buf[100];
  1116. P_escapecode = code;
  1117. if (__top_jb) {
  1118. __p2c_jmp_buf *jb = __top_jb;
  1119. __top_jb = jb->next;
  1120. longjmp(jb->jbuf, 1);
  1121. }
  1122. if (code == 0)
  1123. exit(EXIT_SUCCESS);
  1124. if (code == -1)
  1125. exit(EXIT_FAILURE);
  1126. fprintf(stderr, "%s\n", _ShowEscape(buf, P_escapecode, P_ioresult, ""));
  1127. exit(EXIT_FAILURE);
  1128. }
  1129. int _EscIO(code)
  1130. int code;
  1131. {
  1132. P_ioresult = code;
  1133. return _Escape(-10);
  1134. }
  1135. int _EscIO2(code, name)
  1136. int code;
  1137. char *name;
  1138. {
  1139. P_ioresult = code;
  1140. if (!__top_jb && name && *name) {
  1141. char buf[100];
  1142. fprintf(stderr, "%s: %s\n",
  1143. name, _ShowEscape(buf, P_escapecode, P_ioresult, ""));
  1144. exit(EXIT_FAILURE);
  1145. }
  1146. return _Escape(-10);
  1147. }
  1148. /* End. */
  1149. typedef struct TPoint {
  1150. long X, Y, C, H, N, O, P, S, Si, B, Br, Cl, F, I, Al, Ag, As,Au, Ba, Be, Bi, Ca, Cd,
  1151. Co, Cr, Cs, Cu, Fe, Ga, Ge, Hf, Hg, In, Ir, Li, Lu, Mg, Mn, Mo, Na, Nb, Ni, Os, K, Pb, Pd, Pt, Rb,
  1152. Re, Rh, Ru, Sb, Sc, Se, Sn, Sr, Ta, Te, Ti, Tl, V, W, Ytt, Zn, Zr, RecCount;
  1153. struct TPoint *Last;
  1154. } TPoint;
  1155. typedef struct TBond {
  1156. long X1, Y1, X2, Y2, RecCount;
  1157. struct TBond *Last;
  1158. } TBond;
  1159. Static long C, H, N, O, P, S, Si, B, Br, Cl, F, I, Al, Ag, As, Au, Ba, Be, Bi, Ca, Cd,
  1160. Co, Cr, Cs, Cu, Fe, Ga, Ge, Hf, Hg, In, Ir, Li, Lu, Mg, Mn, Mo, Na, Nb, Ni, Os, K, Pb,
  1161. Pd, Pt, Rb, Re, Rh, Ru, Sb, Sc, Se, Sn, Sr, Ta, Te, Ti, Tl, V, W, Ytt, Zn, Zr, X1, X2, Y1, Y2, T, D;
  1162. Static FILE *IFile;
  1163. Static TPoint *Point, *Last, *Current;
  1164. Static TBond *Bond, *LastB, *CurrentB;
  1165. Static Char sss[256], A[256], subs[256], Alert[256];
  1166. Static Char sssb[7];
  1167. Static double M, Me;
  1168. Static Char separator;
  1169. Static long Count, code, atoms, rep, range, bonds;
  1170. Static boolean Abandon, debug, verbose, fa, nobonds;
  1171. Static long Sensi = 5; /*bonds and labels joint precision sensitivity*/
  1172. Static Char IFile_NAME[_FNSIZE];
  1173. Static Void doBonds()
  1174. {
  1175. do {
  1176. if (!fgets(sss,256,IFile)) return;
  1177. sscanf(sss, "%ld%ld%ld%ld%ld%ld%*[^\n]", &X1, &Y1, &X2, &Y2, &T, &D);
  1178. /*getc(IFile);*/
  1179. bonds--;
  1180. if (debug)
  1181. printf("%ld; %ld; %ld; %ld; %ld; %ld\n", X1, Y1, X2, Y2, T, D);
  1182. if (D == 1 || T == 8){
  1183. if (debug) printf("skipped\n");
  1184. continue;
  1185. }
  1186. if (debug) printf("parsed\n");
  1187. if (T == 11)
  1188. range = ((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2)) * 4;
  1189. LastB = Bond;
  1190. Bond = (TBond *)malloc(sizeof(TBond));
  1191. if (Bond == NULL) {
  1192. fprintf(stderr,"Could not allocate memory\n");
  1193. exit(1);
  1194. }
  1195. Bond->X1 = X1;
  1196. Bond->X2 = X2;
  1197. Bond->Y1 = Y1;
  1198. Bond->Y2 = Y2;
  1199. Bond->Last = LastB;
  1200. CurrentB = Bond;
  1201. Bond = Bond->Last;
  1202. while (Bond->Last != NULL) {
  1203. if ((labs(Bond->X1 - X1) < Sensi && labs(Bond->Y1 - Y1) < Sensi &&
  1204. labs(Bond->X2 - X2) < Sensi && labs(Bond->Y2 - Y2) < Sensi) ||
  1205. (labs(Bond->X2 - X1) < Sensi && labs(Bond->Y2 - Y1) < Sensi &&
  1206. labs(Bond->X1 - X2) < Sensi && labs(Bond->Y1 - Y2) < Sensi)) {
  1207. if (debug)
  1208. printf(" ! Bond overlap\n");
  1209. strcat(Alert, "!");
  1210. }
  1211. Bond = Bond->Last;
  1212. }
  1213. Bond = CurrentB;
  1214. Abandon = false;
  1215. Current = Point;
  1216. while (Point->Last != NULL) {
  1217. if (T == 11) {
  1218. Abandon = true;
  1219. if ((Point->X - X1) * (Point->X - X1) +
  1220. (Point->Y - Y1) * (Point->Y - Y1) < range) {
  1221. if (Point->H > 0)
  1222. Point->H--;
  1223. if (debug)
  1224. printf("Ring --> stripped one H from %ld %ld\n",
  1225. Point->X, Point->Y);
  1226. }
  1227. } else {
  1228. if (labs(Point->X - X1) < Sensi && labs(Point->Y - Y1) < Sensi) {
  1229. if (debug)
  1230. printf(" %ld --> Joined at %ld %ld\n", Point->RecCount, X1, Y1);
  1231. if (T == 0 || T == 5 || T == 6 || T == 7 || T == 10 || T == 12 ||
  1232. T == 13)
  1233. Point->H--;
  1234. if (T == 1 || T == 2 || T == 4 || T == 14 || T == 15 )
  1235. Point->H -= 2;
  1236. if (T == 3)
  1237. Point->H -= 3;
  1238. if (Point->H < 0) {
  1239. if (debug) printf("Point^.X=%ld, Point^.Y=%ld has H count <0 !\n",Point->X,Point->Y);
  1240. Point->H = 0;
  1241. }
  1242. Abandon = true;
  1243. }
  1244. }
  1245. Point = Point->Last;
  1246. }
  1247. Point = Current;
  1248. if (!Abandon) {
  1249. Count++;
  1250. Last = Point;
  1251. Point = (TPoint *)malloc(sizeof(TPoint));
  1252. if (Point == NULL) {
  1253. fprintf(stderr,"Could not allocate memory\n");
  1254. exit(1);
  1255. }
  1256. Point->X = X1;
  1257. if (debug)
  1258. printf(" Point^.X=%ld", Point->X);
  1259. Point->Y = Y1;
  1260. if (debug)
  1261. printf(" Point^.Y=%ld", Point->Y);
  1262. if (T != 11 && T != 9)
  1263. Point->C = 1;
  1264. else
  1265. Point->C = 0;
  1266. if (debug)
  1267. printf(" Point^.C=%ld", Point->C);
  1268. if (T == 0 || T == 5 || T == 6 || T == 7 || T == 10 || T == 12 ||
  1269. T == 13)
  1270. Point->H = 3;
  1271. if (T == 1 || T == 2 || T == 4 || T == 14 || T == 15)
  1272. Point->H = 2;
  1273. if (T == 3)
  1274. Point->H = 1;
  1275. if (debug)
  1276. printf(" Point^.H=%ld", Point->H);
  1277. Point->N = 0;
  1278. Point->O = 0;
  1279. Point->P = 0;
  1280. Point->S = 0;
  1281. Point->Si = 0;
  1282. Point->B = 0;
  1283. Point->Br = 0;
  1284. Point->Cl = 0;
  1285. Point->F = 0;
  1286. Point->I = 0;
  1287. Point->Al = 0;
  1288. Point->Ag = 0;
  1289. Point->As = 0;
  1290. Point->Au = 0;
  1291. Point->Ba = 0;
  1292. Point->Be = 0;
  1293. Point->Bi = 0;
  1294. Point->Ca = 0;
  1295. Point->Cd = 0;
  1296. Point->Co = 0;
  1297. Point->Cr = 0;
  1298. Point->Cs = 0;
  1299. Point->Cu = 0;
  1300. Point->Fe = 0;
  1301. Point->Ga = 0;
  1302. Point->Ge = 0;
  1303. Point->Hf = 0;
  1304. Point->Hg = 0;
  1305. Point->In = 0;
  1306. Point->Ir = 0;
  1307. Point->Li = 0;
  1308. Point->Lu = 0;
  1309. Point->Na = 0;
  1310. Point->Nb = 0;
  1311. Point->Ni = 0;
  1312. Point->Os = 0;
  1313. Point->Mg = 0;
  1314. Point->Mn = 0;
  1315. Point->Mo = 0;
  1316. Point->K = 0;
  1317. Point->Pb = 0;
  1318. Point->Pd = 0;
  1319. Point->Pt = 0;
  1320. Point->Rb = 0;
  1321. Point->Re = 0;
  1322. Point->Rh = 0;
  1323. Point->Ru = 0;
  1324. Point->Sb = 0;
  1325. Point->Sc = 0;
  1326. Point->Se = 0;
  1327. Point->Sn = 0;
  1328. Point->Sr = 0;
  1329. Point->Ta = 0;
  1330. Point->Te = 0;
  1331. Point->Ti = 0;
  1332. Point->Tl = 0;
  1333. Point->V = 0;
  1334. Point->W = 0;
  1335. Point->Ytt = 0;
  1336. Point->Zn = 0;
  1337. Point->Zr = 0;
  1338. Point->RecCount = Count;
  1339. if (debug)
  1340. printf(" Point^.RecCount=%ld\n", Point->RecCount);
  1341. Point->Last = Last;
  1342. }
  1343. if (T != 11) {
  1344. Abandon = false;
  1345. Current = Point;
  1346. while (Point->Last != NULL) {
  1347. if (labs(Point->X - X2) < Sensi && labs(Point->Y - Y2) < Sensi) {
  1348. if (debug)
  1349. printf(" %ld --> Joined at %ld %ld\n", Point->RecCount, X2, Y2);
  1350. if (T == 0 || T == 5 || T == 6 || T == 7 || T == 10 || T == 12 ||
  1351. T == 13)
  1352. Point->H--;
  1353. if (T == 1 || T == 2 || T == 4 || T == 14 || T == 15)
  1354. Point->H -= 2;
  1355. if (T == 3)
  1356. Point->H -= 3;
  1357. if (Point->H < 0) {
  1358. if (debug) printf("Point^.X=%ld, Point^.Y=%ld has H count <0 !\n",Point->X,Point->Y);
  1359. Point->H = 0;
  1360. }
  1361. Abandon = true;
  1362. }
  1363. Point = Point->Last;
  1364. }
  1365. Point = Current;
  1366. if (!Abandon) {
  1367. Count++;
  1368. Last = Point;
  1369. Point = (TPoint *)malloc(sizeof(TPoint));
  1370. if (Point == NULL) {
  1371. fprintf(stderr,"Could not allocate memory\n");
  1372. exit(1);
  1373. }
  1374. Point->X = X2;
  1375. if (debug)
  1376. printf(" Point^.X=%ld", Point->X);
  1377. Point->Y = Y2;
  1378. if (debug)
  1379. printf(" Point^.Y=%ld", Point->Y);
  1380. if (T != 11 && T != 9)
  1381. Point->C = 1;
  1382. else
  1383. Point->C = 0;
  1384. if (debug)
  1385. printf(" Point^.C=%ld", Point->C);
  1386. if (T == 0 || T == 5 || T == 6 || T == 7 || T == 10 || T == 12 ||
  1387. T == 13)
  1388. Point->H = 3;
  1389. if (T == 1 || T == 2 || T == 4 || T == 14 || T == 15 )
  1390. Point->H = 2;
  1391. if (T == 3)
  1392. Point->H = 1;
  1393. if (debug)
  1394. printf(" Point^.H=%ld", Point->H);
  1395. Point->N = 0;
  1396. Point->O = 0;
  1397. Point->P = 0;
  1398. Point->S = 0;
  1399. Point->Si = 0;
  1400. Point->B = 0;
  1401. Point->Br = 0;
  1402. Point->Cl = 0;
  1403. Point->F = 0;
  1404. Point->I = 0;
  1405. Point->Al = 0;
  1406. Point->Ag = 0;
  1407. Point->As = 0;
  1408. Point->Au = 0;
  1409. Point->Ba = 0;
  1410. Point->Be = 0;
  1411. Point->Bi = 0;
  1412. Point->Ca = 0;
  1413. Point->Cd = 0;
  1414. Point->Co = 0;
  1415. Point->Cr = 0;
  1416. Point->Cs = 0;
  1417. Point->Cu = 0;
  1418. Point->Fe = 0;
  1419. Point->Ga = 0;
  1420. Point->Ge = 0;
  1421. Point->Hf = 0;
  1422. Point->Hg = 0;
  1423. Point->In = 0;
  1424. Point->Ir = 0;
  1425. Point->Li = 0;
  1426. Point->Lu = 0;
  1427. Point->Mg = 0;
  1428. Point->Mn = 0;
  1429. Point->Mo = 0;
  1430. Point->Na = 0;
  1431. Point->Nb = 0;
  1432. Point->Ni = 0;
  1433. Point->Os = 0;
  1434. Point->K = 0;
  1435. Point->Pb = 0;
  1436. Point->Pd = 0;
  1437. Point->Pt = 0;
  1438. Point->Rb = 0;
  1439. Point->Re = 0;
  1440. Point->Rh = 0;
  1441. Point->Ru = 0;
  1442. Point->Sb = 0;
  1443. Point->Sc = 0;
  1444. Point->Se = 0;
  1445. Point->Sn = 0;
  1446. Point->Sr = 0;
  1447. Point->Ta = 0;
  1448. Point->Te = 0;
  1449. Point->Ti = 0;
  1450. Point->Tl = 0;
  1451. Point->V = 0;
  1452. Point->W = 0;
  1453. Point->Ytt = 0;
  1454. Point->Zn = 0;
  1455. Point->Zr = 0;
  1456. Point->RecCount = Count;
  1457. if (debug)
  1458. printf(" Point^.RecCount=%ld\n", Point->RecCount);
  1459. Point->Last = Last;
  1460. }
  1461. }
  1462. } while (bonds != 0);
  1463. }
  1464. Static Void doLabels()
  1465. {
  1466. long mul, gmul, gmpos, ggmul, ggmpos;
  1467. boolean stripped;
  1468. Char STR2[256];
  1469. long FORLIM;
  1470. Char *TEMP;
  1471. if (debug)
  1472. printf("---- and now parse the labels ---------\n");
  1473. if (verbose)
  1474. printf("HeteroAtoms: %ld\n", atoms);
  1475. FORLIM = atoms;
  1476. for (rep = 1; rep <= FORLIM; rep++) {
  1477. if (fscanf(IFile, "%ld%ld%c", &X1, &Y1, &separator)<2) return;
  1478. if (!fgets(sss, 256, IFile))return;
  1479. TEMP = strchr(sss, '\n');
  1480. if (TEMP != NULL)
  1481. *TEMP = 0;
  1482. snprintf(A,256, "%.*s", strpos2(sss, "\t", 1) - 1, sss);
  1483. if (debug)
  1484. printf("Atom %s X=%ld Y=%ld sss: %s\n", A, X1, Y1, sss);
  1485. if (nobonds)
  1486. { /*initialize the Point structure if no bonds, only labels, defined*/
  1487. Count++;
  1488. Last = Point;
  1489. Point = (TPoint *)malloc(sizeof(TPoint));
  1490. if (Point == NULL) {
  1491. fprintf(stderr,"Could not allocate memory\n");
  1492. exit(1);
  1493. }
  1494. Point->X = X1;
  1495. Point->Y = Y1;
  1496. Point->C = 0;
  1497. Point->H = 0;
  1498. Point->N = 0;
  1499. Point->O = 0;
  1500. Point->P = 0;
  1501. Point->S = 0;
  1502. Point->Si = 0;
  1503. Point->B = 0;
  1504. Point->Br = 0;
  1505. Point->Cl = 0;
  1506. Point->F = 0;
  1507. Point->I = 0;
  1508. Point->Al = 0;
  1509. Point->Ag = 0;
  1510. Point->As = 0;
  1511. Point->Au = 0;
  1512. Point->Ba = 0;
  1513. Point->Be = 0;
  1514. Point->Bi = 0;
  1515. Point->Ca = 0;
  1516. Point->Cd = 0;
  1517. Point->Co = 0;
  1518. Point->Cr = 0;
  1519. Point->Cs = 0;
  1520. Point->Cu = 0;
  1521. Point->Fe = 0;
  1522. Point->Ga = 0;
  1523. Point->Ge = 0;
  1524. Point->Hf = 0;
  1525. Point->Hg = 0;
  1526. Point->In = 0;
  1527. Point->Ir = 0;
  1528. Point->Li = 0;
  1529. Point->Lu = 0;
  1530. Point->Mg = 0;
  1531. Point->Mn = 0;
  1532. Point->Mo = 0;
  1533. Point->Na = 0;
  1534. Point->Nb = 0;
  1535. Point->Ni = 0;
  1536. Point->Os = 0;
  1537. Point->K = 0;
  1538. Point->Pb = 0;
  1539. Point->Pd = 0;
  1540. Point->Pt = 0;
  1541. Point->Rb = 0;
  1542. Point->Re = 0;
  1543. Point->Rh = 0;
  1544. Point->Ru = 0;
  1545. Point->Sb = 0;
  1546. Point->Sc = 0;
  1547. Point->Se = 0;
  1548. Point->Sn = 0;
  1549. Point->Sr = 0;
  1550. Point->Ta = 0;
  1551. Point->Te = 0;
  1552. Point->Ti = 0;
  1553. Point->Tl = 0;
  1554. Point->V = 0;
  1555. Point->W = 0;
  1556. Point->Ytt = 0;
  1557. Point->Zn = 0;
  1558. Point->Zr = 0;
  1559. Point->RecCount = Count;
  1560. Point->Last = Last;
  1561. }
  1562. Current = Point;
  1563. while (Point->Last != NULL) {
  1564. if (labs(Point->X - X1) < Sensi && labs(Point->Y - Y1) < Sensi) {
  1565. if (debug)
  1566. printf(" [%ld]\n", Point->RecCount);
  1567. Point->C = 0; /*we substitute -CH_x(-) by -R(-)*/
  1568. Point->H = 0;
  1569. Point->N = 0;
  1570. Point->O = 0;
  1571. Point->P = 0;
  1572. Point->S = 0;
  1573. Point->Si = 0;
  1574. Point->B = 0;
  1575. Point->Br = 0;
  1576. Point->Cl = 0;
  1577. Point->F = 0;
  1578. Point->I = 0;
  1579. Point->Al = 0;
  1580. Point->Ag = 0;
  1581. Point->As = 0;
  1582. Point->Au = 0;
  1583. Point->Ba = 0;
  1584. Point->Be = 0;
  1585. Point->Bi = 0;
  1586. Point->Ca = 0;
  1587. Point->Cd = 0;
  1588. Point->Co = 0;
  1589. Point->Cr = 0;
  1590. Point->Cs = 0;
  1591. Point->Cu = 0;
  1592. Point->Fe = 0;
  1593. Point->Ga = 0;
  1594. Point->Ge = 0;
  1595. Point->Hf = 0;
  1596. Point->Hg = 0;
  1597. Point->In = 0;
  1598. Point->Ir = 0;
  1599. Point->Li = 0;
  1600. Point->Lu = 0;
  1601. Point->Mg = 0;
  1602. Point->Mn = 0;
  1603. Point->Mo = 0;
  1604. Point->Na = 0;
  1605. Point->Nb = 0;
  1606. Point->Ni = 0;
  1607. Point->Os = 0;
  1608. Point->K = 0;
  1609. Point->Pb = 0;
  1610. Point->Pd = 0;
  1611. Point->Pt = 0;
  1612. Point->Rb = 0;
  1613. Point->Re = 0;
  1614. Point->Rh = 0;
  1615. Point->Ru = 0;
  1616. Point->Sb = 0;
  1617. Point->Sc = 0;
  1618. Point->Se = 0;
  1619. Point->Sn = 0;
  1620. Point->Sr = 0;
  1621. Point->Ta = 0;
  1622. Point->Te = 0;
  1623. Point->Ti = 0;
  1624. Point->Tl = 0;
  1625. Point->V = 0;
  1626. Point->W = 0;
  1627. Point->Ytt = 0;
  1628. Point->Zn = 0;
  1629. Point->Zr = 0;
  1630. mul = 1;
  1631. gmul = 1;
  1632. ggmul = 1;
  1633. while (*A != '\0') {
  1634. stripped = false;
  1635. if ((int)strlen(A) >= 5) {
  1636. snprintf(subs,256, "%.5s", A);
  1637. if ((int)strlen(A) > 6) {
  1638. if (A[5] == '_') {
  1639. if (A[6]!= '{') {
  1640. snprintf(STR2,256, "%c", A[6]);
  1641. if (A[7]=='_') snprintf(STR2,256, "%c%c", A[6],A[8]);
  1642. code = (sscanf(STR2, "%ld", &mul) == 0);
  1643. }else{
  1644. mul=7;
  1645. while(A[mul]!='}'){STR2[mul-7]=A[mul]; mul++ ; }
  1646. STR2[mul-6]='\0';
  1647. code = (sscanf(STR2, "%ld", &mul) == 0);
  1648. }
  1649. } else
  1650. mul = 1;
  1651. }
  1652. mul *= gmul * ggmul;
  1653. if (!strcmp(subs, "TBDMS")) { /*Tert-butyldimethylsilyl*/
  1654. if (debug)
  1655. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1656. Point->C += mul * 6;
  1657. Point->H += mul * 15;
  1658. Point->Si += mul;
  1659. strcpy(A, strsub(STR2, A, 6, (int)(strlen(A) - 5)));
  1660. stripped = true;
  1661. }
  1662. if (!strcmp(subs, "TBDPS")) { /*Tert-butyldiphenylsilyl*/
  1663. if (debug)
  1664. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1665. Point->C += mul * 16;
  1666. Point->H += mul * 19;
  1667. Point->Si += mul;
  1668. strcpy(A, strsub(STR2, A, 6, (int)(strlen(A) - 5)));
  1669. stripped = true;
  1670. }
  1671. if (A[0] == '[') {
  1672. ggmpos = strpos2(A, "]", 1);
  1673. if (ggmpos != 0) {
  1674. if (A[ggmpos] == '_') {
  1675. if (A[ggmpos+1]!= '{') {
  1676. snprintf(STR2,256, "%c", A[ggmpos+1]);
  1677. if (A[ggmpos+2]=='_') snprintf(STR2,256, "%c%c", A[ggmpos+1],A[ggmpos+3]);
  1678. code = (sscanf(STR2, "%ld", &ggmul) == 0);
  1679. }else{
  1680. ggmul=ggmpos+2;
  1681. while(A[ggmul]!='}'){STR2[ggmul-ggmpos-2]=A[ggmul]; ggmul++ ; }
  1682. STR2[ggmul-ggmpos-1]='\0';
  1683. code = (sscanf(STR2, "%ld", &ggmul) == 0);
  1684. }
  1685. } else
  1686. ggmul = 1;
  1687. }
  1688. }
  1689. if (A[0] == '(') {
  1690. gmpos = strpos2(A, ")", 1);
  1691. if (gmpos != 0) {
  1692. if (A[gmpos] == '_') {
  1693. if (A[gmpos+1]!= '{') {
  1694. snprintf(STR2,256, "%c", A[gmpos+1]);
  1695. if (A[gmpos+2]=='_') snprintf(STR2,256, "%c%c", A[gmpos+1],A[gmpos+3]);
  1696. code = (sscanf(STR2, "%ld", &gmul) == 0);
  1697. }else{
  1698. gmul=gmpos+2;
  1699. while(A[gmul]!='}'){STR2[gmul-gmpos-2]=A[gmul]; gmul++ ; }
  1700. STR2[gmul-gmpos-1]='\0';
  1701. code = (sscanf(STR2, "%ld", &gmul) == 0);
  1702. }
  1703. } else
  1704. gmul = 1;
  1705. }
  1706. }
  1707. }
  1708. if ((int)strlen(A) >= 4 && !stripped) {
  1709. snprintf(subs,256, "%.4s", A);
  1710. if ((int)strlen(A) > 5) {
  1711. if (A[4] == '_') {
  1712. if (A[5]!= '{') {
  1713. snprintf(STR2,256, "%c", A[5]);
  1714. if (A[6]=='_') snprintf(STR2,256, "%c%c", A[5],A[7]);
  1715. code = (sscanf(STR2, "%ld", &mul) == 0);
  1716. }else{
  1717. mul=6;
  1718. while(A[mul]!='}'){STR2[mul-6]=A[mul]; mul++ ; }
  1719. STR2[mul-5]='\0';
  1720. code = (sscanf(STR2, "%ld", &mul) == 0);
  1721. }
  1722. } else
  1723. mul = 1;
  1724. }
  1725. mul *= gmul * ggmul;
  1726. if (!strcmp(subs, "DBAM"))
  1727. { /*dibutylaminomethylene; =R, used as the N prot.*/
  1728. if (debug)
  1729. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1730. Point->C += mul * 9;
  1731. Point->H += mul * 19;
  1732. Point->N += mul;
  1733. strcpy(A, strsub(STR2, A, 5, (int)(strlen(A) - 4)));
  1734. stripped = true;
  1735. }
  1736. if (!strcmp(subs, "DMAM"))
  1737. { /*dimethylaminomethylene; =R, used as the N prot.*/
  1738. if (debug)
  1739. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1740. Point->C += mul * 3;
  1741. Point->H += mul * 7;
  1742. Point->N += mul;
  1743. strcpy(A, strsub(STR2, A, 5, (int)(strlen(A) - 4)));
  1744. stripped = true;
  1745. }
  1746. if (!strcmp(subs, "DMTr")) { /*dimethoxytrityl*/
  1747. if (debug)
  1748. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1749. Point->C += mul * 21;
  1750. Point->H += mul * 19;
  1751. Point->O += mul * 2;
  1752. strcpy(A, strsub(STR2, A, 5, (int)(strlen(A) - 4)));
  1753. stripped = true;
  1754. }
  1755. if (!strcmp(subs, "MMTr")) { /*monomethoxytrityl*/
  1756. if (debug)
  1757. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1758. Point->C += mul * 20;
  1759. Point->H += mul * 16;
  1760. Point->O += mul;
  1761. strcpy(A, strsub(STR2, A, 5, (int)(strlen(A) - 4)));
  1762. stripped = true;
  1763. }
  1764. if (!strcmp(subs, "TMTr")) { /*trimethoxytrityl*/
  1765. if (debug)
  1766. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1767. Point->C += mul * 22;
  1768. Point->H += mul * 22;
  1769. Point->O += mul * 3;
  1770. strcpy(A, strsub(STR2, A, 5, (int)(strlen(A) - 4)));
  1771. stripped = true;
  1772. }
  1773. }
  1774. if ((int)strlen(A) >= 3 && !stripped) {
  1775. snprintf(subs,256, "%.3s", A);
  1776. if ((int)strlen(A) > 4) {
  1777. if (A[3] == '_') {
  1778. if (A[4]!= '{') {
  1779. snprintf(STR2,256, "%c", A[4]);
  1780. if (A[5]=='_') snprintf(STR2,256, "%c%c", A[4],A[6]);
  1781. code = (sscanf(STR2, "%ld", &mul) == 0);
  1782. }else{
  1783. mul=5;
  1784. while(A[mul]!='}'){STR2[mul-5]=A[mul]; mul++ ; }
  1785. STR2[mul-4]='\0';
  1786. code = (sscanf(STR2, "%ld", &mul) == 0);
  1787. }
  1788. } else
  1789. mul = 1;
  1790. }
  1791. mul *= gmul * ggmul;
  1792. if (!strcmp(subs, "Ade")) { /*Adeninyl*/
  1793. if (debug)
  1794. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1795. Point->C += mul * 5;
  1796. Point->H += mul * 4;
  1797. Point->N += mul * 5;
  1798. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1799. stripped = true;
  1800. }
  1801. if (!strcmp(subs, "BOC")) { /*Butyloxycarbonyl*/
  1802. if (debug)
  1803. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1804. Point->C += mul * 5;
  1805. Point->H += mul * 9;
  1806. Point->O += mul * 2;
  1807. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1808. stripped = true;
  1809. }
  1810. if (!strcmp(subs, "Cyt")) { /*Cytosinyl*/
  1811. if (debug)
  1812. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1813. Point->C += mul * 4;
  1814. Point->H += mul * 4;
  1815. Point->N += mul * 3;
  1816. Point->O += mul;
  1817. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1818. stripped = true;
  1819. }
  1820. if (!strcmp(subs, "Gua")) { /*Guaninyl*/
  1821. if (debug)
  1822. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1823. Point->C += mul * 5;
  1824. Point->H += mul * 4;
  1825. Point->N += mul * 5;
  1826. Point->O += mul;
  1827. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1828. stripped = true;
  1829. }
  1830. if (!strcmp(subs, "iBu")) { /*iso-Butyl*/
  1831. if (debug)
  1832. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1833. Point->C += mul * 4;
  1834. Point->H += mul * 9;
  1835. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1836. stripped = true;
  1837. }
  1838. if (!strcmp(subs, "iPr")) { /*2-Propyl*/
  1839. if (debug)
  1840. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1841. Point->C += mul * 3;
  1842. Point->H += mul * 7;
  1843. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1844. stripped = true;
  1845. }
  1846. if (!strcmp(subs, "MOC")) { /*Methoxycarbonyl*/
  1847. if (debug)
  1848. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1849. Point->C += mul * 2;
  1850. Point->H += mul * 3;
  1851. Point->O += mul * 2;
  1852. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1853. stripped = true;
  1854. }
  1855. if (!strcmp(subs, "MOM")) { /*Methoxymethyl*/
  1856. if (debug)
  1857. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1858. Point->C += mul * 2;
  1859. Point->H += mul * 5;
  1860. Point->O += mul;
  1861. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1862. stripped = true;
  1863. }
  1864. if (!strcmp(subs, "tBu")) { /*t-Butyl*/
  1865. if (debug)
  1866. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1867. Point->C += mul * 4;
  1868. Point->H += mul * 9;
  1869. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1870. stripped = true;
  1871. }
  1872. if (!strcmp(subs, "Thy")) { /*Thyminyl*/
  1873. if (debug)
  1874. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1875. Point->C += mul * 5;
  1876. Point->H += mul * 5;
  1877. Point->N += mul * 2;
  1878. Point->O += mul * 2;
  1879. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1880. stripped = true;
  1881. }
  1882. if (!strcmp(subs, "TMS")) { /*Trimethylsilyl*/
  1883. if (debug)
  1884. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1885. Point->C += mul * 3;
  1886. Point->H += mul * 9;
  1887. Point->Si += mul;
  1888. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1889. stripped = true;
  1890. }
  1891. if (!strcmp(subs, "Tol")) { /*tolyl*/
  1892. if (debug)
  1893. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1894. Point->C += mul * 8;
  1895. Point->H += mul * 7;
  1896. Point->O += mul;
  1897. strcpy(A, strsub(STR2, A, 4, (int)(strlen(A) - 3)));
  1898. stripped = true;
  1899. }
  1900. if (!strcmp(subs, "Ura")) { /*Uracilyl*/
  1901. if (debug)
  1902. printf(" %s*%ld (%ld,%ld)\n", subs, mul, gmul, ggmul);
  1903. Point->C += mul * 4;
  1904. Point->H += mul

Large files files are truncated, but you can click here to view the full file