File: execute_command1.c

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

/*=============================================================================

				execute_command1.c

Purpose:
	Parse and execute command.  Refresh the message  (reset or fill
	with a new content). This function is capable to execute garlic
	scripts.

Input:
	(1) Pointer to MolComplexS structure, with macromol. complexes.
	(2) Pointer to the number of macromolecular complexes.
	(3) Pointer to the next macromolecular complex identifier.
	(4) Pointer to RuntimeS structure, with some runtime data.
	(5) Pointer to ConfigS structure, with configuration data.
	(6) Pointer to GUIS structure, with GUI data.
	(7) Pointer to pointer to NearestAtomS structure.
	(8) Pointer to the number of pixels in the main win. free area.
	(9) Pointer to refreshI.

Output:
	(1) The latest command executed.
	(2) Return value.

Return value:
	(1) Positive on success (command code).
	(2) Zero, if command string is empty.
	(3) Negative on failure.

Notes:
	(1) The value of refreshI  (*refreshIP)  may be changed in this
	    function or in some function called by this function. It is
	    checked in  EventLoop_  (see event_loop.c).  It is  assumed
	    that  refreshI  is updated no more  than once in each event
	    handling function. If this is not the case, the care should
	    be taken to avoid refreshI overflow.

	(2) The command string is converted to uppercase. Do not forget
	    that  file names are  case sensitive.  Use the copy  of the
	    original command string to prepare the proper file name.

========includes:============================================================*/

#include <stdio.h>

#include <string.h>
#include <ctype.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>

#include "defines.h"
#include "commands.h"
#include "typedefs.h"

/*======function prototypes:=================================================*/

int		ExecuteScript_ (MolComplexS *, int *, int *,
				RuntimeS *, ConfigS *, GUIS *,
				NearestAtomS **, size_t *, unsigned int *);
char		*ExtractToken_ (char *, int, char *, char *);
int		Load_ (MolComplexS *, int *, int *,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS *, size_t, unsigned int *);
int		Discard_ (MolComplexS *, int *, int *,
			  RuntimeS *, ConfigS *, GUIS *,
			  NearestAtomS *, size_t, unsigned int *, char *);
int		Catch_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *, char *);
int		Select_ (MolComplexS *, int,
			 RuntimeS *, ConfigS *, GUIS *,
			 NearestAtomS *, size_t, unsigned int *,
			 char *, int);
int		Show_ (MolComplexS *, int,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS *, size_t, unsigned int *);
int		Hide_ (MolComplexS *, int,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS *, size_t, unsigned int *);
int		Color_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *, char *);
int		Atoms_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *, char *);
int		Bonds_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *, char *);
int		CommandRotate_ (MolComplexS *, int,
				RuntimeS *, ConfigS *, GUIS *,
				NearestAtomS *, size_t, unsigned int *,
				char *);
int		CommandTranslate_ (MolComplexS *, int,
				   RuntimeS *, ConfigS *, GUIS *,
				   NearestAtomS *, size_t, unsigned int *,
				   char *);
int		CommandSlab_ (MolComplexS *, int,
			      RuntimeS *, ConfigS *, GUIS *,
			      NearestAtomS *, size_t, unsigned int *,
			      char *);
int		CommandFading_ (MolComplexS *, int,
				RuntimeS *, ConfigS *, GUIS *,
				NearestAtomS *, size_t, unsigned int *,
				char *);
int		Log_ (ConfigS *, RuntimeS *);
int		Foreground_ (MolComplexS *, int,
			     RuntimeS *, ConfigS *, GUIS *,
			     NearestAtomS *, size_t, unsigned int *);
int		Background_ (MolComplexS *, int,
			     RuntimeS *, ConfigS *, GUIS *,
			     NearestAtomS *, size_t, unsigned int *);
int		TextBackground_ (MolComplexS *, int,
				 RuntimeS *, ConfigS *, GUIS *,
				 NearestAtomS *, size_t, unsigned int *);
int		TextForeground_ (MolComplexS *, int,
				 RuntimeS *, ConfigS *, GUIS *,
				 NearestAtomS *, size_t, unsigned int *);
