HP VXI 75000 C Series User's And Scpi Programming Manual page 373

Algorithmic closed loop controller
Table of Contents

Advertisement

}
}
}
#endif
/* Print usage information */
void usage(char *prog_name)
{
(void) fprintf(stderr, "usage: %s algorithm_file...\n", prog_name);
}
/* Get an algorithm from a filename */
static char *get_algorithm(char *file_name)
{
FILE
int32
int
char
f = fopen(file_name, "r");
if (! f) {
(void) fprintf(stderr, "Error: can't open algorithm file '%s'\n",
exit(1);
}
a_size = 0;
while (getc(f) != EOF) {
a_size++;
}
rewind(f);
algorithm = malloc(a_size + 1);
a_size = 0;
while ((c = getc(f)) != EOF) {
algorithm[a_size] = c;
a_size++;
}
algorithm[a_size] = 0;
(void) fclose(f);
return algorithm;
}
/*F******************************************************************
* NAME: static float64 two_to_the_N()
*
* TASK: Calculates 2^n
*/
static float64
{
/* compute 2^n */
float64 r = 1;
int32
i;
for ( i = 0; i < n; i++ )
Appendix F
*f;
/* Algorithm file pointer */
a_size;
/* Algorithm size */
c;
/* Character read from input */
*algorithm;
/* Points to algorithm string */
file_name);
/* Count length of algorithm */
/* Use as array index */
/* Read the algorithm */
/* Null terminate */
/* Return algorithm string */
two_to_the_N( int32 n )
r *= 2;
/* Storage for algorithm */
Generating User Defined Functions
373

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vxi e1415a

Table of Contents