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
|
/* Copyright (C) 2000 Damir Zucic */
/*=============================================================================
angle.c
Purpose:
Execute angle command: define the angle separating neighboring
residues along the axis of an alpha helix. The input angle should
be specified in degrees. Default hard-coded value is 100 degrees
(see init_runtime.c).
Input:
(1) Pointer to RuntimeS structure.
(2) Pointer to the remainder of the command string.
Output:
(1) The helix step angle value changed.
(2) Return value.
Return value:
(1) Positive (command) code on success.
(2) Negative (error) code on failure.
========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"
/*======execute angle command:===============================================*/
int Angle_ (RuntimeS *runtimeSP, char *stringP)
{
char *P;
int n;
double value;
/* Replace each non-numeric character (except */
/* minus sign and decimal point) with space: */
P = stringP;
while ((n = *P++) != '\0')
{
if (!isdigit (n) && (n != '-') && (n != '.')) *(P - 1) = ' ';
}
/* Try to extract the angle: */
if (sscanf (stringP, "%lf", &value) != 1) return ERROR_ANGLE;
/* On success, copy the extracted angle to RuntimeS structure: */
runtimeSP->helix_step_angle = value;
/* Return the command code: */
return COMMAND_ANGLE;
}
/*===========================================================================*/
|