source: CIVL/include/impls/fortran_sigp.cvl@ 1aaefd4

main test-branch
Last change on this file since 1aaefd4 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/* This CVL file contains the function prototypes for
2 * Fortran standard generic intrinsic procedures (SGIPs).
3 */
4
5#ifndef __FORTRAN_SGIP_C__
6#define __FORTRAN_SGIP_C__
7
8#include <fortran_sgip.cvh>
9
10int __fortran__command_argument_count(
11){
12 return F_ARGC;
13}
14
15void __fortran__get_command_argument(
16 int *number, /* the nth argument, 0 for program entry name*/
17 char *value, /* the variable pointing to the nth argument */
18 /* if no such argument exists, blanks are assigend*/
19 int *length, /* the length of the value assigned to 'value' */
20 int *status, /* -1, if 'value' has insufficient length for assigned actual arg */
21 /* 0, if 'value' is correctly assigned */
22 /* >0, if the actual argument is invalid */
23 char *errmsg /* Processor-dependent error messages if 'status' is positive */
24){
25 int stat = 0;
26 int n = 0;
27
28 if (*number > F_ARGC || *number < 0) { /* Invalid number */
29 stat = ERRSTAT_NUMBER_OUT_OF_RANGE;
30 } else if (*number > 0) { /* Try to get nth command arg */
31 n = *number - 1;
32 if (value != NULL) {
33 if (sizeof(value)/sizeof(char) < F_ARGL[n]) {
34 stat = ERRSTAT_ARGUMENT_OUT_OF_RANGE; /* Insufficient memory for arg */
35 } else {
36 value = F_ARGV[n];
37 }
38 }
39 if (length != NULL) {
40 length = F_ARGL[n];
41 }
42 } else { /* Try to get program entry name */
43 n = *number - 1;
44 if (value != NULL) {
45 if (sizeof(value)/sizeof(char) < F_ARGL[n]) {
46 stat = ERRSTAT_ARGUMENT_OUT_OF_RANGE; /* Insufficient memory for arg */
47 } else {
48 value = F_PENV;
49 }
50 }
51 if (length != NULL) {
52 length = F_PENL;
53 }
54 }
55 if (status != NULL) {
56 *status = stat;
57 }
58 if (errmsg != NULL) {
59 // TODO: set errmsg
60 }
61}
62
63#endif
Note: See TracBrowser for help on using the repository browser.