int		Font_ (MolComplexS *, int,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS **, size_t *, unsigned int *);
int		CommandBackbone_ (MolComplexS *, int,
				  RuntimeS *, ConfigS *, GUIS *,
				  NearestAtomS *, size_t, unsigned int *,
				  char *);
int		HydrogenBonds_ (MolComplexS *, int,
				RuntimeS *, ConfigS *, GUIS *,
				NearestAtomS *, size_t, unsigned int *,
				char *);
int		CommandStereo_ (MolComplexS *, int,
				RuntimeS *, ConfigS *, GUIS *,
				NearestAtomS *, size_t, unsigned int *,
				char *);
int		CommandMono_ (MolComplexS *, int,
			      RuntimeS *, ConfigS *, GUIS *,
			      NearestAtomS *, size_t, unsigned int *);
int		CommandPosition_ (MolComplexS *, int,
				  RuntimeS *, ConfigS *, GUIS *,
				  NearestAtomS *, size_t, unsigned int *,
				  char *);
int		Title_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *);
int		Labels_ (MolComplexS *, int,
			 RuntimeS *, ConfigS *, GUIS *,
			 NearestAtomS *, size_t, unsigned int *,
			 char *);
int		Register_ (void);
int		Center_ (MolComplexS *, int,
			 RuntimeS *, ConfigS *, GUIS *,
			 NearestAtomS *, size_t, unsigned int *);
int		Save_ (MolComplexS *, int, RuntimeS *);
int		Tag_ (MolComplexS *, int,
		      RuntimeS *, ConfigS *, GUIS *,
		      NearestAtomS *, size_t, unsigned int *);
int		Sequence_ (MolComplexS *, int, RuntimeS *, char *);
int		Ramachandran_ (MolComplexS *, int,
			       RuntimeS *, ConfigS *, GUIS *,
			       NearestAtomS *, size_t, unsigned int *,
			       char *);
int		Wheel_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *,
			char *);
int		Angle_ (RuntimeS *, char *);
int		Radius_ (RuntimeS *, char *);
int		Venn_ (MolComplexS *, int,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS *, size_t, unsigned int *,
		       char *);
int		SSB_ (MolComplexS *, int,
		      RuntimeS *, ConfigS *, GUIS *,
		      NearestAtomS *, size_t, unsigned int *, char *);
int		Window_ (RuntimeS *);
int		Plot_ (MolComplexS *, int,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS *, size_t, unsigned int *,
		       char *);
int		CommandMove_ (MolComplexS *, int, RuntimeS *, char *);
int		Plane_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *,
			char *);
int		Scale_ (MolComplexS *, int, RuntimeS *, char *);
int		Pattern_ (MolComplexS *, int, RuntimeS *, char *);
int		Dock_ (MolComplexS *, int,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS *, size_t, unsigned int *,
		       char *);
int		Compare_ (MolComplexS *, int,
			  RuntimeS *, ConfigS *, GUIS *,
			  NearestAtomS *, size_t, unsigned int *,
			  char *);
int		Neighborhood_ (MolComplexS *, int,
			       RuntimeS *, ConfigS *, GUIS *,
			       NearestAtomS *, size_t, unsigned int *,
			       char *);
int		Structure_ (MolComplexS *, int, RuntimeS *, char *);
int		Create_ (MolComplexS *, int *, int *,
			 RuntimeS *, ConfigS *, GUIS *,
			 NearestAtomS *, size_t, unsigned int *);
int		Replace_ (MolComplexS *, int, int,
			  RuntimeS *, ConfigS *, GUIS *,
			  NearestAtomS *, size_t, unsigned int *);
int		Edit_ (MolComplexS *, int,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS *, size_t, unsigned int *,
		       char *);
int		Membrane_ (MolComplexS *, int,
			   RuntimeS *, ConfigS *, GUIS *,
			   NearestAtomS *, size_t, unsigned int *,
			   char *);
int		Set_ (MolComplexS *, int,
		      RuntimeS *, ConfigS *, GUIS *,
		      NearestAtomS *, size_t, unsigned int *,
		      char *);
int		Probe_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *,
			char *);
int		CommandRefresh_ (MolComplexS *, int,
				 RuntimeS *, ConfigS *, GUIS *,
				 NearestAtomS *, size_t, unsigned int *,
				 char *);
