Skip to content
Extraits de code Groupes Projets
Valider 8470aa2f rédigé par Etienne BRATEAU's avatar Etienne BRATEAU
Parcourir les fichiers

p2c: fix types for some functions and clean code, deprecate some functions

parent ca36e383
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -19,7 +19,21 @@ ...@@ -19,7 +19,21 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
# define log1p(X) log(1+(X)) /* Funcition for compiler warnings*/
#ifdef __GNUC__
#define DEPRECATED __attribute__((deprecated))
#else
/**
* Deprecated functions
*
* Use this macro in front of a function declaration to say the function is deprecated.
* The compiler may emit a warning every time the function is used
*/
#define DEPRECATED
#endif
#define log1p(X) log(1+(X))
typedef struct __p2c_jmp_buf { typedef struct __p2c_jmp_buf {
struct __p2c_jmp_buf *next; struct __p2c_jmp_buf *next;
...@@ -78,35 +92,37 @@ extern int _EscIO (int); ...@@ -78,35 +92,37 @@ extern int _EscIO (int);
extern int microsleep (long); extern int microsleep (long);
extern long ipow (long, long); extern long ipow (long, long);
extern char *strsub (char *, char *, int, int);
extern char *strsub (char *, char *, size_t, size_t);
extern char *strltrim (char *); extern char *strltrim (char *);
extern char *strrtrim (char *); extern char *strrtrim (char *);
extern char *strrpt (char *, char *, int); extern char *strrpt (char *, char *, size_t);
extern char *strpad (char *, char *, int, int); extern char *strpad (char *, char *, size_t, size_t);
extern int strpos2 (char *, char *, int); extern int strpos2 (char *, char *, size_t);
extern void strmove (int len, char * s, int spos, char * d, int dpos); extern void strmove (size_t len, char * s, size_t spos, char * d, size_t dpos);
extern int strcicmp (char * s1, char * s2); extern int strcicmp (char * s1, char * s2);
extern long memavail ();
extern int P_peek (FILE *); extern long memavail () DEPRECATED;
extern char P_peek (FILE *);
extern int P_eof (FILE *); extern int P_eof (FILE *);
extern int P_eoln (FILE *); extern int P_eoln (FILE *);
extern void P_readpaoc (FILE *, char *, int); extern void P_readpaoc (FILE *, char *, size_t);
extern void P_readlnpaoc (FILE *, char *, int); extern void P_readlnpaoc (FILE *, char *, size_t);
extern long P_maxpos (FILE *); extern long P_maxpos (FILE *);
extern char *P_trimname (char *, int); extern char *P_trimname (char *, size_t) DEPRECATED;
extern long *P_setunion (long *, long *, long *); extern long *P_setunion (long *, long *, long *) DEPRECATED;
extern long *P_setint (long *, long *, long *); extern long *P_setint (long *, long *, long *) DEPRECATED;
extern long *P_setdiff (long *, long *, long *); extern long *P_setdiff (long *, long *, long *) DEPRECATED;
extern long *P_setxor (long *, long *, long *); extern long *P_setxor (long *, long *, long *) DEPRECATED;
extern int P_inset (unsigned, long *); extern int P_inset (unsigned, long *) DEPRECATED;
extern int P_setequal (long *, long *); extern int P_setequal (long *, long *) DEPRECATED;
extern int P_subset (long *, long *); extern int P_subset (long *, long *) DEPRECATED;
extern long *P_addset (long *, unsigned); extern long *P_addset (long *, unsigned) DEPRECATED;
extern long *P_addsetr (long *, unsigned, unsigned); extern long *P_addsetr (long *, unsigned, unsigned) DEPRECATED;
extern long *P_remset (long *, unsigned); extern long *P_remset (long *, unsigned) DEPRECATED;
extern long *P_setcpy (long *, long *); extern long *P_setcpy (long *, long *) DEPRECATED;
extern long *P_expset (long *, long); extern long *P_expset (long *, long) DEPRECATED;
extern long P_packset (long *); extern long P_packset (long *) DEPRECATED;
extern int P_getcmdline (int l, int h, char *line); extern int P_getcmdline (int l, int h, char *line);
extern void TimeStamp (int *Day, int *Month, int *Year, extern void TimeStamp (int *Day, int *Month, int *Year,
int *Hour, int *Min, int *Sec); int *Hour, int *Min, int *Sec);
...@@ -208,24 +224,8 @@ typedef struct { ...@@ -208,24 +224,8 @@ typedef struct {
#define P_max(a,b) ((a) > (b) ? (a) : (b)) #define P_max(a,b) ((a) > (b) ? (a) : (b))
#define P_min(a,b) ((a) < (b) ? (a) : (b)) #define P_min(a,b) ((a) < (b) ? (a) : (b))
/* Funcition for compiler warnings*/
#ifdef __GNUC__
#define DEPRECATED __attribute__((deprecated))
#else
/**
* Deprecated functions
*
* Use this macro in front of a function declaration to say the function is deprecated.
* The compiler may emit a warning every time the function is used
*/
#define DEPRECATED
#endif
#endif /* P2C_H */ #endif /* P2C_H */
/* ifdefs for microsleep here */
#define BSDMICROSLEEP
#if !defined(L_cuserid) #if !defined(L_cuserid)
#define L_cuserid 32 #define L_cuserid 32
...@@ -233,5 +233,3 @@ extern char * cuserid(char *); ...@@ -233,5 +233,3 @@ extern char * cuserid(char *);
#endif #endif
/* End. */ /* End. */
Ce diff est replié.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter