OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
progbar_c.c
Go to the documentation of this file.
1//Copyright> OpenRadioss
2//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3//Copyright>
4//Copyright> This program is free software: you can redistribute it and/or modify
5//Copyright> it under the terms of the GNU Affero General Public License as published by
6//Copyright> the Free Software Foundation, either version 3 of the License, or
7//Copyright> (at your option) any later version.
8//Copyright>
9//Copyright> This program is distributed in the hope that it will be useful,
10//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//Copyright> GNU Affero General Public License for more details.
13//Copyright>
14//Copyright> You should have received a copy of the GNU Affero General Public License
15//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16//Copyright>
17//Copyright>
18//Copyright> Commercial Alternative: Altair Radioss Software
19//Copyright>
20//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21//Copyright> software under a commercial license. Contact Altair to discuss further if the
22//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23#include "hardware.inc"
24#include "c_header.inc"
25
26/*Cvf50c1 Nouvelle routine*/
27/*Routine pour ecrire une barre de progression sur la sortie standard */
28#include <stdio.h>
29
30void progbar_c(int *icur, int *imax)
31{
32 int i, j ;
33 char line[62], format[40], outline[80] ;
34 double percent ;
35
36 percent=(double)(*icur) / *imax * 100 ;
37 j=*icur * 60 / *imax ;
38 line[0]=' ' ;
39 line[1]='*' ;
40 for (i=0;i<j;i++) {line[i+2]='=';}
41 line[i+2]='\0' ;
42
43 sprintf(format, "%%-%ds %%5.1f%%%%", 62 );
44 sprintf(outline,format,line,percent) ;
45 fprintf(stdout,"\r%s",outline) ;
46 if (*icur == *imax) {fprintf(stdout,"\n") ;}
47 fflush(stdout) ;
48}
49
50void _FCALL PROGBAR_C(int *icur, int *imax)
51{
52 progbar_c(icur, imax) ;
53}
54void progbar_c_(int *icur, int *imax)
55{
56 progbar_c(icur, imax) ;
57}
58void progbar_c__(int *icur, int *imax)
59{
60 progbar_c(icur, imax) ;
61}
62
#define _FCALL
void progbar_c(int *icur, int *imax)
Definition progbar_c.c:30
void progbar_c__(int *icur, int *imax)
Definition progbar_c.c:58
void progbar_c_(int *icur, int *imax)
Definition progbar_c.c:54
void _FCALL PROGBAR_C(int *icur, int *imax)
Definition progbar_c.c:50