home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-28 | 22.5 KB | 1,058 lines |
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!rpi!gatech!hubcap!ncrcae!ncrhub2!ncrgw2!psinntp!fafnir!mckelvey
- From: mckelvey@fafnir.com (James W. McKelvey)
- Subject: Re: Code Generation Bug (long)
- Message-ID: <C1I64F.8nv@fafnir.com>
- Sender: mckelvey@fafnir.com (James W. McKelvey)
- Reply-To: mckelvey@fafnir.com
- Organization: Fafnir Software, Saugus, CA, USA
- Date: Wed, 27 Jan 1993 07:57:51 GMT
- Lines: 1046
-
- Thanks for your responses. Most people think it is a question of optimization.
- This is not the case. I have submitted this bug to NeXT. Below is a shorter
- version of what I gave them. This is not reproducible as it does not include
- some .h files needed to compile.
-
- We have found a code generation bug in the 3.0 C compiler. It occurs with
- optimization OFF. There are two symptoms:
- 1) Code mysteriously gets segmentation fault or other severe error.
- 2) A variable is "missing" in GDB.
-
- Problem 1 is due to the compiler thinking that an A register contains the
- offset for an automatic variable when it does not. The variable is the same
- one as in problem 2.
-
- The following .s file demonstrates the problem. Notice that there is no debug
- record for automatic variable "innnx". I have marked with "XXX" the places
- where improper code is generated. Register A2 is presumed to contain the
- offset for "innnx" but it does not.
-
- #NO_APP
- .stabs "ddu_add_table_field.c",100,0,0,Ltext0
- .text
- Ltext0:
- .stabs "int:t1=r1;-2147483648;2147483647;",128,0,0,0
- .stabs "char:t2=r2;0;127;",128,0,0,0
- .stabs "long int:t3=r1;-2147483648;2147483647;",128,0,0,0
- .stabs "unsigned int:t4=r1;0;-1;",128,0,0,0
- .stabs "long unsigned int:t5=r1;0;-1;",128,0,0,0
- .stabs "short int:t6=r1;-32768;32767;",128,0,0,0
- .stabs "long long int:t7=r1;0;-1;",128,0,0,0
- .stabs "short unsigned int:t8=r1;0;65535;",128,0,0,0
- .stabs "long long unsigned int:t9=r1;0;-1;",128,0,0,0
- .stabs "signed char:t10=r1;-128;127;",128,0,0,0
- .stabs "unsigned char:t11=r1;0;255;",128,0,0,0
- .stabs "float:t12=r1;4;0;",128,0,0,0
- .stabs "double:t13=r1;8;0;",128,0,0,0
- .stabs "long double:t14=r1;8;0;",128,0,0,0
- .stabs "void:t15=15",128,0,0,0
- .stabs "ptrdiff_t:t3",128,0,0,0
- .stabs "size_t:t5",128,0,0,0
- .stabs "wchar_t:t8",128,0,0,0
- .stabs "va_list:t16=*2",128,0,0,0
- .stabs
- "_iobuf:T17=s20_cnt:1,0,32;_ptr:16,32,32;_base:16,64,32;_bufsiz:1,96,32;_flag:6
- ,128,16;_file:11,144,8;_smallbuf:2,152,8;;",128,0,0,0
- .stabs "fpos_t:t3",128,0,0,0
- .stabs "STRING:t18=ar1;0;254;2",128,0,0,0
- .stabs "info_field:T19=s40field:20=ar1;0;9;16,0,320;;",128,0,0,0
- .stabs "INFOFIELD:t19",128,0,0,0
- .stabs "idtype:T21=s8identifier:16,0,32;length:1,32,32;;",128,0,0,0
- .stabs "IDTYPE:t21",128,0,0,0
- .stabs
- "name_header:T22=s12forward:23=*22,0,32;backward:23,32,32;ident:24=*21,64,32;;"
- ,128,0,0,0
- .stabs "NAME_HEADER:t22",128,0,0,0
- .stabs
- "fieldtype:T25=s22field_type:16,0,32;field_length:1,32,32;field_name:16,64,32;f
- ield_value_specified:1,96,32;field_value:26=*15,128,32;primary:2,160,8;;",128,0
- ,0,0
- .stabs "FIELDTYPE:t25",128,0,0,0
- .stabs
- "devtype:T27=s12dev_size:1,0,32;dev_name_length:1,32,32;dev_name:16,64,32;;",12
- 8,0,0,0
- .stabs "DEVTYPE:t27",128,0,0,0
- .stabs
- "queue_header:T28=s20forward:29=*28,0,32;backward:29,32,32;ident:24,64,32;field
- :30=*25,96,32;dev:31=*27,128,32;;",128,0,0,0
- .stabs "QUEUE_HEADER:t28",128,0,0,0
- .stabs
- "dsc_descriptor_d:T32=s8dsc_w_length:8,0,16;dsc_b_dtype:11,16,8;dsc_b_class:11,
- 24,8;dsc_a_pointer:16,32,32;;",128,0,0,0
- .stabs
- "dsc_descriptor_s:T33=s8dsc_w_length:8,0,16;dsc_b_dtype:11,16,8;dsc_b_class:11,
- 24,8;dsc_a_pointer:16,32,32;;",128,0,0,0
- .stabs
- "dsc_descriptor:T34=s8dsc_w_length:8,0,16;dsc_b_dtype:11,16,8;dsc_b_class:11,24
- ,8;dsc_a_pointer:16,32,32;;",128,0,0,0
- .stabs "BOOL:t2",128,0,0,0
- .cstring
- LC0:
- .ascii "\0"
- .text
- .align 1
- .globl _ddu_add_table_field
- _ddu_add_table_field:
- .stabd 68,0,10
- link a6,#-66368
- movel a2,sp@-
- .stabd 68,0,14
- LBB2:
- .stabd 68,0,16
- movel #135561217,a6@(-20)
- .stabd 68,0,20
- clrl a6@(-36)
- .stabd 68,0,29
- movel #-66354,a0
- clrl a0@(a6:l)
- .stabd 68,0,30
- movel #-66362,a0
- clrl a0@(a6:l)
- .stabd 68,0,33
- movel a6,d0
- addl #-65582,d0
- movel d0,sp@-
- jbsr _ddu_init
- .stabd 68,0,34
- movel a6,d0
- addl #-65326,d0
- movel d0,sp@-
- jbsr _ddu_init
- .stabd 68,0,35
- movel a6,d0
- addl #-65838,d0
- movel d0,sp@-
- jbsr _ddu_init
- .stabd 68,0,36
- movel a6,d0
- addl #-66350,d0
- movel d0,sp@-
- jbsr _ddu_init
- .stabd 68,0,37
- movel a6,d0
- addl #-66094,d0
- movel d0,sp@-
- jbsr _ddu_init
- .stabd 68,0,39
- movel a6,d0
- addl #-66358,d0
- movel d0,sp@-
- movel a6,d0
- addl #-65582,d0
- movel d0,sp@-
- pea _db_names_list
- jbsr _ddu_get_identifier
- movel d0,a6@(-20)
- .stabd 68,0,40
- moveb a6@(-17),d0
- andb #1,d0
- addw #32,sp
- tstb d0
- jne L2
- .stabd 68,0,41
- movel #135569664,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,42
- movel #135569664,d0
- jra L1
- .stabd 68,0,43
- L2:
- .stabd 68,0,44
- movel a6,d0
- addl #-66358,d0
- movel d0,sp@-
- movel a6,d0
- addl #-65326,d0
- movel d0,sp@-
- pea _table_names_list
- jbsr _ddu_get_identifier
- movel d0,a6@(-20)
- .stabd 68,0,45
- moveb a6@(-17),d0
- andb #1,d0
- addw #12,sp
- tstb d0
- jne L3
- .stabd 68,0,46
- movel #135569664,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,47
- movel #135569664,d0
- jra L1
- .stabd 68,0,48
- L3:
- .stabd 68,0,51
- moveq #-40,d0
- addl a6,d0
- movel d0,sp@-
- pea _data_view_class
- jbsr _msg_create_definition
- movel d0,a6@(-20)
- .stabd 68,0,52
- addqw #8,sp
- tstl a6@(-20)
- jne L4
- .stabd 68,0,53
- movel #135569488,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,54
- movel #135569488,d0
- jra L1
- .stabd 68,0,55
- L4:
- .stabd 68,0,56
- tstl a6@(-40)
- jne L5
- .stabd 68,0,57
- movel #135569472,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,58
- movel #135569472,d0
- jra L1
- .stabd 68,0,59
- L5:
- .stabd 68,0,62
- movel a6,d0
- addl #-65326,d0
- movel d0,sp@-
- movel a6@(-40),sp@-
- jbsr _msg_set_definition_name
- movel d0,a6@(-20)
- .stabd 68,0,63
- addqw #8,sp
- tstl a6@(-20)
- jne L6
- .stabd 68,0,64
- movel #135569928,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,65
- movel #135569928,d0
- jra L1
- .stabd 68,0,66
- L6:
- .stabd 68,0,67
- pea _data_view_class
- movel a6@(-40),sp@-
- jbsr _msg_set_definition_class
- movel d0,a6@(-20)
- .stabd 68,0,68
- addqw #8,sp
- tstl a6@(-20)
- jne L7
- .stabd 68,0,69
- movel #135569888,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,70
- movel #135569888,d0
- jra L1
- .stabd 68,0,71
- L7:
- .stabd 68,0,72
- pea _d3_relation_type
- movel a6@(-40),sp@-
- jbsr _msg_set_definition_type
- movel d0,a6@(-20)
- .stabd 68,0,73
- addqw #8,sp
- tstl a6@(-20)
- jne L8
- .stabd 68,0,74
- movel #135569944,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,75
- movel #135569944,d0
- jra L1
- .stabd 68,0,76
- L8:
- .stabd 68,0,77
- movel a6,d0
- addl #-66350,d0
- movel d0,sp@-
- movel a6@(-40),sp@-
- jbsr _msg_set_definition_desc
- movel d0,a6@(-20)
- .stabd 68,0,78
- addqw #8,sp
- tstl a6@(-20)
- jne L9
- .stabd 68,0,79
- movel #135569904,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,80
- movel #135569904,d0
- jra L1
- .stabd 68,0,81
- L9:
- .stabd 68,0,83
- tstl _dict_names_list
- jeq L10
- .stabd 68,0,84
- L11:
- tstl _dict_names_list
- jeq L12
- .stabd 68,0,85
- LBB3:
- movel a6,d0
- addl #-66358,d0
- movel d0,sp@-
- movel a6,d0
- addl #-65070,d0
- movel #-66362,a0
- movel a0@(a6:l),d1
- mulsl #255,d1
- addl d1,d0
- movel d0,sp@-
- pea _dict_names_list
- jbsr _ddu_get_identifier
- movel d0,a6@(-20)
- .stabd 68,0,88
- moveb a6@(-17),d0
- andb #1,d0
- addw #12,sp
- tstb d0
- jne L13
- .stabd 68,0,89
- movel #135569664,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,90
- movel #135569664,d0
- jra L1
- .stabd 68,0,91
- L13:
- .stabd 68,0,92
- movel a6,d0
- addl #-65070,d0
- movel #-66362,a0
- movel a0@(a6:l),d1
- mulsl #255,d1
- addl d1,d0
- movel d0,sp@-
- movel a6@(-40),sp@-
- jbsr _msg_set_defined_in
- movel d0,a6@(-20)
- .stabd 68,0,94
- addqw #8,sp
- tstl a6@(-20)
- jne L14
- .stabd 68,0,95
- movel #135569920,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,96
- movel #135569920,d0
- jra L1
- .stabd 68,0,97
- L14:
- .stabd 68,0,98
- movel #-66362,a0
- movel #-66362,a2
- movel a2@(a6:l),d0
- movel d0,a1
- addqw #1,a1
- movel a1,a0@(a6:l)
- .stabd 68,0,99
- LBE3:
- jra L11
- L12:
- .stabd 68,0,100
- jra L15
- L10:
- .stabd 68,0,101
- LBB4:
- pea LC0
- pea _DDD_NAME
- jbsr _strcmp
- addqw #8,sp
- tstl d0
- jeq L16
- .stabd 68,0,103
- movel #-66366,a0
- movel a2@(a6:l),a0@(a6:l) XXX
- .stabd 68,0,104
- pea _DDD_NAME
- movel a6,d0
- addl #-65070,d0
- movel a2@(a6:l),d1 XXX
- mulsl #255,d1
- addl d1,d0
- movel d0,sp@-
- jbsr _strcpy
- .stabd 68,0,105
- addqw #8,sp
- jra L17
- L16:
- .stabd 68,0,108
- movel #135569752,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,109
- addqw #8,sp
- L17:
- .stabd 68,0,110
- movel a6,d0
- addl #-65070,d0
- movel a2@(a6:l),d1 XXX
- mulsl #255,d1
- addl d1,d0
- movel d0,sp@-
- movel a2@(a6:l),sp@- XXX
- jbsr _msg_set_defined_in
- movel d0,a6@(-20)
- .stabd 68,0,111
- addqw #8,sp
- tstl a6@(-20)
- jne L18
- .stabd 68,0,112
- movel #135569920,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,113
- movel #135569920,d0
- jra L1
- .stabd 68,0,114
- L18:
- .stabd 68,0,115
- addql #1,a2@(a6:l) XXX
- .stabd 68,0,116
- LBE4:
- L15:
- .stabd 68,0,118
- movel a6,d0
- addl #-65582,d0
- movel d0,sp@-
- movel a6@(-40),sp@-
- jbsr _msg_set_defined_in
- movel d0,a6@(-20)
- .stabd 68,0,119
- addqw #8,sp
- tstl a6@(-20)
- jne L19
- .stabd 68,0,120
- movel #135569920,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,121
- movel #135569920,d0
- jra L1
- .stabd 68,0,122
- L19:
- nop
- .stabd 68,0,128
- movel #-66366,a0
- clrl a0@(a6:l)
- L20:
- movel #-66366,a0
- movel a0@(a6:l),a1
- cmpl a2@(a6:l),a1 XXX
- jge L21
- .stabd 68,0,129
- movel a6,d0
- addl #-66358,d0
- movel d0,sp@-
- movel a6,d0
- addl #-65070,d0
- movel #-66366,a0
- movel a0@(a6:l),d1
- mulsl #255,d1
- addl d1,d0
- movel d0,sp@-
- pea _dict_names_list
- jbsr _ddu_add_identifier
- movel d0,a6@(-20)
- .stabd 68,0,132
- moveb a6@(-17),d0
- andb #1,d0
- addw #12,sp
- tstb d0
- jne L23
- .stabd 68,0,133
- movel #135569440,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,134
- movel #135569440,d0
- jra L1
- .stabd 68,0,135
- L23:
- .stabd 68,0,136
- .stabd 68,0,128
- L22:
- movel #-66366,a0
- addql #1,a0@(a6:l)
- jra L20
- L21:
- nop
- .stabd 68,0,141
- L24:
- tstl _table_field_list
- jeq L25
- .stabd 68,0,142
- LBB5:
- movel a6,d0
- addl #-66367,d0
- movel d0,sp@-
- movel a6,d0
- addl #-66354,d0
- movel d0,sp@-
- moveq #-36,d0
- addl a6,d0
- movel d0,sp@-
- movel a6,d0
- addl #-65838,d0
- movel d0,sp@-
- moveq #-24,d0
- addl a6,d0
- movel d0,sp@-
- movel a6,d0
- addl #-66094,d0
- movel d0,sp@-
- pea _table_field_list
- jbsr _ddu_get_field
- movel d0,a6@(-20)
- .stabd 68,0,149
- moveb a6@(-17),d0
- andb #1,d0
- addw #28,sp
- tstb d0
- jne L26
- .stabd 68,0,150
- movel #135569656,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,151
- movel #135569656,d0
- jra L1
- .stabd 68,0,152
- L26:
- .stabd 68,0,156
- moveq #-32,d0
- addl a6,d0
- movel d0,sp@-
- moveq #-28,d0
- addl a6,d0
- movel d0,sp@-
- movel a6,d0
- addl #-66094,d0
- movel d0,sp@-
- jbsr _ddu_get_d3_datatype
- movel d0,a6@(-20)
- .stabd 68,0,157
- moveb a6@(-17),d0
- andb #1,d0
- addw #12,sp
- tstb d0
- jne L27
- .stabd 68,0,158
- movel #135569528,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,159
- movel #135569528,d0
- jra L1
- .stabd 68,0,160
- L27:
- .stabd 68,0,163
- movel #-66367,a0
- moveb a0@(a6:l),d0
- extbl d0
- movel d0,sp@-
- clrl sp@-
- moveq #-44,d0
- addl a6,d0
- movel d0,sp@-
- movel #-66354,a0
- movel a0@(a6:l),sp@-
- movel a6@(-36),sp@-
- movel a6@(-32),sp@-
- movel a6@(-24),sp@-
- movel a6@(-28),sp@-
- pea _data_item_class
- movel a2@(a6:l),sp@-
- movel a6,d0
- addl #-65070,d0
- movel d0,sp@-
- movel a6,d0
- addl #-66350,d0
- movel d0,sp@-
- movel a6,d0
- addl #-65838,d0
- movel d0,sp@-
- jbsr _ddu_add_d3_field
- movel d0,a6@(-20)
- .stabd 68,0,176
- moveb a6@(-17),d0
- andb #1,d0
- addw #52,sp
- tstb d0
- jne L28
- .stabd 68,0,177
- movel #135569408,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,178
- movel #135569408,d0
- jra L1
- .stabd 68,0,179
- L28:
- .stabd 68,0,182
- movel a6@(-44),sp@-
- movel a6@(-40),sp@-
- jbsr _msg_set_ref_by_id
- movel d0,a6@(-20)
- .stabd 68,0,183
- addqw #8,sp
- tstl a6@(-20)
- jne L29
- .stabd 68,0,184
- movel #135569912,sp@-
- pea 1:w
- jbsr _sts_handler
- .stabd 68,0,185
- movel #135569912,d0
- jra L1
- .stabd 68,0,186
- L29:
- .stabd 68,0,187
- LBE5:
- jra L24
- L25:
- .stabd 68,0,190
- movel #-65326,a1
- addl a6,a1
- movel a1,a6@(-4)
- .stabd 68,0,191
- moveb #14,a6@(-6)
- .stabd 68,0,192
- moveb #1,a6@(-5)
- .stabd 68,0,193
- movel a6,d0
- addl #-65326,d0
- movel d0,sp@-
- jbsr _strlen
- movew d0,a6@(-8)
- .stabd 68,0,194
- movel #-66366,a0
- clrl a0@(a6:l)
- addqw #4,sp
- L30:
- movel #-66366,a0
- movel a0@(a6:l),a1
- cmpl a2@(a6:l),a1 XXX
- jge L31
- .stabd 68,0,195
- LBB6:
- movel a6,d0
- addl #-65070,d0
- movel #-66366,a0
- movel a0@(a6:l),d1
- mulsl #255,d1
- movel d0,a1
- addl d1,a1
- movel a1,a6@(-12)
- .stabd 68,0,196
- moveb #14,a6@(-14)
- .stabd 68,0,197
- moveb #1,a6@(-13)
- .stabd 68,0,198
- movel a6,d0
- addl #-65070,d0
- movel #-66366,a0
- movel a0@(a6:l),d1
- mulsl #255,d1
- addl d1,d0
- movel d0,sp@-
- jbsr _strlen
- movew d0,a6@(-16)
- .stabd 68,0,199
- movel a6,d0
- addl #-65070,d0
- movel #-66366,a0
- movel a0@(a6:l),d1
- mulsl #255,d1
- addl d1,d0
- movel d0,sp@-
- movel a6@(-40),sp@-
- jbsr _msg_save_definition
- movel d0,a6@(-20)
- .stabd 68,0,200
- addw #12,sp
- tstl a6@(-20)
- jne L33
- .stabd 68,0,201
- moveq #-16,d0
- addl a6,d0
- movel d0,sp@-
- movel a6,d0
- subql #8,d0
- movel d0,sp@-
- pea 2:w
- movel #135569880,sp@-
- pea 4:w
- jbsr _sts_handler
- .stabd 68,0,203
- movel #135569880,d0
- jra L1
- .stabd 68,0,204
- jra L34
- L33:
- .stabd 68,0,208
- moveq #-16,d0
- addl a6,d0
- movel d0,sp@-
- movel a6,d0
- subql #8,d0
- movel d0,sp@-
- pea 2:w
- movel #135565323,sp@-
- pea 4:w
- jbsr _sts_handler
- .stabd 68,0,210
- addw #20,sp
- L34:
- .stabd 68,0,211
- LBE6:
- .stabd 68,0,194
- L32:
- movel #-66366,a0
- addql #1,a0@(a6:l)
- jra L30
- L31:
- .stabd 68,0,213
- movel a6@(-20),d0
- jra L1
- .stabd 68,0,214
- LBE2:
- .stabd 68,0,214
- L1:
- movel #-66368,a0
- movel a6@(-4,a0:l),a2
- unlk a6
- rts
- .stabs "ddu_add_table_field:F1",36,0,0,_ddu_add_table_field
- .stabs "message1_desc:34",128,0,0,-8
- .stabs "message2_desc:34",128,0,0,-16
- .stabs "status:1",128,0,0,-20
- .stabs "field_length:1",128,0,0,-24
- .stabs "data_type:1",128,0,0,-28
- .stabs "scale:1",128,0,0,-32
- .stabs "value_specified:1",128,0,0,-36
- .stabs "context:5",128,0,0,-40
- .stabs "field_context:5",128,0,0,-44
- .stabs "table_d3_name:35=ar1;0;254;18",128,0,0,-65070
- .stabs "table_name:18",128,0,0,-65326
- .stabs "table_db_name:18",128,0,0,-65582
- .stabs "field_name:18",128,0,0,-65838
- .stabs "field_type:18",128,0,0,-66094
- .stabs "descrip:18",128,0,0,-66350
- .stabs "field_value:16",128,0,0,-66354
- .stabs "length:1",128,0,0,-66358
- .stabs "i:1",128,0,0,-66366
- .stabs "primary:2",128,0,0,-66367
- .stabn 192,0,0,LBB2
- .stabn 192,0,0,LBB3
- .stabn 224,0,0,LBE3
- .stabn 192,0,0,LBB4
- .stabn 224,0,0,LBE4
- .stabn 192,0,0,LBB5
- .stabn 224,0,0,LBE5
- .stabn 192,0,0,LBB6
- .stabn 224,0,0,LBE6
- .stabn 224,0,0,LBE2
- .stabs "identifier_list:G29",32,0,0,0
- .comm _identifier_list,4
- .stabs "attach_names_list:G29",32,0,0,0
- .comm _attach_names_list,4
- .stabs "class_list:G29",32,0,0,0
- .comm _class_list,4
- .stabs "cond_field_list:G29",32,0,0,0
- .comm _cond_field_list,4
- .stabs "db_dev_list:G29",32,0,0,0
- .comm _db_dev_list,4
- .stabs "db_names_list:G29",32,0,0,0
- .comm _db_names_list,4
- .stabs "def_field_list:G29",32,0,0,0
- .comm _def_field_list,4
- .stabs "def_field_name_list:G29",32,0,0,0
- .comm _def_field_name_list,4
- .stabs "def_names_list:G29",32,0,0,0
- .comm _def_names_list,4
- .stabs "dict_names_list:G29",32,0,0,0
- .comm _dict_names_list,4
- .stabs "dicts_names_list:G29",32,0,0,0
- .comm _dicts_names_list,4
- .stabs "file_names_list:G29",32,0,0,0
- .comm _file_names_list,4
- .stabs "msg_names_list:G29",32,0,0,0
- .comm _msg_names_list,4
- .stabs "msg_field_list:G29",32,0,0,0
- .comm _msg_field_list,4
- .stabs "msg_field_name_list:G29",32,0,0,0
- .comm _msg_field_name_list,4
- .stabs "msg_subtype_list:G29",32,0,0,0
- .comm _msg_subtype_list,4
- .stabs "msg_type_list:G29",32,0,0,0
- .comm _msg_type_list,4
- .stabs "pass_names_list:G29",32,0,0,0
- .comm _pass_names_list,4
- .stabs "proc_names_list:G29",32,0,0,0
- .comm _proc_names_list,4
- .stabs "server_names_list:G29",32,0,0,0
- .comm _server_names_list,4
- .stabs "subclass_list:G29",32,0,0,0
- .comm _subclass_list,4
- .stabs "syb_data_dev_list:G29",32,0,0,0
- .comm _syb_data_dev_list,4
- .stabs "syb_log_dev_list:G29",32,0,0,0
- .comm _syb_log_dev_list,4
- .stabs "table_field_list:G29",32,0,0,0
- .comm _table_field_list,4
- .stabs "table_field_name_list:G29",32,0,0,0
- .comm _table_field_name_list,4
- .stabs "table_names_list:G29",32,0,0,0
- .comm _table_names_list,4
- .stabs "trans_name_list:G29",32,0,0,0
- .comm _trans_name_list,4
- .stabs "trans_value_list:G29",32,0,0,0
- .comm _trans_value_list,4
- .stabs "user_names_list:G29",32,0,0,0
- .comm _user_names_list,4
- .stabs "view_field_list:G29",32,0,0,0
- .comm _view_field_list,4
- .stabs "view_names_list:G29",32,0,0,0
- .comm _view_names_list,4
- .text
- .stabs "",100,0,0,Letext
- Letext:
-
- And here is the original C source:
-
- #include "ddu_define.h"
- #include "ddu_queue.h"
- #include "ddu_message.h"
- #include "st_descrip.h"
- #include "st_stsdef.h"
-
- typedef char BOOL;
-
- int ddu_add_table_field(void)
- {
- #ifdef DEBUG
- static DESCRIPTOR (current_module_desc, "ddu_add_table_field");
- #endif
- struct dsc_descriptor message1_desc,
- message2_desc;
- int status = DDU_NORMAL,
- field_length,
- data_type,
- scale,
- value_specified = FALSE;
- unsigned long context,
- field_context;
- STRING table_d3_name [CONTEXT_MAX];
- char table_name [TOKEN_LEN],
- table_db_name [TOKEN_LEN],
- field_name [TOKEN_LEN],
- field_type [TOKEN_LEN],
- descrip [TOKEN_LEN];
- char *field_value = NULL;
- int length, innnx=0, i;
- BOOL primary;
-
- ddu_init(table_db_name);
- ddu_init(table_name);
- ddu_init(field_name);
- ddu_init(descrip);
- ddu_init(field_type);
-
- status = ddu_get_identifier(&db_names_list, table_db_name, &length);
- if (!STS_STATUS_SUCCESS(status)) {
- sts_handler(1, DDU_GETIDENTERR);
- return(DDU_GETIDENTERR);
- }
- status = ddu_get_identifier(&table_names_list, table_name, &length);
- if (!STS_STATUS_SUCCESS(status)) {
- sts_handler(1, DDU_GETIDENTERR);
- return(DDU_GETIDENTERR);
- }
-
- /* Create the table as a d3view. */
- status = msg_create_definition(data_view_class, &context);
- if (status == FAILURE) {
- sts_handler(1, DDU_CREATEDEFERR);
- return(DDU_CREATEDEFERR);
- }
- if (context == NIL) {
- sts_handler(1, DDU_CONTEXTERR);
- return(DDU_CONTEXTERR);
- }
-
- /* Put the characteristics of the message in the definition. */
- status = msg_set_definition_name(context, table_name);
- if (status == FAILURE) {
- sts_handler(1, DDU_SETDEFNMERR);
- return(DDU_SETDEFNMERR);
- }
- status = msg_set_definition_class(context, data_view_class);
- if (status == FAILURE) {
- sts_handler(1, DDU_SETDEFCLSERR);
- return(DDU_SETDEFCLSERR);
- }
- status = msg_set_definition_type(context, d3_relation_type);
- if (status == FAILURE) {
- sts_handler(1, DDU_SETDEFTYERR);
- return(DDU_SETDEFTYERR);
- }
- status = msg_set_definition_desc(context, descrip);
- if (status == FAILURE) {
- sts_handler(1, DDU_SETDEFDESCERR);
- return(DDU_SETDEFDESCERR);
- }
-
- if (dict_names_list != NULL) {
- while (dict_names_list != NULL) {
- status = ddu_get_identifier(&dict_names_list,
- table_d3_name[innnx],
- &length);
- if (!STS_STATUS_SUCCESS(status)) {
- sts_handler(1, DDU_GETIDENTERR);
- return(DDU_GETIDENTERR);
- }
- status = msg_set_defined_in(context,
- table_d3_name[innnx]);
- if (status == FAILURE) {
- sts_handler(1, DDU_SETDEFINERR);
- return(DDU_SETDEFINERR);
- }
- innnx += 1;
- }
- } else {
- if (strcmp(DDD_NAME, "") != 0)
- {
- i = innnx;
- strcpy(table_d3_name[innnx], DDD_NAME);
- }
- else
- {
- sts_handler(1, DDU_NODDDFOUND);
- }
- status = msg_set_defined_in(innnx, table_d3_name[innnx]);
- if (status == FAILURE) {
- sts_handler(1, DDU_SETDEFINERR);
- return(DDU_SETDEFINERR);
- }
- innnx += 1;
- }
-
- status = msg_set_defined_in(context, table_db_name);
- if (status == FAILURE) {
- sts_handler(1, DDU_SETDEFINERR);
- return(DDU_SETDEFINERR);
- }
-
- /* This is done so that mapping multiple table definition
- * into dictionary will be implemented correctly. Anyway,
- * before the next command, "dict_names_list" will be
- * initialize to NULL */
- for (i = 0; i < innnx; i++) {
- status = ddu_add_identifier(&dict_names_list,
- table_d3_name[i],
- &length);
- if (!STS_STATUS_SUCCESS(status)) {
- sts_handler(1, DDU_ADDIDENTERR);
- return(DDU_ADDIDENTERR);
- }
- }
-
- /* Now go through the list of table fields. Get the field name,
- ** field name length, data_type, and field length for each one. Then
- ** call the D3 stuff to load each one into the dictionary. */
- while (table_field_list != NULL) {
- status = ddu_get_field(&table_field_list,
- field_type,
- &field_length,
- field_name,
- &value_specified,
- &field_value,
- &primary);
- if (!STS_STATUS_SUCCESS(status)) {
- sts_handler(1, DDU_GETFIELDERR);
- return(DDU_GETFIELDERR);
- }
-
- /* Get the data_type (an enumerated type) from the field_type
- * (a character string ). */
- status = ddu_get_d3_datatype(field_type, &data_type, &scale);
- if (!STS_STATUS_SUCCESS(status)) {
- sts_handler(1, DDU_GETD3DTTYERR);
- return(DDU_GETD3DTTYERR);
- }
-
- /* Put the field definitions in the D3 here. */
- status = ddu_add_d3_field(field_name,
- descrip,
- table_d3_name,
- innnx,
- data_item_class,
- data_type,
- field_length,
- scale,
- value_specified,
- field_value,
- &field_context,
- LOCAL,
- primary);
- if (!STS_STATUS_SUCCESS(status)) {
- sts_handler(1, DDU_ADDD3FIELDERR);
- return(DDU_ADDD3FIELDERR);
- }
-
- /* Add a reference for the field to the table. */
- status = msg_set_ref_by_id(context, field_context);
- if (status == FAILURE) {
- sts_handler(1, DDU_SETREFIDERR);
- return(DDU_SETREFIDERR);
- }
- }
-
- /* All the fields have been added to the table. Save it now. */
- message1_desc.dsc_a_pointer = table_name;
- message1_desc.dsc_b_dtype = DSC_K_DTYPE_T;
- message1_desc.dsc_b_class = DSC_K_CLASS_S;
- message1_desc.dsc_w_length = strlen(table_name);
- for (i = 0; i < innnx; i++) {
- message2_desc.dsc_a_pointer = table_d3_name[i];
- message2_desc.dsc_b_dtype = DSC_K_DTYPE_T;
- message2_desc.dsc_b_class = DSC_K_CLASS_S;
- message2_desc.dsc_w_length = strlen(table_d3_name[i]);
- status = msg_save_definition(context, table_d3_name[i]);
- if (status == FAILURE) {
- sts_handler(4, DDU_SAVETABERR,
- 2, &message1_desc, &message2_desc);
- return(DDU_SAVETABERR);
- } else {
-
- /* Let the user know the table was successfully
- * added. */
- sts_handler(4, DDU_ADDTAB,
- 2, &message1_desc, &message2_desc);
- }
- }
-
- return (status);
- }
- --
- The gentle journey jars to stop. The drifting dream is
- done. The long gone goblins loom ahead; the deadly,
- that we thought were dead, stand waiting, every one.
- -- Walt Kelly Jim McKelvey mckelvey@fafnir.com
-