File: cstring.h

package info (click to toggle)
elk 3.0-6
  • links: PTS
  • area: main
  • in suites: potato, slink
  • size: 4,068 kB
  • ctags: 3,123
  • sloc: ansic: 20,686; lisp: 5,232; makefile: 419; awk: 91; sh: 21
file content (23 lines) | stat: -rw-r--r-- 659 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* These must be defined as macros, because they use Alloca().
 */

#define Get_String_Stack(_from,_to) {\
    int _len;\
    Check_Type(_from, T_String);\
    _len = STRING(_from)->size;\
    Alloca ((_to), char*, _len+1);\
    bcopy (STRING(_from)->data, (_to), _len);\
    (_to)[_len] = '\0';\
}

#define Get_Strsym_Stack(_from,_to) {\
    int _len;\
    if (TYPE(_from) == T_Symbol)\
	(_from) = SYMBOL(_from)->name;\
    else if (TYPE(_from) != T_String)\
	Wrong_Type_Combination ((_from), "string or symbol");\
    _len = STRING(_from)->size;\
    Alloca ((_to), char*, _len+1);\
    bcopy (STRING(_from)->data, (_to), _len);\
    (_to)[_len] = '\0';\
}