int		Sticks_ (MolComplexS *, int,
			 RuntimeS *, ConfigS *, GUIS *,
			 NearestAtomS *, size_t, unsigned int *,
			 char *);
int		Balls_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *,
			char *);
int		Blur_ (MolComplexS *, int,
		       RuntimeS *, ConfigS *, GUIS *,
		       NearestAtomS *, size_t, unsigned int *,
		       char *);
int		Group_ (MolComplexS *, int,
			RuntimeS *, ConfigS *, GUIS *,
			NearestAtomS *, size_t, unsigned int *, char *);
int		Dump_ (MolComplexS *, int, RuntimeS *, char *);

/*======execute command (1):=================================================*/

int ExecuteCommand1_ (MolComplexS *mol_complexSP, int *mol_complexesNP,
		      int *next_mol_complexIDP,
		      RuntimeS *runtimeSP,
		      ConfigS *configSP, GUIS *guiSP,
		      NearestAtomS **nearest_atomSPP, size_t *pixelsNP,
		      unsigned int *refreshIP)
{
char		commandA[STRINGSIZE];
int		command_length;
int		i;
char		*remainderP;
char		tokenA[STRINGSIZE];

/* If the previous command was PAUSE, take a special care: */
if (runtimeSP->pauseF == 1)
	{

	/* Script mode: */
	if (runtimeSP->scriptF)
		{
		return ExecuteScript_ (mol_complexSP, mol_complexesNP,
				       next_mol_complexIDP,
				       runtimeSP, configSP, guiSP,
				       nearest_atomSPP, pixelsNP, refreshIP);
		}
	/* Interactive mode: */
	else
		{
		runtimeSP->pauseF = 0;
		runtimeSP->messageA[0] = '\0';
		runtimeSP->message_length = 0;
		return COMMAND_CONTINUE;
		}
	}

/* Copy both command length and command string: */
command_length = runtimeSP->command_length;
strncpy (commandA, runtimeSP->curr_commandA, runtimeSP->command_length);
commandA[command_length] = '\0';

/* Convert the command string to uppercase: */
for (i = 0; i < command_length; i++) commandA[i] = toupper (commandA[i]);

/* Truncate the message and reset the message length: */
runtimeSP->messageA[0] = '\0';
runtimeSP->message_length = 0;

/* Take the first token - it should be the command word: */
remainderP = ExtractToken_ (tokenA, STRINGSIZE, commandA, " \t\n");

/* If there is nothing, return zero - the command string is empty: */
if (remainderP == NULL) return 0; 

/* Parse and execute the command: */

/*------quit, exit:----------------------------------------------------------*/

if ((strstr (tokenA, "QUI") == tokenA) || (strstr (tokenA, "EXI") == tokenA))
	{
	return COMMAND_QUIT;
	}

/*------pause:---------------------------------------------------------------*/

else if (strstr (tokenA, "PAU") == tokenA)
	{
	runtimeSP->pauseF = 1;
	strcpy (runtimeSP->messageA, "Press enter to continue!");
	runtimeSP->message_length = strlen (runtimeSP->messageA);
	return COMMAND_PAUSE;
	}

/*------ignore:--------------------------------------------------------------*/

/* This command does nothing - it is added for debugging purpose! */
else if (strstr (tokenA, "IGN") == tokenA)
	{
	return COMMAND_IGNORE;
	}

/*------select:--------------------------------------------------------------*/

/* Overwrite the previous selection: */
else if (strstr (tokenA, "SEL") == tokenA)
	{
	return Select_ (mol_complexSP, *mol_complexesNP,
			runtimeSP, configSP, guiSP,
			*nearest_atomSPP, *pixelsNP, refreshIP,
			remainderP, 0);
	}

/*------restrict:------------------------------------------------------------*/

/* Restrict the previous selection: */
else if (strstr (tokenA, "RES") == tokenA)
	{
	return Select_ (mol_complexSP, *mol_complexesNP,
			runtimeSP, configSP, guiSP,
			*nearest_atomSPP, *pixelsNP, refreshIP,
			remainderP, 1);
	}

/*------add:-----------------------------------------------------------------*/

/* Expand (add to) the previous selection: */
else if ((strstr (tokenA, "ADD") == tokenA) ||
	 (strstr (tokenA, "EXP") == tokenA))
	{
	return Select_ (mol_complexSP, *mol_complexesNP,
			runtimeSP, configSP, guiSP,
			*nearest_atomSPP, *pixelsNP, refreshIP,
			remainderP, 2);
	}

/*------load, read:----------------------------------------------------------*/

else if ((strstr (tokenA, "LOA") == tokenA) ||
	 (strstr (tokenA, "REA") == tokenA))
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return Load_ (mol_complexSP, mol_complexesNP, next_mol_complexIDP,
		      runtimeSP, configSP, guiSP,
		      *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------discard:-------------------------------------------------------------*/

else if (strstr (tokenA, "DIS") == tokenA)
	{
	return Discard_ (mol_complexSP, mol_complexesNP, next_mol_complexIDP,
			 runtimeSP, configSP, guiSP,
			 *nearest_atomSPP, *pixelsNP, refreshIP, remainderP);
	}

/*------catch, take:---------------------------------------------------------*/

else if ((strstr (tokenA, "CAT") == tokenA) ||
	 (strstr (tokenA, "TAK") == tokenA))
	{
	return Catch_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
	}

/*------show:----------------------------------------------------------------*/

else if (strstr (tokenA, "SHO") == tokenA)
	{
	return Show_ (mol_complexSP, *mol_complexesNP,
		      runtimeSP, configSP, guiSP,
		      *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------hide:----------------------------------------------------------------*/

else if (strstr (tokenA, "HID") == tokenA)
	{
	return Hide_ (mol_complexSP, *mol_complexesNP,
		      runtimeSP, configSP, guiSP,
		      *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------color:---------------------------------------------------------------*/

else if (strstr (tokenA, "COL") == tokenA)
	{
	return Color_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
	}

/*------atoms:---------------------------------------------------------------*/

else if (strstr (tokenA, "ATO") == tokenA)
	{
	return Atoms_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
	}

/*------bonds:---------------------------------------------------------------*/

else if (strstr (tokenA, "BON") == tokenA)
	{
	return Bonds_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
	}

/*------rotate:--------------------------------------------------------------*/

else if (strstr (tokenA, "ROT") == tokenA)
	{
	return CommandRotate_ (mol_complexSP, *mol_complexesNP,
			       runtimeSP, configSP, guiSP,
			       *nearest_atomSPP, *pixelsNP, refreshIP,
			       remainderP);
	}

/*------translate:-----------------------------------------------------------*/

else if (strstr (tokenA, "TRA") == tokenA)
	{
	return CommandTranslate_ (mol_complexSP, *mol_complexesNP,
				  runtimeSP, configSP, guiSP,
				  *nearest_atomSPP, *pixelsNP, refreshIP,
				  remainderP);
	}

/*------slab:----------------------------------------------------------------*/

else if (strstr (tokenA, "SLA") == tokenA)
	{
	return CommandSlab_ (mol_complexSP, *mol_complexesNP,
			     runtimeSP, configSP, guiSP,
			     *nearest_atomSPP, *pixelsNP, refreshIP,
			     remainderP);
	}

/*------fading:--------------------------------------------------------------*/

else if (strstr (tokenA, "FAD") == tokenA)
	{
	return CommandFading_ (mol_complexSP, *mol_complexesNP,
			       runtimeSP, configSP, guiSP,
			       *nearest_atomSPP, *pixelsNP, refreshIP,
			       remainderP);
	}

/*------log:-----------------------------------------------------------------*/

else if (strstr (tokenA, "LOG") == tokenA)
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return Log_ (configSP, runtimeSP);
	}

/*------fg:------------------------------------------------------------------*/

else if ((strcmp (tokenA, "FG") == 0) || (strstr (tokenA, "FOREG") == tokenA))
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return Foreground_ (mol_complexSP, *mol_complexesNP,
			    runtimeSP, configSP, guiSP,
			    *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------bg:------------------------------------------------------------------*/

else if ((strcmp (tokenA, "BG") == 0) || (strstr (tokenA, "BACKG") == tokenA))
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return Background_ (mol_complexSP, *mol_complexesNP,
			    runtimeSP, configSP, guiSP,
			    *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------tbg:-----------------------------------------------------------------*/

else if (strcmp (tokenA, "TBG") == 0)
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return TextBackground_ (mol_complexSP, *mol_complexesNP,
				runtimeSP, configSP, guiSP,
				*nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------tfg:-----------------------------------------------------------------*/

else if (strcmp (tokenA, "TFG") == 0)
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return TextForeground_ (mol_complexSP, *mol_complexesNP,
				runtimeSP, configSP, guiSP,
				*nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------font:----------------------------------------------------------------*/

else if (strstr (tokenA, "FON") == tokenA)
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return Font_ (mol_complexSP, *mol_complexesNP,
		      runtimeSP, configSP, guiSP,
		      nearest_atomSPP, pixelsNP, refreshIP);
	}

/*------backbone:------------------------------------------------------------*/

else if (strstr (tokenA, "BAC") == tokenA)
        {
	return CommandBackbone_ (mol_complexSP, *mol_complexesNP,
				 runtimeSP, configSP, guiSP,
				 *nearest_atomSPP, *pixelsNP, refreshIP,
				 remainderP);
	}

/*------hybonds:-------------------------------------------------------------*/

else if (strstr (tokenA, "HYB") == tokenA)
	{
	return HydrogenBonds_ (mol_complexSP, *mol_complexesNP,
			       runtimeSP, configSP, guiSP,
			       *nearest_atomSPP, *pixelsNP, refreshIP,
			       remainderP);
	}

/*------stereo:--------------------------------------------------------------*/

else if (strstr (tokenA, "STE") == tokenA)
	{
	return CommandStereo_ (mol_complexSP, *mol_complexesNP,
			       runtimeSP, configSP, guiSP,
			       *nearest_atomSPP, *pixelsNP, refreshIP,
			       remainderP);
	}

/*------mono:----------------------------------------------------------------*/

else if (strstr (tokenA, "MON") == tokenA)
	{
	return CommandMono_ (mol_complexSP, *mol_complexesNP,
			     runtimeSP, configSP, guiSP,
			     *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------position:------------------------------------------------------------*/

else if (strstr (tokenA, "POS") == tokenA)
	{
	return CommandPosition_ (mol_complexSP, *mol_complexesNP,
				 runtimeSP, configSP, guiSP,
				 *nearest_atomSPP, *pixelsNP, refreshIP,
				 remainderP);
	}

/*------title:---------------------------------------------------------------*/

else if (strstr (tokenA, "TIT") == tokenA)
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return Title_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------labels:--------------------------------------------------------------*/

else if (strstr (tokenA, "LAB") == tokenA)
	{
	return Labels_ (mol_complexSP, *mol_complexesNP,
			runtimeSP, configSP, guiSP,
			*nearest_atomSPP, *pixelsNP, refreshIP,
			remainderP);
	}

/*------register:------------------------------------------------------------*/

else if (strstr (tokenA, "REG") == tokenA)
	{
	strcpy (runtimeSP->messageA,
		"A short e-mail message was send to the author.");
	runtimeSP->message_length = strlen (runtimeSP->messageA);
	Register_ ();
	return COMMAND_REGISTER;
	}

/*------center:--------------------------------------------------------------*/

else if (strstr (tokenA, "CEN") == tokenA)
	{
	return Center_ (mol_complexSP, *mol_complexesNP,
			runtimeSP, configSP, guiSP,
			*nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------save:----------------------------------------------------------------*/

else if (strstr (tokenA, "SAV") == tokenA)
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return Save_ (mol_complexSP, *mol_complexesNP, runtimeSP);
	}

/*------tag:-----------------------------------------------------------------*/

else if (strstr (tokenA, "TAG") == tokenA)
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return Tag_ (mol_complexSP, *mol_complexesNP,
		     runtimeSP, configSP, guiSP,
		     *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------sequence:------------------------------------------------------------*/

else if (strstr (tokenA, "SEQ") == tokenA)
	{
	return Sequence_ (mol_complexSP, *mol_complexesNP,
			  runtimeSP, remainderP);
	}

/*------ramachandran:--------------------------------------------------------*/

else if (strstr (tokenA, "RAM") == tokenA)
	{
	return Ramachandran_ (mol_complexSP, *mol_complexesNP,
			      runtimeSP, configSP, guiSP,
			      *nearest_atomSPP, *pixelsNP, refreshIP,
			      remainderP);
	}

/*------wheel:---------------------------------------------------------------*/

else if (strstr (tokenA, "WHE") == tokenA)
	{
	return Wheel_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
	}

/*------angle:---------------------------------------------------------------*/

else if (strstr (tokenA, "ANG") == tokenA)
	{
	return Angle_ (runtimeSP, remainderP);
	}

/*------radius:--------------------------------------------------------------*/

else if (strstr (tokenA, "RAD") == tokenA)
	{
	return Radius_ (runtimeSP, remainderP);
	}

/*------venn:----------------------------------------------------------------*/

else if (strstr (tokenA, "VEN") == tokenA)
	{
	return Venn_ (mol_complexSP, *mol_complexesNP,
		      runtimeSP, configSP, guiSP,
		      *nearest_atomSPP, *pixelsNP, refreshIP,
		      remainderP);
	}

/*------ssb:-----------------------------------------------------------------*/

else if (strstr (tokenA, "SSB") == tokenA)
	{
	return SSB_ (mol_complexSP, *mol_complexesNP,
		     runtimeSP, configSP, guiSP,
		     *nearest_atomSPP, *pixelsNP, refreshIP,
		     remainderP);
	}

/*------window:--------------------------------------------------------------*/

else if (strstr (tokenA, "WIN") == tokenA)
	{
	return Window_ (runtimeSP);
	}

/*------plot:----------------------------------------------------------------*/

else if (strstr (tokenA, "PLO") == tokenA)
	{
	return Plot_ (mol_complexSP, *mol_complexesNP,
		      runtimeSP, configSP, guiSP,
		      *nearest_atomSPP, *pixelsNP, refreshIP,
		      remainderP);
	}

/*------move:----------------------------------------------------------------*/

else if (strstr (tokenA, "MOV") == tokenA)
	{
	return CommandMove_ (mol_complexSP, *mol_complexesNP,
			     runtimeSP, remainderP);
	}

/*------plane:---------------------------------------------------------------*/

else if (strstr (tokenA, "PLA") == tokenA)
	{
	return Plane_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
	}

/*------scale:---------------------------------------------------------------*/

else if (strstr (tokenA, "SCA") == tokenA)
	{
	return Scale_ (mol_complexSP, *mol_complexesNP, runtimeSP, remainderP);
	}

/*------pattern:-------------------------------------------------------------*/

else if (strstr (tokenA, "PAT") == tokenA)
        {
        return Pattern_ (mol_complexSP, *mol_complexesNP,
			 runtimeSP, remainderP);
        }

/*------dock:----------------------------------------------------------------*/

else if (strstr (tokenA, "DOC") == tokenA)
	{
	return Dock_ (mol_complexSP, *mol_complexesNP,
		      runtimeSP, configSP, guiSP,
		      *nearest_atomSPP, *pixelsNP, refreshIP,
		      remainderP);
	}

/*------compare:-------------------------------------------------------------*/

else if (strstr (tokenA, "COM") == tokenA)
	{
	return Compare_ (mol_complexSP, *mol_complexesNP,
			 runtimeSP, configSP, guiSP,
			 *nearest_atomSPP, *pixelsNP, refreshIP,
			 remainderP);
	}

/*------neighborhood:--------------------------------------------------------*/

else if (strstr (tokenA, "NEI") == tokenA)
	{
	return Neighborhood_ (mol_complexSP, *mol_complexesNP,
			      runtimeSP, configSP, guiSP,
			      *nearest_atomSPP, *pixelsNP, refreshIP,
			      remainderP);
	}

/*------structure:-----------------------------------------------------------*/

else if (strstr (tokenA, "STR") == tokenA)
	{
	return Structure_ (mol_complexSP, *mol_complexesNP,
			   runtimeSP, remainderP);
	}

/*------create:--------------------------------------------------------------*/

else if (strstr (tokenA, "CRE") == tokenA)
	{
	return Create_ (mol_complexSP, mol_complexesNP, next_mol_complexIDP,
			runtimeSP, configSP, guiSP,
			*nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------replace:-------------------------------------------------------------*/

else if (strstr (tokenA, "REP") == tokenA)
	{
	return Replace_ (mol_complexSP, *mol_complexesNP, *next_mol_complexIDP,
			 runtimeSP, configSP, guiSP,
			 *nearest_atomSPP, *pixelsNP, refreshIP);
	}

/*------edit:----------------------------------------------------------------*/

else if (strstr (tokenA, "EDI") == tokenA)
	{
	return Edit_ (mol_complexSP, *mol_complexesNP,
		      runtimeSP, configSP, guiSP,
		      *nearest_atomSPP, *pixelsNP, refreshIP,
		      remainderP);
	}

/*------membrane:------------------------------------------------------------*/

else if (strstr (tokenA, "MEM") == tokenA)
	{
	return Membrane_ (mol_complexSP, *mol_complexesNP,
			  runtimeSP, configSP, guiSP,
			  *nearest_atomSPP, *pixelsNP, refreshIP,
			  remainderP);
	}

/*------set:-----------------------------------------------------------------*/

else if (strstr (tokenA, "SET") == tokenA)
	{
	return Set_ (mol_complexSP, *mol_complexesNP,
		     runtimeSP, configSP, guiSP,
		     *nearest_atomSPP, *pixelsNP, refreshIP,
		     remainderP);
	}

/*------probe:---------------------------------------------------------------*/

else if (strstr (tokenA, "PRO") == tokenA)
	{
	return Probe_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
	}

/*------refresh:-------------------------------------------------------------*/

else if (strstr (tokenA, "REF") == tokenA)
	{
	return CommandRefresh_ (mol_complexSP, *mol_complexesNP,
				runtimeSP, configSP, guiSP,
				*nearest_atomSPP, *pixelsNP, refreshIP,
				remainderP);
	}

/*------sticks:--------------------------------------------------------------*/

else if (strstr (tokenA, "STI") == tokenA)
	{
	return Sticks_ (mol_complexSP, *mol_complexesNP,
			runtimeSP, configSP, guiSP,
			*nearest_atomSPP, *pixelsNP, refreshIP,
			remainderP);
	}

/*------balls:---------------------------------------------------------------*/

else if (strstr (tokenA, "BAL") == tokenA)
        {
        return Balls_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
        }

/*------blur:----------------------------------------------------------------*/

else if (strstr (tokenA, "BLU") == tokenA)
	{
	return Blur_ (mol_complexSP, *mol_complexesNP,
		      runtimeSP, configSP, guiSP,
		      *nearest_atomSPP, *pixelsNP, refreshIP,
		      remainderP);
	}

/*------group:---------------------------------------------------------------*/

else if (strstr (tokenA, "GRO") == tokenA)
	{
	return Group_ (mol_complexSP, *mol_complexesNP,
		       runtimeSP, configSP, guiSP,
		       *nearest_atomSPP, *pixelsNP, refreshIP,
		       remainderP);
	}

/*------dump:----------------------------------------------------------------*/

else if (strstr (tokenA, "DUM") == tokenA)
	{
	return Dump_ (mol_complexSP, *mol_complexesNP, runtimeSP, remainderP);
	}

/*------execute:-------------------------------------------------------------*/

else if (strstr (tokenA, "EXE") == tokenA)
	{
	/* The original  command string  should be used */
	/* because the copy was converted to uppercase: */
	return ExecuteScript_ (mol_complexSP, mol_complexesNP,
			       next_mol_complexIDP,
			       runtimeSP, configSP, guiSP,
			       nearest_atomSPP, pixelsNP, refreshIP);
	}

/*------end of command recognition section.----------------------------------*/

/* If this point is reached, the command was not recognized! */

/* Prepare error message: */
strcpy (runtimeSP->messageA, "Command not recognized!");
runtimeSP->message_length = strlen (runtimeSP->messageA);

/* Return the error code: */
return ERROR_UNREC_COMM;
}

/*===========================================================================*/