blob: 963852604b771d6b3a088c4965db57f367f39411 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <u.h>
#include <libc.h>
#include <bio.h>
#include "dat.h"
#include "fns.h"
Term *setdoublequotes(Term *);
void
initflags(void)
{
flagdoublequotes = DoubleQuotesChars;
}
Term *
setflag(Rune *flag, Term *value)
{
if(runestrcmp(flag, L"double_quotes") == 0)
return setdoublequotes(value);
else
return permissionerror(L"modify", L"flag", mkatom(flag));
}
Term *
setdoublequotes(Term *value)
{
if(value->tag != AtomTerm)
return typeerror(L"atom", value);
if(runestrcmp(value->text, L"chars") == 0)
flagdoublequotes = DoubleQuotesChars;
else if(runestrcmp(value->text, L"codes") == 0)
flagdoublequotes = DoubleQuotesCodes;
else if(runestrcmp(value->text, L"atom") == 0)
flagdoublequotes = DoubleQuotesAtom;
else
return domainerror(L"flag_value", value);
return nil;
}
|