source: Sophya/trunk/SophyaLib/SUtils/utils.h@ 3879

Last change on this file since 3879 was 895, checked in by ansari, 25 years ago

Documentation de fichiers - Reza 12/4/2000

File size: 1.4 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2//
3// $Id: utils.h,v 1.1 2000-04-12 17:49:54 ansari Exp $
4//
5
6#ifndef UTILS_EA
7#define UTILS_EA
8
9#include "machdefs.h"
10#include <string.h>
11#include <string>
12#include <stdlib.h>
13#include <stdio.h>
14
15
16// MemCpy marche meme en cas de recouvrement.
17// #define memcpy MemCpy
18
19void* MemCpy(void* dest, const void* source, size_t n);
20
21char const* PeidaWorkPath();
22void buildPath(char* dst, const char* dir, const char* file);
23void buildPath(string& dst, const string& dir, const string& file);
24void changeSuffix(char* file, const char* suffix);
25void changeSuffix(string& file, const string& suffix);
26string itos(int);
27string ftos(double);
28
29inline void GetIntEnv(char const* s, int& v)
30{
31 char* pdeb = getenv(s);
32 if (pdeb) v = atoi(pdeb);
33}
34
35/* if defined(__DECCXX) || defined(__xlC) */
36#if defined(__xlC) || defined(__DECCXX)
37#define STRUCTCOMP(s) \
38 bool operator==(s const& b) const \
39{ return memcmp(this, &b, sizeof(s)) == 0; } \
40 bool operator<(s const& b) const \
41{ return memcmp(this, &b, sizeof(s)) < 0; }
42
43#define STRUCTCOMPF(s,f) \
44 bool operator==(s const& b) const \
45{ return f == b.f; } \
46 bool operator<(s const& b) const \
47{ return f < b.f; }
48#else
49#define STRUCTCOMP(s)
50#define STRUCTCOMPF(s,f)
51#endif
52
53#endif // UTILS_EA
Note: See TracBrowser for help on using the repository browser.