Annotation of freem/src/ssvn_character.c, revision 1.1.1.1
1.1 snw 1: /*
2: * *
3: * * *
4: * * *
5: * ***************
6: * * * * *
7: * * MUMPS *
8: * * * * *
9: * ***************
10: * * *
11: * * *
12: * *
13: *
14: * ssvn_character.c
15: * ^$CHARACTER ssv
16: *
17: *
18: * Author: Serena Willis <jpw@coherent-logic.com>
19: * Copyright (C) 1998 MUG Deutschland
20: * Copyright (C) 2020 Coherent Logic Development LLC
21: *
22: *
23: * This file is part of FreeM.
24: *
25: * FreeM is free software: you can redistribute it and/or modify
26: * it under the terms of the GNU Affero Public License as published by
27: * the Free Software Foundation, either version 3 of the License, or
28: * (at your option) any later version.
29: *
30: * FreeM is distributed in the hope that it will be useful,
31: * but WITHOUT ANY WARRANTY; without even the implied warranty of
32: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33: * GNU Affero Public License for more details.
34: *
35: * You should have received a copy of the GNU Affero Public License
36: * along with FreeM. If not, see <https://www.gnu.org/licenses/>.
37: *
38: **/
39:
40: #include <stdio.h>
41: #include <stdlib.h>
42: #include <string.h>
43: #include "mref.h"
44: #include "mpsdef.h"
45:
46: void ssvn_character(short action, char *key, char *data)
47: {
48: freem_ref_t *r = (freem_ref_t *) malloc (sizeof (freem_ref_t));
49: NULLPTRCHK(r,"ssvn_character");
50:
51: mref_init (r, MREF_RT_SSV, "^$CHARACTER");
52: internal_to_mref (r, key);
53:
54: switch (action) {
55:
56: case get_sym:
57:
58: if (strcmp (mref_get_subscript (r, 0), "M") != 0) {
59: merr_raise (M38);
60: goto done;
61: }
62:
63: if (strcmp (mref_get_subscript (r, 1), "PATCODE") == 0) {
64: merr_raise (M38);
65: goto done;
66: }
67:
68: if (strcmp (mref_get_subscript (r, 1), "IDENT") == 0) {
69: merr_raise (OK);
70: *data = '\201';
71: goto done;
72: }
73: else if (strcmp (mref_get_subscript (r, 1), "COLLATE") == 0) {
74: merr_raise (OK);
75: *data = '\201';
76: goto done;
77: }
78: else if (strcmp (mref_get_subscript (r, 1), "INPUT") == 0) {
79:
80: if (strcmp (mref_get_subscript (r, 2), "M") != 0) {
81: merr_raise (M38);
82: goto done;
83: }
84:
85: *data = '\201';
86: merr_raise (OK);
87: goto done;
88:
89: }
90: else if (strcmp (mref_get_subscript (r, 1), "OUTPUT") == 0) {
91:
92: if (strcmp (mref_get_subscript (r, 2), "M") != 0) {
93: merr_raise (M38);
94: goto done;
95: }
96:
97: *data = '\201';
98: merr_raise (OK);
99: goto done;
100:
101: }
102:
103: merr_raise (OK);
104: goto done;
105:
106: default:
107: merr_raise (M29);
108: goto done;
109: }
110:
111:
112: done:
113: free (r);
114:
115: return;
116: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>