source: Sophya/trunk/SophyaLib/NTools/utils.h@ 220

Last change on this file since 220 was 220, checked in by ansari, 26 years ago

Creation module DPC/NTools Reza 09/04/99

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