-
Notifications
You must be signed in to change notification settings - Fork 2
/
keyObject.h
82 lines (60 loc) · 2.25 KB
/
keyObject.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Bahasa Anak Indonesia untuk Komputer - BAIK
// Copyright Haris Hasanudin - 2005 - 2011
//
// Kupersembahkan untuk istriku tercinta Masako, anakku tersayang Takumi
// dan Tomoki serta seluruh putra putri Indonesia
void keyObject (char object_str[MAX_STRING_LEN])
{
int n=0, i=0;
char ident[MAX_STRING_LEN];
char dat_a[MAX_STRING_LEN];
char dat_b[MAX_STRING_LEN];
VAL_LABEL valdat, valdat2, tmpdat;
// var list for class params
struct node_list tmpnode;
char class_tmpvar[MAX_STRING_LEN];
memset(&tmpdat, '\0', sizeof(tmpdat));
memset(&valdat, '\0', sizeof(valdat));
memset(&valdat2, '\0', sizeof(valdat2));
memset(&ident, '\0', sizeof(ident));
memset(&dat_a, '\0', sizeof(dat_a));
memset(&dat_b, '\0', sizeof(dat_b));
memset(&tmpnode, '\0', sizeof(tmpnode));
memset(&class_tmpvar, '\0', sizeof(class_tmpvar));
// printf("DEBUG: case TYPE_OBJECT\n");
strcpy( ident, object_str );
// object name
strcpy(dat_a, getObjectName(object_str) );
// object param
strcpy(dat_b, getObjectParam(object_str) );
/*
printf("For TREE object str : %s , len %d\n",ident, strlen(ident));
printf("For Check obj name: %s\n",dat_a);
printf("For Check obj param: %s len %d\n",dat_b, strlen(dat_b));
*/
// check for member existance and scope
checkObjectValidation(object_str);
getlex();
if( lex.type == _EOF )
Error("interupsi yang tidak diinginkan");
if( lex.detail.symbol != '=' )
Error("benda salah masukan");
getlex();
if( lex.type == _EOF )
Error("interupsi yang tidak diinginkan");
ungetlex();
// printf("start ekspresi\n");
valdat = expression();
strcpy(valdat.ident, ident);
strcpy(valdat.benda_name, dat_a);
strcpy(valdat.benda_param, dat_b);
valdat.isClassVar = 1;
/*
printf("For TREE ident : %s\n",ident);
printf("For TREE datatype %d\n",valdat.datatype);
printf("For TREE val %d\n",valdat.val);
printf("For TREE dbl %f\n",valdat.floatdata);
*/
// write into tree
ValLabel( ident, class_sub_deep, valdat, VAL_FLAG_SEARCH_W );
}