libpulsar
A modular compiler for the pulsar programming language
Loading...
Searching...
No Matches
Macros | Functions
dynstr.h File Reference

Defines a dynamically-allocated string. More...

#include "def.h"
#include "dynarr.h"

Go to the source code of this file.

Macros

#define ps_dynstr_new()
 
#define ps_dynstr_free(arr)   ps_dynarr_free(arr)
 
#define ps_dynstr_append(dstrptr, str)
 Appends a string str to the struct ps_dynstr string pointed to by dstrptr.
 

Functions

struct ps_dynstr ps_dynarr (char)
 

Detailed Description

Defines a dynamically-allocated string.

Author
Ethan Uppal

Definition in file dynstr.h.

Macro Definition Documentation

◆ ps_dynstr_append

#define ps_dynstr_append (   dstrptr,
  str 
)
Value:
do { \
(*dstrptr)->length--; /* overwrite ending null terminator */ \
STR _str = str; \
while (*_str) { \
ps_push(dstrptr, *(_str++)); \
}; \
ps_push(dstrptr, 0); \
} while (0)
#define STR
Definition def.h:40

Appends a string str to the struct ps_dynstr string pointed to by dstrptr.

Definition at line 26 of file dynstr.h.

◆ ps_dynstr_free

#define ps_dynstr_free (   arr)    ps_dynarr_free(arr)

Definition at line 20 of file dynstr.h.

◆ ps_dynstr_new

#define ps_dynstr_new ( )
Value:
({ \
auto_t dstr = ps_dynarr_new(struct ps_dynstr); \
ps_push(&dstr, 0); \
dstr; \
})
#define auto_t
Definition def.h:53
#define ps_dynarr_new(T)
Definition dynarr.h:35

Definition at line 14 of file dynstr.h.

Function Documentation

◆ ps_dynarr()

struct ps_dynstr ps_dynarr ( char  )