2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Write the functionlist to a FD file for identify.library.
10 static void write_fd_func(FILE *out
, struct functionhead
*funclistit
, unsigned int lvo
)
12 struct functionarg
*arglistit
;
15 if (funclistit
->lvo
> lvo
+ 1)
17 if (funclistit
->lvo
== lvo
+ 2)
18 fprintf(out
, "private()()\n");
20 fprintf(out
, "##bias %u\n", funclistit
->lvo
* 6);
23 fprintf(out
, "%s(", funclistit
->name
);
25 for (arglistit
= funclistit
->arguments
;
27 arglistit
= arglistit
->next
)
29 /* Print a , separator when not the first function argument */
30 if (arglistit
!= funclistit
->arguments
)
33 /* Print only variable name */
34 variable
= arglistit
->arg
+ strlen(arglistit
->arg
) - 1;
35 while ((variable
>= arglistit
->arg
) &&
36 (isalnum(*variable
) || (*variable
== '_')))
40 fprintf(out
, "%s", variable
+ 1);
45 void writefd(struct config
*cfg
)
49 struct functionhead
*funclistit
= cfg
->funclist
;
50 struct functionarg
*arglistit
;
54 if (cfg
->modtype
== DEVICE
)
56 /* Skip BeginIO/EndIO */
59 for (i
= 0; i
< 2; i
++)
64 funclistit
= funclistit
->next
;
68 snprintf(line
, 255, "%s/%s_lib.fd", cfg
->gendir
, cfg
->modulename
);
70 out
= fopen(line
, "w");
79 fprintf(out
, "##base _%s\n", cfg
->libbase
);
82 * This is correct even for devices. cfg->firstlvo holds LVO number for
83 * the first user function.
85 fprintf(out
, "##bias %u\n", cfg
->firstlvo
* 6);
88 "* Automatically generated from '%s'.\n"
89 "* Edits will be lost. This file is supposed to be a support file for identify.library.\n"
94 fprintf(out
, "##public\n");
96 for (lvo
= cfg
->firstlvo
- 1;
98 funclistit
= funclistit
->next
101 switch (funclistit
->libcall
)
104 write_fd_func(out
, funclistit
, lvo
);
106 for (arglistit
= funclistit
->arguments
;
108 arglistit
= arglistit
->next
111 /* Print a , separator when not the first function argument */
112 if (arglistit
!= funclistit
->arguments
)
115 /* Print register name in lower case */
116 for (lower
= arglistit
->reg
; *lower
!= '\0'; lower
++)
118 fputc(tolower(*lower
), out
);
123 lvo
= funclistit
->lvo
;
127 write_fd_func(out
, funclistit
, lvo
);
128 fprintf(out
, "sysv");
129 if (cfg
->options
& OPTION_DUPBASE
)
130 fprintf(out
, ",rbase");
133 lvo
= funclistit
->lvo
;
138 fprintf(out
, "##end\n");