source: branches/profile/AISC/aisc_inline.h

Last change on this file was 7415, checked in by westram, 13 years ago

merged from dev [7395] [7396] [7397] [7398] [7399] [7400] [7401] [7402] [7403] [7404] [7405]

  • server/client interface
    • changed invalid casts (now casts are done between classes derived from dll<XXX>)
    • re-activated 'unused' warnings (deactivated since [566])
    • removed unused functions/variables
    • removed 'extern "C"'-voodoo
    • when creating two objects containing a DESTROY callback (like PT_local), AISC servers now warn and automatically destroy the 1st created object (which leaked) and then create the 2nd
  • fixed multiple creation of PT_local from PT_FamilyFinder
  • print ioerror when saving nameserver db fails
  • AISC interpreter
    • fixed array overflow in command table
    • detect "endless" recursive evaluation
    • fixed RUIs occurred while scanning backwards
    • fixed leak
    • GOSUB/CALL (change function argument parsing and evaluation)
File size: 1.8 KB
Line 
1//   Coded by Ralf Westram (coder@reallysoft.de)                 //
2//   Institute of Microbiology (Technical University Munich)     //
3//   http://www.arb-home.de/                                     //
4
5#ifndef AISC_INLINE_H
6#define AISC_INLINE_H
7
8#ifndef _STRING_H
9#include <string.h>
10#endif
11#ifndef _STDLIB_H
12#include <stdlib.h>
13#endif
14
15#define EOSTR    0
16#define BEG_STR1 '('
17#define BEG_STR2 '~'
18#define END_STR1 '~'
19#define END_STR2 ')'
20
21inline bool is_SPACE(char c) { return c == ' ' || c == '\t'; }
22inline bool is_SEP(char c)   { return c == ',' || c == ';'; }
23inline bool is_LF(char c)    { return c == '\n'; }
24inline bool is_EOS(char c)   { return c == EOSTR; }
25
26inline bool is_SPACE_LF(char c)         { return is_SPACE(c) || is_LF(c); }
27inline bool is_SPACE_LF_EOS(char c)     { return is_SPACE_LF(c) || is_EOS(c); }
28inline bool is_SPACE_SEP_LF_EOS(char c) { return is_SPACE_LF_EOS(c) || is_SEP(c); }
29inline bool is_LF_EOS(char c)           { return is_LF(c) || is_EOS(c); }
30inline bool is_SEP_LF_EOS(char c)       { return is_SEP(c) || is_LF_EOS(c); }
31
32inline void SKIP_SPACE_LF(const char *& var) { while (is_SPACE_LF(*var)) ++var; }
33inline void SKIP_SPACE_LF(char *& var)       { while (is_SPACE_LF(*var)) ++var; }
34
35inline void SKIP_SPACE_LF_BACKWARD(const char *& var, const char *strStart) { while (is_SPACE_LF(*var) && var>strStart) --var; }
36inline void SKIP_SPACE_LF_BACKWARD(char *& var, const char *strStart)       { while (is_SPACE_LF(*var) && var>strStart) --var; }
37
38
39
40inline char *strduplen(const char *s, int len) {
41    char *d = (char*)malloc(len+1);
42    memcpy(d, s, len);
43    d[len] = 0;
44    return d;
45}
46
47inline char *copy_string_part(const char *first, const char *last) {
48    return strduplen(first, last-first+1);
49}
50
51
52#else
53#error aisc_inline.h included twice
54#endif // AISC_INLINE_H
Note: See TracBrowser for help on using the repository browser.