Changeset 374 for asp3_tinet_ecnl_rx/trunk
- Timestamp:
- Apr 5, 2019, 9:26:53 PM (5 years ago)
- Location:
- asp3_tinet_ecnl_rx/trunk
- Files:
-
- 104 added
- 5 deleted
- 175 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/Debug/Makefile
r373 r374 158 158 159 159 # 160 # mbedサービスの定義 161 # 162 163 include $(SRCDIR)/mbed/Makefile.mbed 164 165 # 160 166 # 共通コンパイルオプションの定義 161 167 # … … 193 199 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 194 200 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 195 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 196 202 197 203 # -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/DebugCitrus/Makefile
r373 r374 158 158 159 159 # 160 # mbedサービスの定義 161 # 162 163 include $(SRCDIR)/mbed/Makefile.mbed 164 165 # 160 166 # 共通コンパイルオプションの定義 161 167 # … … 193 199 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 194 200 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 195 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 196 202 197 203 # -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/DebugEther/Makefile
r373 r374 158 158 159 159 # 160 # mbedサービスの定義 161 # 162 163 include $(SRCDIR)/mbed/Makefile.mbed 164 165 # 160 166 # 共通コンパイルオプションの定義 161 167 # … … 193 199 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 194 200 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 195 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o201 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 196 202 197 203 # -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/src/client.c
r371 r374 33 33 * の責任を負わない. 34 34 * 35 * @(#) $Id : client.c 1729 2019-01-09 14:44:36Z coas-nagasima$35 * @(#) $Id$ 36 36 */ 37 37 #include <lib/curl_config.h> … … 47 47 #include "kernel_cfg.h" 48 48 #include "ff.h" 49 #include "util/ntstdio.h"49 #include <stdio.h> 50 50 #include "client.h" 51 51 #include "jsonsl.h" -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/src/client.h
r371 r374 33 33 * の責任を負わない. 34 34 * 35 * @(#) $Id : client.h 1784 2019-02-06 01:11:25Z coas-nagasima$35 * @(#) $Id$ 36 36 */ 37 37 -
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/src/main.c
r371 r374 68 68 #include "core/ntshell.h" 69 69 #include "core/ntlibc.h" 70 #include "util/ntstdio.h"70 #include <stdio.h> 71 71 #include "usrcmd.h" 72 72 #include "util/ntopt.h" 73 73 #include "socket_stub.h" 74 #include " mbed_api.h"74 #include "gpio_api.h" 75 75 #include "usb_hbth.h" 76 76 #include "ntshell_main.h" … … 188 188 { 189 189 FILINFO fno; 190 #if _USE_LFN191 char lfn[ _MAX_LFN + 1];190 #if FF_USE_LFN 191 char lfn[FF_MAX_LFN + 1]; 192 192 fno.lfname = lfn; 193 fno.lfsize = _MAX_LFN + 1;193 fno.lfsize = FF_MAX_LFN + 1; 194 194 #endif 195 195 ER ret; 196 196 197 #ifdef TOPPERS_OMIT_TECS198 serial_opn_por(SIO_PORTID);199 #endif200 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV);201 202 197 //wolfSSL_Debugging_ON(); 203 198 204 ntshell_task_init( uart_read, uart_write, &main_obj);199 ntshell_task_init(SIO_PORTID); 205 200 206 201 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/app2_light/Debug/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 184 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 185 191 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 186 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 187 193 188 194 # -
asp3_tinet_ecnl_rx/trunk/app2_light/DebugCitrus/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 184 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 185 191 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 186 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 187 193 188 194 # -
asp3_tinet_ecnl_rx/trunk/app2_light/DebugEther/Makefile
r364 r374 153 153 154 154 # 155 # mbedサービスの定義 156 # 157 158 include $(SRCDIR)/mbed/Makefile.mbed 159 160 # 155 161 # 共通コンパイルオプションの定義 156 162 # … … 182 188 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 183 189 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 184 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 185 191 186 192 # -
asp3_tinet_ecnl_rx/trunk/app2_light/src/main.c
r364 r374 67 67 #include "core/ntshell.h" 68 68 #include "core/ntlibc.h" 69 #include "util/ntstdio.h"69 #include <stdio.h> 70 70 #include "usrcmd.h" 71 71 #include "util/ntopt.h" 72 72 #include "socket_stub.h" 73 #include " mbed_api.h"73 #include "gpio_api.h" 74 74 #include "usb_hbth.h" 75 75 #include "ntshell_main.h" … … 183 183 { 184 184 FILINFO fno; 185 #if _USE_LFN186 char lfn[ _MAX_LFN + 1];185 #if FF_USE_LFN 186 char lfn[FF_MAX_LFN + 1]; 187 187 fno.lfname = lfn; 188 fno.lfsize = _MAX_LFN + 1;188 fno.lfsize = FF_MAX_LFN + 1; 189 189 #endif 190 190 ER ret; 191 191 192 #ifdef TOPPERS_OMIT_TECS 193 serial_opn_por(SIO_PORTID); 194 #endif 195 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 196 197 ntshell_task_init(uart_read, uart_write, &main_obj); 192 ntshell_task_init(SIO_PORTID); 198 193 199 194 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/Debug/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 184 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 185 191 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 186 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 187 193 188 194 # -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/DebugCitrus/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 184 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 185 191 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 186 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 187 193 188 194 # -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/DebugEther/Makefile
r364 r374 153 153 154 154 # 155 # mbedサービスの定義 156 # 157 158 include $(SRCDIR)/mbed/Makefile.mbed 159 160 # 155 161 # 共通コンパイルオプションの定義 156 162 # … … 182 188 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 183 189 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 184 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 185 191 186 192 # -
asp3_tinet_ecnl_rx/trunk/app3_human_detec/src/main.c
r364 r374 67 67 #include "core/ntshell.h" 68 68 #include "core/ntlibc.h" 69 #include "util/ntstdio.h"69 #include <stdio.h> 70 70 #include "usrcmd.h" 71 71 #include "util/ntopt.h" 72 72 #include "socket_stub.h" 73 #include " mbed_api.h"73 #include "gpio_api.h" 74 74 #include "usb_hbth.h" 75 75 #include "ntshell_main.h" … … 183 183 { 184 184 FILINFO fno; 185 #if _USE_LFN186 char lfn[ _MAX_LFN + 1];185 #if FF_USE_LFN 186 char lfn[FF_MAX_LFN + 1]; 187 187 fno.lfname = lfn; 188 fno.lfsize = _MAX_LFN + 1;188 fno.lfsize = FF_MAX_LFN + 1; 189 189 #endif 190 190 ER ret; 191 191 192 #ifdef TOPPERS_OMIT_TECS 193 serial_opn_por(SIO_PORTID); 194 #endif 195 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 196 197 ntshell_task_init(uart_read, uart_write, &main_obj); 192 ntshell_task_init(SIO_PORTID); 198 193 199 194 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/app4_aircon/Debug/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # gdicサービスの定義 158 164 # … … 190 196 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 197 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 193 199 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 194 200 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app4_aircon/DebugCitrus/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # gdicサービスの定義 158 164 # … … 190 196 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 197 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 193 199 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 194 200 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app4_aircon/DebugEther/Makefile
r364 r374 153 153 154 154 # 155 # mbedサービスの定義 156 # 157 158 include $(SRCDIR)/mbed/Makefile.mbed 159 160 # 155 161 # gdicサービスの定義 156 162 # … … 188 194 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 189 195 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 190 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o196 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 191 197 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 192 198 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app4_aircon/src/main.c
r364 r374 67 67 #include "core/ntshell.h" 68 68 #include "core/ntlibc.h" 69 #include "util/ntstdio.h"69 #include <stdio.h> 70 70 #include "usrcmd.h" 71 71 #include "util/ntopt.h" 72 72 #include "socket_stub.h" 73 #include " mbed_api.h"73 #include "gpio_api.h" 74 74 #include "usb_hbth.h" 75 75 #include "ntshell_main.h" … … 183 183 { 184 184 FILINFO fno; 185 #if _USE_LFN186 char lfn[ _MAX_LFN + 1];185 #if FF_USE_LFN 186 char lfn[FF_MAX_LFN + 1]; 187 187 fno.lfname = lfn; 188 fno.lfsize = _MAX_LFN + 1;188 fno.lfsize = FF_MAX_LFN + 1; 189 189 #endif 190 190 ER ret; 191 191 192 #ifdef TOPPERS_OMIT_TECS 193 serial_opn_por(SIO_PORTID); 194 #endif 195 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 196 197 ntshell_task_init(uart_read, uart_write, &main_obj); 192 ntshell_task_init(SIO_PORTID); 198 193 199 194 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/Debug/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # gdicサービスの定義 158 164 # … … 190 196 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 197 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 193 199 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 194 200 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/DebugCitrus/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # gdicサービスの定義 158 164 # … … 190 196 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 191 197 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 192 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o198 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 193 199 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 194 200 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/DebugEther/Makefile
r364 r374 153 153 154 154 # 155 # mbedサービスの定義 156 # 157 158 include $(SRCDIR)/mbed/Makefile.mbed 159 160 # 155 161 # gdicサービスの定義 156 162 # … … 188 194 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 189 195 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 190 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o196 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 191 197 APPLDIRS := $(APPLDIRS) ../../ntshell/lcd 192 198 APPL_COBJS := $(APPL_COBJS) draw_font.o shnm12_font.o -
asp3_tinet_ecnl_rx/trunk/app5_temp_sensor/src/main.c
r364 r374 67 67 #include "core/ntshell.h" 68 68 #include "core/ntlibc.h" 69 #include "util/ntstdio.h"69 #include <stdio.h> 70 70 #include "usrcmd.h" 71 71 #include "util/ntopt.h" 72 72 #include "socket_stub.h" 73 #include " mbed_api.h"73 #include "gpio_api.h" 74 74 #include "usb_hbth.h" 75 75 #include "ntshell_main.h" … … 183 183 { 184 184 FILINFO fno; 185 #if _USE_LFN186 char lfn[ _MAX_LFN + 1];185 #if FF_USE_LFN 186 char lfn[FF_MAX_LFN + 1]; 187 187 fno.lfname = lfn; 188 fno.lfsize = _MAX_LFN + 1;188 fno.lfsize = FF_MAX_LFN + 1; 189 189 #endif 190 190 ER ret; 191 191 192 #ifdef TOPPERS_OMIT_TECS 193 serial_opn_por(SIO_PORTID); 194 #endif 195 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 196 197 ntshell_task_init(uart_read, uart_write, &main_obj); 192 ntshell_task_init(SIO_PORTID); 198 193 199 194 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/Debug/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 184 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 185 191 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 186 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 187 193 188 194 # -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/DebugCitrus/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 184 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 185 191 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 186 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 187 193 188 194 # -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/DebugEther/Makefile
r364 r374 153 153 154 154 # 155 # mbedサービスの定義 156 # 157 158 include $(SRCDIR)/mbed/Makefile.mbed 159 160 # 155 161 # 共通コンパイルオプションの定義 156 162 # … … 182 188 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 183 189 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 184 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 185 191 186 192 # -
asp3_tinet_ecnl_rx/trunk/app6_hot_water_pot/src/main.c
r364 r374 67 67 #include "core/ntshell.h" 68 68 #include "core/ntlibc.h" 69 #include "util/ntstdio.h"69 #include <stdio.h> 70 70 #include "usrcmd.h" 71 71 #include "util/ntopt.h" 72 72 #include "socket_stub.h" 73 #include " mbed_api.h"73 #include "gpio_api.h" 74 74 #include "usb_hbth.h" 75 75 #include "ntshell_main.h" … … 183 183 { 184 184 FILINFO fno; 185 #if _USE_LFN186 char lfn[ _MAX_LFN + 1];185 #if FF_USE_LFN 186 char lfn[FF_MAX_LFN + 1]; 187 187 fno.lfname = lfn; 188 fno.lfsize = _MAX_LFN + 1;188 fno.lfsize = FF_MAX_LFN + 1; 189 189 #endif 190 190 ER ret; 191 191 192 #ifdef TOPPERS_OMIT_TECS 193 serial_opn_por(SIO_PORTID); 194 #endif 195 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 196 197 ntshell_task_init(uart_read, uart_write, &main_obj); 192 ntshell_task_init(SIO_PORTID); 198 193 199 194 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/Debug/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 184 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 185 191 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 186 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 187 193 188 194 # -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/DebugCitrus/Makefile
r364 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 184 190 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 185 191 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 186 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o192 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 187 193 188 194 # -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/DebugEther/Makefile
r364 r374 153 153 154 154 # 155 # mbedサービスの定義 156 # 157 158 include $(SRCDIR)/mbed/Makefile.mbed 159 160 # 155 161 # 共通コンパイルオプションの定義 156 162 # … … 182 188 APPL_COBJS := $(APPL_COBJS) ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o 183 189 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 184 APPL_COBJS := $(APPL_COBJS) mbed_api.onetcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o190 APPL_COBJS := $(APPL_COBJS) netcmd.o fdtable.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 185 191 186 192 # -
asp3_tinet_ecnl_rx/trunk/app7_buzzer/src/main.c
r364 r374 67 67 #include "core/ntshell.h" 68 68 #include "core/ntlibc.h" 69 #include "util/ntstdio.h"69 #include <stdio.h> 70 70 #include "usrcmd.h" 71 71 #include "util/ntopt.h" 72 72 #include "socket_stub.h" 73 #include " mbed_api.h"73 #include "gpio_api.h" 74 74 #include "usb_hbth.h" 75 75 #include "ntshell_main.h" … … 183 183 { 184 184 FILINFO fno; 185 #if _USE_LFN186 char lfn[ _MAX_LFN + 1];185 #if FF_USE_LFN 186 char lfn[FF_MAX_LFN + 1]; 187 187 fno.lfname = lfn; 188 fno.lfsize = _MAX_LFN + 1;188 fno.lfsize = FF_MAX_LFN + 1; 189 189 #endif 190 190 ER ret; 191 191 192 #ifdef TOPPERS_OMIT_TECS 193 serial_opn_por(SIO_PORTID); 194 #endif 195 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 196 197 ntshell_task_init(uart_read, uart_write, &main_obj); 192 ntshell_task_init(SIO_PORTID); 198 193 199 194 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/Debug/Makefile
r364 r374 153 153 154 154 # 155 # mbedサービスの定義 156 # 157 158 include $(SRCDIR)/mbed/Makefile.mbed 159 160 # 155 161 # 共通コンパイルオプションの定義 156 162 # -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/DebugCitrus/Makefile
r364 r374 153 153 154 154 # 155 # mbedサービスの定義 156 # 157 158 include $(SRCDIR)/mbed/Makefile.mbed 159 160 # 155 161 # 共通コンパイルオプションの定義 156 162 # -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/arch/rx630_gcc/tSCIF.c
r337 r374 47 47 #include "tSCIF_tecsgen.h" 48 48 #include "scif.h" 49 #include "target_kernel_impl.h" 49 50 50 51 /* -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/cfg/pass1.rb
r337 r374 727 727 # 728 728 def self.OutLineNumber(cfgInfo) 729 @cfg1Out.add("#line #{cfgInfo[:_LINE_]} \"#{cfgInfo[:_FILE_] }\"")729 @cfg1Out.add("#line #{cfgInfo[:_LINE_]} \"#{cfgInfo[:_FILE_].gsub('\\', '/')}\"") 730 730 end 731 731 … … 734 734 # 735 735 def self.OutClassLineNumber(cfgInfo) 736 @cfg1Out.add("#line #{cfgInfo[:CLASS_LINE_]} \"#{cfgInfo[:CLASS_FILE_] }\"")736 @cfg1Out.add("#line #{cfgInfo[:CLASS_LINE_]} \"#{cfgInfo[:CLASS_FILE_].gsub('\\', '/')}\"") 737 737 end 738 738 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/gdic/adafruit_ssd1306/adafruit_ssd1306.h
r364 r374 22 22 #include <stdbool.h> 23 23 #include <time.h> 24 #include "mbed_api.h" 24 #include "gpio_api.h" 25 #include "spi_api.h" 26 #include "i2c_api.h" 25 27 #include "gfxfont.h" 26 28 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/Makefile.target
r337 r374 13 13 # コンパイルオプション 14 14 # 15 INCLUDES := $(INCLUDES) -I$(TARGETDIR) -I$(SRCDIR)/ pdic15 INCLUDES := $(INCLUDES) -I$(TARGETDIR) -I$(SRCDIR)/mbed 16 16 17 17 # … … 25 25 # システムサービスに関する定義 26 26 # 27 SYSSVC_DIRS := $(SYSSVC_DIRS) 27 SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/mbed 28 28 SYSSVC_COBJS := $(SYSSVC_COBJS) 29 29 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/gr_citrus.h
r337 r374 71 71 * ボーレート設定 72 72 */ 73 #define BAUD_19200BPS UINT_C( 78 ) 74 #define BAUD_38400BPS UINT_C( 39 ) 75 #define BAUD_57600BPS UINT_C( 25 ) 76 #define BAUD_115200BPS UINT_C( 12 ) 77 78 #define UART_BAUDRATE BAUD_115200BPS 73 #define UART_BAUDRATE 115200 79 74 80 75 /* -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/tSIOPortGRCitrus.cdl
r337 r374 51 51 */ 52 52 import_C("gr_citrus.h"); 53 import_C(" rx630.h");53 import_C("device.h"); 54 54 55 55 /* 56 56 * FIFO内蔵シリアルコミュニケーションインタフェース用 簡易SIOドライバ 57 57 */ 58 import("t SCIF.cdl");58 import("tMbedSerial.cdl"); 59 59 60 60 /* … … 74 74 call sSIOPort cSIOPort; 75 75 [inline] entry siSIOCBR eiSIOCBR; 76 77 /*78 * 割込み要求ライン操作のための結合79 */80 call sInterruptRequest cRxInterruptRequest;81 call sInterruptRequest cTxInterruptRequest;82 76 }; 83 77 … … 86 80 * ト)のセルタイプ 87 81 */ 88 [active]89 82 composite tSIOPortGRCitrus { 90 83 /* … … 98 91 */ 99 92 attr { 100 uintptr_t baseAddress; /* ベースアドレス */ 101 INTNO rxInterruptNumber; /* 受信割込み番号 */ 102 INTNO txInterruptNumber; /* 送信割込み番号 */ 103 PRI isrPriority = 1; /* ISR優先度 */ 104 PRI interruptPriority = -4; /* 割込み優先度 */ 93 int32_t tx; /* 送信Pin */ 94 int32_t rx; /* 受信Pin */ 105 95 uint32_t baudRate = 115200; /* ボーレートの設定値 */ 106 96 }; … … 109 99 * SIOドライバ 110 100 */ 111 cell tSCIF SCIF { 112 baseAddress = composite.baseAddress; 101 cell tMbedSerial MbedSerial { 102 tx = composite.tx; 103 rx = composite.rx; 113 104 baudRate = composite.baudRate; 114 105 ciSIOCBR = SIOPortMain.eiSIOCBR; … … 120 111 cell tSIOPortGRCitrusMain SIOPortMain { 121 112 ciSIOCBR => composite.ciSIOCBR; 122 cSIOPort = SCIF.eSIOPort; 123 cRxInterruptRequest = RxInterruptRequest.eInterruptRequest; 124 cTxInterruptRequest = TxInterruptRequest.eInterruptRequest; 113 cSIOPort = MbedSerial.eSIOPort; 125 114 }; 126 115 composite.eSIOPort => SIOPortMain.eSIOPort; 127 128 /*129 * SIOの受信割込みサービスルーチンと割込み要求ライン130 */131 cell tISR RxISRInstance {132 interruptNumber = composite.rxInterruptNumber;133 isrPriority = composite.isrPriority;134 ciISRBody = SCIF.eiRxISR;135 };136 cell tInterruptRequest RxInterruptRequest {137 interruptNumber = composite.rxInterruptNumber;138 interruptPriority = composite.interruptPriority;139 };140 141 /*142 * SIOの受信割込みサービスルーチンと割込み要求ライン143 */144 cell tISR TxISRInstance {145 interruptNumber = composite.txInterruptNumber;146 isrPriority = composite.isrPriority;147 ciISRBody = SCIF.eiTxISR;148 };149 cell tInterruptRequest TxInterruptRequest {150 interruptNumber = composite.txInterruptNumber;151 interruptPriority = composite.interruptPriority;152 };153 116 }; 154 117 … … 158 121 * サンプルプログラムが使うポートが,SIOPortTarget1に固定されているた 159 122 * め,ポート1とポート3を入れ換えている.具体的には,SIOPortTarget1は 160 * SCIFのチャネル2(チャネル番号は0から始まるので,ポート3のこと)に,161 * SIOPortTarget3は SCIFのチャネル0につながっている.123 * MbedSerialのチャネル2(チャネル番号は0から始まるので,ポート3のこと)に, 124 * SIOPortTarget3はMbedSerialのチャネル0につながっている. 162 125 */ 163 126 [prototype] 164 127 cell tSIOPortGRCitrus SIOPortTarget1 { 165 128 /* 属性の設定 */ 166 baseAddress = C_EXP("SCI0_BASE"); 167 rxInterruptNumber = C_EXP("INT_SCI0_RXI"); 168 txInterruptNumber = C_EXP("INT_SCI0_TEI"); 129 tx = C_EXP("P20"); /* PIN_IO0 */ 130 rx = C_EXP("P21"); /* PIN_IO1 */ 169 131 }; 170 132 … … 172 134 cell tSIOPortGRCitrus SIOPortTarget2 { 173 135 /* 属性の設定 */ 174 baseAddress = C_EXP("SCI1_BASE"); 175 rxInterruptNumber = C_EXP("INT_SCI1_RXI"); 176 txInterruptNumber = C_EXP("INT_SCI1_TEI"); 136 tx = C_EXP("P50"); /* PIN_IO5 */ 137 rx = C_EXP("P52"); /* PIN_IO6 */ 177 138 }; 178 139 … … 180 141 cell tSIOPortGRCitrus SIOPortTarget3 { 181 142 /* 属性の設定 */ 182 baseAddress = C_EXP("SCI2_BASE"); 183 rxInterruptNumber = C_EXP("INT_SCI2_RXI"); 184 txInterruptNumber = C_EXP("INT_SCI2_TEI"); 143 tx = C_EXP("P32"); /* PIN_IO7 */ 144 rx = C_EXP("P33"); /* PIN_IO8 */ 185 145 }; 186 146 … … 188 148 cell tSIOPortGRCitrus SIOPortTarget4 { 189 149 /* 属性の設定 */ 190 baseAddress = C_EXP("SCI3_BASE"); 191 rxInterruptNumber = C_EXP("INT_SCI3_RXI"); 192 txInterruptNumber = C_EXP("INT_SCI3_TEI"); 150 tx = C_EXP("PC7"); /* PIN_IO12 */ 151 rx = C_EXP("PC6"); /* PIN_IO11 */ 193 152 }; 194 153 … … 196 155 cell tSIOPortGRCitrus SIOPortTarget5 { 197 156 /* 属性の設定 */ 198 baseAddress = C_EXP("SCI4_BASE"); 199 rxInterruptNumber = C_EXP("INT_SCI4_RXI"); 200 txInterruptNumber = C_EXP("INT_SCI4_TEI"); 157 tx = C_EXP("P26"); /* PIN_IO26 */ 158 rx = C_EXP("P30"); /* PIN_IO22 */ 201 159 }; 202 160 … … 204 162 cell tSIOPortGRCitrus SIOPortTarget6 { 205 163 /* 属性の設定 */ 206 baseAddress = C_EXP("SCI5_BASE"); 207 rxInterruptNumber = C_EXP("INT_SCI5_RXI"); 208 txInterruptNumber = C_EXP("INT_SCI5_TEI"); 164 tx = C_EXP("PB5"); /* PIN_IO29 */ 165 rx = C_EXP("P25"); /* PIN_IO23 */ 209 166 }; 210 167 … … 212 169 cell tSIOPortGRCitrus SIOPortTarget7 { 213 170 /* 属性の設定 */ 214 baseAddress = C_EXP("SCI6_BASE"); 215 rxInterruptNumber = C_EXP("INT_SCI6_RXI"); 216 txInterruptNumber = C_EXP("INT_SCI6_TEI"); 171 tx = C_EXP("PA0"); /* PIN_IO33 */ 172 rx = C_EXP("PC2"); /* PIN_IO4 */ 217 173 }; 218 174 … … 220 176 cell tSIOPortGRCitrus SIOPortTarget8 { 221 177 /* 属性の設定 */ 222 baseAddress = NULL; 223 rxInterruptNumber = NULL; 224 txInterruptNumber = NULL; 178 rx = NULL; 179 tx = NULL; 225 180 }; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/tSIOPortGRCitrusMain_inline.h
r337 r374 57 57 */ 58 58 cSIOPort_open(); 59 60 /*61 * SIOの割込みマスクを解除する.62 */63 cRxInterruptRequest_enable();64 cTxInterruptRequest_enable();65 59 } 66 60 … … 77 71 */ 78 72 cSIOPort_close(); 79 80 /*81 * SIOの割込みをマスクする.82 */83 cRxInterruptRequest_disable();84 cTxInterruptRequest_disable();85 73 } 86 74 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_kernel_impl.c
r364 r374 53 53 #include "syssvc/serial.h" 54 54 #ifdef TOPPERS_OMIT_TECS 55 #include "rx630_uart.h" 55 #include "serial_api.h" 56 #endif 57 58 #ifdef TOPPERS_OMIT_TECS 59 serial_t log_serial; 56 60 #endif 57 61 … … 75 79 sil_reb_mem(PORTA_PDR_ADDR) & ~PORT_PDR_B7_BIT); 76 80 81 #ifdef TOPPERS_OMIT_TECS 77 82 /* 78 83 * シリアルポートの設定 79 84 */ 80 81 /* ポートP20をTxD0, ポートP21をRxD0に */ 82 sil_wrb_mem(PORT2_PMR_ADDR, 0x03); 83 84 /* データディレクションレジスタ(PDR)の設定 P21(RxD0)を入力ポートにする */ 85 sil_wrb_mem(PORT2_PDR_ADDR, 86 sil_reb_mem(PORT2_PDR_ADDR) & ~PORT_PDR_B1_BIT); 87 88 /* データディレクションレジスタ(PDR)の設定 P20(TxD0)を出力ポートにする */ 89 sil_wrb_mem(PORT2_PDR_ADDR, 90 sil_reb_mem(PORT2_PDR_ADDR) | PORT_PDR_B0_BIT); 85 serial_init(&log_serial, P20, P21); 86 serial_baud(&log_serial, UART_BAUDRATE); 87 serial_format(&log_serial, 8, ParityNone, 1); 88 #endif 91 89 92 90 /* ポートP40~P47を周辺機器に */ … … 149 147 { 150 148 if (c == '\n') { 151 rx630_uart_pol_putc('\r', TARGET_PUTC_PORTID);149 serial_putc(&log_serial, '\r'); 152 150 } 153 151 154 rx630_uart_pol_putc(c, TARGET_PUTC_PORTID);152 serial_putc(&log_serial, c); 155 153 } 156 154 #endif -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_serial.c
r337 r374 3 3 * Toyohashi Open Platform for Embedded Real-Time Systems/ 4 4 * Advanced Standard Profile Kernel 5 * 5 * 6 6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory 7 7 * Toyohashi Univ. of Technology, JAPAN … … 12 12 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN 13 13 * Copyright (C) 2013 by Mitsuhiro Matsuura 14 * 14 * 15 15 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ 16 16 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 … … 35 35 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを 36 36 * 免責すること. 37 * 37 * 38 38 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お 39 39 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 … … 41 41 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ 42 42 * の責任を負わない. 43 * 43 * 44 44 * @(#) $Id$ 45 45 */ … … 51 51 #include <sil.h> 52 52 #include "target_serial.h" 53 #include "hal/serial_api.h" 54 #include "target_syssvc.h" 55 #include "syssvc/serial.h" 56 57 /* 58 * シリアルI/Oポート初期化ブロックの定義 59 */ 60 typedef struct sio_port_initialization_block { 61 PinName tx; 62 PinName rx; 63 } SIOPINIB; 64 65 /* 66 * シリアルI/Oポート管理ブロックの定義 67 */ 68 struct sio_port_control_block { 69 const SIOPINIB *p_siopinib; 70 intptr_t exinf; 71 bool_t openflag; 72 serial_t serial; 73 }; 74 75 /* 76 * シリアルI/Oポート管理ブロックのエリア 77 */ 78 SIOPCB siopcb_table[TNUM_PORT]; 79 80 static const SIOPINIB siopinib_table[TNUM_SIOP] = 81 { 82 { P20, P21 }, 83 #if TNUM_SIOP > 1 84 { P50, P52 }, 85 #endif 86 #if TNUM_SIOP > 2 87 { P32, P33 }, 88 #endif 89 #if TNUM_SIOP > 3 90 { PC7, PC6 }, 91 #endif 92 #if TNUM_SIOP > 4 93 { P26, P30 }, 94 #endif 95 #if TNUM_SIOP > 5 96 { PB5, P25 }, 97 #endif 98 #if TNUM_SIOP > 6 99 { PA0, PC2 }, 100 #endif 101 }; 102 103 /* 104 * シリアルI/OポートIDから管理ブロックを取り出すためのマクロ 105 */ 106 #define INDEX_SIOP(siopid) ((uint_t)((siopid) - 1)) 107 #define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)])) 108 #define get_siopinib(siopid) (&(siopinib_table[INDEX_SIOP(siopid)])) 109 110 static void mbed_serial_irq_handler(uint32_t id, SerialIrq event); 53 111 54 112 /* … … 58 116 sio_initialize(intptr_t exinf) 59 117 { 60 rx630_uart_initialize(); 118 SIOPCB *p_siopcb; 119 uint_t i; 120 121 /* 122 * シリアルI/Oポート管理ブロックの初期化 123 */ 124 for (p_siopcb = siopcb_table, i = 0; i < TNUM_SIOP; p_siopcb++, i++) { 125 p_siopcb->p_siopinib = &(siopinib_table[i]); 126 p_siopcb->openflag = false; 127 } 61 128 } 62 129 … … 69 136 SIOPCB *p_siopcb = NULL; 70 137 ER ercd; 71 INTNO intno_sio_tx, intno_sio_rx; 72 73 /* 74 * シリアルI/O割込みをマスクする. 75 * (dis_int関数は、"\kernel\interrupt.c"に記述) 76 */ 77 p_siopcb = rx630_uart_get_siopcb(siopid); 78 intno_sio_tx = rx630_uart_intno_tx(p_siopcb); 79 intno_sio_rx = rx630_uart_intno_rx(p_siopcb); 80 ercd = dis_int(intno_sio_tx); 81 assert(ercd == E_OK); 82 ercd = dis_int(intno_sio_rx); 83 assert(ercd == E_OK); 84 85 p_siopcb = 86 rx630_uart_opn_por(siopid , exinf , UART_BAUDRATE , UART_CLKSRC); 87 88 /* 89 * シリアルI/O割込みをマスク解除する. 90 * (ena_int関数は、"\kernel\interrupt.c"に記述) 91 */ 92 ercd = ena_int(intno_sio_tx); 93 assert(ercd == E_OK); 94 ercd = ena_int(intno_sio_rx); 95 assert(ercd == E_OK); 96 97 return(p_siopcb); 138 serial_t *serial; 139 140 if ((siopid <= 0) || (siopid > (sizeof(siopcb_table) / sizeof(siopcb_table[0])))) 141 return NULL; 142 p_siopcb = get_siopcb(siopid); 143 144 if (p_siopcb->openflag) 145 return NULL; 146 p_siopcb->openflag = true; 147 p_siopcb->exinf = exinf; 148 149 serial = &p_siopcb->serial; 150 serial_init(serial, p_siopcb->p_siopinib->tx, p_siopcb->p_siopinib->rx); 151 serial_baud(serial, UART_BAUDRATE); 152 serial_format(serial, 8, ParityNone, 1); 153 154 serial_irq_handler(serial, mbed_serial_irq_handler, siopid); 155 156 return p_siopcb; 98 157 } 99 158 … … 105 164 { 106 165 ER ercd; 107 INTNO intno_sio_tx, intno_sio_rx;166 serial_t *serial = &p_siopcb->serial; 108 167 109 168 /* 110 169 * デバイス依存のクローズ処理. 111 170 */ 112 rx630_uart_cls_por(p_siopcb); 113 114 /* 115 * シリアルI/O割込みをマスクする. 116 */ 117 intno_sio_tx = rx630_uart_intno_tx(p_siopcb); 118 intno_sio_rx = rx630_uart_intno_rx(p_siopcb); 119 ercd = dis_int(intno_sio_tx); 120 assert(ercd == E_OK); 121 ercd = dis_int(intno_sio_rx); 122 assert(ercd == E_OK); 171 serial_free(serial); 172 p_siopcb->openflag = false; 173 } 174 175 /* 176 * シリアルI/Oポートへの文字送信 177 */ 178 bool_t 179 sio_snd_chr(SIOPCB *p_siopcb, char c) 180 { 181 serial_t *serial = &p_siopcb->serial; 182 if (!serial_writable(serial)) 183 return false; 184 serial_putc(serial, c); 185 return true; 186 } 187 188 /* 189 * シリアルI/Oポートからの文字受信 190 */ 191 int_t 192 sio_rcv_chr(SIOPCB *p_siopcb) 193 { 194 serial_t *serial = &p_siopcb->serial; 195 if (!serial_readable(serial)) 196 return -1; 197 return serial_getc(serial); 198 } 199 200 /* 201 * シリアルI/Oポートからのコールバックの許可 202 */ 203 void 204 sio_ena_cbr(SIOPCB *p_siopcb, uint_t cbrtn) 205 { 206 serial_t *serial = &p_siopcb->serial; 207 switch (cbrtn) { 208 case SIO_RDY_SND: 209 serial_irq_set(serial, TxIrq, true); 210 break; 211 case SIO_RDY_RCV: 212 serial_irq_set(serial, RxIrq, true); 213 break; 214 } 215 } 216 217 /* 218 * シリアルI/Oポートからのコールバックの禁止 219 */ 220 void 221 sio_dis_cbr(SIOPCB *p_siopcb, uint_t cbrtn) 222 { 223 serial_t *serial = &p_siopcb->serial; 224 switch (cbrtn) { 225 case SIO_RDY_SND: 226 serial_irq_set(serial, TxIrq, false); 227 break; 228 case SIO_RDY_RCV: 229 serial_irq_set(serial, RxIrq, false); 230 break; 231 } 232 } 233 234 /* 235 * シリアルI/Oポートからの送信可能コールバック 236 */ 237 void 238 serial_irdy_snd(SIOPCB *p_siopcb) 239 { 240 /* 共通部(syssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/ 241 sio_irdy_snd(p_siopcb->exinf); 242 } 243 244 /* 245 * シリアルI/Oポートからの受信通知コールバック 246 */ 247 void 248 serial_irdy_rcv(SIOPCB *p_siopcb) 249 { 250 /* 共通部(syssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/ 251 sio_irdy_rcv(p_siopcb->exinf); 123 252 } 124 253 … … 126 255 * SIOの割込みハンドラ 127 256 */ 128 void sio_tx_isr(intptr_t exinf) 129 { 130 rx630_uart_tx_isr(exinf); 131 } 132 133 /* 134 * SIOの割込みハンドラ 135 */ 136 void sio_rx_isr(intptr_t exinf) 137 { 138 rx630_uart_rx_isr(exinf); 139 } 140 141 /* 142 * シリアルI/Oポートへの文字送信 143 */ 144 bool_t 145 sio_snd_chr(SIOPCB *siopcb, char c) 146 { 147 return(rx630_uart_snd_chr(siopcb, c)); 148 } 149 150 /* 151 * シリアルI/Oポートからの文字受信 152 */ 153 int_t 154 sio_rcv_chr(SIOPCB *siopcb) 155 { 156 return(rx630_uart_rcv_chr(siopcb)); 157 } 158 159 /* 160 * シリアルI/Oポートからのコールバックの許可 161 */ 162 void 163 sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn) 164 { 165 rx630_uart_ena_cbr(siopcb, cbrtn); 166 } 167 168 /* 169 * シリアルI/Oポートからのコールバックの禁止 170 */ 171 void 172 sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn) 173 { 174 rx630_uart_dis_cbr(siopcb, cbrtn); 175 } 176 177 /* 178 * シリアルI/Oポートからの送信可能コールバック 179 */ 180 void 181 rx630_uart_irdy_snd(intptr_t exinf) 182 { 183 /* 共通部(syssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/ 184 sio_irdy_snd(exinf); 185 } 186 187 /* 188 * シリアルI/Oポートからの受信通知コールバック 189 */ 190 void 191 rx630_uart_irdy_rcv(intptr_t exinf) 192 { 193 /* 共通部(syssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/ 194 sio_irdy_rcv(exinf); 195 } 196 257 void 258 mbed_serial_irq_handler(uint32_t siopid, SerialIrq event) 259 { 260 SIOPCB *p_siopcb; 261 262 if ((siopid <= 0) || (siopid > (sizeof(siopcb_table) / sizeof(siopcb_table[0])))) 263 return; 264 p_siopcb = get_siopcb(siopid); 265 266 if (!p_siopcb->openflag) 267 return; 268 269 switch (event) { 270 case TxIrq: 271 serial_irdy_snd(p_siopcb); 272 break; 273 case RxIrq: 274 serial_irdy_rcv(p_siopcb); 275 break; 276 } 277 } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_serial.cfg
r337 r374 4 4 5 5 #include <target_serial.h> 6 6 7 ATT_INI({ TA_NULL, 0, sio_initialize }); 7 CFG_INT(INTNO_SIO_TX, { INTATR_SIO, INTPRI_SIO });8 CFG_INT(INTNO_SIO_RX, { INTATR_SIO, INTPRI_SIO });9 8 10 CRE_ISR(INTNO_SIO_TX_ISR, {TA_NULL, SIO_PORTID, INTNO_SIO_TX, sio_tx_isr, 1});11 CRE_ISR(INTNO_SIO_RX_ISR, {TA_NULL, SIO_PORTID, INTNO_SIO_RX, sio_rx_isr, 1}); -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_serial.h
r337 r374 53 53 54 54 #include "gr_citrus.h" 55 #include " rx630_uart.h"55 #include "serial_api.h" 56 56 57 /* 58 * SIOの割込みハンドラのベクタ番号 59 */ 60 #define INHNO_SIO_TX INT_SCI1_TEI /* 割込みハンドラ番号 */ 61 #define INTNO_SIO_TX INT_SCI1_TEI /* 割込み番号 */ 62 #define INHNO_SIO_RX INT_SCI1_RXI /* 割込みハンドラ番号 */ 63 #define INTNO_SIO_RX INT_SCI1_RXI /* 割込み番号 */ 64 #define INTPRI_SIO -4 /* 割込み優先度 */ 65 #define INTATR_SIO (TA_NULL) /* 割込み属性 */ 57 #define SIO_RDY_SND 1 58 #define SIO_RDY_RCV 2 66 59 67 60 #ifndef TOPPERS_MACRO_ONLY 68 61 62 typedef struct sio_port_control_block SIOPCB; 69 63 70 64 /* … … 82 76 */ 83 77 extern void sio_cls_por(SIOPCB *p_siopcb); 84 85 /*86 * SIOの割込みハンドラ87 */88 extern void sio_tx_isr(intptr_t exinf);89 extern void sio_rx_isr(intptr_t exinf);90 78 91 79 /* -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_citrus_gcc/target_syssvc.h
r337 r374 113 113 114 114 /* 115 * 使用するシリアルポートのPinName 116 */ 117 #define STDIO_UART_TX P20 118 #define STDIO_UART_RX P21 119 120 /* 115 121 * システムログタスク関連の定数の定義 116 122 * -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/Makefile.target
r337 r374 13 13 # コンパイルオプション 14 14 # 15 INCLUDES := $(INCLUDES) -I$(TARGETDIR) -I$(SRCDIR)/ pdic15 INCLUDES := $(INCLUDES) -I$(TARGETDIR) -I$(SRCDIR)/mbed 16 16 17 17 # … … 25 25 # システムサービスに関する定義 26 26 # 27 SYSSVC_DIRS := $(SYSSVC_DIRS) 27 SYSSVC_DIRS := $(SYSSVC_DIRS) $(SRCDIR)/mbed 28 28 SYSSVC_COBJS := $(SYSSVC_COBJS) 29 29 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/gr_sakura.h
r337 r374 71 71 * ボーレート設定 72 72 */ 73 #define BAUD_19200BPS UINT_C( 78 ) 74 #define BAUD_38400BPS UINT_C( 39 ) 75 #define BAUD_57600BPS UINT_C( 25 ) 76 #define BAUD_115200BPS UINT_C( 12 ) 77 78 #define UART_BAUDRATE BAUD_115200BPS 73 #define UART_BAUDRATE 115200 79 74 80 75 /* -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/tSIOPortGRSakura.cdl
r337 r374 51 51 */ 52 52 import_C("gr_sakura.h"); 53 import_C(" rx630.h");53 import_C("device.h"); 54 54 55 55 /* 56 56 * FIFO内蔵シリアルコミュニケーションインタフェース用 簡易SIOドライバ 57 57 */ 58 import("t SCIF.cdl");58 import("tMbedSerial.cdl"); 59 59 60 60 /* … … 74 74 call sSIOPort cSIOPort; 75 75 [inline] entry siSIOCBR eiSIOCBR; 76 77 /*78 * 割込み要求ライン操作のための結合79 */80 call sInterruptRequest cRxInterruptRequest;81 call sInterruptRequest cTxInterruptRequest;82 76 }; 83 77 … … 86 80 * ト)のセルタイプ 87 81 */ 88 [active]89 82 composite tSIOPortGRSakura { 90 83 /* … … 98 91 */ 99 92 attr { 100 uintptr_t baseAddress; /* ベースアドレス */ 101 INTNO rxInterruptNumber; /* 受信割込み番号 */ 102 INTNO txInterruptNumber; /* 送信割込み番号 */ 103 PRI isrPriority = 1; /* ISR優先度 */ 104 PRI interruptPriority = -4; /* 割込み優先度 */ 93 int32_t tx; /* 送信Pin */ 94 int32_t rx; /* 受信Pin */ 105 95 uint32_t baudRate = 115200; /* ボーレートの設定値 */ 106 96 }; … … 109 99 * SIOドライバ 110 100 */ 111 cell tSCIF SCIF { 112 baseAddress = composite.baseAddress; 101 cell tMbedSerial MbedSerial { 102 tx = composite.tx; 103 rx = composite.rx; 113 104 baudRate = composite.baudRate; 114 105 ciSIOCBR = SIOPortMain.eiSIOCBR; … … 120 111 cell tSIOPortGRSakuraMain SIOPortMain { 121 112 ciSIOCBR => composite.ciSIOCBR; 122 cSIOPort = SCIF.eSIOPort; 123 cRxInterruptRequest = RxInterruptRequest.eInterruptRequest; 124 cTxInterruptRequest = TxInterruptRequest.eInterruptRequest; 113 cSIOPort = MbedSerial.eSIOPort; 125 114 }; 126 115 composite.eSIOPort => SIOPortMain.eSIOPort; 127 128 /*129 * SIOの受信割込みサービスルーチンと割込み要求ライン130 */131 cell tISR RxISRInstance {132 interruptNumber = composite.rxInterruptNumber;133 isrPriority = composite.isrPriority;134 ciISRBody = SCIF.eiRxISR;135 };136 cell tInterruptRequest RxInterruptRequest {137 interruptNumber = composite.rxInterruptNumber;138 interruptPriority = composite.interruptPriority;139 };140 141 /*142 * SIOの受信割込みサービスルーチンと割込み要求ライン143 */144 cell tISR TxISRInstance {145 interruptNumber = composite.txInterruptNumber;146 isrPriority = composite.isrPriority;147 ciISRBody = SCIF.eiTxISR;148 };149 cell tInterruptRequest TxInterruptRequest {150 interruptNumber = composite.txInterruptNumber;151 interruptPriority = composite.interruptPriority;152 };153 116 }; 154 117 … … 158 121 * サンプルプログラムが使うポートが,SIOPortTarget1に固定されているた 159 122 * め,ポート1とポート3を入れ換えている.具体的には,SIOPortTarget1は 160 * SCIFのチャネル2(チャネル番号は0から始まるので,ポート3のこと)に,161 * SIOPortTarget3は SCIFのチャネル0につながっている.123 * MbedSerialのチャネル2(チャネル番号は0から始まるので,ポート3のこと)に, 124 * SIOPortTarget3はMbedSerialのチャネル0につながっている. 162 125 */ 163 126 [prototype] 164 127 cell tSIOPortGRSakura SIOPortTarget1 { 165 128 /* 属性の設定 */ 166 baseAddress = C_EXP("SCI0_BASE"); 167 rxInterruptNumber = C_EXP("INT_SCI0_RXI"); 168 txInterruptNumber = C_EXP("INT_SCI0_TEI"); 129 tx = C_EXP("P20"); /* PIN_IO1 */ 130 rx = C_EXP("P21"); /* PIN_IO0 */ 169 131 }; 170 132 … … 172 134 cell tSIOPortGRSakura SIOPortTarget2 { 173 135 /* 属性の設定 */ 174 baseAddress = C_EXP("SCI1_BASE"); 175 rxInterruptNumber = C_EXP("INT_SCI1_RXI"); 176 txInterruptNumber = C_EXP("INT_SCI1_TEI"); 136 tx = C_EXP("P32"); /* PIN_IO6 */ 137 rx = C_EXP("P33"); /* PIN_IO7 */ 177 138 }; 178 139 … … 180 141 cell tSIOPortGRSakura SIOPortTarget3 { 181 142 /* 属性の設定 */ 182 baseAddress = C_EXP("SCI2_BASE"); 183 rxInterruptNumber = C_EXP("INT_SCI2_RXI"); 184 txInterruptNumber = C_EXP("INT_SCI2_TEI"); 143 tx = C_EXP("P50"); /* PIN_IO24 */ 144 rx = C_EXP("P52"); /* PIN_IO26 */ 185 145 }; 186 146 … … 188 148 cell tSIOPortGRSakura SIOPortTarget4 { 189 149 /* 属性の設定 */ 190 baseAddress = C_EXP("SCI3_BASE"); 191 rxInterruptNumber = C_EXP("INT_SCI3_RXI"); 192 txInterruptNumber = C_EXP("INT_SCI3_TEI"); 150 tx = C_EXP("P23"); /* PIN_IO3 */ 151 rx = C_EXP("P25"); /* PIN_IO5 */ 193 152 }; 194 153 … … 196 155 cell tSIOPortGRSakura SIOPortTarget5 { 197 156 /* 属性の設定 */ 198 baseAddress = C_EXP("SCI4_BASE"); 199 rxInterruptNumber = C_EXP("INT_SCI4_RXI"); 200 txInterruptNumber = C_EXP("INT_SCI4_TEI"); 157 tx = C_EXP("PC3"); /* PIN_IO9 */ 158 rx = C_EXP("PC2"); /* PIN_IO8 */ 201 159 }; 202 160 … … 204 162 cell tSIOPortGRSakura SIOPortTarget6 { 205 163 /* 属性の設定 */ 206 baseAddress = C_EXP("SCI5_BASE"); 207 rxInterruptNumber = C_EXP("INT_SCI5_RXI"); 208 txInterruptNumber = C_EXP("INT_SCI5_TEI"); 164 tx = C_EXP("PC7"); /* PIN_IO12 */ 165 rx = C_EXP("PC6"); /* PIN_IO11 */ 209 166 }; 210 167 … … 212 169 cell tSIOPortGRSakura SIOPortTarget7 { 213 170 /* 属性の設定 */ 214 baseAddress = C_EXP("SCI6_BASE"); 215 rxInterruptNumber = C_EXP("INT_SCI6_RXI"); 216 txInterruptNumber = C_EXP("INT_SCI6_TEI"); 171 tx = C_EXP("P26"); /* PIN_IO58 */ 172 rx = C_EXP("P30"); /* PIN_IO60 */ 217 173 }; 218 174 … … 220 176 cell tSIOPortGRSakura SIOPortTarget8 { 221 177 /* 属性の設定 */ 222 baseAddress = NULL; 223 rxInterruptNumber = NULL; 224 txInterruptNumber = NULL; 178 tx = NULL; 179 rx = NULL; 225 180 }; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/tSIOPortGRSakuraMain_inline.h
r337 r374 57 57 */ 58 58 cSIOPort_open(); 59 60 /*61 * SIOの割込みマスクを解除する.62 */63 cRxInterruptRequest_enable();64 cTxInterruptRequest_enable();65 59 } 66 60 … … 77 71 */ 78 72 cSIOPort_close(); 79 80 /*81 * SIOの割込みをマスクする.82 */83 cRxInterruptRequest_disable();84 cTxInterruptRequest_disable();85 73 } 86 74 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_kernel_impl.c
r364 r374 53 53 #include "syssvc/serial.h" 54 54 #ifdef TOPPERS_OMIT_TECS 55 #include "rx630_uart.h" 55 #include "serial_api.h" 56 #endif 57 58 #ifdef TOPPERS_OMIT_TECS 59 serial_t log_serial; 56 60 #endif 57 61 … … 78 82 sil_reb_mem(PORTA_PDR_ADDR) & ~PORT_PDR_B7_BIT); 79 83 84 #ifdef TOPPERS_OMIT_TECS 80 85 /* 81 86 * シリアルポートの設定 82 87 */ 83 84 /* ポートP20をTxD0, ポートP21をRxD0に */ 85 sil_wrb_mem(PORT2_PMR_ADDR, 0x03); 86 87 /* データディレクションレジスタ(PDR)の設定 P21(RxD0)を入力ポートにする */ 88 sil_wrb_mem(PORT2_PDR_ADDR, 89 sil_reb_mem(PORT2_PDR_ADDR) & ~PORT_PDR_B1_BIT); 90 91 /* データディレクションレジスタ(PDR)の設定 P20(TxD0)を出力ポートにする */ 92 sil_wrb_mem(PORT2_PDR_ADDR, 93 sil_reb_mem(PORT2_PDR_ADDR) | PORT_PDR_B0_BIT); 88 serial_init(&log_serial, P20, P21); 89 serial_baud(&log_serial, UART_BAUDRATE); 90 serial_format(&log_serial, 8, ParityNone, 1); 91 #endif 94 92 95 93 /* ポートP40~P47を周辺機器に */ … … 152 150 { 153 151 if (c == '\n') { 154 rx630_uart_pol_putc('\r', TARGET_PUTC_PORTID);152 serial_putc(&log_serial, '\r'); 155 153 } 156 154 157 rx630_uart_pol_putc(c, TARGET_PUTC_PORTID);155 serial_putc(&log_serial, c); 158 156 } 159 157 #endif -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_serial.c
r337 r374 3 3 * Toyohashi Open Platform for Embedded Real-Time Systems/ 4 4 * Advanced Standard Profile Kernel 5 * 5 * 6 6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory 7 7 * Toyohashi Univ. of Technology, JAPAN … … 12 12 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN 13 13 * Copyright (C) 2013 by Mitsuhiro Matsuura 14 * 14 * 15 15 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ 16 16 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 … … 35 35 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを 36 36 * 免責すること. 37 * 37 * 38 38 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お 39 39 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 … … 41 41 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ 42 42 * の責任を負わない. 43 * 43 * 44 44 * @(#) $Id$ 45 45 */ … … 51 51 #include <sil.h> 52 52 #include "target_serial.h" 53 #include "hal/serial_api.h" 54 #include "target_syssvc.h" 55 #include "syssvc/serial.h" 56 57 /* 58 * シリアルI/Oポート初期化ブロックの定義 59 */ 60 typedef struct sio_port_initialization_block { 61 PinName tx; 62 PinName rx; 63 } SIOPINIB; 64 65 /* 66 * シリアルI/Oポート管理ブロックの定義 67 */ 68 struct sio_port_control_block { 69 const SIOPINIB *p_siopinib; 70 intptr_t exinf; 71 bool_t openflag; 72 serial_t serial; 73 }; 74 75 /* 76 * シリアルI/Oポート管理ブロックのエリア 77 */ 78 SIOPCB siopcb_table[TNUM_PORT]; 79 80 static const SIOPINIB siopinib_table[TNUM_SIOP] = 81 { 82 { P20, P21 }, 83 #if TNUM_SIOP > 1 84 { P32, P33 }, 85 #endif 86 #if TNUM_SIOP > 2 87 { P50, P52 }, 88 #endif 89 #if TNUM_SIOP > 3 90 { P23, P25 }, 91 #endif 92 #if TNUM_SIOP > 4 93 { PC3, PC2 }, 94 #endif 95 #if TNUM_SIOP > 5 96 { PC7, PC6 }, 97 #endif 98 #if TNUM_SIOP > 6 99 { P26, P30 }, 100 #endif 101 }; 102 103 /* 104 * シリアルI/OポートIDから管理ブロックを取り出すためのマクロ 105 */ 106 #define INDEX_SIOP(siopid) ((uint_t)((siopid) - 1)) 107 #define get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)])) 108 #define get_siopinib(siopid) (&(siopinib_table[INDEX_SIOP(siopid)])) 109 110 static void mbed_serial_irq_handler(uint32_t id, SerialIrq event); 53 111 54 112 /* … … 58 116 sio_initialize(intptr_t exinf) 59 117 { 60 rx630_uart_initialize(); 118 SIOPCB *p_siopcb; 119 uint_t i; 120 121 /* 122 * シリアルI/Oポート管理ブロックの初期化 123 */ 124 for (p_siopcb = siopcb_table, i = 0; i < TNUM_SIOP; p_siopcb++, i++) { 125 p_siopcb->p_siopinib = &(siopinib_table[i]); 126 p_siopcb->openflag = false; 127 } 61 128 } 62 129 … … 69 136 SIOPCB *p_siopcb = NULL; 70 137 ER ercd; 71 INTNO intno_sio_tx, intno_sio_rx; 72 73 /* 74 * シリアルI/O割込みをマスクする. 75 * (dis_int関数は、"\kernel\interrupt.c"に記述) 76 */ 77 p_siopcb = rx630_uart_get_siopcb(siopid); 78 intno_sio_tx = rx630_uart_intno_tx(p_siopcb); 79 intno_sio_rx = rx630_uart_intno_rx(p_siopcb); 80 ercd = dis_int(intno_sio_tx); 81 assert(ercd == E_OK); 82 ercd = dis_int(intno_sio_rx); 83 assert(ercd == E_OK); 84 85 p_siopcb = 86 rx630_uart_opn_por(siopid , exinf , UART_BAUDRATE , UART_CLKSRC); 87 88 /* 89 * シリアルI/O割込みをマスク解除する. 90 * (ena_int関数は、"\kernel\interrupt.c"に記述) 91 */ 92 ercd = ena_int(intno_sio_tx); 93 assert(ercd == E_OK); 94 ercd = ena_int(intno_sio_rx); 95 assert(ercd == E_OK); 96 97 return(p_siopcb); 138 serial_t *serial; 139 140 if ((siopid <= 0) || (siopid > (sizeof(siopcb_table) / sizeof(siopcb_table[0])))) 141 return NULL; 142 p_siopcb = get_siopcb(siopid); 143 144 if (p_siopcb->openflag) 145 return NULL; 146 p_siopcb->openflag = true; 147 p_siopcb->exinf = exinf; 148 149 serial = &p_siopcb->serial; 150 serial_init(serial, p_siopcb->p_siopinib->tx, p_siopcb->p_siopinib->rx); 151 serial_baud(serial, UART_BAUDRATE); 152 serial_format(serial, 8, ParityNone, 1); 153 154 serial_irq_handler(serial, mbed_serial_irq_handler, siopid); 155 156 return p_siopcb; 98 157 } 99 158 … … 105 164 { 106 165 ER ercd; 107 INTNO intno_sio_tx, intno_sio_rx;166 serial_t *serial = &p_siopcb->serial; 108 167 109 168 /* 110 169 * デバイス依存のクローズ処理. 111 170 */ 112 rx630_uart_cls_por(p_siopcb); 113 114 /* 115 * シリアルI/O割込みをマスクする. 116 */ 117 intno_sio_tx = rx630_uart_intno_tx(p_siopcb); 118 intno_sio_rx = rx630_uart_intno_rx(p_siopcb); 119 ercd = dis_int(intno_sio_tx); 120 assert(ercd == E_OK); 121 ercd = dis_int(intno_sio_rx); 122 assert(ercd == E_OK); 171 serial_free(serial); 172 p_siopcb->openflag = false; 173 } 174 175 /* 176 * シリアルI/Oポートへの文字送信 177 */ 178 bool_t 179 sio_snd_chr(SIOPCB *p_siopcb, char c) 180 { 181 serial_t *serial = &p_siopcb->serial; 182 if (!serial_writable(serial)) 183 return false; 184 serial_putc(serial, c); 185 return true; 186 } 187 188 /* 189 * シリアルI/Oポートからの文字受信 190 */ 191 int_t 192 sio_rcv_chr(SIOPCB *p_siopcb) 193 { 194 serial_t *serial = &p_siopcb->serial; 195 if (!serial_readable(serial)) 196 return -1; 197 return serial_getc(serial); 198 } 199 200 /* 201 * シリアルI/Oポートからのコールバックの許可 202 */ 203 void 204 sio_ena_cbr(SIOPCB *p_siopcb, uint_t cbrtn) 205 { 206 serial_t *serial = &p_siopcb->serial; 207 switch (cbrtn) { 208 case SIO_RDY_SND: 209 serial_irq_set(serial, TxIrq, true); 210 break; 211 case SIO_RDY_RCV: 212 serial_irq_set(serial, RxIrq, true); 213 break; 214 } 215 } 216 217 /* 218 * シリアルI/Oポートからのコールバックの禁止 219 */ 220 void 221 sio_dis_cbr(SIOPCB *p_siopcb, uint_t cbrtn) 222 { 223 serial_t *serial = &p_siopcb->serial; 224 switch (cbrtn) { 225 case SIO_RDY_SND: 226 serial_irq_set(serial, TxIrq, false); 227 break; 228 case SIO_RDY_RCV: 229 serial_irq_set(serial, RxIrq, false); 230 break; 231 } 232 } 233 234 /* 235 * シリアルI/Oポートからの送信可能コールバック 236 */ 237 void 238 serial_irdy_snd(SIOPCB *p_siopcb) 239 { 240 /* 共通部(syssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/ 241 sio_irdy_snd(p_siopcb->exinf); 242 } 243 244 /* 245 * シリアルI/Oポートからの受信通知コールバック 246 */ 247 void 248 serial_irdy_rcv(SIOPCB *p_siopcb) 249 { 250 /* 共通部(syssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/ 251 sio_irdy_rcv(p_siopcb->exinf); 123 252 } 124 253 … … 126 255 * SIOの割込みハンドラ 127 256 */ 128 void sio_tx_isr(intptr_t exinf) 129 { 130 rx630_uart_tx_isr(exinf); 131 } 132 133 /* 134 * SIOの割込みハンドラ 135 */ 136 void sio_rx_isr(intptr_t exinf) 137 { 138 rx630_uart_rx_isr(exinf); 139 } 140 141 /* 142 * シリアルI/Oポートへの文字送信 143 */ 144 bool_t 145 sio_snd_chr(SIOPCB *siopcb, char c) 146 { 147 return(rx630_uart_snd_chr(siopcb, c)); 148 } 149 150 /* 151 * シリアルI/Oポートからの文字受信 152 */ 153 int_t 154 sio_rcv_chr(SIOPCB *siopcb) 155 { 156 return(rx630_uart_rcv_chr(siopcb)); 157 } 158 159 /* 160 * シリアルI/Oポートからのコールバックの許可 161 */ 162 void 163 sio_ena_cbr(SIOPCB *siopcb, uint_t cbrtn) 164 { 165 rx630_uart_ena_cbr(siopcb, cbrtn); 166 } 167 168 /* 169 * シリアルI/Oポートからのコールバックの禁止 170 */ 171 void 172 sio_dis_cbr(SIOPCB *siopcb, uint_t cbrtn) 173 { 174 rx630_uart_dis_cbr(siopcb, cbrtn); 175 } 176 177 /* 178 * シリアルI/Oポートからの送信可能コールバック 179 */ 180 void 181 rx630_uart_irdy_snd(intptr_t exinf) 182 { 183 /* 共通部(syssvc\serial.c)にあるsio_irdy_snd関数を呼び出し*/ 184 sio_irdy_snd(exinf); 185 } 186 187 /* 188 * シリアルI/Oポートからの受信通知コールバック 189 */ 190 void 191 rx630_uart_irdy_rcv(intptr_t exinf) 192 { 193 /* 共通部(syssvc\serial.c)にあるsio_irdy_rcv関数を呼び出し*/ 194 sio_irdy_rcv(exinf); 195 } 196 257 void 258 mbed_serial_irq_handler(uint32_t siopid, SerialIrq event) 259 { 260 SIOPCB *p_siopcb; 261 262 if ((siopid <= 0) || (siopid > (sizeof(siopcb_table) / sizeof(siopcb_table[0])))) 263 return; 264 p_siopcb = get_siopcb(siopid); 265 266 if (!p_siopcb->openflag) 267 return; 268 269 switch (event) { 270 case TxIrq: 271 serial_irdy_snd(p_siopcb); 272 break; 273 case RxIrq: 274 serial_irdy_rcv(p_siopcb); 275 break; 276 } 277 } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_serial.cfg
r337 r374 4 4 5 5 #include <target_serial.h> 6 6 7 ATT_INI({ TA_NULL, 0, sio_initialize }); 7 CFG_INT(INTNO_SIO_TX, { INTATR_SIO, INTPRI_SIO });8 CFG_INT(INTNO_SIO_RX, { INTATR_SIO, INTPRI_SIO });9 8 10 CRE_ISR(INTNO_SIO_TX_ISR, {TA_NULL, SIO_PORTID, INTNO_SIO_TX, sio_tx_isr, 1});11 CRE_ISR(INTNO_SIO_RX_ISR, {TA_NULL, SIO_PORTID, INTNO_SIO_RX, sio_rx_isr, 1}); -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_serial.h
r337 r374 53 53 54 54 #include "gr_sakura.h" 55 #include " rx630_uart.h"55 #include "serial_api.h" 56 56 57 /* 58 * SIOの割込みハンドラのベクタ番号 59 */ 60 #define INHNO_SIO_TX INT_SCI0_TEI /* 割込みハンドラ番号 */ 61 #define INTNO_SIO_TX INT_SCI0_TEI /* 割込み番号 */ 62 #define INHNO_SIO_RX INT_SCI0_RXI /* 割込みハンドラ番号 */ 63 #define INTNO_SIO_RX INT_SCI0_RXI /* 割込み番号 */ 64 #define INTPRI_SIO -4 /* 割込み優先度 */ 65 #define INTATR_SIO (TA_NULL) /* 割込み属性 */ 57 #define SIO_RDY_SND 1 58 #define SIO_RDY_RCV 2 66 59 67 60 #ifndef TOPPERS_MACRO_ONLY 68 61 62 typedef struct sio_port_control_block SIOPCB; 69 63 70 64 /* … … 82 76 */ 83 77 extern void sio_cls_por(SIOPCB *p_siopcb); 84 85 /*86 * SIOの割込みハンドラ87 */88 extern void sio_tx_isr(intptr_t exinf);89 extern void sio_rx_isr(intptr_t exinf);90 78 91 79 /* -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/target/gr_sakura_gcc/target_syssvc.h
r337 r374 113 113 114 114 /* 115 * 使用するシリアルポートのPinName 116 */ 117 #define STDIO_UART_TX P20 118 #define STDIO_UART_RX P21 119 120 /* 115 121 * システムログタスク関連の定数の定義 116 122 * -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/MANIFEST_tecsgen_body
r337 r374 1 1 MANIFEST_tecsgen_body 2 2 3 Makefile 3 4 tecscde 5 tecscde.rb 6 tecsgen 7 tecsgen.rb 8 tecsgen_rcov.rb 9 tecsmerge 10 tecsmerge.rb 4 11 cdelib/Makefile 5 12 cdelib/cell_plugin_dialog.rb … … 11 18 cdelib/tview.rb 12 19 cdelib/version.rb 13 14 20 tecs/TECSInfo/TECSInfo.cdl 21 tecs/TECSInfo/TECSInfoAccessor.cdl 15 22 tecs/TECSInfo/nTECSInfo_tArrayTypeInfo.c 16 tecs/TECSInfo/nTECSInfo_tAttrVarInfo.c17 23 tecs/TECSInfo/nTECSInfo_tBoolTypeInfo.c 18 24 tecs/TECSInfo/nTECSInfo_tCallInfo.c … … 28 34 tecs/TECSInfo/nTECSInfo_tParamInfo.c 29 35 tecs/TECSInfo/nTECSInfo_tPtrTypeInfo.c 36 tecs/TECSInfo/nTECSInfo_tRawEntryDescriptorInfo.c 30 37 tecs/TECSInfo/nTECSInfo_tRegionInfo.c 31 38 tecs/TECSInfo/nTECSInfo_tSignatureInfo.c 32 39 tecs/TECSInfo/nTECSInfo_tStructTypeInfo.c 40 tecs/TECSInfo/nTECSInfo_tTECSInfoAccessor.c 33 41 tecs/TECSInfo/nTECSInfo_tTECSInfoSub.c 34 42 tecs/TECSInfo/nTECSInfo_tTECSInfo_inline.h … … 36 44 tecs/TECSInfo/nTECSInfo_tVarDeclInfo.c 37 45 tecs/TECSInfo/nTECSInfo_tVoidTypeInfo.c 46 tecs/TECSInfo/tTECSInfoAccessor.c 38 47 tecs/TLSFMalloc/README-TLSF.txt 39 48 tecs/TLSFMalloc/tTLSFMalloc.cdl … … 61 70 tecs/mruby/nMruby_tMruby.c 62 71 tecs/mruby/nMruby_tMrubyCyclicTaskBody.c 72 tecs/mruby/nMruby_tMrubyProc.c 63 73 tecs/mruby/nMruby_tMrubyTaskBody.c 64 74 tecs/mruby/nMruby_tMrubyVM.c … … 87 97 tecs/rpc/tDataqueueAdaptor_inline.h 88 98 tecs/rpc/tDataqueueOWChannel.cdl 99 tecs/rpc/tMessageBufferCEP.cdl 100 tecs/rpc/tMessageBufferCEP_inline.h 101 tecs/rpc/tMessageBufferChannel.cdl 89 102 tecs/rpc/tNBOTDR_inline.h 90 103 tecs/rpc/tPPAllocator.c … … 105 118 tecs/tecs.h 106 119 tecs/tecs.xsd 107 108 tecscde109 tecscde.rb110 tecsgen111 tecsgen.rb112 tecsgen_rcov113 tecsgen_rcov.rb114 120 tecslib/core/C_parser.tab.rb 115 121 tecslib/core/C_parser.y.rb … … 132 138 tecslib/core/tool_info.rb 133 139 tecslib/core/types.rb 140 tecslib/core/unjoin_plugin.rb 134 141 tecslib/core/value.rb 135 142 tecslib/messages/messages_console_en_US.rb … … 165 172 tecslib/plugin/HRP2SemaphorePlugin.rb 166 173 tecslib/plugin/HRP2TaskPlugin.rb 174 tecslib/plugin/HRPHandlerPlugin.rb 175 tecslib/plugin/HRPKernelObjectManager.rb 176 tecslib/plugin/HRPKernelObjectPlugin.rb 177 tecslib/plugin/HRPObjectPlugin.rb 178 tecslib/plugin/HRPPlugin.rb 179 tecslib/plugin/HRPRPCPlugin.rb 180 tecslib/plugin/HRPSVCPlugin.rb 181 tecslib/plugin/HRPTaskPlugin.rb 167 182 tecslib/plugin/Mruby2CBridgePlugin.rb 168 183 tecslib/plugin/MrubyBridgeCellPlugin.rb 169 184 tecslib/plugin/MrubyBridgeCelltypePlugin.rb 185 tecslib/plugin/MrubyBridgeCompositePlugin.rb 170 186 tecslib/plugin/MrubyBridgePlugin.rb 171 187 tecslib/plugin/MrubyBridgeSignaturePlugin.rb … … 175 191 tecslib/plugin/OpaqueRPCPlugin.rb 176 192 tecslib/plugin/RPCPlugin.rb 193 tecslib/plugin/RepeatCellPlugin.rb 194 tecslib/plugin/RepeatJoinPlugin.rb 177 195 tecslib/plugin/SharedOpaqueRPCPlugin.rb 178 196 tecslib/plugin/SharedRPCPlugin.rb … … 186 204 tecslib/plugin/lib/GenParamCopy.rb 187 205 tecslib/plugin/lib/GenTransparentMarshaler.rb 206 tecslib/plugin/lib/MrubyBridgeCelltypePluginModule.rb 188 207 tecslib/version.rb 189 190 tecsmerge191 tecsmerge.rb -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecs/mruby/TECSPointer.h
r359 r374 102 102 { \ 103 103 if( sizeof( type ) > sizeof( mrb_int ) ){ \ 104 if( val > = (((type)1) << (sizeof(mrb_int)*8-1))\105 || val < -(((type)1) << (sizeof(mrb_int)*8-1))) \104 if( val > TYPE ## _MAX \ 105 || val < TYPE ## _MIN ) \ 106 106 /* '=' unecessary for negative value */ \ 107 107 /* ignore warning on int32_t */ \ … … 126 126 { \ 127 127 if( sizeof( type ) > sizeof( mrb_int ) ){ \ 128 if( val >= (((type)1) << (sizeof(mrb_int)*8)))\128 if( val > TYPE ## _MAX ) \ 129 129 /* '=' unecessary for negative value */ \ 130 130 /* ignore warning on int32_t */ \ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecs/mruby/mrubyVMs.cdl
r359 r374 37 37 38 38 /* 39 * tools/mruby/mruby.c から cInit_initializeBridge( mrb ) を呼び出すように変更したもの 39 * POSIX 環境用の VM 40 * mrbgems の mrbgems/mruby-bin-mruby/tools/mruby/mruby.c を参考に作成したもの 40 41 */ 41 42 namespace nMruby{ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecs/mruby/tecs_mruby.h
r359 r374 1 1 /* 2 * Copyright (C) 2008-201 7by TOPPERS Project2 * Copyright (C) 2008-2019 by TOPPERS Project 3 3 * 4 4 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 46 46 #include "mruby/irep.h" 47 47 #include "mruby/dump.h" 48 #include "mruby/proc.h" 48 49 49 50 #include "TECSPointer.h" 50 51 #include "TECSStruct.h" 51 52 52 #if ! defined( MRUBY_RELEASE_MAJOR ) || MRUBY_RELEASE_MAJOR == 1 && MRUBY_RELEASE_MINOR < 253 #ifndef MRB_ARGS_REQ54 #define MRB_ARGS_REQ(n) ARGS_REQ(n)55 #define MRB_ARGS_OPT(n) ARGS_OPT(n)56 #define MRB_ARGS_ARG(n1,n2) ARGS_ARG(n1,n2)57 #define MRB_ARGS_REST() ARGS_REST()58 #define MRB_ARGS_POST(n) ARGS_POST(n)59 #define MRB_ARGS_KEY(n1,n2) ARGS_KEY(n1,n2)60 #define MRB_ARGS_BLOCK() ARGS_BLOCK()61 #define MRB_ARGS_ANY() ARGS_ANY()62 #define MRB_ARGS_NONE() ARGS_NONE()63 #endif /* MRB_ARGS_REQ */64 #endif65 53 66 #if ! defined( MRUBY_RELEASE_MAJOR ) 67 #define mrb_float_value( mrb, val ) mrb_float_value( val ) 68 #endif 69 70 #else 54 #else /* TECSGEN */ 71 55 72 56 /* 73 * fake tecsgen because tecsgen cannot accept actual mruby.h in case of below.57 * fake definition because tecsgen cannot accept actual mruby.h in case of below. 74 58 * types: long long, long long int 75 59 * special keyword __attribute__(x), __extension__ … … 78 62 typedef int mrb_irep; 79 63 typedef int mrb_context; 80 struct RClass { int dummy;};81 struct RProc { int dummy;};64 struct RClass {uint32_t gcnext;}; // actual definition: struct RBasic *gcnext 65 struct RProc {uint32_t gcnext;}; // actual definition: struct RBasic *gcnext 82 66 83 67 typedef int CELLCB; 68 69 #define GET_SET_BOOL( Type, type ) 70 #define GET_SET_CHAR( Type, type ) 71 #define GET_SET_INT( Type, type ) 72 #define GET_SET_FLOAT( Type, type ) 73 #define POINTER_CLASS( Type, type ) 74 #define CHECK_AND_GET_POINTER( Type, type ) 84 75 85 76 #endif /* TECSGEN */ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecs/rpc/TDR.cdl
r337 r374 68 68 ER sendSOP( [in]bool_t b_client ); /* StartOfPacket magic を送信 */ 69 69 ER receiveSOP( [in]bool_t b_client ); /* StartOfPacket magic を受信 */ 70 /* b_client: クライアント側なら true, サーバー側なら false */71 72 /* マジックコードの送受信 */73 // ER sendSHSOP( [in]bool_t b_client ); /* StartOfPacket magic を送信 */74 // ER receiveSHSOP( [in]bool_t b_client ); /* StartOfPacket magic を受信 */75 70 /* b_client: クライアント側なら true, サーバー側なら false */ 76 71 … … 150 145 }; 151 146 152 // Straight Order TECS Data Representation (Straight means no endian-conversion is done)147 // Straight Byte Order TECS Data Representation (Data are always sent in native endian) 153 148 celltype tTDR { 154 149 call sChannel cChannel; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecs/rpc/sChannel.cdl
r337 r374 58 58 }; 59 59 60 /* 61 * size に uint16_t ではなく int16_t を用いるのは、下位層が ER_INT を返す場合を想定したもの. 62 * 63 * sChannel は TECS RPC の TDR の下位層である通信チャンネルとのインタフェースである. 64 * 通信チャンネルは、高水準 I/O のように、バッファリングされることを想定する. 65 * TDR からは、int8_t, int16_t, int32_t, int64_t, (int128_t), float32_t, double64_t bool_t, char_t のような基本型(無符号を含む)が渡される。 66 * 配列や構造体の場合であっても要素ごとに渡される。 67 */ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecs/rpc/tTDR_inline.h
r337 r374 75 75 return(E_ID); 76 76 } 77 (void)p_cellcb; // to avoid unused warning 77 78 78 79 syslog( LOG_INFO, "TDR: resetting channel" ); … … 102 103 return(E_ID); 103 104 } 105 (void)p_cellcb; // to avoid unused warning 104 106 105 107 /* ここに処理本体を記述します #_TEFB_# */ … … 151 153 return(E_ID); 152 154 } 155 (void)p_cellcb; // to avoid unused warning 153 156 154 157 /* ここに処理本体を記述します #_TEFB_# */ … … 157 160 #endif 158 161 159 162 if( b_client ) 160 163 p_sopMagic = &SOP_MAGIC2; 161 164 else … … 198 201 return(E_ID); 199 202 } 203 (void)p_cellcb; // to avoid unused warning 200 204 201 205 /* ここに処理本体を記述します #_TEFB_# */ … … 234 238 return(E_ID); 235 239 } 240 (void)p_cellcb; // to avoid unused warning 236 241 237 242 /* ここに処理本体を記述します #_TEFB_# */ … … 267 272 return(E_ID); 268 273 } 274 (void)p_cellcb; // to avoid unused warning 269 275 270 276 /* ここに処理本体を記述します #_TEFB_# */ … … 287 293 return(E_ID); 288 294 } 295 (void)p_cellcb; // to avoid unused warning 289 296 290 297 /* ここに処理本体を記述します #_TEFB_# */ … … 307 314 return(E_ID); 308 315 } 316 (void)p_cellcb; // to avoid unused warning 309 317 310 318 /* ここに処理本体を記述します #_TEFB_# */ … … 327 335 return(E_ID); 328 336 } 337 (void)p_cellcb; // to avoid unused warning 329 338 330 339 /* ここに処理本体を記述します #_TEFB_# */ … … 347 356 return(E_ID); 348 357 } 358 (void)p_cellcb; // to avoid unused warning 349 359 350 360 /* ここに処理本体を記述します #_TEFB_# */ … … 368 378 return(E_ID); 369 379 } 380 (void)p_cellcb; // to avoid unused warning 370 381 371 382 /* ここに処理本体を記述します #_TEFB_# */ … … 390 401 return(E_ID); 391 402 } 403 (void)p_cellcb; // to avoid unused warning 392 404 393 405 /* ここに処理本体を記述します #_TEFB_# */ … … 412 424 return(E_ID); 413 425 } 426 (void)p_cellcb; // to avoid unused warning 414 427 415 428 /* ここに処理本体を記述します #_TEFB_# */ … … 434 447 return(E_ID); 435 448 } 449 (void)p_cellcb; // to avoid unused warning 436 450 437 451 /* ここに処理本体を記述します #_TEFB_# */ … … 456 470 return(E_ID); 457 471 } 472 (void)p_cellcb; // to avoid unused warning 458 473 459 474 /* ここに処理本体を記述します #_TEFB_# */ … … 477 492 return(E_ID); 478 493 } /* end if VALID_IDX(idx) */ 494 (void)p_cellcb; // to avoid unused warning 479 495 480 496 /* ここに処理本体を記述します #_TEFB_# */ … … 497 513 return(E_ID); 498 514 } /* end if VALID_IDX(idx) */ 515 (void)p_cellcb; // to avoid unused warning 499 516 500 517 /* ここに処理本体を記述します #_TEFB_# */ … … 517 534 return(E_ID); 518 535 } /* end if VALID_IDX(idx) */ 536 (void)p_cellcb; // to avoid unused warning 519 537 520 538 /* ここに処理本体を記述します #_TEFB_# */ … … 537 555 return(E_ID); 538 556 } /* end if VALID_IDX(idx) */ 557 (void)p_cellcb; // to avoid unused warning 539 558 540 559 /* ここに処理本体を記述します #_TEFB_# */ … … 557 576 return(E_ID); 558 577 } /* end if VALID_IDX(idx) */ 578 (void)p_cellcb; // to avoid unused warning 559 579 560 580 /* ここに処理本体を記述します #_TEFB_# */ … … 578 598 return(E_ID); 579 599 } /* end if VALID_IDX(idx) */ 600 (void)p_cellcb; // to avoid unused warning 580 601 581 602 /* ここに処理本体を記述します #_TEFB_# */ … … 600 621 return(E_ID); 601 622 } /* end if VALID_IDX(idx) */ 623 (void)p_cellcb; // to avoid unused warning 602 624 603 625 /* ここに処理本体を記述します #_TEFB_# */ … … 622 644 return(E_ID); 623 645 } /* end if VALID_IDX(idx) */ 646 (void)p_cellcb; // to avoid unused warning 624 647 625 648 /* ここに処理本体を記述します #_TEFB_# */ … … 644 667 return(E_ID); 645 668 } /* end if VALID_IDX(idx) */ 669 (void)p_cellcb; // to avoid unused warning 646 670 647 671 /* ここに処理本体を記述します #_TEFB_# */ … … 666 690 return(E_ID); 667 691 } /* end if VALID_IDX(idx) */ 692 (void)p_cellcb; // to avoid unused warning 668 693 669 694 /* ここに処理本体を記述します #_TEFB_# */ … … 688 713 return(E_ID); 689 714 } /* end if VALID_IDX(idx) */ 715 (void)p_cellcb; // to avoid unused warning 690 716 691 717 /* ここに処理本体を記述します #_TEFB_# */ … … 705 731 ER ercd = E_OK; 706 732 CELLCB *p_cellcb; 707 uint8_t val; 708 if (VALID_IDX(idx)) { 709 p_cellcb = GET_CELLCB(idx); 710 } 711 else { 712 return(E_ID); 713 } /* end if VALID_IDX(idx) */ 733 uint8_t val = 0; 734 if (VALID_IDX(idx)) { 735 p_cellcb = GET_CELLCB(idx); 736 } 737 else { 738 return(E_ID); 739 } /* end if VALID_IDX(idx) */ 740 (void)p_cellcb; // to avoid unused warning 714 741 715 742 /* ここに処理本体を記述します #_TEFB_# */ … … 737 764 return(E_ID); 738 765 } 766 (void)p_cellcb; // to avoid unused warning 739 767 740 768 /* ここに処理本体を記述します #_TEFB_# */ … … 757 785 return(E_ID); 758 786 } 787 (void)p_cellcb; // to avoid unused warning 759 788 760 789 /* ここに処理本体を記述します #_TEFB_# */ … … 778 807 return(E_ID); 779 808 } 809 (void)p_cellcb; // to avoid unused warning 780 810 781 811 /* ここに処理本体を記述します #_TEFB_# */ … … 800 830 return(E_ID); 801 831 } 832 (void)p_cellcb; // to avoid unused warning 802 833 803 834 /* ここに処理本体を記述します #_TEFB_# */ … … 821 852 return(E_ID); 822 853 } 854 (void)p_cellcb; // to avoid unused warning 823 855 824 856 /* ここに処理本体を記述します #_TEFB_# */ … … 863 895 return(E_ID); 864 896 } /* end if VALID_IDX(idx) */ 897 (void)p_cellcb; // to avoid unused warning 865 898 866 899 /* ここに処理本体を記述します #_TEFB_# */ … … 883 916 return(E_ID); 884 917 } 918 (void)p_cellcb; // to avoid unused warning 885 919 886 920 /* ここに処理本体を記述します #_TEFB_# */ … … 903 937 return(E_ID); 904 938 } 939 (void)p_cellcb; // to avoid unused warning 905 940 906 941 /* ここに処理本体を記述します #_TEFB_# */ … … 923 958 return(E_ID); 924 959 } 960 (void)p_cellcb; // to avoid unused warning 925 961 926 962 /* ここに処理本体を記述します #_TEFB_# */ … … 944 980 return(E_ID); 945 981 } /* end if VALID_IDX(idx) */ 982 (void)p_cellcb; // to avoid unused warning 946 983 947 984 /* ここに処理本体を記述します #_TEFB_# */ … … 966 1003 return(E_ID); 967 1004 } 1005 (void)p_cellcb; // to avoid unused warning 968 1006 969 1007 /* ここに処理本体を記述します #_TEFB_# */ … … 988 1026 return(E_ID); 989 1027 } 1028 (void)p_cellcb; // to avoid unused warning 990 1029 991 1030 /* ここに処理本体を記述します #_TEFB_# */ … … 1010 1049 return(E_ID); 1011 1050 } 1051 (void)p_cellcb; // to avoid unused warning 1012 1052 1013 1053 /* ここに処理本体を記述します #_TEFB_# */ … … 1031 1071 return(E_ID); 1032 1072 } /* end if VALID_IDX(idx) */ 1073 (void)p_cellcb; // to avoid unused warning 1033 1074 1034 1075 /* ここに処理本体を記述します #_TEFB_# */ … … 1051 1092 return(E_ID); 1052 1093 } /* end if VALID_IDX(idx) */ 1094 (void)p_cellcb; // to avoid unused warning 1053 1095 1054 1096 /* ここに処理本体を記述します #_TEFB_# */ … … 1071 1113 return(E_ID); 1072 1114 } /* end if VALID_IDX(idx) */ 1115 (void)p_cellcb; // to avoid unused warning 1073 1116 1074 1117 /* ここに処理本体を記述します #_TEFB_# */ … … 1091 1134 return(E_ID); 1092 1135 } /* end if VALID_IDX(idx) */ 1136 (void)p_cellcb; // to avoid unused warning 1093 1137 1094 1138 /* ここに処理本体を記述します #_TEFB_# */ … … 1112 1156 return(E_ID); 1113 1157 } /* end if VALID_IDX(idx) */ 1158 (void)p_cellcb; // to avoid unused warning 1114 1159 1115 1160 /* ここに処理本体を記述します #_TEFB_# */ … … 1134 1179 return(E_ID); 1135 1180 } /* end if VALID_IDX(idx) */ 1181 (void)p_cellcb; // to avoid unused warning 1136 1182 1137 1183 /* ここに処理本体を記述します #_TEFB_# */ … … 1156 1202 return(E_ID); 1157 1203 } /* end if VALID_IDX(idx) */ 1204 (void)p_cellcb; // to avoid unused warning 1158 1205 1159 1206 /* ここに処理本体を記述します #_TEFB_# */ … … 1178 1225 return(E_ID); 1179 1226 } /* end if VALID_IDX(idx) */ 1227 (void)p_cellcb; // to avoid unused warning 1180 1228 1181 1229 /* ここに処理本体を記述します #_TEFB_# */ … … 1199 1247 return(E_ID); 1200 1248 } 1249 (void)p_cellcb; // to avoid unused warning 1201 1250 1202 1251 /* ここに処理本体を記述します #_TEFB_# */ … … 1220 1269 return(E_ID); 1221 1270 } 1271 (void)p_cellcb; // to avoid unused warning 1222 1272 1223 1273 /* ここに処理本体を記述します #_TEFB_# */ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecsgen.rb
r359 r374 5 5 # Generator for TOPPERS Embedded Component System 6 6 # 7 # Copyright (C) 2008-201 7by TOPPERS Project7 # Copyright (C) 2008-2019 by TOPPERS Project 8 8 #-- 9 9 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 54 54 # Authors list is in i-ro-ha order. 55 55 #Version:: see version.rb 56 $Copyright = "Copyright(c) 2008-201 7, TOPPERS project. All rights reserved."56 $Copyright = "Copyright(c) 2008-2019, TOPPERS project. All rights reserved." 57 57 $License = "TOPPERS License" 58 58 … … 223 223 analyze_option addtional_option_parser 224 224 load_modules 225 setup 225 if ! $TECSFLOW then 226 setup 227 end 226 228 227 229 dbgPrint "tecspath: #{$tecsgen_base_path}, __FILE__=#{__FILE__}\n" … … 284 286 ARGV.each { |a| $arguments += " " + a } 285 287 286 $unopt = false # bool: disable optimizing 288 $unopt = false # bool: disable optimizing both call and entry port 289 $unopt_entry= false # bool: disable optimizing entry port 287 290 $gen_base = "gen" # string: folder path to place generated files 288 291 $gen = $gen_base # string: folder path to place generated files … … 385 388 $unopt = true 386 389 } 390 parser.on('--unoptimize-entry', 'unoptimize entry port') { 391 $unopt_entry = true 392 } 387 393 parser.on('-c', '--cpp=cpp_cmd', 'C pre-processor command used import_C (default: gcc -E -DTECSGEN), you can also specify by environment variable TECS_CPP' ){ 388 394 |arg| … … 465 471 } 466 472 467 if ARGV.empty? && ! $print_version && ! $unit_test 473 if ARGV.empty? && ! $print_version && ! $unit_test && ! $TECSFLOW 468 474 ARGV.options{|parser| 469 475 puts parser.help … … 482 488 # このファイルを誤って読み込むと、異なるバージョン名を表示してしまう 483 489 require_tecsgen_lib 'tecslib/version.rb' 484 if $t ecscde_versionthen485 STDERR << " tecscde version #{$tecscde_version} (tecsgen version #{$version}) #{$Copyright}\n"490 if $title then 491 STDERR << "#{$title} version #{$tool_version} (tecsgen version #{$version}) #{$Copyright}\n" 486 492 elsif ! $no_banner || $print_version 487 493 STDERR << "tecsgen version #{$version} #{$Copyright}\n" … … 490 496 STDERR << "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]\n" 491 497 end 492 if $print_version && ARGV.empty? 498 if $print_version && ARGV.empty? && ! $TECSFLOW 493 499 exit 494 500 end … … 518 524 require_tecsgen_lib 'tecslib/core/tool_info.rb' 519 525 require_tecsgen_lib 'tecslib/core/tecsinfo.rb' 526 require_tecsgen_lib 'tecslib/core/unjoin_plugin.rb' 520 527 require_tecsgen_lib 'tecslib/plugin/CelltypePlugin.rb' 521 528 require_tecsgen_lib 'tecslib/plugin/CompositePlugin.rb' … … 601 608 # クラス変数のリセットを確実に行う必要がある 602 609 603 if $TECSCDE != true then610 if $TECSCDE != true && $TECSFLOW != true then 604 611 begin 605 612 TECSGEN.init … … 607 614 tecsgen.run1 608 615 tecsgen.run2 616 tecsgen.dump_tecsgen_rbdmp 609 617 rescue => evar 610 618 print_exception( evar ) -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecsgen_rcov.rb
r337 r374 44 44 # Usage: tecsgen_rcov.rb [options] CDL-file.cdl 45 45 # 46 47 $:.unshift(File.dirname(__FILE__)) 48 46 49 require 'simplecov' 47 SimpleCov.command_name "tecsgen#{ $$}"50 SimpleCov.command_name "tecsgen#{Time.now.to_f}" 48 51 SimpleCov.root File.dirname( File.expand_path __FILE__ ) 49 52 SimpleCov.at_exit do -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/C_parser.tab.rb
r337 r374 1 1 # 2 2 # DO NOT MODIFY!!!! 3 # This file is automatically generated by Racc 1.4. 143 # This file is automatically generated by Racc 1.4.9 4 4 # from Racc grammer file "". 5 5 # … … 8 8 class C_parser < Racc::Parser 9 9 10 module_eval(<<'...end C_parser.y.rb/module_eval...', 'C_parser.y.rb', 727) 11 12 RESERVED = { 13 # keyword 14 'typedef' => :TYPEDEF, 15 'struct' => :STRUCT, 16 'union' => :UNION, 17 'sizeof' => :SIZEOF, 18 'throw' => :THROW, 19 20 # specifier 21 # types 22 'void' => :VOID, 23 'char' => :CHAR, 24 'short' => :SHORT, 25 26 'volatile'=> :VOLATILE, 27 'const' => :CONST, 28 'extern' => :EXTERN, 29 30 'long' => :LONG, 31 'float' => :FLOAT, 32 'double' => :DOUBLE, 33 'signed' => :SIGNED, 34 'unsigned'=> :UNSIGNED, 35 36 'int' => :INT, 37 'enum' => :ENUM, 38 39 'if' => :IF, 40 'else' => :ELSE, 41 'while' => :WHILE, 42 'do' => :DO, 43 'for' => :FOR, 44 'case' => :CASE, 45 'default' => :DEFAULT, 46 'goto' => :GOTO, 47 'continue' => :CONTINUE, 48 'break' => :BREAK, 49 'return' => :RETURN, 50 '__inline__' => :__INLINE__, 51 'inline' => :INLINE, 52 '__inline' => :__INLINE, 53 'Inline' => :CINLINE, # inline starting with Capital letter 54 'static' => :STATIC, 55 'register' => :REGISTER, 56 'auto' => :AUTO, 57 '__extension__' => :EXTENSION, 58 59 } 60 61 @@generator_nest = -1 62 @@generator_stack = [] 63 @@current_locale = [] 64 65 def finalize 66 67 # mikan Namespace.pop 68 Celltype.pop 69 Cell.pop 70 CompositeCelltype.pop 71 Region.pop 72 73 end 74 75 def set_plugin( plugin ) 76 @plugin = plugin 77 end 78 79 def self.get_plugin 80 @@generator_stack[@@generator_nest].get_plugin 81 end 82 83 def get_plugin 84 @plugin 85 end 86 87 def parse(files) 88 89 # mikan Namespace.push 90 Celltype.push 91 Cell.push 92 CompositeCelltype.push 93 Region.push 94 95 @@generator_nest += 1 96 @@generator_stack[@@generator_nest] = self 97 @b_no_type_name = false 98 99 begin 100 101 @q = [] 102 comment = false 103 104 # euc のコメントを utf8 として扱うと、コメントの終わりを誤る問題の対策 105 TECS_LANG::set_kcode_binary 106 107 # 800U, 0xffLL など (整数リテラルに共通の修飾子) 108 integer_qualifier = "([Uu][Ll][Ll]|[Uu][Ll]|[Uu]|[Ll][Ll]|[Ll])?" 109 110 files.each {|file| 111 lineno = 1 112 begin 113 #2.0 IO.foreach(file) {|line| 114 TECSIO.foreach(file) {|line| 115 col = 1 116 line.rstrip! 117 118 until line.empty? 119 120 if comment 121 case line 122 # コメント終了 123 when /\A\*\// 124 comment = false 125 when /\A./ 126 ; 127 end 128 else 129 case line 130 # 空白、プリプロセスディレクティブ 131 when /\A\s+/ 132 ; 133 # 識別子 134 when /\A[a-zA-Z_]\w*/ 135 word = $& 136 @q << [RESERVED[word] || :IDENTIFIER, Token.new(word.intern, file, lineno, col)] 137 # 16 進数定数 138 when /\A0x[0-9A-Fa-f]+#{integer_qualifier}/ 139 @q << [:HEX_CONSTANT, Token.new($&, file, lineno, col)] 140 # 8 進数定数 141 when /\A0[0-7]+#{integer_qualifier}/ 142 @q << [:OCTAL_CONSTANT, Token.new($&, file, lineno, col)] 143 # 浮動小数定数 144 when /\A[0-9]+\.([0-9]*)?([Ee][+-]?[0-9]+)?/ 145 @q << [:FLOATING_CONSTANT, Token.new($&, file, lineno, col)] 146 # 整数定数 147 when /\A\d+#{integer_qualifier}/ 148 # when /\A\d+/ 149 @q << [:INTEGER_CONSTANT, Token.new($&.to_i, file, lineno, col)] 150 # 文字 151 when /\A'(?:[^'\\]|\\.)'/ 152 @q << [:CHARACTER_LITERAL, Token.new($&, file, lineno, col)] 153 # 文字列 154 # "#include #include #include \"../systask/logtask.cfg\" 最後の " 忘れ)で無限ループ 155 # when /\A"(?:[^"\\]+|\\.)*"/ 156 when /\A"(?:[^"\\]|\\.)*"/ # これはうまく行くようだ 157 @q << [:STRING_LITERAL, Token.new($&, file, lineno, col)] 158 # 行コメント 159 when /\A\/\/.*$/ 160 # 読み飛ばすだけ 161 # コメント開始 162 when /\A\/\*/ 163 comment = true 164 when /\A>>=/, /\A<<=/, /\A>>/, /\A<</ 165 @q << [$&, Token.new($&, file, lineno, col)] 166 when /\A\+=/, /\A\-=/, /\A\*=/, /\A\/=/, /\A%=/, /\A&=/, /\A\|=/, /\A\^=/ 167 @q << [$&, Token.new($&, file, lineno, col)] 168 when /\A::/, /\A==/, /\A!=/, /\A>=/, /\A<=/, /\A\->/, /\A\+\+/, /\A\-\-/ 169 @q << [$&, Token.new($&, file, lineno, col)] 170 when /\A./ 171 @q << [$&, Token.new($&, file, lineno, col)] 172 else 173 raise 174 end 175 end 176 177 line = $' 178 col += $&.length 179 end 180 181 lineno += 1 182 } 183 184 rescue => evar 185 Generator.error( "B1002 while open or reading \'$1\'" , file ) 186 print_exception( evar ) 187 end 188 } 189 190 # 終了の印 191 @q << nil 192 193 @yydebug = true 194 do_parse 195 196 ensure 197 @@generator_nest -= 1 198 TECS_LANG::reset_kcode 199 end 200 201 end 202 203 204 def next_token 205 token = @q.shift 206 207 if token then 208 @@current_locale[@@generator_nest] = token[1].locale 209 210 case token[1].val 211 when ";", ":", ",", "(", ")", "{", "}" 212 set_no_type_name false 213 when ".", "->" 214 set_no_type_name true 215 end 216 217 # TYPE_NAME トークンへ置き換え 218 if @b_no_type_name == false 219 if token[0] == :IDENTIFIER && Namespace.is_typename?( token[1].val ) then 220 token[0] = :TYPE_NAME 221 locale = @@current_locale[@@generator_nest] 10 module_eval(<<'...end C_parser.y.rb/module_eval...', 'C_parser.y.rb', 784) 11 12 RESERVED = { 13 # keyword 14 'typedef' => :TYPEDEF, 15 'struct' => :STRUCT, 16 'union' => :UNION, 17 'sizeof' => :SIZEOF, 18 'throw' => :THROW, 19 20 # specifier 21 # types 22 'void' => :VOID, 23 'char' => :CHAR, 24 'short' => :SHORT, 25 26 'volatile'=> :VOLATILE, 27 'restrict'=> :RESTRICT, 28 'const' => :CONST, 29 'extern' => :EXTERN, 30 31 'long' => :LONG, 32 'float' => :FLOAT, 33 'double' => :DOUBLE, 34 'signed' => :SIGNED, 35 'unsigned'=> :UNSIGNED, 36 37 'int' => :INT, 38 'enum' => :ENUM, 39 40 'if' => :IF, 41 'else' => :ELSE, 42 'while' => :WHILE, 43 'do' => :DO, 44 'for' => :FOR, 45 'switch' => :SWITCH, 46 'case' => :CASE, 47 'default' => :DEFAULT, 48 'goto' => :GOTO, 49 'continue' => :CONTINUE, 50 'break' => :BREAK, 51 'return' => :RETURN, 52 '__inline__' => :__INLINE__, 53 'inline' => :INLINE, 54 '__inline' => :__INLINE, 55 'Inline' => :CINLINE, # inline starting with Capital letter 56 'static' => :STATIC, 57 'register' => :REGISTER, 58 'auto' => :AUTO, 59 '__extension__' => :EXTENSION, 60 '__asm__' => :_ASM, 61 'asm' => :_ASM 62 63 } 64 65 @@generator_nest = -1 66 @@generator_stack = [] 67 @@current_locale = [] 68 69 def finalize 70 71 # mikan Namespace.pop 72 Celltype.pop 73 Cell.pop 74 CompositeCelltype.pop 75 Region.pop 76 77 end 78 79 def set_plugin( plugin ) 80 @plugin = plugin 81 end 82 83 def self.get_plugin 84 @@generator_stack[@@generator_nest].get_plugin 85 end 86 87 def get_plugin 88 @plugin 89 end 90 91 def parse(files) 92 93 # mikan Namespace.push 94 Celltype.push 95 Cell.push 96 CompositeCelltype.push 97 Region.push 98 99 @@generator_nest += 1 100 @@generator_stack[@@generator_nest] = self 101 @b_no_type_name = false 102 103 begin 104 105 @q = [] 106 comment = false 107 # b_asm = false 108 109 # euc のコメントを utf8 として扱うと、コメントの終わりを誤る問題の対策 110 TECS_LANG::set_kcode_binary 111 112 # 800U, 0xffLL など (整数リテラルに共通の修飾子) 113 integer_qualifier = "([Uu][Ll][Ll]|[Uu][Ll]|[Uu]|[Ll][Ll]|[Ll])?" 114 115 files.each {|file| 116 lineno = 1 117 begin 118 #2.0 IO.foreach(file) {|line| 119 TECSIO.foreach(file) {|line| 120 col = 1 121 line.rstrip! 122 123 until line.empty? 124 125 if comment 126 case line 127 # コメント終了 128 when /\A\*\// 129 comment = false 130 when /\A./ 131 ; 132 end 133 else 134 case line 135 # 空白、プリプロセスディレクティブ 136 when /\A\s+/ 137 ; 138 # 識別子 139 when /\A[a-zA-Z_]\w*/ 140 word = $& 141 @q << [RESERVED[word] || :IDENTIFIER, Token.new(word.intern, file, lineno, col)] 142 # 16 進数定数 143 when /\A0x[0-9A-Fa-f]+#{integer_qualifier}/ 144 @q << [:HEX_CONSTANT, Token.new($&, file, lineno, col)] 145 # 8 進数定数 146 when /\A0[0-7]+#{integer_qualifier}/ 147 @q << [:OCTAL_CONSTANT, Token.new($&, file, lineno, col)] 148 # 浮動小数定数 149 when /\A[0-9]+\.([0-9]*)?([Ee][+-]?[0-9]+)?/ 150 @q << [:FLOATING_CONSTANT, Token.new($&, file, lineno, col)] 151 # 整数定数 152 when /\A\d+#{integer_qualifier}/ 153 # when /\A\d+/ 154 @q << [:INTEGER_CONSTANT, Token.new($&.to_i, file, lineno, col)] 155 # 文字 156 when /\A'(?:[^'\\]|\\.)'/ 157 @q << [:CHARACTER_LITERAL, Token.new($&, file, lineno, col)] 158 # 文字列 159 # "#include #include #include \"../systask/logtask.cfg\" 最後の " 忘れ)で無限ループ 160 # when /\A"(?:[^"\\]+|\\.)*"/ 161 when /\A"(?:[^"\\]|\\.)*"/ # これはうまく行くようだ 162 @q << [:STRING_LITERAL, Token.new($&, file, lineno, col)] 163 # 行コメント 164 when /\A\/\/.*$/ 165 # 読み飛ばすだけ 166 # コメント開始 167 when /\A\/\*/ 168 comment = true 169 when /\A>>=/, /\A<<=/, /\A>>/, /\A<</ 170 @q << [$&, Token.new($&, file, lineno, col)] 171 when /\A\+=/, /\A\-=/, /\A\*=/, /\A\/=/, /\A%=/, /\A&=/, /\A\|=/, /\A\^=/ 172 @q << [$&, Token.new($&, file, lineno, col)] 173 when /\A::/, /\A==/, /\A!=/, /\A>=/, /\A<=/, /\A\->/, /\A\+\+/, /\A\-\-/ 174 @q << [$&, Token.new($&, file, lineno, col)] 175 when /\A\|\|/, /\A\&\&/ 176 @q << [$&, Token.new($&, file, lineno, col)] 177 when /\A./ 178 @q << [$&, Token.new($&, file, lineno, col)] 179 else 180 raise 181 end 182 end 183 184 line = $' 185 col += $&.length 186 end 187 188 lineno += 1 189 } 190 191 rescue => evar 192 Generator.error( "B1002 while open or reading \'$1\'" , file ) 193 print_exception( evar ) 194 end 195 } 196 197 # 終了の印 198 @q << nil 199 200 @yydebug = true 201 do_parse 202 203 ensure 204 @@generator_nest -= 1 205 TECS_LANG::reset_kcode 206 end 207 208 end 209 210 211 def next_token 212 token = @q.shift 213 214 if token then 215 @@current_locale[@@generator_nest] = token[1].locale 216 217 case token[1].val 218 when ";", ":", ",", "(", ")", "{", "}" 219 set_no_type_name false 220 when ".", "->" 221 set_no_type_name true 222 end 223 224 # TYPE_NAME トークンへ置き換え 225 if @b_no_type_name == false 226 if token[0] == :IDENTIFIER && Namespace.is_typename?( token[1].val ) then 227 token[0] = :TYPE_NAME 228 locale = @@current_locale[@@generator_nest] 222 229 #print( "#{locale[0]}: line #{locale[1]} : #{token[0]} '#{token[1].val}: type_name'\n" ) 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 Console.puts "error: #{locale[0]}: line #{locale[1]}#{msg}"263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 230 end 231 end 232 233 if $debug then # 070107 token 無効時ここを通さないようした (through 対応 -d の時に例外発生) 234 locale = @@current_locale[@@generator_nest] 235 if token then 236 print( "#{locale[0]}: line #{locale[1]} : #{token[0]} '#{token[1].val}'\n" ) 237 else 238 print( "#{locale[0]}: line #{locale[1]} : EOF\n" ) 239 end 240 end 241 end 242 243 token 244 end 245 246 def on_error(t, v, vstack) 247 if v == "$" then 248 Generator.error( "B1003 Unexpected EOF" ) 249 else 250 Generator.error( "B1004 syntax error near \'$1\'" , v.val ) 251 end 252 253 end 254 255 def self.current_locale 256 @@current_locale[ @@generator_nest ] 257 end 258 259 @@n_error = 0 260 @@n_warning = 0 261 @@n_info = 0 262 263 # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でエラー発生は不適切) 264 def self.error( msg ) 265 @@n_error += 1 266 locale = @@current_locale[ @@generator_nest ] 267 268 if locale then 269 Console.puts "#{locale[0]}:#{locale[1]}: error: #{msg}" 270 else 271 Console.puts "error: #{msg}" 272 end 273 end 274 275 # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でウォーニング発生は不適切) 276 def self.warning( msg ) 277 @@n_warning += 1 278 locale = @@current_locale[ @@generator_nest ] 279 Console.puts "warning: #{locale[0]}: line #{locale[1]} #{msg}" 280 end 281 282 # このメソッドは構文解析、意味解析からのみ呼出し可 283 def self.info( msg ) 284 @@n_info += 1 285 locale = @@current_locale[ @@generator_nest ] 286 Console.puts "info: #{locale[0]}: line #{locale[1]} #{msg}" 287 end 288 289 def self.get_n_error 290 @@n_error 291 end 292 293 def self.get_n_warning 294 @@n_warning 295 end 296 297 def self.get_nest 298 @@generator_nest 299 end 300 301 def set_no_type_name b_no_type_name 302 locale = @@current_locale[ @@generator_nest ] 296 303 #print "b_no_type_name=#{b_no_type_name} #{locale[0]}: line #{locale[1]}\n" 297 298 304 @b_no_type_name = b_no_type_name 305 end 299 306 300 307 ...end C_parser.y.rb/module_eval... … … 302 309 303 310 clist = [ 304 '106,107,108,109,110,112,70,113,68,181,302,143,55,118,119,208,117,120', 305 '121,122,123,124,125,106,107,108,109,110,112,337,113,209,336,210,143', 306 '76,118,119,170,117,120,121,122,123,124,125,305,69,301,67,350,28,29,106', 307 '107,108,109,110,112,75,113,28,29,162,143,77,118,119,170,117,120,121', 308 '122,123,124,125,169,79,205,206,353,306,307,308,309,310,311,312,313,314', 309 '315,264,55,144,8,9,10,11,15,16,17,18,19,20,21,174,267,23,25,27,28,29', 310 '197,198,375,263,144,106,107,108,109,110,112,346,113,342,197,198,143', 311 '173,118,119,153,117,120,121,122,123,124,125,106,107,108,109,110,112', 312 '144,113,357,341,3,143,274,118,119,253,117,120,121,122,123,124,125,106', 313 '107,108,109,110,112,54,113,199,200,361,143,53,118,119,98,117,120,121', 314 '122,123,124,125,106,107,108,109,110,112,345,113,363,83,364,143,82,118', 315 '119,346,117,120,121,122,123,124,125,81,144,249,83,274,253,82,253,53', 316 '106,107,108,109,110,112,337,113,55,336,365,236,366,118,119,144,117,120', 317 '121,122,123,124,125,54,249,367,194,253,97,53,53,195,196,81,199,200,55', 318 '55,144,230,89,8,9,10,11,15,16,17,18,19,20,21,79,372,23,25,27,28,29,199', 319 '200,144,231,88,232,233,234,235,87,237,238,240,241,242,243,194,377,194', 320 '199,200,195,196,195,196,378,39,40,41,42,43,44,45,46,144,106,107,108', 321 '109,110,112,379,113,205,206,380,143,381,118,119,382,117,120,121,122', 322 '123,124,125,106,107,108,109,110,112,384,113,197,198,385,143,386,118', 323 '119,65,117,120,121,122,123,124,125,106,107,108,109,110,112,62,113,391', 324 '37,392,143,393,118,119,394,117,120,121,122,123,124,125,106,107,108,109', 325 '110,112,61,113,211,212,396,143,398,118,119,280,117,120,121,122,123,124', 326 '125,47,144,279,36,277,8,9,10,11,15,16,17,18,19,20,21,271,37,23,25,27', 327 '28,29,270,144,38,8,9,10,11,15,16,17,18,19,20,21,199,200,23,25,27,28', 328 '29,269,97,256,144,255,39,40,41,42,43,44,45,46,36,247,8,9,10,11,15,16', 329 '17,18,19,20,21,144,246,23,25,27,28,29,245,32,38,106,107,108,109,110', 330 '112,216,113,215,210,209,143,208,118,119,207,117,120,121,122,123,124', 331 '125,39,40,41,42,43,44,45,46,303,106,107,108,109,110,112,316,113,317', 332 '319,320,236,321,118,119,323,117,120,121,122,123,124,125,54,54,54,324', 333 '54,325,53,53,53,326,53,329,176,55,55,55,230,55,8,9,10,11,15,16,17,18', 334 '19,20,21,79,175,23,25,27,28,29,77,97,144,231,171,232,233,234,235,163', 335 '237,238,240,241,242,243,183,348,184,349,185,186,187,207,,,39,40,41,42', 336 '43,44,45,46,144,106,107,108,109,110,112,,113,,,,143,,118,119,,117,120', 337 '121,122,123,124,125,,,106,107,108,109,110,112,,113,,,,236,,118,119,', 338 '117,120,121,122,123,124,125,54,54,54,,54,,53,53,53,,53,,,55,55,55,230', 339 '55,8,9,10,11,15,16,17,18,19,20,21,79,,23,25,27,28,29,,,,231,,232,233', 340 '234,235,144,237,238,240,241,242,243,201,202,203,204,201,202,203,204', 341 ',,39,40,41,42,43,44,45,46,144,106,107,108,109,110,112,,113,,,,236,,118', 342 '119,,117,120,121,122,123,124,125,54,201,202,203,204,,53,,,,,,,55,,,230', 343 ',8,9,10,11,15,16,17,18,19,20,21,79,,23,25,27,28,29,,,,231,,232,233,234', 344 '235,,237,238,240,241,242,243,,,,,,,,,,,39,40,41,42,43,44,45,46,144,106', 345 '107,108,109,110,112,,113,,,,143,,118,119,,117,120,121,122,123,124,125', 346 '106,107,108,109,110,112,,113,,,,143,,118,119,,117,120,121,122,123,124', 347 '125,106,107,108,109,110,112,,113,,,,143,,118,119,,117,120,121,122,123', 348 '124,125,106,107,108,109,110,112,,113,,,,143,,118,119,,117,120,121,122', 349 '123,124,125,,144,,,,,,,,106,107,108,109,110,112,,113,,,,143,,118,119', 350 '144,117,120,121,122,123,124,125,106,107,108,109,110,112,,113,,368,,143', 351 ',118,119,144,117,120,121,122,123,124,125,,,,,,,,106,107,108,109,110', 352 '112,,113,144,,,236,,118,119,,117,120,121,122,123,124,125,,,,,,,,,,,', 353 ',,,,,230,144,8,9,10,11,15,16,17,18,19,20,21,79,,23,25,27,28,29,,,,231', 354 '144,232,233,234,235,,237,238,240,241,242,243,,,,,,,,,,,39,40,41,42,43', 355 '44,45,46,144,106,107,108,109,110,112,,113,,,,236,,118,119,,117,120,121', 356 '122,123,124,125,,,,,,,,,,,,,,,,,230,,8,9,10,11,15,16,17,18,19,20,21', 357 '79,,23,25,27,28,29,,,,231,,232,233,234,235,,237,238,240,241,242,243', 358 ',,,,,,,,,,39,40,41,42,43,44,45,46,144,106,107,108,109,110,112,,113,', 359 ',,236,,118,119,,117,120,121,122,123,124,125,,,,,,,,,,,,,,,,,230,,8,9', 360 '10,11,15,16,17,18,19,20,21,79,,23,25,27,28,29,,,,231,,232,233,234,235', 361 ',237,238,240,241,242,243,,,,,,,,,,,39,40,41,42,43,44,45,46,144,106,107', 362 '108,109,110,112,,113,,,,143,,118,119,,117,120,121,122,123,124,125,106', 363 '107,108,109,110,112,,113,,,,143,,118,119,,117,120,121,122,123,124,125', 364 '106,107,108,109,110,112,,113,,,,143,,118,119,,117,120,121,122,123,124', 365 '125,106,107,108,109,110,112,,113,,,,143,,118,119,,117,120,121,122,123', 366 '124,125,,144,,,,,141,,,,,,,142,106,107,108,109,110,112,,113,,147,144', 367 '143,,118,119,,117,120,121,122,123,124,125,106,107,108,109,110,112,,113', 368 ',,144,143,,118,119,,117,120,121,122,123,124,125,106,107,108,109,110', 369 '112,,113,,,144,143,,118,119,,117,120,121,122,123,124,125,106,107,108', 370 '109,110,112,,113,,,,143,,118,119,,117,120,121,122,123,124,125,,144,', 371 ',,,,,,106,107,108,109,110,112,,113,,,,143,,118,119,144,117,120,121,122', 372 '123,124,125,106,107,108,109,110,112,,113,,,,143,,118,119,144,117,120', 373 '121,122,123,124,125,106,107,108,109,110,112,,113,,,,143,,118,119,144', 374 '117,120,121,122,123,124,125,106,107,108,109,110,112,,113,,,,143,,118', 375 '119,,117,120,121,122,123,124,125,,144,,,,,141,351,,,,,,142,106,107,108', 376 '109,110,112,,113,,,144,143,,118,119,,117,120,121,122,123,124,125,106', 377 '107,108,109,110,112,,113,,,144,143,,118,119,,117,120,121,122,123,124', 378 '125,106,107,108,109,110,112,,113,,,144,143,,118,119,,117,120,121,122', 379 '123,124,125,106,107,108,109,110,112,,113,,,,143,,118,119,,117,120,121', 380 '122,123,124,125,,144,,,,,,,,106,107,108,109,110,112,,113,,,,143,,118', 381 '119,144,117,120,121,122,123,124,125,106,107,108,109,110,112,,113,,,', 382 '143,,118,119,144,117,120,121,122,123,124,125,106,107,108,109,110,112', 383 ',113,,,,143,,118,119,144,117,120,121,122,123,124,125,,,,,,,,,,106,107', 384 '108,109,110,112,,113,,,,236,,118,119,144,117,120,121,122,123,124,125', 385 ',,,,,,,,,,,,,,,144,230,,8,9,10,11,15,16,17,18,19,20,21,79,239,23,25', 386 '27,28,29,,,144,231,,232,233,234,235,,237,238,240,241,242,243,,,,,,,', 387 ',,,39,40,41,42,43,44,45,46,144,106,107,108,109,110,112,,113,,338,,143', 388 ',118,119,,117,120,121,122,123,124,125,106,107,108,109,110,112,,113,', 389 ',,143,,118,119,,117,120,121,122,123,124,125,8,9,10,11,15,16,17,18,19', 390 '20,21,,,23,25,27,28,29,8,9,10,11,15,16,17,18,19,20,21,,,23,25,27,28', 391 '29,,106,107,108,109,110,112,,113,,,144,143,,118,119,,117,120,121,122', 392 '123,124,125,106,107,108,109,110,112,,113,,,144,143,,118,119,,117,120', 393 '121,122,123,124,125,106,107,108,109,110,112,,113,,,,143,,118,119,,117', 394 '120,121,122,123,124,125,106,107,108,109,110,189,,113,,,,143,,118,119', 395 ',117,120,121,122,123,124,125,,144,,,,,,,,106,107,108,109,110,191,,113', 396 ',,,143,,118,119,144,117,120,121,122,123,124,125,106,107,108,109,110', 397 '191,,113,,,,143,,118,119,144,117,120,121,122,123,124,125,106,107,108', 398 '109,110,112,,113,,,,143,,118,119,144,117,120,121,122,123,124,125,106', 399 '107,108,109,110,112,,113,,,,143,,118,119,,117,120,121,122,123,124,125', 400 ',144,,,,,141,,,,,,,142,,,328,,106,107,108,109,110,112,144,113,,,,143', 401 ',118,119,,117,120,121,122,123,124,125,,,,,,,144,,,,,,,,,,,106,107,108', 402 '109,110,112,,113,,,,236,144,118,119,,117,120,121,122,123,124,125,,,', 403 ',,,,,,,,,,,,,230,,8,9,10,11,15,16,17,18,19,20,21,79,144,23,25,27,28', 404 '29,,,,231,,232,233,234,235,,237,238,240,241,242,243,,,,,,,274,334,,253', 405 '39,40,41,42,43,44,45,46,144,55,,,,,249,334,,253,,,53,,,,,,,55,,,,,8', 406 '9,10,11,15,16,17,18,19,20,21,,,23,25,27,28,29,8,9,10,11,15,16,17,18', 407 '19,20,21,,,23,25,27,28,29,370,,,,,,,,39,40,41,42,43,44,45,46,,,149,', 408 ',,,,,,39,40,41,42,43,44,45,46,,8,9,10,11,15,16,17,18,19,20,21,,,23,25', 409 '27,28,29,8,9,10,11,15,16,17,18,19,20,21,,,23,25,27,28,29,,,,330,,,,', 410 '39,40,41,42,43,44,45,46,,,,,,,,,,,39,40,41,42,43,44,45,46,8,9,10,11', 411 '15,16,17,18,19,20,21,,,23,25,27,28,29,8,9,10,11,15,16,17,18,19,20,21', 412 ',,23,25,27,28,29,,,,,,,,,39,40,41,42,43,44,45,46,,,,,,,,,,,39,40,41', 413 '42,43,44,45,46,8,9,10,11,15,16,17,18,19,20,21,,340,23,25,27,28,29,8', 414 '9,10,11,15,16,17,18,19,20,21,,164,23,25,27,28,29,,,,,,,,,39,40,41,42', 415 '43,44,45,46,,,,,,,,,,,39,40,41,42,43,44,45,46,8,9,10,11,15,16,17,18', 416 '19,20,21,,,23,25,27,28,29,8,9,10,11,15,16,17,18,19,20,21,,,23,25,27', 417 '28,29,,,,,,,,,39,40,41,42,43,44,45,46,,,,,,,,,,,39,40,41,42,43,44,45', 418 '46,8,9,10,11,15,16,17,18,19,20,21,,,23,25,27,28,29,8,9,10,11,15,16,17', 419 '18,19,20,21,,257,23,25,27,28,29,,,,,,,,,39,40,41,42,43,44,45,46,,,,', 420 ',,,,,,39,40,41,42,43,44,45,46,8,9,10,11,15,16,17,18,19,20,21,,,23,25', 421 '27,28,29,8,9,10,11,15,16,17,18,19,20,21,,262,23,25,27,28,29,,,,,,,,', 422 '39,40,41,42,43,44,45,46,,,,,,,,,,,39,40,41,42,43,44,45,46,8,9,10,11', 423 '15,16,17,18,19,20,21,,,23,25,27,28,29,8,9,10,11,15,16,17,18,19,20,21', 424 ',,23,25,27,28,29,,,,,,,,,39,40,41,42,43,44,45,46,,,,,,,,,,,39,40,41', 425 '42,43,44,45,46,8,9,10,11,15,16,17,18,19,20,21,,,23,25,27,28,29' ] 426 racc_action_table = arr = ::Array.new(2875, nil) 311 '111,112,113,114,115,117,294,118,56,298,55,163,54,123,124,82,54,262,122', 312 '125,126,127,128,129,130,111,112,113,114,115,117,217,118,271,391,101', 313 '163,91,123,124,82,271,271,122,125,126,127,128,129,130,56,70,171,72,82', 314 '69,397,71,80,32,33,34,224,309,271,223,216,226,84,227,228,229,84,392', 315 '101,325,272,171,298,312,80,164,165,172,393,173,174,175,176,177,178,179', 316 '180,149,181,101,218,79,308,369,388,32,33,34,265,266,164,165,172,73,173', 317 '174,175,176,177,178,179,180,149,181,111,112,113,114,115,117,384,118', 318 '32,33,34,163,78,123,124,82,440,402,122,125,126,127,128,129,130,55,219', 319 '271,271,383,101,54,332,248,325,387,55,298,249,250,56,382,54,111,112', 320 '113,114,115,117,56,118,56,171,331,163,395,123,124,82,276,210,122,125', 321 '126,127,128,129,130,420,55,378,210,248,377,396,54,330,249,250,393,92', 322 '164,165,172,56,173,174,175,176,177,178,179,180,149,181,171,9,10,11,12', 323 '13,14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,355,356', 324 '213,164,165,172,204,173,174,175,176,177,178,179,180,149,181,111,112', 325 '113,114,115,117,404,118,93,378,203,163,377,123,124,82,193,271,122,125', 326 '126,127,128,129,130,111,112,113,114,115,117,290,118,101,86,55,163,85', 327 '123,124,82,54,291,122,125,126,127,128,129,130,56,357,171,13,14,15,16', 328 '17,18,19,20,21,22,26,28,30,31,32,33,34,248,86,322,438,85,249,250,171', 329 '434,435,370,164,165,172,271,173,174,175,176,177,178,179,180,149,181', 330 '259,260,261,321,255,256,257,258,315,316,262,164,165,172,271,173,174', 331 '175,176,177,178,179,180,149,181,111,112,113,114,115,117,403,118,317', 332 '318,263,163,264,123,124,82,320,271,122,125,126,127,128,129,130,13,14', 333 '15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,437,111,112,113,114,115', 334 '117,360,118,400,171,271,163,368,123,124,82,166,103,122,125,126,127,128', 335 '129,130,102,55,255,256,257,258,310,54,255,256,257,258,405,164,165,172', 336 '56,173,174,175,176,177,178,179,180,149,181,171,9,10,11,12,13,14,15,16', 337 '17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,259,260,301,164,165', 338 '172,300,173,174,175,176,177,178,179,180,149,181,111,112,113,114,115', 339 '117,408,118,253,254,292,163,409,123,124,82,253,254,122,125,126,127,128', 340 '129,130,111,112,113,114,115,117,410,118,253,254,55,163,289,123,124,82', 341 '54,288,122,125,126,127,128,129,130,56,415,171,13,14,15,16,17,18,19,20', 342 '21,22,26,28,30,31,32,33,34,253,254,253,254,251,252,261,171,211,212,285', 343 '164,165,172,284,173,174,175,176,177,178,179,180,149,181,237,238,239', 344 '240,241,242,243,244,245,246,247,164,165,172,283,173,174,175,176,177', 345 '178,179,180,149,181,111,112,113,114,115,117,282,118,251,252,389,163', 346 '389,123,124,82,251,252,122,125,126,127,128,129,130,111,112,113,114,115', 347 '117,101,118,67,82,55,163,64,123,124,82,54,63,122,125,126,127,128,129', 348 '130,56,55,171,55,55,294,280,54,298,54,54,54,279,430,431,432,56,433,56', 349 '56,56,365,436,278,263,275,264,171,273,270,48,164,165,172,444,173,174', 350 '175,176,177,178,179,180,149,181,269,3,,,,,,,,,,164,165,172,,173,174', 351 '175,176,177,178,179,180,149,181,111,112,113,114,115,117,,118,,,,163', 352 ',123,124,82,,,122,125,126,127,128,129,130,111,112,113,114,115,117,,118', 353 ',,,148,,123,124,,,,122,125,126,127,128,129,130,,,171,111,112,113,114', 354 '115,117,,118,,,,148,,123,124,,,,122,125,126,127,128,129,130,,,,164,165', 355 '172,,173,174,175,176,177,178,179,180,149,181,,,,,,,111,112,113,114,115', 356 '117,,118,,411,,148,,123,124,,,149,122,125,126,127,128,129,130,,,,111', 357 '112,113,114,115,117,,118,,,,148,,123,124,,,149,122,125,126,127,128,129', 358 '130,111,112,113,114,115,117,,118,,,,148,,123,124,,,,122,125,126,127', 359 '128,129,130,,,171,,,,,,,,,,,,,149,,111,112,113,114,115,117,,118,,,171', 360 '148,,123,124,,,,122,125,126,127,128,129,130,,149,,,,,,,,111,112,113', 361 '114,115,117,,118,,,,148,,123,124,146,398,149,122,125,126,127,128,129', 362 '130,111,112,113,114,115,117,,118,,,,148,,123,124,,,,122,125,126,127', 363 '128,129,130,111,112,113,114,115,117,,118,,149,,148,,123,124,389,,,122', 364 '125,126,127,128,129,130,,,,147,,,111,112,113,114,115,117,,118,,,,148', 365 '149,123,124,,,,122,125,126,127,128,129,130,111,112,113,114,115,117,', 366 '118,,379,,148,149,123,124,,,,122,125,126,127,128,129,130,,,,,,,,,,,', 367 ',149,,,,,111,112,113,114,115,117,,118,,,,148,,123,124,,,,122,125,126', 368 '127,128,129,130,,149,,,,,,,,,,,,,,,,,,,,,,,,,149,171,9,10,11,12,13,14', 369 '15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,111,112,113', 370 '114,115,117,,118,,,,148,,123,124,149,,,122,125,126,127,128,129,130,111', 371 '112,113,114,115,117,,118,,,,148,,123,124,146,,,122,125,126,127,128,129', 372 '130,111,112,113,114,115,117,,118,,,,148,,123,124,,,,122,125,126,127', 373 '128,129,130,,111,112,113,114,115,117,,118,,,,148,,123,124,,,149,122', 374 '125,126,127,128,129,130,,,147,,,111,112,113,114,115,117,,118,,,,148', 375 '149,123,124,,,,122,125,126,127,128,129,130,111,112,113,114,115,117,', 376 '118,,,,148,149,123,124,,,,122,125,126,127,128,129,130,,111,112,113,114', 377 '115,117,,118,,,,148,149,123,124,,,,122,125,126,127,128,129,130,111,112', 378 '113,114,115,117,,118,,,,148,,123,124,146,,149,122,125,126,127,128,129', 379 '130,111,112,113,114,115,117,427,118,,,,148,,123,124,,,149,122,125,126', 380 '127,128,129,130,,111,112,113,114,115,117,,118,,,,148,,123,124,,,149', 381 '122,125,126,127,128,129,130,,,147,,,111,112,113,114,115,117,,118,,185', 382 ',148,149,123,124,,,,122,125,126,127,128,129,130,111,112,113,114,115', 383 '117,,118,,,,148,149,123,124,,,,122,125,126,127,128,129,130,,111,112', 384 '113,114,115,117,,118,,,,148,149,123,124,,,,122,125,126,127,128,129,130', 385 '111,112,113,114,115,117,,118,,,,148,,123,124,,,149,122,125,126,127,128', 386 '129,130,111,112,113,114,115,117,,118,,,,148,,123,124,,,149,122,125,126', 387 '127,128,129,130,,111,112,113,114,115,117,,118,,,,148,,123,124,,,149', 388 '122,125,126,127,128,129,130,111,112,113,114,115,117,,118,,,,148,,123', 389 '124,,,149,122,125,126,127,128,129,130,111,112,113,114,115,117,,118,', 390 ',,148,,123,124,,,149,122,125,126,127,128,129,130,,111,112,113,114,115', 391 '117,,118,,,,148,,123,124,,,149,122,125,126,127,128,129,130,111,112,113', 392 '114,115,117,,118,,,,148,,123,124,,,149,122,125,126,127,128,129,130,111', 393 '112,113,114,115,117,,118,,,,148,,123,124,,,149,122,125,126,127,128,129', 394 '130,,111,112,113,114,115,117,,118,,,,148,,123,124,,,149,122,125,126', 395 '127,128,129,130,111,112,113,114,115,117,,118,,,,148,,123,124,,,149,122', 396 '125,126,127,128,129,130,111,112,113,114,115,117,,118,,,,148,,123,124', 397 ',,149,122,125,126,127,128,129,130,,111,112,113,114,115,117,,118,,,,148', 398 ',123,124,,,149,122,125,126,127,128,129,130,111,112,113,114,115,117,', 399 '118,,,,148,,123,124,,,149,122,125,126,127,128,129,130,111,112,113,114', 400 '115,117,,118,,,,148,,123,124,146,,149,122,125,126,127,128,129,130,,111', 401 '112,113,114,115,117,,118,,,,148,,123,124,,,149,122,125,126,127,128,129', 402 '130,,,,,,,,,,,,,,,,,,149,,,,,,,,,,147,,,111,112,113,114,115,117,,118', 403 ',,,148,149,123,124,,,,122,125,126,127,128,129,130,,111,112,113,114,115', 404 '117,,118,,,,148,149,123,124,,,,122,125,126,127,128,129,130,,,,,,,13', 405 '14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,,,111,112,113,114,115', 406 '117,,118,,,,148,,123,124,,,149,122,125,126,127,128,129,130,,111,112', 407 '113,114,115,231,,118,,,,148,,123,124,,,149,122,125,126,127,128,129,130', 408 '111,112,113,114,115,233,,118,,,,148,,123,124,,,,122,125,126,127,128', 409 '129,130,111,112,113,114,115,233,,118,,,,148,,123,124,,,149,122,125,126', 410 '127,128,129,130,,,,,,,,,,,,,111,112,113,114,115,117,149,118,,,,148,', 411 '123,124,,,,122,125,126,127,128,129,130,111,112,113,114,115,117,149,118', 412 ',,,148,,123,124,,,,122,125,126,127,128,129,130,,,,,,,149,13,14,15,16', 413 '17,18,19,20,21,22,26,28,30,31,32,33,34,,,111,112,113,114,115,117,,118', 414 ',,,148,,123,124,,,149,122,125,126,127,128,129,130,111,112,113,114,115', 415 '117,327,118,,,,148,,123,124,,,149,122,125,126,127,128,129,130,,,,,,', 416 ',13,14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,,,111,112,113,114', 417 '115,117,,118,,,,148,,123,124,,,149,122,125,126,127,128,129,130,111,112', 418 '113,114,115,117,,118,,,,148,,123,124,,,149,122,125,126,127,128,129,130', 419 '111,112,113,114,115,117,,118,,,,148,,123,124,,,,122,125,126,127,128', 420 '129,130,,111,112,113,114,115,117,429,118,,,,148,,123,124,,,149,122,125', 421 '126,127,128,129,130,,287,,,,111,112,113,114,115,117,,118,,,,148,149', 422 '123,124,146,442,,122,125,126,127,128,129,130,111,112,113,114,115,117', 423 ',118,,,,148,149,123,124,,,,122,125,126,127,128,129,130,,111,112,113', 424 '114,115,117,,118,,,,148,149,123,124,,,,122,125,126,127,128,129,130,', 425 ',147,,,,,,,,,,,,,,46,149,,,,,,,,,,,,,,,,,,,,,,,,,149,,,46,,,,,,,,,,', 426 ',,,,,,,,,,,,149,45,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,28,30', 427 '31,32,33,34,35,36,37,38,,,47,45,9,10,11,12,13,14,15,16,17,18,19,20,21', 428 '22,26,28,30,31,32,33,34,35,36,37,38,,41,47,294,375,,298,,,54,,,,,,,', 429 ',56,,,,,,,,,,325,375,,298,,,,,,,,,,,,56,,,,,,,,9,10,11,12,13,14,15,16', 430 '17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,9,10,11,12,13,14', 431 '15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,188,,,,,192', 432 ',,,,,,,,,,,,,,,,,,,413,,,,,,,,,,,,,,,,,,,,,,9,10,11,12,13,14,15,16,17', 433 '18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,9,10,11,12,13,14,15', 434 '16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,371,9,10,11,12', 435 '13,14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,,,,,', 436 '205,,,,,,,,,,,,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,28,30,31', 437 '32,33,34,35,36,37,38,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,28', 438 '30,31,32,33,34,35,36,37,38,307,,,,,,,,,,,,,,,,,,,,,,,,,381,,,,,,,,,', 439 ',,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36', 440 '37,38,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34', 441 '35,36,37,38,302,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,28,30,31', 442 '32,33,34,35,36,37,38,,,,,,,,,,,,9,10,11,12,13,14,15,16,17,18,19,20,21', 443 '22,26,28,30,31,32,33,34,35,36,37,38,9,10,11,12,13,14,15,16,17,18,19', 444 '20,21,22,26,28,30,31,32,33,34,35,36,37,38,9,10,11,12,13,14,15,16,17', 445 '18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,9,10,11,12,13,14,15', 446 '16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,9,10,11,12,13', 447 '14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,9,10,11', 448 '12,13,14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37,38,9', 449 '10,11,12,13,14,15,16,17,18,19,20,21,22,26,28,30,31,32,33,34,35,36,37', 450 '38' ] 451 racc_action_table = arr = ::Array.new(3198, nil) 427 452 idx = 0 428 453 clist.each do |str| … … 434 459 435 460 clist = [ 436 '210,210,210,210,210,210,26,210,24,114,213,210,55,210,210,297,210,210', 437 '210,210,210,210,210,211,211,211,211,211,211,332,211,298,332,299,211', 438 '48,211,211,95,211,211,211,211,211,211,211,217,26,213,24,300,55,55,189', 439 '189,189,189,189,189,48,189,114,114,90,189,50,189,189,172,189,189,189', 440 '189,189,189,189,95,50,132,132,303,217,217,217,217,217,217,217,217,217', 441 '217,166,85,210,189,189,189,189,189,189,189,189,189,189,189,101,172,189', 442 '189,189,189,189,287,287,347,166,211,394,394,394,394,394,394,347,394', 443 '259,288,288,394,101,394,394,84,394,394,394,394,394,394,394,181,181,181', 444 '181,181,181,189,181,318,259,1,181,273,181,181,273,181,181,181,181,181', 445 '181,181,194,194,194,194,194,194,51,194,289,289,322,194,51,194,194,70', 446 '194,194,194,194,194,194,194,195,195,195,195,195,195,275,195,324,52,327', 447 '195,52,195,195,275,195,195,195,195,195,195,195,51,394,248,80,180,248', 448 '80,180,248,392,392,392,392,392,392,252,392,180,252,330,392,333,392,392', 449 '181,392,392,392,392,392,392,392,342,152,335,286,152,69,342,152,286,286', 450 '248,290,290,342,152,194,392,66,392,392,392,392,392,392,392,392,392,392', 451 '392,392,339,392,392,392,392,392,291,291,195,392,64,392,392,392,392,63', 452 '392,392,392,392,392,392,285,354,128,292,292,285,285,128,128,355,392', 453 '392,392,392,392,392,392,392,392,381,381,381,381,381,381,356,381,295', 454 '295,357,381,358,381,381,359,381,381,381,381,381,381,381,380,380,380', 455 '380,380,380,365,380,129,129,369,380,371,380,380,22,380,380,380,380,380', 456 '380,380,196,196,196,196,196,196,14,196,382,32,387,196,389,196,196,390', 457 '196,196,196,196,196,196,196,197,197,197,197,197,197,12,197,137,137,393', 458 '197,397,197,197,185,197,197,197,197,197,197,197,3,381,184,32,182,32', 459 '32,32,32,32,32,32,32,32,32,32,178,2,32,32,32,32,32,177,380,32,72,72', 460 '72,72,72,72,72,72,72,72,72,130,130,72,72,72,72,72,175,170,157,196,156', 461 '32,32,32,32,32,32,32,32,2,150,2,2,2,2,2,2,2,2,2,2,2,197,148,2,2,2,2', 462 '2,146,2,2,198,198,198,198,198,198,144,198,142,136,135,198,134,198,198', 463 '133,198,198,198,198,198,198,198,2,2,2,2,2,2,2,2,215,379,379,379,379', 464 '379,379,231,379,232,234,235,379,236,379,379,238,379,379,379,379,379', 465 '379,379,160,94,54,240,264,241,160,94,54,242,264,244,111,160,94,54,379', 466 '264,379,379,379,379,379,379,379,379,379,379,379,379,105,379,379,379', 467 '379,379,104,98,198,379,97,379,379,379,379,91,379,379,379,379,379,379', 468 '115,278,115,281,115,115,115,296,,,379,379,379,379,379,379,379,379,379', 469 '171,171,171,171,171,171,,171,,,,171,,171,171,,171,171,171,171,171,171', 470 '171,,,378,378,378,378,378,378,,378,,,,378,,378,378,,378,378,378,378', 471 '378,378,378,76,4,74,,174,,76,4,74,,174,,,76,4,74,378,174,378,378,378', 472 '378,378,378,378,378,378,378,378,378,,378,378,378,378,378,,,,378,,378', 473 '378,378,378,171,378,378,378,378,378,378,294,294,294,294,131,131,131', 474 '131,,,378,378,378,378,378,378,378,378,378,361,361,361,361,361,361,,361', 475 ',,,361,,361,361,,361,361,361,361,361,361,361,218,293,293,293,293,,218', 476 ',,,,,,218,,,361,,361,361,361,361,361,361,361,361,361,361,361,361,,361', 477 '361,361,361,361,,,,361,,361,361,361,361,,361,361,361,361,361,361,,,', 478 ',,,,,,,361,361,361,361,361,361,361,361,361,199,199,199,199,199,199,', 479 '199,,,,199,,199,199,,199,199,199,199,199,199,199,350,350,350,350,350', 480 '350,,350,,,,350,,350,350,,350,350,350,350,350,350,350,346,346,346,346', 481 '346,346,,346,,,,346,,346,346,,346,346,346,346,346,346,346,191,191,191', 482 '191,191,191,,191,,,,191,,191,191,,191,191,191,191,191,191,191,,199,', 483 ',,,,,,200,200,200,200,200,200,,200,,,,200,,200,200,350,200,200,200,200', 484 '200,200,200,336,336,336,336,336,336,,336,,336,,336,,336,336,346,336', 485 '336,336,336,336,336,336,,,,,,,,323,323,323,323,323,323,,323,191,,,323', 486 ',323,323,,323,323,323,323,323,323,323,,,,,,,,,,,,,,,,,323,200,323,323', 487 '323,323,323,323,323,323,323,323,323,323,,323,323,323,323,323,,,,323', 488 '336,323,323,323,323,,323,323,323,323,323,323,,,,,,,,,,,323,323,323,323', 489 '323,323,323,323,323,321,321,321,321,321,321,,321,,,,321,,321,321,,321', 490 '321,321,321,321,321,321,,,,,,,,,,,,,,,,,321,,321,321,321,321,321,321', 491 '321,321,321,321,321,321,,321,321,321,321,321,,,,321,,321,321,321,321', 492 ',321,321,321,321,321,321,,,,,,,,,,,321,321,321,321,321,321,321,321,321', 493 '398,398,398,398,398,398,,398,,,,398,,398,398,,398,398,398,398,398,398', 494 '398,,,,,,,,,,,,,,,,,398,,398,398,398,398,398,398,398,398,398,398,398', 495 '398,,398,398,398,398,398,,,,398,,398,398,398,398,,398,398,398,398,398', 496 '398,,,,,,,,,,,398,398,398,398,398,398,398,398,398,320,320,320,320,320', 497 '320,,320,,,,320,,320,320,,320,320,320,320,320,320,320,319,319,319,319', 498 '319,319,,319,,,,319,,319,319,,319,319,319,319,319,319,319,77,77,77,77', 499 '77,77,,77,,,,77,,77,77,,77,77,77,77,77,77,77,317,317,317,317,317,317', 500 ',317,,,,317,,317,317,,317,317,317,317,317,317,317,,320,,,,,77,,,,,,', 501 '77,82,82,82,82,82,82,,82,,82,319,82,,82,82,,82,82,82,82,82,82,82,183', 502 '183,183,183,183,183,,183,,,77,183,,183,183,,183,183,183,183,183,183', 503 '183,316,316,316,316,316,316,,316,,,317,316,,316,316,,316,316,316,316', 504 '316,316,316,304,304,304,304,304,304,,304,,,,304,,304,304,,304,304,304', 505 '304,304,304,304,,82,,,,,,,,201,201,201,201,201,201,,201,,,,201,,201', 506 '201,183,201,201,201,201,201,201,201,202,202,202,202,202,202,,202,,,', 507 '202,,202,202,316,202,202,202,202,202,202,202,302,302,302,302,302,302', 508 ',302,,,,302,,302,302,304,302,302,302,302,302,302,302,277,277,277,277', 509 '277,277,,277,,,,277,,277,277,,277,277,277,277,277,277,277,,201,,,,,302', 510 '302,,,,,,302,203,203,203,203,203,203,,203,,,202,203,,203,203,,203,203', 511 '203,203,203,203,203,209,209,209,209,209,209,,209,,,302,209,,209,209', 512 ',209,209,209,209,209,209,209,212,212,212,212,212,212,,212,,,277,212', 513 ',212,212,,212,212,212,212,212,212,212,204,204,204,204,204,204,,204,', 514 ',,204,,204,204,,204,204,204,204,204,204,204,,203,,,,,,,,271,271,271', 515 '271,271,271,,271,,,,271,,271,271,209,271,271,271,271,271,271,271,205', 516 '205,205,205,205,205,,205,,,,205,,205,205,212,205,205,205,205,205,205', 517 '205,206,206,206,206,206,206,,206,,,,206,,206,206,204,206,206,206,206', 518 '206,206,206,,,,,,,,,,145,145,145,145,145,145,,145,,,,145,,145,145,271', 519 '145,145,145,145,145,145,145,,,,,,,,,,,,,,,,205,145,,145,145,145,145', 520 '145,145,145,145,145,145,145,145,145,145,145,145,145,145,,,206,145,,145', 521 '145,145,145,,145,145,145,145,145,145,,,,,,,,,,,145,145,145,145,145,145', 522 '145,145,145,253,253,253,253,253,253,,253,,253,,253,,253,253,,253,253', 523 '253,253,253,253,253,112,112,112,112,112,112,,112,,,,112,,112,112,,112', 524 '112,112,112,112,112,112,38,38,38,38,38,38,38,38,38,38,38,,,38,38,38', 525 '38,38,112,112,112,112,112,112,112,112,112,112,112,,,112,112,112,112', 526 '112,,207,207,207,207,207,207,,207,,,253,207,,207,207,,207,207,207,207', 527 '207,207,207,208,208,208,208,208,208,,208,,,112,208,,208,208,,208,208', 528 '208,208,208,208,208,116,116,116,116,116,116,,116,,,,116,,116,116,,116', 529 '116,116,116,116,116,116,117,117,117,117,117,117,,117,,,,117,,117,117', 530 ',117,117,117,117,117,117,117,,207,,,,,,,,118,118,118,118,118,118,,118', 531 ',,,118,,118,118,208,118,118,118,118,118,118,118,119,119,119,119,119', 532 '119,,119,,,,119,,119,119,116,119,119,119,119,119,119,119,141,141,141', 533 '141,141,141,,141,,,,141,,141,141,117,141,141,141,141,141,141,141,243', 534 '243,243,243,243,243,,243,,,,243,,243,243,,243,243,243,243,243,243,243', 535 ',118,,,,,141,,,,,,,141,,,243,,237,237,237,237,237,237,119,237,,,,237', 536 ',237,237,,237,237,237,237,237,237,237,,,,,,,141,,,,,,,,,,,233,233,233', 537 '233,233,233,,233,,,,233,243,233,233,,233,233,233,233,233,233,233,,,', 538 ',,,,,,,,,,,,,233,,233,233,233,233,233,233,233,233,233,233,233,233,237', 539 '233,233,233,233,233,,,,233,,233,233,233,233,,233,233,233,233,233,233', 540 ',,,,,,274,274,,274,233,233,233,233,233,233,233,233,233,274,,,,,249,249', 541 ',249,,,249,,,,,,,249,,,,,274,274,274,274,274,274,274,274,274,274,274', 542 ',,274,274,274,274,274,249,249,249,249,249,249,249,249,249,249,249,,', 543 '249,249,249,249,249,337,,,,,,,,274,274,274,274,274,274,274,274,,,83', 544 ',,,,,,,249,249,249,249,249,249,249,249,,337,337,337,337,337,337,337', 545 '337,337,337,337,,,337,337,337,337,337,83,83,83,83,83,83,83,83,83,83', 546 '83,,,83,83,83,83,83,,,,247,,,,,337,337,337,337,337,337,337,337,,,,,', 547 ',,,,,83,83,83,83,83,83,83,83,247,247,247,247,247,247,247,247,247,247', 548 '247,,,247,247,247,247,247,5,5,5,5,5,5,5,5,5,5,5,,,5,5,5,5,5,,,,,,,,', 549 '247,247,247,247,247,247,247,247,,,,,,,,,,,5,5,5,5,5,5,5,5,254,254,254', 550 '254,254,254,254,254,254,254,254,,254,254,254,254,254,254,92,92,92,92', 551 '92,92,92,92,92,92,92,,92,92,92,92,92,92,,,,,,,,,254,254,254,254,254', 552 '254,254,254,,,,,,,,,,,92,92,92,92,92,92,92,92,155,155,155,155,155,155', 553 '155,155,155,155,155,,,155,155,155,155,155,89,89,89,89,89,89,89,89,89', 554 '89,89,,,89,89,89,89,89,,,,,,,,,155,155,155,155,155,155,155,155,,,,,', 555 ',,,,,89,89,89,89,89,89,89,89,88,88,88,88,88,88,88,88,88,88,88,,,88,88', 556 '88,88,88,158,158,158,158,158,158,158,158,158,158,158,,158,158,158,158', 557 '158,158,,,,,,,,,88,88,88,88,88,88,88,88,,,,,,,,,,,158,158,158,158,158', 558 '158,158,158,67,67,67,67,67,67,67,67,67,67,67,,,67,67,67,67,67,161,161', 559 '161,161,161,161,161,161,161,161,161,,161,161,161,161,161,161,,,,,,,', 560 ',67,67,67,67,67,67,67,67,,,,,,,,,,,161,161,161,161,161,161,161,161,7', 561 '7,7,7,7,7,7,7,7,7,7,,,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,,,6,6,6,6,6,,', 562 ',,,,,,7,7,7,7,7,7,7,7,,,,,,,,,,,6,6,6,6,6,6,6,6,73,73,73,73,73,73,73', 563 '73,73,73,73,,,73,73,73,73,73' ] 564 racc_action_check = arr = ::Array.new(2875, nil) 461 '440,440,440,440,440,440,293,440,56,293,52,440,293,440,440,440,52,139', 462 '440,440,440,440,440,440,440,438,438,438,438,438,438,106,438,354,326', 463 '103,438,65,438,438,438,151,326,438,438,438,438,438,438,438,88,29,440', 464 '31,51,29,354,31,109,56,56,56,120,207,286,120,106,120,293,120,120,120', 465 '52,328,212,324,151,438,324,212,51,440,440,440,328,440,440,440,440,440', 466 '440,440,440,440,440,318,110,49,207,286,318,88,88,88,142,142,438,438', 467 '438,31,438,438,438,438,438,438,438,438,438,438,436,436,436,436,436,436', 468 '304,436,120,120,120,436,49,436,436,436,428,362,436,436,436,436,436,436', 469 '436,98,116,428,362,304,316,98,227,340,222,316,309,222,340,340,98,304', 470 '309,167,167,167,167,167,167,222,167,309,436,226,167,333,167,167,167', 471 '167,98,167,167,167,167,167,167,167,394,4,297,309,339,297,334,4,225,339', 472 '339,394,66,436,436,436,4,436,436,436,436,436,436,436,436,436,436,167', 473 '167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167', 474 '167,167,167,167,167,167,167,167,267,267,101,167,167,167,95,167,167,167', 475 '167,167,167,167,167,167,167,429,429,429,429,429,429,364,429,68,373,94', 476 '429,373,429,429,429,87,364,429,429,429,429,429,429,429,427,427,427,427', 477 '427,427,187,427,71,83,217,427,83,427,427,427,217,187,427,427,427,427', 478 '427,427,427,217,269,429,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75', 479 '75,75,133,53,221,426,53,133,133,427,418,418,291,429,429,429,426,429', 480 '429,429,429,429,429,429,429,429,429,137,137,350,220,136,136,136,136', 481 '214,214,351,427,427,427,220,427,427,427,427,427,427,427,427,427,427', 482 '175,175,175,175,175,175,363,175,215,215,352,175,353,175,175,175,218', 483 '363,175,175,175,175,175,175,175,76,76,76,76,76,76,76,76,76,76,76,76', 484 '76,76,76,76,76,425,82,82,82,82,82,82,274,82,357,175,425,82,283,82,82', 485 '82,82,73,82,82,82,82,82,82,82,72,201,347,347,347,347,209,201,348,348', 486 '348,348,365,175,175,175,201,175,175,175,175,175,175,175,175,175,175', 487 '82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82', 488 '82,82,82,349,349,198,82,82,82,197,82,82,82,82,82,82,82,82,82,82,273', 489 '273,273,273,273,273,371,273,135,135,189,273,374,273,273,273,346,346', 490 '273,273,273,273,273,273,273,404,404,404,404,404,404,376,404,345,345', 491 '79,404,186,404,404,404,79,184,404,404,404,404,404,404,404,79,380,273', 492 '47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,344,344,343,343,342', 493 '342,138,404,99,99,179,273,273,273,178,273,273,273,273,273,273,273,273', 494 '273,273,131,131,131,131,131,131,131,131,131,131,131,404,404,404,177', 495 '404,404,404,404,404,404,404,404,404,404,402,402,402,402,402,402,176', 496 '402,341,341,395,402,396,402,402,402,134,134,402,402,402,402,402,402', 497 '402,275,275,275,275,275,275,102,275,27,403,77,275,25,275,275,275,77', 498 '23,275,275,275,275,275,275,275,77,55,402,152,384,191,174,55,191,152', 499 '384,191,173,408,412,414,55,416,152,384,191,281,422,172,140,165,141,275', 500 '163,149,3,402,402,402,437,402,402,402,402,402,402,402,402,402,402,147', 501 '1,,,,,,,,,,275,275,275,,275,275,275,275,275,275,275,275,275,275,360', 502 '360,360,360,360,360,,360,,,,360,,360,360,360,,,360,360,360,360,360,360', 503 '360,249,249,249,249,249,249,,249,,,,249,,249,249,,,,249,249,249,249', 504 '249,249,249,,,360,383,383,383,383,383,383,,383,,,,383,,383,383,,,,383', 505 '383,383,383,383,383,383,,,,360,360,360,,360,360,360,360,360,360,360', 506 '360,360,360,,,,,,,377,377,377,377,377,377,,377,,377,,377,,377,377,,', 507 '249,377,377,377,377,377,377,377,,,,367,367,367,367,367,367,,367,,,,367', 508 ',367,367,,,383,367,367,367,367,367,367,367,366,366,366,366,366,366,', 509 '366,,,,366,,366,366,,,,366,366,366,366,366,366,366,,,367,,,,,,,,,,,', 510 ',377,,393,393,393,393,393,393,,393,,,366,393,,393,393,,,,393,393,393', 511 '393,393,393,393,,367,,,,,,,,356,356,356,356,356,356,,356,,,,356,,356', 512 '356,356,356,366,356,356,356,356,356,356,356,330,330,330,330,330,330', 513 ',330,,,,330,,330,330,,,,330,330,330,330,330,330,330,322,322,322,322', 514 '322,322,,322,,393,,322,,322,322,322,,,322,322,322,322,322,322,322,,', 515 ',356,,,310,310,310,310,310,310,,310,,,,310,356,310,310,,,,310,310,310', 516 '310,310,310,310,298,298,298,298,298,298,,298,,298,,298,330,298,298,', 517 ',,298,298,298,298,298,298,298,,,,,,,,,,,,,322,,,,,282,282,282,282,282', 518 '282,,282,,,,282,,282,282,,,,282,282,282,282,282,282,282,,310,,,,,,,', 519 ',,,,,,,,,,,,,,,,,298,282,282,282,282,282,282,282,282,282,282,282,282', 520 '282,282,282,282,282,282,282,282,282,282,282,282,282,282,280,280,280', 521 '280,280,280,,280,,,,280,,280,280,282,,,280,280,280,280,280,280,280,146', 522 '146,146,146,146,146,,146,,,,146,,146,146,146,,,146,146,146,146,146,146', 523 '146,278,278,278,278,278,278,,278,,,,278,,278,278,,,,278,278,278,278', 524 '278,278,278,,397,397,397,397,397,397,,397,,,,397,,397,397,,,280,397', 525 '397,397,397,397,397,397,,,146,,,405,405,405,405,405,405,,405,,,,405', 526 '146,405,405,,,,405,405,405,405,405,405,405,271,271,271,271,271,271,', 527 '271,,,,271,278,271,271,,,,271,271,271,271,271,271,271,,266,266,266,266', 528 '266,266,,266,,,,266,397,266,266,,,,266,266,266,266,266,266,266,80,80', 529 '80,80,80,80,,80,,,,80,,80,80,80,,405,80,80,80,80,80,80,80,406,406,406', 530 '406,406,406,406,406,,,,406,,406,406,,,271,406,406,406,406,406,406,406', 531 ',265,265,265,265,265,265,,265,,,,265,,265,265,,,266,265,265,265,265', 532 '265,265,265,,,80,,,85,85,85,85,85,85,,85,,85,,85,80,85,85,,,,85,85,85', 533 '85,85,85,85,264,264,264,264,264,264,,264,,,,264,406,264,264,,,,264,264', 534 '264,264,264,264,264,,263,263,263,263,263,263,,263,,,,263,265,263,263', 535 ',,,263,263,263,263,263,263,263,262,262,262,262,262,262,,262,,,,262,', 536 '262,262,,,85,262,262,262,262,262,262,262,261,261,261,261,261,261,,261', 537 ',,,261,,261,261,,,264,261,261,261,261,261,261,261,,260,260,260,260,260', 538 '260,,260,,,,260,,260,260,,,263,260,260,260,260,260,260,260,259,259,259', 539 '259,259,259,,259,,,,259,,259,259,,,262,259,259,259,259,259,259,259,258', 540 '258,258,258,258,258,,258,,,,258,,258,258,,,261,258,258,258,258,258,258', 541 '258,,257,257,257,257,257,257,,257,,,,257,,257,257,,,260,257,257,257', 542 '257,257,257,257,256,256,256,256,256,256,,256,,,,256,,256,256,,,259,256', 543 '256,256,256,256,256,256,255,255,255,255,255,255,,255,,,,255,,255,255', 544 ',,258,255,255,255,255,255,255,255,,254,254,254,254,254,254,,254,,,,254', 545 ',254,254,,,257,254,254,254,254,254,254,254,253,253,253,253,253,253,', 546 '253,,,,253,,253,253,,,256,253,253,253,253,253,253,253,252,252,252,252', 547 '252,252,,252,,,,252,,252,252,,,255,252,252,252,252,252,252,252,,251', 548 '251,251,251,251,251,,251,,,,251,,251,251,,,254,251,251,251,251,251,251', 549 '251,250,250,250,250,250,250,,250,,,,250,,250,250,,,253,250,250,250,250', 550 '250,250,250,389,389,389,389,389,389,,389,,,,389,,389,389,389,,252,389', 551 '389,389,389,389,389,389,,248,248,248,248,248,248,,248,,,,248,,248,248', 552 ',,251,248,248,248,248,248,248,248,,,,,,,,,,,,,,,,,,250,,,,,,,,,,389', 553 ',,117,117,117,117,117,117,,117,,,,117,389,117,117,,,,117,117,117,117', 554 '117,117,117,,236,236,236,236,236,236,,236,,,,236,248,236,236,,,,236', 555 '236,236,236,236,236,236,,,,,,,117,117,117,117,117,117,117,117,117,117', 556 '117,117,117,117,117,117,117,,,121,121,121,121,121,121,,121,,,,121,,121', 557 '121,,,117,121,121,121,121,121,121,121,,122,122,122,122,122,122,,122', 558 ',,,122,,122,122,,,236,122,122,122,122,122,122,122,123,123,123,123,123', 559 '123,,123,,,,123,,123,123,,,,123,123,123,123,123,123,123,124,124,124', 560 '124,124,124,,124,,,,124,,124,124,,,121,124,124,124,124,124,124,124,', 561 ',,,,,,,,,,,233,233,233,233,233,233,122,233,,,,233,,233,233,,,,233,233', 562 '233,233,233,233,233,223,223,223,223,223,223,123,223,,,,223,,223,223', 563 ',,,223,223,223,223,223,223,223,,,,,,,124,233,233,233,233,233,233,233', 564 '233,233,233,233,233,233,233,233,233,233,,,231,231,231,231,231,231,,231', 565 ',,,231,,231,231,,,233,231,231,231,231,231,231,231,224,224,224,224,224', 566 '224,224,224,,,,224,,224,224,,,223,224,224,224,224,224,224,224,,,,,,', 567 ',231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231,231', 568 ',,213,213,213,213,213,213,,213,,,,213,,213,213,,,231,213,213,213,213', 569 '213,213,213,210,210,210,210,210,210,,210,,,,210,,210,210,,,224,210,210', 570 '210,210,210,210,210,180,180,180,180,180,180,,180,,,,180,,180,180,,,', 571 '180,180,180,180,180,180,180,,407,407,407,407,407,407,407,407,,,,407', 572 ',407,407,,,213,407,407,407,407,407,407,407,,180,,,,435,435,435,435,435', 573 '435,,435,,,,435,210,435,435,435,435,,435,435,435,435,435,435,435,164', 574 '164,164,164,164,164,,164,,,,164,180,164,164,,,,164,164,164,164,164,164', 575 '164,,279,279,279,279,279,279,,279,,,,279,407,279,279,,,,279,279,279', 576 '279,279,279,279,,,435,,,,,,,,,,,,,,41,435,,,,,,,,,,,,,,,,,,,,,,,,,164', 577 ',,2,,,,,,,,,,,,,,,,,,,,,,,279,41,41,41,41,41,41,41,41,41,41,41,41,41', 578 '41,41,41,41,41,41,41,41,41,41,41,41,41,,,41,2,2,2,2,2,2,2,2,2,2,2,2', 579 '2,2,2,2,2,2,2,2,2,2,2,2,2,2,,2,2,294,294,,294,,,294,,,,,,,,,294,,,,', 580 ',,,,,325,325,,325,,,,,,,,,,,,325,,,,,,,,294,294,294,294,294,294,294', 581 '294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294', 582 '294,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325', 583 '325,325,325,325,325,325,325,325,325,86,,,,,86,,,,,,,,,,,,,,,,,,,,378', 584 ',,,,,,,,,,,,,,,,,,,,,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86', 585 '86,86,86,86,86,86,86,86,86,378,378,378,378,378,378,378,378,378,378,378', 586 '378,378,378,378,378,378,378,378,378,378,378,378,378,378,292,7,7,7,7', 587 '7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,,,,,,96,,,,,,,,,,,,292,292', 588 '292,292,292,292,292,292,292,292,292,292,292,292,292,292,292,292,292', 589 '292,292,292,292,292,292,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96', 590 '96,96,96,96,96,96,96,96,96,96,202,,,,,,,,,,,,,,,,,,,,,,,,,299,,,,,,', 591 ',,,,,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202', 592 '202,202,202,202,202,202,202,202,202,299,299,299,299,299,299,299,299', 593 '299,299,299,299,299,299,299,299,299,299,299,299,299,299,299,299,299', 594 '199,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92', 595 '92,92,92,,,,,,,,,,,,199,199,199,199,199,199,199,199,199,199,199,199', 596 '199,199,199,199,199,199,199,199,199,199,199,199,199,8,8,8,8,8,8,8,8', 597 '8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,196,196,196,196,196,196,196,196,196', 598 '196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,6,6', 599 '6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5', 600 '5,5,5,5,5,5,5,5,5,5,5,5,5,5,93,93,93,93,93,93,93,93,93,93,93,93,93,93', 601 '93,93,93,93,93,93,93,93,93,93,93,69,69,69,69,69,69,69,69,69,69,69,69', 602 '69,69,69,69,69,69,69,69,69,69,69,69,69' ] 603 racc_action_check = arr = ::Array.new(3198, nil) 565 604 idx = 0 566 605 clist.each do |str| … … 572 611 573 612 racc_action_pointer = [ 574 nil, 150, 420, 404, 652, 2412, 2762, 2744, nil, nil, 575 nil, nil, 346, nil, 323, nil, nil, nil, nil, nil, 576 nil, nil, 337, nil, -5, nil, -7, nil, nil, nil, 577 nil, nil, 366, nil, nil, nil, nil, nil, 1848, nil, 578 nil, nil, nil, nil, nil, nil, nil, nil, 18, nil, 579 23, 162, 188, nil, 534, -8, nil, nil, nil, nil, 580 nil, nil, nil, 232, 227, nil, 204, 2674, nil, 233, 581 124, nil, 387, 2814, 653, nil, 651, 1303, nil, nil, 582 205, nil, 1363, 2342, 124, 72, nil, nil, 2604, 2552, 583 22, 543, 2482, nil, 533, 21, nil, 537, 563, nil, 584 nil, 88, nil, nil, 533, 474, nil, nil, nil, nil, 585 nil, 542, 1866, nil, 2, 581, 1972, 1995, 2027, 2050, 586 nil, nil, nil, nil, nil, nil, nil, nil, 275, 322, 587 414, 685, 45, 480, 461, 458, 456, 351, nil, nil, 588 nil, 2073, 485, nil, 477, 1749, 470, nil, 467, nil, 589 445, nil, 235, nil, nil, 2534, 411, 409, 2622, nil, 590 532, 2692, nil, nil, nil, nil, 74, nil, nil, nil, 591 436, 608, 51, nil, 655, 435, nil, 419, 412, nil, 592 206, 138, 401, 1386, 393, 383, nil, nil, nil, 51, 593 nil, 890, nil, nil, 161, 184, 356, 379, 482, 821, 594 922, 1464, 1487, 1570, 1639, 1694, 1717, 1926, 1949, 1593, 595 -2, 21, 1616, -7, nil, 506, nil, 4, 745, nil, 613 nil, 732, 2528, 716, 182, 3068, 3043, 2752, 2993, nil, 596 614 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 597 nil, 515, 517, 2177, 518, 519, 488, 2137, 491, nil, 598 529, 503, 507, 2096, 509, nil, nil, 2394, 204, 2271, 599 nil, nil, 217, 1843, 2464, nil, nil, nil, nil, 108, 600 nil, nil, nil, nil, 536, nil, nil, nil, nil, nil, 601 nil, 1671, nil, 145, 2253, 184, nil, 1533, 581, nil, 602 nil, 586, nil, nil, nil, 273, 224, 91, 105, 144, 603 225, 250, 269, 724, 681, 287, 579, -20, -5, -4, 604 10, nil, 1510, 72, 1432, nil, nil, nil, nil, nil, 605 nil, nil, nil, nil, nil, nil, 1409, 1326, 82, 1280, 606 1257, 1069, 133, 975, 153, nil, nil, 155, nil, nil, 607 216, nil, 22, 222, nil, 235, 945, 2324, nil, 260, 608 nil, nil, 234, nil, nil, nil, 867, 106, nil, nil, 609 844, nil, nil, nil, 253, 294, 310, 315, 283, 319, 610 nil, 727, nil, nil, nil, 329, nil, nil, nil, 334, 611 nil, 339, nil, nil, nil, nil, nil, nil, 633, 514, 612 333, 310, 296, nil, nil, nil, nil, 303, nil, 362, 613 332, nil, 216, 350, 115, nil, nil, 385, 1163, nil ] 615 nil, nil, nil, 624, nil, 619, nil, 656, nil, 38, 616 nil, 40, nil, nil, nil, nil, nil, nil, nil, nil, 617 nil, 2499, nil, nil, nil, nil, nil, 510, nil, 78, 618 nil, 37, 3, 322, nil, 680, -14, nil, nil, nil, 619 nil, nil, nil, nil, nil, 20, 183, nil, 249, 3118, 620 nil, 278, 429, 421, nil, 252, 344, 664, nil, 544, 621 1392, nil, 419, 285, nil, 1473, 2701, 266, 28, nil, 622 nil, nil, 2932, 3093, 214, 193, 2819, nil, 138, 576, 623 nil, 200, 654, 22, nil, nil, 12, nil, nil, 15, 624 1, nil, nil, nil, nil, nil, 137, 1959, nil, nil, 625 55, 2035, 2061, 2086, 2111, nil, nil, nil, nil, nil, 626 nil, 568, nil, 306, 629, 495, 326, 318, 571, -20, 627 672, 673, 64, nil, nil, nil, 1235, 724, nil, 702, 628 nil, 22, 682, nil, nil, nil, nil, nil, nil, nil, 629 nil, nil, nil, 672, 2431, 669, nil, 161, nil, nil, 630 nil, nil, 702, 691, 685, 376, 635, 612, 546, 542, 631 2350, nil, nil, nil, 547, nil, 545, 281, nil, 507, 632 nil, 684, nil, nil, nil, nil, 3018, 451, 447, 2968, 633 nil, 440, 2881, nil, nil, nil, nil, 44, nil, 410, 634 2325, nil, 61, 2300, 343, 368, nil, 286, 381, nil, 635 348, 322, 147, 2173, 2249, 189, 160, 139, nil, nil, 636 nil, 2224, nil, 2148, nil, nil, 1985, nil, nil, nil, 637 nil, nil, nil, nil, nil, nil, nil, nil, 1904, 779, 638 1853, 1828, 1802, 1777, 1752, 1726, 1701, 1676, 1650, 1625, 639 1600, 1574, 1549, 1524, 1498, 1443, 1367, 223, nil, 300, 640 nil, 1341, nil, 514, 385, 659, nil, nil, 1260, 2457, 641 1210, 619, 1132, 379, nil, nil, 45, nil, nil, nil, 642 nil, 325, 2794, -1, 2604, nil, nil, 183, 1090, 2906, 643 nil, nil, nil, nil, 107, nil, nil, nil, nil, 149, 644 1065, nil, nil, nil, nil, nil, 137, nil, 82, nil, 645 nil, nil, 1034, nil, 68, 2629, 23, nil, 65, nil, 646 1009, nil, nil, 167, 186, nil, nil, nil, nil, 170, 647 131, 621, 567, 559, 557, 520, 503, 417, 423, 464, 648 334, 326, 350, 351, 14, nil, 984, 421, nil, nil, 649 754, nil, 129, 376, 256, 451, 908, 883, nil, nil, 650 nil, 510, nil, 260, 520, nil, 539, 855, 2726, nil, 651 556, nil, nil, 807, 683, nil, nil, nil, nil, 1878, 652 nil, nil, nil, 950, 180, 629, 631, 1286, nil, nil, 653 nil, nil, 634, 653, 539, 1316, 1417, 2376, 687, nil, 654 nil, nil, 689, nil, 693, nil, 649, nil, 318, nil, 655 nil, nil, 622, nil, nil, 412, 323, 281, 128, 256, 656 nil, nil, nil, nil, nil, 2406, 118, 666, 23, nil, 657 -2, nil, nil, nil, nil, nil, nil ] 614 658 615 659 racc_action_default = [ 616 -176, -243, -1, -243, -243, -70, -71, -72, -80, -81, 617 -82, -83, -84, -85, -86, -87, -88, -89, -90, -91, 618 -92, -93, -96, -99, -243, -116, -243, -129, -134, -135, 619 -177, -178, -243, -180, -181, -184, -185, -186, -243, -232, 620 -233, -234, -235, -236, -237, -238, -239, 400, -243, -76, 621 -78, -243, -137, -139, -243, -145, -73, -84, -86, -74, 622 -75, -183, -182, -98, -243, -102, -115, -243, -119, -243, 623 -128, -179, -106, -108, -243, -69, -243, -243, -190, -191, 624 -136, -138, -243, -243, -243, -146, -147, -94, -243, -243, 625 -84, -85, -243, -117, -243, -243, -130, -132, -243, -107, 626 -109, -243, -188, -77, -78, -2, -3, -4, -5, -6, 627 -7, -8, -243, -10, -12, -23, -243, -243, -243, -243, 628 -29, -30, -31, -32, -33, -34, -35, -37, -41, -44, 629 -47, -52, -55, -57, -59, -61, -63, -65, -68, -79, 630 -170, -243, -243, -240, -243, -243, -243, -142, -243, -144, 631 -149, -151, -155, -140, -148, -243, -84, -85, -243, -100, 632 -243, -243, -122, -121, -114, -118, -243, -123, -125, -126, 633 -243, -243, -243, -187, -243, -243, -11, -243, -243, -67, 634 -156, -20, -243, -243, -243, -243, -18, -19, -24, -243, 635 -25, -243, -27, -28, -243, -243, -243, -243, -243, -243, 636 -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, 637 -243, -243, -243, -243, -174, -243, -241, -35, -243, -192, 638 -193, -194, -195, -196, -197, -198, -199, -200, -201, -202, 639 -203, -243, -243, -243, -243, -243, -240, -243, -243, -213, 640 -243, -243, -243, -243, -243, -141, -143, -243, -158, -243, 641 -153, -154, -159, -243, -243, -105, -104, -97, -101, -243, 642 -110, -112, -113, -120, -243, -131, -133, -127, -189, -242, 643 -9, -243, -157, -158, -243, -243, -21, -20, -243, -16, 644 -17, -243, -38, -39, -40, -42, -43, -45, -46, -48, 645 -49, -50, -51, -53, -54, -56, -58, -60, -62, -64, 646 -243, -171, -243, -243, -243, -221, -222, -223, -224, -225, 647 -226, -227, -228, -229, -230, -231, -243, -243, -243, -243, 648 -243, -243, -243, -243, -243, -215, -216, -243, -218, -219, 649 -243, -152, -160, -243, -166, -243, -243, -243, -162, -243, 650 -95, -103, -243, -124, -36, -13, -243, -243, -15, -26, 651 -243, -172, -175, -173, -243, -243, -243, -243, -243, -243, 652 -210, -243, -212, -214, -217, -243, -161, -167, -164, -243, 653 -168, -243, -163, -111, -22, -14, -66, -220, -243, -243, 654 -243, -243, -243, -211, -150, -165, -169, -204, -206, -243, 655 -243, -209, -243, -243, -243, -205, -207, -243, -243, -208 ] 660 -215, -269, -1, -269, -269, -86, -88, -90, -92, -98, 661 -99, -100, -101, -102, -103, -104, -105, -106, -107, -108, 662 -109, -110, -111, -112, -113, -114, -115, -118, -121, -269, 663 -139, -269, -163, -164, -165, -166, -167, -168, -169, -216, 664 -217, -269, -219, -220, -223, -224, -225, -269, 447, -269, 665 -94, -96, -269, -171, -173, -269, -180, -87, -112, -114, 666 -89, -91, -93, -222, -221, -120, -269, -124, -138, -269, 667 -142, -269, -155, -158, -218, -130, -132, -269, -85, -269, 668 -269, -229, -269, -170, -172, -269, -269, -269, -181, -182, 669 -184, -116, -269, -269, -112, -113, -269, -140, -269, -269, 670 -159, -161, -269, -269, -129, -131, -269, -227, -95, -96, 671 -2, -3, -4, -5, -6, -7, -8, -269, -10, -12, 672 -25, -269, -269, -269, -269, -31, -32, -33, -34, -35, 673 -36, -37, -39, -43, -46, -49, -54, -57, -59, -61, 674 -63, -65, -67, -69, -97, -209, -269, -269, -265, -269, 675 -82, -269, -269, -230, -231, -232, -233, -234, -235, -236, 676 -237, -238, -239, -265, -269, -269, -243, -269, -245, -247, 677 -248, -249, -269, -269, -269, -269, -269, -269, -269, -269, 678 -269, -268, -37, -84, -269, -176, -269, -269, -179, -186, 679 -188, -192, -193, -174, -183, -185, -269, -112, -113, -269, 680 -122, -269, -269, -145, -144, -137, -141, -269, -146, -148, 681 -269, -151, -269, -269, -269, -269, -226, -269, -269, -11, 682 -269, -269, -195, -269, -269, -269, -269, -269, -19, -20, 683 -26, -269, -27, -269, -29, -30, -269, -71, -72, -73, 684 -74, -75, -76, -77, -78, -79, -80, -81, -269, -269, 685 -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, 686 -269, -269, -269, -269, -269, -269, -269, -269, -213, -269, 687 -266, -269, -250, -269, -269, -269, -244, -246, -269, -269, 688 -269, -269, -269, -269, -261, -262, -269, -263, -175, -177, 689 -178, -269, -269, -197, -269, -190, -191, -198, -269, -269, 690 -128, -127, -119, -123, -269, -133, -135, -136, -143, -269, 691 -269, -149, -153, -160, -162, -152, -269, -156, -269, -228, 692 -267, -9, -269, -196, -197, -269, -269, -14, -269, -23, 693 -269, -17, -18, -269, -269, -70, -40, -41, -42, -44, 694 -45, -47, -48, -50, -51, -52, -53, -55, -56, -58, 695 -60, -62, -64, -66, -269, -210, -269, -269, -83, -240, 696 -269, -242, -269, -269, -269, -269, -269, -269, -260, -264, 697 -194, -269, -189, -199, -269, -205, -269, -269, -269, -201, 698 -269, -117, -125, -269, -269, -147, -150, -154, -157, -269, 699 -38, -13, -15, -269, -269, -28, -269, -269, -211, -214, 700 -212, -241, -269, -269, -269, -269, -269, -269, -269, -200, 701 -206, -203, -269, -207, -269, -202, -269, -134, -269, -24, 702 -16, -68, -251, -253, -254, -269, -269, -269, -269, -269, 703 -187, -204, -208, -126, -21, -269, -269, -269, -269, -256, 704 -269, -258, -22, -252, -255, -257, -259 ] 656 705 657 706 racc_goto_table = [ 658 50, 4, 177, 146, 56, 59, 60, 190, 192, 193, 659 148, 86, 139, 138, 260, 80, 167, 188, 138, 158, 660 275, 258, 178, 35, 31, 165, 332, 73, 12, 74, 661 14, 4, 287, 288, 91, 217, 95, 293, 294, 251, 662 304, 154, 219, 2, 85, 295, 92, 285, 286, 296, 663 72, 332, 297, 35, 71, 157, 91, 298, 12, 91, 664 14, 73, 73, 99, 100, 172, 94, 272, 161, 299, 665 102, 276, 104, 278, 103, 63, 214, 138, 155, 177, 666 64, 177, 152, 259, 72, 72, 254, 160, 94, 66, 667 168, 94, 266, 90, 165, 282, 283, 284, 166, 281, 668 265, 73, 300, 182, 331, 213, 30, 138, 248, 289, 669 290, 291, 292, 101, 156, 90, 347, 258, 90, 78, 670 145, 1, 157, 217, 72, 157, nil, nil, 91, nil, 671 318, nil, nil, 327, nil, nil, 273, nil, nil, nil, 672 nil, nil, nil, nil, nil, nil, nil, nil, 250, nil, 673 nil, nil, nil, nil, 160, nil, 261, 160, 322, nil, 674 94, nil, nil, nil, nil, nil, nil, 276, nil, nil, 675 268, nil, 344, 138, 339, nil, nil, nil, 73, nil, 676 nil, 156, nil, nil, 156, nil, 343, 90, nil, 138, 677 nil, nil, nil, nil, 354, nil, 373, nil, nil, nil, 678 nil, 72, nil, nil, nil, 248, 355, 356, nil, 358, 679 359, 217, 80, 217, 104, nil, nil, nil, 360, nil, 680 362, 157, nil, nil, nil, nil, nil, nil, nil, nil, 681 273, nil, nil, nil, nil, nil, 374, 352, 138, nil, 682 nil, nil, nil, nil, nil, nil, 152, nil, 152, nil, 683 nil, 217, nil, 160, nil, nil, nil, 369, 383, nil, 684 168, nil, nil, nil, 371, nil, nil, nil, 217, 217, 685 389, 390, 138, 152, nil, 387, 388, nil, nil, nil, 686 156, nil, 217, nil, 397, nil, 376, nil, 217, 395, 687 nil, nil, nil, nil, nil, 399, nil, nil, nil, nil, 707 51, 144, 145, 81, 183, 182, 184, 281, 186, 23, 708 267, 95, 208, 83, 206, 305, 303, 313, 328, 169, 709 25, 4, 199, 230, 57, 60, 61, 62, 75, 89, 710 40, 99, 168, 221, 198, 95, 296, 77, 95, 220, 711 373, 182, 232, 234, 235, 65, 96, 207, 23, 76, 712 304, 366, 343, 344, 345, 346, 75, 75, 90, 25, 713 4, 194, 214, 215, 66, 104, 105, 323, 145, 74, 714 202, 373, 196, 107, 68, 109, 94, 76, 76, 347, 715 348, 339, 340, 183, 182, 274, 341, 342, 98, 108, 716 195, 236, 187, 88, 209, 372, 353, 352, 75, 197, 717 94, 152, 286, 94, 169, 359, 39, 361, 351, 106, 718 350, 201, 98, 349, 2, 98, 303, 277, 167, 76, 719 206, 313, 225, 313, 394, 1, 299, nil, nil, 183, 720 182, 311, 183, 182, 314, 406, 407, nil, 198, nil, 721 nil, 198, nil, nil, 95, 326, 329, 333, 109, 334, 722 336, 337, 338, 220, nil, 220, nil, nil, 335, nil, 723 nil, nil, nil, nil, 293, nil, nil, nil, 182, 182, 724 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 725 182, 182, 182, 182, 182, 182, 152, 295, 354, nil, 726 nil, nil, 401, 358, nil, 324, nil, 306, 417, nil, 727 362, 363, 364, 197, nil, nil, 197, nil, nil, 94, 728 nil, nil, 75, 319, 75, 201, nil, nil, 201, 367, 729 380, 98, nil, 385, 390, nil, nil, nil, nil, 183, 730 182, 386, nil, 76, 422, 76, 424, nil, nil, nil, 731 nil, 198, 182, nil, nil, nil, nil, nil, nil, nil, 732 nil, nil, 329, 418, 83, nil, nil, nil, nil, 439, 733 nil, 441, nil, nil, nil, nil, nil, 293, 443, nil, 734 445, nil, 446, nil, nil, nil, nil, 399, 145, nil, 735 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 736 nil, nil, nil, nil, nil, nil, nil, nil, 324, 412, 737 414, 152, 183, 182, 416, 209, 197, nil, nil, nil, 738 nil, 145, nil, nil, nil, 419, 421, 182, 201, nil, 739 nil, nil, nil, nil, nil, nil, nil, 425, 426, 428, 688 740 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 689 741 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 690 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 691 nil, nil, nil, nil, nil, nil, 152, nil, 261 ] 692 693 racc_goto_check = [ 694 32, 27, 6, 25, 27, 27, 27, 10, 10, 10, 695 57, 55, 33, 24, 45, 56, 51, 12, 24, 39, 696 8, 42, 13, 26, 64, 49, 61, 9, 34, 44, 697 36, 27, 15, 15, 35, 10, 53, 17, 17, 60, 698 79, 55, 70, 2, 9, 18, 48, 14, 14, 19, 699 30, 61, 20, 26, 64, 35, 35, 21, 34, 35, 700 36, 9, 9, 44, 44, 53, 27, 60, 48, 22, 701 32, 6, 32, 6, 31, 38, 33, 24, 40, 6, 702 41, 6, 27, 43, 30, 30, 39, 27, 27, 47, 703 32, 27, 25, 34, 49, 12, 12, 12, 50, 13, 704 54, 9, 6, 9, 59, 62, 63, 24, 55, 16, 705 16, 16, 16, 67, 34, 34, 8, 42, 34, 68, 706 69, 1, 35, 10, 30, 35, nil, nil, 35, nil, 707 70, nil, nil, 6, nil, nil, 55, nil, nil, nil, 708 nil, nil, nil, nil, nil, nil, nil, nil, 32, nil, 709 nil, nil, nil, nil, 27, nil, 32, 27, 25, nil, 710 27, nil, nil, nil, nil, nil, nil, 6, nil, nil, 711 32, nil, 12, 24, 25, nil, nil, nil, 9, nil, 712 nil, 34, nil, nil, 34, nil, 51, 34, nil, 24, 713 nil, nil, nil, nil, 6, nil, 45, nil, nil, nil, 714 nil, 30, nil, nil, nil, 55, 6, 6, nil, 6, 715 6, 10, 56, 10, 32, nil, nil, nil, 70, nil, 716 70, 35, nil, nil, nil, nil, nil, nil, nil, nil, 717 55, nil, nil, nil, nil, nil, 6, 33, 24, nil, 718 nil, nil, nil, nil, nil, nil, 27, nil, 27, nil, 719 nil, 10, nil, 27, nil, nil, nil, 25, 70, nil, 720 32, nil, nil, nil, 57, nil, nil, nil, 10, 10, 721 6, 6, 24, 27, nil, 70, 70, nil, nil, nil, 722 34, nil, 10, nil, 6, nil, 24, nil, 10, 70, 723 nil, nil, nil, nil, nil, 70, nil, nil, nil, nil, 742 nil, nil, nil, nil, nil, 423, 399, 145, nil, nil, 724 743 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 725 744 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 745 306 ] 746 747 racc_goto_check = [ 748 36, 37, 12, 72, 26, 13, 28, 73, 60, 38, 749 11, 39, 55, 59, 53, 49, 46, 57, 8, 29, 750 40, 30, 43, 15, 30, 30, 30, 30, 33, 58, 751 68, 56, 84, 10, 39, 39, 65, 48, 39, 6, 752 66, 13, 13, 13, 13, 42, 52, 54, 38, 9, 753 47, 75, 18, 18, 18, 18, 33, 33, 9, 40, 754 30, 58, 56, 56, 45, 48, 48, 65, 12, 68, 755 52, 66, 44, 36, 51, 36, 38, 9, 9, 19, 756 19, 16, 16, 26, 13, 28, 17, 17, 30, 35, 757 9, 27, 61, 62, 36, 64, 24, 23, 33, 38, 758 38, 30, 6, 38, 29, 73, 67, 73, 22, 71, 759 21, 30, 30, 20, 2, 30, 46, 84, 83, 9, 760 53, 57, 9, 57, 8, 1, 43, nil, nil, 26, 761 13, 28, 26, 13, 28, 75, 75, nil, 39, nil, 762 nil, 39, nil, nil, 39, 6, 12, 10, 36, 10, 763 15, 15, 15, 6, nil, 6, nil, nil, 12, nil, 764 nil, nil, nil, nil, 58, nil, nil, nil, 13, 13, 765 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 766 13, 13, 13, 13, 13, 13, 30, 36, 6, nil, 767 nil, nil, 73, 12, nil, 58, nil, 36, 49, nil, 768 6, 6, 6, 38, nil, nil, 38, nil, nil, 38, 769 nil, nil, 33, 36, 33, 30, nil, nil, 30, 29, 770 12, 30, nil, 55, 15, nil, nil, nil, nil, 26, 771 13, 28, nil, 9, 73, 9, 73, nil, nil, nil, 772 nil, 39, 13, nil, nil, nil, nil, nil, nil, nil, 773 nil, nil, 12, 11, 59, nil, nil, nil, nil, 73, 774 nil, 73, nil, nil, nil, nil, nil, 58, 73, nil, 775 73, nil, 73, nil, nil, nil, nil, 37, 12, nil, 726 776 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 727 nil, nil, nil, nil, nil, nil, 27, nil, 32 ] 777 nil, nil, nil, nil, nil, nil, nil, nil, 58, 12, 778 60, 30, 26, 13, 28, 36, 38, nil, nil, nil, 779 nil, 12, nil, nil, nil, 12, 26, 13, 30, nil, 780 nil, nil, nil, nil, nil, nil, nil, 6, 6, 6, 781 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 782 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 783 nil, nil, nil, nil, nil, 72, 37, 12, nil, nil, 784 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 785 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 786 36 ] 728 787 729 788 racc_goto_pointer = [ 730 nil, 121, 43, nil, nil, nil, -110, nil, -161, -11, 731 -110, nil, -99, -90, -150, -167, -92, -168, -162, -159, 732 -157, -153, -142, nil, -64, -79, 21, -1, nil, nil, 733 12, -2, -4, -65, 26, -33, 28, nil, 53, -69, 734 -9, 58, -137, -77, -9, -146, nil, 65, -21, -67, 735 4, -78, nil, -33, -70, -44, -36, -73, nil, -143, 736 -113, -222, -36, 104, 22, nil, nil, 39, 69, 41, 737 -103, nil, nil, nil, nil, nil, nil, nil, nil, -177 ] 789 nil, 125, 114, nil, nil, nil, -78, nil, -206, 2, 790 -84, -136, -78, -80, nil, -98, -170, -167, -203, -180, 791 -148, -152, -155, -167, -169, nil, -81, -40, -79, -63, 792 19, nil, nil, -19, nil, 10, -4, -79, 7, -58, 793 18, nil, 18, -70, -19, 37, -183, -151, -10, -186, 794 nil, 45, -23, -82, -51, -86, -40, -195, -27, -39, 795 -78, 6, 37, nil, -197, -155, -253, 104, 28, nil, 796 nil, 32, -48, -168, nil, -231, nil, nil, nil, nil, 797 nil, nil, nil, 36, -50 ] 738 798 739 799 racc_goto_default = [ 740 nil, nil, nil, 114, 105, 111, 244, 115, nil, 7, 741 126, 116, 127, nil, 128, 129, 130, 131, 132, 133, 742 134, 135, 136, 137, 179, 140, 220, 218, 48, 5, 743 6, 49, 84, nil, 57, 13, 58, 22, nil, nil, 744 nil, nil, 159, nil, 180, nil, 24, nil, nil, 93, 745 nil, nil, 26, nil, 96, 51, 52, 335, 150, 151, 746 333, 252, nil, nil, nil, 33, 34, nil, 227, nil, 747 nil, 221, 222, 223, 224, 225, 226, 228, 229, nil ] 800 nil, nil, nil, 119, 110, 116, 151, 120, nil, 7, 801 nil, nil, 150, 131, 121, 132, 133, 134, 135, 136, 802 137, 138, 139, 140, 141, 142, 143, nil, nil, 44, 803 191, 49, 5, 6, 8, 50, 87, 268, 58, 24, 804 59, 27, nil, nil, nil, nil, 200, nil, 222, nil, 805 29, nil, nil, 97, nil, nil, nil, 100, 52, 53, 806 376, nil, nil, 189, 190, 374, 297, nil, nil, 42, 807 43, nil, 154, 170, 153, 155, 156, 157, 158, 159, 808 160, 161, 162, nil, nil ] 748 809 749 810 racc_reduce_table = [ 750 811 0, 0, :racc_error, 751 1, 97, :_reduce_none, 752 1, 99, :_reduce_2, 753 1, 99, :_reduce_3, 754 1, 99, :_reduce_4, 755 1, 99, :_reduce_5, 756 1, 99, :_reduce_6, 757 1, 99, :_reduce_7, 758 1, 99, :_reduce_8, 759 3, 99, :_reduce_9, 760 1, 101, :_reduce_10, 761 2, 101, :_reduce_11, 762 1, 103, :_reduce_none, 763 4, 103, :_reduce_none, 764 5, 103, :_reduce_none, 765 4, 103, :_reduce_15, 766 3, 103, :_reduce_16, 767 3, 103, :_reduce_17, 768 2, 103, :_reduce_18, 769 2, 103, :_reduce_19, 770 0, 104, :_reduce_none, 812 1, 98, :_reduce_none, 813 1, 100, :_reduce_2, 814 1, 100, :_reduce_3, 815 1, 100, :_reduce_4, 816 1, 100, :_reduce_5, 817 1, 100, :_reduce_6, 818 1, 100, :_reduce_7, 819 1, 100, :_reduce_8, 820 3, 100, :_reduce_9, 821 1, 102, :_reduce_10, 822 2, 102, :_reduce_11, 771 823 1, 104, :_reduce_none, 824 4, 104, :_reduce_13, 772 825 3, 104, :_reduce_none, 773 1, 106, :_reduce_none, 774 2, 106, :_reduce_24, 775 2, 106, :_reduce_25, 776 4, 106, :_reduce_26, 777 2, 106, :_reduce_27, 778 2, 106, :_reduce_28, 779 1, 107, :_reduce_29, 780 1, 107, :_reduce_30, 781 1, 107, :_reduce_31, 782 1, 107, :_reduce_32, 783 1, 107, :_reduce_33, 784 1, 107, :_reduce_34, 785 1, 108, :_reduce_none, 786 4, 108, :_reduce_36, 826 4, 104, :_reduce_none, 827 5, 104, :_reduce_none, 828 3, 104, :_reduce_17, 829 3, 104, :_reduce_18, 830 2, 104, :_reduce_19, 831 2, 104, :_reduce_20, 832 6, 104, :_reduce_none, 833 7, 104, :_reduce_none, 834 1, 105, :_reduce_none, 835 3, 105, :_reduce_none, 787 836 1, 110, :_reduce_none, 788 3, 110, :_reduce_38, 789 3, 110, :_reduce_39, 790 3, 110, :_reduce_40, 791 1, 111, :_reduce_none, 792 3, 111, :_reduce_42, 793 3, 111, :_reduce_43, 837 2, 110, :_reduce_26, 838 2, 110, :_reduce_27, 839 4, 110, :_reduce_28, 840 2, 110, :_reduce_29, 841 2, 110, :_reduce_30, 842 1, 111, :_reduce_31, 843 1, 111, :_reduce_32, 844 1, 111, :_reduce_33, 845 1, 111, :_reduce_34, 846 1, 111, :_reduce_35, 847 1, 111, :_reduce_36, 794 848 1, 112, :_reduce_none, 795 3, 112, :_reduce_45, 796 3, 112, :_reduce_46, 849 4, 112, :_reduce_38, 797 850 1, 113, :_reduce_none, 798 3, 113, :_reduce_48, 799 3, 113, :_reduce_49, 800 3, 113, :_reduce_50, 801 3, 113, :_reduce_51, 851 3, 113, :_reduce_40, 852 3, 113, :_reduce_41, 853 3, 113, :_reduce_42, 802 854 1, 114, :_reduce_none, 803 3, 114, :_reduce_ 53,804 3, 114, :_reduce_ 54,855 3, 114, :_reduce_44, 856 3, 114, :_reduce_45, 805 857 1, 115, :_reduce_none, 806 3, 115, :_reduce_56, 858 3, 115, :_reduce_47, 859 3, 115, :_reduce_48, 807 860 1, 116, :_reduce_none, 808 3, 116, :_reduce_58, 861 3, 116, :_reduce_50, 862 3, 116, :_reduce_51, 863 3, 116, :_reduce_52, 864 3, 116, :_reduce_53, 809 865 1, 117, :_reduce_none, 810 3, 117, :_reduce_60, 866 3, 117, :_reduce_55, 867 3, 117, :_reduce_56, 811 868 1, 118, :_reduce_none, 812 3, 118, :_reduce_ 62,869 3, 118, :_reduce_58, 813 870 1, 119, :_reduce_none, 814 3, 119, :_reduce_6 4,871 3, 119, :_reduce_60, 815 872 1, 120, :_reduce_none, 816 5, 120, :_reduce_66,817 1, 1 02, :_reduce_67,818 1, 121, :_reduce_68,819 3, 122, :_reduce_none,820 1, 123, :_reduce_70,873 3, 120, :_reduce_62, 874 1, 121, :_reduce_none, 875 3, 121, :_reduce_64, 876 1, 122, :_reduce_none, 877 3, 122, :_reduce_66, 821 878 1, 123, :_reduce_none, 822 1, 123, :_reduce_72, 823 2, 123, :_reduce_73, 824 2, 123, :_reduce_74, 825 2, 123, :_reduce_75, 826 1, 124, :_reduce_76, 827 3, 124, :_reduce_77, 879 5, 123, :_reduce_68, 880 1, 109, :_reduce_none, 881 3, 109, :_reduce_none, 882 1, 124, :_reduce_none, 883 1, 124, :_reduce_none, 884 1, 124, :_reduce_none, 885 1, 124, :_reduce_none, 886 1, 124, :_reduce_none, 887 1, 124, :_reduce_none, 888 1, 124, :_reduce_none, 889 1, 124, :_reduce_none, 890 1, 124, :_reduce_none, 891 1, 124, :_reduce_none, 892 1, 124, :_reduce_none, 893 1, 103, :_reduce_82, 894 3, 103, :_reduce_83, 895 1, 125, :_reduce_84, 896 3, 126, :_reduce_none, 897 1, 127, :_reduce_86, 898 2, 127, :_reduce_87, 828 899 1, 127, :_reduce_none, 829 3, 127, :_reduce_79, 830 1, 126, :_reduce_80, 831 1, 126, :_reduce_81, 832 1, 126, :_reduce_82, 833 1, 126, :_reduce_83, 834 1, 126, :_reduce_84, 835 1, 126, :_reduce_85, 836 1, 126, :_reduce_86, 837 1, 126, :_reduce_87, 838 1, 126, :_reduce_88, 839 1, 126, :_reduce_89, 840 1, 126, :_reduce_90, 841 1, 126, :_reduce_91, 842 1, 126, :_reduce_92, 843 1, 126, :_reduce_93, 844 0, 136, :_reduce_94, 845 6, 130, :_reduce_95, 846 0, 137, :_reduce_96, 847 5, 130, :_reduce_97, 848 2, 130, :_reduce_98, 849 1, 133, :_reduce_99, 850 1, 135, :_reduce_none, 851 2, 135, :_reduce_none, 852 1, 134, :_reduce_102, 853 3, 138, :_reduce_103, 854 2, 138, :_reduce_none, 855 2, 138, :_reduce_none, 900 2, 127, :_reduce_89, 901 1, 127, :_reduce_90, 902 2, 127, :_reduce_91, 903 1, 127, :_reduce_none, 904 2, 127, :_reduce_none, 905 1, 128, :_reduce_94, 906 3, 128, :_reduce_95, 907 1, 132, :_reduce_none, 908 3, 132, :_reduce_97, 909 1, 129, :_reduce_none, 910 1, 129, :_reduce_none, 911 1, 129, :_reduce_none, 912 1, 129, :_reduce_none, 913 1, 130, :_reduce_102, 914 1, 130, :_reduce_103, 915 1, 130, :_reduce_104, 916 1, 130, :_reduce_105, 917 1, 130, :_reduce_106, 918 1, 130, :_reduce_107, 919 1, 130, :_reduce_108, 920 1, 130, :_reduce_109, 921 1, 130, :_reduce_110, 922 1, 130, :_reduce_111, 923 1, 130, :_reduce_112, 924 1, 130, :_reduce_113, 925 1, 130, :_reduce_114, 926 1, 130, :_reduce_115, 927 0, 141, :_reduce_116, 928 6, 135, :_reduce_117, 929 0, 142, :_reduce_118, 930 5, 135, :_reduce_119, 931 2, 135, :_reduce_120, 932 1, 138, :_reduce_121, 856 933 1, 140, :_reduce_none, 857 2, 140, :_reduce_107, 858 1, 140, :_reduce_108, 859 2, 140, :_reduce_109, 860 1, 139, :_reduce_110, 861 3, 139, :_reduce_111, 862 1, 141, :_reduce_none, 863 5, 131, :_reduce_none, 864 4, 131, :_reduce_none, 865 2, 131, :_reduce_none, 866 1, 142, :_reduce_116, 867 1, 144, :_reduce_none, 868 2, 144, :_reduce_none, 869 1, 143, :_reduce_none, 870 3, 145, :_reduce_none, 871 2, 145, :_reduce_none, 872 2, 145, :_reduce_none, 934 2, 140, :_reduce_none, 935 1, 139, :_reduce_124, 936 3, 143, :_reduce_125, 937 5, 143, :_reduce_126, 938 2, 143, :_reduce_none, 939 2, 143, :_reduce_none, 940 2, 145, :_reduce_129, 941 1, 145, :_reduce_none, 942 2, 145, :_reduce_131, 943 1, 145, :_reduce_132, 944 1, 144, :_reduce_133, 945 3, 144, :_reduce_134, 873 946 1, 146, :_reduce_none, 874 3, 146, :_reduce_none, 875 1, 147, :_reduce_none, 876 4, 132, :_reduce_none, 877 5, 132, :_reduce_none, 878 2, 132, :_reduce_none, 879 1, 148, :_reduce_129, 947 5, 136, :_reduce_none, 948 4, 136, :_reduce_none, 949 2, 136, :_reduce_none, 950 1, 147, :_reduce_139, 880 951 1, 149, :_reduce_none, 881 3, 149, :_reduce_none,882 1, 1 50, :_reduce_none,952 2, 149, :_reduce_none, 953 1, 148, :_reduce_none, 883 954 3, 150, :_reduce_none, 884 1, 105, :_reduce_134,885 1, 105, :_reduce_135,886 2, 128, :_reduce_136,887 1, 128, :_reduce_none,888 2, 128, :_reduce_138,889 1, 152, :_reduce_139,890 3, 152, :_reduce_ 140,891 4, 1 52, :_reduce_141,892 3, 152, :_reduce_142,893 4, 152, :_reduce_143,894 3, 152, :_reduce_144,895 1, 151, :_reduce_145,896 2, 151, :_reduce_146,897 2, 151, :_reduce_147,898 3, 151, :_reduce_148,955 2, 150, :_reduce_none, 956 2, 150, :_reduce_none, 957 1, 151, :_reduce_none, 958 3, 151, :_reduce_none, 959 1, 152, :_reduce_none, 960 2, 152, :_reduce_none, 961 3, 152, :_reduce_none, 962 4, 137, :_reduce_none, 963 5, 137, :_reduce_none, 964 5, 137, :_reduce_none, 965 6, 137, :_reduce_none, 966 2, 137, :_reduce_none, 967 5, 137, :_reduce_none, 968 6, 137, :_reduce_none, 969 2, 137, :_reduce_none, 899 970 1, 153, :_reduce_none, 900 5, 153, :_reduce_none,971 3, 153, :_reduce_none, 901 972 1, 154, :_reduce_none, 902 973 3, 154, :_reduce_none, 903 2, 155, :_reduce_none, 904 2, 155, :_reduce_none, 905 1, 155, :_reduce_none, 906 1, 109, :_reduce_none, 907 2, 109, :_reduce_none, 908 1, 156, :_reduce_none, 909 1, 156, :_reduce_none, 910 2, 156, :_reduce_none, 911 3, 157, :_reduce_none, 912 2, 157, :_reduce_none, 913 3, 157, :_reduce_none, 914 3, 157, :_reduce_none, 915 4, 157, :_reduce_none, 916 2, 157, :_reduce_166, 917 3, 157, :_reduce_none, 918 3, 157, :_reduce_168, 919 4, 157, :_reduce_none, 920 1, 129, :_reduce_170, 921 3, 129, :_reduce_171, 922 4, 129, :_reduce_172, 923 4, 129, :_reduce_173, 924 1, 158, :_reduce_174, 925 3, 158, :_reduce_175, 926 0, 98, :_reduce_none, 927 2, 98, :_reduce_none, 974 1, 106, :_reduce_163, 975 1, 106, :_reduce_none, 976 1, 106, :_reduce_165, 977 1, 131, :_reduce_none, 978 1, 131, :_reduce_none, 979 1, 131, :_reduce_none, 980 1, 131, :_reduce_none, 981 2, 133, :_reduce_170, 982 1, 133, :_reduce_none, 983 2, 133, :_reduce_172, 984 1, 156, :_reduce_173, 985 3, 156, :_reduce_174, 986 4, 156, :_reduce_175, 987 3, 156, :_reduce_176, 988 4, 156, :_reduce_177, 989 4, 156, :_reduce_none, 990 3, 156, :_reduce_179, 991 1, 155, :_reduce_180, 992 2, 155, :_reduce_181, 993 2, 155, :_reduce_182, 994 3, 155, :_reduce_183, 928 995 1, 159, :_reduce_none, 929 996 2, 159, :_reduce_none, 997 1, 157, :_reduce_none, 998 5, 157, :_reduce_none, 930 999 1, 160, :_reduce_none, 931 1, 160, :_reduce_none, 932 2, 160, :_reduce_none, 933 2, 160, :_reduce_none, 934 1, 160, :_reduce_none, 935 1, 160, :_reduce_none, 936 1, 160, :_reduce_none, 937 4, 161, :_reduce_187, 938 1, 163, :_reduce_188, 939 3, 163, :_reduce_189, 940 3, 162, :_reduce_none, 941 0, 165, :_reduce_none, 1000 3, 160, :_reduce_none, 1001 2, 161, :_reduce_none, 1002 2, 161, :_reduce_none, 1003 1, 161, :_reduce_none, 1004 1, 158, :_reduce_none, 1005 3, 158, :_reduce_none, 1006 1, 107, :_reduce_none, 1007 2, 107, :_reduce_none, 1008 1, 162, :_reduce_none, 1009 1, 162, :_reduce_none, 1010 2, 162, :_reduce_none, 1011 3, 163, :_reduce_none, 1012 2, 163, :_reduce_none, 1013 3, 163, :_reduce_none, 1014 3, 163, :_reduce_none, 1015 4, 163, :_reduce_none, 1016 2, 163, :_reduce_205, 1017 3, 163, :_reduce_none, 1018 3, 163, :_reduce_207, 1019 4, 163, :_reduce_none, 1020 1, 134, :_reduce_209, 1021 3, 134, :_reduce_210, 1022 4, 134, :_reduce_211, 1023 4, 134, :_reduce_212, 1024 1, 108, :_reduce_213, 1025 3, 108, :_reduce_214, 1026 0, 99, :_reduce_none, 1027 2, 99, :_reduce_none, 1028 1, 164, :_reduce_none, 1029 2, 164, :_reduce_none, 1030 1, 165, :_reduce_none, 1031 1, 165, :_reduce_none, 942 1032 2, 165, :_reduce_none, 943 1, 166, :_reduce_none, 944 1, 166, :_reduce_none, 945 1, 166, :_reduce_none, 946 1, 166, :_reduce_none, 947 1, 166, :_reduce_none, 948 1, 166, :_reduce_none, 949 1, 166, :_reduce_none, 950 1, 166, :_reduce_none, 951 1, 166, :_reduce_none, 952 1, 166, :_reduce_none, 953 1, 166, :_reduce_none, 954 5, 167, :_reduce_none, 955 7, 167, :_reduce_none, 956 5, 168, :_reduce_none, 957 7, 169, :_reduce_none, 958 9, 170, :_reduce_none, 959 5, 171, :_reduce_none, 960 3, 172, :_reduce_none, 961 4, 172, :_reduce_none, 962 3, 172, :_reduce_none, 963 3, 164, :_reduce_none, 964 3, 173, :_reduce_none, 965 2, 173, :_reduce_none, 966 2, 173, :_reduce_none, 967 3, 173, :_reduce_none, 968 2, 173, :_reduce_none, 969 2, 174, :_reduce_none, 970 4, 174, :_reduce_none, 971 1, 175, :_reduce_none, 972 1, 175, :_reduce_none, 973 1, 175, :_reduce_none, 974 1, 175, :_reduce_none, 975 1, 175, :_reduce_none, 976 1, 175, :_reduce_none, 977 1, 175, :_reduce_none, 978 1, 175, :_reduce_none, 979 1, 175, :_reduce_none, 980 1, 175, :_reduce_none, 981 1, 175, :_reduce_none, 982 1, 125, :_reduce_none, 983 1, 125, :_reduce_none, 984 1, 125, :_reduce_none, 985 1, 125, :_reduce_none, 986 1, 125, :_reduce_none, 987 1, 125, :_reduce_none, 988 1, 125, :_reduce_none, 989 1, 125, :_reduce_none, 990 1, 100, :_reduce_240, 991 2, 100, :_reduce_241, 992 3, 100, :_reduce_242 ] 993 994 racc_reduce_n = 243 995 996 racc_shift_n = 400 1033 2, 165, :_reduce_none, 1034 1, 165, :_reduce_none, 1035 1, 165, :_reduce_none, 1036 1, 165, :_reduce_none, 1037 4, 166, :_reduce_226, 1038 1, 168, :_reduce_227, 1039 3, 168, :_reduce_228, 1040 3, 167, :_reduce_none, 1041 1, 170, :_reduce_none, 1042 1, 170, :_reduce_none, 1043 1, 170, :_reduce_none, 1044 1, 170, :_reduce_none, 1045 1, 170, :_reduce_none, 1046 1, 170, :_reduce_none, 1047 1, 170, :_reduce_none, 1048 1, 170, :_reduce_none, 1049 1, 170, :_reduce_none, 1050 1, 170, :_reduce_none, 1051 3, 171, :_reduce_none, 1052 4, 171, :_reduce_none, 1053 3, 171, :_reduce_none, 1054 2, 169, :_reduce_none, 1055 3, 169, :_reduce_none, 1056 1, 180, :_reduce_none, 1057 2, 180, :_reduce_none, 1058 1, 181, :_reduce_none, 1059 1, 181, :_reduce_none, 1060 1, 172, :_reduce_none, 1061 2, 172, :_reduce_none, 1062 5, 173, :_reduce_none, 1063 7, 173, :_reduce_none, 1064 5, 177, :_reduce_none, 1065 5, 174, :_reduce_none, 1066 7, 175, :_reduce_none, 1067 6, 176, :_reduce_none, 1068 7, 176, :_reduce_none, 1069 6, 176, :_reduce_none, 1070 7, 176, :_reduce_none, 1071 3, 178, :_reduce_none, 1072 2, 178, :_reduce_none, 1073 2, 178, :_reduce_none, 1074 2, 178, :_reduce_none, 1075 3, 178, :_reduce_none, 1076 1, 101, :_reduce_265, 1077 2, 101, :_reduce_266, 1078 3, 101, :_reduce_267, 1079 1, 179, :_reduce_268 ] 1080 1081 racc_reduce_n = 269 1082 1083 racc_shift_n = 447 997 1084 998 1085 racc_token_table = { … … 1014 1101 "++" => 15, 1015 1102 "--" => 16, 1016 "," => 17, 1017 :SIZEOF => 18, 1018 "&" => 19, 1019 "*" => 20, 1020 "+" => 21, 1021 "-" => 22, 1022 "~" => 23, 1023 "!" => 24, 1024 "/" => 25, 1025 "%" => 26, 1026 "<<" => 27, 1027 ">>" => 28, 1028 "<" => 29, 1029 ">" => 30, 1030 "<=" => 31, 1031 ">=" => 32, 1032 "==" => 33, 1033 "!=" => 34, 1034 "^" => 35, 1035 "|" => 36, 1036 "&&" => 37, 1037 "||" => 38, 1038 "?" => 39, 1039 ":" => 40, 1040 ";" => 41, 1041 "=" => 42, 1042 :VOID => 43, 1043 :FLOAT => 44, 1044 :DOUBLE => 45, 1045 :BOOL => 46, 1046 :TYPE_NAME => 47, 1047 :CHAR => 48, 1048 :SHORT => 49, 1049 :INT => 50, 1050 :LONG => 51, 1051 :SIGNED => 52, 1052 :UNSIGNED => 53, 1053 "{" => 54, 1054 "}" => 55, 1055 :STRUCT => 56, 1056 :UNION => 57, 1057 :ENUM => 58, 1058 :CONST => 59, 1059 :VOLATILE => 60, 1060 :C_EXP => 61, 1061 :EXTENSION => 62, 1062 :TYPEDEF => 63, 1063 :IF => 64, 1064 :ELSE => 65, 1065 :WHILE => 66, 1066 :DO => 67, 1067 :FOR => 68, 1068 :SWITCH => 69, 1069 :infunc_statment => 70, 1070 :CASE => 71, 1071 :DEFAULT => 72, 1072 :GOTO => 73, 1073 :CONTINUE => 74, 1074 :BREAK => 75, 1075 :RETURN => 76, 1076 "+=" => 77, 1077 "-=" => 78, 1078 "*=" => 79, 1079 "/=" => 80, 1080 "%=" => 81, 1081 "<<=" => 82, 1082 ">>=" => 83, 1083 "&=" => 84, 1084 "|=" => 85, 1085 "^=" => 86, 1086 :__INLINE__ => 87, 1087 :INLINE => 88, 1088 :__INLINE => 89, 1089 :CINLINE => 90, 1090 :EXTERN => 91, 1091 :STATIC => 92, 1092 :AUTO => 93, 1093 :REGISTER => 94, 1094 "::" => 95 } 1095 1096 racc_nt_base = 96 1103 "{" => 17, 1104 "}" => 18, 1105 "," => 19, 1106 :SIZEOF => 20, 1107 "&" => 21, 1108 "*" => 22, 1109 "+" => 23, 1110 "-" => 24, 1111 "~" => 25, 1112 "!" => 26, 1113 "/" => 27, 1114 "%" => 28, 1115 "<<" => 29, 1116 ">>" => 30, 1117 "<" => 31, 1118 ">" => 32, 1119 "<=" => 33, 1120 ">=" => 34, 1121 "==" => 35, 1122 "!=" => 36, 1123 "^" => 37, 1124 "|" => 38, 1125 "&&" => 39, 1126 "||" => 40, 1127 "?" => 41, 1128 ":" => 42, 1129 "=" => 43, 1130 "+=" => 44, 1131 "-=" => 45, 1132 "*=" => 46, 1133 "/=" => 47, 1134 "%=" => 48, 1135 "<<=" => 49, 1136 ">>=" => 50, 1137 "&=" => 51, 1138 "|=" => 52, 1139 "^=" => 53, 1140 ";" => 54, 1141 :EXTERN => 55, 1142 :STATIC => 56, 1143 :AUTO => 57, 1144 :REGISTER => 58, 1145 :VOID => 59, 1146 :CHAR => 60, 1147 :SHORT => 61, 1148 :INT => 62, 1149 :LONG => 63, 1150 :FLOAT => 64, 1151 :DOUBLE => 65, 1152 :SIGNED => 66, 1153 :UNSIGNED => 67, 1154 :BOOL => 68, 1155 :TYPE_NAME => 69, 1156 :STRUCT => 70, 1157 :UNION => 71, 1158 :ENUM => 72, 1159 :CONST => 73, 1160 :RESTRICT => 74, 1161 :VOLATILE => 75, 1162 :__INLINE__ => 76, 1163 :INLINE => 77, 1164 :__INLINE => 78, 1165 :CINLINE => 79, 1166 :C_EXP => 80, 1167 :EXTENSION => 81, 1168 :TYPEDEF => 82, 1169 :CASE => 83, 1170 :DEFAULT => 84, 1171 :IF => 85, 1172 :ELSE => 86, 1173 :SWITCH => 87, 1174 :WHILE => 88, 1175 :DO => 89, 1176 :FOR => 90, 1177 :GOTO => 91, 1178 :CONTINUE => 92, 1179 :BREAK => 93, 1180 :RETURN => 94, 1181 "::" => 95, 1182 :_ASM => 96 } 1183 1184 racc_nt_base = 97 1097 1185 1098 1186 racc_use_result_var = true … … 1132 1220 "\"++\"", 1133 1221 "\"--\"", 1222 "\"{\"", 1223 "\"}\"", 1134 1224 "\",\"", 1135 1225 "SIZEOF", … … 1156 1246 "\"?\"", 1157 1247 "\":\"", 1158 "\";\"",1159 1248 "\"=\"", 1160 "VOID",1161 "FLOAT",1162 "DOUBLE",1163 "BOOL",1164 "TYPE_NAME",1165 "CHAR",1166 "SHORT",1167 "INT",1168 "LONG",1169 "SIGNED",1170 "UNSIGNED",1171 "\"{\"",1172 "\"}\"",1173 "STRUCT",1174 "UNION",1175 "ENUM",1176 "CONST",1177 "VOLATILE",1178 "C_EXP",1179 "EXTENSION",1180 "TYPEDEF",1181 "IF",1182 "ELSE",1183 "WHILE",1184 "DO",1185 "FOR",1186 "SWITCH",1187 "infunc_statment",1188 "CASE",1189 "DEFAULT",1190 "GOTO",1191 "CONTINUE",1192 "BREAK",1193 "RETURN",1194 1249 "\"+=\"", 1195 1250 "\"-=\"", … … 1202 1257 "\"|=\"", 1203 1258 "\"^=\"", 1259 "\";\"", 1260 "EXTERN", 1261 "STATIC", 1262 "AUTO", 1263 "REGISTER", 1264 "VOID", 1265 "CHAR", 1266 "SHORT", 1267 "INT", 1268 "LONG", 1269 "FLOAT", 1270 "DOUBLE", 1271 "SIGNED", 1272 "UNSIGNED", 1273 "BOOL", 1274 "TYPE_NAME", 1275 "STRUCT", 1276 "UNION", 1277 "ENUM", 1278 "CONST", 1279 "RESTRICT", 1280 "VOLATILE", 1204 1281 "__INLINE__", 1205 1282 "INLINE", 1206 1283 "__INLINE", 1207 1284 "CINLINE", 1208 "EXTERN", 1209 "STATIC", 1210 "AUTO", 1211 "REGISTER", 1285 "C_EXP", 1286 "EXTENSION", 1287 "TYPEDEF", 1288 "CASE", 1289 "DEFAULT", 1290 "IF", 1291 "ELSE", 1292 "SWITCH", 1293 "WHILE", 1294 "DO", 1295 "FOR", 1296 "GOTO", 1297 "CONTINUE", 1298 "BREAK", 1299 "RETURN", 1212 1300 "\"::\"", 1301 "_ASM", 1213 1302 "$start", 1214 1303 "all", … … 1219 1308 "expression", 1220 1309 "postfix_expression", 1221 "argument_ list",1310 "argument_expression_list", 1222 1311 "type_qualifier", 1312 "type_name", 1313 "initializer_list", 1314 "assignment_expression", 1223 1315 "unary_expression", 1224 1316 "unary_operator", 1225 1317 "cast_expression", 1226 "type_name",1227 1318 "multiplicative_expression", 1228 1319 "additive_expression", … … 1236 1327 "logical_or_expression", 1237 1328 "conditional_expression", 1329 "assignment_operator", 1238 1330 "constant_expression", 1239 1331 "declaration", 1240 1332 "declaration_specifiers", 1241 1333 "init_declarator_list", 1242 "storage_class ",1334 "storage_class_specifier", 1243 1335 "type_specifier", 1336 "function_specifier", 1244 1337 "init_declarator", 1245 1338 "declarator", … … 1255 1348 "struct_declaration", 1256 1349 "struct_declarator_list", 1257 " type_specifier_qualifier_list",1350 "specifier_qualifier_list", 1258 1351 "struct_declarator", 1259 1352 "union_term", … … 1263 1356 "union_declarator_list", 1264 1357 "union_declarator", 1265 "enum_type",1266 1358 "enumerator_list", 1267 1359 "enumerator", … … 1269 1361 "direct_declarator", 1270 1362 "parameter_type_list", 1363 "identifier_list", 1364 "type_qualifier_list", 1271 1365 "parameter_list", 1272 1366 "parameter_declaration", 1273 1367 "abstract_declarator", 1274 1368 "direct_abstract_declarator", 1275 "initializer_list",1276 1369 "extension_statement", 1277 " statement",1370 "cdl_statement", 1278 1371 "typedef", 1279 1372 "func_def", 1280 1373 "declarator_list", 1281 "compoundstatement", 1282 "infunc_statement_list", 1283 "infunc_statement", 1374 "compound_statement", 1375 "statement", 1376 "labeled_statement", 1377 "expression_statement", 1284 1378 "ifstatement", 1285 1379 "whilestatement", … … 1287 1381 "forstatement", 1288 1382 "switchstatement", 1289 " labelstatement",1290 " gotostatement",1291 " expressionstatement",1292 " assignment_operator" ]1383 "jump_statement", 1384 "asm_statement", 1385 "block_item_list", 1386 "block_item" ] 1293 1387 1294 1388 Racc_debug_parser = false … … 1300 1394 # reduce 1 omitted 1301 1395 1302 module_eval(<<'.,.,', 'C_parser.y.rb', 5 2)1396 module_eval(<<'.,.,', 'C_parser.y.rb', 57) 1303 1397 def _reduce_2(val, _values, result) 1304 1398 result = [ :IDENTIFIER, val[0] ] … … 1307 1401 .,., 1308 1402 1309 module_eval(<<'.,.,', 'C_parser.y.rb', 6 0)1403 module_eval(<<'.,.,', 'C_parser.y.rb', 65) 1310 1404 def _reduce_3(val, _values, result) 1311 1405 result = [ :INTEGER_CONSTANT, val[0] ] … … 1314 1408 .,., 1315 1409 1316 module_eval(<<'.,.,', 'C_parser.y.rb', 6 2)1410 module_eval(<<'.,.,', 'C_parser.y.rb', 67) 1317 1411 def _reduce_4(val, _values, result) 1318 1412 result = [ :FLOATING_CONSTANT, val[0] ] … … 1321 1415 .,., 1322 1416 1323 module_eval(<<'.,.,', 'C_parser.y.rb', 6 4)1417 module_eval(<<'.,.,', 'C_parser.y.rb', 69) 1324 1418 def _reduce_5(val, _values, result) 1325 1419 result = [ :OCTAL_CONSTANT, val[0] ] … … 1328 1422 .,., 1329 1423 1330 module_eval(<<'.,.,', 'C_parser.y.rb', 66)1424 module_eval(<<'.,.,', 'C_parser.y.rb', 71) 1331 1425 def _reduce_6(val, _values, result) 1332 1426 result = [ :HEX_CONSTANT, val[0] ] … … 1335 1429 .,., 1336 1430 1337 module_eval(<<'.,.,', 'C_parser.y.rb', 68)1431 module_eval(<<'.,.,', 'C_parser.y.rb', 73) 1338 1432 def _reduce_7(val, _values, result) 1339 1433 result = [ :CHARACTER_LITERAL, val[0] ] … … 1342 1436 .,., 1343 1437 1344 module_eval(<<'.,.,', 'C_parser.y.rb', 7 0)1438 module_eval(<<'.,.,', 'C_parser.y.rb', 75) 1345 1439 def _reduce_8(val, _values, result) 1346 1440 result = [ :STRING_LITERAL_LIST, val[0] ] … … 1349 1443 .,., 1350 1444 1351 module_eval(<<'.,.,', 'C_parser.y.rb', 7 2)1445 module_eval(<<'.,.,', 'C_parser.y.rb', 77) 1352 1446 def _reduce_9(val, _values, result) 1353 1447 result = [ :PARENTHESES, val[1].get_elements ] … … 1356 1450 .,., 1357 1451 1358 module_eval(<<'.,.,', 'C_parser.y.rb', 76)1452 module_eval(<<'.,.,', 'C_parser.y.rb', 81) 1359 1453 def _reduce_10(val, _values, result) 1360 1454 result = [val[0]] … … 1363 1457 .,., 1364 1458 1365 module_eval(<<'.,.,', 'C_parser.y.rb', 78)1459 module_eval(<<'.,.,', 'C_parser.y.rb', 83) 1366 1460 def _reduce_11(val, _values, result) 1367 1461 result << val[1] … … 1372 1466 # reduce 12 omitted 1373 1467 1374 # reduce 13 omitted 1468 module_eval(<<'.,.,', 'C_parser.y.rb', 89) 1469 def _reduce_13(val, _values, result) 1470 result = [ :OP_SUBSC, val[0], val[2] ] 1471 result 1472 end 1473 .,., 1375 1474 1376 1475 # reduce 14 omitted 1377 1476 1378 module_eval(<<'.,.,', 'C_parser.y.rb', 86) 1379 def _reduce_15(val, _values, result) 1380 result = [ :OP_SUBSC, val[0], val[2] ] 1381 result 1382 end 1383 .,., 1384 1385 module_eval(<<'.,.,', 'C_parser.y.rb', 88) 1386 def _reduce_16(val, _values, result) 1477 # reduce 15 omitted 1478 1479 # reduce 16 omitted 1480 1481 module_eval(<<'.,.,', 'C_parser.y.rb', 94) 1482 def _reduce_17(val, _values, result) 1387 1483 result = [ :OP_DOT, val[0], val[2] ] 1388 1484 result … … 1390 1486 .,., 1391 1487 1392 module_eval(<<'.,.,', 'C_parser.y.rb', 9 0)1393 def _reduce_1 7(val, _values, result)1488 module_eval(<<'.,.,', 'C_parser.y.rb', 96) 1489 def _reduce_18(val, _values, result) 1394 1490 result = [ :OP_REF, val[0], val[2] ] 1395 1491 result … … 1397 1493 .,., 1398 1494 1399 module_eval(<<'.,.,', 'C_parser.y.rb', 91) 1400 def _reduce_18(val, _values, result) 1401 result = val[0] 1402 result 1403 end 1404 .,., 1405 1406 module_eval(<<'.,.,', 'C_parser.y.rb', 92) 1495 module_eval(<<'.,.,', 'C_parser.y.rb', 97) 1407 1496 def _reduce_19(val, _values, result) 1408 1497 result = val[0] … … 1411 1500 .,., 1412 1501 1413 # reduce 20 omitted 1502 module_eval(<<'.,.,', 'C_parser.y.rb', 98) 1503 def _reduce_20(val, _values, result) 1504 result = val[0] 1505 result 1506 end 1507 .,., 1414 1508 1415 1509 # reduce 21 omitted … … 1419 1513 # reduce 23 omitted 1420 1514 1421 module_eval(<<'.,.,', 'C_parser.y.rb', 104) 1422 def _reduce_24(val, _values, result) 1515 # reduce 24 omitted 1516 1517 # reduce 25 omitted 1518 1519 module_eval(<<'.,.,', 'C_parser.y.rb', 111) 1520 def _reduce_26(val, _values, result) 1423 1521 result = [ val[0], val[1] ] 1424 1522 result … … 1426 1524 .,., 1427 1525 1428 module_eval(<<'.,.,', 'C_parser.y.rb', 1 06)1429 def _reduce_2 5(val, _values, result)1526 module_eval(<<'.,.,', 'C_parser.y.rb', 113) 1527 def _reduce_27(val, _values, result) 1430 1528 result = [ :OP_SIZEOF_EXPR, val[1] ] 1431 1529 result … … 1433 1531 .,., 1434 1532 1435 module_eval(<<'.,.,', 'C_parser.y.rb', 1 08)1436 def _reduce_2 6(val, _values, result)1533 module_eval(<<'.,.,', 'C_parser.y.rb', 115) 1534 def _reduce_28(val, _values, result) 1437 1535 result = [ :OP_SIZEOF_TYPE, val[1] ] 1438 1536 result … … 1440 1538 .,., 1441 1539 1442 module_eval(<<'.,.,', 'C_parser.y.rb', 1 09)1443 def _reduce_2 7(val, _values, result)1540 module_eval(<<'.,.,', 'C_parser.y.rb', 116) 1541 def _reduce_29(val, _values, result) 1444 1542 result = val[1] 1445 1543 result … … 1447 1545 .,., 1448 1546 1449 module_eval(<<'.,.,', 'C_parser.y.rb', 11 0)1450 def _reduce_ 28(val, _values, result)1547 module_eval(<<'.,.,', 'C_parser.y.rb', 117) 1548 def _reduce_30(val, _values, result) 1451 1549 result = val[1] 1452 1550 result … … 1454 1552 .,., 1455 1553 1456 module_eval(<<'.,.,', 'C_parser.y.rb', 1 13)1457 def _reduce_ 29(val, _values, result)1554 module_eval(<<'.,.,', 'C_parser.y.rb', 120) 1555 def _reduce_31(val, _values, result) 1458 1556 result = :OP_U_AMP 1459 1557 result … … 1461 1559 .,., 1462 1560 1463 module_eval(<<'.,.,', 'C_parser.y.rb', 1 14)1464 def _reduce_3 0(val, _values, result)1561 module_eval(<<'.,.,', 'C_parser.y.rb', 121) 1562 def _reduce_32(val, _values, result) 1465 1563 result = :OP_U_ASTER 1466 1564 result … … 1468 1566 .,., 1469 1567 1470 module_eval(<<'.,.,', 'C_parser.y.rb', 1 15)1471 def _reduce_3 1(val, _values, result)1568 module_eval(<<'.,.,', 'C_parser.y.rb', 122) 1569 def _reduce_33(val, _values, result) 1472 1570 result = :OP_U_PLUS 1473 1571 result … … 1475 1573 .,., 1476 1574 1477 module_eval(<<'.,.,', 'C_parser.y.rb', 1 16)1478 def _reduce_3 2(val, _values, result)1575 module_eval(<<'.,.,', 'C_parser.y.rb', 123) 1576 def _reduce_34(val, _values, result) 1479 1577 result = :OP_U_MINUS 1480 1578 result … … 1482 1580 .,., 1483 1581 1484 module_eval(<<'.,.,', 'C_parser.y.rb', 1 17)1485 def _reduce_3 3(val, _values, result)1582 module_eval(<<'.,.,', 'C_parser.y.rb', 124) 1583 def _reduce_35(val, _values, result) 1486 1584 result = :OP_U_TILDE 1487 1585 result … … 1489 1587 .,., 1490 1588 1491 module_eval(<<'.,.,', 'C_parser.y.rb', 1 18)1492 def _reduce_3 4(val, _values, result)1589 module_eval(<<'.,.,', 'C_parser.y.rb', 125) 1590 def _reduce_36(val, _values, result) 1493 1591 result = :OP_U_EXCLAM 1494 1592 result … … 1496 1594 .,., 1497 1595 1498 # reduce 3 5omitted1499 1500 module_eval(<<'.,.,', 'C_parser.y.rb', 1 23)1501 def _reduce_3 6(val, _values, result)1596 # reduce 37 omitted 1597 1598 module_eval(<<'.,.,', 'C_parser.y.rb', 130) 1599 def _reduce_38(val, _values, result) 1502 1600 result = [ :CAST, val[1], val[3] ] 1503 1601 result … … 1505 1603 .,., 1506 1604 1507 # reduce 3 7omitted1508 1509 module_eval(<<'.,.,', 'C_parser.y.rb', 1 28)1510 def _reduce_ 38(val, _values, result)1605 # reduce 39 omitted 1606 1607 module_eval(<<'.,.,', 'C_parser.y.rb', 135) 1608 def _reduce_40(val, _values, result) 1511 1609 result = [ :OP_MULT, val[0], val[2] ] 1512 1610 result … … 1514 1612 .,., 1515 1613 1516 module_eval(<<'.,.,', 'C_parser.y.rb', 13 0)1517 def _reduce_ 39(val, _values, result)1614 module_eval(<<'.,.,', 'C_parser.y.rb', 137) 1615 def _reduce_41(val, _values, result) 1518 1616 result = [ :OP_DIV, val[0], val[2] ] 1519 1617 result … … 1521 1619 .,., 1522 1620 1523 module_eval(<<'.,.,', 'C_parser.y.rb', 13 2)1524 def _reduce_4 0(val, _values, result)1621 module_eval(<<'.,.,', 'C_parser.y.rb', 139) 1622 def _reduce_42(val, _values, result) 1525 1623 result = [ :OP_REMAIN, val[0], val[2] ] 1526 1624 result … … 1528 1626 .,., 1529 1627 1530 # reduce 4 1omitted1531 1532 module_eval(<<'.,.,', 'C_parser.y.rb', 1 37)1533 def _reduce_4 2(val, _values, result)1628 # reduce 43 omitted 1629 1630 module_eval(<<'.,.,', 'C_parser.y.rb', 144) 1631 def _reduce_44(val, _values, result) 1534 1632 result = [ :OP_ADD, val[0], val[2] ] 1535 1633 result … … 1537 1635 .,., 1538 1636 1539 module_eval(<<'.,.,', 'C_parser.y.rb', 1 39)1540 def _reduce_4 3(val, _values, result)1637 module_eval(<<'.,.,', 'C_parser.y.rb', 146) 1638 def _reduce_45(val, _values, result) 1541 1639 result = [ :OP_SUB, val[0], val[2] ] 1542 1640 result … … 1544 1642 .,., 1545 1643 1546 # reduce 4 4omitted1547 1548 module_eval(<<'.,.,', 'C_parser.y.rb', 1 44)1549 def _reduce_4 5(val, _values, result)1644 # reduce 46 omitted 1645 1646 module_eval(<<'.,.,', 'C_parser.y.rb', 151) 1647 def _reduce_47(val, _values, result) 1550 1648 result = [ :OP_LSFT, val[0], val[2] ] 1551 1649 result … … 1553 1651 .,., 1554 1652 1555 module_eval(<<'.,.,', 'C_parser.y.rb', 1 46)1556 def _reduce_4 6(val, _values, result)1653 module_eval(<<'.,.,', 'C_parser.y.rb', 153) 1654 def _reduce_48(val, _values, result) 1557 1655 result = [ :OP_RSFT, val[0], val[2] ] 1558 1656 result … … 1560 1658 .,., 1561 1659 1562 # reduce 4 7omitted1563 1564 module_eval(<<'.,.,', 'C_parser.y.rb', 15 1)1565 def _reduce_ 48(val, _values, result)1660 # reduce 49 omitted 1661 1662 module_eval(<<'.,.,', 'C_parser.y.rb', 158) 1663 def _reduce_50(val, _values, result) 1566 1664 result = [ :OP_LT, val[0], val[2] ] 1567 1665 result … … 1569 1667 .,., 1570 1668 1571 module_eval(<<'.,.,', 'C_parser.y.rb', 1 53)1572 def _reduce_ 49(val, _values, result)1669 module_eval(<<'.,.,', 'C_parser.y.rb', 160) 1670 def _reduce_51(val, _values, result) 1573 1671 result = [ :OP_GT, val[0], val[2] ] 1574 1672 result … … 1576 1674 .,., 1577 1675 1578 module_eval(<<'.,.,', 'C_parser.y.rb', 1 55)1579 def _reduce_5 0(val, _values, result)1676 module_eval(<<'.,.,', 'C_parser.y.rb', 162) 1677 def _reduce_52(val, _values, result) 1580 1678 result = [ :OP_LE, val[0], val[2] ] 1581 1679 result … … 1583 1681 .,., 1584 1682 1585 module_eval(<<'.,.,', 'C_parser.y.rb', 1 57)1586 def _reduce_5 1(val, _values, result)1683 module_eval(<<'.,.,', 'C_parser.y.rb', 164) 1684 def _reduce_53(val, _values, result) 1587 1685 result = [ :OP_GE, val[0], val[2] ] 1588 1686 result … … 1590 1688 .,., 1591 1689 1592 # reduce 5 2omitted1593 1594 module_eval(<<'.,.,', 'C_parser.y.rb', 16 2)1595 def _reduce_5 3(val, _values, result)1690 # reduce 54 omitted 1691 1692 module_eval(<<'.,.,', 'C_parser.y.rb', 169) 1693 def _reduce_55(val, _values, result) 1596 1694 result = [ :OP_EQ, val[0], val[2] ] 1597 1695 result … … 1599 1697 .,., 1600 1698 1601 module_eval(<<'.,.,', 'C_parser.y.rb', 1 64)1602 def _reduce_5 4(val, _values, result)1699 module_eval(<<'.,.,', 'C_parser.y.rb', 171) 1700 def _reduce_56(val, _values, result) 1603 1701 result = [ :OP_NE, val[0], val[2] ] 1604 1702 result … … 1606 1704 .,., 1607 1705 1608 # reduce 5 5omitted1609 1610 module_eval(<<'.,.,', 'C_parser.y.rb', 1 69)1611 def _reduce_5 6(val, _values, result)1706 # reduce 57 omitted 1707 1708 module_eval(<<'.,.,', 'C_parser.y.rb', 176) 1709 def _reduce_58(val, _values, result) 1612 1710 result = [ :OP_AND, val[0], val[2] ] 1613 1711 result … … 1615 1713 .,., 1616 1714 1617 # reduce 5 7omitted1618 1619 module_eval(<<'.,.,', 'C_parser.y.rb', 1 74)1620 def _reduce_ 58(val, _values, result)1715 # reduce 59 omitted 1716 1717 module_eval(<<'.,.,', 'C_parser.y.rb', 181) 1718 def _reduce_60(val, _values, result) 1621 1719 result = [ :OP_EOR, val[0], val[2] ] 1622 1720 result … … 1624 1722 .,., 1625 1723 1626 # reduce 59omitted1627 1628 module_eval(<<'.,.,', 'C_parser.y.rb', 1 79)1629 def _reduce_6 0(val, _values, result)1724 # reduce 61 omitted 1725 1726 module_eval(<<'.,.,', 'C_parser.y.rb', 186) 1727 def _reduce_62(val, _values, result) 1630 1728 result = [ :OP_OR, val[0], val[2] ] 1631 1729 result … … 1633 1731 .,., 1634 1732 1635 # reduce 6 1omitted1636 1637 module_eval(<<'.,.,', 'C_parser.y.rb', 1 84)1638 def _reduce_6 2(val, _values, result)1733 # reduce 63 omitted 1734 1735 module_eval(<<'.,.,', 'C_parser.y.rb', 191) 1736 def _reduce_64(val, _values, result) 1639 1737 result = [ :OP_LAND, val[0], val[2] ] 1640 1738 result … … 1642 1740 .,., 1643 1741 1644 # reduce 6 3omitted1645 1646 module_eval(<<'.,.,', 'C_parser.y.rb', 1 89)1647 def _reduce_6 4(val, _values, result)1742 # reduce 65 omitted 1743 1744 module_eval(<<'.,.,', 'C_parser.y.rb', 196) 1745 def _reduce_66(val, _values, result) 1648 1746 result = [ :OP_LOR, val[0], val[2] ] 1649 1747 result … … 1651 1749 .,., 1652 1750 1653 # reduce 6 5omitted1654 1655 module_eval(<<'.,.,', 'C_parser.y.rb', 194)1656 def _reduce_6 6(val, _values, result)1751 # reduce 67 omitted 1752 1753 module_eval(<<'.,.,', 'C_parser.y.rb', 201) 1754 def _reduce_68(val, _values, result) 1657 1755 result = [ :OP_CEX, val[0], val[2].get_elements, val[4] ] 1658 1756 result … … 1660 1758 .,., 1661 1759 1662 module_eval(<<'.,.,', 'C_parser.y.rb', 201) 1663 def _reduce_67(val, _values, result) 1760 # reduce 69 omitted 1761 1762 # reduce 70 omitted 1763 1764 # reduce 71 omitted 1765 1766 # reduce 72 omitted 1767 1768 # reduce 73 omitted 1769 1770 # reduce 74 omitted 1771 1772 # reduce 75 omitted 1773 1774 # reduce 76 omitted 1775 1776 # reduce 77 omitted 1777 1778 # reduce 78 omitted 1779 1780 # reduce 79 omitted 1781 1782 # reduce 80 omitted 1783 1784 # reduce 81 omitted 1785 1786 module_eval(<<'.,.,', 'C_parser.y.rb', 223) 1787 def _reduce_82(val, _values, result) 1664 1788 result = Expression.new( val[0] ) 1665 1789 # result.print … … 1669 1793 .,., 1670 1794 1671 module_eval(<<'.,.,', 'C_parser.y.rb', 208) 1672 def _reduce_68(val, _values, result) 1795 module_eval(<<'.,.,', 'C_parser.y.rb', 228) 1796 def _reduce_83(val, _values, result) 1797 result = Expression.new( val[2] ) # ',' の後ろを採用 1798 1799 result 1800 end 1801 .,., 1802 1803 module_eval(<<'.,.,', 'C_parser.y.rb', 234) 1804 def _reduce_84(val, _values, result) 1673 1805 result = Expression.new( val[0] ) 1674 1806 # result.print … … 1685 1817 .,., 1686 1818 1687 # reduce 69omitted1688 1689 module_eval(<<'.,.,', 'C_parser.y.rb', 2 37)1690 def _reduce_ 70(val, _values, result)1819 # reduce 85 omitted 1820 1821 module_eval(<<'.,.,', 'C_parser.y.rb', 261) 1822 def _reduce_86(val, _values, result) 1691 1823 result = CIntType.new( -3 ) # storage class は無視 1692 1824 … … 1695 1827 .,., 1696 1828 1697 # reduce 71 omitted 1698 1699 module_eval(<<'.,.,', 'C_parser.y.rb', 242) 1700 def _reduce_72(val, _values, result) 1829 module_eval(<<'.,.,', 'C_parser.y.rb', 265) 1830 def _reduce_87(val, _values, result) 1831 result = val[1] # storage class は無視 1832 1833 result 1834 end 1835 .,., 1836 1837 # reduce 88 omitted 1838 1839 module_eval(<<'.,.,', 'C_parser.y.rb', 270) 1840 def _reduce_89(val, _values, result) 1841 result = val[1].merge val[0] 1842 1843 result 1844 end 1845 .,., 1846 1847 module_eval(<<'.,.,', 'C_parser.y.rb', 274) 1848 def _reduce_90(val, _values, result) 1701 1849 result = CIntType.new( -3 ) 1702 1850 result.set_qualifier val[0] … … 1706 1854 .,., 1707 1855 1708 module_eval(<<'.,.,', 'C_parser.y.rb', 247) 1709 def _reduce_73(val, _values, result) 1710 result = val[1] # storage class は無視 1711 1712 result 1713 end 1714 .,., 1715 1716 module_eval(<<'.,.,', 'C_parser.y.rb', 251) 1717 def _reduce_74(val, _values, result) 1718 result = val[1].merge val[0] 1719 1720 result 1721 end 1722 .,., 1723 1724 module_eval(<<'.,.,', 'C_parser.y.rb', 255) 1725 def _reduce_75(val, _values, result) 1856 module_eval(<<'.,.,', 'C_parser.y.rb', 279) 1857 def _reduce_91(val, _values, result) 1726 1858 val[1].set_qualifier val[0] 1727 result = val[1] 1728 1729 result 1730 end 1731 .,., 1732 1733 module_eval(<<'.,.,', 'C_parser.y.rb', 262) 1734 def _reduce_76(val, _values, result) 1859 result = val[1] 1860 1861 result 1862 end 1863 .,., 1864 1865 # reduce 92 omitted 1866 1867 # reduce 93 omitted 1868 1869 module_eval(<<'.,.,', 'C_parser.y.rb', 287) 1870 def _reduce_94(val, _values, result) 1735 1871 result = [val[0]] 1736 1872 result … … 1738 1874 .,., 1739 1875 1740 module_eval(<<'.,.,', 'C_parser.y.rb', 2 64)1741 def _reduce_ 77(val, _values, result)1876 module_eval(<<'.,.,', 'C_parser.y.rb', 289) 1877 def _reduce_95(val, _values, result) 1742 1878 result << val[2] 1743 1879 result … … 1745 1881 .,., 1746 1882 1747 # reduce 78omitted1748 1749 module_eval(<<'.,.,', 'C_parser.y.rb', 2 69)1750 def _reduce_ 79(val, _values, result)1883 # reduce 96 omitted 1884 1885 module_eval(<<'.,.,', 'C_parser.y.rb', 294) 1886 def _reduce_97(val, _values, result) 1751 1887 val[0].set_initializer( val[2] ) 1752 1888 result … … 1754 1890 .,., 1755 1891 1756 module_eval(<<'.,.,', 'C_parser.y.rb', 272) 1757 def _reduce_80(val, _values, result) 1892 # reduce 98 omitted 1893 1894 # reduce 99 omitted 1895 1896 # reduce 100 omitted 1897 1898 # reduce 101 omitted 1899 1900 module_eval(<<'.,.,', 'C_parser.y.rb', 304) 1901 def _reduce_102(val, _values, result) 1758 1902 set_no_type_name true; result = CVoidType.new 1759 1903 result … … 1761 1905 .,., 1762 1906 1763 module_eval(<<'.,.,', 'C_parser.y.rb', 273) 1764 def _reduce_81(val, _values, result) 1907 module_eval(<<'.,.,', 'C_parser.y.rb', 306) 1908 def _reduce_103(val, _values, result) 1909 set_no_type_name true; result = CIntType.new(-11 ) 1910 result 1911 end 1912 .,., 1913 1914 module_eval(<<'.,.,', 'C_parser.y.rb', 308) 1915 def _reduce_104(val, _values, result) 1916 set_no_type_name true; result = CIntType.new( -2 ) 1917 result 1918 end 1919 .,., 1920 1921 module_eval(<<'.,.,', 'C_parser.y.rb', 310) 1922 def _reduce_105(val, _values, result) 1923 set_no_type_name true; result = CIntType.new( -3 ) 1924 result 1925 end 1926 .,., 1927 1928 module_eval(<<'.,.,', 'C_parser.y.rb', 312) 1929 def _reduce_106(val, _values, result) 1930 set_no_type_name true; result = CIntType.new( -4 ) 1931 result 1932 end 1933 .,., 1934 1935 module_eval(<<'.,.,', 'C_parser.y.rb', 314) 1936 def _reduce_107(val, _values, result) 1765 1937 set_no_type_name true; result = CFloatType.new(-32) 1766 1938 result … … 1768 1940 .,., 1769 1941 1770 module_eval(<<'.,.,', 'C_parser.y.rb', 274)1771 def _reduce_ 82(val, _values, result)1942 module_eval(<<'.,.,', 'C_parser.y.rb', 316) 1943 def _reduce_108(val, _values, result) 1772 1944 set_no_type_name true; result = CFloatType.new(-64) 1773 1945 result … … 1775 1947 .,., 1776 1948 1777 module_eval(<<'.,.,', 'C_parser.y.rb', 275) 1778 def _reduce_83(val, _values, result) 1779 set_no_type_name true; result = CBoolType.new 1780 result 1781 end 1782 .,., 1783 1784 module_eval(<<'.,.,', 'C_parser.y.rb', 276) 1785 def _reduce_84(val, _values, result) 1786 set_no_type_name true; result = val[0] 1787 result 1788 end 1789 .,., 1790 1791 module_eval(<<'.,.,', 'C_parser.y.rb', 277) 1792 def _reduce_85(val, _values, result) 1793 set_no_type_name true; result = CVoidType.new 1794 result 1795 end 1796 .,., 1797 1798 module_eval(<<'.,.,', 'C_parser.y.rb', 278) 1799 def _reduce_86(val, _values, result) 1800 set_no_type_name true; result = CVoidType.new 1801 result 1802 end 1803 .,., 1804 1805 module_eval(<<'.,.,', 'C_parser.y.rb', 279) 1806 def _reduce_87(val, _values, result) 1807 set_no_type_name true; result = CDefinedType.new( val[0].val ) 1808 result 1809 end 1810 .,., 1811 1812 module_eval(<<'.,.,', 'C_parser.y.rb', 281) 1813 def _reduce_88(val, _values, result) 1814 set_no_type_name true; result = CIntType.new(-11 ) 1815 result 1816 end 1817 .,., 1818 1819 module_eval(<<'.,.,', 'C_parser.y.rb', 282) 1820 def _reduce_89(val, _values, result) 1821 set_no_type_name true; result = CIntType.new( -2 ) 1822 result 1823 end 1824 .,., 1825 1826 module_eval(<<'.,.,', 'C_parser.y.rb', 283) 1827 def _reduce_90(val, _values, result) 1828 set_no_type_name true; result = CIntType.new( -3 ) 1829 result 1830 end 1831 .,., 1832 1833 module_eval(<<'.,.,', 'C_parser.y.rb', 284) 1834 def _reduce_91(val, _values, result) 1835 set_no_type_name true; result = CIntType.new( -4 ) 1836 result 1837 end 1838 .,., 1839 1840 module_eval(<<'.,.,', 'C_parser.y.rb', 287) 1841 def _reduce_92(val, _values, result) 1949 module_eval(<<'.,.,', 'C_parser.y.rb', 319) 1950 def _reduce_109(val, _values, result) 1842 1951 set_no_type_name true 1843 1952 result = CIntType.new( -3 ) … … 1848 1957 .,., 1849 1958 1850 module_eval(<<'.,.,', 'C_parser.y.rb', 293)1851 def _reduce_ 93(val, _values, result)1959 module_eval(<<'.,.,', 'C_parser.y.rb', 325) 1960 def _reduce_110(val, _values, result) 1852 1961 set_no_type_name true 1853 1962 result = CIntType.new( -3 ) … … 1858 1967 .,., 1859 1968 1860 module_eval(<<'.,.,', 'C_parser.y.rb', 302) 1861 def _reduce_94(val, _values, result) 1969 module_eval(<<'.,.,', 'C_parser.y.rb', 330) 1970 def _reduce_111(val, _values, result) 1971 set_no_type_name true; result = CBoolType.new 1972 result 1973 end 1974 .,., 1975 1976 module_eval(<<'.,.,', 'C_parser.y.rb', 332) 1977 def _reduce_112(val, _values, result) 1978 set_no_type_name true; result = val[0] 1979 result 1980 end 1981 .,., 1982 1983 module_eval(<<'.,.,', 'C_parser.y.rb', 334) 1984 def _reduce_113(val, _values, result) 1985 set_no_type_name true; result = CVoidType.new 1986 result 1987 end 1988 .,., 1989 1990 module_eval(<<'.,.,', 'C_parser.y.rb', 336) 1991 def _reduce_114(val, _values, result) 1992 set_no_type_name true; result = CVoidType.new 1993 result 1994 end 1995 .,., 1996 1997 module_eval(<<'.,.,', 'C_parser.y.rb', 338) 1998 def _reduce_115(val, _values, result) 1999 set_no_type_name true; result = CDefinedType.new( val[0].val ) 2000 result 2001 end 2002 .,., 2003 2004 module_eval(<<'.,.,', 'C_parser.y.rb', 344) 2005 def _reduce_116(val, _values, result) 1862 2006 StructType.set_define( true ) 1863 2007 result … … 1865 2009 .,., 1866 2010 1867 module_eval(<<'.,.,', 'C_parser.y.rb', 3 05)1868 def _reduce_ 95(val, _values, result)2011 module_eval(<<'.,.,', 'C_parser.y.rb', 347) 2012 def _reduce_117(val, _values, result) 1869 2013 StructType.end_of_parse 1870 2014 result = val[1] … … 1874 2018 .,., 1875 2019 1876 module_eval(<<'.,.,', 'C_parser.y.rb', 3 11)1877 def _reduce_ 96(val, _values, result)2020 module_eval(<<'.,.,', 'C_parser.y.rb', 353) 2021 def _reduce_118(val, _values, result) 1878 2022 result = CStructType.new() 1879 2023 StructType.set_define( true ) … … 1883 2027 .,., 1884 2028 1885 module_eval(<<'.,.,', 'C_parser.y.rb', 3 16)1886 def _reduce_ 97(val, _values, result)2029 module_eval(<<'.,.,', 'C_parser.y.rb', 358) 2030 def _reduce_119(val, _values, result) 1887 2031 StructType.end_of_parse 1888 2032 result = val[1] … … 1892 2036 .,., 1893 2037 1894 module_eval(<<'.,.,', 'C_parser.y.rb', 3 22)1895 def _reduce_ 98(val, _values, result)2038 module_eval(<<'.,.,', 'C_parser.y.rb', 364) 2039 def _reduce_120(val, _values, result) 1896 2040 StructType.set_define( false ) 1897 2041 StructType.end_of_parse … … 1902 2046 .,., 1903 2047 1904 module_eval(<<'.,.,', 'C_parser.y.rb', 3 28)1905 def _reduce_ 99(val, _values, result)2048 module_eval(<<'.,.,', 'C_parser.y.rb', 370) 2049 def _reduce_121(val, _values, result) 1906 2050 set_no_type_name true 1907 2051 result … … 1909 2053 .,., 1910 2054 1911 # reduce 1 00omitted1912 1913 # reduce 1 01omitted1914 1915 module_eval(<<'.,.,', 'C_parser.y.rb', 3 37)1916 def _reduce_1 02(val, _values, result)2055 # reduce 122 omitted 2056 2057 # reduce 123 omitted 2058 2059 module_eval(<<'.,.,', 'C_parser.y.rb', 379) 2060 def _reduce_124(val, _values, result) 1917 2061 result = CStructType.new( val[0].val ) 1918 2062 set_no_type_name true … … 1922 2066 .,., 1923 2067 1924 module_eval(<<'.,.,', 'C_parser.y.rb', 3 46)1925 def _reduce_1 03(val, _values, result)2068 module_eval(<<'.,.,', 'C_parser.y.rb', 388) 2069 def _reduce_125(val, _values, result) 1926 2070 val[1].each { |i| # i: Decl 1927 2071 i.set_type( val[0] ) … … 1936 2080 .,., 1937 2081 1938 # reduce 104 omitted 1939 1940 # reduce 105 omitted 1941 1942 # reduce 106 omitted 1943 1944 module_eval(<<'.,.,', 'C_parser.y.rb', 365) 1945 def _reduce_107(val, _values, result) 2082 module_eval(<<'.,.,', 'C_parser.y.rb', 399) 2083 def _reduce_126(val, _values, result) 2084 val[1].each { |i| # i: Decl 2085 i.set_type( val[0] ) 2086 i.set_kind( :MEMBER ) 2087 i.check 2088 CStructType.new_member( i ) 2089 } 2090 result = val[1] 2091 2092 result 2093 end 2094 .,., 2095 2096 # reduce 127 omitted 2097 2098 # reduce 128 omitted 2099 2100 module_eval(<<'.,.,', 'C_parser.y.rb', 417) 2101 def _reduce_129(val, _values, result) 1946 2102 result = val[1].merge val[0] 1947 2103 … … 1950 2106 .,., 1951 2107 1952 module_eval(<<'.,.,', 'C_parser.y.rb', 369) 1953 def _reduce_108(val, _values, result) 2108 # reduce 130 omitted 2109 2110 module_eval(<<'.,.,', 'C_parser.y.rb', 422) 2111 def _reduce_131(val, _values, result) 2112 val[1].set_qualifier val[0] 2113 result = val[1] 2114 2115 result 2116 end 2117 .,., 2118 2119 module_eval(<<'.,.,', 'C_parser.y.rb', 427) 2120 def _reduce_132(val, _values, result) 1954 2121 result = CIntType.new( -3 ) 1955 2122 result.set_qualifier val[0] … … 1959 2126 .,., 1960 2127 1961 module_eval(<<'.,.,', 'C_parser.y.rb', 374) 1962 def _reduce_109(val, _values, result) 1963 val[1].set_qualifier val[0] 1964 result = val[1] 1965 1966 result 1967 end 1968 .,., 1969 1970 module_eval(<<'.,.,', 'C_parser.y.rb', 380) 1971 def _reduce_110(val, _values, result) 2128 module_eval(<<'.,.,', 'C_parser.y.rb', 433) 2129 def _reduce_133(val, _values, result) 1972 2130 result = [ val[0] ] 1973 2131 result … … 1975 2133 .,., 1976 2134 1977 module_eval(<<'.,.,', 'C_parser.y.rb', 382)1978 def _reduce_1 11(val, _values, result)2135 module_eval(<<'.,.,', 'C_parser.y.rb', 435) 2136 def _reduce_134(val, _values, result) 1979 2137 result << val[2] 1980 2138 result … … 1982 2140 .,., 1983 2141 1984 # reduce 1 12omitted1985 1986 # reduce 1 13omitted1987 1988 # reduce 1 14omitted1989 1990 # reduce 1 15omitted1991 1992 module_eval(<<'.,.,', 'C_parser.y.rb', 399)1993 def _reduce_1 16(val, _values, result)2142 # reduce 135 omitted 2143 2144 # reduce 136 omitted 2145 2146 # reduce 137 omitted 2147 2148 # reduce 138 omitted 2149 2150 module_eval(<<'.,.,', 'C_parser.y.rb', 452) 2151 def _reduce_139(val, _values, result) 1994 2152 set_no_type_name true 1995 2153 result … … 1997 2155 .,., 1998 2156 1999 # reduce 117 omitted 2000 2001 # reduce 118 omitted 2002 2003 # reduce 119 omitted 2004 2005 # reduce 120 omitted 2006 2007 # reduce 121 omitted 2008 2009 # reduce 122 omitted 2010 2011 # reduce 123 omitted 2012 2013 # reduce 124 omitted 2014 2015 # reduce 125 omitted 2016 2017 # reduce 126 omitted 2018 2019 # reduce 127 omitted 2020 2021 # reduce 128 omitted 2022 2023 module_eval(<<'.,.,', 'C_parser.y.rb', 430) 2024 def _reduce_129(val, _values, result) 2025 result = CEnumType.new( -1 ) 2026 result 2027 end 2028 .,., 2029 2030 # reduce 130 omitted 2031 2032 # reduce 131 omitted 2033 2034 # reduce 132 omitted 2035 2036 # reduce 133 omitted 2037 2038 module_eval(<<'.,.,', 'C_parser.y.rb', 446) 2039 def _reduce_134(val, _values, result) 2157 # reduce 140 omitted 2158 2159 # reduce 141 omitted 2160 2161 # reduce 142 omitted 2162 2163 # reduce 143 omitted 2164 2165 # reduce 144 omitted 2166 2167 # reduce 145 omitted 2168 2169 # reduce 146 omitted 2170 2171 # reduce 147 omitted 2172 2173 # reduce 148 omitted 2174 2175 # reduce 149 omitted 2176 2177 # reduce 150 omitted 2178 2179 # reduce 151 omitted 2180 2181 # reduce 152 omitted 2182 2183 # reduce 153 omitted 2184 2185 # reduce 154 omitted 2186 2187 # reduce 155 omitted 2188 2189 # reduce 156 omitted 2190 2191 # reduce 157 omitted 2192 2193 # reduce 158 omitted 2194 2195 # reduce 159 omitted 2196 2197 # reduce 160 omitted 2198 2199 # reduce 161 omitted 2200 2201 # reduce 162 omitted 2202 2203 module_eval(<<'.,.,', 'C_parser.y.rb', 495) 2204 def _reduce_163(val, _values, result) 2040 2205 result = :CONST 2041 2206 result … … 2043 2208 .,., 2044 2209 2045 module_eval(<<'.,.,', 'C_parser.y.rb', 447) 2046 def _reduce_135(val, _values, result) 2210 # reduce 164 omitted 2211 2212 module_eval(<<'.,.,', 'C_parser.y.rb', 498) 2213 def _reduce_165(val, _values, result) 2047 2214 result = :VOLATILE 2048 2215 result … … 2050 2217 .,., 2051 2218 2052 module_eval(<<'.,.,', 'C_parser.y.rb', 452) 2053 def _reduce_136(val, _values, result) 2219 # reduce 166 omitted 2220 2221 # reduce 167 omitted 2222 2223 # reduce 168 omitted 2224 2225 # reduce 169 omitted 2226 2227 module_eval(<<'.,.,', 'C_parser.y.rb', 509) 2228 def _reduce_170(val, _values, result) 2054 2229 val[1].set_type( val[0] ) 2055 2230 result = val[1] … … 2059 2234 .,., 2060 2235 2061 # reduce 1 37omitted2062 2063 module_eval(<<'.,.,', 'C_parser.y.rb', 458)2064 def _reduce_1 38(val, _values, result)2236 # reduce 171 omitted 2237 2238 module_eval(<<'.,.,', 'C_parser.y.rb', 515) 2239 def _reduce_172(val, _values, result) 2065 2240 result = Decl.new( val[1].val ) 2066 2241 result.set_type( val[0] ) … … 2070 2245 .,., 2071 2246 2072 module_eval(<<'.,.,', 'C_parser.y.rb', 464)2073 def _reduce_1 39(val, _values, result)2247 module_eval(<<'.,.,', 'C_parser.y.rb', 521) 2248 def _reduce_173(val, _values, result) 2074 2249 result = Decl.new( val[0].val ) 2075 2250 result … … 2077 2252 .,., 2078 2253 2079 module_eval(<<'.,.,', 'C_parser.y.rb', 466)2080 def _reduce_1 40(val, _values, result)2254 module_eval(<<'.,.,', 'C_parser.y.rb', 523) 2255 def _reduce_174(val, _values, result) 2081 2256 result = val[1] 2082 2257 result … … 2084 2259 .,., 2085 2260 2086 module_eval(<<'.,.,', 'C_parser.y.rb', 469)2087 def _reduce_1 41(val, _values, result)2261 module_eval(<<'.,.,', 'C_parser.y.rb', 526) 2262 def _reduce_175(val, _values, result) 2088 2263 val[0].set_type( CArrayType.new( val[2] ) ) 2089 2264 result = val[0] … … 2093 2268 .,., 2094 2269 2095 module_eval(<<'.,.,', 'C_parser.y.rb', 474)2096 def _reduce_1 42(val, _values, result)2270 module_eval(<<'.,.,', 'C_parser.y.rb', 531) 2271 def _reduce_176(val, _values, result) 2097 2272 val[0].set_type( CArrayType.new ) 2098 2273 result = val[0] … … 2102 2277 .,., 2103 2278 2104 module_eval(<<'.,.,', 'C_parser.y.rb', 479)2105 def _reduce_1 43(val, _values, result)2279 module_eval(<<'.,.,', 'C_parser.y.rb', 536) 2280 def _reduce_177(val, _values, result) 2106 2281 # Generator.warning( "W6001 need 'void' for no parameter" ) 2107 2282 val[0].set_type( CFuncType.new ) … … 2112 2287 .,., 2113 2288 2114 module_eval(<<'.,.,', 'C_parser.y.rb', 487) 2115 def _reduce_144(val, _values, result) 2289 # reduce 178 omitted 2290 2291 module_eval(<<'.,.,', 'C_parser.y.rb', 543) 2292 def _reduce_179(val, _values, result) 2116 2293 # Generator.warning( "W6002 need 'void' for no parameter" ) 2117 2294 val[0].set_type( CFuncType.new ) … … 2122 2299 .,., 2123 2300 2124 module_eval(<<'.,.,', 'C_parser.y.rb', 494)2125 def _reduce_1 45(val, _values, result)2301 module_eval(<<'.,.,', 'C_parser.y.rb', 550) 2302 def _reduce_180(val, _values, result) 2126 2303 result = CPtrType.new 2127 2304 result … … 2129 2306 .,., 2130 2307 2131 module_eval(<<'.,.,', 'C_parser.y.rb', 497)2132 def _reduce_1 46(val, _values, result)2308 module_eval(<<'.,.,', 'C_parser.y.rb', 553) 2309 def _reduce_181(val, _values, result) 2133 2310 result = CPtrType.new 2134 2311 result.set_qualifier( val[1] ) … … 2138 2315 .,., 2139 2316 2140 module_eval(<<'.,.,', 'C_parser.y.rb', 5 02)2141 def _reduce_1 47(val, _values, result)2317 module_eval(<<'.,.,', 'C_parser.y.rb', 558) 2318 def _reduce_182(val, _values, result) 2142 2319 val[1].set_type(CPtrType.new) 2143 2320 result = val[1] … … 2147 2324 .,., 2148 2325 2149 module_eval(<<'.,.,', 'C_parser.y.rb', 5 07)2150 def _reduce_1 48(val, _values, result)2326 module_eval(<<'.,.,', 'C_parser.y.rb', 563) 2327 def _reduce_183(val, _values, result) 2151 2328 ptrtype = CPtrType.new 2152 2329 ptrtype.set_qualifier( val[1] ) … … 2158 2335 .,., 2159 2336 2160 # reduce 149 omitted 2161 2162 # reduce 150 omitted 2163 2164 # reduce 151 omitted 2165 2166 # reduce 152 omitted 2167 2168 # reduce 153 omitted 2169 2170 # reduce 154 omitted 2171 2172 # reduce 155 omitted 2173 2174 # reduce 156 omitted 2175 2176 # reduce 157 omitted 2177 2178 # reduce 158 omitted 2179 2180 # reduce 159 omitted 2181 2182 # reduce 160 omitted 2183 2184 # reduce 161 omitted 2185 2186 # reduce 162 omitted 2187 2188 # reduce 163 omitted 2189 2190 # reduce 164 omitted 2191 2192 # reduce 165 omitted 2193 2194 module_eval(<<'.,.,', 'C_parser.y.rb', 571) 2195 def _reduce_166(val, _values, result) 2337 # reduce 184 omitted 2338 2339 # reduce 185 omitted 2340 2341 # reduce 186 omitted 2342 2343 # reduce 187 omitted 2344 2345 # reduce 188 omitted 2346 2347 # reduce 189 omitted 2348 2349 # reduce 190 omitted 2350 2351 # reduce 191 omitted 2352 2353 # reduce 192 omitted 2354 2355 # reduce 193 omitted 2356 2357 # reduce 194 omitted 2358 2359 # reduce 195 omitted 2360 2361 # reduce 196 omitted 2362 2363 # reduce 197 omitted 2364 2365 # reduce 198 omitted 2366 2367 # reduce 199 omitted 2368 2369 # reduce 200 omitted 2370 2371 # reduce 201 omitted 2372 2373 # reduce 202 omitted 2374 2375 # reduce 203 omitted 2376 2377 # reduce 204 omitted 2378 2379 module_eval(<<'.,.,', 'C_parser.y.rb', 630) 2380 def _reduce_205(val, _values, result) 2196 2381 Generator.warning( "W6003 need 'void' for no parameter" ) 2197 2382 … … 2200 2385 .,., 2201 2386 2202 # reduce 167omitted2203 2204 module_eval(<<'.,.,', 'C_parser.y.rb', 576)2205 def _reduce_ 168(val, _values, result)2387 # reduce 206 omitted 2388 2389 module_eval(<<'.,.,', 'C_parser.y.rb', 635) 2390 def _reduce_207(val, _values, result) 2206 2391 Generator.warning( "W6004 need 'void' for no parameter" ) 2207 2392 … … 2210 2395 .,., 2211 2396 2212 # reduce 169omitted2213 2214 module_eval(<<'.,.,', 'C_parser.y.rb', 583)2215 def _reduce_ 170(val, _values, result)2397 # reduce 208 omitted 2398 2399 module_eval(<<'.,.,', 'C_parser.y.rb', 642) 2400 def _reduce_209(val, _values, result) 2216 2401 result = val[0] 2217 2402 result … … 2219 2404 .,., 2220 2405 2221 module_eval(<<'.,.,', 'C_parser.y.rb', 585)2222 def _reduce_ 171(val, _values, result)2406 module_eval(<<'.,.,', 'C_parser.y.rb', 644) 2407 def _reduce_210(val, _values, result) 2223 2408 result = val[1] 2224 2409 result … … 2226 2411 .,., 2227 2412 2228 module_eval(<<'.,.,', 'C_parser.y.rb', 587)2229 def _reduce_ 172(val, _values, result)2413 module_eval(<<'.,.,', 'C_parser.y.rb', 646) 2414 def _reduce_211(val, _values, result) 2230 2415 result = val[1] 2231 2416 result … … 2233 2418 .,., 2234 2419 2235 module_eval(<<'.,.,', 'C_parser.y.rb', 589)2236 def _reduce_ 173(val, _values, result)2420 module_eval(<<'.,.,', 'C_parser.y.rb', 648) 2421 def _reduce_212(val, _values, result) 2237 2422 result = C_EXP.new( val[2] ) 2238 2423 result … … 2240 2425 .,., 2241 2426 2242 module_eval(<<'.,.,', 'C_parser.y.rb', 594)2243 def _reduce_ 174(val, _values, result)2427 module_eval(<<'.,.,', 'C_parser.y.rb', 653) 2428 def _reduce_213(val, _values, result) 2244 2429 result = [ val[0] ] 2245 2430 … … 2248 2433 .,., 2249 2434 2250 module_eval(<<'.,.,', 'C_parser.y.rb', 598)2251 def _reduce_ 175(val, _values, result)2435 module_eval(<<'.,.,', 'C_parser.y.rb', 657) 2436 def _reduce_214(val, _values, result) 2252 2437 val[0] << val[2] 2253 2438 result = val[0] … … 2257 2442 .,., 2258 2443 2259 # reduce 176omitted2260 2261 # reduce 177omitted2262 2263 # reduce 178omitted2264 2265 # reduce 179omitted2266 2267 # reduce 180omitted2268 2269 # reduce 181omitted2270 2271 # reduce 182omitted2272 2273 # reduce 183omitted2274 2275 # reduce 184omitted2276 2277 # reduce 185omitted2278 2279 # reduce 186omitted2280 2281 module_eval(<<'.,.,', 'C_parser.y.rb', 6 26)2282 def _reduce_ 187(val, _values, result)2444 # reduce 215 omitted 2445 2446 # reduce 216 omitted 2447 2448 # reduce 217 omitted 2449 2450 # reduce 218 omitted 2451 2452 # reduce 219 omitted 2453 2454 # reduce 220 omitted 2455 2456 # reduce 221 omitted 2457 2458 # reduce 222 omitted 2459 2460 # reduce 223 omitted 2461 2462 # reduce 224 omitted 2463 2464 # reduce 225 omitted 2465 2466 module_eval(<<'.,.,', 'C_parser.y.rb', 685) 2467 def _reduce_226(val, _values, result) 2283 2468 val[2].each{ |i| 2284 2469 i.set_kind( :TYPEDEF ) … … 2291 2476 .,., 2292 2477 2293 module_eval(<<'.,.,', 'C_parser.y.rb', 6 35)2294 def _reduce_ 188(val, _values, result)2478 module_eval(<<'.,.,', 'C_parser.y.rb', 694) 2479 def _reduce_227(val, _values, result) 2295 2480 result = [ val[0] ] 2296 2481 result … … 2298 2483 .,., 2299 2484 2300 module_eval(<<'.,.,', 'C_parser.y.rb', 6 37)2301 def _reduce_ 189(val, _values, result)2485 module_eval(<<'.,.,', 'C_parser.y.rb', 696) 2486 def _reduce_228(val, _values, result) 2302 2487 result << val[2] 2303 2488 result … … 2305 2490 .,., 2306 2491 2307 # reduce 190 omitted2308 2309 # reduce 191 omitted2310 2311 # reduce 192 omitted2312 2313 # reduce 193 omitted2314 2315 # reduce 194 omitted2316 2317 # reduce 195 omitted2318 2319 # reduce 196 omitted2320 2321 # reduce 197 omitted2322 2323 # reduce 198 omitted2324 2325 # reduce 199 omitted2326 2327 # reduce 200 omitted2328 2329 # reduce 201 omitted2330 2331 # reduce 202 omitted2332 2333 # reduce 203 omitted2334 2335 # reduce 204 omitted2336 2337 # reduce 205 omitted2338 2339 # reduce 206 omitted2340 2341 # reduce 207 omitted2342 2343 # reduce 208 omitted2344 2345 # reduce 209 omitted2346 2347 # reduce 210 omitted2348 2349 # reduce 211 omitted2350 2351 # reduce 212 omitted2352 2353 # reduce 213 omitted2354 2355 # reduce 214 omitted2356 2357 # reduce 215 omitted2358 2359 # reduce 216 omitted2360 2361 # reduce 217 omitted2362 2363 # reduce 218 omitted2364 2365 # reduce 219 omitted2366 2367 # reduce 220 omitted2368 2369 # reduce 221 omitted2370 2371 # reduce 222 omitted2372 2373 # reduce 223 omitted2374 2375 # reduce 224 omitted2376 2377 # reduce 225 omitted2378 2379 # reduce 226 omitted2380 2381 # reduce 227 omitted2382 2383 # reduce 228 omitted2384 2385 2492 # reduce 229 omitted 2386 2493 … … 2405 2512 # reduce 239 omitted 2406 2513 2407 module_eval(<<'.,.,', 'C_parser.y.rb', 718) 2408 def _reduce_240(val, _values, result) 2514 # reduce 240 omitted 2515 2516 # reduce 241 omitted 2517 2518 # reduce 242 omitted 2519 2520 # reduce 243 omitted 2521 2522 # reduce 244 omitted 2523 2524 # reduce 245 omitted 2525 2526 # reduce 246 omitted 2527 2528 # reduce 247 omitted 2529 2530 # reduce 248 omitted 2531 2532 # reduce 249 omitted 2533 2534 # reduce 250 omitted 2535 2536 # reduce 251 omitted 2537 2538 # reduce 252 omitted 2539 2540 # reduce 253 omitted 2541 2542 # reduce 254 omitted 2543 2544 # reduce 255 omitted 2545 2546 # reduce 256 omitted 2547 2548 # reduce 257 omitted 2549 2550 # reduce 258 omitted 2551 2552 # reduce 259 omitted 2553 2554 # reduce 260 omitted 2555 2556 # reduce 261 omitted 2557 2558 # reduce 262 omitted 2559 2560 # reduce 263 omitted 2561 2562 # reduce 264 omitted 2563 2564 module_eval(<<'.,.,', 'C_parser.y.rb', 761) 2565 def _reduce_265(val, _values, result) 2409 2566 result = NamespacePath.new( val[0].val, false ) 2410 2567 result … … 2412 2569 .,., 2413 2570 2414 module_eval(<<'.,.,', 'C_parser.y.rb', 7 19)2415 def _reduce_2 41(val, _values, result)2571 module_eval(<<'.,.,', 'C_parser.y.rb', 762) 2572 def _reduce_266(val, _values, result) 2416 2573 result = NamespacePath.new( val[1].val, true ) 2417 2574 result … … 2419 2576 .,., 2420 2577 2421 module_eval(<<'.,.,', 'C_parser.y.rb', 7 21)2422 def _reduce_2 42(val, _values, result)2578 module_eval(<<'.,.,', 'C_parser.y.rb', 764) 2579 def _reduce_267(val, _values, result) 2423 2580 result = val[0].append!( val[2].val ) 2581 result 2582 end 2583 .,., 2584 2585 module_eval(<<'.,.,', 'C_parser.y.rb', 768) 2586 def _reduce_268(val, _values, result) 2587 while true 2588 # ';' が表れるまで、トークンを読み飛ばす。 2589 # gcc の構文拡張に対応すべきだが、単純な実装として、';' まで読み飛ばす。 2590 # トークン単位で読み飛ばしているので、文字列やコメント内の ';' は対象にならない。 2591 token = next_token 2592 if token[1].val == ";" 2593 break 2594 end 2595 # p "skip: #{token[1].val}" 2596 end 2597 2424 2598 result 2425 2599 end -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/C_parser.y.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2018 by TOPPERS Project 7 7 #-- 8 # 上記著作権者は,以下の(1) ~(4)の条件を満たす場合に限り,本ソフトウェ8 # 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ 9 9 # ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 10 10 # 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. … … 48 48 # argument_expression_list(関数引数), assignment_expression(代入)がない 49 49 # 式の result は、すべて配列で第一要素が識別シンボル、第二要素以下が引数 50 # 51 # 2019/3/28 長島 下記のC99の構文に近づくよう変更 52 #(読めないヘッダーファイルがあったため) 53 # http://www.quut.com/c/ANSI-C-grammar-y-1999.html 54 # 元々のコメントと合わなくなっています 50 55 51 56 primary_expression 52 57 : namespace_identifier 53 58 { result = [ :IDENTIFIER, val[0] ] } #1ok 54 59 # : IDENTIFIER # mikan namespace への対応 … … 58 63 # | FALSE 59 64 # { result = [ :BOOL_CONSTANT, false ] } 60 65 | INTEGER_CONSTANT 61 66 { result = [ :INTEGER_CONSTANT, val[0] ] } 62 67 | FLOATING_CONSTANT 63 68 { result = [ :FLOATING_CONSTANT, val[0] ] } 64 69 | OCTAL_CONSTANT 65 70 { result = [ :OCTAL_CONSTANT, val[0] ] } 66 71 | HEX_CONSTANT 67 72 { result = [ :HEX_CONSTANT, val[0] ] } 68 73 | CHARACTER_LITERAL 69 74 { result = [ :CHARACTER_LITERAL, val[0] ] } 70 75 | string_literal_list 71 76 { result = [ :STRING_LITERAL_LIST, val[0] ] } 72 77 | '(' expression ')' 73 78 { result = [ :PARENTHESES, val[1].get_elements ] } 74 79 75 80 string_literal_list 76 81 : STRING_LITERAL 77 82 { result = [val[0]] } 78 83 | string_literal_list STRING_LITERAL 79 84 { result << val[1] } 80 85 81 86 # 関数呼び出しと後置インクリメント、デクリメント演算子がない 82 87 postfix_expression 83 : primary_expression 84 | primary_expression '(' argument_list ')' 85 | primary_expression type_qualifier '(' argument_list ')' # intended __asm volatile ( " MNEMONIC OPERAND" ); 86 | postfix_expression '[' expression ']' 88 : primary_expression 89 | postfix_expression '[' expression ']' 87 90 { result = [ :OP_SUBSC, val[0], val[2] ] } 88 | postfix_expression '.' IDENTIFIER 91 | postfix_expression '(' ')' 92 | postfix_expression '(' argument_expression_list ')' 93 | postfix_expression type_qualifier '(' argument_expression_list ')' # intended __asm volatile ( " MNEMONIC OPERAND" ); 94 | postfix_expression '.' IDENTIFIER 89 95 { result = [ :OP_DOT, val[0], val[2] ] } 90 96 | postfix_expression '->' IDENTIFIER 91 97 { result = [ :OP_REF, val[0], val[2] ] } 92 | postfix_expression '++' { result = val[0] } # ++, -- は無視する 93 | postfix_expression '--' { result = val[0] } 94 95 argument_list 96 : 97 | expression 98 | argument_list ',' expression 98 | postfix_expression '++' { result = val[0] } # ++, -- は無視する 99 | postfix_expression '--' { result = val[0] } 100 | '(' type_name ')' '{' initializer_list '}' 101 | '(' type_name ')' '{' initializer_list ',' '}' 102 103 argument_expression_list 104 : assignment_expression 105 | argument_expression_list ',' assignment_expression 99 106 100 107 101 108 # 前置インクリメント、デクリメント演算子がない 102 109 unary_expression 103 104 110 : postfix_expression 111 | unary_operator cast_expression 105 112 { result = [ val[0], val[1] ] } 106 113 | SIZEOF unary_expression 107 114 { result = [ :OP_SIZEOF_EXPR, val[1] ] } 108 115 | SIZEOF '(' type_name ')' 109 116 { result = [ :OP_SIZEOF_TYPE, val[1] ] } 110 117 | '++' unary_expression { result = val[1] } # ++, -- は無視する … … 112 119 113 120 unary_operator 114 115 116 117 118 119 121 : '&' { result = :OP_U_AMP } 122 | '*' { result = :OP_U_ASTER } 123 | '+' { result = :OP_U_PLUS } 124 | '-' { result = :OP_U_MINUS } 125 | '~' { result = :OP_U_TILDE } 126 | '!' { result = :OP_U_EXCLAM } 120 127 121 128 cast_expression 122 123 129 : unary_expression 130 | '(' type_name ')' cast_expression 124 131 { result = [ :CAST, val[1], val[3] ] } 125 132 126 133 multiplicative_expression 127 128 134 : cast_expression 135 | multiplicative_expression '*' cast_expression 129 136 { result = [ :OP_MULT, val[0], val[2] ] } 130 137 | multiplicative_expression '/' cast_expression 131 138 { result = [ :OP_DIV, val[0], val[2] ] } 132 139 | multiplicative_expression '%' cast_expression 133 140 { result = [ :OP_REMAIN, val[0], val[2] ] } 134 141 135 142 additive_expression 136 137 143 : multiplicative_expression 144 | additive_expression '+' multiplicative_expression 138 145 { result = [ :OP_ADD, val[0], val[2] ] } 139 146 | additive_expression '-' multiplicative_expression 140 147 { result = [ :OP_SUB, val[0], val[2] ] } 141 148 142 149 shift_expression 143 144 150 : additive_expression 151 | shift_expression '<<' additive_expression 145 152 { result = [ :OP_LSFT, val[0], val[2] ] } 146 153 | shift_expression '>>' additive_expression 147 154 { result = [ :OP_RSFT, val[0], val[2] ] } 148 155 149 156 relational_expression 150 151 157 : shift_expression 158 | relational_expression '<' shift_expression 152 159 { result = [ :OP_LT, val[0], val[2] ] } 153 160 | relational_expression '>' shift_expression 154 161 { result = [ :OP_GT, val[0], val[2] ] } 155 162 | relational_expression '<=' shift_expression 156 163 { result = [ :OP_LE, val[0], val[2] ] } 157 164 | relational_expression '>=' shift_expression 158 165 { result = [ :OP_GE, val[0], val[2] ] } 159 166 160 167 equality_expression 161 162 168 : relational_expression 169 | equality_expression '==' relational_expression 163 170 { result = [ :OP_EQ, val[0], val[2] ] } 164 171 | equality_expression '!=' relational_expression 165 172 { result = [ :OP_NE, val[0], val[2] ] } 166 173 167 174 and_expression 168 169 175 : equality_expression 176 | and_expression '&' equality_expression 170 177 { result = [ :OP_AND, val[0], val[2] ] } 171 178 172 179 exclusive_or_expression 173 174 180 : and_expression 181 | exclusive_or_expression '^' and_expression 175 182 { result = [ :OP_EOR, val[0], val[2] ] } 176 183 177 184 inclusive_or_expression 178 179 185 : exclusive_or_expression 186 | inclusive_or_expression '|' exclusive_or_expression 180 187 { result = [ :OP_OR, val[0], val[2] ] } 181 188 182 189 logical_and_expression 183 184 190 : inclusive_or_expression 191 | logical_and_expression '&&' inclusive_or_expression 185 192 { result = [ :OP_LAND, val[0], val[2] ] } 186 193 187 194 logical_or_expression 188 189 195 : logical_and_expression 196 | logical_or_expression '||' logical_and_expression 190 197 { result = [ :OP_LOR, val[0], val[2] ] } 191 198 192 199 conditional_expression 193 194 200 : logical_or_expression 201 | logical_or_expression '?' expression ':' conditional_expression 195 202 { result = [ :OP_CEX, val[0], val[2].get_elements, val[4] ] } 196 203 197 198 # コンマ演算子が使えない 204 assignment_expression 205 : conditional_expression 206 | unary_expression assignment_operator assignment_expression 207 208 assignment_operator 209 : '=' 210 | '+=' 211 | '-=' 212 | '*=' 213 | '/=' 214 | '%=' 215 | '<<=' 216 | '>>=' 217 | '&=' 218 | '|=' 219 | '^=' 220 199 221 expression 200 : conditional_expression222 : assignment_expression 201 223 { 202 224 result = Expression.new( val[0] ) 203 225 # result.print 204 226 } 227 | expression ',' assignment_expression 228 { 229 result = Expression.new( val[2] ) # ',' の後ろを採用 230 } 205 231 206 232 constant_expression 207 233 : conditional_expression 208 234 { 209 235 result = Expression.new( val[0] ) … … 218 244 } 219 245 220 221 222 246 # Types 223 247 ########################## 宣言 ########################## … … 227 251 # K&Rとの違い: storage classが指定できない、型が省略できない 228 252 declaration 229 230 # : type_specifier_qualifier_list init_declarator_list ';'253 : declaration_specifiers init_declarator_list ';' 254 # : specifier_qualifier_list init_declarator_list ';' 231 255 232 256 # declaration_specifiersは関数のパラメータで使われるが、 233 # type_specifier_qualifier_listで十分かもしれない257 # specifier_qualifier_listで十分かもしれない 234 258 235 259 declaration_specifiers 236 : storage_class 260 : storage_class_specifier 237 261 { 238 262 result = CIntType.new( -3 ) # storage class は無視 239 263 } 240 | type_specifier 241 | type_qualifier 264 | storage_class_specifier declaration_specifiers 265 { 266 result = val[1] # storage class は無視 267 } 268 | type_specifier 269 | type_specifier declaration_specifiers 270 { 271 result = val[1].merge val[0] 272 } 273 | type_qualifier 242 274 { 243 275 result = CIntType.new( -3 ) 244 276 result.set_qualifier val[0] 245 277 } 246 | storage_class declaration_specifiers 247 { 248 result = val[1] # storage class は無視 249 } 250 | type_specifier declaration_specifiers 251 { 252 result = val[1].merge val[0] 253 } 254 | type_qualifier declaration_specifiers 278 | type_qualifier declaration_specifiers 255 279 { 256 280 val[1].set_qualifier val[0] 257 result = val[1] 258 } 259 281 result = val[1] 282 } 283 | function_specifier 284 | function_specifier declaration_specifiers 260 285 261 286 init_declarator_list 262 287 : init_declarator 263 288 { result = [val[0]] } 264 289 | init_declarator_list ',' init_declarator 265 290 { result << val[2] } 266 291 267 292 init_declarator 268 269 293 : declarator 294 | declarator '=' initializer 270 295 { val[0].set_initializer( val[2] ) } 271 296 297 storage_class_specifier 298 : EXTERN 299 | STATIC 300 | AUTO 301 | REGISTER 302 272 303 type_specifier 273 : VOID { set_no_type_name true; result = CVoidType.new } 274 | FLOAT { set_no_type_name true; result = CFloatType.new(-32) } 275 | DOUBLE { set_no_type_name true; result = CFloatType.new(-64) } 276 | BOOL { set_no_type_name true; result = CBoolType.new } 277 | struct_specifier { set_no_type_name true; result = val[0] } # set_no_type_name true は struct_tag でも呼ばれる 278 | union_specifier { set_no_type_name true; result = CVoidType.new } # void が宣言されたとする 279 | enum_specifier { set_no_type_name true; result = CVoidType.new } # void が宣言されたとする 280 | TYPE_NAME { set_no_type_name true; result = CDefinedType.new( val[0].val ) } 281 282 | CHAR { set_no_type_name true; result = CIntType.new(-11 ) } 283 | SHORT { set_no_type_name true; result = CIntType.new( -2 ) } 284 | INT { set_no_type_name true; result = CIntType.new( -3 ) } 285 | LONG { set_no_type_name true; result = CIntType.new( -4 ) } 286 | SIGNED 304 : VOID 305 { set_no_type_name true; result = CVoidType.new } 306 | CHAR 307 { set_no_type_name true; result = CIntType.new(-11 ) } 308 | SHORT 309 { set_no_type_name true; result = CIntType.new( -2 ) } 310 | INT 311 { set_no_type_name true; result = CIntType.new( -3 ) } 312 | LONG 313 { set_no_type_name true; result = CIntType.new( -4 ) } 314 | FLOAT 315 { set_no_type_name true; result = CFloatType.new(-32) } 316 | DOUBLE 317 { set_no_type_name true; result = CFloatType.new(-64) } 318 | SIGNED 287 319 { 288 320 set_no_type_name true … … 290 322 result.set_sign :SIGNED 291 323 } 292 324 | UNSIGNED 293 325 { 294 326 set_no_type_name true … … 296 328 result.set_sign :UNSIGNED 297 329 } 330 | BOOL 331 { set_no_type_name true; result = CBoolType.new } 332 | struct_specifier 333 { set_no_type_name true; result = val[0] } # set_no_type_name true は struct_tag でも呼ばれる 334 | union_specifier 335 { set_no_type_name true; result = CVoidType.new } # void が宣言されたとする 336 | enum_specifier 337 { set_no_type_name true; result = CVoidType.new } # void が宣言されたとする 338 | TYPE_NAME 339 { set_no_type_name true; result = CDefinedType.new( val[0].val ) } 298 340 299 341 # mikan K&Rのstruct_or_union_specifierに相当するが、unionは使えない, bit field にも対応しない 300 342 struct_specifier # mikan 301 343 # : STRUCT struct_tag '{' 302 344 : struct_term struct_tag '{' 303 345 { StructType.set_define( true ) } 304 346 struct_declaration_list '}' 305 347 { 306 348 StructType.end_of_parse … … 308 350 } 309 351 # | STRUCT 310 352 | struct_term 311 353 { 312 354 result = CStructType.new() 313 355 StructType.set_define( true ) 314 356 } 315 357 '{' struct_declaration_list '}' 316 358 { 317 359 StructType.end_of_parse … … 319 361 } 320 362 # | STRUCT struct_tag # mikan struct_tag は namespace 対応が必要 321 363 | struct_term struct_tag # mikan struct_tag は namespace 対応が必要 322 364 { 323 365 StructType.set_define( false ) … … 327 369 328 370 struct_term 329 371 : STRUCT { set_no_type_name true } 330 372 331 373 struct_declaration_list 332 333 374 : struct_declaration 375 | struct_declaration_list struct_declaration 334 376 335 377 struct_tag: 336 378 IDENTIFIER 337 379 { 338 380 result = CStructType.new( val[0].val ) … … 342 384 # ポインタ修飾子を追加 343 385 struct_declaration 344 345 # : type_specifier_qualifier_list struct_declarator_list ';'386 : declaration_specifiers struct_declarator_list ';' 387 # : specifier_qualifier_list struct_declarator_list ';' 346 388 { 347 389 val[1].each { |i| # i: Decl … … 353 395 result = val[1] 354 396 } 355 | union_specifier ';' # 無名 356 | struct_specifier ';' # 無名 397 # ビットフィールドを読み飛ばし 398 | declaration_specifiers struct_declarator_list ':' constant_expression ';' 399 { 400 val[1].each { |i| # i: Decl 401 i.set_type( val[0] ) 402 i.set_kind( :MEMBER ) 403 i.check 404 CStructType.new_member( i ) 405 } 406 result = val[1] 407 } 408 | union_specifier ';' # 無名 409 | struct_specifier ';' # 無名 357 410 358 411 … … 360 413 # K&Rのspecifier_qualifier_listと同じ 361 414 # 名前がまぎらわしかったのでtype_を付けた 362 type_specifier_qualifier_list 363 : type_specifier 364 | type_specifier type_specifier_qualifier_list 415 specifier_qualifier_list 416 : type_specifier specifier_qualifier_list 365 417 { 366 418 result = val[1].merge val[0] 367 419 } 368 | type_qualifier 420 | type_specifier 421 | type_qualifier specifier_qualifier_list 422 { 423 val[1].set_qualifier val[0] 424 result = val[1] 425 } 426 | type_qualifier 369 427 { 370 428 result = CIntType.new( -3 ) 371 429 result.set_qualifier val[0] 372 430 } 373 | type_qualifier type_specifier_qualifier_list374 {375 val[1].set_qualifier val[0]376 result = val[1]377 }378 431 379 432 struct_declarator_list 380 433 : struct_declarator 381 434 { result = [ val[0] ] } 382 435 | struct_declarator_list ',' struct_declarator 383 436 { result << val[2] } 384 437 385 438 # ビットフィールドは使えない 386 439 struct_declarator 387 388 389 440 : declarator 441 # | ':' constant_expression 442 # | declarator ':' constant_expression 390 443 391 444 union_specifier … … 393 446 # | UNION '{' union_declaration_list '}' 394 447 # | UNION union_tag # mikan struct_tag は namespace 対応が必要 395 396 397 448 : union_term union_tag '{' union_declaration_list '}' 449 | union_term '{' union_declaration_list '}' 450 | union_term union_tag # mikan struct_tag は namespace 対応が必要 398 451 399 452 union_term 400 453 : UNION { set_no_type_name true } 401 454 402 455 union_declaration_list 403 404 456 : union_declaration 457 | union_declaration_list union_declaration 405 458 406 459 union_tag: … … 408 461 409 462 union_declaration 410 463 : declaration_specifiers union_declarator_list ';' 411 464 | union_specifier ';' # 無名 412 465 | struct_specifier ';' # 無名 413 466 414 467 union_declarator_list 415 : union_declarator 416 | union_declarator_list ',' union_declarator 417 418 # ビットフィールドは使えない 468 : union_declarator 469 | union_declarator_list ',' union_declarator 470 419 471 union_declarator 420 : declarator 421 422 423 424 # enumの種類を追加 425 enum_specifier # mikan 426 : enum_type '{' enumerator_list '}' 427 | enum_type IDENTIFIER '{' enumerator_list '}' 428 | enum_type IDENTIFIER 429 430 enum_type 431 : ENUM { result = CEnumType.new( -1 ) } 432 # | ENUM8 { result = CEnumType.new( 8 ) } 433 # | ENUM16 { result = CEnumType.new( 16 ) } 434 # | ENUM32 { result = CEnumType.new( 32 ) } 435 # | ENUM64 { result = CEnumType.new( 64 ) } 436 # | ENUM128 { result = CEnumType.new( 128 ) } 472 : declarator 473 | ':' constant_expression 474 | declarator ':' constant_expression 475 476 enum_specifier 477 : ENUM '{' enumerator_list '}' 478 | ENUM IDENTIFIER '{' enumerator_list '}' 479 | ENUM '{' enumerator_list ',' '}' 480 | ENUM IDENTIFIER '{' enumerator_list ',' '}' 481 | ENUM IDENTIFIER 482 | ENUM TYPE_NAME '{' enumerator_list '}' 483 | ENUM TYPE_NAME '{' enumerator_list ',' '}' 484 | ENUM TYPE_NAME 437 485 438 486 enumerator_list 439 440 487 : enumerator 488 | enumerator_list ',' enumerator 441 489 442 490 enumerator 443 444 491 : IDENTIFIER 492 | IDENTIFIER '=' constant_expression 445 493 446 494 type_qualifier 447 : CONST { result = :CONST } 448 | VOLATILE { result = :VOLATILE } 495 : CONST 496 { result = :CONST } 497 | RESTRICT 498 | VOLATILE 499 { result = :VOLATILE } 500 501 function_specifier 502 : __INLINE__ 503 | INLINE 504 | __INLINE 505 | CINLINE 449 506 450 507 declarator 451 508 : pointer direct_declarator 452 509 { 453 510 val[1].set_type( val[0] ) 454 511 result = val[1] 455 512 } 456 457 513 | direct_declarator 514 | pointer TYPE_NAME # 関数ポインタの typedef が二重定義の場合 458 515 { 459 516 result = Decl.new( val[1].val ) … … 462 519 463 520 direct_declarator # mikan 464 521 : IDENTIFIER 465 522 { result = Decl.new( val[0].val ) } 466 523 | '(' declarator ')' 467 524 { result = val[1] } 468 525 | direct_declarator '[' constant_expression ']' 469 526 { 470 527 val[0].set_type( CArrayType.new( val[2] ) ) 471 528 result = val[0] 472 529 } 473 530 | direct_declarator '[' ']' 474 531 { 475 532 val[0].set_type( CArrayType.new ) 476 533 result = val[0] 477 534 } 478 535 | direct_declarator '(' parameter_type_list ')' 479 536 { 480 537 # Generator.warning( "W6001 need 'void' for no parameter" ) … … 482 539 result = val[0] 483 540 } 484 485 # | direct_declarator '(' identifier_list ')' # これは何のために必要? 060211 486 | direct_declarator '(' ')' 541 | direct_declarator '(' identifier_list ')' # これは何のために必要? 060211 542 | direct_declarator '(' ')' 487 543 { 488 544 # Generator.warning( "W6002 need 'void' for no parameter" ) … … 492 548 493 549 pointer 494 550 : '*' 495 551 { result = CPtrType.new } 496 | '*' type_qualifier 552 | '*' type_qualifier_list 497 553 { 498 554 result = CPtrType.new 499 555 result.set_qualifier( val[1] ) 500 556 } 501 557 | '*' pointer 502 558 { 503 559 val[1].set_type(CPtrType.new) 504 560 result = val[1] 505 561 } 506 | '*' type_qualifierpointer562 | '*' type_qualifier_list pointer 507 563 { 508 564 ptrtype = CPtrType.new … … 512 568 } 513 569 570 type_qualifier_list 571 : type_qualifier 572 | type_qualifier_list type_qualifier 514 573 515 574 parameter_type_list 516 517 575 : parameter_list 576 | parameter_list ',' '.' '.' '.' 518 577 # mikan 可変長パラメータ, ... の間のスペースが許される(手抜き) 519 578 520 579 parameter_list 521 580 : parameter_declaration 522 581 # { result = ParamList.new( val[0] ) } 523 582 | parameter_list ',' parameter_declaration 524 583 # { 525 584 # val[0].add_param( val[2] ) … … 530 589 # パラメータ修飾子を追加 531 590 parameter_declaration 532 591 : declaration_specifiers declarator 533 592 # { 534 593 # decl = ParamDecl.new( val[1], val[0], [] ) … … 545 604 # result = nil 546 605 # } 547 548 549 550 551 #identifier_list # 060211 不用になった552 #: IDENTIFIER553 #| identifier_list ',' IDENTIFIER606 | declaration_specifiers abstract_declarator # 仮引数なし 607 | declaration_specifiers # 仮引数なし 608 609 610 identifier_list # 060211 不用になった 611 : IDENTIFIER 612 | identifier_list ',' IDENTIFIER 554 613 555 614 type_name 556 : type_specifier_qualifier_list557 | type_specifier_qualifier_list abstract_declarator615 : specifier_qualifier_list 616 | specifier_qualifier_list abstract_declarator 558 617 559 618 abstract_declarator # mikan 560 561 562 619 : pointer 620 | direct_abstract_declarator 621 | pointer direct_abstract_declarator 563 622 564 623 direct_abstract_declarator 565 566 567 | '[' constant_expression ']'568 569 | direct_abstract_declarator '[' constant_expression ']'570 624 : '(' abstract_declarator ')' 625 | '[' ']' 626 | '[' assignment_expression ']' 627 | direct_abstract_declarator '[' ']' 628 | direct_abstract_declarator '[' assignment_expression ']' 629 | '(' ')' 571 630 { 572 631 Generator.warning( "W6003 need 'void' for no parameter" ) 573 632 } 574 575 633 | '(' parameter_type_list ')' 634 | direct_abstract_declarator '(' ')' 576 635 { 577 636 Generator.warning( "W6004 need 'void' for no parameter" ) 578 637 } 579 638 | direct_abstract_declarator '(' parameter_type_list ')' 580 639 581 640 # assignment_expressionをconstant_expressionに変更 582 641 initializer # mikan 583 : constant_expression642 : assignment_expression 584 643 { result = val[0] } 585 644 | '{' initializer_list '}' 586 645 { result = val[1] } 587 646 | '{' initializer_list ',' '}' 588 647 { result = val[1] } 589 | C_EXP '(' STRING_LITERAL ')'648 | C_EXP '(' STRING_LITERAL ')' 590 649 { result = C_EXP.new( val[2] ) } 591 650 592 651 initializer_list 593 652 : initializer 594 653 { 595 654 result = [ val[0] ] 596 655 } 597 656 | initializer_list ',' initializer 598 657 { 599 658 val[0] << val[2] … … 606 665 #トップレベルの構文規則 607 666 C_parser 608 609 667 : 668 | C_parser extension_statement 610 669 611 670 extension_statement 612 :statement613 | EXTENSIONstatement614 615 statement616 617 618 619 620 621 622 671 : cdl_statement 672 | EXTENSION cdl_statement 673 674 cdl_statement 675 : typedef 676 | func_def 677 | enum_specifier ';' 678 | struct_specifier ';' 679 | declaration 680 | ';' 681 | error # エラー回復ポイント 623 682 624 683 typedef 625 : TYPEDEF type_specifier_qualifier_list declarator_list ';'684 : TYPEDEF specifier_qualifier_list declarator_list ';' 626 685 { 627 686 val[2].each{ |i| … … 633 692 634 693 declarator_list 635 694 : declarator 636 695 { result = [ val[0] ] } 637 696 | declarator_list ',' declarator 638 697 { result << val[2] } 639 698 640 699 func_def 641 : declaration_specifiers declarator compoundstatement 642 643 infunc_statement_list 644 : 645 | infunc_statement_list infunc_statement 646 647 infunc_statement 648 : declaration 649 | ifstatement 650 | whilestatement 651 | dowhilestatement 652 | forstatement 653 | switchstatement 654 | labelstatement 655 | compoundstatement 656 | gotostatement 657 | expressionstatement 658 | ';' 700 : declaration_specifiers declarator compound_statement 701 702 statement 703 : labeled_statement 704 | compound_statement 705 | expression_statement 706 | ifstatement 707 | whilestatement 708 | dowhilestatement 709 | forstatement 710 | switchstatement 711 | jump_statement 712 | asm_statement 713 714 labeled_statement 715 : IDENTIFIER ':' statement 716 | CASE constant_expression ':' statement 717 | DEFAULT ':' statement 718 719 compound_statement 720 : '{' '}' 721 | '{' block_item_list '}' 722 723 block_item_list 724 : block_item 725 | block_item_list block_item 726 727 block_item 728 : declaration 729 | statement 730 731 expression_statement 732 : ';' 733 | expression ';' 659 734 660 735 ifstatement 661 : IF '(' expression ')' infunc_statement 662 | IF '(' expression ')' infunc_statement ELSE infunc_statement 736 : IF '(' expression ')' statement 737 | IF '(' expression ')' statement ELSE statement 738 739 switchstatement 740 : SWITCH '(' expression ')' compound_statement 663 741 664 742 whilestatement 665 : WHILE '(' expression ')' infunc_statement743 : WHILE '(' expression ')' statement 666 744 667 745 dowhilestatement 668 : DO infunc_statement WHILE '(' expression ')' ';'746 : DO statement WHILE '(' expression ')' ';' 669 747 670 748 forstatement 671 : FOR '(' expression ';' expression ';' expression ')' infunc_statement 672 673 switchstatement 674 : SWITCH '(' expression ')' infunc_statment 675 676 labelstatement 677 : IDENTIFIER ':' infunc_statement 678 | CASE constant_expression ':' infunc_statement 679 | DEFAULT ':' infunc_statement 680 681 compoundstatement 682 : '{' infunc_statement_list '}' 683 684 gotostatement 685 : GOTO IDENTIFIER ';' 686 | CONTINUE ';' 687 | BREAK ';' 688 | RETURN expression ';' 689 | RETURN ';' 690 691 expressionstatement 692 : expression ';' 693 | unary_expression assignment_operator expression ';' 694 695 assignment_operator 696 : '=' 697 | '+=' 698 | '-=' 699 | '*=' 700 | '/=' 701 | '%=' 702 | '<<=' 703 | '>>=' 704 | '&=' 705 | '|=' 706 | '^=' 707 708 storage_class 709 : __INLINE__ 710 | INLINE 711 | __INLINE 712 | CINLINE 713 | EXTERN 714 | STATIC 715 | AUTO 716 | REGISTER 749 : FOR '(' expression_statement expression_statement ')' statement 750 | FOR '(' expression_statement expression_statement expression ')' statement 751 | FOR '(' declaration expression_statement ')' statement 752 | FOR '(' declaration expression_statement expression ')' statement 753 754 jump_statement 755 : GOTO IDENTIFIER ';' 756 | CONTINUE ';' 757 | BREAK ';' 758 | RETURN ';' 759 | RETURN expression ';' 717 760 718 761 namespace_identifier 719 720 721 762 : IDENTIFIER { result = NamespacePath.new( val[0].val, false ) } 763 | '::' IDENTIFIER { result = NamespacePath.new( val[1].val, true ) } 764 | namespace_identifier '::' IDENTIFIER 722 765 { result = val[0].append!( val[2].val ) } 723 766 767 asm_statement 768 : _ASM { 769 while true 770 # ';' が表れるまで、トークンを読み飛ばす。 771 # gcc の構文拡張に対応すべきだが、単純な実装として、';' まで読み飛ばす。 772 # トークン単位で読み飛ばしているので、文字列やコメント内の ';' は対象にならない。 773 token = next_token 774 if token[1].val == ";" 775 break 776 end 777 # p "skip: #{token[1].val}" 778 end 779 } 780 724 781 end 725 782 726 783 ---- inner 727 784 728 RESERVED = { 729 # keyword 730 'typedef' => :TYPEDEF, 731 'struct' => :STRUCT, 732 'union' => :UNION, 733 'sizeof' => :SIZEOF, 734 'throw' => :THROW, 735 736 # specifier 737 # types 738 'void' => :VOID, 739 'char' => :CHAR, 740 'short' => :SHORT, 741 742 'volatile'=> :VOLATILE, 743 'const' => :CONST, 744 'extern' => :EXTERN, 745 746 'long' => :LONG, 747 'float' => :FLOAT, 748 'double' => :DOUBLE, 749 'signed' => :SIGNED, 750 'unsigned'=> :UNSIGNED, 751 752 'int' => :INT, 753 'enum' => :ENUM, 754 755 'if' => :IF, 756 'else' => :ELSE, 757 'while' => :WHILE, 758 'do' => :DO, 759 'for' => :FOR, 760 'case' => :CASE, 761 'default' => :DEFAULT, 762 'goto' => :GOTO, 763 'continue' => :CONTINUE, 764 'break' => :BREAK, 765 'return' => :RETURN, 766 '__inline__' => :__INLINE__, 767 'inline' => :INLINE, 768 '__inline' => :__INLINE, 769 'Inline' => :CINLINE, # inline starting with Capital letter 770 'static' => :STATIC, 771 'register' => :REGISTER, 772 'auto' => :AUTO, 773 '__extension__' => :EXTENSION, 774 775 } 776 777 @@generator_nest = -1 778 @@generator_stack = [] 779 @@current_locale = [] 780 781 def finalize 782 783 # mikan Namespace.pop 784 Celltype.pop 785 Cell.pop 786 CompositeCelltype.pop 787 Region.pop 788 789 end 790 791 def set_plugin( plugin ) 792 @plugin = plugin 793 end 794 795 def self.get_plugin 796 @@generator_stack[@@generator_nest].get_plugin 797 end 798 799 def get_plugin 800 @plugin 801 end 802 803 def parse(files) 804 805 # mikan Namespace.push 806 Celltype.push 807 Cell.push 808 CompositeCelltype.push 809 Region.push 810 811 @@generator_nest += 1 812 @@generator_stack[@@generator_nest] = self 813 @b_no_type_name = false 814 815 begin 816 817 @q = [] 818 comment = false 819 820 # euc のコメントを utf8 として扱うと、コメントの終わりを誤る問題の対策 821 TECS_LANG::set_kcode_binary 822 823 # 800U, 0xffLL など (整数リテラルに共通の修飾子) 824 integer_qualifier = "([Uu][Ll][Ll]|[Uu][Ll]|[Uu]|[Ll][Ll]|[Ll])?" 825 826 files.each {|file| 827 lineno = 1 828 begin 829 #2.0 IO.foreach(file) {|line| 830 TECSIO.foreach(file) {|line| 831 col = 1 832 line.rstrip! 833 834 until line.empty? 835 836 if comment 837 case line 838 # コメント終了 839 when /\A\*\// 840 comment = false 841 when /\A./ 842 ; 843 end 844 else 845 case line 846 # 空白、プリプロセスディレクティブ 847 when /\A\s+/ 848 ; 849 # 識別子 850 when /\A[a-zA-Z_]\w*/ 851 word = $& 852 @q << [RESERVED[word] || :IDENTIFIER, Token.new(word.intern, file, lineno, col)] 853 # 16 進数定数 854 when /\A0x[0-9A-Fa-f]+#{integer_qualifier}/ 855 @q << [:HEX_CONSTANT, Token.new($&, file, lineno, col)] 856 # 8 進数定数 857 when /\A0[0-7]+#{integer_qualifier}/ 858 @q << [:OCTAL_CONSTANT, Token.new($&, file, lineno, col)] 859 # 浮動小数定数 860 when /\A[0-9]+\.([0-9]*)?([Ee][+-]?[0-9]+)?/ 861 @q << [:FLOATING_CONSTANT, Token.new($&, file, lineno, col)] 862 # 整数定数 863 when /\A\d+#{integer_qualifier}/ 864 # when /\A\d+/ 865 @q << [:INTEGER_CONSTANT, Token.new($&.to_i, file, lineno, col)] 866 # 文字 867 when /\A'(?:[^'\\]|\\.)'/ 868 @q << [:CHARACTER_LITERAL, Token.new($&, file, lineno, col)] 869 # 文字列 870 # "#include #include #include \"../systask/logtask.cfg\" 最後の " 忘れ)で無限ループ 871 # when /\A"(?:[^"\\]+|\\.)*"/ 872 when /\A"(?:[^"\\]|\\.)*"/ # これはうまく行くようだ 873 @q << [:STRING_LITERAL, Token.new($&, file, lineno, col)] 874 # 行コメント 875 when /\A\/\/.*$/ 876 # 読み飛ばすだけ 877 # コメント開始 878 when /\A\/\*/ 879 comment = true 880 when /\A>>=/, /\A<<=/, /\A>>/, /\A<</ 881 @q << [$&, Token.new($&, file, lineno, col)] 882 when /\A\+=/, /\A\-=/, /\A\*=/, /\A\/=/, /\A%=/, /\A&=/, /\A\|=/, /\A\^=/ 883 @q << [$&, Token.new($&, file, lineno, col)] 884 when /\A::/, /\A==/, /\A!=/, /\A>=/, /\A<=/, /\A\->/, /\A\+\+/, /\A\-\-/ 885 @q << [$&, Token.new($&, file, lineno, col)] 886 when /\A./ 887 @q << [$&, Token.new($&, file, lineno, col)] 888 else 889 raise 890 end 891 end 892 893 line = $' 894 col += $&.length 895 end 896 897 lineno += 1 898 } 899 900 rescue => evar 901 Generator.error( "B1002 while open or reading \'$1\'" , file ) 902 print_exception( evar ) 903 end 904 } 905 906 # 終了の印 907 @q << nil 908 909 @yydebug = true 910 do_parse 911 912 ensure 913 @@generator_nest -= 1 914 TECS_LANG::reset_kcode 915 end 916 917 end 918 919 920 def next_token 921 token = @q.shift 922 923 if token then 924 @@current_locale[@@generator_nest] = token[1].locale 925 926 case token[1].val 927 when ";", ":", ",", "(", ")", "{", "}" 928 set_no_type_name false 929 when ".", "->" 930 set_no_type_name true 931 end 932 933 # TYPE_NAME トークンへ置き換え 934 if @b_no_type_name == false 935 if token[0] == :IDENTIFIER && Namespace.is_typename?( token[1].val ) then 936 token[0] = :TYPE_NAME 937 locale = @@current_locale[@@generator_nest] 785 RESERVED = { 786 # keyword 787 'typedef' => :TYPEDEF, 788 'struct' => :STRUCT, 789 'union' => :UNION, 790 'sizeof' => :SIZEOF, 791 'throw' => :THROW, 792 793 # specifier 794 # types 795 'void' => :VOID, 796 'char' => :CHAR, 797 'short' => :SHORT, 798 799 'volatile'=> :VOLATILE, 800 'restrict'=> :RESTRICT, 801 'const' => :CONST, 802 'extern' => :EXTERN, 803 804 'long' => :LONG, 805 'float' => :FLOAT, 806 'double' => :DOUBLE, 807 'signed' => :SIGNED, 808 'unsigned'=> :UNSIGNED, 809 810 'int' => :INT, 811 'enum' => :ENUM, 812 813 'if' => :IF, 814 'else' => :ELSE, 815 'while' => :WHILE, 816 'do' => :DO, 817 'for' => :FOR, 818 'switch' => :SWITCH, 819 'case' => :CASE, 820 'default' => :DEFAULT, 821 'goto' => :GOTO, 822 'continue' => :CONTINUE, 823 'break' => :BREAK, 824 'return' => :RETURN, 825 '__inline__' => :__INLINE__, 826 'inline' => :INLINE, 827 '__inline' => :__INLINE, 828 'Inline' => :CINLINE, # inline starting with Capital letter 829 'static' => :STATIC, 830 'register' => :REGISTER, 831 'auto' => :AUTO, 832 '__extension__' => :EXTENSION, 833 '__asm__' => :_ASM, 834 'asm' => :_ASM 835 836 } 837 838 @@generator_nest = -1 839 @@generator_stack = [] 840 @@current_locale = [] 841 842 def finalize 843 844 # mikan Namespace.pop 845 Celltype.pop 846 Cell.pop 847 CompositeCelltype.pop 848 Region.pop 849 850 end 851 852 def set_plugin( plugin ) 853 @plugin = plugin 854 end 855 856 def self.get_plugin 857 @@generator_stack[@@generator_nest].get_plugin 858 end 859 860 def get_plugin 861 @plugin 862 end 863 864 def parse(files) 865 866 # mikan Namespace.push 867 Celltype.push 868 Cell.push 869 CompositeCelltype.push 870 Region.push 871 872 @@generator_nest += 1 873 @@generator_stack[@@generator_nest] = self 874 @b_no_type_name = false 875 876 begin 877 878 @q = [] 879 comment = false 880 # b_asm = false 881 882 # euc のコメントを utf8 として扱うと、コメントの終わりを誤る問題の対策 883 TECS_LANG::set_kcode_binary 884 885 # 800U, 0xffLL など (整数リテラルに共通の修飾子) 886 integer_qualifier = "([Uu][Ll][Ll]|[Uu][Ll]|[Uu]|[Ll][Ll]|[Ll])?" 887 888 files.each {|file| 889 lineno = 1 890 begin 891 #2.0 IO.foreach(file) {|line| 892 TECSIO.foreach(file) {|line| 893 col = 1 894 line.rstrip! 895 896 until line.empty? 897 898 if comment 899 case line 900 # コメント終了 901 when /\A\*\// 902 comment = false 903 when /\A./ 904 ; 905 end 906 else 907 case line 908 # 空白、プリプロセスディレクティブ 909 when /\A\s+/ 910 ; 911 # 識別子 912 when /\A[a-zA-Z_]\w*/ 913 word = $& 914 @q << [RESERVED[word] || :IDENTIFIER, Token.new(word.intern, file, lineno, col)] 915 # 16 進数定数 916 when /\A0x[0-9A-Fa-f]+#{integer_qualifier}/ 917 @q << [:HEX_CONSTANT, Token.new($&, file, lineno, col)] 918 # 8 進数定数 919 when /\A0[0-7]+#{integer_qualifier}/ 920 @q << [:OCTAL_CONSTANT, Token.new($&, file, lineno, col)] 921 # 浮動小数定数 922 when /\A[0-9]+\.([0-9]*)?([Ee][+-]?[0-9]+)?/ 923 @q << [:FLOATING_CONSTANT, Token.new($&, file, lineno, col)] 924 # 整数定数 925 when /\A\d+#{integer_qualifier}/ 926 # when /\A\d+/ 927 @q << [:INTEGER_CONSTANT, Token.new($&.to_i, file, lineno, col)] 928 # 文字 929 when /\A'(?:[^'\\]|\\.)'/ 930 @q << [:CHARACTER_LITERAL, Token.new($&, file, lineno, col)] 931 # 文字列 932 # "#include #include #include \"../systask/logtask.cfg\" 最後の " 忘れ)で無限ループ 933 # when /\A"(?:[^"\\]+|\\.)*"/ 934 when /\A"(?:[^"\\]|\\.)*"/ # これはうまく行くようだ 935 @q << [:STRING_LITERAL, Token.new($&, file, lineno, col)] 936 # 行コメント 937 when /\A\/\/.*$/ 938 # 読み飛ばすだけ 939 # コメント開始 940 when /\A\/\*/ 941 comment = true 942 when /\A>>=/, /\A<<=/, /\A>>/, /\A<</ 943 @q << [$&, Token.new($&, file, lineno, col)] 944 when /\A\+=/, /\A\-=/, /\A\*=/, /\A\/=/, /\A%=/, /\A&=/, /\A\|=/, /\A\^=/ 945 @q << [$&, Token.new($&, file, lineno, col)] 946 when /\A::/, /\A==/, /\A!=/, /\A>=/, /\A<=/, /\A\->/, /\A\+\+/, /\A\-\-/ 947 @q << [$&, Token.new($&, file, lineno, col)] 948 when /\A\|\|/, /\A\&\&/ 949 @q << [$&, Token.new($&, file, lineno, col)] 950 when /\A./ 951 @q << [$&, Token.new($&, file, lineno, col)] 952 else 953 raise 954 end 955 end 956 957 line = $' 958 col += $&.length 959 end 960 961 lineno += 1 962 } 963 964 rescue => evar 965 Generator.error( "B1002 while open or reading \'$1\'" , file ) 966 print_exception( evar ) 967 end 968 } 969 970 # 終了の印 971 @q << nil 972 973 @yydebug = true 974 do_parse 975 976 ensure 977 @@generator_nest -= 1 978 TECS_LANG::reset_kcode 979 end 980 981 end 982 983 984 def next_token 985 token = @q.shift 986 987 if token then 988 @@current_locale[@@generator_nest] = token[1].locale 989 990 case token[1].val 991 when ";", ":", ",", "(", ")", "{", "}" 992 set_no_type_name false 993 when ".", "->" 994 set_no_type_name true 995 end 996 997 # TYPE_NAME トークンへ置き換え 998 if @b_no_type_name == false 999 if token[0] == :IDENTIFIER && Namespace.is_typename?( token[1].val ) then 1000 token[0] = :TYPE_NAME 1001 locale = @@current_locale[@@generator_nest] 938 1002 #print( "#{locale[0]}: line #{locale[1]} : #{token[0]} '#{token[1].val}: type_name'\n" ) 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1003 end 1004 end 1005 1006 if $debug then # 070107 token 無効時ここを通さないようした (through 対応 -d の時に例外発生) 1007 locale = @@current_locale[@@generator_nest] 1008 if token then 1009 print( "#{locale[0]}: line #{locale[1]} : #{token[0]} '#{token[1].val}'\n" ) 1010 else 1011 print( "#{locale[0]}: line #{locale[1]} : EOF\n" ) 1012 end 1013 end 1014 end 1015 1016 token 1017 end 1018 1019 def on_error(t, v, vstack) 1020 if v == "$" then 1021 Generator.error( "B1003 Unexpected EOF" ) 1022 else 1023 Generator.error( "B1004 syntax error near \'$1\'" , v.val ) 1024 end 1025 1026 end 1027 1028 def self.current_locale 1029 @@current_locale[ @@generator_nest ] 1030 end 1031 1032 @@n_error = 0 1033 @@n_warning = 0 1034 @@n_info = 0 1035 1036 # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でエラー発生は不適切) 1037 def self.error( msg ) 1038 @@n_error += 1 1039 locale = @@current_locale[ @@generator_nest ] 1040 1041 if locale then 1042 Console.puts "error: #{locale[0]}: line #{locale[1]} #{msg}" 1043 else 1044 Console.puts "error: #{msg}" 1045 end 1046 end 1047 1048 # このメソッドは構文解析、意味解析からのみ呼出し可(コード生成でウォーニング発生は不適切) 1049 def self.warning( msg ) 1050 @@n_warning += 1 1051 locale = @@current_locale[ @@generator_nest ] 1052 Console.puts "warning: #{locale[0]}: line #{locale[1]} #{msg}" 1053 end 1054 1055 # このメソッドは構文解析、意味解析からのみ呼出し可 1056 def self.info( msg ) 1057 @@n_info += 1 1058 locale = @@current_locale[ @@generator_nest ] 1059 Console.puts "info: #{locale[0]}: line #{locale[1]} #{msg}" 1060 end 1061 1062 def self.get_n_error 1063 @@n_error 1064 end 1065 1066 def self.get_n_warning 1067 @@n_warning 1068 end 1069 1070 def self.get_nest 1071 @@generator_nest 1072 end 1073 1074 def set_no_type_name b_no_type_name 1075 locale = @@current_locale[ @@generator_nest ] 1012 1076 #print "b_no_type_name=#{b_no_type_name} #{locale[0]}: line #{locale[1]}\n" 1013 1014 1077 @b_no_type_name = b_no_type_name 1078 end 1015 1079 1016 1080 ---- footer -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/bnf.tab.rb
r337 r374 284 284 string += line 285 285 # この位置では error メソッドは使えない (token 読出し前) 286 puts " error: #{file} line #{lineno}: string literal has newline without escape"286 puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape" 287 287 @@n_error += 1 288 288 end … … 325 325 b_in_string = true 326 326 # この位置では error メソッドは使えない (token 読出し前) # mikan cdl_error ではない 327 puts " error: #{file} line #{lineno}: string literal has newline without escape"327 puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape" 328 328 @@n_error += 1 329 329 # 山括弧で囲まれた文字列 330 when /\A<[0-9A-Za-z_\. \/]+>/ # AB: angle bracke 330 # when /\A<[0-9A-Za-z_\. \/]+>/ # AB: angle bracke 331 when /\A<(?:[^>\\]|\\.)*>/ # これはうまく行くようだ 331 332 @q << [:AB_STRING_LITERAL, Token.new($&, file, lineno, col)] 332 333 # 行コメント … … 458 459 end 459 460 if locale then 460 Console.puts " error: #{locale[0]}: line #{locale[1]}#{msg}"461 Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: error: #{msg}" 461 462 else 462 463 Console.puts "error: #{msg}" … … 491 492 end 492 493 if locale then 493 Console.puts " warning: #{locale[0]}: line #{locale[1]}#{msg}"494 Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: warning: #{msg}" 494 495 else 495 496 Console.puts "warning: #{msg}" … … 524 525 end 525 526 if locale then 526 Console.puts " info: #{locale[0]}: line #{locale[1]}#{msg}"527 Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: info: #{msg}" 527 528 else 528 529 Console.puts "info: #{msg}" … … 589 590 590 591 clist = [ 591 '66,575,328, 666,538,872,78,330,562,328,78,78,78,163,199,200,201,202,203',592 '204,205,207,846,208,678, 700,897,135,647,212,213,214,215,216,217,218',593 ' 679,249,761,711,565,547,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24',592 '66,575,328,559,538,815,78,330,869,328,78,78,78,409,199,200,201,202,203', 593 '204,205,207,846,208,678,135,897,135,647,212,213,214,215,216,217,218', 594 '249,679,177,872,870,408,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24', 594 595 '25,26,27,28,29,30,31,32,33,34,35,38,465,189,693,333,334,42,43,44,45', 595 '46,47,48,49,896,180,644,256,559,177,815,163,135,189,135,135,135,135', 596 '189,66,189,189,70,68,69,135,71,72,328,73,78,74,304,305,324,860,901,189', 597 '255,162,325,136,327,189,75,75,75,76,77,77,77,135,88,189,189,189,189', 598 '79,87,101,80,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28', 599 '29,30,31,32,33,34,35,38,78,426,569,668,899,42,43,44,45,46,47,48,49,189', 600 '178,189,136,66,136,136,136,136,256,135,446,89,100,78,78,136,328,70,68', 601 '69,667,71,72,135,73,571,74,304,305,324,135,135,135,478,868,325,479,327', 602 '867,399,75,136,76,89,77,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24', 603 '25,26,27,28,29,30,31,32,33,34,35,38,450,48,49,400,839,42,43,44,45,46', 604 '47,48,49,135,135,328,838,66,304,305,306,607,307,308,310,311,406,208', 605 '78,136,136,70,68,69,401,71,72,797,73,150,74,78,149,136,654,304,305,324', 606 '78,796,136,136,136,325,75,327,76,407,77,5,6,7,10,13,14,15,16,17,18,19', 607 '20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,835,163,403,661,402', 608 '42,43,44,45,46,47,48,49,163,648,826,403,88,697,136,136,432,78,87,681', 609 '816,574,89,208,520,720,70,68,69,660,71,72,532,73,196,74,510,636,827', 610 '199,200,201,202,203,204,205,207,208,208,75,682,76,135,77,212,213,214', 611 '215,216,217,218,304,305,306,889,307,308,310,311,199,200,201,202,203', 612 '204,205,207,817,208,635,747,518,135,637,212,213,214,215,216,217,218', 613 '529,888,415,199,200,201,202,203,204,205,207,341,208,342,528,343,135', 614 '234,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207,414', 615 '208,270,878,235,135,719,212,213,214,215,216,217,218,525,277,589,504', 616 '691,314,180,136,582,590,721,581,199,200,201,202,203,204,205,207,879', 617 '208,720,587,163,135,776,212,213,214,215,216,217,218,503,690,313,136', 618 '199,200,201,202,203,204,205,207,264,208,523,698,282,135,770,212,213', 619 '214,215,216,217,218,347,582,136,275,581,348,349,898,180,850,199,200', 620 '201,202,203,204,205,207,163,208,699,283,91,135,136,212,213,214,215,216', 621 '217,218,199,200,201,202,203,204,205,207,851,208,722,833,691,135,162', 622 '212,213,214,215,216,217,218,630,163,88,887,136,902,478,886,87,479,347', 623 '859,89,163,409,348,349,88,631,699,832,794,903,87,904,234,592,89,629', 624 '170,136,199,200,201,202,203,204,205,207,858,208,564,408,90,135,235,212', 625 '213,214,215,216,217,218,522,199,200,201,202,203,204,205,207,136,208', 626 '521,150,906,135,149,212,213,214,215,216,217,218,199,200,201,202,203', 627 '204,205,207,136,208,394,395,396,135,360,212,213,214,215,216,217,218', 628 '199,200,201,202,203,204,205,207,361,208,394,395,396,135,362,212,213', 629 '214,215,216,217,218,145,146,363,199,200,201,202,203,204,205,207,437', 630 '208,287,288,454,135,136,212,213,214,215,216,217,218,234,354,355,356', 631 '357,591,436,438,439,440,441,456,457,458,455,136,347,350,351,515,235', 632 '348,349,199,200,201,202,203,204,205,207,907,208,352,353,514,135,136', 633 '212,213,214,215,216,217,218,199,200,201,202,203,204,205,207,513,208', 634 '358,359,512,135,136,212,213,214,215,216,217,218,364,365,511,199,200', 635 '201,202,203,204,205,207,208,208,404,336,482,135,136,212,213,214,215', 636 '216,217,218,199,200,201,202,203,204,205,207,481,208,517,518,474,135', 637 '473,212,213,214,215,216,217,218,472,199,200,201,202,203,204,205,207', 638 '470,208,350,351,463,135,136,212,213,214,215,216,217,218,350,351,234', 639 '354,355,356,357,607,454,737,738,740,741,437,136,88,352,353,196,739,785', 640 '87,235,608,234,89,610,743,742,456,457,458,455,436,438,439,440,441,611', 641 '136,354,355,356,357,235,352,353,199,200,201,202,203,204,205,207,336', 642 '208,352,353,612,135,136,212,213,214,215,216,217,218,614,199,200,201', 643 '202,203,204,205,207,472,208,352,353,615,135,136,212,213,214,215,216', 644 '217,218,199,200,201,202,203,204,205,207,616,208,358,359,617,135,618', 645 '212,213,214,215,216,217,218,199,200,201,202,203,204,205,207,208,208', 646 '594,336,908,135,621,212,213,214,215,216,217,218,620,288,163,199,200', 647 '201,202,203,204,205,207,462,208,787,788,459,135,136,212,213,214,215', 648 '216,217,218,625,199,200,201,202,203,204,205,207,448,208,789,790,445', 596 '46,47,48,49,896,88,644,406,666,761,711,87,135,871,135,135,135,135,189', 597 '66,189,189,70,68,69,135,71,72,328,73,78,74,304,305,324,860,901,189,407', 598 '136,325,136,327,189,75,75,75,76,77,77,77,135,874,178,189,189,189,79', 599 '875,101,80,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28', 600 '29,30,31,32,33,34,35,38,78,364,365,256,899,42,43,44,45,46,47,48,49,189', 601 '189,189,136,66,136,136,136,136,878,135,135,89,100,78,78,136,328,70,68', 602 '69,399,71,72,135,73,877,74,304,305,324,135,446,135,478,868,325,479,327', 603 '867,879,75,136,76,89,77,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24', 604 '25,26,27,28,29,30,31,32,33,34,35,38,450,48,49,314,838,42,43,44,45,46', 605 '47,48,49,135,135,839,135,66,304,305,306,135,307,308,310,311,691,838', 606 '78,136,136,70,68,69,313,71,72,275,73,880,74,78,180,136,816,304,305,324', 607 '78,881,136,136,136,325,75,327,76,690,77,5,6,7,10,13,14,15,16,17,18,19', 608 '20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,835,426,403,282,697', 609 '42,43,44,45,46,47,48,49,163,817,163,620,288,277,136,136,432,136,180', 610 '504,78,150,136,654,149,720,70,68,69,283,71,72,403,73,402,74,520,636', 611 '162,199,200,201,202,203,204,205,207,328,208,75,503,76,135,77,212,213', 612 '214,215,216,217,218,304,305,306,859,307,308,310,311,199,200,201,202', 613 '203,204,205,207,889,208,635,648,883,135,637,212,213,214,215,216,217', 614 '218,884,858,681,199,200,201,202,203,204,205,207,341,208,342,888,343', 615 '135,234,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207', 616 '682,208,885,668,235,135,661,212,213,214,215,216,217,218,88,789,790,691', 617 '256,400,87,136,150,890,89,149,199,200,201,202,203,204,205,207,667,208', 618 '891,660,163,135,776,212,213,214,215,216,217,218,794,255,401,136,199', 619 '200,201,202,203,204,205,207,892,208,719,415,850,135,162,212,213,214', 620 '215,216,217,218,887,898,136,902,886,582,721,903,581,833,199,200,201', 621 '202,203,204,205,207,720,208,414,851,904,135,136,212,213,214,215,216', 622 '217,218,199,200,201,202,203,204,205,207,832,208,722,698,826,135,906', 623 '212,213,214,215,216,217,218,163,163,88,478,136,907,479,582,87,908,581', 624 '607,89,163,3,163,88,910,827,699,699,81,87,352,353,234,89,797,170,770', 625 '136,199,200,201,202,203,204,205,207,796,208,547,587,564,135,235,212', 626 '213,214,215,216,217,218,90,199,200,201,202,203,204,205,207,136,208,394', 627 '395,396,135,91,212,213,214,215,216,217,218,199,200,201,202,203,204,205', 628 '207,136,208,394,395,396,135,92,212,213,214,215,216,217,218,199,200,201', 629 '202,203,204,205,207,163,208,350,351,96,135,124,212,213,214,215,216,217', 630 '218,594,336,125,199,200,201,202,203,204,205,207,126,208,130,510,132', 631 '135,136,212,213,214,215,216,217,218,134,199,200,201,202,203,204,205', 632 '207,140,208,352,353,142,135,136,212,213,214,215,216,217,218,199,200', 633 '201,202,203,204,205,207,143,208,404,336,144,135,136,212,213,214,215', 634 '216,217,218,199,200,201,202,203,204,205,207,147,208,358,359,155,135', 635 '136,212,213,214,215,216,217,218,350,351,156,199,200,201,202,203,204', 636 '205,207,159,208,350,351,160,135,136,212,213,214,215,216,217,218,164', 637 '199,200,201,202,203,204,205,207,165,208,358,359,166,135,136,212,213', 638 '214,215,216,217,218,199,200,201,202,203,204,205,207,167,208,630,437', 639 '168,135,136,212,213,214,215,216,217,218,352,353,234,747,518,171,631', 640 '287,288,436,438,439,440,441,136,347,629,172,347,173,348,349,235,348', 641 '349,199,200,201,202,203,204,205,207,174,208,352,353,175,135,136,212', 642 '213,214,215,216,217,218,176,199,200,201,202,203,204,205,207,180,208', 643 '184,772,185,135,136,212,213,214,215,216,217,218,199,200,201,202,203', 644 '204,205,207,454,208,145,146,186,135,136,212,213,214,215,216,217,218', 645 '347,187,234,517,518,348,349,456,457,458,455,199,200,201,202,203,204', 646 '205,207,454,208,188,235,189,135,191,212,213,214,215,216,217,218,354', 647 '355,356,357,787,788,136,456,457,458,455,354,355,356,357,199,200,201', 648 '202,203,204,205,207,437,208,382,383,384,135,136,212,213,214,215,216', 649 '217,218,377,378,379,380,381,385,436,438,439,440,441,304,305,306,136', 650 '307,308,310,311,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27', 651 '28,29,30,31,32,33,34,35,38,136,354,355,356,357,42,43,44,45,46,47,48', 652 '49,199,200,201,202,203,204,205,207,192,208,352,353,193,135,196,212,213', 653 '214,215,216,217,218,247,89,136,199,200,201,202,203,204,205,207,257,208', 654 '159,264,208,135,270,212,213,214,215,216,217,218,199,200,201,202,203', 655 '204,205,207,180,208,272,279,280,135,281,212,213,214,215,216,217,218', 656 '234,284,285,286,289,290,199,200,201,202,203,204,205,207,312,208,335', 657 '189,336,135,235,212,213,214,215,216,217,218,360,199,200,201,202,203', 658 '204,205,207,136,208,361,670,362,135,363,212,213,214,215,216,217,218', 659 '199,200,201,202,203,204,205,207,368,208,369,136,371,135,372,212,213', 660 '214,215,216,217,218,159,199,200,201,202,203,204,205,207,405,208,136', 661 '587,410,135,142,212,213,214,215,216,217,218,412,413,199,200,201,202', 662 '203,204,205,207,416,208,417,418,419,135,136,212,213,214,215,216,217', 663 '218,420,199,200,201,202,203,204,205,207,421,208,444,445,448,135,136', 664 '212,213,214,215,216,217,218,199,200,201,202,203,204,205,207,459,208', 665 '462,772,463,135,136,212,213,214,215,216,217,218,470,88,234,88,382,383', 666 '384,87,472,87,473,89,474,89,481,136,377,378,379,380,381,385,235,482', 667 '208,199,200,201,202,203,204,205,207,511,208,512,513,514,135,136,212', 668 '213,214,215,216,217,218,515,199,200,201,202,203,204,205,207,521,208', 669 '522,523,264,135,136,212,213,214,215,216,217,218,199,200,201,202,203', 670 '204,205,207,525,208,270,528,529,135,136,212,213,214,215,216,217,218', 671 '199,200,201,202,203,204,205,207,208,208,532,208,208,135,180,212,213', 672 '214,215,216,217,218,536,537,540,199,200,201,202,203,204,205,207,541', 673 '208,542,544,545,135,136,212,213,214,215,216,217,218,737,738,740,741', 674 '548,189,270,558,562,196,739,737,738,740,741,136,565,189,743,742,196', 675 '739,234,592,569,88,88,571,88,743,742,87,87,88,87,89,89,136,89,87,328', 676 '574,235,89,196,199,200,201,202,203,204,205,207,589,208,590,700,360,135', 677 '136,212,213,214,215,216,217,218,361,362,472,199,200,201,202,203,204', 678 '205,207,363,208,472,591,607,135,136,212,213,214,215,216,217,218,199', 679 '200,201,202,203,204,205,207,608,208,611,336,612,135,614,212,213,214', 680 '215,216,217,218,199,200,201,202,203,204,205,207,615,208,616,617,618', 681 '135,208,212,213,214,215,216,217,218,621,737,738,740,741,163,625,88,88', 682 '641,196,739,785,87,87,136,643,89,89,743,742,625,662,663,669,674,199', 683 '200,201,202,203,204,205,207,675,208,676,680,683,135,136,212,213,214', 684 '215,216,217,218,199,200,201,202,203,204,205,207,685,208,686,687,688', 685 '135,136,212,213,214,215,216,217,218,472,104,105,106,107,108,109,110', 686 '111,112,113,114,689,189,136,692,208,695,704,5,6,7,10,13,14,15,16,17', 687 '18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,163,706,707', 688 '708,163,42,43,44,45,46,47,48,49,710,712,136,117,118,119,120,121,122', 689 '123,199,200,201,202,203,204,205,207,713,208,714,715,718,135,136,212', 690 '213,214,215,216,217,218,199,200,201,202,203,204,205,207,723,208,726', 691 '571,75,135,729,212,213,214,215,216,217,218,199,200,201,202,203,204,205', 692 '207,730,208,196,744,745,135,748,212,213,214,215,216,217,218,199,200', 693 '201,202,203,204,205,207,749,208,752,753,754,135,756,212,213,214,215', 694 '216,217,218,625,759,760,764,199,200,201,202,203,204,205,207,767,208', 695 '771,779,780,135,136,212,213,214,215,216,217,218,199,200,201,202,203', 696 '204,205,207,782,208,783,791,793,135,136,212,213,214,215,216,217,218', 697 '199,200,201,202,203,204,205,207,189,208,795,798,799,135,136,212,213', 698 '214,215,216,217,218,199,200,201,202,203,204,205,207,800,208,803,804', 699 '805,135,136,212,213,214,215,216,217,218,806,654,718,180,199,200,201', 700 '202,203,204,205,207,811,208,812,813,814,135,136,212,213,214,215,216', 701 '217,218,199,200,201,202,203,204,205,207,726,208,823,828,831,135,136', 702 '212,213,214,215,216,217,218,199,200,201,202,203,204,205,207,836,208', 703 '840,841,-386,135,136,212,213,214,215,216,217,218,199,200,201,202,203', 704 '204,205,207,842,208,843,237,844,135,136,212,213,214,215,216,217,218', 705 '848,803,208,854,199,200,201,202,203,204,205,207,857,208,862,863,865', 649 706 '135,136,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207', 650 '444,208,421,772,641,135,136,212,213,214,215,216,217,218,88,88,234,382', 651 '383,384,87,87,420,643,89,89,419,418,136,377,378,379,380,381,385,417', 652 '235,416,625,199,200,201,202,203,204,205,207,413,208,412,662,663,135', 653 '136,212,213,214,215,216,217,218,142,199,200,201,202,203,204,205,207', 654 '410,208,405,159,669,135,136,212,213,214,215,216,217,218,199,200,201', 655 '202,203,204,205,207,372,208,371,369,674,135,136,212,213,214,215,216', 656 '217,218,199,200,201,202,203,204,205,207,368,208,675,237,676,135,363', 657 '212,213,214,215,216,217,218,304,305,306,234,307,308,310,311,362,199', 658 '200,201,202,203,204,205,207,136,208,361,680,360,135,235,212,213,214', 659 '215,216,217,218,683,199,200,201,202,203,204,205,207,136,208,336,685', 660 '686,135,687,212,213,214,215,216,217,218,199,200,201,202,203,204,205', 661 '207,136,208,688,689,189,135,692,212,213,214,215,216,217,218,199,200', 662 '201,202,203,204,205,207,136,208,335,208,695,135,312,212,213,214,215', 663 '216,217,218,290,289,286,199,200,201,202,203,204,205,207,285,208,704', 664 '163,706,135,136,212,213,214,215,216,217,218,737,738,740,741,707,708', 665 '88,88,163,196,739,710,87,87,284,136,89,89,743,742,712,713,714,199,200', 666 '201,202,203,204,205,207,715,208,718,281,280,135,136,212,213,214,215', 667 '216,217,218,199,200,201,202,203,204,205,207,723,208,726,571,75,135,136', 668 '212,213,214,215,216,217,218,729,730,472,20,21,22,23,24,25,26,27,28,29', 669 '30,31,32,33,136,196,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25', 670 '26,27,28,29,30,31,32,33,34,35,38,279,744,745,272,3,42,43,44,45,46,47', 671 '48,49,748,749,136,117,118,119,120,121,122,123,199,200,201,202,203,204', 672 '205,207,750,208,610,752,753,135,136,212,213,214,215,216,217,218,199', 673 '200,201,202,203,204,205,207,754,208,180,756,625,135,759,212,213,214', 674 '215,216,217,218,199,200,201,202,203,204,205,207,760,208,270,208,264', 675 '135,764,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207', 676 '159,208,257,767,89,135,247,212,213,214,215,216,217,218,771,196,193,192', 677 '199,200,201,202,203,204,205,207,779,208,780,191,782,135,136,212,213', 678 '214,215,216,217,218,199,200,201,202,203,204,205,207,783,208,189,81,910', 679 '135,136,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207', 680 '791,208,188,793,187,135,136,212,213,214,215,216,217,218,199,200,201', 681 '202,203,204,205,207,795,208,186,670,798,135,136,212,213,214,215,216', 682 '217,218,799,800,803,804,199,200,201,202,203,204,205,207,805,208,806', 683 '654,718,135,136,212,213,214,215,216,217,218,737,738,740,741,180,88,88', 684 '88,811,196,739,87,87,87,136,89,89,89,743,742,812,813,199,200,201,202', 685 '203,204,205,207,814,208,185,184,726,135,136,212,213,214,215,216,217', 686 '218,199,200,201,202,203,204,205,207,823,208,180,176,175,135,136,212', 687 '213,214,215,216,217,218,382,383,384,472,117,118,119,120,121,122,123', 688 '828,377,378,379,380,381,385,136,5,6,7,10,13,14,15,16,17,18,19,20,21', 689 '22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,174,173,831,172,171,42', 690 '43,44,45,46,47,48,49,168,836,136,167,166,840,841,-386,842,843,199,200', 691 '201,202,203,204,205,207,844,208,165,164,160,135,136,212,213,214,215', 692 '216,217,218,199,200,201,202,203,204,205,345,848,208,803,159,156,135', 693 '208,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207,854', 694 '208,155,147,857,135,144,212,213,214,215,216,217,218,199,200,201,202', 695 '203,204,205,207,143,208,862,863,142,135,865,212,213,214,215,216,217', 696 '218,140,869,870,871,199,200,201,202,203,204,205,207,134,208,132,874', 697 '875,135,136,212,213,214,215,216,217,218,199,200,201,202,203,204,205', 698 '207,130,208,877,126,838,135,136,212,213,214,215,216,217,218,199,200', 699 '201,202,203,204,205,207,880,208,881,587,328,135,136,212,213,214,215', 700 '216,217,218,199,200,201,202,203,204,205,207,883,208,884,885,125,135', 701 '136,212,213,214,215,216,217,218,124,890,891,234,104,105,106,107,108', 702 '109,110,111,112,113,114,88,892,96,136,92,544,87,545,235,542,89,199,200', 703 '201,202,203,204,205,207,548,208,189,270,541,135,136,212,213,214,215', 704 '216,217,218,199,200,201,202,203,204,205,207,540,208,558,537,536,135', 705 '136,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207,,208', 706 ',,,135,136,212,213,214,215,216,217,218,199,200,201,202,203,204,205,207', 707 ',208,,,,135,,212,213,214,215,216,217,218,,,,,199,200,201,202,203,204', 708 '205,207,,208,,772,,135,136,212,213,214,215,216,217,218,199,200,201,202', 709 '203,204,205,207,,208,,,,135,136,212,213,214,215,216,217,218,199,200', 710 '201,202,203,204,205,207,,208,,,,135,136,212,213,214,215,216,217,218', 711 '199,200,201,202,203,204,205,207,,208,,,,135,136,212,213,214,215,216', 712 '217,218,,,,,199,200,201,202,203,204,205,207,,208,,,,135,136,212,213', 713 '214,215,216,217,218,199,200,201,202,203,204,205,207,,208,,,,135,136', 714 '212,213,214,215,216,217,218,737,738,740,741,,88,,,,196,739,87,,,136', 715 '89,,,743,742,,,,,,,,,,,,,,,,,136,104,105,106,107,108,109,110,111,112', 716 '113,114,,,,478,585,,584,,,,,,,89,136,,,,,,,472,,,,,,117,118,119,120', 717 '121,122,123,,,136,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26', 718 '27,28,29,30,31,32,33,34,35,38,241,,78,,,42,43,44,45,46,47,48,49,,,,', 719 ',,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27', 720 '28,29,30,31,32,33,34,35,38,672,,78,,,42,43,44,45,46,47,48,49,,,,,,,', 721 ',,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28', 707 ',208,,,,135,136,212,213,214,215,216,217,218,199,200,201,202,203,204', 708 '205,207,,208,,,,135,136,212,213,214,215,216,217,218,199,200,201,202', 709 '203,204,205,207,,208,,,,135,136,212,213,214,215,216,217,218,88,,,,,', 710 '87,,,88,89,737,738,740,741,87,,,136,89,196,739,,,,234,,,,743,742,117', 711 '118,119,120,121,122,123,,,136,,,,,235,,,199,200,201,202,203,204,205', 712 '207,,208,,,,135,136,212,213,214,215,216,217,218,199,200,201,202,203', 713 '204,205,207,,208,472,,,135,136,212,213,214,215,216,217,218,199,200,201', 714 '202,203,204,205,345,,208,,,,135,,212,213,214,215,216,217,218,199,200', 715 '201,202,203,204,205,207,,208,,,,135,,212,213,214,215,216,217,218,,,', 716 '104,105,106,107,108,109,110,111,112,113,114,,,,,136,,,,,,,104,105,106', 717 '107,108,109,110,111,112,113,114,,,,,136,117,118,119,120,121,122,123', 718 ',,,478,585,,584,,,,,,,89,136,117,118,119,120,121,122,123,20,21,22,23', 719 '24,25,26,27,28,29,30,31,32,33,136,5,6,7,10,13,14,15,16,17,18,19,20,21', 720 '22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,672,,78,,,42,43,44,45,46', 721 '47,48,49,,,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22', 722 '23,24,25,26,27,28,29,30,31,32,33,34,35,38,241,,78,,,42,43,44,45,46,47', 723 '48,49,,,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23', 724 '24,25,26,27,28,29,30,31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49', 725 ',,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26', 726 '27,28,29,30,31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,506,,,', 727 ',,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27', 728 '28,29,30,31,32,33,34,35,38,78,428,,,,42,43,44,45,46,47,48,49,,,,,,,', 729 ',,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28', 722 730 '29,30,31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,', 723 731 ',,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30', 724 '31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,506,,,,,,,,,,,,,,,', 725 ',,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31', 726 '32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6', 727 '7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33', 728 '34,35,38,78,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13', 729 '14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38', 730 '78,428,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15', 731 '16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,78,,', 732 ',,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17', 733 '18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,78,387,,,,42', 732 '31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5', 733 '6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33', 734 '34,35,38,78,632,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10', 735 '13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35', 736 '38,78,638,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14', 737 '15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,128', 738 '658,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16', 739 '17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,78,,,,,42', 734 740 '43,44,45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19', 735 '20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,78, ,,,,42,43,44,45',736 '4 6,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22',737 '2 3,24,25,26,27,28,29,30,31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48',738 '4 9,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25',739 '2 6,27,28,29,30,31,32,33,34,35,38,128,516,,,,42,43,44,45,46,47,48,49',741 '20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,78,516,,,,42,43,44', 742 '45,46,47,48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21', 743 '22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,78,,,,,42,43,44,45,46,47', 744 '48,49,,,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24', 745 '25,26,27,28,29,30,31,32,33,34,35,38,78,387,,,,42,43,44,45,46,47,48,49', 740 746 ',,,,,,,,,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26', 741 747 '27,28,29,30,31,32,33,34,35,38,78,,,,,42,43,44,45,46,47,48,49,,,,,,,', 742 748 ',,,,,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28', 743 '29,30,31,32,33,34,35,38,78,632,,,,42,43,44,45,46,47,48,49,,,,,,,,,,',744 ',,,,,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29',745 '30,31,32,33,34,35,38,78,638,,,,42,43,44,45,46,47,48,49,,,,,,,,,,,,,',746 ',,,,,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30',747 '31,32,33,34,35,38,,658,,,,42,43,44,45,46,47,48,49,104,105,106,107,108',748 '109,110,111,112,113,114,,,,,,,,,,,,,,,,,,,,,,,,,,,,117,118,119,120,121',749 '122,123,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29',750 '30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6,7,10,13,14,15',751 '16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,',752 '42,43,44,45,46,47,48,49,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24',753 '25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6',754 '7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33',755 '34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6,7,10,13,14,15,16,17,18,19',756 '20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45',757 '46,47,48,49,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28',758 749 '29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6,7,10,13,14', 759 750 '15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,,', 760 751 ',,,42,43,44,45,46,47,48,49,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23', 761 '24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47' ] 762 racc_action_table = arr = ::Array.new(3623, nil) 752 '24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48,49', 753 '5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32', 754 '33,34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6,7,10,13,14,15,16,17,18', 755 '19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44', 756 '45,46,47,48,49,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27', 757 '28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48,49,5,6,7,10,13', 758 '14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,38', 759 ',,,,,42,43,44,45,46,47,48,49,5,6,7,10,13,14,15,16,17,18,19,20,21,22', 760 '23,24,25,26,27,28,29,30,31,32,33,34,35,38,,,,,,42,43,44,45,46,47,48', 761 '49,5,6,7,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31', 762 '32,33,34,35,38,,,,,,42,43,44,45,46,47' ] 763 racc_action_table = arr = ::Array.new(3593, nil) 763 764 idx = 0 764 765 clist.each do |str| … … 770 771 771 772 clist = [ 772 '2,469,843,576,422,856,192,194,450,192,329,2,613,434,630,630,630,630', 773 '630,630,630,630,824,630,596,630,893,630,560,630,630,630,630,630,630', 774 '630,597,154,703,642,454,434,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2', 775 '2,2,2,2,2,2,2,2,329,422,613,194,194,2,2,2,2,2,2,2,2,893,414,560,157', 776 '447,125,777,573,721,460,558,631,303,470,576,291,856,469,2,2,2,839,2', 777 '2,563,2,291,2,192,192,192,843,895,824,157,573,192,630,192,596,329,2', 778 '613,2,329,2,613,782,85,703,642,597,154,2,85,41,2,291,291,291,291,291', 773 '2,469,843,447,422,777,192,194,852,192,329,2,613,269,515,515,515,515', 774 '515,515,515,515,824,515,596,325,893,515,560,515,515,515,515,515,515', 775 '515,154,597,125,856,853,269,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2', 776 '2,2,2,2,2,2,2,2,329,422,613,194,194,2,2,2,2,2,2,2,2,893,85,560,267,576', 777 '703,642,85,721,855,631,558,528,511,447,161,777,469,2,2,2,92,2,2,563', 778 '2,161,2,192,192,192,843,895,824,267,325,192,515,192,596,329,2,613,2', 779 '329,2,613,75,860,125,856,154,597,2,861,41,2,161,161,161,161,161,161', 780 '161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161', 781 '161,161,161,161,161,187,230,230,258,895,161,161,161,161,161,161,161', 782 '161,576,703,642,721,185,631,558,528,511,866,691,303,89,41,315,185,92', 783 '315,161,161,161,258,161,161,333,161,863,161,563,563,563,286,308,782', 784 '340,851,563,340,563,851,866,161,75,161,340,161,185,185,185,185,185,185', 785 '185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185', 786 '185,185,185,185,185,315,89,89,190,869,185,185,185,185,185,185,185,185', 787 '839,470,812,692,291,187,187,187,512,187,187,187,187,609,812,291,691', 788 '303,185,185,185,190,185,185,171,185,872,185,778,171,333,778,315,315', 789 '315,294,873,286,308,782,315,185,315,185,609,185,291,291,291,291,291', 779 790 '291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,291,291', 780 '291,291,291,291,291,291,187,291,461,577,895,291,291,291,291,291,291', 781 '291,291,447,125,777,721,185,558,631,303,470,258,286,308,89,41,315,185', 782 '839,315,291,291,291,577,291,291,92,291,462,291,563,563,563,512,75,325', 783 '340,851,563,340,563,851,258,291,782,291,340,291,185,185,185,185,185', 784 '185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185', 785 '185,185,185,185,185,185,315,89,89,262,812,185,185,185,185,185,185,185', 786 '185,511,333,463,812,161,187,187,187,756,187,187,187,187,267,413,161', 787 '286,308,185,185,185,262,185,185,756,185,148,185,561,148,92,561,315,315', 788 '315,294,756,512,75,325,315,185,315,185,267,185,161,161,161,161,161,161', 789 '161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161', 790 '161,161,161,161,161,808,392,264,568,264,161,161,161,161,161,161,161', 791 '161,375,561,784,625,127,625,511,333,294,778,127,599,778,465,127,412', 792 '392,808,161,161,161,568,161,161,411,161,472,161,375,553,784,720,720', 793 '720,720,720,720,720,720,410,720,161,599,161,720,161,720,720,720,720', 794 '720,720,720,294,294,294,880,294,294,294,294,257,257,257,257,257,257', 795 '257,257,778,257,553,684,684,257,553,257,257,257,257,257,257,257,409', 796 '880,278,474,474,474,474,474,474,474,474,210,474,210,408,210,474,720', 797 '474,474,474,474,474,474,474,403,403,403,403,403,403,403,403,278,403', 798 '407,866,720,403,653,403,403,403,403,403,403,403,402,172,480,366,609', 799 '190,172,720,580,483,653,580,479,479,479,479,479,479,479,479,866,479', 800 '653,479,716,479,720,479,479,479,479,479,479,479,366,609,190,257,889', 801 '889,889,889,889,889,889,889,401,889,396,626,176,889,716,889,889,889', 802 '889,889,889,889,488,477,474,171,477,488,488,894,171,834,504,504,504', 803 '504,504,504,504,504,102,504,626,176,9,504,403,504,504,504,504,504,504', 804 '504,862,862,862,862,862,862,862,862,834,862,657,801,751,862,102,862', 805 '862,862,862,862,862,862,549,115,253,879,479,897,476,879,253,476,221', 806 '841,253,452,269,221,221,88,549,657,801,751,898,88,901,504,504,88,549', 807 '115,889,859,859,859,859,859,859,859,859,841,859,452,269,8,859,504,859', 808 '859,859,859,859,859,859,395,513,513,513,513,513,513,513,513,504,513', 809 '394,86,904,513,86,513,513,513,513,513,513,513,848,848,848,848,848,848', 810 '848,848,862,848,254,254,254,848,498,848,848,848,848,848,848,848,359', 811 '359,359,359,359,359,359,359,499,359,520,520,520,359,500,359,359,359', 812 '359,359,359,359,82,82,501,358,358,358,358,358,358,358,358,547,358,181', 813 '181,564,358,859,358,358,358,358,358,358,358,848,496,496,496,496,502', 814 '547,547,547,547,547,564,564,564,564,513,487,222,222,384,848,487,487', 815 '806,806,806,806,806,806,806,806,905,806,223,223,383,806,848,806,806', 816 '806,806,806,806,806,357,357,357,357,357,357,357,357,382,357,225,225', 817 '381,357,359,357,357,357,357,357,357,357,230,230,380,797,797,797,797', 818 '797,797,797,797,368,797,265,265,343,797,358,797,797,797,797,797,797', 819 '797,796,796,796,796,796,796,796,796,342,796,389,389,338,796,337,796', 820 '796,796,796,796,796,796,335,356,356,356,356,356,356,356,356,334,356', 821 '489,489,327,356,806,356,356,356,356,356,356,356,490,490,797,495,495', 822 '495,495,525,318,739,739,739,739,297,357,696,491,491,739,739,739,696', 823 '797,526,796,696,528,739,739,318,318,318,318,297,297,297,297,297,529', 824 '797,224,224,224,224,796,492,492,355,355,355,355,355,355,355,355,530', 825 '355,493,493,531,355,796,355,355,355,355,355,355,355,533,354,354,354', 826 '354,354,354,354,354,739,354,494,494,534,354,356,354,354,354,354,354', 827 '354,354,353,353,353,353,353,353,353,353,535,353,497,497,536,353,537', 828 '353,353,353,353,353,353,353,352,352,352,352,352,352,352,352,538,352', 829 '505,505,906,352,543,352,352,352,352,352,352,352,539,539,544,748,748', 830 '748,748,748,748,748,748,326,748,742,742,324,748,355,748,748,748,748', 831 '748,748,748,548,729,729,729,729,729,729,729,729,309,729,743,743,307', 832 '729,354,729,729,729,729,729,729,729,719,719,719,719,719,719,719,719', 833 '306,719,285,719,557,719,353,719,719,719,719,719,719,719,430,602,748', 834 '246,246,246,430,602,284,559,430,602,283,282,352,246,246,246,246,246', 835 '246,281,748,280,565,351,351,351,351,351,351,351,351,276,351,274,570', 836 '572,351,748,351,351,351,351,351,351,351,272,147,147,147,147,147,147', 837 '147,147,271,147,266,256,578,147,729,147,147,147,147,147,147,147,350', 838 '350,350,350,350,350,350,350,242,350,240,236,583,350,719,350,350,350', 839 '350,350,350,350,149,149,149,149,149,149,149,149,235,149,586,149,588', 840 '149,229,149,149,149,149,149,149,149,546,546,546,147,546,546,546,546', 841 '228,349,349,349,349,349,349,349,349,351,349,227,598,226,349,147,349', 842 '349,349,349,349,349,349,600,714,714,714,714,714,714,714,714,147,714', 843 '206,604,605,714,606,714,714,714,714,714,714,714,348,348,348,348,348', 844 '348,348,348,350,348,607,608,198,348,611,348,348,348,348,348,348,348', 845 '710,710,710,710,710,710,710,710,149,710,195,616,619,710,189,710,710', 846 '710,710,710,710,710,184,183,179,347,347,347,347,347,347,347,347,178', 847 '347,632,634,636,347,349,347,347,347,347,347,347,347,827,827,827,827', 848 '637,638,373,288,640,827,827,641,373,288,177,714,373,288,827,827,643', 849 '644,646,706,706,706,706,706,706,706,706,648,706,651,175,174,706,348', 850 '706,706,706,706,706,706,706,345,345,345,345,345,345,345,345,658,345', 851 '662,663,664,345,710,345,345,345,345,345,345,345,665,666,827,36,36,36', 852 '36,36,36,36,36,36,36,36,36,36,36,347,668,345,345,345,345,345,345,345', 853 '345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345', 854 '345,345,345,345,173,671,673,169,1,345,345,345,345,345,345,345,345,688', 855 '689,706,260,260,260,260,260,260,260,515,515,515,515,515,515,515,515', 856 '691,515,692,693,694,515,345,515,515,515,515,515,515,515,166,166,166', 857 '166,166,166,166,166,695,166,168,697,699,166,700,166,166,166,166,166', 858 '166,166,341,341,341,341,341,341,341,341,701,341,167,165,164,341,707', 859 '341,341,341,341,341,341,341,682,682,682,682,682,682,682,682,160,682', 860 '159,711,152,682,151,682,682,682,682,682,682,682,718,144,141,139,521', 861 '521,521,521,521,521,521,521,725,521,727,138,730,521,515,521,521,521', 862 '521,521,521,521,522,522,522,522,522,522,522,522,731,522,137,3,909,522', 863 '166,522,522,522,522,522,522,522,523,523,523,523,523,523,523,523,746', 864 '523,136,749,133,523,341,523,523,523,523,523,523,523,581,581,581,581', 865 '581,581,581,581,755,581,131,581,760,581,682,581,581,581,581,581,581', 866 '581,761,763,764,766,908,908,908,908,908,908,908,908,767,908,768,769', 867 '770,908,521,908,908,908,908,908,908,908,783,783,783,783,771,146,518', 868 '245,772,783,783,146,518,245,522,146,518,245,783,783,773,775,290,290', 869 '290,290,290,290,290,290,776,290,129,128,780,290,523,290,290,290,290', 870 '290,290,290,207,207,207,207,207,207,207,207,781,207,126,124,123,207', 871 '581,207,207,207,207,207,207,207,510,510,510,783,170,170,170,170,170', 872 '170,170,793,510,510,510,510,510,510,908,207,207,207,207,207,207,207', 791 '291,291,291,291,291,291,808,291,625,176,625,291,291,291,291,291,291', 792 '291,291,392,778,573,539,539,172,839,470,294,692,172,366,561,86,512,561', 793 '86,808,291,291,291,176,291,291,264,291,264,291,392,553,573,720,720,720', 794 '720,720,720,720,720,874,720,291,366,291,720,291,720,720,720,720,720', 795 '720,720,294,294,294,841,294,294,294,294,902,902,902,902,902,902,902', 796 '902,880,902,553,561,876,902,553,902,902,902,902,902,902,902,877,841', 797 '599,889,889,889,889,889,889,889,889,210,889,210,880,210,889,720,889', 798 '889,889,889,889,889,889,521,521,521,521,521,521,521,521,599,521,878', 799 '577,720,521,568,521,521,521,521,521,521,521,430,743,743,751,157,262', 800 '430,720,148,881,430,148,522,522,522,522,522,522,522,522,577,522,882', 801 '568,102,522,720,522,522,522,522,522,522,522,751,157,262,902,523,523', 802 '523,523,523,523,523,523,883,523,653,278,834,523,102,523,523,523,523', 803 '523,523,523,879,894,889,897,879,580,653,898,580,801,234,234,234,234', 804 '234,234,234,234,653,234,278,834,901,234,521,234,234,234,234,234,234', 805 '234,166,166,166,166,166,166,166,166,801,166,657,626,784,166,904,166', 806 '166,166,166,166,166,166,115,716,518,476,522,905,476,477,518,906,477', 807 '756,518,434,1,452,127,909,784,657,626,3,127,494,494,234,127,756,115', 808 '716,523,479,479,479,479,479,479,479,479,756,479,434,479,452,479,234', 809 '479,479,479,479,479,479,479,8,358,358,358,358,358,358,358,358,234,358', 810 '520,520,520,358,9,358,358,358,358,358,358,358,363,363,363,363,363,363', 811 '363,363,166,363,254,254,254,363,16,363,363,363,363,363,363,363,360,360', 812 '360,360,360,360,360,360,375,360,222,222,38,360,68,360,360,360,360,360', 813 '360,360,505,505,69,361,361,361,361,361,361,361,361,70,361,72,375,73', 814 '361,479,361,361,361,361,361,361,361,74,682,682,682,682,682,682,682,682', 815 '76,682,223,223,77,682,358,682,682,682,682,682,682,682,862,862,862,862', 816 '862,862,862,862,79,862,265,265,80,862,363,862,862,862,862,862,862,862', 817 '362,362,362,362,362,362,362,362,84,362,225,225,94,362,360,362,362,362', 818 '362,362,362,362,489,489,95,797,797,797,797,797,797,797,797,100,797,490', 819 '490,101,797,361,797,797,797,797,797,797,797,104,811,811,811,811,811', 820 '811,811,811,106,811,497,497,108,811,682,811,811,811,811,811,811,811', 821 '838,838,838,838,838,838,838,838,110,838,549,297,114,838,862,838,838', 822 '838,838,838,838,838,491,491,797,684,684,117,549,181,181,297,297,297', 823 '297,297,362,487,549,118,221,119,487,487,797,221,221,796,796,796,796', 824 '796,796,796,796,122,796,492,492,123,796,797,796,796,796,796,796,796', 825 '796,124,835,835,835,835,835,835,835,835,126,835,128,835,129,835,811', 826 '835,835,835,835,835,835,835,514,514,514,514,514,514,514,514,318,514', 827 '82,82,131,514,838,514,514,514,514,514,514,514,488,133,796,389,389,488', 828 '488,318,318,318,318,823,823,823,823,823,823,823,823,564,823,136,796', 829 '137,823,138,823,823,823,823,823,823,823,495,495,495,495,742,742,796', 830 '564,564,564,564,224,224,224,224,207,207,207,207,207,207,207,207,547', 831 '207,510,510,510,207,835,207,207,207,207,207,207,207,510,510,510,510', 832 '510,510,547,547,547,547,547,546,546,546,514,546,546,546,546,207,207', 873 833 '207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207', 874 '207,207,207,207,122,119,799,118,117,207,207,207,207,207,207,207,207', 875 '114,810,290,110,108,814,815,816,817,821,211,211,211,211,211,211,211', 876 '211,822,211,106,104,101,211,207,211,211,211,211,211,211,211,212,212', 877 '212,212,212,212,212,212,828,212,833,100,95,212,836,212,212,212,212,212', 878 '212,212,902,902,902,902,902,902,902,902,837,902,94,84,840,902,80,902', 879 '902,902,902,902,902,902,591,591,591,591,591,591,591,591,79,591,845,846', 880 '77,591,850,591,591,591,591,591,591,591,76,852,853,855,575,575,575,575', 881 '575,575,575,575,74,575,73,860,861,575,211,575,575,575,575,575,575,575', 882 '234,234,234,234,234,234,234,234,72,234,863,70,869,234,212,234,234,234', 883 '234,234,234,234,584,584,584,584,584,584,584,584,872,584,873,584,874', 884 '584,902,584,584,584,584,584,584,584,514,514,514,514,514,514,514,514', 885 '876,514,877,878,69,514,591,514,514,514,514,514,514,514,68,881,882,234', 886 '162,162,162,162,162,162,162,162,162,162,162,4,883,38,575,16,431,4,432', 887 '234,428,4,365,365,365,365,365,365,365,365,437,365,442,443,426,365,234', 888 '365,365,365,365,365,365,365,364,364,364,364,364,364,364,364,425,364', 889 '446,419,416,364,584,364,364,364,364,364,364,364,363,363,363,363,363', 890 '363,363,363,,363,,,,363,514,363,363,363,363,363,363,363,838,838,838', 891 '838,838,838,838,838,,838,,,,838,,838,838,838,838,838,838,838,,,,,835', 892 '835,835,835,835,835,835,835,,835,,835,,835,365,835,835,835,835,835,835', 893 '835,362,362,362,362,362,362,362,362,,362,,,,362,364,362,362,362,362', 894 '362,362,362,361,361,361,361,361,361,361,361,,361,,,,361,363,361,361', 895 '361,361,361,361,361,823,823,823,823,823,823,823,823,,823,,,,823,838', 896 '823,823,823,823,823,823,823,,,,,360,360,360,360,360,360,360,360,,360', 897 ',,,360,835,360,360,360,360,360,360,360,811,811,811,811,811,811,811,811', 898 ',811,,,,811,362,811,811,811,811,811,811,811,669,669,669,669,,424,,,', 899 '669,669,424,,,361,424,,,669,669,,,,,,,,,,,,,,,,,823,54,54,54,54,54,54', 900 '54,54,54,54,54,,,,478,478,,478,,,,,,,478,360,,,,,,,669,,,,,,54,54,54', 901 '54,54,54,54,,,811,478,478,478,478,478,478,478,478,478,478,478,478,478', 902 '478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,150,,150', 903 ',,478,478,478,478,478,478,478,478,,,,,,,,,,,,,,,,,,,,,150,150,150,150', 834 '207,207,207,207,207,207,207,207,207,823,496,496,496,496,207,207,207', 835 '207,207,207,207,207,748,748,748,748,748,748,748,748,139,748,493,493', 836 '141,748,144,748,748,748,748,748,748,748,151,152,207,859,859,859,859', 837 '859,859,859,859,159,859,160,164,165,859,167,859,859,859,859,859,859', 838 '859,575,575,575,575,575,575,575,575,168,575,169,173,174,575,175,575', 839 '575,575,575,575,575,575,748,177,178,179,183,184,257,257,257,257,257', 840 '257,257,257,189,257,195,198,206,257,748,257,257,257,257,257,257,257', 841 '226,581,581,581,581,581,581,581,581,748,581,227,581,228,581,229,581', 842 '581,581,581,581,581,581,729,729,729,729,729,729,729,729,235,729,236', 843 '859,240,729,242,729,729,729,729,729,729,729,256,584,584,584,584,584', 844 '584,584,584,266,584,575,584,271,584,272,584,584,584,584,584,584,584', 845 '274,276,147,147,147,147,147,147,147,147,280,147,281,282,283,147,257', 846 '147,147,147,147,147,147,147,284,591,591,591,591,591,591,591,591,285', 847 '591,306,307,309,591,581,591,591,591,591,591,591,591,719,719,719,719', 848 '719,719,719,719,324,719,326,719,327,719,729,719,719,719,719,719,719', 849 '719,334,288,147,602,246,246,246,288,335,602,337,288,338,602,342,584', 850 '246,246,246,246,246,246,147,343,368,714,714,714,714,714,714,714,714', 851 '380,714,381,382,383,714,147,714,714,714,714,714,714,714,384,710,710', 852 '710,710,710,710,710,710,394,710,395,396,401,710,591,710,710,710,710', 853 '710,710,710,706,706,706,706,706,706,706,706,402,706,407,408,409,706', 854 '719,706,706,706,706,706,706,706,504,504,504,504,504,504,504,504,410', 855 '504,411,412,413,504,414,504,504,504,504,504,504,504,416,419,425,365', 856 '365,365,365,365,365,365,365,426,365,428,431,432,365,714,365,365,365', 857 '365,365,365,365,827,827,827,827,437,442,443,446,450,827,827,783,783', 858 '783,783,710,454,460,827,827,783,783,504,504,461,4,696,462,373,783,783', 859 '4,696,146,373,4,696,706,373,146,463,465,504,146,472,630,630,630,630', 860 '630,630,630,630,480,630,483,630,498,630,504,630,630,630,630,630,630', 861 '630,499,500,827,364,364,364,364,364,364,364,364,501,364,783,502,525', 862 '364,365,364,364,364,364,364,364,364,908,908,908,908,908,908,908,908', 863 '526,908,529,530,531,908,533,908,908,908,908,908,908,908,341,341,341', 864 '341,341,341,341,341,534,341,535,536,537,341,538,341,341,341,341,341', 865 '341,341,543,739,739,739,739,544,548,88,424,557,739,739,739,88,424,630', 866 '559,88,424,739,739,565,570,572,578,583,347,347,347,347,347,347,347,347', 867 '586,347,588,598,600,347,364,347,347,347,347,347,347,347,345,345,345', 868 '345,345,345,345,345,604,345,605,606,607,345,908,345,345,345,345,345', 869 '345,345,739,162,162,162,162,162,162,162,162,162,162,162,608,610,341', 870 '611,616,619,632,345,345,345,345,345,345,345,345,345,345,345,345,345', 871 '345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,634,636', 872 '637,638,640,345,345,345,345,345,345,345,345,641,643,347,260,260,260', 873 '260,260,260,260,348,348,348,348,348,348,348,348,644,348,646,648,651', 874 '348,345,348,348,348,348,348,348,348,349,349,349,349,349,349,349,349', 875 '658,349,662,663,664,349,665,349,349,349,349,349,349,349,350,350,350', 876 '350,350,350,350,350,666,350,668,671,673,350,688,350,350,350,350,350', 877 '350,350,351,351,351,351,351,351,351,351,689,351,693,694,695,351,697', 878 '351,351,351,351,351,351,351,699,700,701,707,352,352,352,352,352,352', 879 '352,352,711,352,718,725,727,352,348,352,352,352,352,352,352,352,353', 880 '353,353,353,353,353,353,353,730,353,731,746,749,353,349,353,353,353', 881 '353,353,353,353,354,354,354,354,354,354,354,354,750,354,755,760,761', 882 '354,350,354,354,354,354,354,354,354,355,355,355,355,355,355,355,355', 883 '763,355,764,766,767,355,351,355,355,355,355,355,355,355,768,769,770', 884 '771,356,356,356,356,356,356,356,356,772,356,773,775,776,356,352,356', 885 '356,356,356,356,356,356,357,357,357,357,357,357,357,357,780,357,781', 886 '793,799,357,353,357,357,357,357,357,357,357,359,359,359,359,359,359', 887 '359,359,810,359,814,815,816,359,354,359,359,359,359,359,359,359,149', 888 '149,149,149,149,149,149,149,817,149,821,149,822,149,355,149,149,149', 889 '149,149,149,149,828,833,836,837,474,474,474,474,474,474,474,474,840', 890 '474,845,846,850,474,356,474,474,474,474,474,474,474,290,290,290,290', 891 '290,290,290,290,,290,,,,290,357,290,290,290,290,290,290,290,848,848', 892 '848,848,848,848,848,848,,848,,,,848,359,848,848,848,848,848,848,848', 893 '806,806,806,806,806,806,806,806,,806,,,,806,149,806,806,806,806,806', 894 '806,806,245,,,,,,245,,,253,245,669,669,669,669,253,,,474,253,669,669', 895 ',,,848,,,,669,669,170,170,170,170,170,170,170,,,290,,,,,848,,,403,403', 896 '403,403,403,403,403,403,,403,,,,403,848,403,403,403,403,403,403,403', 897 '513,513,513,513,513,513,513,513,,513,669,,,513,806,513,513,513,513,513', 898 '513,513,212,212,212,212,212,212,212,212,,212,,,,212,,212,212,212,212', 899 '212,212,212,211,211,211,211,211,211,211,211,,211,,,,211,,211,211,211', 900 '211,211,211,211,,,,464,464,464,464,464,464,464,464,464,464,464,,,,,403', 901 ',,,,,,54,54,54,54,54,54,54,54,54,54,54,,,,,513,464,464,464,464,464,464', 902 '464,,,,478,478,,478,,,,,,,478,212,54,54,54,54,54,54,54,36,36,36,36,36', 903 '36,36,36,36,36,36,36,36,36,211,478,478,478,478,478,478,478,478,478,478', 904 '478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478', 905 '478,582,,582,,,478,478,478,478,478,478,478,478,,,,,,,,,,,,,,,,,,,,,582', 906 '582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582', 907 '582,582,582,582,582,582,582,582,582,582,150,,150,,,582,582,582,582,582', 908 '582,582,582,,,,,,,,,,,,,,,,,,,,,150,150,150,150,150,150,150,150,150', 904 909 '150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150', 905 '150,150,150,150,150,150,150,582,,582,,,150,150,150,150,150,150,150,150', 906 ',,,,,,,,,,,,,,,,,,,,582,582,582,582,582,582,582,582,582,582,582,582', 907 '582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,372', 908 ',,,,582,582,582,582,582,582,582,582,,,,,,,,,,,,,,,,,,,372,372,372,372', 910 '150,150,372,,,,,150,150,150,150,150,150,150,150,,,,,,,,,,,,,,,,,,,372', 909 911 '372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372,372', 910 '372,372,372,372,372,372,372,459,,,,,372,372,372,372,372,372,372,372', 911 '372,,,,,,,,,,,,,,,,,,459,459,459,459,459,459,459,459,459,459,459,459', 912 '459,459,459,459,459,459,459,459,459,459,459,459,459,459,459,459,250', 913 ',,,,459,459,459,459,459,459,459,459,,,,,,,,,,,,,,,,,,,250,250,250,250', 912 '372,372,372,372,372,372,372,372,372,372,293,,,,,372,372,372,372,372', 913 '372,372,372,372,,,,,,,,,,,,,,,,,,293,293,293,293,293,293,293,293,293', 914 '293,293,293,293,293,293,293,293,293,293,293,293,293,293,293,293,293', 915 '293,293,444,293,,,,293,293,293,293,293,293,293,293,,,,,,,,,,,,,,,,,', 916 ',444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444', 917 '444,444,444,444,444,444,444,444,444,444,444,445,,,,,444,444,444,444', 918 '444,444,444,444,,,,,,,,,,,,,,,,,,,445,445,445,445,445,445,445,445,445', 919 '445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,445', 920 '445,445,550,,,,,445,445,445,445,445,445,445,445,,,,,,,,,,,,,,,,,,,550', 921 '550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550', 922 '550,550,550,550,550,550,550,550,550,550,554,550,,,,550,550,550,550,550', 923 '550,550,550,,,,,,,,,,,,,,,,,,,554,554,554,554,554,554,554,554,554,554', 924 '554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554', 925 '554,566,554,,,,554,554,554,554,554,554,554,554,,,,,,,,,,,,,,,,,,,566', 926 '566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566', 927 '566,566,566,566,566,566,566,566,566,566,71,566,,,,566,566,566,566,566', 928 '566,566,566,,,,,,,,,,,,,,,,,,,71,71,71,71,71,71,71,71,71,71,71,71,71', 929 '71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,386,,,,,71,71,71,71,71', 930 '71,71,71,,,,,,,,,,,,,,,,,,,386,386,386,386,386,386,386,386,386,386,386', 931 '386,386,386,386,386,386,386,386,386,386,386,386,386,386,386,386,386', 932 '459,386,,,,386,386,386,386,386,386,386,386,,,,,,,,,,,,,,,,,,,459,459', 933 '459,459,459,459,459,459,459,459,459,459,459,459,459,459,459,459,459', 934 '459,459,459,459,459,459,459,459,459,251,,,,,459,459,459,459,459,459', 935 '459,459,,,,,,,,,,,,,,,,,,,251,251,251,251,251,251,251,251,251,251,251', 936 '251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251', 937 '250,251,,,,251,251,251,251,251,251,251,251,,,,,,,,,,,,,,,,,,,250,250', 914 938 '250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250', 915 '250,250,250,250,250,250,250,293,,,,,250,250,250,250,250,250,250,250', 916 ',,,,,,,,,,,,,,,,,,293,293,293,293,293,293,293,293,293,293,293,293,293', 917 '293,293,293,293,293,293,293,293,293,293,293,293,293,293,293,445,293', 918 ',,,293,293,293,293,293,293,293,293,,,,,,,,,,,,,,,,,,,445,445,445,445', 919 '445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,445', 920 '445,445,445,445,445,445,445,251,,,,,445,445,445,445,445,445,445,445', 921 ',,,,,,,,,,,,,,,,,,251,251,251,251,251,251,251,251,251,251,251,251,251', 922 '251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,444,251', 923 ',,,251,251,251,251,251,251,251,251,,,,,,,,,,,,,,,,,,,444,444,444,444', 924 '444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444', 925 '444,444,444,444,444,444,444,156,,,,,444,444,444,444,444,444,444,444', 926 ',,,,,,,,,,,,,,,,,,156,156,156,156,156,156,156,156,156,156,156,156,156', 927 '156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,386,,,,', 928 '156,156,156,156,156,156,156,156,,,,,,,,,,,,,,,,,,,386,386,386,386,386', 929 '386,386,386,386,386,386,386,386,386,386,386,386,386,386,386,386,386', 930 '386,386,386,386,386,386,71,386,,,,386,386,386,386,386,386,386,386,,', 931 ',,,,,,,,,,,,,,,,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71', 932 '71,71,71,71,71,71,71,71,71,71,550,,,,,71,71,71,71,71,71,71,71,,,,,,', 933 ',,,,,,,,,,,,550,550,550,550,550,550,550,550,550,550,550,550,550,550', 934 '550,550,550,550,550,550,550,550,550,550,550,550,550,550,554,550,,,,550', 935 '550,550,550,550,550,550,550,,,,,,,,,,,,,,,,,,,554,554,554,554,554,554', 936 '554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554', 937 '554,554,554,554,554,566,554,,,,554,554,554,554,554,554,554,554,,,,,', 938 ',,,,,,,,,,,,,566,566,566,566,566,566,566,566,566,566,566,566,566,566', 939 '566,566,566,566,566,566,566,566,566,566,566,566,566,566,,566,,,,566', 940 '566,566,566,566,566,566,566,464,464,464,464,464,464,464,464,464,464', 941 '464,,,,,,,,,,,,,,,,,,,,,,,,,,,,464,464,464,464,464,464,464,244,244,244', 939 '250,250,250,250,250,250,250,250,250,156,,,,,250,250,250,250,250,250', 940 '250,250,,,,,,,,,,,,,,,,,,,156,156,156,156,156,156,156,156,156,156,156', 941 '156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156', 942 ',,,,,156,156,156,156,156,156,156,156,622,622,622,622,622,622,622,622', 943 '622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,622', 944 '622,622,622,,,,,,622,622,622,622,622,622,622,622,40,40,40,40,40,40,40', 945 '40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,,,,,', 946 '40,40,40,40,40,40,40,40,705,705,705,705,705,705,705,705,705,705,705', 947 '705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705', 948 ',,,,,705,705,705,705,705,705,705,705,244,244,244,244,244,244,244,244', 942 949 '244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244', 943 '244,244,244,244,244,244,244,244,,,,,,244,244,244,244,244,244,244,244', 944 '40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40', 945 '40,40,40,40,40,,,,,,40,40,40,40,40,40,40,40,289,289,289,289,289,289', 946 '289,289,289,289,289,289,289,289,289,289,289,289,289,289,289,289,289', 947 '289,289,289,289,289,,,,,,289,289,289,289,289,289,289,289,709,709,709', 950 '244,244,244,,,,,,244,244,244,244,244,244,244,244,519,519,519,519,519', 951 '519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519', 952 '519,519,519,519,519,519,,,,,,519,519,519,519,519,519,519,519,709,709', 948 953 '709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709', 949 '709,709,709,709,709,709,709,709,,,,,,709,709,709,709,709,709,709,709', 950 '519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519', 951 '519,519,519,519,519,519,519,519,519,519,519,,,,,,519,519,519,519,519', 952 '519,519,519,622,622,622,622,622,622,622,622,622,622,622,622,622,622', 953 '622,622,622,622,622,622,622,622,622,622,622,622,622,622,,,,,,622,622', 954 '622,622,622,622,622,622,705,705,705,705,705,705,705,705,705,705,705', 955 '705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705', 956 ',,,,,705,705,705,705,705,705,705,705,239,239,239,239,239,239,239,239', 957 '239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239', 958 '239,239,239,,,,,,239,239,239,239,239,239' ] 959 racc_action_check = arr = ::Array.new(3623, nil) 954 '709,709,709,709,709,709,709,709,709,,,,,,709,709,709,709,709,709,709', 955 '709,289,289,289,289,289,289,289,289,289,289,289,289,289,289,289,289', 956 '289,289,289,289,289,289,289,289,289,289,289,289,,,,,,289,289,289,289', 957 '289,289,289,289,239,239,239,239,239,239,239,239,239,239,239,239,239', 958 '239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,,,,,,239', 959 '239,239,239,239,239' ] 960 racc_action_check = arr = ::Array.new(3593, nil) 960 961 idx = 0 961 962 clist.each do |str| … … 967 968 968 969 racc_action_pointer = [ 969 nil, 1442, -1, 1586, 1989, nil, nil, nil, 602, 527,970 nil, nil, nil, nil, nil, nil, 1993, nil, nil, nil,970 nil, 613, -1, 620, 1492, nil, nil, nil, 612, 627, 971 nil, nil, nil, nil, nil, nil, 680, nil, nil, nil, 971 972 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 972 nil, nil, nil, nil, nil, nil, 1340, nil, 1985, nil,973 32 95, 123, nil, nil, nil, nil, nil, nil, nil, nil,974 nil, nil, nil, nil, 218 2, nil, nil, nil, nil, nil,975 nil, nil, nil, nil, nil, nil, nil, nil, 1974, 1964,976 1919, 2991, 1910, 1890, 1888, 198, 1876, 1866, nil, 1806,977 1852, nil, 679, nil, 1816, 122, 655, nil, 607, 174,978 nil, nil, 190, nil, 1786, 1766, nil, nil, nil, nil,979 1821, 1744, 550, nil, 1805, nil, 1804, nil, 1788, nil,980 1787, nil, nil, nil, 1784, 587, nil, 1775, 1774, 1772,981 nil, nil, 1771, 1714, 1711, 77, 1706, 350, 1627, 1628,982 nil, 1558, nil, 1538, nil, nil, 1592, 1477, 1549, 1481,983 nil, 1 480, nil, nil, 1539, nil, 1663, 1133, 285, 1177,984 2 340, 1531, 1520, nil, 27, nil, 2873, 45, nil, 1495,985 1 520, 271, 1895, nil, 1502, 1505, 1481, 1500, 1478, 1312,986 1607, 538, 476, 1423, 1344, 1343, 525, 1328, 1300, 1260,987 nil, 692, nil, 1287, 1290, 184, nil, 156, nil, 1276,988 450, nil, -6, nil, -65, 1277, nil, nil, 1159, nil,989 nil, nil, nil, nil, nil, nil, 1 232, 1709, nil, nil,990 437, 1801, 1823, nil, nil, nil, nil, nil, nil, nil,991 nil, 590, 741, 751, 893, 767, 1204, 1186, 1174, 1157,992 774, nil, nil, nil, 1915, 1178, 1155, nil, nil, 3541,993 1 157, nil, 1124, nil, 3254, 1665, 1017, nil, nil, nil,994 2578, 2755, nil, 592, 612, nil, 1131, 414, 149, nil,995 1 324, nil, 248, nil, 332, 814, 1135, 271, nil, 599,996 nil, 1 102, 1119, nil, 1081, nil, 1079, nil, 430, nil,997 1 069, 1098, 1060, 1088, 1055, 1035, 176, nil, 1322, 3336,998 1687, 97, nil, 2637, 291, nil, nil, 802, nil, nil,999 nil, nil, nil, 80, nil, nil, 1002, 984, 177, 980,1000 nil, nil, nil, nil, nil, 183, nil, nil, 797, nil,1001 nil, nil, nil, nil, 961, 199, 900, 857, nil, -2,1002 nil, nil, nil, 254, 858, 787, nil, 840, 838, nil,1003 206, 15 03, 829, 811, nil, 1367, nil, 1300, 1253, 1208,1004 1 155, 1110, 993, 971, 949, 926, 857, 787, 720, 695,1005 2191, 2143, 2121, 2051, 2029, 2007, 447, nil, 811, nil,1006 nil, nil, 24 60, 1321, nil, 342, nil, nil, nil, nil,1007 804, 792, 788, 770, 754, nil, 2932, nil, nil, 806,1008 nil, nil, 3 30, nil, 654, 643, 524, nil, nil, nil,1009 nil, 516, 470, 461, nil, nil, nil, 458, 381, 423,1010 383, 308, 359, 271, 69, nil, 2032, nil, nil, 2032,1011 nil, nil, -37, nil, 2233, 2029, 1981, nil, 1967, nil,1012 1078, 1893, 1965, nil, 0, nil, nil, 2008, nil, nil,1013 nil, nil, 1 911, 2005, 2814, 2696, 1999, 73, nil, nil,1014 -32, nil, 599, nil, 31, nil, nil, nil, nil, 2519,1015 -16, 155, 192, 255, 3160, 328, nil, nil, nil, -8,1016 81, nil, 370, nil, 439, nil, 596, 537, 2279, 495,1017 474, nil, nil, 484, nil, nil, nil, 741, 526, 849,1018 8 61, 871, 900, 912, 935, 856, 717, 951, 671, 671,1019 676, 685, 710, nil, 553, 995, nil, nil, nil, nil,1020 1660, 253, 197, 651, 1959, 1459, nil, nil, 1664, 3418,1021 634, 1551, 1573, 1595, nil, 874, 891, nil, 892, 877,1022 925, 930, nil, 940, 953, 940, 975, 947, 992, 977,1023 nil, nil, nil, 969, 1006, nil, 1084, 638, 1027, 587,1024 3050, nil, nil, 310, 3109, nil, nil, 1003, 78, 1081,1025 13, 284, nil, 92, 642, 1096, 3168, nil, 305, nil,1026 1 109, nil, 996, 77, nil, 1893, -11, 130, 1108, nil,1027 484, 1617, 2401, 1159, 1937, nil, 1179, nil, 1178, nil,1028 nil, 1 867, nil, nil, nil, nil, 14, 26, 1211, 356,1029 1 222, nil, 1079, nil, 1234, 1235, 1237, 1250, 1252, 448,1030 nil, 1198, nil, 0, nil, nil, 1277, nil, nil, 1279,1031 nil, nil, 3 459, nil, nil, 346, 524, nil, nil, nil,1032 12, 79, 1272, nil, 1300, nil, 1305, 1286, 1289, nil,1033 1 319, 1326, 25, 1304, 1305, nil, 1337, nil, 1315, nil,1034 nil, 1 231, nil, 465, nil, nil, nil, 577, 1337, nil,1035 nil, nil, 1 364, 1365, 1256, 1350, 1377, nil, 1398, 2235,1036 nil, 1 426, nil, 1430, nil, nil, nil, nil, nil, nil,1037 nil, nil, 1525, nil, 387, nil, nil, nil, 1409, 1437,1038 nil, 1454, 1456, 1432, 1463, 1451, 887, 1479, nil, 1480,1039 1 457, 1500, nil, 24, nil, 3500, 1345, 1448, nil, 3377,1040 1 275, 1523, nil, nil, 1231, nil, 496, nil, 1540, 1063,1041 384, 76, nil, nil, nil, 1 521, nil, 1549, nil, 1041,1042 1 437, 1544, nil, nil, nil, nil, nil, nil, nil, 888,1043 nil, nil, 10 26, 1049, nil, nil, 1595, nil, 1018, 1594,1044 nil, 548, nil, nil, nil, 1587, 262, nil, nil, nil,1045 1 591, 1626, nil, 1632, 1632, nil, 1634, 1613, 1614, 1641,1046 1 531, 1656, 1633, 1674, nil, 1648, 1683, 75, 352, nil,1047 1 686, 1678, 115, 1665, 344, nil, nil, nil, nil, nil,1048 nil, nil, nil, 1 729, nil, nil, 834, 812, nil, 1742,1049 nil, 5 47, nil, nil, nil, nil, 765, nil, 330, nil,1050 1 753, 2213, 229, nil, 1783, 1784, 1672, 1761, nil, nil,1051 nil, 1 674, 1771, 2165, 8, nil, nil, 1322, 1791, nil,1052 nil, nil, nil, 1824, 544, 2099, 1828, 1815, 2073, 89,1053 1 819, 598, nil, -13, nil, 1838, 1865, nil, 673, nil,1054 1843, 205, 1879, 1883, nil, 1854, -9, nil, nil, 628,1055 1892, 1867, 575, 1917, nil, nil, 464, nil, nil, 1887,1056 nil, nil, 1932, 1936, 1936, nil, 1959, 1900, 1932, 591,1057 399, 1944, 1945, 1928, nil, nil, nil, nil, nil, 521,1058 nil, nil, nil, 11, 53 9, 100, nil, 595, 581, nil,1059 nil, 614, 1845, nil, 650, 765, 966, nil, 1643, 1577,973 nil, nil, nil, nil, nil, nil, 2268, nil, 694, nil, 974 3265, 123, nil, nil, nil, nil, nil, nil, nil, nil, 975 nil, nil, nil, nil, 2185, nil, nil, nil, nil, nil, 976 nil, nil, nil, nil, nil, nil, nil, nil, 702, 712, 977 721, 2888, 717, 719, 729, 115, 738, 742, nil, 704, 978 770, nil, 921, nil, 755, 75, 359, nil, 1610, 174, 979 nil, nil, 89, nil, 730, 742, nil, nil, nil, nil, 980 807, 755, 496, nil, 827, nil, 836, nil, 840, nil, 981 858, nil, nil, nil, 862, 586, nil, 877, 889, 891, 982 nil, nil, 905, 909, 917, 27, 922, 606, 866, 870, 983 nil, 892, nil, 903, nil, nil, 979, 888, 983, 1040, 984 nil, 1044, nil, nil, 1106, nil, 1500, 1268, 484, 2000, 985 2416, 1115, 1107, nil, 26, nil, 3183, 448, nil, 1094, 986 1123, 97, 1591, nil, 1124, 1129, 575, 1127, 1143, 1031, 987 2017, 282, 350, 1146, 1147, 1149, 335, 1163, 1164, 1134, 988 nil, 848, nil, 1163, 1168, 184, nil, 156, nil, 1171, 989 218, nil, -6, nil, -65, 1178, nil, nil, 1081, nil, 990 nil, nil, nil, nil, nil, nil, 1179, 1019, nil, nil, 991 437, 2228, 2206, nil, nil, nil, nil, nil, nil, nil, 992 nil, 880, 687, 729, 989, 767, 1182, 1177, 1178, 1179, 993 132, nil, nil, nil, 553, 1222, 1220, nil, nil, 3511, 994 1225, nil, 1196, nil, 3347, 2107, 1268, nil, nil, nil, 995 3124, 3065, nil, 2116, 612, nil, 1230, 1176, 130, nil, 996 1615, nil, 480, nil, 367, 767, 1244, 76, nil, -1, 997 nil, 1217, 1245, nil, 1227, nil, 1228, nil, 524, nil, 998 1237, 1270, 1241, 1271, 1252, 1261, 197, nil, 1329, 3470, 999 2048, 271, nil, 2534, 291, nil, nil, 778, nil, nil, 1000 nil, nil, nil, 177, nil, nil, 1232, 1233, 198, 1234, 1001 nil, nil, nil, nil, nil, 183, nil, nil, 867, nil, 1002 nil, nil, nil, nil, 1252, 10, 1197, 1313, nil, -2, 1003 nil, nil, nil, 190, 1328, 1274, nil, 1337, 1339, nil, 1004 206, 1588, 1336, 1345, nil, 1658, nil, 1636, 1750, 1772, 1005 1794, 1816, 1842, 1864, 1886, 1908, 1934, 1956, 651, 1978, 1006 695, 720, 787, 673, 1544, 1452, 325, nil, 1350, nil, 1007 nil, nil, 2475, 1495, nil, 692, nil, nil, nil, nil, 1008 1361, 1363, 1364, 1365, 1375, nil, 2947, nil, nil, 936, 1009 nil, nil, 342, nil, 1384, 1386, 1387, nil, nil, nil, 1010 nil, 1382, 1400, 2162, nil, nil, nil, 1402, 1347, 1404, 1011 1426, 1368, 1429, 1430, 1428, nil, 1440, nil, nil, 1442, 1012 nil, nil, -37, nil, 1611, 1443, 1422, nil, 1424, nil, 1013 476, 1355, 1426, nil, 599, nil, nil, 1471, nil, nil, 1014 nil, nil, 1373, 1467, 2593, 2652, 1441, -11, nil, nil, 1015 1444, nil, 601, nil, 1483, nil, nil, nil, nil, 3006, 1016 1385, 1485, 1488, 1501, 2163, 1477, nil, nil, nil, -8, 1017 254, nil, 1509, nil, 2026, nil, 593, 597, 2294, 628, 1018 1516, nil, nil, 1521, nil, nil, nil, 877, 954, 791, 1019 804, 855, 890, 1087, 596, 978, 1063, 815, 1515, 1509, 1020 1509, 1518, 1518, nil, 1427, 709, nil, nil, nil, nil, 1021 958, 81, 261, 2184, 949, 12, nil, nil, 592, 3388, 1022 590, 461, 495, 521, nil, 1544, 1563, nil, 80, 1536, 1023 1568, 1570, nil, 1572, 1588, 1559, 1591, 1562, 1593, 318, 1024 nil, nil, nil, 1572, 1604, nil, 937, 937, 1603, 857, 1025 2711, nil, nil, 310, 2770, nil, nil, 1547, 79, 1613, 1026 13, 355, nil, 92, 900, 1618, 2829, nil, 437, nil, 1027 1620, nil, 1507, 344, nil, 1148, 73, 433, 1597, nil, 1028 541, 1199, 2355, 1627, 1244, nil, 1636, nil, 1635, nil, 1029 nil, 1291, nil, nil, nil, nil, 14, 27, 1639, 430, 1030 1640, nil, 1331, nil, 1658, 1660, 1661, 1657, 1680, 240, 1031 1587, 1626, nil, 0, nil, nil, 1687, nil, nil, 1689, 1032 nil, nil, 3224, nil, nil, 332, 578, nil, nil, nil, 1033 1519, 78, 1660, nil, 1716, nil, 1721, 1689, 1692, nil, 1034 1720, 1733, 75, 1703, 1720, nil, 1753, nil, 1723, nil, 1035 nil, 1638, nil, 521, nil, nil, nil, 577, 1742, nil, 1036 nil, nil, 1769, 1770, 1661, 1747, 1789, nil, 1795, 2125, 1037 nil, 1794, nil, 1798, nil, nil, nil, nil, nil, nil, 1038 nil, nil, 743, nil, 844, nil, nil, nil, 1768, 1811, 1039 nil, 176, 256, 1788, 1819, 1790, 1493, 1817, nil, 1825, 1040 1801, 1829, nil, 74, nil, 3306, 1405, 1772, nil, 3429, 1041 1383, 1837, nil, nil, 1360, nil, 587, nil, 1845, 1313, 1042 384, 76, nil, nil, nil, 1815, nil, 1842, nil, 1221, 1043 1746, 1837, nil, nil, nil, nil, nil, nil, nil, 1611, 1044 nil, nil, 1006, 482, nil, nil, 1867, nil, 1101, 1864, 1045 1788, 447, nil, nil, nil, 1858, 596, nil, nil, nil, 1046 1859, 1885, nil, 1908, 1909, nil, 1911, 1882, 1891, 1918, 1047 1808, 1920, 1902, 1933, nil, 1907, 1934, -9, 284, nil, 1048 1951, 1927, 199, 1485, 576, nil, nil, nil, nil, nil, 1049 nil, nil, nil, 1954, nil, nil, 904, 812, nil, 1930, 1050 nil, 513, nil, nil, nil, nil, 2092, nil, 330, nil, 1051 1947, 835, 240, nil, 1975, 1976, 1864, 1970, nil, nil, 1052 nil, 1884, 1974, 982, 8, nil, nil, 1474, 1982, nil, 1053 nil, nil, nil, 2014, 525, 927, 2015, 1987, 857, 253, 1054 1996, 399, nil, -13, nil, 1997, 2024, nil, 2070, nil, 1055 2000, 205, -5, 30, nil, 52, 25, nil, nil, 1126, 1056 117, 97, 765, 197, nil, nil, 180, nil, nil, 217, 1057 nil, nil, 279, 291, 379, nil, 418, 367, 433, 534, 1058 412, 454, 467, 460, nil, nil, nil, nil, nil, 439, 1059 nil, nil, nil, 11, 533, 100, nil, 539, 512, nil, 1060 nil, 558, 414, nil, 576, 594, 567, nil, 1566, 606, 1060 1061 nil ] 1061 1062 … … 1200 1201 665, nil, nil, nil, nil, nil, 671, 596, 597, 588, 1201 1202 nil, nil, 553, 557, 673, nil, 238, nil, 763, 622, 1202 853, nil, 766, nil, nil, nil, 530, 553, nil, nil,1203 853, nil, 766, nil, 610, nil, 530, 553, nil, nil, 1203 1204 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 1204 1205 nil, nil, nil, nil, nil, nil, nil, nil, 664, nil, … … 1216 1217 nil, nil, nil, nil, nil, nil, nil, nil, nil, 696, 1217 1218 nil, 873, nil, 792, nil, nil, nil, nil, nil, nil, 1218 nil, 464, nil, nil, 339, nil, nil, nil, nil, nil,1219 nil, 464, nil, nil, 339, nil, nil, 750, 610, nil, 1219 1220 nil, 769, nil, nil, nil, nil, nil, nil, nil, nil, 1220 1221 nil, 894, nil, nil, nil, nil, nil, nil, nil, nil, … … 1280 1281 23, nil, nil, nil, nil, nil, 23, 4, 4, 23, 1281 1282 nil, nil, 45, 45, 55, nil, 28, nil, 6, 47, 1282 84, nil, 6, nil, nil, nil, 5, 45, nil, nil,1283 84, nil, 6, nil, 4, nil, 5, 45, nil, nil, 1283 1284 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 1284 1285 nil, nil, nil, nil, nil, nil, nil, nil, 47, nil, … … 1296 1297 nil, nil, nil, nil, nil, nil, nil, nil, nil, 25, 1297 1298 nil, 6, nil, 32, nil, nil, nil, nil, nil, nil, 1298 nil, 45, nil, nil, 22, nil, nil, nil, nil, nil,1299 nil, 45, nil, nil, 22, nil, nil, 4, 4, nil, 1299 1300 nil, 47, nil, nil, nil, nil, nil, nil, nil, nil, 1300 1301 nil, 6, nil, nil, nil, nil, nil, nil, nil, nil, … … 2943 2944 def _reduce_104(val, _values, result) 2944 2945 # tag が無い場合、内部名を与える 2945 result = StructType.new( :" $TAG_#{@@no_struct_tag_num}" )2946 result = StructType.new( :"TAG__#{@@no_struct_tag_num}__" ) 2946 2947 @@no_struct_tag_num += 1 2947 2948 StructType.set_define( true ) … … 3749 3750 module_eval(<<'.,.,', 'bnf.y.rb', 802) 3750 3751 def _reduce_233(val, _values, result) 3751 result = [val[0] .val]3752 result = [val[0]] 3752 3753 result 3753 3754 end … … 3756 3757 module_eval(<<'.,.,', 'bnf.y.rb', 804) 3757 3758 def _reduce_234(val, _values, result) 3758 result << val[2] .val3759 result << val[2] 3759 3760 result 3760 3761 end -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/bnf.y.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 6by TOPPERS Project6 # Copyright (C) 2008-2018 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 379 379 { 380 380 # tag が無い場合、内部名を与える 381 result = StructType.new( :" $TAG_#{@@no_struct_tag_num}" )381 result = StructType.new( :"TAG__#{@@no_struct_tag_num}__" ) 382 382 @@no_struct_tag_num += 1 383 383 StructType.set_define( true ) … … 800 800 801 801 region_name_list 802 : IDENTIFIER803 { result = [val[0] .val] }804 | region_name_list ',' IDENTIFIER805 { result << val[2] .val}802 : namespace_identifier 803 { result = [val[0]] } 804 | region_name_list ',' namespace_identifier 805 { result << val[2] } 806 806 807 807 const_statement … … 1807 1807 string += line 1808 1808 # この位置では error メソッドは使えない (token 読出し前) 1809 puts " error: #{file} line #{lineno}: string literal has newline without escape"1809 puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape" 1810 1810 @@n_error += 1 1811 1811 end … … 1848 1848 b_in_string = true 1849 1849 # この位置では error メソッドは使えない (token 読出し前) # mikan cdl_error ではない 1850 puts " error: #{file} line #{lineno}: string literal has newline without escape"1850 puts "#{file}:#{lineno}:#{col}: error: string literal has newline without escape" 1851 1851 @@n_error += 1 1852 1852 # 山括弧で囲まれた文字列 1853 when /\A<[0-9A-Za-z_\. \/]+>/ # AB: angle bracke 1853 # when /\A<[0-9A-Za-z_\. \/]+>/ # AB: angle bracke 1854 when /\A<(?:[^>\\]|\\.)*>/ # これはうまく行くようだ 1854 1855 @q << [:AB_STRING_LITERAL, Token.new($&, file, lineno, col)] 1855 1856 # 行コメント … … 1981 1982 end 1982 1983 if locale then 1983 Console.puts " error: #{locale[0]}: line #{locale[1]}#{msg}"1984 Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: error: #{msg}" 1984 1985 else 1985 1986 Console.puts "error: #{msg}" … … 2014 2015 end 2015 2016 if locale then 2016 Console.puts " warning: #{locale[0]}: line #{locale[1]}#{msg}"2017 Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: warning: #{msg}" 2017 2018 else 2018 2019 Console.puts "warning: #{msg}" … … 2047 2048 end 2048 2049 if locale then 2049 Console.puts " info: #{locale[0]}: line #{locale[1]}#{msg}"2050 Console.puts "#{locale[0]}:#{locale[1]}:#{locale[2]}: info: #{msg}" 2050 2051 else 2051 2052 Console.puts "info: #{msg}" -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/componentobj.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 7by TOPPERS Project6 # Copyright (C) 2008-2019 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 149 149 end 150 150 151 set_descriptor_list151 # set_descriptor_list ## 152 152 153 153 if @generate then … … 364 364 end 365 365 366 @@set_descriptor_list = {} 367 def self.set_descriptor_list 368 Namespace.get_root.travers_all_signature{ |sig| 369 if @@set_descriptor_list[ sig ] == nil then 370 @@set_descriptor_list[ sig ] = true 371 sig.set_descriptor_list 372 end 373 } 374 end 375 366 376 #== Signature# 引数で参照されている Descriptor 型のリストを作成する 367 377 def set_descriptor_list … … 538 548 # @ct_factory_list:: Factory[] : celltype factory 539 549 # @cell_list:: Cell[] : 定義のみ (V1.0.0.2 以降) 550 # @ordered_cell_list:: Cell[] : ID 順に順序付けされたセルリスト、最適化以降有効 (リンク単位ごとに生成されなおす) 540 551 # @singleton:: bool 541 552 # @idx_is_id:: bool 542 553 # @idx_is_id_act:: bool: actual value 554 # @b_need_ptab:: bool: true if having cells in multi-domain 543 555 # @active:: bool 544 556 # @b_reuse:: bool : reuse 指定されて import された(template 不要) … … 654 666 if $idx_is_id then 655 667 @idx_is_id = true 668 @idx_is_id_act = true 669 @b_need_ptab = true 656 670 else 657 671 @idx_is_id = false 658 end 659 @idx_is_id_act = @idx_is_id 672 @idx_is_id_act = false 673 @b_need_ptab = false 674 end 660 675 661 676 Namespace.new_celltype( self ) … … 700 715 end 701 716 702 check_dynamic_join717 # check_dynamic_join ## 703 718 704 719 @@current_object = nil … … 886 901 @idx_is_id = true 887 902 @idx_is_id_act = true 903 @b_need_ptab = true 888 904 when :ACTIVE 889 905 @active = true … … 899 915 if @singleton then 900 916 @idx_is_id_act = false 917 @b_need_ptab = false 901 918 end 902 919 end … … 999 1016 end 1000 1017 1018 @@dynamic_join_checked_list = {} 1019 def self.check_dynamic_join 1020 Namespace.get_root.travers_all_celltype{ |ct| 1021 if @@dynamic_join_checked_list[ ct ] == nil then 1022 @@dynamic_join_checked_list[ ct ] = true 1023 ct.check_dynamic_join 1024 end 1025 } 1026 end 1027 1001 1028 #=== Celltype#dynamic の適合性チェック 1002 1029 def check_dynamic_join 1030 return if ! $verbose 1003 1031 @port.each{ |port| 1004 1032 signature = port.get_signature … … 1038 1066 end 1039 1067 end 1040 cdl_warning( 'W9999 "$1" cannot handle Descriptor "$2" inf romation for port "$3"', @name, param.get_name, port.get_name )1068 cdl_warning( 'W9999 "$1" cannot handle Descriptor "$2" information for port "$3"', @name, param.get_name, port.get_name ) 1041 1069 } 1042 1070 end … … 1143 1171 # 呼び口(ただし、最適化で不要となるものは除く) 1144 1172 def has_INIB? 1145 # print "name=#{@name} @n_attribute_ro=#{@n_attribute_ro} @n_var_size_is=#{@n_var_size_is} @n_call_port=#{@n_call_port} @n_call_port_omitted_in_CB=#{@n_call_port_omitted_in_CB} @n_entry_port_array_ns=#{@n_entry_port_array_ns}\n" 1146 return $rom && 1147 (@n_attribute_ro > 0 || 1148 @n_var_size_is > 0 || 1149 ( @n_call_port - @n_call_port_omitted_in_CB - (@n_call_port_dynamic-@n_call_port_array_dynamic) ) > 0 || 1150 $ram_initializer && @n_call_port_dynamic || 1151 @n_entry_port_array_ns > 0) 1152 # return $rom && (@n_attribute_ro > 0 || ( @n_call_port - @n_call_port_omitted_in_CB ) > 0) 1173 1174 result = $rom && 1175 (@n_attribute_ro > 0 || 1176 @n_var_size_is > 0 || 1177 ( @n_call_port - @n_call_port_omitted_in_CB - (@n_call_port_dynamic-@n_call_port_array_dynamic) ) > 0 || 1178 $ram_initializer && @n_call_port_dynamic > 0 || 1179 @n_entry_port_array_ns > 0) 1180 # print "name=#{@name} n_attribute_ro=#{@n_attribute_ro} n_var_size_is=#{@n_var_size_is} n_call_port=#{@n_call_port} n_call_port_omitted_in_CB=#{@n_call_port_omitted_in_CB} n_call_port_dynamic=#{@n_call_port_dynamic} n_call_port_array_dynamic=#{@n_call_port_array_dynamic} n_entry_port_array_ns=#{@n_entry_port_array_ns} has_INIB?=#{result}\n" 1181 1182 return result 1153 1183 end 1154 1184 … … 1231 1261 def idx_is_id_act? 1232 1262 @idx_is_id_act 1263 end 1264 1265 def multi_domain? 1266 @b_need_ptab 1233 1267 end 1234 1268 … … 1353 1387 # 逆require ポートに対して複数の結合がないかチェックする 1354 1388 # @generate:: [ Symbol, String, Plugin ] = [ PluginName, option, Plugin ] Plugin は生成後に追加される 1389 # @b_post_code_generated:: Bool: true if generated in tmp_plugin_post_code.cdl 1355 1390 # 1356 1391 # composite のためインスタンス変数 … … 1375 1410 # @id:: Integer : コード生成直前に設定 (プロトタイプ宣言の場合は -1 のまま放置) 1376 1411 # @id_specified::Integer : 指定された id 1377 # @restrict_list::{ entry_name => { func_name, [ region_name, ... ] } } 1412 # @restrict_list::{ entry_name => { func_name, [ region_path_str, ... ] } } 1413 # @restrict_list2::{ entry_name => { func_name, [ domain_root_region, ... ] } } 1414 # @b_restrict_referenced::Bool: restrict_list が参照れた 1378 1415 1379 1416 =begin … … 1459 1496 @referenced_port_list = {} 1460 1497 @restrict_list = {} 1498 @restrict_list2 = {} 1499 @b_restrict_referenced = false 1500 @b_post_code_generated = false 1461 1501 1462 1502 @cell_list = {} … … 1803 1843 set_specifier_list( Generator.get_statement_specifier ) 1804 1844 end 1845 if TECSGEN.post_coded? 1846 @b_post_code_generated = true 1847 end 1805 1848 set_f_def f_def 1806 1849 … … 1820 1863 if ! @in_composite then 1821 1864 # if @celltype.instance_of? Celltype then 1865 if @celltype then # composite でも呼びだす, エラー時 nil 1822 1866 @celltype.new_cell self 1823 #end1867 end 1824 1868 @@cell_list << self 1825 1869 end … … 2132 2176 end 2133 2177 2178 #=== Cell# composite のセルか? 2179 def is_of_composite? 2180 if @celltype.kind_of? CompositeCelltype 2181 return true 2182 else 2183 return false 2184 end 2185 end 2186 2187 #=== Cell# tmp_plugin_post_code.cdl で生成されたセルか? 2188 def post_code_generated? 2189 @b_post_code_generated 2190 end 2191 2134 2192 # composite cell の port に対応する内部の cell の port の名前(リンク時に必要な名前) 2135 2193 def get_real_global_name port_name … … 2219 2277 2220 2278 # セルタイプ内で port_name の CompositeCelltypeJoin を探す(コード生成段階では必ず見つかる) 2279 # print "get_real_cell: cell=#{@name} port=#{port_name}\n" 2280 # pp @cell_list 2221 2281 cj = @celltype.find_export( port_name ) 2222 2282 … … 2230 2290 end 2231 2291 2292 #=== Cell#get_real_celltype 2293 # 2294 def get_real_celltype( port_name ) 2295 if @celltype.instance_of?( CompositeCelltype ) then 2296 return @celltype.get_real_celltype port_name 2297 else 2298 return @celltype 2299 end 2300 end 2232 2301 2233 2302 #=== Cell# 受け口のport の参照カウントをアップする … … 2270 2339 return "#{@global_name}_#{port_name}" 2271 2340 end 2341 end 2342 2343 #Cell#属性の初期値を得る 2344 #attr_name::Symbol 必ず初期化されていないと Ruby 例外となる 2345 def get_attr_initializer attr_name 2346 val = @join_list.get_item( attr_name ) 2347 if val == nil then 2348 val = (@celltype.find attr_name).get_initializer 2349 else 2350 val = val.get_rhs 2351 end 2352 return val 2272 2353 end 2273 2354 … … 2520 2601 else 2521 2602 cell = j.get_rhs_cell2 2522 next if cell == nil # 右辺が見つからなかった.既にエラー2603 next if cell == nil || cell.get_celltype == nil # 右辺が見つからなかった.既にエラー 2523 2604 port = cell.get_celltype.find( j.get_rhs_port2 ) 2605 if port == nil then 2606 dbgPrint "set_port_ref: #{@name}.#{j.get_name} = #{cell.get_name}.#{j.get_rhs_port2}\n" 2607 # through プラグインで生成されたセルの受け口が見つからないケース (のハズ) 2608 cdl_error( "entry '$1' not found in '$2' refered from $3.$4", j.get_rhs_port2, cell.get_name, @name, j.get_name ) 2609 next 2610 end 2524 2611 dbgPrint( "set_port_reference_count: #{@name}.#{j.get_name} => #{cell.get_name}.#{port.get_name}\n") 2525 2612 cell.port_referenced port … … 2966 3053 #=== Cell#restrict を追加 2967 3054 def add_restrict( entry_name, func_name, region_name_list ) 2968 if @restrict_list[ entry_name ] then 2969 if @restrict_list[ entry_name ][ func_name ] then 2970 @restrict_list[ entry_name ][ func_name ].each{ |rn| 2971 if region_name_list.include? rn then 2972 # p func_name 2973 name = func_name ? entry_name : entry_name+"."+func_name 2974 cdl_warning( "W9999 $1 restrict region duplicate $2", name, rn ) 3055 if @restrict_list[ entry_name ] == nil then 3056 @restrict_list[ entry_name ] = {} 3057 @restrict_list2[ entry_name ] = {} 3058 end 3059 if @restrict_list[ entry_name ][ func_name ] == nil then 3060 @restrict_list[ entry_name ][ func_name ] = [] 3061 @restrict_list2[ entry_name ][ func_name ] = [] 3062 end 3063 region_name_list.each { |rp| 3064 @restrict_list[ entry_name ][ func_name ] << rp 3065 # p "Class: " + rp.to_s 3066 obj = Namespace.find rp 3067 if ( obj.kind_of? Region ) then 3068 @restrict_list2[ entry_name ][ func_name ] << obj.get_domain_root 3069 else 3070 cdl_error( "S9999 $1 not found or not region", rp.to_s ) 3071 end 3072 } 3073 end 3074 3075 #=== Cell#check_restrict_list 3076 def check_restrict_list 3077 # p "check_restrict_list" 3078 @restrict_list.each{ |entry_name, func_hash| 3079 func_hash.each{ |func_name, region_list| 3080 region_list.each{ |rp| 3081 obj = Namespace.find rp 3082 if ( obj.kind_of? Region ) then 3083 if obj.get_domain_root != @region.get_domain_root then 3084 else 3085 cdl_info( "I9999 $1: restrict calling domain to $2, which is same domain as the cell locates", @name, rp.to_s ) 3086 # restrict を同じドメインを指定してもよいこととする (HRP3) 3087 # KernelDoamin 内のセルに対し、KernelDomain に restrict している場合、 3088 # 無所属経由で結合されているが、KernelDomain から呼出すことを想定した許可 3089 end 3090 else 3091 cdl_error( "S9999 $1 not region", rp.to_s ) 3092 end 3093 } 3094 } 3095 } 3096 end 3097 3098 #=== Cell#callable? 3099 def callable?( callee_cell, entry_name, func_name ) 3100 # p "callable? #{@name}" 3101 res = callee_cell.callable_from?( entry_name, func_name, self ) 3102 dbgPrint "callable? #{callee_cell.get_namespace_path}.#{entry_name}.#{func_name} from #{@NamespacePath} is #{res}\n" 3103 return res 3104 end 3105 3106 #=== Cell#callable_from? (private) 3107 def callable_from?( entry_name, func_name, caller_cell ) 3108 @b_restrict_referenced = true 3109 if @restrict_list.length == 0 then 3110 return true 3111 end 3112 3113 dr = caller_cell.get_region.get_domain_root 3114 if @restrict_list[entry_name] then 3115 if @restrict_list[entry_name][func_name] then 3116 @restrict_list2[entry_name][func_name].each{ |region| 3117 if dr == region then 3118 return true 3119 end 3120 } 3121 elsif @restrict_list[entry_name][nil] then 3122 @restrict_list2[entry_name][nil].each{ |region| 3123 if dr == region then 3124 return true 2975 3125 end 2976 3126 } 2977 3127 else 2978 @restrict_list[ entry_name ][ func_name ] = region_name_list 2979 end 2980 else 2981 func_list = { } 2982 func_list[ func_name ] = region_name_list 2983 @restrict_list[ entry_name ] = func_list 2984 end 2985 # pp @restrict_list 2986 end 2987 2988 #=== Cell#check_restrict_list 2989 def check_restrict_list 2990 @restrict_list.each{ |entry_name, func_hash| 2991 func_hash.each{ |func_name, region_list| 2992 region_list.each{ |rn| 2993 obj = Namespace.find [ rn ] 2994 if ( obj.kind_of? Region ) then 2995 if obj.get_domain_root != @region.get_domain_root then 2996 else 2997 cdl_warning( "W9999 $1 in same domain", rn ) 2998 end 2999 else 3000 cdl_error( "S9999 $1 not region", region ) 3001 end 3002 } 3003 } 3004 } 3005 end 3006 3007 #=== Cell#callable? 3008 def callable?( callee_cell, entry_name, func_name ) 3009 res = callee_cell.callable_from?( entry_name, func_name, self ) 3010 dbgPrint "callable? #{callee_cell.get_namespace_path}.#{entry_name}.#{func_name} from #{@NamespacePath} is #{res}\n" 3011 return res 3012 end 3013 3014 #=== Cell#callable_from? (private) 3015 def callable_from?( entry_name, func_name, caller_cell ) 3016 if @restrict_list.length == 0 then 3128 return false 3129 end 3130 else 3131 return false 3132 end 3133 end 3134 3135 #=== Cell#get_callable_regions( entry_name, func_name ) 3136 # func_name=nil の場合、entry_name の可否をチェック数る 3137 # nil が返る場合、制限されていないことを意味する 3138 def get_restricted_regions( entry_name, func_name ) 3139 # p "get_restricted_regions #{@name}" 3140 @b_restrict_referenced = true 3141 if @restrict_list[entry_name] then 3142 if @restrict_list[entry_name][func_name] then 3143 return @restrict_list2[entry_name][func_name] 3144 else 3145 return @restrict_list2[entry_name][nil] 3146 end 3147 end 3148 return nil 3149 end 3150 3151 #=== Cell#has_ineffective_restrict_specifier 3152 # restrict 指定子が指定されていて、参照されていない場合 true 3153 # 参照は、HRPSVCPlugin のみ 3154 def has_ineffective_restrict_specifier 3155 if @restrict_list.length != 0 && @b_restrict_referenced == false then 3017 3156 return true 3018 end 3019 3020 if @restrict_list[entry_name] then 3021 if @restrict_list[entry_name][nil] && 3022 @restrict_list[entry_name][nil].include?( caller_cell.get_region.get_domain_root.get_name )then 3023 return true 3024 end 3025 if @restrict_list[entry_name][func_name] && 3026 @restrict_list[entry_name][func_name].include?( caller_cell.get_region.get_domain_root.get_name )then 3027 return true 3028 else 3029 return false 3030 end 3031 else 3032 return true 3033 end 3034 end 3035 3157 else 3158 return false 3159 end 3160 end 3161 3036 3162 def show_tree( indent ) 3037 3163 indent.times { print " " } … … 3709 3835 end 3710 3836 3837 def get_global_name 3838 @global_name 3839 end 3840 3711 3841 def get_port_list 3712 3842 @port_list … … 3723 3853 def get_internal_allocator_list 3724 3854 @internal_allocator_list 3855 end 3856 3857 #== CompositeCelltype#get_real_celltype 3858 # port_name に接続されている内部のセルタイプを得る 3859 def get_real_celltype( port_name ) 3860 cj = find_export port_name 3861 inner_celltype = cj.get_cell.get_celltype 3862 if inner_celltype.instance_of? CompositeCelltype then 3863 return inner_celltype.get_real_celltype 3864 else 3865 return inner_celltype 3866 end 3725 3867 end 3726 3868 … … 3936 4078 else 3937 4079 # entry port optimize 3938 if $unopt then4080 if $unopt || $unopt_entry then 3939 4081 # 最適化なし 3940 4082 @b_VMT_useless = false # VMT 不要 (true の時 VMT を介することなく呼出す) … … 4260 4402 4261 4403 def is_VMT_useless? # VMT 関数テーブルを使用しない 4262 @b_VMT_useless 4404 if @port_type == :ENTRY && $unopt_entry == true then 4405 # プラグインから $unopt_entry を設定するケースのため 4406 # ここで読み出すときに、false を返す (reset_optimize での設定変更は速すぎる) 4407 return false 4408 else 4409 return @b_VMT_useless 4410 end 4263 4411 end 4264 4412 4265 4413 def is_skelton_useless? # スケルトン関数不要 (true の時、受け口関数を呼出す) 4266 @b_skelton_useless 4414 if @port_type == :ENTRY && $unopt_entry == true then 4415 # プラグインから $unopt_entry を設定するケースのため 4416 # ここで読み出すときに、false を返す (reset_optimize での設定変更は速すぎる) 4417 return false 4418 else 4419 return @b_skelton_useless 4420 end 4267 4421 end 4268 4422 … … 4801 4955 if ! c.get_f_def then # Namespace の @cell_list にはプロトタイプが含まれるケースあり 4802 4956 if c.get_f_ref then 4803 c dl_error( "S1093 $1 : undefined cell" , c.get_namespace_path.get_path_str )4957 c.cdl_error( "S1093 $1 : undefined cell" , c.get_namespace_path.get_path_str ) 4804 4958 elsif $verbose then 4805 c dl_warning( "W1006 $1 : only prototype, unused and undefined cell" , c.get_namespace_path.get_path_str )4959 c.cdl_warning( "W1006 $1 : only prototype, unused and undefined cell" , c.get_namespace_path.get_path_str ) 4806 4960 end 4807 4961 else … … 4810 4964 # if c.get_f_ref == false && c.is_generate? && ct && ct.is_inactive? then 4811 4965 if c.get_f_ref == false && ct && ct.is_inactive? then 4812 cdl_warning( "W1007 $1 : non-active cell has no entry join and no factory" , c.get_namespace_path.get_path_str ) 4966 c.cdl_warning( "W1007 $1 : non-active cell has no entry join and no factory" , c.get_namespace_path.get_path_str ) 4967 end 4968 if c.has_ineffective_restrict_specifier then 4969 c.cdl_warning( "W9999: $1 has ineffective restrict specifier", c.get_namespace_path.get_path_str ) 4813 4970 end 4814 4971 end … … 5005 5162 end 5006 5163 5164 #== Namespace (Region) に属するセルのリスト 5165 def get_cell_list 5166 @cell_list 5167 end 5168 5169 #== Namespace (Region)# 子リージョンのリスト 5170 # 5171 # リージョンは Namespace クラスで namespace として記憶されている 5172 def get_region_list 5173 @namespace_list 5174 end 5175 5007 5176 def show_tree( indent ) 5008 5177 indent.times { print " " } … … 5601 5770 next_cell_nsp = @through_generated_list[ i + 1 ].get_cell_namespace_path 5602 5771 next_port_name = @through_generated_list[ i + 1 ].get_through_entry_port_name 5772 next_port_subscript = @through_generated_list[ i + 1 ].get_through_entry_port_subscript 5603 5773 rescue Exception => evar 5604 5774 cdl_error( "S1124 $1: plugin function failed: \'get_through_entry_port_name\'" , plugin_name ) … … 5619 5789 next_cell = @cell 5620 5790 next_port_name = @port_name 5791 next_port_subscript = @rhs_subscript 5621 5792 5622 5793 if next_cell == nil then … … 5630 5801 # region から @cell_name.@port_name への through がないか探す 5631 5802 # rp = @through_list[i][3].find_cell_port_through_plugin( @cell_name, @port_name ) #762 5632 rp = @through_list[i][3].find_cell_port_through_plugin( @cell.get_global_name, @port_name )5803 rp = @through_list[i][3].find_cell_port_through_plugin( @cell.get_global_name, @port_name, @rhs_subscript ) 5633 5804 # @through_list[i] と @region_through_list[i-cp_len] は同じ 5634 5805 # 共用しないようにするには、見つからなかったことにすればよい … … 5643 5814 plClass = load_plugin( plugin_name, ThroughPlugin ) 5644 5815 if( plClass ) then 5645 gen_through_cell_code_and_parse( plugin_name, i, next_cell, next_port_name, plClass )5816 gen_through_cell_code_and_parse( plugin_name, i, next_cell, next_port_name, next_port_subscript, plClass ) 5646 5817 end 5647 5818 else … … 5656 5827 # 生成したものを region(@through_list[i][3]) のリストに追加 5657 5828 # @through_list[i][3].add_cell_port_through_plugin( @cell_name, @port_name, @through_generated_list[i] ) #762 5658 @through_list[i][3].add_cell_port_through_plugin( @cell.get_global_name, @port_name, @ through_generated_list[i] )5829 @through_list[i][3].add_cell_port_through_plugin( @cell.get_global_name, @port_name, @rhs_subscript, @through_generated_list[i] ) 5659 5830 end 5660 5831 end … … 5690 5861 5691 5862 #=== Join# through プラグインを呼び出して CDL 生成させるとともに、import する 5692 def gen_through_cell_code_and_parse( plugin_name, i, next_cell, next_port_name, plClass )5863 def gen_through_cell_code_and_parse( plugin_name, i, next_cell, next_port_name, next_port_subscript, plClass ) 5693 5864 5694 5865 through = @through_list[ i ] … … 5717 5888 5718 5889 begin 5719 plugin_object = plClass.new( "#{generating_cell_name}".to_sym, plugin_arg.to_s, next_cell, "#{next_port_name}".to_sym, @definition.get_signature, @celltype, caller_cell ) 5890 plugin_object = plClass.new( generating_cell_name.to_sym, plugin_arg.to_s, 5891 next_cell, next_port_name.to_sym, next_port_subscript, 5892 @definition.get_signature, @celltype, caller_cell ) 5720 5893 plugin_object.set_locale @locale 5721 5894 rescue Exception => evar … … 5912 6085 end 5913 6086 5914 def get_rhs_subscript 6087 # 末尾数字1 : CDL で指定された、右辺のセルを返す 6088 def get_rhs_cell1 # get_cell と同じ 6089 @cell 6090 end 6091 def get_rhs_port1 # get_port_name 同じ 6092 @port_name 6093 end 6094 def get_rhs_subscript1 5915 6095 @rhs_subscript 5916 6096 end … … 5922 6102 # through 指定あり? 5923 6103 if @through_list[0] then 5924 # mikan through で生成したものが root namespace 限定5925 6104 # through で生成されたセルを探す 5926 # cell = Namespace.find( [ "::", @through_generated_list[0].get_cell_name.to_sym ] ) #15927 6105 cell = Namespace.find( @through_generated_list[0].get_cell_namespace_path ) #1 5928 6106 # cell のプラグインで生成されたポート名のポートを探す (composite なら内部の繋がるポート) … … 5931 6109 # ポートを返す(composite なら内部の繋がるポートを返す) 5932 6110 return @cell.get_real_port( @port_name ) 6111 end 6112 end 6113 6114 #=== Join# 右辺の配列添数を得る 6115 # 右辺が through の場合は挿入されたセルの添数 6116 # 右辺が composite の場合は、内部の繋がるセルのポートの添数 (composite では変わらない) 6117 # このメソッドは get_rhs_cell, と対になっている 6118 def get_rhs_subscript 6119 if @through_list[0] then 6120 return @through_generated_list[0].get_through_entry_port_subscript 6121 else 6122 return @rhs_subscript 5933 6123 end 5934 6124 end … … 6568 6758 end 6569 6759 6570 #== Domain 6760 #== DomainType 6571 6761 # 6572 6762 # region の domain を記憶するクラス … … 6607 6797 return if pluginClass == nil 6608 6798 @plugin = pluginClass.new( @region, @name, @option ) 6799 @plugin.set_locale @locale 6609 6800 end 6610 6801 end … … 6624 6815 end 6625 6816 6626 #== Domain リージョンの Hash を得る6817 #== DomainType リージョンの Hash を得る 6627 6818 # @@domain_regions の説明参照 6628 6819 def self.get_domain_regions … … 6636 6827 def get_option 6637 6828 @option 6829 end 6830 6831 #== DomainType#ドメイン種別を得る 6832 #return::Symbol :kernel, :user, :OutOfDomain 6833 def get_kind 6834 @plugin.get_kind 6638 6835 end 6639 6836 … … 6697 6894 6698 6895 if @@domain_name then 6896 dbgPrint "Region=#{name} domain_type=#{@@domain_name} option=#{@@domain_option}\n" 6699 6897 domain_option = CDLString.remove_dquote @@domain_option.to_s 6700 6898 @domain_type = DomainType.new( self, @@domain_name, domain_option ) … … 6945 7143 end 6946 7144 7145 #== Region# ルートリージョン 7146 # ルートリージョンは、namespace のルートと同じインスタンス 7147 def selfget_root 7148 Namespace.get_root 7149 end 7150 6947 7151 def next_in_through_count 6948 7152 @in_through_count += 1 … … 6978 7182 #=== Region# through プラグインで、この region から cell_name.port_name へのプラグインオブジェクトを登録 6979 7183 # mikan namesppace 対応 (cell_name) 6980 def add_cell_port_through_plugin( cell_name, port_name, through_plugin_object ) 6981 @cell_port_throug_plugin_list[ "#{cell_name}.#{port_name}" ] = through_plugin_object 6982 end 6983 6984 def find_cell_port_through_plugin( cell_name, port_name ) 6985 return @cell_port_throug_plugin_list[ "#{cell_name}.#{port_name}" ] 7184 def add_cell_port_through_plugin( cell_name, port_name, subscript, through_plugin_object ) 7185 if subscript then 7186 subscript = '[' + subscript.to_s + ']' 7187 end 7188 @cell_port_throug_plugin_list[ "#{cell_name}.#{port_name}#{subscript}" ] = through_plugin_object 7189 end 7190 7191 def find_cell_port_through_plugin( cell_name, port_name, subscript ) 7192 if subscript then 7193 subscript = '[' + subscript.to_s + ']' 7194 end 7195 return @cell_port_throug_plugin_list[ "#{cell_name}.#{port_name}#{subscript}" ] 6986 7196 end 6987 7197 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/ctypes.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 122 122 # TECS には long double を表現する手段がない (double80_t を定義すればよいか?) 123 123 # cdl_warning( "C1003 $1 & $2 incompatible (\'long double\' is not supported.). Treated as $3." , self.class, another.class, self.class ) 124 cdl_warning( "W9999 $1 & $2 incompatible (\'long double\' is not supported.). Treated as $3." , self.get_type_str, another.get_type_str, self.get_type_str ) 124 # cdl_warning( "W9999 $1 & $2 incompatible (\'long double\' is not supported.). Treated as $3." , self.get_type_str, another.get_type_str, self.get_type_str ) 125 self.to_long 125 126 return self 126 127 else … … 185 186 end 186 187 188 def to_long 189 if @bit_size != -64 then 190 cdl_warning( "W9999 long specified for $1" , get_type_str ) 191 else 192 @bit_size = -128 # @bit_size = -128 : long double 193 end 194 end 187 195 end 188 196 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/expression.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/generate.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 7by TOPPERS Project6 # Copyright (C) 2008-2019 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 122 122 123 123 class Namespace 124 @@domain_gen_factory_list = nil 124 125 def generate 125 126 … … 135 136 return 136 137 end 138 if instance_of? Region then 139 @@domain_gen_factory_list = {} # create hash 140 end 137 141 end 138 142 … … 141 145 gen_global_header 142 146 147 if ( instance_of? Region ) && get_domain_type != nil then 148 # p "******************* domain_type: #{get_domain_type.get_name} ****************" 149 domain_type = get_domain_type 150 if @@domain_gen_factory_list[ domain_type ] == nil then 151 @@domain_gen_factory_list[ domain_type ] = self 152 domain_type.gen_factory 153 end 154 end 155 143 156 # signature のコードを生成 144 157 @signature_list.each { |s| … … 455 468 } 456 469 end 457 f.print " rm -f $(CELLTYPE_COBJS) $(TECSGEN_COBJS) $(PLUGIN_COBJS) $(OTHER_OBJS) $(TARGET) #{timestamp}\n"470 f.print " rm -f $(CELLTYPE_COBJS) $(TECSGEN_COBJS) $(PLUGIN_COBJS) $(OTHER_OBJS) $(TARGET) #{timestamp}\n" 458 471 if $generating_region == @@root_namespace then 459 472 f.print " rm -rf $(GEN_DIR)\n" … … 465 478 f.print "tecs : $(PRE_TECSGEN_TARGET) $(TIMESTAMP) $(POST_TECSGEN_TARGET)\n\n" 466 479 f.print "$(TIMESTAMP) : $(TECS_IMPORTS)\n" 467 f.print " $(TECSGEN) #{TECSGEN.subst_tecspath( $arguments, true )}\n "480 f.print " $(TECSGEN) #{TECSGEN.subst_tecspath( $arguments, true )}\n\n" 468 481 # f.print " touch $(TIMESTAMP)\n\n" 469 470 482 else 471 483 f.print "tecs:\n" … … 473 485 end 474 486 487 # tecsflow:, tcflow ターゲット 488 if $generating_region.get_n_cells != 0 || $generating_region == @@root_namespace then 489 f.print "##### TECSFlow targets #####\n" 490 end 491 492 if Region.get_link_roots.length > 1 && $generating_region == @@root_namespace then 493 tecsflow_target = "tecsflow_sub" 494 if $generating_region.get_n_cells > 0 then 495 f.print "tecsflow: tecs tecsflow_sub\n" 496 else 497 f.print "tecsflow:\n" 498 end 499 Region.get_link_roots.each {|region| 500 if region.get_n_cells > 0 then 501 f.print "\tcd #{region.get_global_name}; make tecsflow\n" 502 end 503 } 504 f.print "\n" 505 else 506 tecsflow_target = "tecsflow" 507 end 508 509 if $generating_region.get_n_cells != 0 then 510 f.print "#{tecsflow_target} : $(GEN_DIR)/tecsgen.rbdmp tcflow\n" 511 f.print "\ttecsflow -g $(GEN_DIR)\n\n" 512 f.print "tecsflow_u : $(GEN_DIR)/tecsgen.rbdmp tcflow\n" 513 f.print "\ttecsflow -g $(GEN_DIR) -U\n\n" 514 f.print "$(GEN_DIR)/tecsgen.rbdmp : tecs\n\n" 515 f.print "tcflow : tecs\n" 516 f.print "\tmake tcflow_exec\n\n" 517 f.print "tcflow_exec : $(GEN_DIR)/tcflow.rbdmp\n" 518 f.print "$(GEN_DIR)/tcflow.rbdmp : $(CELLTYPE_SRCS) $(PLUGIN_CELLTYPE_SRCS)\n" 519 f.print "\ttcflow -g $(GEN_DIR) -c '$(CC) -E -DTECSFLOW -DTECSGEN $(CFLAGS) -I ./' $^\n" 520 end 521 522 if $generating_region.get_n_cells != 0 || $generating_region == @@root_namespace then 523 f.print "##### end TECSFlow targets #####\n\n" 524 end 525 526 # generic %.o : %.c 475 527 f.print "# generic target for objs\n" 476 528 f.print "$(_TECS_OBJ_DIR)%.o : %.#{$c_suffix}\n" … … 492 544 ### Makefile.tecsgen の生成 493 545 f = AppFile.open( "#{$gen}/Makefile.tecsgen" ) 546 547 f.print <<EOT 548 # generated automatically by tecsgen. 549 # This file is not intended to modify. 550 # 551 # Makefile variables below are defined. 552 # TECS_IMPORT_CDLS .cdl files improted by import statement 553 # SIGNATURE_HEADERS .h files of signature 554 # CELLTYPE_TECSGEN_HEADERS .h files of celltype 555 # CELLTYPE_FACTORY_HEADERS .h files of celltype's factory 556 # TECS_HEADERS summary of .h files above 557 # TECS_INLINE_HEADERS .h files of celltype inline header 558 # PLUGIN_INLINE_HEADERS .h files of plugin generated inline header 559 # 560 # TECS_COBJS .o files of TECS 561 # = $(TECSGEN_COBJS)+$(PLUGIN_COBJS)+$(CELLTYPE_COBJS) 562 # = $(TECS_KERNEL_COBJS)+$(TECS_KERNEL_COBJS)+$(TECS_OUTOFDOMAIN_COBJS) 563 # = $(TECSGEN_domain_COBJS)+$(PLUGIN_domain_COBJS)+$(CELLTYPE_domain_COBJS) for each domain 564 # 565 # TECSGEN_COBJS .o files of celltype_tecsgen.c 566 # CELLTYPE_COBJS .o files of celltype.c (celltype code) 567 # PLUGIN_COBJS .o files of plugin generated .c files 568 # 569 # TECSGEN_SRCS .c files of celltype_tecsgen.c 570 # CELLTYPE_SRCS .c files of celltype.c (celltype code) 571 # PLUGIN_SRCS .c files of plugin generated 572 # PLUGIN_CELLTYPE_SRCS .c files of plugin generated celltype.c (celltype code) 573 # PLUGIN_TECSGEN_SRCS .c files of plugin generated celltype_tecsgen.c 574 # 575 # Variables for domain 576 # TECS_DOMAINS domain names 577 # TECS_KERNEL_COBJS .o files of kernel domain (tecsgen, celltype, plugin) 578 # TECS_USER_COBJS .o files of user domain (tecsgen, celltype, plugin) 579 # TECS_OUTOFDOMAIN_COBJS .o files of OutOfDomain (tecsgen, celltype, plugin) 580 # TECSGEN_domain_COBJS .o files of celltype_tecsgen.c files for each domain 581 # PLUGIN_domain_COBJS .o files of plugin generated .c files for each domain 582 # CELLTYPE_domain_COBJS .o files of celltype.c files for each domain 583 # TECSGEN_domain_SRCS .c files of celltype_domain_tecsgen.c 584 # PLUGIN_domain_SRCS .c files of plugin generated .c files for each domain 585 # CELLTYPE_domain_SRCS .c files of celltype.c files for each domain 586 587 EOT 494 588 495 589 f.print( "TECS_IMPORT_CDLS =" ) … … 546 640 DomainType.get_domain_regions.each{ |dt, regions| 547 641 # domain_type は一つのノードには、一つしかないので、このループは、必ず一回しか回らない 642 ### mikan 複数のノードがあり、異なる domain_type が指定される可能性はある 548 643 domain_regions = regions 549 644 domain_type = dt … … 588 683 f.print( "\n\n" ) 589 684 590 f.print( "# TECS_COBJS: objects from sources which are automatically generated by tecsgen\n" ) 685 f.print( "# TECS_KERNEL_COBJS: objects belong to kernel domain\n" ) 686 f.print( "TECS_KERNEL_COBJS = \\\n" ) 687 domain_regions.each{ |r| 688 if r.get_domain_type.get_kind == :kernel then 689 f.print( " $(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n" ) 690 f.print( " $(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n" ) 691 f.print( " $(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n" ) 692 end 693 } 694 f.print( "# TECS_KERNEL_COBJS terminator\n\n" ) 695 696 f.print( "# TECS_USER_COBJS: objects belong to user domain\n" ) 697 f.print( "TECS_USER_COBJS = \\\n" ) 698 domain_regions.each{ |r| 699 if r.get_domain_type.get_kind == :user then 700 f.print( " $(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n" ) 701 f.print( " $(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n" ) 702 f.print( " $(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n" ) 703 end 704 } 705 f.print( "# TECS_USER_COBJS terminator\n\n" ) 706 707 f.print( "# TECS_OUTOFDOMAIN_COBJS: objects belong to OutOfDomain\n" ) 708 f.print( "TECS_OUTOFDOMAIN_COBJS = \\\n" ) 709 domain_regions.each{ |r| 710 if r.get_domain_type.get_kind == :OutOfDomain then 711 f.print( " $(TECSGEN#{decideDomainNameProc.call r}_COBJS) \\\n" ) 712 f.print( " $(PLUGIN#{decideDomainNameProc.call r}_COBJS) \\\n" ) 713 f.print( " $(CELLTYPE#{decideDomainNameProc.call r}_COBJS) \\\n" ) 714 end 715 } 716 f.print( "# TECS_OUTOFDOMAIN_COBJS terminator\n\n" ) 717 718 f.print( "# TECSGEN_COBJS: objects from sources which are automatically generated by tecsgen\n" ) 591 719 f.print( "TECSGEN_COBJS = \\\n" ) 592 720 domain_regions.each{ |r| … … 622 750 623 751 ### 624 f.print( "# TECS _COBJS: objects from sources which are automatically generated by tecsgen\n" )752 f.print( "# TECSGEN_COBJS: objects from sources which are automatically generated by tecsgen\n" ) 625 753 domain_regions.each{ |r| 626 754 nsp = decideDomainNameProc.call( r ) … … 656 784 657 785 f.print( "# PLUGIN_SRCS: sources automatically generated by plugin\n" ) 786 f.print( "PLUGIN_CELLTYPE_SRCS = \\\n" ) 658 787 domain_regions.each{ |r| 659 788 nsp = decideDomainNameProc.call( r ) 660 f.print( "PLUGIN#{nsp}_SRCS = \\\n" ) 661 gen_celltype_names_domain( f, " $(GEN_DIR)/", "_tecsgen.#{$c_suffix} \\\n", domain_type, r, true ) 662 gen_celltype_names_domain2( f, " $(GEN_DIR)/", ".#{$c_suffix} \\\n", domain_type, r, true, false ) 663 f.print( "# PLUGIN#{nsp}_SRCS terminator\n\n" ) 664 } 665 789 f.print( " $(PLUGIN#{nsp}_CELLTYPE_SRCS)\\\n" ) 790 } 791 f.print( "# PLUGIN_CELLTYPE_SRCS terminator\n\n" ) 792 f.print( "PLUGIN_TECSGEN_SRCS = \\\n" ) 793 domain_regions.each{ |r| 794 nsp = decideDomainNameProc.call( r ) 795 f.print( " $(PLUGIN#{nsp}_TECSGEN_SRCS)\\\n" ) 796 } 797 f.print( "# PLUGIN_TECSGEN_SRCS terminator\n\n" ) 798 domain_regions.each{ |r| 799 nsp = decideDomainNameProc.call( r ) 800 f.print( "PLUGIN#{nsp}_SRCS = $(PLUGIN#{nsp}_CELLTYPE_SRCS) $(PLUGIN#{nsp}_TECSGEN_SRCS)\n\n" ) 801 f.print( "PLUGIN#{nsp}_CELLTYPE_SRCS = \\\n" ) 802 gen_celltype_names_domain2( f, "", ".#{$c_suffix} \\\n", domain_type, r, true, false ) 803 f.print( "# PLUGIN#{nsp}_CELLTYPE_SRCS terminator\n\n" ) 804 nsp = decideDomainNameProc.call( r ) 805 f.print( "PLUGIN#{nsp}_TECSGEN_SRCS = \\\n" ) 806 gen_celltype_names_domain( f, "", "_tecsgen.#{$c_suffix} \\\n", domain_type, r, true ) 807 f.print( "# PLUGIN#{nsp}_TECSGEN_SRCS terminator\n\n" ) 808 } 809 810 f.print( "# CELLTYPE_SRCS: sources of celltype code written by user\n" ) 811 f.print( "CELLTYPE_SRCS = \\\n" ) 812 gen_celltype_names( f, " ", ".#{$c_suffix} \\\n", false, false ) 813 f.print( "# CELLTYPE_SRCS terminator\n\n" ) 666 814 f.close 667 815 … … 779 927 @namespace_list.each{ |ns| 780 928 ns.travers_all_signature_proc proc 929 } 930 end 931 932 #=== Namespace#すべてのセルタイプをたどる 933 def travers_all_celltype # ブロック引数 { |celltype| } 934 proc = Proc.new # このメソッドのブロック引数 935 @celltype_list.each{ |ct| 936 proc.call ct 937 } 938 @namespace_list.each{ |ns| 939 ns.travers_all_celltype_proc proc 940 } 941 end 942 def travers_all_celltype_proc proc 943 @celltype_list.each{ |ct| 944 proc.call ct 945 } 946 @namespace_list.each{ |ns| 947 ns.travers_all_celltype_proc proc 781 948 } 782 949 end … … 1023 1190 gen_ph_get_cellcb f 1024 1191 gen_ph_attr_access f if @n_attribute_rw > 0 || @n_attribute_ro > 0 || @n_var > 0 1025 gen_ph_cp_fun_macro f if @n_call_port > 0 1192 f.print "#ifndef TECSFLOW\n" 1193 gen_ph_cp_fun_macro f, false if @n_call_port > 0 1194 f.print "#else /* TECSFLOW */\n" 1195 gen_ph_cp_fun_macro f, true if @n_call_port > 0 1196 f.print "#endif /* TECSFLOW */\n" 1026 1197 # gen_ph_abstract_ep_des_type f 1027 1198 … … 1247 1418 def gen_ph_info f 1248 1419 1420 yn_multi_domain = "no" 1421 yn_multi_domain = "yes" if multi_domain? 1249 1422 yn_idx_is_id = "no" 1250 1423 yn_idx_is_id = "yes" if @idx_is_id … … 1255 1428 yn_rom = "no" 1256 1429 yn_rom = "yes" if $rom 1430 yn_has_CB = "no" 1431 yn_has_CB = "yes" if has_CB? 1432 yn_has_INIB = "no" 1433 yn_has_INIB = "yes" if has_INIB? 1257 1434 yn_cb_init = "no" 1258 1435 yn_cb_init = "yes" if need_CB_initializer? … … 1263 1440 * celltype : #{@name} 1264 1441 * global name : #{@global_name} 1442 * multi-domain : #{yn_multi_domain} 1265 1443 * idx_is_id(actual) : #{yn_idx_is_id}(#{yn_idx_is_id_act}) 1266 1444 * singleton : #{yn_singleton} 1267 * has_CB : #{ has_CB?}1268 * has_INIB : #{ has_INIB?}1445 * has_CB : #{yn_has_CB} 1446 * has_INIB : #{yn_has_INIB} 1269 1447 * rom : #{yn_rom} 1270 1448 * CB initializer : #{yn_cb_init} … … 1595 1773 f.print( "#define #{@global_name}_GET_CELLCB(idx) ((void *)0)\n" ) 1596 1774 elsif @idx_is_id_act then # mikan 単一のセルの場合の最適化, idx_is_id でない場合 1597 f.print( "#define #{@global_name}_GET_CELLCB(idx) (#{@global_name}_CB_ tab[(idx) - #{@global_name}_ID_BASE])\n" )1775 f.print( "#define #{@global_name}_GET_CELLCB(idx) (#{@global_name}_CB_ptab[(idx) - #{@global_name}_ID_BASE])\n" ) 1598 1776 else 1599 1777 f.print( "#define #{@global_name}_GET_CELLCB(idx) (idx)\n" ) … … 1799 1977 end 1800 1978 1801 def gen_ph_cp_fun_macro f 1802 if @n_call_port >0 then1979 def gen_ph_cp_fun_macro f, b_flow 1980 if @n_call_port >0 && b_flow == false then 1803 1981 f.printf( TECSMsg.get( :CPM_comment ) , "#_CPM_#" ) 1804 1982 end … … 1856 2034 1857 2035 # 関数名の出力(標準:受け口ディスクリプタから VMT の関数名、最適化:受け口関数 or 受け口ディスクリプタ) 1858 if ! p.is_VMT_useless? then 2036 if b_flow then 2037 f.print( "\t (p_that)->#{p.get_name}#{subsc}.#{fun.get_name}__T( \\\n" ) 2038 elsif ! p.is_VMT_useless? then 1859 2039 # 標準コード 1860 2040 if @singleton then … … 1891 2071 1892 2072 # 受け口情報の出力(標準:受け口ディスクリプタ、最適化:IDX など) 1893 if ! p.is_skelton_useless? && ! p.is_cell_unique? then 2073 if b_flow then 2074 elsif ! p.is_skelton_useless? && ! p.is_cell_unique? then 1894 2075 # 標準コード 1895 2076 if @singleton then … … 1969 2150 p_cellcb = " #{@global_name}_CB *p_cellcb = p_that;\n" 1970 2151 delim = ", " 1971 cb = "p_ that#{inib}->"2152 cb = "p_cellcb#{inib}->" 1972 2153 end 1973 2154 … … 2616 2797 f.print "extern #{@global_name}_INIB #{@global_name}_SINGLE_CELL_INIB;\n" 2617 2798 end 2618 2619 # @ordered_cell_list.each{ |c|2620 # f.print "extern #{@global_name}_CB #{@global_name}_#{c.get_name}_CB;\n"2621 # }2622 2623 2799 f.print "\n" 2624 elsif @idx_is_id_act then 2625 f.print "extern #{@global_name}_CB *#{@global_name}_CB_tab[];\n" 2800 elsif @b_need_ptab then 2801 f.printf( TECSMsg.get( :SCP_comment ), "#_MCPP_#" ) 2802 if has_CB? then 2803 f.print "extern #{@global_name}_CB *const #{@global_name}_CB_ptab[];\n" 2804 @ordered_cell_list.each{ |c| 2805 if c.is_generate? then # 生成対象か? 2806 name_array = get_name_array c 2807 f.print "extern #{@global_name}_CB #{name_array[4]};\n" 2808 end 2809 } 2810 elsif has_INIB? 2811 f.print "extern #{@global_name}_INIB *const #{@global_name}_INIB_ptab[];\n" 2812 @ordered_cell_list.each{ |c| 2813 if c.is_generate? then # 生成対象か? 2814 name_array = get_name_array c 2815 f.print "extern #{@global_name}_INIB #{name_array[11]};\n" 2816 end 2817 } 2818 end 2626 2819 else 2627 f.print "extern #{@global_name}_CB #{@global_name}_CB_tab[];\n" 2820 f.printf( TECSMsg.get( :SCP_comment ), "#_MCPB_#" ) 2821 if has_CB? then 2822 f.print "extern #{@global_name}_CB #{@global_name}_CB_tab[];\n" 2823 elsif has_INIB? 2824 f.print "extern #{@global_name}_INIB #{@global_name}_INIB_tab[];\n" 2825 end 2628 2826 end 2629 2827 end 2630 2828 2631 2829 def gen_ph_INIB_as_CB f 2632 2830 # ここは、手抜きである。本来なら INIB を出力すべき 2633 2831 if ! has_CB? && has_INIB? then 2634 2832 f.printf( TECSMsg.get( :DCI_comment ), "#_DCI_#" ) 2635 f.print "#define #{@global_name}_CB_tab #{@global_name}_INIB_tab\n" 2636 f.print "#define #{@global_name}_SINGLE_CELL_CB #{@global_name}_SINGLE_CELL_INIB\n" 2833 if @singleton then 2834 f.print "#define #{@global_name}_SINGLE_CELL_CB #{@global_name}_SINGLE_CELL_INIB\n" 2835 elsif @b_need_ptab then 2836 f.print "#define #{@global_name}_CB_ptab #{@global_name}_INIB_ptab\n" 2837 else 2838 f.print "#define #{@global_name}_CB_tab #{@global_name}_INIB_tab\n" 2839 end 2637 2840 f.print "#define #{@global_name}_CB #{@global_name}_INIB\n" 2638 2841 f.print "#define tag_#{@global_name}_CB tag_#{@global_name}_INIB\n" … … 2658 2861 f.printf( TECSMsg.get( :FEC_comment ), "#_FEC_#" ) 2659 2862 2660 if @ idx_is_id_actthen2863 if @b_need_ptab then 2661 2864 amp = '' 2865 tab = 'ptab' 2662 2866 else 2663 2867 amp = '&' 2868 tab = 'tab' 2664 2869 end 2665 2870 f.print <<EOT 2666 2871 #define FOREACH_CELL(i,p_cb) \\ 2667 2872 for( (i) = 0; (i) < #{@global_name}_N_CELL; (i)++ ){ \\ 2668 #{necessity}(p_cb) = #{amp}#{@global_name}_CB_ tab[i];2873 #{necessity}(p_cb) = #{amp}#{@global_name}_CB_#{tab}[i]; 2669 2874 2670 2875 #define END_FOREACH_CELL } … … 2799 3004 if @singleton then 2800 3005 f.print "\t#{that}_inib = &#{@global_name}_SINGLE_CELL_INIB;\n\n" 2801 elsif @ idx_is_id_act2802 f.print "\t#{that}_inib = #{@global_name}_INIB_ tab[(i)];\n\n"3006 elsif @b_need_ptab then 3007 f.print "\t#{that}_inib = #{@global_name}_INIB_ptab[(i)];\n\n" 2803 3008 else 2804 3009 f.print "\t#{that}_inib = &#{@global_name}_INIB_tab[(i)];\n\n" … … 3397 3602 fs.each{ |r, f| f.print "#{@global_name}_INIB #{@global_name}_SINGLE_CELL_INIB = \n" } 3398 3603 indent = 0 3399 elsif ! @ idx_is_id_actthen3604 elsif ! @b_need_ptab then 3400 3605 fs.each{ |r, f| f.print "#{@global_name}_INIB #{@global_name}_INIB_tab[] = {\n" } 3401 3606 indent = 1 … … 3418 3623 3419 3624 print_indent( f, indent ) 3420 if @ idx_is_id_actthen3625 if @b_need_ptab then 3421 3626 f.print "const #{@global_name}_INIB #{name_array[5]} = " 3422 3627 end … … 3428 3633 unless @singleton then 3429 3634 # 1 つの cell INIB の終わり 3430 if @ idx_is_id_actthen3635 if @b_need_ptab then 3431 3636 f.print( "};\n\n" ) 3432 3637 else … … 3435 3640 end 3436 3641 } 3437 if ! @ idx_is_id_actthen3642 if ! @b_need_ptab then 3438 3643 fs.each{ |r, f| f.print( "};\n\n" ) } 3439 3644 end … … 3450 3655 fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_SINGLE_CELL_CB = \n" } 3451 3656 indent = 0 3452 elsif ! @ idx_is_id_actthen3657 elsif ! @b_need_ptab then 3453 3658 fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_CB_tab[] = {\n" } 3454 3659 indent = 1 … … 3471 3676 3472 3677 print_indent( f, indent ) 3473 if @ idx_is_id_actthen3678 if @b_need_ptab then 3474 3679 f.print "#{@global_name}_CB #{name_array[2]} = " 3475 3680 end … … 3493 3698 unless @singleton then 3494 3699 # 1 つの cell CB の終わり 3495 if @ idx_is_id_actthen3700 if @b_need_ptab then 3496 3701 f.print( "};\n\n" ) 3497 3702 else … … 3500 3705 end 3501 3706 } 3502 if ! @ idx_is_id_actthen3707 if ! @b_need_ptab then 3503 3708 fs.each{ |r, f| f.print( "};\n\n" ) } 3504 3709 end … … 3507 3712 fs.each{ |r, f| f.print "struct tag_#{@global_name}_CB #{@global_name}_SINGLE_CELL_CB;\n" } 3508 3713 indent = 0 3509 elsif @ idx_is_id_actthen3714 elsif @b_need_ptab then 3510 3715 @ordered_cell_list.each{ |c| 3511 3716 next if ! c.is_generate? … … 3526 3731 def gen_cell_cb_tab f 3527 3732 indent = 0 3528 if @ idx_is_id_actthen3733 if @b_need_ptab then 3529 3734 if has_INIB? && ( $ram_initializer || ! has_CB? ) then 3530 3735 f.print "/* ID to INIB table #_INTAB_# */\n" … … 3537 3742 } 3538 3743 3539 f.print "#{@global_name}_INIB * #{@global_name}_INIB_tab[] ={\n"3744 f.print "#{@global_name}_INIB *const #{@global_name}_INIB_ptab[] ={\n" 3540 3745 @ordered_cell_list.each{ |c| 3541 3746 if c.is_generate? then # 生成対象か? … … 3557 3762 } 3558 3763 3559 f.print "#{@global_name}_CB * #{@global_name}_CB_tab[] ={\n"3764 f.print "#{@global_name}_CB *const #{@global_name}_CB_ptab[] ={\n" 3560 3765 @ordered_cell_list.each{ |c| 3561 3766 if c.is_generate? then # 生成対象か? … … 3586 3791 # name_array[9] = @global_name # celltype global name 3587 3792 # name_array[10] = cell.get_global_name # cell global name 3793 # name_array[11] = cell_INIB_proto #INIB name for proto type 3588 3794 3589 3795 def get_name_array( cell ) … … 3594 3800 cell_CB_proto = "#{@global_name}_SINGLE_CELL_CB" 3595 3801 cell_INIB_name = "#{@global_name}_SINGLE_CELL_INIB" 3802 cell_INIB_proto = cell_INIB_name 3596 3803 cell_ID = 0 3597 3804 else 3598 if ! @ idx_is_id_actthen3805 if ! @b_need_ptab then 3599 3806 index = cell.get_id - cell.get_celltype.get_id_base 3600 3807 cell_CB_name = "#{@global_name}_CB_tab[#{index}]" … … 3602 3809 cell_CB_proto = "#{@global_name}_CB_tab[]" 3603 3810 cell_INIB_name = "#{@global_name}_INIB_tab[#{index}]" 3811 cell_INIB_proto = "#{@global_name}_INIB_tab[]" 3604 3812 else 3605 3813 cell_CB_name = "#{cell.get_global_name}_CB" … … 3607 3815 cell_CB_proto = cell_CB_name 3608 3816 cell_INIB_name = "#{cell.get_global_name}_INIB" 3817 cell_INIB_proto = cell_INIB_name 3609 3818 end 3610 3819 cell_ID = cell.get_id 3611 end3612 if @idx_is_id_act then3613 cell_IDX = cell_ID3614 else3615 cell_IDX = "&#{cell_CB_name}"3616 3820 end 3617 3821 … … 3622 3826 else 3623 3827 cell_CBP = "NULL" # CB も INIB もなければ NULL に置換 3828 end 3829 3830 if @idx_is_id_act then 3831 cell_IDX = cell_ID 3832 else 3833 cell_IDX = cell_CBP 3624 3834 end 3625 3835 … … 3636 3846 name_array[9] = @global_name # celltype global name 3637 3847 name_array[10] = cell.get_global_name # cell global name 3848 name_array[11] = cell_INIB_proto # INIB name for prototype 3638 3849 3639 3850 return name_array … … 3820 4031 c = j.get_rhs_cell # 呼び先セル 3821 4032 ct = c.get_celltype # 呼び先セルタイプ 4033 name_array = ct.get_name_array( c ) # 呼び先セルタイプで name_array を得る 3822 4034 if ct.has_INIB? || ct.has_CB? then 3823 name_array = ct.get_name_array( c ) # 呼び先セルタイプで name_array を得る3824 4035 f.printf( "%-40s /* %s #_CCP2_# */\n", "#{name_array[7]},", p.get_name ) 3825 4036 else … … 4107 4318 f = fs[ c.get_region.get_domain_root ] 4108 4319 4109 ct = c.get_celltype 4320 ct = c.get_celltype # ct = self でも同じ 4110 4321 jl = c.get_join_list 4322 name_array = get_name_array( c ) 4111 4323 4112 4324 port = ct.get_port_list … … 4143 4355 else 4144 4356 if has_CB? then 4145 if @singleton then 4146 f.print " &#{@global_name}_SINGLE_CELL_CB, /* CB */\n" 4147 else 4148 # f.print " &#{@global_name}_#{c.get_name}_CB,\n" 4149 f.print " &#{@global_name}_CB_tab[#{index}], /* CB */\n" 4150 end 4357 # if @singleton then 4358 # f.print " &#{@global_name}_SINGLE_CELL_CB, /* CB 1 */\n" 4359 # else 4360 # # f.print " &#{@global_name}_#{c.get_name}_CB,\n" 4361 # f.print " &#{@global_name}_CB_tab[#{index}], /* CB 2 */\n" 4362 # end 4363 f.print " #{name_array[8]}, /* CB 1 */\n" 4151 4364 elsif has_INIB? then 4152 if @singleton then 4153 f.print " &#{@global_name}_SINGLE_CELL_INIB, /* INIB */\n" 4154 else 4155 f.print " &#{@global_name}_INIB_tab[#{index}], /* INIB */\n" 4156 end 4365 # if @singleton then 4366 # f.print " &#{@global_name}_SINGLE_CELL_INIB, /* INIB 1 */\n" 4367 # else 4368 # f.print " &#{@global_name}_INIB_tab[#{index}], /* INIB 2 */\n" 4369 # end 4370 f.print " &#{name_array[5]}, /* INIB 1 */\n" 4157 4371 else 4158 4372 f.print " 0,\n" … … 4178 4392 else 4179 4393 if has_CB? then 4180 if @singleton then 4181 f.print " &#{@global_name}_SINGLE_CELL_CB, /* CB */\n" 4182 else 4183 f.print " &#{@global_name}_CB_tab[#{index}], /* CB */\n" 4184 # f.print " &#{@global_name}_#{c.get_name}_CB,\n" 4185 end 4394 # if @singleton then 4395 # f.print " &#{@global_name}_SINGLE_CELL_CB, /* CB 3 */\n" 4396 # else 4397 # f.print " &#{@global_name}_CB_tab[#{index}], /* CB 4 */\n" 4398 # # f.print " &#{@global_name}_#{c.get_name}_CB,\n" 4399 # end 4400 f.print " #{name_array[8]}, /* CB 3 */\n" 4186 4401 elsif has_INIB? then 4187 if @singleton then 4188 f.print " &#{@global_name}_SINGLE_CELL_INIB, /* INIB */\n" 4189 else 4190 f.print " &#{@global_name}_INIB_tab[#{index}], /* INIB */\n" 4191 end 4402 # if @singleton then 4403 # f.print " &#{@global_name}_SINGLE_CELL_INIB, /* INIB 3 */\n" 4404 # else 4405 # # f.print " &#{@global_name}_INIB_tab[#{index}], /* INIB 4 */\n" 4406 # end 4407 f.print " &#{name_array[5]}, /* INIB 3 */\n" 4192 4408 else 4193 4409 f.print " 0,\n" … … 4550 4766 def generate_inline_template_code 4551 4767 return if @n_entry_port_inline == 0 4768 return if @b_reuse && ! $generate_all_template 4552 4769 if ! ( @plugin && @plugin.gen_ep_func? ) then 4553 4770 return if @b_reuse && ! $generate_all_template … … 4927 5144 # str に以下の置換を行う 4928 5145 #- $ct$ ⇒ セルタイプ名(ct) 4929 #- $cell$ ⇒ セル名(cell) cell が nil ならば 3つの置換は行われない5146 #- $cell$ ⇒ セル名(cell) cell が nil ならば以下の置換は行われない 4930 5147 #- $cb$ ⇒ CB の C 言語名(cb) 4931 5148 #- $cbp$ ⇒ CB へのポインタ(cbp) 4932 5149 #- $cb_proto$ ⇒ CB の C 言語名プロトタイプ宣言用(cb_proto) 4933 #- $id$ ⇒ ct_cell5150 #- $id$ ⇒ $ct$_$cell_global$ # ct_cell before or same V1.5.2 4934 5151 #- $idx$ ⇒ idx 4935 5152 #- $ID$ ⇒ id (整数の番号) 4936 5153 #- $ct_global$ ⇒ セルタイプ名(ct) 4937 #- $cell_global$ ⇒ セル名(cell) cell が nil ならば3つの置換は行われない5154 #- $cell_global$ ⇒ セル名(cell) 4938 5155 #- $$ ⇒ $ 4939 5156 def subst_name( str, name_array ) … … 4950 5167 4951 5168 str = str.gsub( /(^|[^\$])\$ct\$/, "\\1#{ct}" ) 5169 str = str.gsub( /(^|[^\$])\$ct_global\$/, "\\1#{ct_global}" ) 4952 5170 if cell then 4953 5171 str = str.gsub( /(^|[^\$])\$cell\$/, "\\1#{cell}" ) 4954 5172 str = str.gsub( /(^|[^\$])\$cb\$/, "\\1#{cb}" ) 4955 str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell}" ) 5173 # str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell}" ) 5174 str = str.gsub( /(^|[^\$])\$id\$/, "\\1#{ct}_#{cell_global}" ) 4956 5175 str = str.gsub( /(^|[^\$])\$cb_proto\$/, "\\1#{cb_proto}" ) 4957 5176 str = str.gsub( /(^|[^\$])\$ID\$/, "\\1#{id}" ) 4958 5177 str = str.gsub( /(^|[^\$])\$idx\$/, "\\1#{idx}" ) 4959 5178 str = str.gsub( /(^|[^\$])\$cbp\$/, "\\1#{cbp}" ) 4960 str = str.gsub( /(^|[^\$])\$ct_global\$/, "\\1#{ct_global}" )4961 5179 str = str.gsub( /(^|[^\$])\$cell_global\$/, "\\1#{cell_global}" ) 4962 5180 end … … 5078 5296 end 5079 5297 end 5298 5299 class DomainType < Node 5300 def gen_factory 5301 # p "DomainType: gen_factory" 5302 @plugin.gen_factory 5303 end 5304 end -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/location.rb
r337 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/messages.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/optimize.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2018 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 178 178 179 179 def set_domain 180 domain_cells = {} 180 181 @cell_list.each{ |c| 181 182 if c.is_generate? then … … 191 192 @domain_roots[ dn ] = [ dr ] 192 193 end 194 if domain_cells[ dr ] then 195 domain_cells[ dr ] << c 196 else 197 domain_cells[ dr ] = [ c ] 198 end 193 199 end 194 200 } … … 196 202 @domain_roots.each{ |dn, drs| 197 203 drs.uniq! 198 if ! $debug then 199 dbgPrint "domains celltype:#{@name} domain=#{dn} " 204 if $verbose && dn then 205 print "[domain] celltype=#{@name} domainType=#{dn} domainRootRegions={" 206 delim = "" 200 207 drs.each{ |r| 201 dbgPrint " region=#{r.get_name}" 208 print delim, r.get_name 209 delim = ", " 202 210 } 203 dbgPrint "\n" 211 print "}\n" 212 drs.each{ |r| 213 print "[domain] celltype=#{@name} domainRootRegion=#{r.get_name} domainType=#{dn} domainKind=#{r.get_domain_root.get_domain_type.get_kind} domainCells={" 214 delim = "" 215 domain_cells[r].each{ |c| 216 print delim, c.get_name 217 delim = ", " 218 } 219 print "}\n" 220 } 204 221 end 205 222 } … … 212 229 # domain_type は一つのノードに一つしかないので、一つの要素を無条件で取り出す 213 230 if regions.length > 1 then 214 cdl_info( "I9999 celltype:#{@name} has cells in multi domain.\n" ) 215 if @idx_is_id == false then 216 cdl_info( "I9999 celltype:#{@name} forcely set idx_is_id\n" ) 217 end 218 @idx_is_id_act = true 231 if $verbose then 232 cdl_info( "I9999 celltype '$1' has cells in multi-domain.\n", @name ) 233 end 234 # if @idx_is_id == false then 235 # cdl_info( "I9999 celltype '$1' forcely set idx_is_id\n", @name ) 236 # end 237 @b_need_ptab = true 238 # @idx_is_id_act = true 219 239 end 220 240 } … … 228 248 end 229 249 250 optimize_call 251 if $unopt_entry == false then 252 optimize_entry 253 end 254 end 255 256 #=== Celltype#呼び口最適化 257 def optimize_call 230 258 @port.each{ |port| 231 259 next if port.get_port_type != :CALL … … 361 389 dbgPrint "#{port.get_name} : # of cells : #{port_cells.length} # of ports : #{port_ports.length}\n" 362 390 } 363 391 end 392 393 #=== Celltype#受け口最適化 394 # optimize_entry は、呼び口最適化の結果を使用している 395 def optimize_entry 364 396 # 受け口最適化の設定 365 397 @port.each{ |port| -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/plugin.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 160 160 # 識別子取得 161 161 if arg =~ /\A[a-zA-Z_]\w*/ then 162 ident = $~ 162 ident = $~.to_s # 163 163 arg = $' 164 164 else -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/pluginModule.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/syntaxobj.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 6by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 685 685 end 686 686 687 #=== Decl# print_flowinfo 688 def print_flowinfo file 689 if @kind == :VAR then 690 file.write "#{@identifier} " 691 end 692 end 693 687 694 def show_tree( indent ) 688 695 indent.times { print " " } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/tecsgen.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 250 250 Cell.create_reverse_join 251 251 252 DescriptorType.check_signature 253 Signature.set_descriptor_list 254 Celltype.check_dynamic_join 255 252 256 #0 set_definition_join は2回呼び出される(1回目) 253 257 dbgPrint( "## Checking all join\n") … … 450 454 end # finalize 451 455 456 def dump_tecsgen_rbdmp 457 dbgPrint "dump_tecsgen_rbdmp 0:\n" 458 #### unjoin_plugin 後に行う必要があるため、コード生成後にダンプを行う 459 #### Region link root ごとにオプティマイズしてダンプ #### 460 Namespace.get_root.unjoin_plugin 461 Namespace.get_root.find_plugin 0, [] 462 463 Region.get_link_roots.each { |region| 464 dbgPrint "dump_tecsgen_rbdmp 1: Region.path_str: #{region.get_namespace_path.get_path_str}\n" 465 466 n_cells = region.get_n_cells 467 468 if $region_list.length > 0 then 469 if $region_list[ region.get_namespace_path.get_path_str ] == false then 470 $region_list[ region.get_namespace_path.get_path_str ] = true 471 else 472 next 473 end 474 end 475 476 dbgPrint "dump_tecsgen_rbdmp 2: Region.path_str: #{region.get_namespace_path.get_path_str}\n" 477 # セルが一つもなければ生成しない 478 # セルの生成がない場合 479 if region.get_n_cells == 0 then 480 # if $region_list.length > 0 then 481 # Generator.warning( "W9999 $1: specified to generate but has no cell", region.get_name ) 482 # end 483 if region != @root_namespace then 484 next 485 end 486 end 487 488 dbgPrint "dump_tecsgen_rbdmp 3: Region.path_str: #{region.get_namespace_path.get_path_str}\n" 489 $generating_region = region 490 if Region.get_link_roots.length > 1 then 491 if region.get_name == "::" then 492 $gen = $gen_base 493 else 494 $gen = $gen_base + "/" + region.get_global_name.to_s 495 end 496 else 497 $gen = $gen_base 498 end 499 500 dbgPrint "dump_tecsgen_rbdmp 4: Region.path_str: #{region.get_namespace_path.get_path_str}\n" 501 dbgPrint( "## Unset optimize variables\n") 502 @root_namespace.reset_optimize # 最適化をリセットする 503 504 # if Generator.get_n_error == 0 then 505 # # エラーが発生していたら、ここへは来ない 506 dbgPrint( "## Set cell id\n") 507 @root_namespace.set_cell_id_and_domain # セルの ID とドメイン情報を設定(linkunit 毎に0からつける) 508 509 # エラーが発生していたら、最適化は実施しない 510 if ! $unopt then 511 dbgPrint( "## Optimizing: Link Region=#{@root_namespace.get_name}\n") 512 @root_namespace.optimize 513 end 514 # end 515 dbgPrint "dump_tecsgen_rbdmp final: Region.path_str: #{region.get_namespace_path.get_path_str}\n" 516 File.write( "#{$gen}/tecsgen.rbdmp", Marshal.dump(Namespace.get_root) ) 517 } 518 end 519 452 520 def self.post_coded? 453 521 @@b_post_coded -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/tecsinfo.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2017 by TOPPERS Project6 # Copyright (C) 2017-2018 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 49 49 #{indent0}region rTECSInfo { 50 50 EOT 51 # mikan 全部生成するのではなく、region 下のセルのセルタイプと、そこから参照されるシグニチャ、セルタイプに限定して出力する. 51 Type.reset_print_info 52 53 # mikan 全部生成するのではなく、region 下のセルのセルタイプと、そこから参照されるシグニチャ、セルタイプに限定して出力すべき 52 54 # しかし、意味解析後に出力するため、これは容易ではない.最適化とコード生成は、リンクルートごとに行われる. 53 55 Namespace.print_info f, indent … … 149 151 "#{tag.get_ID_str}_#{decl.get_name}", 150 152 "(uint32_t)(intptr_t)&(((#{tag.get_type_str}#{tag.get_type_str_post}*)0)->#{decl.get_name})" 153 f.printf "#define PLACE_OF_%-30s (%s)\n", 154 "#{tag.get_ID_str}_#{decl.get_name}", 155 "VARDECL_PLACE_STRUCT" 151 156 } 152 157 } … … 191 196 } 192 197 end 198 199 def print_entry_define f 200 @celltype_list.each { |ct| 201 if ct.get_cell_list.length > 0 then 202 ct.print_entry_define f 203 end 204 } 205 @namespace_list.each { |ns| 206 if ns.instance_of? Namespace then # region を含めない 207 ns.print_entry_define f 208 end 209 } 210 end 193 211 end 194 212 … … 200 218 name = @global_name 201 219 end 220 # p "region:#{get_name}" 202 221 f.print "\n#{indent}/*** #{get_namespace_path} region information cell ***/\n" 203 222 f.print <<EOT 204 223 #{indent}cell nTECSInfo::tRegionInfo #{name}RegionInfo{ 205 224 #{indent} name = "#{@name}"; 206 #{indent}}; 207 EOT 225 EOT 226 @cell_list.each{ |cell| 227 # print "cell class="+cell.get_celltype.class.name+", " + cell.get_celltype.get_name.to_s + " 1\n" 228 if ! cell.exclude_info? then 229 # print "cell class="+cell.get_celltype.class.name+", " + cell.get_celltype.get_name.to_s + " 2\n" 230 f.print "#{indent} cCellInfo[] = #{cell.get_global_name}CellInfo.eCellInfo;\n" 231 end 232 } 233 @namespace_list.each { |region| 234 if region.instance_of? Region then 235 f.print "#{indent} cRegionInfo[] = #{region.get_global_name}RegionInfo.eRegionInfo;\n" 236 end 237 } 238 f.print "#{indent}};\n" 239 @cell_list.each{ |cell| 240 if ! cell.exclude_info? then 241 cell.print_info f, indent 242 end 243 } 208 244 end 209 245 … … 221 257 self.print_info_region f, indent 222 258 end 259 260 def self.print_cell_define f 261 region.get_link_root.print_cell_define f 262 region.get_link_root.get_region{ |region| 263 if region.instance_of? Region then 264 region.print_cell_define_offset f 265 end 266 267 } 268 end 269 270 def print_cell_define f 271 ct_list = {} 272 @cell_list.each{ |cell| 273 next if cell.exclude_info_factory? 274 ct_list[ cell.get_celltype ] = true 275 } 276 f.print "#define TOPPERS_CB_TYPE_ONLY\n" 277 ct_list.each{ |ct, val| 278 f.print "#include \"#{ct.get_global_name}_tecsgen.h\"\n" 279 } 280 f.print "\n" 281 @cell_list.each{ |cell| 282 next if cell.exclude_info_factory? 283 name_array = cell.get_celltype.get_name_array cell 284 if cell.get_celltype.has_CB? 285 cb = "(void*)#{name_array[8]}" 286 cb_proto = "extern #{cell.get_celltype.get_global_name}_CB #{name_array[4]};\n" 287 else 288 cb = "0" 289 cb_proto = "" 290 end 291 if cell.get_celltype.has_INIB? 292 inib = "(void*)&#{name_array[5]}" 293 inib_proto = "extern #{cell.get_celltype.get_global_name}_INIB #{name_array[11]};\n" 294 else 295 inib = "0" 296 inib_proto = "" 297 end 298 if ! cell.exclude_info_factory? then 299 f.print <<EOT 300 #{cb_proto}#define #{cell.get_global_name}__CBP #{cb} 301 #{inib_proto}#define #{cell.get_global_name}__INIBP #{inib} 302 EOT 303 end 304 } 305 @namespace_list.each { |region| 306 if region.instance_of? Region then 307 region.print_cell_define f 308 end 309 } 310 end 311 312 def print_entry_descriptor_define f 313 @cell_list.each{ |cell| 314 next if cell.exclude_info_factory? 315 316 signatures = {} 317 cell.get_celltype.get_port_list.each{ |port| 318 next if port.get_port_type != :ENTRY 319 320 if signatures[ port.get_signature ] == nil then 321 f.print "#include \"#{port.get_signature.get_global_name}_tecsgen.h\"\n" 322 end 323 if cell.get_celltype.get_global_name == :nTECSInfo_tRawEntryDescriptorInfo then 324 f.print "const struct tag_#{cell.get_celltype.get_global_name}_#{port.get_name}_DES " 325 f.print "#{cell.get_global_name}_#{port.get_name}_des;\n" 326 else 327 f.print "extern struct tag_#{port.get_signature.get_global_name}_VDES " 328 f.print "#{cell.get_global_name}_#{port.get_name}_des;\n" 329 end 330 } 331 } 332 @namespace_list.each { |region| 333 if region.instance_of? Region then 334 region.print_entry_descriptor_define f 335 end 336 } 337 end 223 338 end 224 339 … … 227 342 f.print <<EOT 228 343 #{indent}cell nTECSInfo::tCelltypeInfo #{@global_name}CelltypeInfo { 229 #{indent} name = "#{@name}";230 #{indent} b_singleton = #{@singleton};231 #{indent} b_IDX_is_ID_act = C_EXP( "#{@global_name}__IDX_is_ID_act" );232 #{indent} b_hasCB = C_EXP( "#{@global_name}__hasCB" );233 #{indent} b_hasINIB = C_EXP( "#{@global_name}__hasINIB" );234 #{indent} n_cellInLin Unit = C_EXP( "#{@global_name}__NCELLINLINKUNIT" );235 #{indent} n_cellInSystem = #{@cell_list.length};344 #{indent} name = "#{@name}"; 345 #{indent} b_singleton = #{@singleton}; 346 #{indent} b_IDX_is_ID_act = C_EXP( "#{@global_name}__IDX_is_ID_act" ); 347 #{indent} sizeOfCB = C_EXP( "#{@global_name}__sizeOfCB" ); 348 #{indent} sizeOfINIB = C_EXP( "#{@global_name}__sizeOfINIB" ); 349 #{indent} n_cellInLinkUnit = C_EXP( "#{@global_name}__NCELLINLINKUNIT" ); 350 #{indent} n_cellInSystem = #{@cell_list.length}; 236 351 EOT 237 352 @port.each{ |port| … … 273 388 } 274 389 @attribute.each{ |decl| 275 decl.print_info f, @global_name, indent 390 decl.print_info f, @global_name, indent, :DECLTYPE_ATTR 276 391 } 277 392 @var.each{ |decl| 278 decl.print_info f, @global_name, indent 393 decl.print_info f, @global_name, indent, :DECLTYPE_VAR 279 394 } 280 395 end … … 295 410 if ! decl.is_omit? then 296 411 offset = "(uint32_t)(intptr_t)&(((#{@global_name}_#{inib_cb}*)0)->#{decl.get_name})" 412 place = inib_cb 297 413 else 298 414 offset = "0xffffffff" 415 place = "NON" 299 416 end 300 417 f.printf "#define OFFSET_OF_%-30s (%s)\n", "#{@global_name}_#{decl.get_name}", offset 418 f.printf "#define PLACE_OF_%-30s VARDECL_PLACE_%s\n", "#{@global_name}_#{decl.get_name}", place 301 419 } 302 420 @var.each{ |decl| 303 if decl.get_size_is then421 if decl.get_size_is && has_INIB? then 304 422 inib_cb = "INIB" 305 423 else 306 424 inib_cb = "CB" 307 425 end 308 f.printf "#define OFFSET_OF_%-30s (%s)\n", "#{@global_name}_#{decl.get_name}", "(uint32_t)(intptr_t)&(((#{@global_name}_#{inib_cb}*)0)->#{decl.get_name})" 426 place = inib_cb 427 f.printf "#define OFFSET_OF_%-30s (%s)\n", "#{@global_name}_#{decl.get_name}", "(uint32_t)(intptr_t)&(((#{@global_name}_#{inib_cb}*)0)->#{decl.get_name})" 428 f.printf "#define PLACE_OF_%-30s VARDECL_PLACE_%s\n", "#{@global_name}_#{decl.get_name}", place 309 429 } 310 430 else … … 316 436 @attribute.each{ |decl| 317 437 f.printf "#define OFFSET_OF_%-30s (%s)\n", "#{@global_name}_#{decl.get_name}", "0xffffffff" 438 f.printf "#define PLACE_OF_%-30s VARDECL_PLACE_NON\n", "#{@global_name}_#{decl.get_name}" 318 439 } 319 440 @var.each{ |decl| 320 441 f.printf "#define OFFSET_OF_%-30s (%s)\n", "#{@global_name}_#{decl.get_name}", "0xffffffff" 442 f.printf "#define PLACE_OF_%-30s VARDECL_PLACE_NON\n", "#{@global_name}_#{decl.get_name}" 321 443 } 322 444 end … … 324 446 325 447 def print_celltype_define f 326 f.printf "#define %-50s (#{@idx_is_id_act})\n", "#{@global_name}__IDX_is_ID_act" 327 f.printf "#define %-50s (#{has_CB?})\n", "#{@global_name}__hasCB" 328 f.printf "#define %-50s (#{has_INIB?})\n", "#{@global_name}__hasINIB" 329 f.printf "#define %-30s (%d)\n", "#{@global_name}__NCELLINLINKUNIT", @n_cell_gen 448 if has_INIB? then 449 size_INIB = "(sizeof(#{@global_name}_INIB))" 450 else 451 size_INIB = "(0)" 452 end 453 if has_CB? then 454 size_CB = "(sizeof(#{@global_name}_CB))" 455 else 456 size_CB = "(0)" 457 end 458 459 if @n_cell_gen > 0 then 460 f.printf "\n#include \"#{@global_name}_tecsgen.h\"\n" 461 f.printf "#define %-50s (#{@idx_is_id_act})\n", "#{@global_name}__IDX_is_ID_act" 462 f.printf "#define %-50s (#{size_CB})\n", "#{@global_name}__sizeOfCB" 463 f.printf "#define %-50s (#{size_INIB})\n", "#{@global_name}__sizeOfINIB" 464 f.printf "#define %-30s (%d)\n", "#{@global_name}__NCELLINLINKUNIT", @n_cell_gen 465 else 466 f.printf "#define %-50s (false)\n", "#{@global_name}__IDX_is_ID_act" 467 f.printf "#define %-50s (0)\n", "#{@global_name}__sizeOfCB" 468 f.printf "#define %-50s (0)\n", "#{@global_name}__sizeOfINIB" 469 f.printf "#define %-30s (%d)\n", "#{@global_name}__NCELLINLINKUNIT", @n_cell_gen 470 end 330 471 end 331 472 … … 365 506 end 366 507 end 367 if ( port.is_VMT_useless? && port.is_cell_unique? ) || @n_cell_gen == 0 then508 if ( port.is_VMT_useless? && port.is_cell_unique? ) || port.is_omit? || @n_cell_gen == 0 then 368 509 offset = "0xffffffff" 369 510 else … … 375 516 offset = "(uint32_t)(intptr_t)&((#{@global_name}_#{cb_inib}*)0)->#{port.get_name}" 376 517 end 518 array_size = port.get_array_size 519 if array_size == "[]" then 520 array_size = "0xffffffff" 521 elsif array_size == nil then 522 array_size = "0" 523 end 524 377 525 f.printf "#define %-50s (#{offset})\n", "#{@global_name}_#{port.get_name}__offset" 526 f.printf "#define %-50s (#{array_size})\n", "#{@global_name}_#{port.get_name}__array_size" 378 527 f.printf "#define %-50s (#{place})\n", "#{@global_name}_#{port.get_name}__place" 379 528 f.printf "#define %-50s (#{port.is_VMT_useless?})\n", "#{@global_name}_#{port.get_name}__b_VMT_useless" … … 382 531 } 383 532 end 533 534 def print_entry_define f 535 @port.each{ |port| 536 next if port.get_port_type == :CALL 537 array_size = port.get_array_size 538 if array_size == "[]" then 539 array_size = "0xffffffff" 540 elsif array_size == nil then 541 array_size = "0" 542 end 543 544 f.printf "#define %-50s (#{array_size})\n", "#{@global_name}_#{port.get_name}__array_size" 545 } 546 end 384 547 end 385 548 … … 393 556 #{indent} cSignatureInfo = #{@signature.get_global_name}SignatureInfo.eSignatureInfo; 394 557 #{indent} b_inline = #{@b_inline}; 558 #{indent} array_size = C_EXP( "#{ct_global}_#{@name}__array_size" ); 395 559 #{indent}}; 396 560 EOT … … 401 565 #{indent} cSignatureInfo = #{@signature.get_global_name}SignatureInfo.eSignatureInfo; 402 566 #{indent} offset = C_EXP( "#{ct_global}_#{@name}__offset" ); 567 #{indent} array_size = C_EXP( "#{ct_global}_#{@name}__array_size" ); 403 568 #{indent} b_optional = #{@b_optional}; 404 569 #{indent} b_omit = #{@b_omit}; … … 418 583 end 419 584 585 class Cell 586 def print_info f, indent 587 if exclude_info? then 588 return 589 end 590 f.print <<EOT 591 592 #{indent}/*** #{@global_name} cell information ****/ 593 #{indent}cell nTECSInfo::tCellInfo #{@global_name}CellInfo { 594 #{indent} name = "#{@name}"; 595 #{indent} cbp = C_EXP( \"#{@global_name}__CBP\" ); 596 #{indent} inibp = C_EXP( \"#{@global_name}__INIBP\" ); 597 #{indent} cCelltypeInfo = #{@celltype.get_global_name}CelltypeInfo.eCelltypeInfo; 598 EOT 599 @celltype.get_port_list.each{ |port| 600 next if port.get_port_type != :ENTRY 601 602 f.print <<EOT 603 #{indent} cRawEntryDescriptor[] = #{@global_name}_#{port.get_name}RawEntryDescriptorInfo.eRawEntryDescriptor; 604 EOT 605 } 606 f.print "#{indent}};\n" 607 608 # RawEntryDescriptorInfo cells 609 @celltype.get_port_list.each{ |port| 610 next if port.get_port_type != :ENTRY 611 612 size = port.get_array_size 613 if size == nil then 614 size = 1 615 elsif size == "[]" then 616 size = @entry_array_max_subscript[ port ] 617 end 618 if ! port.is_omit? then 619 red = "C_EXP( \"&#{@global_name}_#{port.get_name}_des\" )" 620 else 621 red = "(void *)0" 622 end 623 # mikan 受け口配列 624 f.print <<EOT 625 #{indent}cell nTECSInfo::tRawEntryDescriptorInfo #{@global_name}_#{port.get_name}RawEntryDescriptorInfo { 626 #{indent} size = #{size}; 627 #{indent} rawEntryDescriptor = { #{red} }; 628 EOT 629 # #{indent} cEntryInfo = #{@celltype.get_global_name}_#{port.get_name}EntryInfo.eEntryInfo; 630 f.print "#{indent}};\n" 631 } 632 end 633 634 def exclude_info? 635 # print "exclude_info?: name=" + get_name.to_s 636 if @celltype == nil || 637 is_of_composite? || 638 @celltype.get_global_name == :nTECSInfo_tTECSInfoSub || 639 post_code_generated? || 640 @b_defined == false then 641 # print ": true celltype_is_of_composite=#{is_of_composite?} celltype_name=#{@celltype.get_global_name} celltype.need_generate=#{@celltype.need_generate?}\n" 642 return true 643 else 644 # print ": false\n" 645 return false 646 end 647 end 648 649 def exclude_info_factory? 650 # print "exclude_info_factory?: name=" + get_name.to_s 651 if @celltype == nil || 652 is_of_composite? || 653 @celltype.get_global_name == :nTECSInfo_tTECSInfoSub || 654 ! @celltype.need_generate? then 655 # print ": true celltype_is_of_composite=#{is_of_composite?} celltype_name=#{@celltype.get_global_name} celltype.need_generate=#{@celltype.need_generate?}\n" 656 return true 657 else 658 # print ": false\n" 659 return false 660 end 661 end 662 end 663 420 664 class Signature 421 665 def print_info f, indent … … 446 690 f.print <<EOT 447 691 #{indent}cell nTECSInfo::tFunctionInfo #{sig_name}_#{func_name}FunctionInfo { 448 #{indent} name = "#{ @owner.get_global_name}_#{@name}";692 #{indent} name = "#{get_name}"; 449 693 #{indent} bOneway = #{is_oneway?}; 450 694 EOT … … 502 746 503 747 class Decl 504 def print_info f, parent_ID_str, indent 748 def print_info f, parent_ID_str, indent, decl_type 505 749 if @size_is then 506 750 size = "\"mikan\""; … … 512 756 #{indent} name = "#{get_name}"; 513 757 #{indent} sizeIsExpr = #{size}; 514 #{indent} declType = DECLTYPE_STMEMBER;758 #{indent} declType = #{decl_type}; 515 759 #{indent} offset = C_EXP( "OFFSET_OF_#{parent_ID_str}_#{get_name}" ); 760 #{indent} place = C_EXP( "PLACE_OF_#{parent_ID_str}_#{get_name}" ); 516 761 #{indent} cTypeInfo = #{get_type.get_ID_str}TypeInfo.eTypeInfo; 517 762 #{indent}}; … … 523 768 class Type 524 769 @@typeinfo_printed = {} 770 771 def self.reset_print_info 772 @@typeinfo_printed = {} 773 end 774 525 775 def print_info f, indent 526 776 # Type の info は、最後にまとめて出力するので、ここでは記録するだけ … … 538 788 elsif self.kind_of? StructType then 539 789 get_members_decl.get_items.each{ |decl| 540 decl. get_type.print_info f, indent790 decl.print_info f, get_ID_str, indent, :DECLTYPE_STMEMBER 541 791 } 542 792 end … … 550 800 551 801 def print_info_post f, indent 552 bit_size = get_bit_size553 if bit_size == 0 then554 bit_size = "C_EXP( \"sizeof(#{get_type_str}#{get_type_str_post})\" )"555 end556 802 if self.class.superclass == Type then # 親クラスが Type の場合 types.rb のクラス 557 803 type_name = self.class.name … … 566 812 #{indent} name = "#{get_type_str}#{get_type_str_post}"; 567 813 #{indent} typeKind = TECSTypeKind_#{type_name}; 568 #{indent} bitSize = #{bit_size};814 #{indent} size = C_EXP( "sizeof(#{get_type_str}#{get_type_str_post})" ); 569 815 #{indent} b_const = #{is_const?}; 570 816 #{indent} b_volatile = #{is_volatile?}; 571 817 EOT 572 818 if self.kind_of? PtrType then 573 f.print "#{indent} cTypeInfo = #{get_referto.get_ID_str}TypeInfo.eTypeInfo;\n"819 f.print "#{indent} cTypeInfo = #{get_referto.get_ID_str}TypeInfo.eTypeInfo;\n" 574 820 elsif self.kind_of? ArrayType then 575 f.print "#{indent} cTypeInfo = #{get_type.get_ID_str}TypeInfo.eTypeInfo;\n"821 f.print "#{indent} cTypeInfo = #{get_type.get_ID_str}TypeInfo.eTypeInfo;\n" 576 822 elsif self.kind_of? DefinedType then 577 f.print "#{indent} cTypeInfo = #{get_type.get_ID_str}TypeInfo.eTypeInfo;\n"823 f.print "#{indent} cTypeInfo = #{get_type.get_ID_str}TypeInfo.eTypeInfo;\n" 578 824 elsif self.kind_of? StructType then 579 825 get_members_decl.get_items.each{ |decl| 580 f.print "#{indent} c TypeInfo[] = #{decl.get_type.get_ID_str}TypeInfo.eTypeInfo;\n"826 f.print "#{indent} cVarDeclInfo[] = #{get_ID_str}_#{decl.get_name}VarDeclInfo.eVarDeclInfo;\n" 581 827 } 582 828 elsif self.kind_of? DescriptorType then -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/tool_info.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/core/types.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 5by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 629 629 630 630 class FloatType < Type 631 # @bit_size:: 32, 64, (80), -32, -64 631 # @bit_size:: 32, 64, (80), -32, -64, -128 632 632 633 633 def initialize( bit_size ) … … 684 684 when -64 685 685 str = "#{str}double" 686 when -128 687 str = "#{str}long double" 686 688 end 687 689 return str … … 1558 1560 # 動的結合で渡すデスクリプタ型 1559 1561 class DescriptorType < Type 1560 # @sinagure_nsp::NamespacePath 1562 # @sinagure_nsp::NamespacePath 1563 1564 @@descriptors = {} 1561 1565 1562 1566 def initialize( signature_nsp ) 1563 # p "Desc #{signature_nsp.to_s}" 1564 obj = Namespace.find signature_nsp 1565 if ! obj.kind_of? Signature then 1566 cdl_error( "T9999 '$1': not signature or not found", signature_nsp.to_s ) 1567 @signature_nsp = signature_nsp 1568 else 1569 if obj.has_descriptor? then 1570 # cdl_error( "T9999 '$1': has Descriptor in function parameter", signature_nsp.to_s ) 1571 end 1572 @signature_nsp = obj.get_namespace_path 1573 end 1567 @signature_nsp = signature_nsp 1568 # check_signature ## 1569 @@descriptors[ self ] = false 1574 1570 end 1575 1571 … … 1595 1591 else 1596 1592 cdl_error2( locale, "T9999 Descriptor cannot be used for $1", kind) 1593 end 1594 end 1595 1596 def self.check_signature 1597 @@descriptors.each{ |desc, val| 1598 if val != true then 1599 desc.check_signature 1600 @@descriptors[ desc ] = true 1601 end 1602 } 1603 end 1604 1605 def check_signature 1606 # p "Desc #{@signature_nsp.to_s}" 1607 obj = Namespace.find @signature_nsp 1608 if ! obj.kind_of? Signature then 1609 cdl_error( "T9999 '$1': not signature or not found", @signature_nsp.to_s ) 1610 else 1611 if obj.has_descriptor? then 1612 # cdl_error( "T9999 '$1': has Descriptor in function parameter", @signature_nsp.to_s ) 1613 end 1614 # @signature_nsp = obj.get_namespace_path 1597 1615 end 1598 1616 end -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/messages/messages_console_en_US.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/messages/messages_console_ja_JP.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/messages/messages_file_en_US.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2018 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 76 76 # * このファイルを編集して使用することが意図されていますが 77 77 # * tecsgen の再実行により上書きされてしまうため、通常 78 # * gen/%s_templ ate.c => src/%s.c78 # * gen/%s_templ.c => src/%s.c 79 79 # * のように名前, フォルダを変更してから修正します 80 80 # */ … … 83 83 * This file was automatically generated by tecsgen. 84 84 * Move and rename like below before editing, 85 * gen/%s_templ ate.c => src/%s.c85 * gen/%s_templ.c => src/%s.c 86 86 * to avoid to be overwritten by tecsgen. 87 87 */ … … 335 335 @@comment[ :TEFB_comment ] = "\t/* Put statements here %s */\n" 336 336 337 # @@comment[ :MCPP_comment ] = "/* セル CB プロトタイプ宣言 %s */\n" 338 @@comment[ :MCPP_comment ] = "/* cell CB prototype declaration %s */\n" 339 340 # @@comment[ :MCPB_comment ] = "/* セル CB プロトタイプ宣言 %s */\n" 341 @@comment[ :MCPB_comment ] = "/* cell CB prototype declaration %s */\n" 337 342 end -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/messages/messages_file_ja_JP.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2018 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 65 65 * このファイルを編集して使用することが意図されていますが 66 66 * tecsgen の再実行により上書きされてしまうため、通常 67 * gen/%s_templ ate.c => src/%s.c67 * gen/%s_templ.c => src/%s.c 68 68 * のように名前, フォルダを変更してから修正します 69 69 */ … … 163 163 @@comment[ :TEPF_comment ] = "/* 受け口関数 %s */\n" 164 164 @@comment[ :TEFB_comment ] = "\t/* ここに処理本体を記述します %s */\n" 165 @@comment[ :MCPP_comment ] = "/* CB プロトタイプ宣言 %s */\n" 166 @@comment[ :MCPB_comment ] = "/* CB プロトタイプ宣言 %s */\n" 165 167 166 168 end -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/ATK1AlarmPlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id 37 # $Id$ 38 38 #++ 39 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/ATK1DelayTaskPlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id 37 # $Id$ 38 38 #++ 39 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/ATK1ISRPlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id 37 # $Id$ 38 38 #++ 39 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/ATK1KernelPlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id 37 # $Id$ 38 38 #++ 39 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/ATK1ResourcePlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id 37 # $Id$ 38 38 #++ 39 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/ATK1TaskPlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id 37 # $Id$ 38 38 #++ 39 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/DomainPlugin.rb
r337 r374 46 46 #option::String : domain 指定子の第二引数 47 47 def initialize( region, domain_type_name, option ) 48 super() 48 49 end 49 50 … … 77 78 return false 78 79 end 80 81 #== ドメイン種別を返す 82 #return::Symbol :kernel, :user, :OutOfDomain 83 def get_kind 84 :kernel 85 end 86 87 #== factory 生成 88 # DomainPlugin の factory は特定のファイルへの出力が想定されていない 89 def gen_factory 90 end 79 91 end -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2Cache.rb
r337 r374 1 1 # -*- coding: utf-8 -*- 2 2 3 # $Id$ 3 4 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2CyclicHandlerPlugin.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 2by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2DataqueuePlugin.rb
r337 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 2by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2EventflagPlugin.rb
r337 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 2by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2FixedSizeMemoryPoolPlugin.rb
r337 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 2by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2HandlerPlugin.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2018 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 77 77 elsif @plugin_arg_str == "ISR" 78 78 file.print <<EOT 79 #{tab}ATT_ISR({ #{val[:attribute]}, &#{cell_CB_name}, #{val[:interruptNumber]}, tISR_start, #{val[:priority]} });79 #{tab}ATT_ISR({ #{val[:attribute]}, #{cell_CBP}, #{val[:interruptNumber]}, tISR_start, #{val[:priority]} }); 80 80 EOT 81 81 elsif @plugin_arg_str == "INIT_ROUTINE" 82 82 file.print <<EOT 83 #{tab}ATT_INI({ #{val[:attribute]}, &#{cell_CB_name}, tInitializeRoutine_start });83 #{tab}ATT_INI({ #{val[:attribute]}, #{cell_CBP}, tInitializeRoutine_start }); 84 84 EOT 85 85 elsif @plugin_arg_str == "TERM_ROUTINE" 86 86 file.print <<EOT 87 #{tab}ATT_TER({ #{val[:attribute]}, &#{cell_CB_name}, tTerminateRoutine_start });87 #{tab}ATT_TER({ #{val[:attribute]}, #{cell_CBP}, tTerminateRoutine_start }); 88 88 EOT 89 89 else -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2KernelObjectPlugin.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 2by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 186 186 val = {} 187 187 @celltype.get_attribute_list.each{ |a| 188 p a.get_name188 # p a.get_name 189 189 if a.get_type.kind_of?( ArrayType ) 190 190 val[a.get_name] = [] … … 218 218 if val[:id].nil? != true 219 219 puts val[:id] 220 val[:id] = val[:id].gsub( /(^|[^\$])\$id\$/, "\\1#{@celltype.get_name.to_s}_#{cell.get_name.to_s}" ) 220 #val[:id] = val[:id].gsub( /(^|[^\$])\$id\$/, "\\1#{@celltype.get_name.to_s}_#{cell.get_name.to_s}" ) 221 val[:id] = @celltype.subst_name( val[:id], @celltype.get_name_array( cell ) ) 221 222 end 222 223 # $cbp$の代わり … … 244 245 file2.puts "}\n" 245 246 else 246 print "~~~~~ #{cell.get_region.get_name.to_s} is included in"247 p @@region_list247 dbgPrint "~~~~~ #{cell.get_region.get_name.to_s} is included in" 248 # p @@region_list 248 249 end 249 250 file3 = AppFile.open( "#{$gen}/tecsgen_#{cell_domain_root.get_name.to_s}.cfg" ) … … 260 261 if !val[:accessPattern].nil? 261 262 puts "===== begin check regions #{cell.get_name} =====" 262 p val[:accessPattern]263 p val[:accessPattern].class263 # p val[:accessPattern] 264 # p val[:accessPattern].class 264 265 265 266 #ep = [ :eTaskActivate, :eTaskControl, :eTaskManage, :eTaskRefer ] … … 273 274 if acptnx != "OMIT" 274 275 acv << acptnx 275 p acv[i]276 # p acv[i] 276 277 elsif cell_domain_type.get_option.to_s == "trusted" 277 278 acv << "TACP_KERNEL" 278 p acv[i]279 # p acv[i] 279 280 elsif cell_domain_type.get_option.to_s != "OutOfDomain" 280 281 acv << "TACP(#{cell_domain_root.get_name.to_s})" … … 286 287 } 287 288 288 print "acv = "289 dbgPrint "acv = " 289 290 p acv 290 291 … … 322 323 323 324 def self.check_referenced_cells() 324 puts "===== begin check registered celltype ====="325 dbgPrint "===== begin check registered celltype =====\n" 325 326 self.get_celltype_list.each { |ct| 326 p ct.get_name.to_s327 dbgPrint( ct.get_name.to_s + "\n" ) 327 328 } 328 puts "===== end check registered celltype ====="329 dbgPrint "===== end check registered celltype =====\n" 329 330 330 331 =begin … … 334 335 j = cell.get_join_list.get_item(p.get_name) 335 336 printf "===== check call port : " 336 p p.get_name.to_s337 # p p.get_name.to_s 337 338 next if j.nil? # 未結合の場合 338 339 if @@celltype_list.include?(j.get_celltype) … … 341 342 j.get_cell.set_referenced_cell(cell, j.get_port_name) 342 343 printf "===== check joined rhs cell : " 343 p j.get_cell.get_name.to_s344 # p j.get_cell.get_name.to_s 344 345 printf "===== check joined rhs port_name : " 345 p j.get_port_name346 # p j.get_port_name 346 347 end 347 348 } -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2ObjectPlugin.rb
r337 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2Plugin.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 201 4by TOPPERS Project6 # Copyright (C) 2018 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 44 44 45 45 def initialize( region, name, option ) 46 super 46 47 print "HRP2Plugin: initialize: region=#{region.get_name}, domainName=#{name}, option=#{option}\n" 48 @region = region 49 @name = name 50 51 case option 52 when "trusted", "nontrusted", "OutOfDomain" 53 # OK 54 @option = option 55 else 56 cdl_error( "HRPPlugin: '$1' is unacceptable domain kind, specify 'trusted' or 'nontrusted'", option ) 57 @option = "trusted" # とりあえず trusted を設定しておく 58 end 47 59 end 48 60 … … 108 120 end 109 121 122 #== ドメイン種別を返す 123 #return::Symbol :kernel, :user, :OutOfDomain 124 def get_kind 125 case @option 126 when "trusted" 127 return :kernel 128 when "nontrusted" 129 return :user 130 when "OutOfDomain" 131 return :OutOfDomain 132 end 133 end 134 110 135 def joinable?(current_region, next_region, through_type ) 111 136 print "HRP2Plugin: joinable? from #{current_region.get_name} to #{next_region.get_name} (#{through_type})\n" -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2PostHook.rb
r337 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 201 2by TOPPERS Project6 # Copyright (C) 2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2PriorityDataqueuePlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2RPCPlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 … … 70 71 #=== RPCPlugin の initialize 71 72 # 説明は ThroughPlugin (plugin.rb) を参照 72 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell )73 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell ) 73 74 super 74 75 @b_noClientSemaphore = false … … 234 235 if cell.get_allocator_list.length > 0 then 235 236 236 dbgPrint "make allocator "237 dbgPrint "make allocator\n" 237 238 file.print "#{indent_str}[allocator(" 238 239 … … 269 270 nest = @end_region.gen_region_str_pre file 270 271 indent_str = " " * nest 272 nest_str = " " * nest 273 if @next_cell_port_subscript then 274 subscript = '[' + @next_cell_port_subscript.to_s + ']' 275 else 276 subscript = "" 277 end 271 278 272 279 file.print <<EOT 273 280 #{indent_str}cell #{@rpc_channel_celltype_name}Server #{@cell_name}Body { 274 #{indent_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name} ;281 #{indent_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name}#{subscript}; 275 282 //#{indent_str} #{@call_port_name} = #{@next_cell.get_name}.#{@next_cell_port_name}; 276 283 #{indent_str} //cTDR = #{@channelCellName}.eTDR; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2SVCPlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 … … 83 84 @@generated_celltype_header = {} 84 85 85 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell )86 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell ) 86 87 super 87 88 @ct_name_body = "#{@ct_name}SVCBody_#{@next_cell.get_name}_#{@next_cell_port_name}".to_sym … … 217 218 nest = @end_region.gen_region_str_pre file 218 219 nest_str = " " * nest 220 if @next_cell_port_subscript then 221 subscript = '[' + @next_cell_port_subscript.to_s + ']' 222 else 223 subscript = "" 224 end 219 225 220 226 # サーバー側チャンネルの生成 … … 224 230 #{nest_str} // Server Side Channel 225 231 #{nest_str} cell #{@ct_name_body} #{@cell_name_body}{ 226 #{nest_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name} ;232 #{nest_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name}#{subscript}; 227 233 #{nest_str} }; 228 234 EOT … … 241 247 nest = @start_region.gen_region_str_pre file 242 248 nest_str = " " * nest 249 if @next_cell_port_subscript then 250 subscript = '[' + @next_cell_port_subscript.to_s + ']' 251 else 252 subscript = "" 253 end 243 254 244 255 # クライアント側チャンネルの生成 … … 247 258 #{nest_str} // Client Side Channel 248 259 #{nest_str} cell #{@ct_name} #{@cell_name}{ 249 #{nest_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name} ;260 #{nest_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name}#{subscript}; 250 261 #{nest_str} }; 251 262 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2SemaphorePlugin.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/HRP2TaskPlugin.rb
r359 r374 53 53 # tab : 54 54 def print_cfg_cre(file, cell, val, tab) 55 val[:id] = val[:id].gsub( /(^|[^\$])\$id\$/, "\\1#{@celltype.get_name.to_s}_#{cell.get_name.to_s}" ) 55 #val[:id] = val[:id].gsub( /(^|[^\$])\$id\$/, "\\1#{@celltype.get_name.to_s}_#{cell.get_global_name.to_s}" ) 56 #val[:id] = @celltype.subst_name( val[:id], @celltype.get_name_array( cell ) ) 56 57 # $cbp$の代わり 57 58 index = cell.get_id - @celltype.get_id_base … … 59 60 cell_CB_name = "#{index}" 60 61 # CRE_XXX/DEF_XXXの生成 61 print "assign task plugin\n"62 dbgPrint "assign task plugin\n" 62 63 domainOption = cell.get_region.get_domain_root.get_domain_type.get_option 63 64 # if cell.get_region.get_region_type == :DOMAIN 65 # cell.show_tree 1 64 66 if domainOption != "OutOfDomain" 65 67 # 保護ドメインに属する場合 … … 69 71 raise "system task cannot have user stack." 70 72 end 73 p "CRE_TSK 0 user=#{val[:userStackSize]} system=#{val[:systemStackSize]}" 71 74 file.print <<EOT 72 75 #{tab}CRE_TSK(#{val[:id]}, { #{val[:taskAttribute]}, #{cell_CB_name}, tTask_start_task, #{val[:priority]}, #{val[:systemStackSize]}, NULL }); … … 77 80 raise "user task must have user stack." 78 81 end 82 p "CRE_TSK 1" 79 83 if val[:systemStackSize] == "OMIT" 80 84 file.print <<EOT … … 82 86 EOT 83 87 else 88 p "CRE_TSK 2" 84 89 file.print <<EOT 85 90 #{tab}CRE_TSK(#{val[:id]}, { #{val[:taskAttribute]}, #{cell_CB_name}, tTask_start_task, #{val[:priority]}, #{val[:userStackSize]}, NULL, #{val[:systemStackSize]}, NULL }); … … 138 143 regions = ct.get_domain_roots 139 144 regions_hrp2 = regions[ :HRP2 ] 140 print "HRP2 domain in #{ct.get_name}: "145 dbgPrint "HRP2 domain in #{ct.get_name}: " 141 146 regions_hrp2.each { |reg| 142 print reg.get_name147 dbgPrint reg.get_name 143 148 } 144 149 puts "" -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/MrubyBridgePlugin.rb
r359 r374 3 3 # mruby => TECS bridge 4 4 # 5 # Copyright (C) 2008-201 5by TOPPERS Project5 # Copyright (C) 2008-2017 by TOPPERS Project 6 6 # 7 7 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/MultiPlugin.rb
r359 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2017 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/NotifierPlugin.rb
r359 r374 1 1 # -*- coding: utf-8 -*- 2 # 3 # TECS Generator 4 # Generator for TOPPERS Embedded Component System 2 5 # 3 6 # Copyright (C) 2015 by Ushio Laboratory … … 5 8 # Copyright (C) 2015-2016 by Embedded and Real-Time Systems Laboratory 6 9 # Graduate School of Information Science, Nagoya Univ., JAPAN 10 # Copyright (C) 2015-2018 by TOPPERS Project 7 11 # 12 #-- 13 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ 14 # ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 15 # 変・再配布(以下,利用と呼ぶ)することを無償で許諾する. 16 # (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 17 # 権表示,この利用条件および下記の無保証規定が,そのままの形でソー 18 # スコード中に含まれていること. 19 # (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 20 # 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 21 # 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 22 # の無保証規定を掲載すること. 23 # (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 24 # 用できない形で再配布する場合には,次のいずれかの条件を満たすこ 25 # と. 26 # (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 27 # 作権表示,この利用条件および下記の無保証規定を掲載すること. 28 # (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに 29 # 報告すること. 30 # (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 31 # 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. 32 # また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理 33 # 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを 34 # 免責すること. 35 # 36 # 本ソフトウェアは,無保証で提供されているものである.上記著作権者お 37 # よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 38 # に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ 39 # アの利用により直接的または間接的に生じたいかなる損害に関しても,そ 40 # の責任を負わない. 41 # 42 # $Id$ 43 #++ 8 44 9 45 NotifierPluginArgProc = { … … 128 164 # @param [Cell, Symbol] cell セル.セルについて一般化する場合は `:generic` 129 165 # @param [Integer, Symbol, nil] subscript 添字.添字について一般化する場合は `:generic` 166 # @param [Celltype] 呼び先のセルタイプ、cell==:generic の場合のみ有効 130 167 # @private 131 def generate_inner(context, fn_name, cell, subscript )168 def generate_inner(context, fn_name, cell, subscript, callee_ct=nil) 132 169 source_file = context.source_file 133 170 header_file = context.header_file … … 141 178 unless ct.is_singleton? 142 179 if cell == :generic 143 params << "(CELLIDX)extinf" 180 params << "(#{callee_ct.get_global_name}_IDX)extinf" 181 # params << "(CELLIDX)extinf" 144 182 else 145 183 # セルのCELLIDXを得る … … 233 271 234 272 generate_inner context, fn_name, 235 :generic, subscript 273 :generic, subscript, ct 236 274 237 275 props.each { |prop| … … 445 483 # join:: Join : 結合 (declarationがPortであるもの) 446 484 def validate_join(handler, cell, join) 447 485 return !generate_attr_map(handler, cell).nil? 448 486 end 449 487 … … 872 910 parse_plugin_arg 873 911 unless @factory 874 cdl_error(" ASP1003 celltype $1: option factory is not specified",912 cdl_error("NTF1003 celltype $1: option factory is not specified", 875 913 celltype.get_name) 876 914 end 877 915 unless @output_file 878 cdl_error(" ASP1003 celltype $1: option output_file is not specified",916 cdl_error("NTF1003 celltype $1: option output_file is not specified", 879 917 celltype.get_name) 880 918 end … … 883 921 def set_factory(template_string) 884 922 unless @factory.nil? 885 cdl_error(" ASP1003 celltype $1: option factory was specified more than once",923 cdl_error("NTF1003 celltype $1: option factory was specified more than once", 886 924 celltype.get_name) 887 925 end … … 891 929 def set_factory_output_file(output_file) 892 930 unless @output_file.nil? 893 cdl_error(" ASP1003 celltype $1: option output_file was specified more than once",931 cdl_error("NTF1003 celltype $1: option output_file was specified more than once", 894 932 celltype.get_name) 895 933 end … … 898 936 899 937 def gen_factory file 900 puts "===== begin #{@celltype.get_name.to_s} plugin ====="938 # puts "===== begin #{@celltype.get_name.to_s} plugin =====" 901 939 902 940 kernelCfg = AppFile.open( "#{$gen}/#{@output_file}" ) … … 922 960 subst_attr = @celltype.find(name) 923 961 unless subst_attr 924 cdl_error( " ASP1007 celltype $1: additional_param: attribute $2 does not exist.",962 cdl_error( "NTF1007 celltype $1: additional_param: attribute $2 does not exist.", 925 963 @celltype.get_name, name) 926 964 end … … 935 973 936 974 kernelCfg.close 937 puts "===== end #{@celltype.get_name.to_s} plugin ====="975 # puts "===== end #{@celltype.get_name.to_s} plugin =====" 938 976 end 939 977 940 978 def gen_factory_for_cell(kernelCfg, cell) 979 # print "########## gen_factory_for_cell cell=#{cell.get_name}\n" 941 980 handler_flags = [] 942 981 handler_args = [] … … 959 998 when 'false' then ignoreErrors = false 960 999 else 961 cdl_warning ( "ASP1005 cell $1: unrecognized value '$2' specified for ignoreErrors",1000 cdl_warning2( cell.get_locale, "NTF1005 cell $1: unrecognized value '$2' specified for ignoreErrors", 962 1001 cell.get_name, ignoreErrors ) 963 1002 ignoreErrors = false 964 1003 end 965 1004 1005 # ドメイン指定用文字列 1006 pre_text = "" 1007 post_text = "\n" 1008 indent = "" 1009 966 1010 [EVENT_HANDLER, ERROR_HANDLER].each { |handler| 967 1011 # 呼び口の結合を取得 968 1012 call_join = cell.get_join_list.get_item(handler.call_port_name.to_sym) 1013 domain_root = cell.get_region.get_domain_root 1014 if cell.get_region.get_domain_root.get_domain_type then 1015 # print "cell=#{cell.get_name} domain_root=#{domain_root.get_name} domain_type=#{domain_root.get_domain_type.get_name} domain_option=#{domain_root.get_domain_type.get_option}\n" 1016 else 1017 # print "cell=#{cell.get_name} domain_root=#{cell.get_region.get_domain_root.get_name}\n" 1018 end 1019 if call_join 1020 # print "validate_join: hanlder=#{handler.class.name} cell=#{cell.get_name} join=#{call_join.get_name} rhs_cell=#{call_join.get_cell}\n" 1021 else 1022 # print "validate_join: hanlder=#{handler.class.name} cell=#{cell.get_name}\n" 1023 end 969 1024 970 1025 # ハンドラタイプを判別する … … 974 1029 975 1030 if matches.length == 0 976 cdl_error ( "ASP1001 cell $1: no matching handler type found for $2", cell.get_name, handler.call_port_name )1031 cdl_error2( cell.get_locale, "NTF1001 cell $1: no matching handler type found for $2", cell.get_name, handler.call_port_name ) 977 1032 next 978 1033 end 979 1034 980 1035 # 最初に見つかった有効なハンドラタイプを使用 981 1036 ht = matches[0] 1037 1038 # ドメインプラグインが指定されている場合、所属ドメインのチェック 1039 domain_root = cell.get_region.get_domain_root 1040 if domain_root.get_domain_type then 1041 if domain_root.get_domain_type.get_name == :HRP then 1042 option = domain_root.get_domain_type.get_option 1043 matches.each{ |match| 1044 # p "match:#{match}" 1045 case match 1046 when ActivateTaskHandlerType, WakeUpTaskHandlerType, 1047 SetVariableHandlerType, SetVariableToErrorCodeHandlerType, 1048 IncrementVariableHandlerType, SignalSemaphoreHandlerType, 1049 SetEventflagHandlerType, SendToDataqueueHandlerType, 1050 SendErrorCodeToDataqueueHandlerType 1051 if option == "OutOfDomain" then 1052 cdl_error2( cell.get_locale, "NTF9999: NotifierPlugin: $1 cannot be placed out of domain", cell.get_name ) 1053 elsif call_join.get_cell.get_region.get_domain_root == nil || 1054 call_join.get_cell.get_region.get_domain_root != domain_root then 1055 cdl_error2( cell.get_locale, "NTF9999: NotifierPlugin: $1 and $2 must be placed in same domain", cell.get_name, call_join.get_cell.get_name ) 1056 end 1057 dbgPrint "#{self.class.name}: match pattern 1.\n" 1058 when UserHandlerType 1059 if option != "kernel" then 1060 cdl_error2( cell.get_locale, "NTF9999: NotifierPlugin: $1 can be placed in kernel domain only, because notify target is handler", cell.get_name ) 1061 elsif call_join.get_cell.get_region.get_domain_root == nil || 1062 call_join.get_cell.get_region.get_domain_root != domain_root then 1063 cdl_error2( cell.get_locale, "NTF9999: NotifierPlugin: $1 and $2 must be placed in same domain", cell.get_name, call_join.get_cell.get_name ) 1064 end 1065 dbgPrint "#{self.class.name}: match pattern 2.\n" 1066 when NullHandlerType.new # エラー通知を指定していない 1067 dbgPrint "#{self.class.name}: match pattern 3.\n" 1068 end 1069 } 1070 1071 # if cell.get_region.get_param == :KERNEL_DOMAIN 1072 if option == "kernel" 1073 pre_text = "KERNEL_DOMAIN{\n" 1074 post_text = "}\n" 1075 indent = "\t" 1076 elsif option != "OutOfDomain" then 1077 pre_text = "DOMAIN(#{domain_root.get_name.to_s}){\n" 1078 post_text = "}\n" 1079 indent = "\t" 1080 end 1081 else 1082 cdl_error( "NTF9999: NotifierPlugin: unknown domain type $1", domain_root.get_domain_type.get_name ) 1083 end 1084 1085 end 982 1086 983 1087 # 通知ハンドラで「エラーが発生するはずがない」のに「エラーハンドラが指定されている」 … … 986 1090 # なため、検出は行わない。) 987 1091 if handler == ERROR_HANDLER && !ht.is_a?(NullHandlerType) && !event_handler_might_fail 988 cdl_error ( "ASP1004 cell $1: handler type $2 which never raises an error was inferred for the normal notification handler, but an error notification handler was specified.",1092 cdl_error2( cell.get_locale, "NTF1004 cell $1: handler type $2 which never raises an error was inferred for the normal notification handler, but an error notification handler was specified.", 989 1093 cell.get_name, handler_flag) 990 1094 end 991 1095 if handler == ERROR_HANDLER && ht.is_a?(NullHandlerType) && event_handler_might_fail && !ignoreErrors 992 cdl_warning ( "ASP1006 cell $1: handler type $2 which might raise an error was inferred for the normal notificaton handler, but an error notification handler was not specified.",1096 cdl_warning2( cell.get_locale, "NTF1006 cell $1: handler type $2 which might raise an error was inferred for the normal notificaton handler, but an error notification handler was not specified.", 993 1097 cell.get_name, handler_flag) 994 1098 end … … 1057 1161 # $id$等の置換 1058 1162 cell.get_celltype.subst_name(subst, name_array) 1059 } 1060 1061 # 出力 1062 kernelCfg.puts text 1063 1064 end 1065 private :gen_factory_for_cell 1163 } 1164 1165 # 出力 (CRE_xxx) 1166 kernelCfg.print pre_text 1167 kernelCfg.print indent, text, "\n" 1168 gen_sac kernelCfg, cell, indent 1169 kernelCfg.print post_text 1170 end 1171 1172 def gen_sac file, cell, indent 1173 domain_root = cell.get_region.get_domain_root 1174 if domain_root.get_domain_type then 1175 id = (cell.get_attr_initializer :id).to_s 1176 name_array = cell.get_celltype.get_name_array(cell) 1177 case cell.get_celltype.get_name 1178 when :tCyclicNotifier 1179 obj_type = "CYC" 1180 when :tAlarmNotifier 1181 obj_type = "ALM" 1182 else 1183 raise "NotifierPlugin: unknown celltype #{cell.get_celltype.get_name}" 1184 end 1185 id = cell.get_celltype.subst_name(id, name_array) 1186 # p obj_type 1187 # p HRPPlugin.get_sac_str cell 1188 file.print indent, "SAC_#{obj_type}( #{id}, #{HRPPlugin.get_sac_str cell} );\n" 1189 end 1190 end 1191 private :gen_factory_for_cell 1066 1192 1067 1193 end -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/OpaqueRPCPlugin.rb
r337 r374 56 56 #=== RPCPlugin の initialize 57 57 # 説明は ThroughPlugin (plugin.rb) を参照 58 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell )58 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell ) 59 59 super 60 60 @b_noClientSemaphore = false … … 254 254 nest = @end_region.gen_region_str_pre file 255 255 nest_str = " " * nest 256 if @next_cell_port_subscript then 257 subscript = '[' + @next_cell_port_subscript.to_s + ']' 258 else 259 subscript = "" 260 end 256 261 257 262 if @serverErrorHandler then … … 282 287 #{nest_str} cell #{@rpc_server_channel_celltype_name} #{@serverChannelCell}_Unmarshaler { 283 288 #{nest_str} cChannel = #{@serverChannelCell}.eC1; 284 #{nest_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name} ;289 #{nest_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name}#{subscript}; 285 290 #{serverErrorHandler_str}#{nest_str} }; 286 291 EOT -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/RPCPlugin.rb
r337 r374 65 65 #=== RPCPlugin の initialize 66 66 # 説明は ThroughPlugin (plugin.rb) を参照 67 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell )67 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell ) 68 68 super 69 69 @b_noClientSemaphore = false … … 197 197 nest = @region.gen_region_str_pre file 198 198 indent_str = " " * nest 199 if @next_cell_port_subscript then 200 subscript = '[' + @next_cell_port_subscript.to_s + ']' 201 else 202 subscript = "" 203 end 199 204 200 205 file.print <<EOT … … 233 238 file.print <<EOT 234 239 #{indent_str}cell #{@rpc_channel_celltype_name} #{@cell_name} { 235 #{indent_str} #{@call_port_name} = #{@next_cell.get_name}.#{@next_cell_port_name} ;240 #{indent_str} #{@call_port_name} = #{@next_cell.get_name}.#{@next_cell_port_name}#{subscript}; 236 241 #{indent_str} cTDR = #{@channelCellName}.eTDR; 237 242 #{indent_str} cEventflag = #{@channelCellName}.eEventflag; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/SharedOpaqueRPCPlugin.rb
r337 r374 68 68 #=== RPCPlugin の initialize 69 69 # 説明は ThroughPlugin (plugin.rb) を参照 70 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell )70 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell ) 71 71 super 72 72 initialize_opaque_marshaler … … 221 221 nest = @start_region.gen_region_str_pre file 222 222 indent_str = " " * nest 223 nest_str = " " * nest 224 if @next_cell_port_subscript then 225 subscript = '[' + @next_cell_port_subscript.to_s + ']' 226 else 227 subscript = "" 228 end 223 229 224 230 # セルを探す … … 303 309 #{indent_str}cell #{@unmarshaler_celltype_name} #{@cell_name}_Server { 304 310 #{indent_str} cTDR = #{@shared_channel_cell}_Server.eTDR; 305 #{indent_str} cServerCall = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name} ;311 #{indent_str} cServerCall = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name}#{subscript}; 306 312 #{ppallocator_join}#{indent_str}}; 307 313 EOT -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/SharedRPCPlugin.rb
r337 r374 62 62 #=== RPCPlugin の initialize 63 63 # 説明は ThroughPlugin (plugin.rb) を参照 64 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell )64 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell ) 65 65 66 66 # mikan プラグインオプション指定の不一致のチェック task_priority, … … 236 236 nest = @region.gen_region_str_pre file 237 237 indent_str = " " * nest 238 if @next_cell_port_subscript then 239 subscript = '[' + @next_cell_port_subscript.to_s + ']' 240 else 241 subscript = "" 242 end 238 243 239 244 # セルを探す … … 291 296 file.print <<EOT 292 297 #{indent_str}cell #{@rpc_channel_celltype_name} #{@cell_name} { 293 #{indent_str} #{@call_port_name} = #{@next_cell.get_name}.#{@next_cell_port_name} ;298 #{indent_str} #{@call_port_name} = #{@next_cell.get_name}.#{@next_cell_port_name}#{subscript}; 294 299 #{indent_str} cTDR = #{@shared_channel_cell}.eTDR; 295 300 #{indent_str} cEventflag = #{@shared_channel_cell}.eEventflag; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/ThroughPlugin.rb
r337 r374 47 47 #@next_cell:: Cell 呼び口を結合するセル 48 48 #@next_cell_port_name:: Symbol 呼び口を結合する受口の名前 49 #@next_cell_port_subscript::Nil|Integer 呼び口を結合する受口の配列添数.受け口配列でない場合 nil 49 50 #@signature:: Signature シグニチャ 50 51 #@celltype:: Celltype 呼び先のセルのセルタイプ. through が連接する場合、最終的な呼び先のセルのセルタイプ … … 74 75 #next_cell:: Cell 呼び口を接続するセル 75 76 #next_cell_port_name:: Symbol 呼び口を接続する受口の名前 77 #next_cell_port_subscript:: Nil|Integer 呼び口を接続する受口配列添数 76 78 #signature:: Signature シグニチャ 77 79 #celltype:: Celltype セルタイプ (呼び先のセルのセルタイプ) 78 80 #caller_cell:: Cell 呼び元のセル.@caller_cell の項を参照 79 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell )81 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell ) 80 82 super() 81 83 @cell_name = cell_name # 生成すべきセル名(受け口側のセル名) … … 83 85 @next_cell = next_cell # 呼び先のセル 84 86 @next_cell_port_name = next_cell_port_name 87 @next_cell_port_subscript = next_cell_port_subscript 85 88 @signature = signature 86 89 @entry_port_name = :"eThroughEntry" … … 136 139 def get_through_entry_port_name 137 140 @entry_port_name 141 end 142 143 #=== 生成されたセルの受け口配列添数を得る 144 def get_through_entry_port_subscript 145 @entry_port_subscript 138 146 end 139 147 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/TracePlugin.rb
r337 r374 44 44 #=== TracePlugin の initialize 45 45 # 説明は ThroughPlugin (plugin.rb) を参照 46 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell )46 def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell ) 47 47 48 48 @maxArrayDisplay = 16 … … 141 141 nest = @region.gen_region_str_pre file 142 142 indent_str = " " * nest 143 if @next_cell_port_subscript then 144 subscript = '[' + @next_cell_port_subscript.to_s + ']' 145 else 146 subscript = "" 147 end 143 148 144 149 if @probeName then … … 155 160 file.print <<EOT 156 161 #{indent_str}cell #{@ct_name} #{@cell_name} { 157 #{indent_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name} ;162 #{indent_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name}#{subscript}; 158 163 #{probeName_str}#{caller_cell_str}#{indent_str}}; 159 164 EOT … … 210 215 } 211 216 file.print( " );\n" ) 217 if @next_cell_port_subscript then 218 subscript = '[' + @next_cell_port_subscript.to_s + ']' 219 else 220 subscript = "" 221 end 212 222 213 223 file.print <<EOT 214 224 \tgetMicroTime( &utime ); 215 \tsyslog( LOG_INFO, \"Leave: %sTime=%d: #{@next_cell.get_name}.#{@next_cell_port_name} .#{func_name}\", ATTR_probeName_str, utime );225 \tsyslog( LOG_INFO, \"Leave: %sTime=%d: #{@next_cell.get_name}.#{@next_cell_port_name}#{subscript}.#{func_name}\", ATTR_probeName_str, utime ); 216 226 EOT 217 227 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenHRP2Marshaler.rb
r337 r374 35 35 # の責任を負わない. 36 36 # 37 # $Id$ 37 38 #++ 38 39 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenOpaqueMarshaler.rb
r337 r374 4 4 # Generator for TOPPERS Embedded Component System 5 5 # 6 # Copyright (C) 2008-201 4by TOPPERS Project6 # Copyright (C) 2008-2018 by TOPPERS Project 7 7 #-- 8 8 # 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ … … 464 464 /* Channel Lock */ 465 465 SET_RPC_STATE( state_, RPCSTATE_CLIENT_GET_SEM ); 466 if( is_cLockChannel_joined() ) 467 cLockChannel_wait(); 466 if( is_cLockChannel_joined() ){ 467 if( (ercd_=cLockChannel_wait()) != E_OK ) 468 goto error_reset; 469 } 468 470 EOT 469 471 … … 554 556 /* Channel Unlock */ 555 557 SET_RPC_STATE( state_, RPCSTATE_CLIENT_RELEASE_SEM ); 556 if( is_cLockChannel_joined() ) 557 cLockChannel_signal(); 558 if( is_cLockChannel_joined() ){ 559 if( (ercd_=cLockChannel_signal()) != E_OK ) 560 goto error_reset; 561 } 562 EOT 563 564 file.print <<EOT 565 /* state_ is not used in normal case */ 566 /* below is to avoid 'set but not used' warnning */ 567 (void)state_; 558 568 EOT 559 569 … … 630 640 file.print <<EOT 631 641 }else{ 632 return ;642 return E_ID; 633 643 } 634 644 EOT -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/plugin/lib/GenTransparentMarshaler.rb
r337 r374 388 388 }; 389 389 #{ppallocator_dealloc_str} 390 return ;390 return E_OK; 391 391 392 392 error_reset: … … 394 394 (void)cTDR_reset(); 395 395 #{ppallocator_dealloc_str} 396 return E_OK; 396 397 EOT 397 398 -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tecsgen/tecslib/version.rb
r337 r374 1 1 $package = "tecsgen" 2 $version = "1. 5.0"2 $version = "1.6.4" -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netdev/if_btusb/Makefile.tinet
r337 r374 42 42 INCLUDES := $(INCLUDES) -I$(TINET_ROOT)/netdev/$(NET_DEV) 43 43 TINET_DIRS := $(TINET_DIRS):$(TINET_ROOT)/netdev/$(NET_DEV) 44 TINET_COBJS := $(TINET_COBJS) nap_main.o panu_main.o if_btusb.o44 TINET_COBJS := $(TINET_COBJS) bt_main.o if_btusb.o 45 45 TINET_KERNEL_CFG := $(TINET_KERNEL_CFG) $(TINET_ROOT)/netdev/$(NET_DEV)/if_btusb.cfg -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netdev/if_btusb/bt_main.c
r373 r374 58 58 #include "sdp.h" 59 59 #include "pan.h" 60 #include "panu_main.h" 60 #include "bt_main.h" 61 #include "usb_hbth.h" 61 62 62 63 //#define PACKET_DUMP … … 66 67 67 68 #define RFCOMM_SERVER_CHANNEL 1 68 /*static*/uint16_t rfcomm_channel_id = FAILED_RFCOMM_ID_NOT_SET;69 static uint16_t rfcomm_channel_id = FAILED_RFCOMM_ID_NOT_SET; 69 70 70 71 static int record_id = -1; … … 90 91 91 92 volatile int bt_bnep_mode = 0; 92 bool_t bt_enabled = false; 93 94 enum bt_state_t { 95 BT_STATE_DORMANT, 96 BT_STATE_POWER_ON, 97 BT_STATE_BNEP_QUERY, 98 BT_STATE_BNEP_WAIT, 99 BT_STATE_BNEP_QUERY_WAIT, 100 BT_STATE_CONNECTING, 101 BT_STATE_CONNECTED, 102 }; 103 104 enum bt_state_t bt_state = BT_STATE_DORMANT; 105 int bt_timer; 93 106 94 107 // outgoing network packet … … 108 121 break; 109 122 case DE_SIZE_VAR_16: 110 len = READ_NET_16(element, 1);123 len = big_endian_read_16(element, 1); 111 124 break; 112 125 default: … … 129 142 130 143 // accept first entry or if we foudn a NAP and only have a PANU yet 131 if ((bnep_remote_uuid == 0) || (sdp_bnep_remote_uuid == B NEP_UUID_NAP && bnep_remote_uuid == BNEP_UUID_PANU)) {144 if ((bnep_remote_uuid == 0) || (sdp_bnep_remote_uuid == BLUETOOTH_SERVICE_CLASS_NAP && bnep_remote_uuid == BLUETOOTH_SERVICE_CLASS_PANU)) { 132 145 bnep_l2cap_psm = sdp_bnep_l2cap_psm; 133 146 bnep_remote_uuid = sdp_bnep_remote_uuid; … … 146 159 147 160 switch (event->type) { 148 case SDP_ QUERY_ATTRIBUTE_VALUE:161 case SDP_EVENT_QUERY_ATTRIBUTE_VALUE: 149 162 value_event = (sdp_query_attribute_value_event_t*)event; 150 163 … … 165 178 166 179 switch (value_event->attribute_id) { 167 case SDP_ServiceClassIDList:180 case BLUETOOTH_ATTRIBUTE_SERVICE_CLASS_ID_LIST: 168 181 if (de_get_element_type(attribute_value) != DE_DES) break; 169 182 for (des_iterator_init(&des_list_it, attribute_value); des_iterator_has_more(&des_list_it); des_iterator_next(&des_list_it)) { … … 172 185 uint32_t uuid = de_get_uuid32(element); 173 186 switch (uuid) { 174 case B NEP_UUID_PANU:175 case B NEP_UUID_NAP:176 case B NEP_UUID_GN:187 case BLUETOOTH_SERVICE_CLASS_PANU: 188 case BLUETOOTH_SERVICE_CLASS_NAP: 189 case BLUETOOTH_SERVICE_CLASS_GN: 177 190 log_info("SDP Attribute 0x%04x: BNEP PAN protocol UUID: %04x", value_event->attribute_id, uuid); 178 191 sdp_bnep_remote_uuid = uuid; … … 192 205 free(str); 193 206 break; 194 case SDP_ProtocolDescriptorList: {207 case BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST: { 195 208 log_info("SDP Attribute: 0x%04x", value_event->attribute_id); 196 209 … … 210 223 uuid = de_get_uuid32(element); 211 224 switch (uuid) { 212 case SDP_L2CAPProtocol:225 case BLUETOOTH_PROTOCOL_L2CAP: 213 226 if (!des_iterator_has_more(&prot_it)) continue; 214 227 des_iterator_next(&prot_it); 215 228 de_element_get_uint16(des_iterator_get_element(&prot_it), &sdp_bnep_l2cap_psm); 216 229 break; 217 case SDP_BNEPProtocol:230 case BLUETOOTH_PROTOCOL_BNEP: 218 231 if (!des_iterator_has_more(&prot_it)) continue; 219 232 des_iterator_next(&prot_it); … … 238 251 break; 239 252 240 case SDP_ QUERY_COMPLETE:253 case SDP_EVENT_QUERY_COMPLETE: 241 254 handle_sdp_client_record_complete(); 242 255 complete_event = (sdp_query_complete_event_t*)event; … … 246 259 } 247 260 else { 261 bnep_do_connect = false; 248 262 log_error("No BNEP service found"); 263 } 264 if (!bnep_do_connect) { 265 // 20秒後 BNEP Query 開始 266 bt_state = BT_STATE_BNEP_QUERY_WAIT; 267 bt_timer = 20 * 1000; 249 268 } 250 269 break; … … 269 288 if (packet[2] == HCI_STATE_WORKING) { 270 289 hci_send_cmd(&hci_write_local_name, bt_localname); 271 /* Send a general query for BNEP Protocol ID */ 272 log_info("Start SDP BNEP query."); 273 sdp_general_query_for_uuid(remote_addr, SDP_BNEPProtocol); 290 if (bt_bnep_mode == 0) { 291 // 即時 BNEP Query 開始 292 bt_state = BT_STATE_BNEP_QUERY_WAIT; 293 bt_timer = 0; 294 } 295 else { 296 bt_state = BT_STATE_BNEP_WAIT; 297 bt_timer = -1; 298 } 274 299 } 275 300 break; … … 284 309 285 310 case HCI_EVENT_COMMAND_COMPLETE: 286 if ( COMMAND_COMPLETE_EVENT(packet, hci_read_bd_addr)) {287 bt_flip_addr(event_addr, &packet[6]);311 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_bd_addr)) { 312 reverse_bd_addr(&packet[6], event_addr); 288 313 log_info("BD-ADDR: %s", bd_addr_to_str(event_addr)); 289 314 … … 292 317 break; 293 318 } 294 if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name)) {295 hci_discoverable_control(1);319 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_write_local_name)) { 320 gap_discoverable_control(1); 296 321 break; 297 322 } … … 301 326 // deny link key request 302 327 log_info("Link key request"); 303 bt_flip_addr(event_addr, &packet[2]);328 reverse_bd_addr(&packet[2], event_addr); 304 329 hci_send_cmd(&hci_link_key_request_negative_reply, &event_addr); 305 330 break; … … 308 333 // inform about pin code request 309 334 log_info("Pin code request - using '0000'"); 310 bt_flip_addr(event_addr, &packet[2]);335 reverse_bd_addr(&packet[2], event_addr); 311 336 hci_send_cmd(&hci_pin_code_request_reply, &event_addr, 4, "0000"); 312 337 break; … … 314 339 case HCI_EVENT_USER_CONFIRMATION_REQUEST: 315 340 // inform about user confirmation request 316 log_info("HCI User Confirmation Request with numeric value '%06u'", READ_BT_32(packet, 8));341 log_info("HCI User Confirmation Request with numeric value '%06u'", little_endian_read_32(packet, 8)); 317 342 log_info("HCI User Confirmation Auto accept"); 318 343 break; … … 320 345 case RFCOMM_EVENT_INCOMING_CONNECTION: 321 346 // data: event (8), len(8), address(48), channel (8), rfcomm_cid (16) 322 bt_flip_addr(event_addr, &packet[2]);347 reverse_bd_addr(&packet[2], event_addr); 323 348 rfcomm_channel_nr = packet[8]; 324 rfcomm_channel_id = READ_BT_16(packet, 9);349 rfcomm_channel_id = little_endian_read_16(packet, 9); 325 350 log_info("RFCOMM channel %u requested for %s", rfcomm_channel_nr, bd_addr_to_str(event_addr)); 326 351 rfcomm_accept_connection_internal(rfcomm_channel_id); … … 333 358 } 334 359 else { 335 rfcomm_channel_id = READ_BT_16(packet, 12);336 mtu = READ_BT_16(packet, 14);360 rfcomm_channel_id = little_endian_read_16(packet, 12); 361 mtu = little_endian_read_16(packet, 14); 337 362 log_info("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u", rfcomm_channel_id, mtu); 338 363 } … … 347 372 if (packet[2]) { 348 373 log_info("BNEP channel open failed, status %02x", packet[2]); 374 375 // 30秒後 BNEP Query 開始 376 bt_state = BT_STATE_BNEP_QUERY_WAIT; 377 bt_timer = 30 * 1000; 349 378 } 350 379 else { 351 380 // data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), remote_address (48) 352 bnep_cid = READ_BT_16(packet, 3);353 uuid_source = READ_BT_16(packet, 5);354 uuid_dest = READ_BT_16(packet, 7);355 mtu = READ_BT_16(packet, 9);356 // bt_flip_addr(remote_addr, &packet[11]);381 bnep_cid = little_endian_read_16(packet, 3); 382 uuid_source = little_endian_read_16(packet, 5); 383 uuid_dest = little_endian_read_16(packet, 7); 384 mtu = little_endian_read_16(packet, 9); 385 //reverse_bd_addr(&packet[11], remote_addr); 357 386 memcpy(&remote_addr, &packet[11], sizeof(bd_addr_t)); 358 387 log_info("BNEP connection open succeeded to %s source UUID 0x%04x dest UUID: 0x%04x, max frame size %u", bd_addr_to_str(event_addr), uuid_source, uuid_dest, mtu); … … 360 389 btstack_network_up(bnep_cid, (uint8_t *)hci_local_bd_addr(), (uint8_t *)remote_addr); 361 390 log_info("Network Interface %s activated", btstack_network_get_name(bnep_cid)); 391 392 bt_state = BT_STATE_CONNECTED; 393 bt_timer = -1; 362 394 } 363 395 break; … … 368 400 369 401 case BNEP_EVENT_CHANNEL_CLOSED: 370 bnep_cid = READ_BT_16(packet, 2);402 bnep_cid = little_endian_read_16(packet, 2); 371 403 bt_channel_closed(bnep_cid); 404 405 // 30秒後 BNEP Query 開始 406 bt_state = BT_STATE_BNEP_QUERY_WAIT; 407 bt_timer = 30 * 1000; 372 408 break; 373 409 374 410 case BNEP_EVENT_READY_TO_SEND: 375 bnep_cid = READ_BT_16(packet, 2);411 bnep_cid = little_endian_read_16(packet, 2); 376 412 bt_send_packet(bnep_cid); 377 413 break; … … 428 464 } 429 465 430 void panu_init(void)466 void bt_init(void) 431 467 { 432 468 const hci_transport_t *transport; … … 437 473 service_record_item_t *bnep_service_record_item; 438 474 475 btstack_network_init(&network_send_packet_callback); 476 439 477 //hci_dump_open("", HCI_DUMP_PACKETLOGGER); 440 441 log_info("bt初期化...");442 478 443 479 // start with BTstack init - especially configure HCI Transport … … 446 482 447 483 /* Initialize HCI */ 448 log_info("HCI初期化...");449 484 transport = hci_transport_usb_instance(); 450 485 control = NULL; … … 455 490 456 491 /* Initialize L2CAP */ 457 log_info("L2CAP初期化...");458 492 l2cap_init(); 459 493 l2cap_register_packet_handler(packet_handler); 460 494 461 495 /* Initialise SDP, create record for SPP and register with SDP */ 462 log_info("SDP初期化...");463 496 sdp_init(); 464 497 465 498 /* Initialize RFCOMM */ 466 log_info("RFCOMM初期化...");467 499 rfcomm_init(); 468 500 rfcomm_register_packet_handler(packet_handler); … … 470 502 471 503 /* Initialise BNEP */ 472 log_info("BNEP初期化...");473 504 bnep_init(); 474 505 bnep_register_packet_handler(packet_handler); 475 bnep_register_service(NULL, BNEP_UUID_PANU, BNEP_MTU_MIN); /* Minimum L2CAP MTU for bnep is 1691 bytes */ 506 if (bt_bnep_mode == 0) { 507 bnep_register_service(NULL, BLUETOOTH_SERVICE_CLASS_PANU, BNEP_MTU_MIN); /* Minimum L2CAP MTU for bnep is 1691 bytes */ 508 } 509 else { 510 bnep_register_service(NULL, BLUETOOTH_SERVICE_CLASS_NAP, BNEP_MTU_MIN); /* Minimum L2CAP MTU for bnep is 1691 bytes */ 511 } 476 512 477 513 memset(spp_service_buffer, 0, sizeof(spp_service_buffer)); … … 482 518 bnep_service_record_item = (service_record_item_t *)bnep_service_buffer; 483 519 484 log_info("SPPサービス登録...");485 520 sdp_create_spp_service((uint8_t*)&spp_service_record_item->service_record, 1, "RX SPP"); 486 521 de_dump_data_element((uint8_t*)spp_service_record_item->service_record); … … 488 523 sdp_register_service_internal(NULL, spp_service_record_item); 489 524 490 log_info("BNEPサービス登録..."); 491 pan_create_panu_service((uint8_t*)&bnep_service_record_item->service_record, "RX PANU", "RX PANU", BNEP_SECURITY_NONE); 492 de_dump_data_element((uint8_t*)bnep_service_record_item->service_record); 493 log_info("PANU SDP service buffer size: %u", (uint16_t)(sizeof(service_record_item_t) + de_get_len((uint8_t*)bnep_service_record_item->service_record))); 525 if (bt_bnep_mode == 0) { 526 pan_create_panu_service((uint8_t*)&bnep_service_record_item->service_record, "RX PANU", "RX PANU", BNEP_SECURITY_NONE); 527 de_dump_data_element((uint8_t*)bnep_service_record_item->service_record); 528 log_info("PANU SDP service buffer size: %u", (uint16_t)(sizeof(service_record_item_t) + de_get_len((uint8_t*)bnep_service_record_item->service_record))); 529 } 530 else { 531 pan_create_nap_service((uint8_t*)&bnep_service_record_item->service_record, "RX NAP", "RX NAP", BNEP_SECURITY_NONE, 532 PAN_NET_ACCESS_TYPE_100MB_ETHERNET, 0x0001312D0/*10Mb/sec*/, NULL, NULL); 533 de_dump_data_element((uint8_t*)bnep_service_record_item->service_record); 534 log_info("NAP SDP service buffer size: %u", (uint16_t)(sizeof(service_record_item_t) + de_get_len((uint8_t*)bnep_service_record_item->service_record))); 535 } 494 536 sdp_register_service_internal(NULL, bnep_service_record_item); 495 537 … … 500 542 501 543 /* Turn on the device */ 502 log_info("HCI電源ON...");503 544 hci_power_control(HCI_POWER_ON); 504 545 … … 506 547 sdp_parser_init(); 507 548 sdp_parser_register_callback(handle_sdp_client_query_result); 508 } 509 510 void nap_init(void); 511 512 void bt_init(void) 513 { 514 btstack_network_init(&network_send_packet_callback); 515 516 if (bt_bnep_mode == 0) { 517 panu_init(); 518 } 519 else { 520 nap_init(); 521 } 522 523 bt_enabled = true; 524 } 525 526 void bt_task(void) 527 { 528 extern void hal_tick_handler(); 529 530 if (bt_enabled) { 531 hal_tick_handler(); 549 550 bt_state = BT_STATE_POWER_ON; 551 bt_timer = -1; 552 } 553 554 void bt_process(void) 555 { 556 if (bt_state != BT_STATE_DORMANT) { 532 557 run_loop_execute(); 533 558 bt_send_packet(0xffff); 559 } 560 561 if (bt_timer != 0) 562 return; 563 564 switch (bt_state) { 565 case BT_STATE_BNEP_QUERY_WAIT: 566 /* Send a general query for BNEP Protocol ID */ 567 log_info("Start SDP BNEP query."); 568 sdp_general_query_for_uuid(remote_addr, BLUETOOTH_PROTOCOL_BNEP); 569 570 bt_state = BT_STATE_BNEP_QUERY; 571 bt_timer = -1; 572 break; 573 default: 574 bt_timer = -1; 575 break; 534 576 } 535 577 } … … 592 634 hci_close(); 593 635 594 bt_enabled = false; 595 } 636 bt_state = BT_STATE_DORMANT; 637 bt_timer = -1; 638 } 639 640 void bt_task_on_start(struct task_if_t *task, ID tskid) 641 { 642 } 643 644 void bt_task_on_end(struct task_if_t *task) 645 { 646 } 647 648 int bt_task_get_timer(struct task_if_t *task) 649 { 650 return bt_timer; 651 } 652 653 void bt_task_progress(struct task_if_t *task, int elapse) 654 { 655 if (bt_timer == -1) 656 return; 657 658 bt_timer -= elapse; 659 if (bt_timer < 0) 660 bt_timer = 0; 661 } 662 663 void bt_task_process(struct task_if_t *task, enum task_event_t event) 664 { 665 extern void hal_tick_handler(); 666 667 switch (event & ~TASK_EVENT_TICK) { 668 case TASK_EVENT_START: 669 bt_init(); 670 break; 671 case TASK_EVENT_TERMINATE: 672 bt_terminate(); 673 break; 674 case TASK_EVENT_WAKEUP: 675 case TASK_EVENT_TIMEOUT: 676 if (event & TASK_EVENT_TICK) 677 hal_tick_handler(); 678 bt_process(); 679 break; 680 } 681 } 682 683 struct task_if_t bt_task = { 684 bt_task_on_start, 685 bt_task_on_end, 686 bt_task_get_timer, 687 bt_task_progress, 688 bt_task_process, 689 }; -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netdev/if_btusb/bt_main.h
r373 r374 1 1 /* 2 * panu_main.h2 * bt_main.h 3 3 * 4 4 */ … … 16 16 17 17 void bt_init(void); 18 void bt_task(void);19 18 int bt_can_send_packet(void); 20 19 void bt_send_packet(uint16_t bnep_cid); -
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/netdev/if_btusb/if_btusb.c
r364 r374 79 79 #include "kernel/kernel_impl.h" 80 80 #include "btstack/utils.h" 81 #include " panu_main.h"81 #include "bt_main.h" 82 82 #include "usb_hbth.h" 83 83 //#include "hal_cpu.h" -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/Debug/Makefile
r365 r374 155 155 156 156 # 157 # mbedサービスの定義 158 # 159 160 include $(SRCDIR)/mbed/Makefile.mbed 161 162 # 157 163 # 共通コンパイルオプションの定義 158 164 # … … 180 186 181 187 APPLDIRS := $(APPLDIRS) ../../ntshell/tlsf ../../ntshell/fatfs ../../ntshell/ntshell ../../ntshell/ntshell/core ../../ntshell/ntshell/util ../../ntshell/src 182 APPL_COBJS := $(APPL_COBJS) ntshell_main.o mbed_api.ofdtable.o io_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o188 APPL_COBJS := $(APPL_COBJS) ntshell_main.o fdtable.o io_stub.o ffarch.o diskio.o ff.o mmc_rspi.o ccsbcs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o tlsf.o 183 189 184 190 # … … 194 200 ifdef USE_CXX 195 201 APPL_CXXOBJS := main.o 196 APPL_COBJS := $(APPL_COBJS) ether_phy.o if_btusb.o if_rx62n.o nap_main.o panu_main.o197 else 198 APPL_COBJS := $(APPL_COBJS) main.o ether_phy.o if_btusb.o if_rx62n.o nap_main.o panu_main.o202 APPL_COBJS := $(APPL_COBJS) ether_phy.o if_btusb.o if_rx62n.o bt_main.o 203 else 204 APPL_COBJS := $(APPL_COBJS) main.o ether_phy.o if_btusb.o if_rx62n.o bt_main.o 199 205 endif 200 206 APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/src/bt_main.c
r373 r374 58 58 #include "sdp.h" 59 59 #include "pan.h" 60 #include "panu_main.h" 60 #include "bt_main.h" 61 #include "usb_hbth.h" 61 62 62 63 //#define PACKET_DUMP … … 66 67 67 68 #define RFCOMM_SERVER_CHANNEL 1 68 /*static*/uint16_t rfcomm_channel_id = FAILED_RFCOMM_ID_NOT_SET;69 static uint16_t rfcomm_channel_id = FAILED_RFCOMM_ID_NOT_SET; 69 70 70 71 static int record_id = -1; … … 90 91 91 92 volatile int bt_bnep_mode = 0; 92 bool_t bt_enabled = false; 93 94 enum bt_state_t { 95 BT_STATE_DORMANT, 96 BT_STATE_POWER_ON, 97 BT_STATE_BNEP_QUERY, 98 BT_STATE_BNEP_WAIT, 99 BT_STATE_BNEP_QUERY_WAIT, 100 BT_STATE_CONNECTING, 101 BT_STATE_CONNECTED, 102 }; 103 104 enum bt_state_t bt_state = BT_STATE_DORMANT; 105 int bt_timer; 93 106 94 107 // outgoing network packet … … 108 121 break; 109 122 case DE_SIZE_VAR_16: 110 len = READ_NET_16(element, 1);123 len = big_endian_read_16(element, 1); 111 124 break; 112 125 default: … … 129 142 130 143 // accept first entry or if we foudn a NAP and only have a PANU yet 131 if ((bnep_remote_uuid == 0) || (sdp_bnep_remote_uuid == B NEP_UUID_NAP && bnep_remote_uuid == BNEP_UUID_PANU)) {144 if ((bnep_remote_uuid == 0) || (sdp_bnep_remote_uuid == BLUETOOTH_SERVICE_CLASS_NAP && bnep_remote_uuid == BLUETOOTH_SERVICE_CLASS_PANU)) { 132 145 bnep_l2cap_psm = sdp_bnep_l2cap_psm; 133 146 bnep_remote_uuid = sdp_bnep_remote_uuid; … … 146 159 147 160 switch (event->type) { 148 case SDP_ QUERY_ATTRIBUTE_VALUE:161 case SDP_EVENT_QUERY_ATTRIBUTE_VALUE: 149 162 value_event = (sdp_query_attribute_value_event_t*)event; 150 163 … … 165 178 166 179 switch (value_event->attribute_id) { 167 case SDP_ServiceClassIDList:180 case BLUETOOTH_ATTRIBUTE_SERVICE_CLASS_ID_LIST: 168 181 if (de_get_element_type(attribute_value) != DE_DES) break; 169 182 for (des_iterator_init(&des_list_it, attribute_value); des_iterator_has_more(&des_list_it); des_iterator_next(&des_list_it)) { … … 172 185 uint32_t uuid = de_get_uuid32(element); 173 186 switch (uuid) { 174 case B NEP_UUID_PANU:175 case B NEP_UUID_NAP:176 case B NEP_UUID_GN:187 case BLUETOOTH_SERVICE_CLASS_PANU: 188 case BLUETOOTH_SERVICE_CLASS_NAP: 189 case BLUETOOTH_SERVICE_CLASS_GN: 177 190 log_info("SDP Attribute 0x%04x: BNEP PAN protocol UUID: %04x", value_event->attribute_id, uuid); 178 191 sdp_bnep_remote_uuid = uuid; … … 192 205 free(str); 193 206 break; 194 case SDP_ProtocolDescriptorList: {207 case BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST: { 195 208 log_info("SDP Attribute: 0x%04x", value_event->attribute_id); 196 209 … … 210 223 uuid = de_get_uuid32(element); 211 224 switch (uuid) { 212 case SDP_L2CAPProtocol:225 case BLUETOOTH_PROTOCOL_L2CAP: 213 226 if (!des_iterator_has_more(&prot_it)) continue; 214 227 des_iterator_next(&prot_it); 215 228 de_element_get_uint16(des_iterator_get_element(&prot_it), &sdp_bnep_l2cap_psm); 216 229 break; 217 case SDP_BNEPProtocol:230 case BLUETOOTH_PROTOCOL_BNEP: 218 231 if (!des_iterator_has_more(&prot_it)) continue; 219 232 des_iterator_next(&prot_it); … … 238 251 break; 239 252 240 case SDP_ QUERY_COMPLETE:253 case SDP_EVENT_QUERY_COMPLETE: 241 254 handle_sdp_client_record_complete(); 242 255 complete_event = (sdp_query_complete_event_t*)event; … … 246 259 } 247 260 else { 261 bnep_do_connect = false; 248 262 log_error("No BNEP service found"); 263 } 264 if (!bnep_do_connect) { 265 // 20秒後 BNEP Query 開始 266 bt_state = BT_STATE_BNEP_QUERY_WAIT; 267 bt_timer = 20 * 1000; 249 268 } 250 269 break; … … 269 288 if (packet[2] == HCI_STATE_WORKING) { 270 289 hci_send_cmd(&hci_write_local_name, bt_localname); 271 /* Send a general query for BNEP Protocol ID */ 272 log_info("Start SDP BNEP query."); 273 sdp_general_query_for_uuid(remote_addr, SDP_BNEPProtocol); 290 if (bt_bnep_mode == 0) { 291 // 即時 BNEP Query 開始 292 bt_state = BT_STATE_BNEP_QUERY_WAIT; 293 bt_timer = 0; 294 } 295 else { 296 bt_state = BT_STATE_BNEP_WAIT; 297 bt_timer = -1; 298 } 274 299 } 275 300 break; … … 284 309 285 310 case HCI_EVENT_COMMAND_COMPLETE: 286 if ( COMMAND_COMPLETE_EVENT(packet, hci_read_bd_addr)) {287 bt_flip_addr(event_addr, &packet[6]);311 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_bd_addr)) { 312 reverse_bd_addr(&packet[6], event_addr); 288 313 log_info("BD-ADDR: %s", bd_addr_to_str(event_addr)); 289 314 … … 292 317 break; 293 318 } 294 if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name)) {295 hci_discoverable_control(1);319 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_write_local_name)) { 320 gap_discoverable_control(1); 296 321 break; 297 322 } … … 301 326 // deny link key request 302 327 log_info("Link key request"); 303 bt_flip_addr(event_addr, &packet[2]);328 reverse_bd_addr(&packet[2], event_addr); 304 329 hci_send_cmd(&hci_link_key_request_negative_reply, &event_addr); 305 330 break; … … 308 333 // inform about pin code request 309 334 log_info("Pin code request - using '0000'"); 310 bt_flip_addr(event_addr, &packet[2]);335 reverse_bd_addr(&packet[2], event_addr); 311 336 hci_send_cmd(&hci_pin_code_request_reply, &event_addr, 4, "0000"); 312 337 break; … … 314 339 case HCI_EVENT_USER_CONFIRMATION_REQUEST: 315 340 // inform about user confirmation request 316 log_info("HCI User Confirmation Request with numeric value '%06u'", READ_BT_32(packet, 8));341 log_info("HCI User Confirmation Request with numeric value '%06u'", little_endian_read_32(packet, 8)); 317 342 log_info("HCI User Confirmation Auto accept"); 318 343 break; … … 320 345 case RFCOMM_EVENT_INCOMING_CONNECTION: 321 346 // data: event (8), len(8), address(48), channel (8), rfcomm_cid (16) 322 bt_flip_addr(event_addr, &packet[2]);347 reverse_bd_addr(&packet[2], event_addr); 323 348 rfcomm_channel_nr = packet[8]; 324 rfcomm_channel_id = READ_BT_16(packet, 9);349 rfcomm_channel_id = little_endian_read_16(packet, 9); 325 350 log_info("RFCOMM channel %u requested for %s", rfcomm_channel_nr, bd_addr_to_str(event_addr)); 326 351 rfcomm_accept_connection_internal(rfcomm_channel_id); … … 333 358 } 334 359 else { 335 rfcomm_channel_id = READ_BT_16(packet, 12);336 mtu = READ_BT_16(packet, 14);360 rfcomm_channel_id = little_endian_read_16(packet, 12); 361 mtu = little_endian_read_16(packet, 14); 337 362 log_info("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u", rfcomm_channel_id, mtu); 338 363 } … … 347 372 if (packet[2]) { 348 373 log_info("BNEP channel open failed, status %02x", packet[2]); 374 375 // 30秒後 BNEP Query 開始 376 bt_state = BT_STATE_BNEP_QUERY_WAIT; 377 bt_timer = 30 * 1000; 349 378 } 350 379 else { 351 380 // data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), remote_address (48) 352 bnep_cid = READ_BT_16(packet, 3);353 uuid_source = READ_BT_16(packet, 5);354 uuid_dest = READ_BT_16(packet, 7);355 mtu = READ_BT_16(packet, 9);356 // bt_flip_addr(remote_addr, &packet[11]);381 bnep_cid = little_endian_read_16(packet, 3); 382 uuid_source = little_endian_read_16(packet, 5); 383 uuid_dest = little_endian_read_16(packet, 7); 384 mtu = little_endian_read_16(packet, 9); 385 //reverse_bd_addr(&packet[11], remote_addr); 357 386 memcpy(&remote_addr, &packet[11], sizeof(bd_addr_t)); 358 387 log_info("BNEP connection open succeeded to %s source UUID 0x%04x dest UUID: 0x%04x, max frame size %u", bd_addr_to_str(event_addr), uuid_source, uuid_dest, mtu); … … 360 389 btstack_network_up(bnep_cid, (uint8_t *)hci_local_bd_addr(), (uint8_t *)remote_addr); 361 390 log_info("Network Interface %s activated", btstack_network_get_name(bnep_cid)); 391 392 bt_state = BT_STATE_CONNECTED; 393 bt_timer = -1; 362 394 } 363 395 break; … … 368 400 369 401 case BNEP_EVENT_CHANNEL_CLOSED: 370 bnep_cid = READ_BT_16(packet, 2);402 bnep_cid = little_endian_read_16(packet, 2); 371 403 bt_channel_closed(bnep_cid); 404 405 // 30秒後 BNEP Query 開始 406 bt_state = BT_STATE_BNEP_QUERY_WAIT; 407 bt_timer = 30 * 1000; 372 408 break; 373 409 374 410 case BNEP_EVENT_READY_TO_SEND: 375 bnep_cid = READ_BT_16(packet, 2);411 bnep_cid = little_endian_read_16(packet, 2); 376 412 bt_send_packet(bnep_cid); 377 413 break; … … 428 464 } 429 465 430 void panu_init(void)466 void bt_init(void) 431 467 { 432 468 const hci_transport_t *transport; … … 437 473 service_record_item_t *bnep_service_record_item; 438 474 475 btstack_network_init(&network_send_packet_callback); 476 439 477 //hci_dump_open("", HCI_DUMP_PACKETLOGGER); 440 441 log_info("bt初期化...");442 478 443 479 // start with BTstack init - especially configure HCI Transport … … 446 482 447 483 /* Initialize HCI */ 448 log_info("HCI初期化...");449 484 transport = hci_transport_usb_instance(); 450 485 control = NULL; … … 455 490 456 491 /* Initialize L2CAP */ 457 log_info("L2CAP初期化...");458 492 l2cap_init(); 459 493 l2cap_register_packet_handler(packet_handler); 460 494 461 495 /* Initialise SDP, create record for SPP and register with SDP */ 462 log_info("SDP初期化...");463 496 sdp_init(); 464 497 465 498 /* Initialize RFCOMM */ 466 log_info("RFCOMM初期化...");467 499 rfcomm_init(); 468 500 rfcomm_register_packet_handler(packet_handler); … … 470 502 471 503 /* Initialise BNEP */ 472 log_info("BNEP初期化...");473 504 bnep_init(); 474 505 bnep_register_packet_handler(packet_handler); 475 bnep_register_service(NULL, BNEP_UUID_PANU, BNEP_MTU_MIN); /* Minimum L2CAP MTU for bnep is 1691 bytes */ 506 if (bt_bnep_mode == 0) { 507 bnep_register_service(NULL, BLUETOOTH_SERVICE_CLASS_PANU, BNEP_MTU_MIN); /* Minimum L2CAP MTU for bnep is 1691 bytes */ 508 } 509 else { 510 bnep_register_service(NULL, BLUETOOTH_SERVICE_CLASS_NAP, BNEP_MTU_MIN); /* Minimum L2CAP MTU for bnep is 1691 bytes */ 511 } 476 512 477 513 memset(spp_service_buffer, 0, sizeof(spp_service_buffer)); … … 482 518 bnep_service_record_item = (service_record_item_t *)bnep_service_buffer; 483 519 484 log_info("SPPサービス登録...");485 520 sdp_create_spp_service((uint8_t*)&spp_service_record_item->service_record, 1, "RX SPP"); 486 521 de_dump_data_element((uint8_t*)spp_service_record_item->service_record); … … 488 523 sdp_register_service_internal(NULL, spp_service_record_item); 489 524 490 log_info("BNEPサービス登録..."); 491 pan_create_panu_service((uint8_t*)&bnep_service_record_item->service_record, "RX PANU", "RX PANU", BNEP_SECURITY_NONE); 492 de_dump_data_element((uint8_t*)bnep_service_record_item->service_record); 493 log_info("PANU SDP service buffer size: %u", (uint16_t)(sizeof(service_record_item_t) + de_get_len((uint8_t*)bnep_service_record_item->service_record))); 525 if (bt_bnep_mode == 0) { 526 pan_create_panu_service((uint8_t*)&bnep_service_record_item->service_record, "RX PANU", "RX PANU", BNEP_SECURITY_NONE); 527 de_dump_data_element((uint8_t*)bnep_service_record_item->service_record); 528 log_info("PANU SDP service buffer size: %u", (uint16_t)(sizeof(service_record_item_t) + de_get_len((uint8_t*)bnep_service_record_item->service_record))); 529 } 530 else { 531 pan_create_nap_service((uint8_t*)&bnep_service_record_item->service_record, "RX NAP", "RX NAP", BNEP_SECURITY_NONE, 532 PAN_NET_ACCESS_TYPE_100MB_ETHERNET, 0x0001312D0/*10Mb/sec*/, NULL, NULL); 533 de_dump_data_element((uint8_t*)bnep_service_record_item->service_record); 534 log_info("NAP SDP service buffer size: %u", (uint16_t)(sizeof(service_record_item_t) + de_get_len((uint8_t*)bnep_service_record_item->service_record))); 535 } 494 536 sdp_register_service_internal(NULL, bnep_service_record_item); 495 537 … … 500 542 501 543 /* Turn on the device */ 502 log_info("HCI電源ON...");503 544 hci_power_control(HCI_POWER_ON); 504 545 … … 506 547 sdp_parser_init(); 507 548 sdp_parser_register_callback(handle_sdp_client_query_result); 508 } 509 510 void nap_init(void); 511 512 void bt_init(void) 513 { 514 btstack_network_init(&network_send_packet_callback); 515 516 if (bt_bnep_mode == 0) { 517 panu_init(); 518 } 519 else { 520 nap_init(); 521 } 522 523 bt_enabled = true; 524 } 525 526 void bt_task(void) 527 { 528 extern void hal_tick_handler(); 529 530 if (bt_enabled) { 531 hal_tick_handler(); 549 550 bt_state = BT_STATE_POWER_ON; 551 bt_timer = -1; 552 } 553 554 void bt_process(void) 555 { 556 if (bt_state != BT_STATE_DORMANT) { 532 557 run_loop_execute(); 533 558 bt_send_packet(0xffff); 559 } 560 561 if (bt_timer != 0) 562 return; 563 564 switch (bt_state) { 565 case BT_STATE_BNEP_QUERY_WAIT: 566 /* Send a general query for BNEP Protocol ID */ 567 log_info("Start SDP BNEP query."); 568 sdp_general_query_for_uuid(remote_addr, BLUETOOTH_PROTOCOL_BNEP); 569 570 bt_state = BT_STATE_BNEP_QUERY; 571 bt_timer = -1; 572 break; 573 default: 574 bt_timer = -1; 575 break; 534 576 } 535 577 } … … 592 634 hci_close(); 593 635 594 bt_enabled = false; 595 } 636 bt_state = BT_STATE_DORMANT; 637 bt_timer = -1; 638 } 639 640 void bt_task_on_start(struct task_if_t *task, ID tskid) 641 { 642 } 643 644 void bt_task_on_end(struct task_if_t *task) 645 { 646 } 647 648 int bt_task_get_timer(struct task_if_t *task) 649 { 650 return bt_timer; 651 } 652 653 void bt_task_progress(struct task_if_t *task, int elapse) 654 { 655 if (bt_timer == -1) 656 return; 657 658 bt_timer -= elapse; 659 if (bt_timer < 0) 660 bt_timer = 0; 661 } 662 663 void bt_task_process(struct task_if_t *task, enum task_event_t event) 664 { 665 extern void hal_tick_handler(); 666 667 switch (event & ~TASK_EVENT_TICK) { 668 case TASK_EVENT_START: 669 bt_init(); 670 break; 671 case TASK_EVENT_TERMINATE: 672 bt_terminate(); 673 break; 674 case TASK_EVENT_WAKEUP: 675 case TASK_EVENT_TIMEOUT: 676 if (event & TASK_EVENT_TICK) 677 hal_tick_handler(); 678 bt_process(); 679 break; 680 } 681 } 682 683 struct task_if_t bt_task = { 684 bt_task_on_start, 685 bt_task_on_end, 686 bt_task_get_timer, 687 bt_task_progress, 688 bt_task_process, 689 }; -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/src/bt_main.h
r373 r374 1 1 /* 2 * panu_main.h2 * bt_main.h 3 3 * 4 4 */ … … 16 16 17 17 void bt_init(void); 18 void bt_task(void);19 18 int bt_can_send_packet(void); 20 19 void bt_send_packet(uint16_t bnep_cid); -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/src/if_btusb.c
r337 r374 77 77 #include "kernel/kernel_impl.h" 78 78 #include "btstack/utils.h" 79 #include " panu_main.h"79 #include "bt_main.h" 80 80 #include "usb_hbth.h" 81 81 //#include "hal_cpu.h" -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/src/main.c
r364 r374 56 56 #include "core/ntshell.h" 57 57 #include "core/ntlibc.h" 58 #include "util/ntstdio.h"58 #include <stdio.h> 59 59 #include "usrcmd.h" 60 60 #include "util/ntopt.h" 61 #include " mbed_api.h"61 #include "gpio_api.h" 62 62 #include "usb_hbth.h" 63 63 #include "ntshell_main.h" … … 69 69 extern int bt_bnep_mode; 70 70 /* PANU向けリモートアドレス */ 71 // BUFFALLO72 //bd_addr_t remote_addr = { 0x00,0x1B,0xDC,0x04,0x5C,0x2D };73 // Raspberry Pi 374 //bd_addr_t remote_addr = {0xB8,0x27,0xEB,0x10,0x6D,0x60};75 // PRINCETON76 //bd_addr_t remote_addr = {0x00,0x1B,0xDC,0x06,0x6E,0x98};77 // ELECOM78 71 bd_addr_t remote_addr = {0x00,0x1B,0xDC,0x09,0x27,0x26}; 79 72 … … 185 178 { 186 179 FILINFO fno; 187 #if _USE_LFN188 char lfn[ _MAX_LFN + 1];180 #if FF_USE_LFN 181 char lfn[FF_MAX_LFN + 1]; 189 182 fno.lfname = lfn; 190 fno.lfsize = _MAX_LFN + 1;183 fno.lfsize = FF_MAX_LFN + 1; 191 184 #endif 192 185 ER ret; 193 186 194 #ifdef TOPPERS_OMIT_TECS 195 serial_opn_por(SIO_PORTID); 196 #endif 197 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 198 199 ntshell_task_init(uart_read, uart_write, &main_obj); 187 ntshell_task_init(SIO_PORTID); 200 188 201 189 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/btstack/include/btstack/hci_cmds.h
r337 r374 404 404 * @param status 405 405 */ 406 #define SDP_ QUERY_COMPLETE0x91406 #define SDP_EVENT_QUERY_COMPLETE 0x91 407 407 408 408 // data: event(8), len(8), rfcomm channel(8), name(var) … … 422 422 * @param attribute_value 423 423 */ 424 #define SDP_ QUERY_ATTRIBUTE_VALUE0x93424 #define SDP_EVENT_QUERY_ATTRIBUTE_VALUE 0x93 425 425 426 426 // not provided by daemon, only used for internal testing -
asp3_tinet_ecnl_rx/trunk/btstack/include/btstack/sdp_util.h
r337 r374 68 68 // UNIVERSAL ATTRIBUTE DEFINITIONS 69 69 #define SDP_ServiceRecordHandle 0x0000 70 #define SDP_ServiceClassIDList0x000170 #define BLUETOOTH_ATTRIBUTE_SERVICE_CLASS_ID_LIST 0x0001 71 71 #define SDP_ServiceRecordState 0x0002 72 72 #define SDP_ServiceID 0x0003 73 #define SDP_ProtocolDescriptorList0x000473 #define BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST 0x0004 74 74 #define SDP_BrowseGroupList 0x0005 75 75 #define SDP_LanguageBaseAttributeIDList 0x0006 … … 93 93 #define SDP_RFCOMMProtocol 0x0003 94 94 #define SDP_OBEXProtocol 0x0008 95 #define SDP_L2CAPProtocol0x010096 #define SDP_BNEPProtocol0x000f95 #define BLUETOOTH_PROTOCOL_L2CAP 0x0100 96 #define BLUETOOTH_PROTOCOL_BNEP 0x000f 97 97 98 98 // OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList -
asp3_tinet_ecnl_rx/trunk/btstack/include/btstack/utils.h
r337 r374 90 90 91 91 // helper for BT little endian format 92 #define READ_BT_16( buffer, pos) ( ((uint16_t) buffer[pos]) | (((uint16_t)buffer[pos+1]) << 8))93 #define READ_BT_24( buffer, pos) ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16))94 #define READ_BT_32( buffer, pos) ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16) | (((uint32_t) buffer[pos+3])) << 24)92 #define little_endian_read_16( buffer, pos) ( ((uint16_t) buffer[pos]) | (((uint16_t)buffer[pos+1]) << 8)) 93 #define little_endian_read_24( buffer, pos) ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16)) 94 #define little_endian_read_32( buffer, pos) ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16) | (((uint32_t) buffer[pos+3])) << 24) 95 95 96 96 // helper for SDP big endian format 97 #define READ_NET_16( buffer, pos) ( ((uint16_t) buffer[pos+1]) | (((uint16_t)buffer[pos ]) << 8))98 #define READ_NET_32( buffer, pos) ( ((uint32_t) buffer[pos+3]) | (((uint32_t)buffer[pos+2]) << 8) | (((uint32_t)buffer[pos+1]) << 16) | (((uint32_t) buffer[pos])) << 24)97 #define big_endian_read_16( buffer, pos) ( ((uint16_t) buffer[pos+1]) | (((uint16_t)buffer[pos ]) << 8)) 98 #define big_endian_read_32( buffer, pos) ( ((uint32_t) buffer[pos+3]) | (((uint32_t)buffer[pos+2]) << 8) | (((uint32_t)buffer[pos+1]) << 16) | (((uint32_t) buffer[pos])) << 24) 99 99 100 100 // HCI CMD OGF/OCF … … 103 103 104 104 // check if command complete event for given command 105 #define COMMAND_COMPLETE_EVENT(event,cmd) ( event[0] == HCI_EVENT_COMMAND_COMPLETE && READ_BT_16(event,3) == cmd.opcode)106 #define COMMAND_STATUS_EVENT(event,cmd) ( event[0] == HCI_EVENT_COMMAND_STATUS && READ_BT_16(event,4) == cmd.opcode)105 #define HCI_EVENT_IS_COMMAND_COMPLETE(event,cmd) ( event[0] == HCI_EVENT_COMMAND_COMPLETE && little_endian_read_16(event,3) == cmd.opcode) 106 #define COMMAND_STATUS_EVENT(event,cmd) ( event[0] == HCI_EVENT_COMMAND_STATUS && little_endian_read_16(event,4) == cmd.opcode) 107 107 108 108 // Code+Len=2, Pkts+Opcode=3; total=5 … … 110 110 111 111 // ACL Packet 112 #define READ_ACL_CONNECTION_HANDLE( buffer ) ( READ_BT_16(buffer,0) & 0x0fff)112 #define READ_ACL_CONNECTION_HANDLE( buffer ) ( little_endian_read_16(buffer,0) & 0x0fff) 113 113 #define READ_ACL_FLAGS( buffer ) ( buffer[1] >> 4 ) 114 #define READ_ACL_LENGTH( buffer ) ( READ_BT_16(buffer, 2))114 #define READ_ACL_LENGTH( buffer ) (little_endian_read_16(buffer, 2)) 115 115 116 116 // L2CAP Packet 117 #define READ_L2CAP_LENGTH(buffer) ( READ_BT_16(buffer, 4))118 #define READ_L2CAP_CHANNEL_ID(buffer) ( READ_BT_16(buffer, 6))117 #define READ_L2CAP_LENGTH(buffer) ( little_endian_read_16(buffer, 4)) 118 #define READ_L2CAP_CHANNEL_ID(buffer) ( little_endian_read_16(buffer, 6)) 119 119 120 void bt_store_16(uint8_t *buffer, uint16_t pos, uint16_t value);121 void bt_store_32(uint8_t *buffer, uint16_t pos, uint32_t value);122 void bt_flip_addr(bd_addr_t dest, bd_addr_t src);120 void little_endian_store_16(uint8_t *buffer, uint16_t pos, uint16_t value); 121 void little_endian_store_32(uint8_t *buffer, uint16_t pos, uint32_t value); 122 void reverse_bd_addr(bd_addr_t src, bd_addr_t dest); 123 123 124 124 void net_store_16(uint8_t *buffer, uint16_t pos, uint16_t value); -
asp3_tinet_ecnl_rx/trunk/btstack/src/bnep.c
r337 r374 84 84 event[1] = sizeof(event) - 2; 85 85 event[2] = status; 86 bt_store_16(event, 3, channel->l2cap_cid);87 bt_store_16(event, 5, channel->uuid_source);88 bt_store_16(event, 7, channel->uuid_dest);89 bt_store_16(event, 9, channel->max_frame_size);86 little_endian_store_16(event, 3, channel->l2cap_cid); 87 little_endian_store_16(event, 5, channel->uuid_source); 88 little_endian_store_16(event, 7, channel->uuid_dest); 89 little_endian_store_16(event, 9, channel->max_frame_size); 90 90 BD_ADDR_COPY(&event[11], channel->remote_addr); 91 91 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 101 101 event[0] = BNEP_EVENT_CHANNEL_TIMEOUT; 102 102 event[1] = sizeof(event) - 2; 103 bt_store_16(event, 2, channel->l2cap_cid);104 bt_store_16(event, 4, channel->uuid_source);105 bt_store_16(event, 6, channel->uuid_dest);103 little_endian_store_16(event, 2, channel->l2cap_cid); 104 little_endian_store_16(event, 4, channel->uuid_source); 105 little_endian_store_16(event, 6, channel->uuid_dest); 106 106 BD_ADDR_COPY(&event[8], channel->remote_addr); 107 107 event[14] = channel->state; … … 118 118 event[0] = BNEP_EVENT_CHANNEL_CLOSED; 119 119 event[1] = sizeof(event) - 2; 120 bt_store_16(event, 2, channel->l2cap_cid);121 bt_store_16(event, 4, channel->uuid_source);122 bt_store_16(event, 6, channel->uuid_dest);120 little_endian_store_16(event, 2, channel->l2cap_cid); 121 little_endian_store_16(event, 4, channel->uuid_source); 122 little_endian_store_16(event, 6, channel->uuid_dest); 123 123 BD_ADDR_COPY(&event[8], channel->remote_addr); 124 124 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 133 133 event[0] = BNEP_EVENT_READY_TO_SEND; 134 134 event[1] = sizeof(event) - 2; 135 bt_store_16(event, 2, channel->l2cap_cid);135 little_endian_store_16(event, 2, channel->l2cap_cid); 136 136 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 137 137 (*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event)); … … 464 464 BD_ADDR_COPY(addr_source, &packet[pos]); 465 465 pos += sizeof(bd_addr_t); 466 network_protocol_type = READ_NET_16(packet, pos);466 network_protocol_type = big_endian_read_16(packet, pos); 467 467 pos += sizeof(uint16_t); 468 468 … … 475 475 } 476 476 /* The "real" network protocol type is 4 bytes ahead in a VLAN packet */ 477 network_protocol_type = READ_NET_16(packet, pos + 2);477 network_protocol_type = big_endian_read_16(packet, pos + 2); 478 478 } 479 479 … … 808 808 /* Check source and destination UUIDs for valid combinations */ 809 809 if (response_code == BNEP_RESP_SETUP_SUCCESS) { 810 channel->uuid_dest = READ_NET_16(packet, 2 + uuid_offset);811 channel->uuid_source = READ_NET_16(packet, 2 + uuid_offset + uuid_size);812 813 if ((channel->uuid_dest != B NEP_UUID_PANU) &&814 (channel->uuid_dest != B NEP_UUID_NAP) &&815 (channel->uuid_dest != B NEP_UUID_GN)) {810 channel->uuid_dest = big_endian_read_16(packet, 2 + uuid_offset); 811 channel->uuid_source = big_endian_read_16(packet, 2 + uuid_offset + uuid_size); 812 813 if ((channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_PANU) && 814 (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_NAP) && 815 (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_GN)) { 816 816 log_error("BNEP_CONNECTION_REQUEST: Invalid destination service UUID: %04x", channel->uuid_dest); 817 817 channel->uuid_dest = 0; 818 818 } 819 if ((channel->uuid_source != B NEP_UUID_PANU) &&820 (channel->uuid_source != B NEP_UUID_NAP) &&821 (channel->uuid_source != B NEP_UUID_GN)) {819 if ((channel->uuid_source != BLUETOOTH_SERVICE_CLASS_PANU) && 820 (channel->uuid_source != BLUETOOTH_SERVICE_CLASS_NAP) && 821 (channel->uuid_source != BLUETOOTH_SERVICE_CLASS_GN)) { 822 822 log_error("BNEP_CONNECTION_REQUEST: Invalid source service UUID: %04x", channel->uuid_source); 823 823 channel->uuid_source = 0; … … 829 829 response_code = BNEP_RESP_SETUP_INVALID_DEST_UUID; 830 830 } else 831 if ((channel->uuid_source != B NEP_UUID_PANU) && (channel->uuid_dest != BNEP_UUID_PANU)) {831 if ((channel->uuid_source != BLUETOOTH_SERVICE_CLASS_PANU) && (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_PANU)) { 832 832 response_code = BNEP_RESP_SETUP_INVALID_SOURCE_UUID; 833 833 } … … 857 857 } 858 858 859 response_code = READ_NET_16(packet, 1);859 response_code = big_endian_read_16(packet, 1); 860 860 861 861 if (response_code == BNEP_RESP_SETUP_SUCCESS) { … … 882 882 } 883 883 884 list_length = READ_NET_16(packet, 1);884 list_length = big_endian_read_16(packet, 1); 885 885 /* Sanity check packet size again with known package size */ 886 886 if (size < 3 + list_length) { … … 903 903 /* There is still enough space, copy the filters to our filter list */ 904 904 for (i = 0; i < list_length / (2 * 2); i ++) { 905 channel->net_filter[channel->net_filter_count].range_start = READ_NET_16(packet, 1 + 2 + i * 4);906 channel->net_filter[channel->net_filter_count].range_end = READ_NET_16(packet, 1 + 2 + i * 4 + 2);905 channel->net_filter[channel->net_filter_count].range_start = big_endian_read_16(packet, 1 + 2 + i * 4); 906 channel->net_filter[channel->net_filter_count].range_end = big_endian_read_16(packet, 1 + 2 + i * 4 + 2); 907 907 if (channel->net_filter[channel->net_filter_count].range_start > channel->net_filter[channel->net_filter_count].range_end) { 908 908 /* Invalid filter range, ignore this filter rule */ … … 945 945 } 946 946 947 response_code = READ_NET_16(packet, 1);947 response_code = big_endian_read_16(packet, 1); 948 948 949 949 if (response_code == BNEP_RESP_FILTER_SUCCESS) { … … 966 966 } 967 967 968 list_length = READ_NET_16(packet, 1);968 list_length = big_endian_read_16(packet, 1); 969 969 /* Sanity check packet size again with known package size */ 970 970 if (size < 3 + list_length) { … … 1032 1032 } 1033 1033 1034 response_code = READ_NET_16(packet, 1);1034 response_code = big_endian_read_16(packet, 1); 1035 1035 1036 1036 if (response_code == BNEP_RESP_FILTER_SUCCESS) { … … 1169 1169 case L2CAP_EVENT_INCOMING_CONNECTION: 1170 1170 /* L2CAP event data: event(8), len(8), address(48), handle (16), psm (16), source cid(16) dest cid(16) */ 1171 bt_flip_addr(event_addr, &packet[2]);1172 con_handle = READ_BT_16(packet, 8);1173 psm = READ_BT_16(packet, 10);1174 l2cap_cid = READ_BT_16(packet, 12);1171 reverse_bd_addr(&packet[2], event_addr); 1172 con_handle = little_endian_read_16(packet, 8); 1173 psm = little_endian_read_16(packet, 10); 1174 l2cap_cid = little_endian_read_16(packet, 12); 1175 1175 1176 1176 if (psm != PSM_BNEP) break; … … 1211 1211 case L2CAP_EVENT_CHANNEL_OPENED: 1212 1212 /* Check if the l2cap channel has been opened for PSM_BNEP */ 1213 if ( READ_BT_16(packet, 11) != PSM_BNEP) {1213 if (little_endian_read_16(packet, 11) != PSM_BNEP) { 1214 1214 break; 1215 1215 } … … 1219 1219 1220 1220 /* Get the bnep channel fpr remote address */ 1221 con_handle = READ_BT_16(packet, 9);1222 l2cap_cid = READ_BT_16(packet, 13);1223 bt_flip_addr(event_addr, &packet[3]);1221 con_handle = little_endian_read_16(packet, 9); 1222 l2cap_cid = little_endian_read_16(packet, 13); 1223 reverse_bd_addr(&packet[3], event_addr); 1224 1224 channel = bnep_channel_for_addr(&event_addr); 1225 1225 if (!channel) { … … 1252 1252 channel->state = BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_RESPONSE; 1253 1253 bnep_channel_state_add(channel, BNEP_CHANNEL_STATE_VAR_SND_CONNECTION_REQUEST); 1254 channel->max_frame_size = bnep_max_frame_size_for_l2cap_mtu( READ_BT_16(packet, 17));1254 channel->max_frame_size = bnep_max_frame_size_for_l2cap_mtu(little_endian_read_16(packet, 17)); 1255 1255 bnep_run(); 1256 1256 break; 1257 1257 case BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_REQUEST: 1258 1258 /* New information: channel mtu */ 1259 channel->max_frame_size = bnep_max_frame_size_for_l2cap_mtu( READ_BT_16(packet, 17));1259 channel->max_frame_size = bnep_max_frame_size_for_l2cap_mtu(little_endian_read_16(packet, 17)); 1260 1260 break; 1261 1261 default: … … 1272 1272 case L2CAP_EVENT_CHANNEL_CLOSED: 1273 1273 // data: event (8), len(8), channel (16) 1274 l2cap_cid = READ_BT_16(packet, 2);1274 l2cap_cid = little_endian_read_16(packet, 2); 1275 1275 channel = bnep_channel_for_l2cap_cid(l2cap_cid); 1276 1276 log_info("L2CAP_EVENT_CHANNEL_CLOSED cid 0x%0x, channel %p", l2cap_cid, channel); … … 1331 1331 BD_ADDR_COPY(addr_source, &packet[pos]); 1332 1332 pos += sizeof(bd_addr_t); 1333 network_protocol_type = READ_NET_16(packet, pos);1333 network_protocol_type = big_endian_read_16(packet, pos); 1334 1334 pos += 2; 1335 1335 break; … … 1337 1337 BD_ADDR_COPY(addr_dest, channel->local_addr); 1338 1338 BD_ADDR_COPY(addr_source, channel->remote_addr); 1339 network_protocol_type = READ_NET_16(packet, pos);1339 network_protocol_type = big_endian_read_16(packet, pos); 1340 1340 pos += 2; 1341 1341 break; … … 1344 1344 BD_ADDR_COPY(addr_source, &packet[pos]); 1345 1345 pos += sizeof(bd_addr_t); 1346 network_protocol_type = READ_NET_16(packet, pos);1346 network_protocol_type = big_endian_read_16(packet, pos); 1347 1347 pos += 2; 1348 1348 break; … … 1351 1351 pos += sizeof(bd_addr_t); 1352 1352 BD_ADDR_COPY(addr_source, channel->remote_addr); 1353 network_protocol_type = READ_NET_16(packet, pos);1353 network_protocol_type = big_endian_read_16(packet, pos); 1354 1354 pos += 2; 1355 1355 break; … … 1563 1563 } 1564 1564 1565 channel->uuid_source = B NEP_UUID_PANU;1565 channel->uuid_source = BLUETOOTH_SERVICE_CLASS_PANU; 1566 1566 channel->uuid_dest = uuid_dest; 1567 1567 … … 1597 1597 1598 1598 /* Only alow one the three service types: PANU, NAP, GN */ 1599 if ((service_uuid != B NEP_UUID_PANU) &&1600 (service_uuid != B NEP_UUID_NAP) &&1601 (service_uuid != B NEP_UUID_GN)) {1599 if ((service_uuid != BLUETOOTH_SERVICE_CLASS_PANU) && 1600 (service_uuid != BLUETOOTH_SERVICE_CLASS_NAP) && 1601 (service_uuid != BLUETOOTH_SERVICE_CLASS_GN)) { 1602 1602 log_info("BNEP_REGISTER_SERVICE: Invalid service UUID: %04x", service_uuid); 1603 1603 return BNEP_CHANNEL_NOT_CONNECTED; -
asp3_tinet_ecnl_rx/trunk/btstack/src/bnep.h
r337 r374 72 72 73 73 /* BNEP UUIDs */ 74 #define B NEP_UUID_PANU0x111575 #define B NEP_UUID_NAP0x111676 #define B NEP_UUID_GN0x111774 #define BLUETOOTH_SERVICE_CLASS_PANU 0x1115 75 #define BLUETOOTH_SERVICE_CLASS_NAP 0x1116 76 #define BLUETOOTH_SERVICE_CLASS_GN 0x1117 77 77 78 78 /* BNEP packet types */ -
asp3_tinet_ecnl_rx/trunk/btstack/src/hci.c
r337 r374 233 233 bd_addr_t addr; 234 234 hci_connection_t * conn; 235 bt_flip_addr(addr, *(bd_addr_t *) bd_addr);235 reverse_bd_addr(*(bd_addr_t *) bd_addr, addr); 236 236 conn = hci_connection_for_bd_addr_and_type(&addr, BD_ADDR_TYPE_CLASSIC); 237 237 if (conn) { … … 469 469 // copy handle_and_flags if not first fragment and update packet boundary flags to be 01 (continuing fragmnent) 470 470 if (acl_header_pos > 0){ 471 uint16_t handle_and_flags = READ_BT_16(hci_stack->hci_packet_buffer, 0);471 uint16_t handle_and_flags = little_endian_read_16(hci_stack->hci_packet_buffer, 0); 472 472 handle_and_flags = (handle_and_flags & 0xcfff) | (1 << 12); 473 bt_store_16(hci_stack->hci_packet_buffer, acl_header_pos, handle_and_flags);473 little_endian_store_16(hci_stack->hci_packet_buffer, acl_header_pos, handle_and_flags); 474 474 } 475 475 476 476 // update header len 477 bt_store_16(hci_stack->hci_packet_buffer, acl_header_pos + 2, current_acl_data_packet_length);477 little_endian_store_16(hci_stack->hci_packet_buffer, acl_header_pos + 2, current_acl_data_packet_length); 478 478 479 479 // count packet … … 640 640 conn->acl_recombination_pos = acl_length + 4; 641 641 conn->acl_recombination_length = l2cap_length; 642 bt_store_16(conn->acl_recombination_buffer, HCI_INCOMING_PRE_BUFFER_SIZE + 2, l2cap_length +4);642 little_endian_store_16(conn->acl_recombination_buffer, HCI_INCOMING_PRE_BUFFER_SIZE + 2, l2cap_length +4); 643 643 } 644 644 break; … … 793 793 // odd: waiting for event 794 794 if (packet[0] == HCI_EVENT_COMMAND_COMPLETE){ 795 uint16_t opcode = READ_BT_16(packet,3);795 uint16_t opcode = little_endian_read_16(packet,3); 796 796 if (opcode == hci_stack->last_cmd_opcode){ 797 797 command_completed = 1; … … 803 803 if (packet[0] == HCI_EVENT_COMMAND_STATUS){ 804 804 uint8_t status = packet[2]; 805 uint16_t opcode = READ_BT_16(packet,4);805 uint16_t opcode = little_endian_read_16(packet,4); 806 806 if (opcode == hci_stack->last_cmd_opcode){ 807 807 if (status){ … … 843 843 case 1: // SEND BAUD CHANGE 844 844 hci_stack->control->baudrate_cmd(hci_stack->config, ((hci_uart_config_t *)hci_stack->config)->baudrate_main, hci_stack->hci_packet_buffer); 845 hci_stack->last_cmd_opcode = READ_BT_16(hci_stack->hci_packet_buffer, 0);845 hci_stack->last_cmd_opcode = little_endian_read_16(hci_stack->hci_packet_buffer, 0); 846 846 hci_dump_packet(HCI_COMMAND_DATA_PACKET, 0, hci_stack->hci_packet_buffer, 3 + hci_stack->hci_packet_buffer[2]); 847 847 hci_send_cmd_packet(hci_stack->hci_packet_buffer, 3 + hci_stack->hci_packet_buffer[2]); … … 860 860 if (valid_cmd){ 861 861 int size = 3 + hci_stack->hci_packet_buffer[2]; 862 hci_stack->last_cmd_opcode = READ_BT_16(hci_stack->hci_packet_buffer, 0);862 hci_stack->last_cmd_opcode = little_endian_read_16(hci_stack->hci_packet_buffer, 0); 863 863 hci_dump_packet(HCI_COMMAND_DATA_PACKET, 0, hci_stack->hci_packet_buffer, size); 864 864 hci_stack->hci_transport->send_packet(HCI_COMMAND_DATA_PACKET, hci_stack->hci_packet_buffer, size); … … 992 992 hci_stack->num_cmd_packets = packet[2]; 993 993 994 if ( COMMAND_COMPLETE_EVENT(packet, hci_read_buffer_size)){994 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_buffer_size)){ 995 995 // from offset 5 996 996 // status 997 997 // "The HC_ACL_Data_Packet_Length return parameter will be used to determine the size of the L2CAP segments contained in ACL Data Packets" 998 hci_stack->acl_data_packet_length = READ_BT_16(packet, 6);998 hci_stack->acl_data_packet_length = little_endian_read_16(packet, 6); 999 999 // ignore: SCO data packet len (8) 1000 1000 hci_stack->acl_packets_total_num = packet[9]; … … 1010 1010 } 1011 1011 #ifdef HAVE_BLE 1012 if ( COMMAND_COMPLETE_EVENT(packet, hci_le_read_buffer_size)){1013 hci_stack->le_data_packets_length = READ_BT_16(packet, 6);1012 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_le_read_buffer_size)){ 1013 hci_stack->le_data_packets_length = little_endian_read_16(packet, 6); 1014 1014 hci_stack->le_acl_packets_total_num = packet[8]; 1015 1015 // determine usable ACL payload size … … 1021 1021 #endif 1022 1022 // Dump local address 1023 if ( COMMAND_COMPLETE_EVENT(packet, hci_read_bd_addr)) {1024 bt_flip_addr(hci_stack->local_bd_addr, &packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE + 1]);1023 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_bd_addr)) { 1024 reverse_bd_addr(&packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE + 1], hci_stack->local_bd_addr); 1025 1025 log_info("Local Address, Status: 0x%02x: Addr: %s", 1026 1026 packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE], bd_addr_to_str(hci_stack->local_bd_addr)); 1027 1027 } 1028 if ( COMMAND_COMPLETE_EVENT(packet, hci_write_scan_enable)){1028 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_write_scan_enable)){ 1029 1029 hci_emit_discoverable_enabled(hci_stack->discoverable); 1030 1030 } 1031 1031 // Note: HCI init checks 1032 if ( COMMAND_COMPLETE_EVENT(packet, hci_read_local_supported_features)){1032 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_local_supported_features)){ 1033 1033 memcpy(hci_stack->local_supported_features, &packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE+1], 8); 1034 1034 log_info("Local Supported Features: 0x%02x%02x%02x%02x%02x%02x%02x%02x", … … 1057 1057 for (i=0; i<packet[2];i++){ 1058 1058 uint16_t num_packets; 1059 handle = READ_BT_16(packet, offset);1059 handle = little_endian_read_16(packet, offset); 1060 1060 offset += 2; 1061 num_packets = READ_BT_16(packet, offset);1061 num_packets = little_endian_read_16(packet, offset); 1062 1062 offset += 2; 1063 1063 … … 1079 1079 } 1080 1080 case HCI_EVENT_CONNECTION_REQUEST: 1081 bt_flip_addr(addr, &packet[2]);1081 reverse_bd_addr(&packet[2], addr); 1082 1082 // TODO: eval COD 8-10 1083 1083 link_type = packet[11]; … … 1106 1106 case HCI_EVENT_CONNECTION_COMPLETE: 1107 1107 // Connection management 1108 bt_flip_addr(addr, &packet[5]);1108 reverse_bd_addr(&packet[5], addr); 1109 1109 log_info("Connection_complete (status=%u) %s", packet[2], bd_addr_to_str(addr)); 1110 1110 addr_type = BD_ADDR_TYPE_CLASSIC; … … 1113 1113 if (!packet[2]){ 1114 1114 conn->state = OPEN; 1115 conn->con_handle = READ_BT_16(packet, 3);1115 conn->con_handle = little_endian_read_16(packet, 3); 1116 1116 conn->bonding_flags |= BONDING_REQUEST_REMOTE_FEATURES; 1117 1117 … … 1148 1148 1149 1149 case HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE: 1150 handle = READ_BT_16(packet, 3);1150 handle = little_endian_read_16(packet, 3); 1151 1151 conn = hci_connection_for_handle(handle); 1152 1152 if (!conn) break; … … 1176 1176 case HCI_EVENT_LINK_KEY_NOTIFICATION: { 1177 1177 link_key_type_t link_key_type; 1178 bt_flip_addr(addr, &packet[2]);1178 reverse_bd_addr(&packet[2], addr); 1179 1179 conn = hci_connection_for_bd_addr_and_type(&addr, BD_ADDR_TYPE_CLASSIC); 1180 1180 if (!conn) break; … … 1201 1201 // PIN CODE REQUEST means the link key request didn't succee -> delete stored link key 1202 1202 if (!hci_stack->remote_device_db) break; 1203 bt_flip_addr(addr, &packet[2]);1203 reverse_bd_addr(&packet[2], addr); 1204 1204 hci_stack->remote_device_db->delete_link_key(&addr); 1205 1205 break; … … 1223 1223 1224 1224 case HCI_EVENT_ENCRYPTION_CHANGE: 1225 handle = READ_BT_16(packet, 3);1225 handle = little_endian_read_16(packet, 3); 1226 1226 conn = hci_connection_for_handle(handle); 1227 1227 if (!conn) break; … … 1237 1237 1238 1238 case HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT: 1239 handle = READ_BT_16(packet, 3);1239 handle = little_endian_read_16(packet, 3); 1240 1240 conn = hci_connection_for_handle(handle); 1241 1241 if (!conn) break; … … 1262 1262 if (!hci_stack->remote_device_db) break; 1263 1263 if (packet[2]) break; // status not ok 1264 bt_flip_addr(addr, &packet[3]);1264 reverse_bd_addr(&packet[3], addr); 1265 1265 // fix for invalid remote names - terminate on 0xff 1266 1266 for (i=0; i<248;i++){ … … 1283 1283 int offset = 3; 1284 1284 for (i=0; i<packet[2];i++){ 1285 bt_flip_addr(addr, &packet[offset]);1285 reverse_bd_addr(&packet[offset], addr); 1286 1286 offset += 14; // 6 + 1 + 1 + 1 + 3 + 2; 1287 1287 if (hci_stack->remote_device_db->get_name(&addr, &device_name)){ … … 1308 1308 case HCI_EVENT_ROLE_CHANGE: 1309 1309 if (packet[2]) break; // status != 0 1310 handle = READ_BT_16(packet, 3);1310 handle = little_endian_read_16(packet, 3); 1311 1311 conn = hci_connection_for_handle(handle); 1312 1312 if (!conn) break; // no conn … … 1331 1331 case HCI_SUBEVENT_LE_CONNECTION_COMPLETE: 1332 1332 // Connection management 1333 bt_flip_addr(addr, &packet[8]);1333 reverse_bd_addr(&packet[8], addr); 1334 1334 addr_type = (bd_addr_type_t)packet[7]; 1335 1335 log_info("LE Connection_complete (status=%u) type %u, %s", packet[3], addr_type, bd_addr_to_str(addr)); … … 1357 1357 1358 1358 conn->state = OPEN; 1359 conn->con_handle = READ_BT_16(packet, 4);1359 conn->con_handle = little_endian_read_16(packet, 4); 1360 1360 1361 1361 // TODO: store - role, peer address type, conn_interval, conn_latency, supervision timeout, master clock … … 1370 1370 break; 1371 1371 1372 // log_info("LE buffer size: %u, count %u", READ_BT_16(packet,6), packet[8]);1372 // log_info("LE buffer size: %u, count %u", little_endian_read_16(packet,6), packet[8]); 1373 1373 1374 1374 default: … … 1389 1389 if (hci_stack->state == HCI_STATE_FALLING_ASLEEP 1390 1390 && hci_stack->substate == 1 1391 && COMMAND_COMPLETE_EVENT(packet, hci_write_scan_enable)){1391 && HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_write_scan_enable)){ 1392 1392 hci_stack->substate++; 1393 1393 } … … 1400 1400 if (!packet[2]){ 1401 1401 hci_connection_t * conn; 1402 handle = READ_BT_16(packet, 3);1402 handle = little_endian_read_16(packet, 3); 1403 1403 conn = hci_connection_for_handle(handle); 1404 1404 if (conn) { … … 1793 1793 } 1794 1794 1795 void hci_discoverable_control(uint8_t enable){1795 void gap_discoverable_control(uint8_t enable){ 1796 1796 if (enable) enable = 1; // normalize argument 1797 1797 … … 2140 2140 // create_connection? 2141 2141 if (IS_COMMAND(packet, hci_create_connection)){ 2142 bt_flip_addr(addr, &packet[3]);2142 reverse_bd_addr(&packet[3], addr); 2143 2143 log_info("Create_connection to %s", bd_addr_to_str(addr)); 2144 2144 … … 2179 2179 if (IS_COMMAND(packet, hci_delete_stored_link_key)){ 2180 2180 if (hci_stack->remote_device_db){ 2181 bt_flip_addr(addr, &packet[3]);2181 reverse_bd_addr(&packet[3], addr); 2182 2182 hci_stack->remote_device_db->delete_link_key(&addr); 2183 2183 } … … 2186 2186 if (IS_COMMAND(packet, hci_pin_code_request_negative_reply) 2187 2187 || IS_COMMAND(packet, hci_pin_code_request_reply)){ 2188 bt_flip_addr(addr, &packet[3]);2188 reverse_bd_addr(&packet[3], addr); 2189 2189 conn = hci_connection_for_bd_addr_and_type(&addr, BD_ADDR_TYPE_CLASSIC); 2190 2190 if (conn){ … … 2197 2197 || IS_COMMAND(packet, hci_user_passkey_request_negative_reply) 2198 2198 || IS_COMMAND(packet, hci_user_passkey_request_reply)) { 2199 bt_flip_addr(addr, &packet[3]);2199 reverse_bd_addr(&packet[3], addr); 2200 2200 conn = hci_connection_for_bd_addr_and_type(&addr, BD_ADDR_TYPE_CLASSIC); 2201 2201 if (conn){ … … 2209 2209 } 2210 2210 if (IS_COMMAND(packet, hci_le_set_random_address)){ 2211 bt_flip_addr(hci_stack->adv_address, &packet[3]);2211 reverse_bd_addr(&packet[3], hci_stack->adv_address); 2212 2212 } 2213 2213 #endif … … 2303 2303 event[1] = sizeof(event) - 2; 2304 2304 event[2] = status; 2305 bt_store_16(event, 3, conn->con_handle);2306 bt_flip_addr(&event[5], conn->address);2305 little_endian_store_16(event, 3, conn->con_handle); 2306 reverse_bd_addr(conn->address, &event[5]); 2307 2307 event[11] = 1; // ACL connection 2308 2308 event[12] = 0; // encryption disabled … … 2317 2317 event[2] = HCI_SUBEVENT_LE_CONNECTION_COMPLETE; 2318 2318 event[3] = status; 2319 bt_store_16(event, 4, conn_handle);2319 little_endian_store_16(event, 4, conn_handle); 2320 2320 event[6] = 0; // TODO: role 2321 2321 event[7] = address_type; 2322 bt_flip_addr(&event[8], *address);2323 bt_store_16(event, 14, 0); // interval2324 bt_store_16(event, 16, 0); // latency2325 bt_store_16(event, 18, 0); // supervision timeout2322 reverse_bd_addr(*address, &event[8]); 2323 little_endian_store_16(event, 14, 0); // interval 2324 little_endian_store_16(event, 16, 0); // latency 2325 little_endian_store_16(event, 18, 0); // supervision timeout 2326 2326 event[20] = 0; // master clock accuracy 2327 2327 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 2334 2334 event[1] = sizeof(event) - 2; 2335 2335 event[2] = 0; // status = OK 2336 bt_store_16(event, 3, handle);2336 little_endian_store_16(event, 3, handle); 2337 2337 event[5] = reason; 2338 2338 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 2346 2346 event[0] = L2CAP_EVENT_TIMEOUT_CHECK; 2347 2347 event[1] = sizeof(event) - 2; 2348 bt_store_16(event, 2, conn->con_handle);2348 little_endian_store_16(event, 2, conn->con_handle); 2349 2349 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); 2350 2350 hci_stack->packet_handler(HCI_EVENT_PACKET, event, sizeof(event)); … … 2378 2378 event[2] = BTSTACK_MAJOR; 2379 2379 event[3] = BTSTACK_MINOR; 2380 bt_store_16(event, 4, BTSTACK_REVISION);2380 little_endian_store_16(event, 4, BTSTACK_REVISION); 2381 2381 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 2382 2382 hci_stack->packet_handler(HCI_EVENT_PACKET, event, sizeof(event)); … … 2399 2399 event[1] = sizeof(event) - 2 - 1; 2400 2400 event[2] = 0; // just to be compatible with HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 2401 bt_flip_addr(&event[3], *addr);2401 reverse_bd_addr(*addr, &event[3]); 2402 2402 memcpy(&event[9], name, 248); 2403 2403 … … 2426 2426 event[pos++] = GAP_SECURITY_LEVEL; 2427 2427 event[pos++] = sizeof(event) - 2; 2428 bt_store_16(event, 2, con_handle);2428 little_endian_store_16(event, 2, con_handle); 2429 2429 pos += 2; 2430 2430 event[pos++] = level; … … 2441 2441 event[pos++] = sizeof(event) - 2; 2442 2442 event[pos++] = status; 2443 bt_flip_addr( * (bd_addr_t *) &event[pos], address);2443 reverse_bd_addr(address, * (bd_addr_t *) &event[pos]); 2444 2444 pos += 6; 2445 2445 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); -
asp3_tinet_ecnl_rx/trunk/btstack/src/hci.h
r337 r374 234 234 235 235 // 236 #define IS_COMMAND(packet, command) ( READ_BT_16(packet,0) == command.opcode)236 #define IS_COMMAND(packet, command) (little_endian_read_16(packet,0) == command.opcode) 237 237 238 238 // data: event(8) … … 595 595 596 596 // Allows to control if device is discoverable. OFF by default. 597 void hci_discoverable_control(uint8_t enable);597 void gap_discoverable_control(uint8_t enable); 598 598 599 599 // Creates and sends HCI command packets based on a template and -
asp3_tinet_ecnl_rx/trunk/btstack/src/hci_dump.c
r337 r374 194 194 195 195 case HCI_DUMP_BLUEZ: 196 bt_store_16( (uint8_t *) &header_bluez.len, 0, 1 + len);196 little_endian_store_16( (uint8_t *) &header_bluez.len, 0, 1 + len); 197 197 header_bluez.in = in; 198 198 header_bluez.pad = 0; 199 bt_store_32( (uint8_t *) &header_bluez.ts_sec, 0, curr_time.tv_sec);200 bt_store_32( (uint8_t *) &header_bluez.ts_usec, 0, curr_time.tv_usec);199 little_endian_store_32( (uint8_t *) &header_bluez.ts_sec, 0, curr_time.tv_sec); 200 little_endian_store_32( (uint8_t *) &header_bluez.ts_usec, 0, curr_time.tv_usec); 201 201 header_bluez.packet_type = packet_type; 202 202 write (dump_file, &header_bluez, sizeof(hcidump_hdr) ); -
asp3_tinet_ecnl_rx/trunk/btstack/src/l2cap.c
r337 r374 135 135 event[1] = sizeof(event) - 2; 136 136 event[2] = status; 137 bt_flip_addr(&event[3], channel->address);138 bt_store_16(event, 9, channel->handle);139 bt_store_16(event, 11, channel->psm);140 bt_store_16(event, 13, channel->local_cid);141 bt_store_16(event, 15, channel->remote_cid);142 bt_store_16(event, 17, channel->local_mtu);143 bt_store_16(event, 19, channel->remote_mtu);144 bt_store_16(event, 21, channel->flush_timeout);137 reverse_bd_addr(channel->address, &event[3]); 138 little_endian_store_16(event, 9, channel->handle); 139 little_endian_store_16(event, 11, channel->psm); 140 little_endian_store_16(event, 13, channel->local_cid); 141 little_endian_store_16(event, 15, channel->remote_cid); 142 little_endian_store_16(event, 17, channel->local_mtu); 143 little_endian_store_16(event, 19, channel->remote_mtu); 144 little_endian_store_16(event, 21, channel->flush_timeout); 145 145 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 146 146 l2cap_dispatch(channel, HCI_EVENT_PACKET, event, sizeof(event)); … … 152 152 event[0] = L2CAP_EVENT_CHANNEL_CLOSED; 153 153 event[1] = sizeof(event) - 2; 154 bt_store_16(event, 2, channel->local_cid);154 little_endian_store_16(event, 2, channel->local_cid); 155 155 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 156 156 l2cap_dispatch(channel, HCI_EVENT_PACKET, event, sizeof(event)); … … 163 163 event[0] = L2CAP_EVENT_INCOMING_CONNECTION; 164 164 event[1] = sizeof(event) - 2; 165 bt_flip_addr(&event[2], channel->address);166 bt_store_16(event, 8, channel->handle);167 bt_store_16(event, 10, channel->psm);168 bt_store_16(event, 12, channel->local_cid);169 bt_store_16(event, 14, channel->remote_cid);165 reverse_bd_addr(channel->address, &event[2]); 166 little_endian_store_16(event, 8, channel->handle); 167 little_endian_store_16(event, 10, channel->psm); 168 little_endian_store_16(event, 12, channel->local_cid); 169 little_endian_store_16(event, 14, channel->remote_cid); 170 170 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 171 171 l2cap_dispatch(channel, HCI_EVENT_PACKET, event, sizeof(event)); … … 176 176 event[0] = L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE; 177 177 event[1] = 4; 178 bt_store_16(event, 2, handle);179 bt_store_16(event, 4, result);178 little_endian_store_16(event, 2, handle); 179 little_endian_store_16(event, 4, result); 180 180 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 181 181 (*packet_handler)(NULL, HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 188 188 event[1] = sizeof(event) - 2; 189 189 event[2] = status; 190 bt_store_16(event, 3, psm);190 little_endian_store_16(event, 3, psm); 191 191 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); 192 192 (*packet_handler)(connection, HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 201 201 event[0] = L2CAP_EVENT_CREDITS; 202 202 event[1] = sizeof(event) - 2; 203 bt_store_16(event, 2, channel->local_cid);203 little_endian_store_16(event, 2, channel->local_cid); 204 204 event[4] = credits; 205 205 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 412 412 413 413 // 0 - Connection handle : PB=pb : BC=00 414 bt_store_16(acl_buffer, 0, channel->handle | (pb << 12) | (0 << 14));414 little_endian_store_16(acl_buffer, 0, channel->handle | (pb << 12) | (0 << 14)); 415 415 // 2 - ACL length 416 bt_store_16(acl_buffer, 2, len + 4);416 little_endian_store_16(acl_buffer, 2, len + 4); 417 417 // 4 - L2CAP packet length 418 bt_store_16(acl_buffer, 4, len + 0);418 little_endian_store_16(acl_buffer, 4, len + 0); 419 419 // 6 - L2CAP channel DEST 420 bt_store_16(acl_buffer, 6, channel->remote_cid);420 little_endian_store_16(acl_buffer, 6, channel->remote_cid); 421 421 // send 422 422 err = hci_send_acl_packet_buffer(len+8); … … 449 449 450 450 // 0 - Connection handle : PB=pb : BC=00 451 bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));451 little_endian_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14)); 452 452 // 2 - ACL length 453 bt_store_16(acl_buffer, 2, len + 4);453 little_endian_store_16(acl_buffer, 2, len + 4); 454 454 // 4 - L2CAP packet length 455 bt_store_16(acl_buffer, 4, len + 0);455 little_endian_store_16(acl_buffer, 4, len + 0); 456 456 // 6 - L2CAP channel DEST 457 bt_store_16(acl_buffer, 6, cid);457 little_endian_store_16(acl_buffer, 6, cid); 458 458 // send 459 459 err = hci_send_acl_packet_buffer(len+8); … … 665 665 config_options[0] = 1; // MTU 666 666 config_options[1] = 2; // len param 667 bt_store_16( (uint8_t*)&config_options, 2, channel->remote_mtu);667 little_endian_store_16( (uint8_t*)&config_options, 2, channel->remote_mtu); 668 668 l2cap_send_signaling_packet(channel->handle, CONFIGURE_RESPONSE, channel->remote_sig_id, channel->remote_cid, flags, 0, 4, &config_options); 669 669 channelStateVarClearFlag(channel,L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_MTU); … … 679 679 config_options[0] = 1; // MTU 680 680 config_options[1] = 2; // len param 681 bt_store_16( (uint8_t*)&config_options, 2, channel->local_mtu);681 little_endian_store_16( (uint8_t*)&config_options, 2, channel->local_mtu); 682 682 l2cap_send_signaling_packet(channel->handle, CONFIGURE_REQUEST, channel->local_sig_id, channel->remote_cid, 0, 4, &config_options); 683 683 l2cap_start_rtx(channel); … … 893 893 // handle connection complete events 894 894 case HCI_EVENT_CONNECTION_COMPLETE: 895 bt_flip_addr(address, &packet[5]);895 reverse_bd_addr(&packet[5], address); 896 896 if (packet[2] == 0){ 897 handle = READ_BT_16(packet, 3);897 handle = little_endian_read_16(packet, 3); 898 898 l2cap_handle_connection_success_for_addr(address, handle); 899 899 } else { … … 904 904 // handle successful create connection cancel command 905 905 case HCI_EVENT_COMMAND_COMPLETE: 906 if ( COMMAND_COMPLETE_EVENT(packet, hci_create_connection_cancel) ) {906 if ( HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_create_connection_cancel) ) { 907 907 if (packet[5] == 0){ 908 bt_flip_addr(address, &packet[6]);908 reverse_bd_addr(&packet[6], address); 909 909 // CONNECTION TERMINATED BY LOCAL HOST (0X16) 910 910 l2cap_handle_connection_failed_for_addr(address, 0x16); … … 921 921 case HCI_EVENT_DISCONNECTION_COMPLETE: 922 922 // send l2cap disconnect events for all channels on this handle and free them 923 handle = READ_BT_16(packet, 3);923 handle = little_endian_read_16(packet, 3); 924 924 linked_list_iterator_init(&it, &l2cap_channels); 925 925 while (linked_list_iterator_has_next(&it)){ … … 940 940 // HCI Connection Timeouts 941 941 case L2CAP_EVENT_TIMEOUT_CHECK: 942 handle = READ_BT_16(packet, 2);942 handle = little_endian_read_16(packet, 2); 943 943 if (hci_authentication_active_for_handle(handle)) break; 944 944 hci_con_used = 0; … … 971 971 972 972 case HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE: 973 handle = READ_BT_16(packet, 3);973 handle = little_endian_read_16(packet, 3); 974 974 linked_list_iterator_init(&it, &l2cap_channels); 975 975 while (linked_list_iterator_has_next(&it)){ … … 982 982 983 983 case GAP_SECURITY_LEVEL: 984 handle = READ_BT_16(packet, 2);984 handle = little_endian_read_16(packet, 2); 985 985 log_info("l2cap - security level update"); 986 986 linked_list_iterator_init(&it, &l2cap_channels); … … 1163 1163 channel->remote_sig_id = command[L2CAP_SIGNALING_COMMAND_SIGID_OFFSET]; 1164 1164 1165 flags = READ_BT_16(command, 6);1165 flags = little_endian_read_16(command, 6); 1166 1166 if (flags & 1) { 1167 1167 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_CONT); … … 1169 1169 1170 1170 // accept the other's configuration options 1171 end_pos = 4 + READ_BT_16(command, L2CAP_SIGNALING_COMMAND_LENGTH_OFFSET);1171 end_pos = 4 + little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_LENGTH_OFFSET); 1172 1172 pos = 8; 1173 1173 while (pos < end_pos){ … … 1180 1180 // MTU { type(8): 1, len(8):2, MTU(16) } 1181 1181 if (option_type == 1 && length == 2){ 1182 channel->remote_mtu = READ_BT_16(command, pos);1182 channel->remote_mtu = little_endian_read_16(command, pos); 1183 1183 // log_info("l2cap cid 0x%02x, remote mtu %u", channel->local_cid, channel->remote_mtu); 1184 1184 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_MTU); … … 1186 1186 // Flush timeout { type(8):2, len(8): 2, Flush Timeout(16)} 1187 1187 if (option_type == 2 && length == 2){ 1188 channel->flush_timeout = READ_BT_16(command, pos);1188 channel->flush_timeout = little_endian_read_16(command, pos); 1189 1189 } 1190 1190 // check for unknown options … … 1237 1237 case CONNECTION_RESPONSE: 1238 1238 l2cap_stop_rtx(channel); 1239 result = READ_BT_16 (command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+4);1239 result = little_endian_read_16 (command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+4); 1240 1240 switch (result) { 1241 1241 case 0: 1242 1242 // successful connection 1243 channel->remote_cid = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);1243 channel->remote_cid = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET); 1244 1244 channel->state = L2CAP_STATE_CONFIG; 1245 1245 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_REQ); … … 1274 1274 1275 1275 case L2CAP_STATE_CONFIG: 1276 result = READ_BT_16 (command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+4);1276 result = little_endian_read_16 (command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+4); 1277 1277 switch (code) { 1278 1278 case CONFIGURE_REQUEST: … … 1353 1353 1354 1354 case CONNECTION_REQUEST: { 1355 uint16_t psm = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);1356 uint16_t source_cid = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+2);1355 uint16_t psm = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET); 1356 uint16_t source_cid = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET+2); 1357 1357 l2cap_handle_connection_request(handle, sig_id, psm, source_cid); 1358 1358 return; … … 1364 1364 1365 1365 case INFORMATION_REQUEST: { 1366 uint16_t infoType = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);1366 uint16_t infoType = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET); 1367 1367 l2cap_register_signaling_response(handle, code, sig_id, infoType); 1368 1368 return; … … 1375 1375 1376 1376 // Get potential destination CID 1377 dest_cid = READ_BT_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET);1377 dest_cid = little_endian_read_16(command, L2CAP_SIGNALING_COMMAND_DATA_OFFSET); 1378 1378 1379 1379 // Find channel for this sig_id and connection handle … … 1415 1415 1416 1416 // increment command_offset 1417 command_offset += L2CAP_SIGNALING_COMMAND_DATA_OFFSET + READ_BT_16(packet, command_offset + L2CAP_SIGNALING_COMMAND_LENGTH_OFFSET);1417 command_offset += L2CAP_SIGNALING_COMMAND_DATA_OFFSET + little_endian_read_16(packet, command_offset + L2CAP_SIGNALING_COMMAND_LENGTH_OFFSET); 1418 1418 } 1419 1419 break; … … 1435 1435 switch (packet[8]){ 1436 1436 case CONNECTION_PARAMETER_UPDATE_RESPONSE: { 1437 uint16_t result = READ_BT_16(packet, 12);1437 uint16_t result = little_endian_read_16(packet, 12); 1438 1438 l2cap_emit_connection_parameter_update_response(handle, result); 1439 1439 break; … … 1450 1450 int update_parameter = 1; 1451 1451 le_connection_parameter_range_t existing_range = gap_le_get_connection_parameter_range(); 1452 uint16_t le_conn_interval_min = READ_BT_16(packet,12);1453 uint16_t le_conn_interval_max = READ_BT_16(packet,14);1454 uint16_t le_conn_latency = READ_BT_16(packet,16);1455 uint16_t le_supervision_timeout = READ_BT_16(packet,18);1452 uint16_t le_conn_interval_min = little_endian_read_16(packet,12); 1453 uint16_t le_conn_interval_max = little_endian_read_16(packet,14); 1454 uint16_t le_conn_latency = little_endian_read_16(packet,16); 1455 uint16_t le_supervision_timeout = little_endian_read_16(packet,18); 1456 1456 1457 1457 if (le_conn_interval_min < existing_range.le_conn_interval_min) update_parameter = 0; -
asp3_tinet_ecnl_rx/trunk/btstack/src/l2cap_signaling.c
r337 r374 91 91 92 92 // 0 - Connection handle : PB=pb : BC=00 93 bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));93 little_endian_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14)); 94 94 // 6 - L2CAP channel = 1 95 bt_store_16(acl_buffer, 6, cid);95 little_endian_store_16(acl_buffer, 6, cid); 96 96 // 8 - Code 97 97 acl_buffer[8] = cmd; … … 134 134 135 135 // 2 - ACL length 136 bt_store_16(acl_buffer, 2, pos - 4);136 little_endian_store_16(acl_buffer, 2, pos - 4); 137 137 // 4 - L2CAP packet length 138 bt_store_16(acl_buffer, 4, pos - 6 - 2);138 little_endian_store_16(acl_buffer, 4, pos - 6 - 2); 139 139 // 10 - L2CAP signaling parameter length 140 bt_store_16(acl_buffer, 10, pos - 12);140 little_endian_store_16(acl_buffer, 10, pos - 12); 141 141 142 142 return pos; … … 158 158 159 159 // 0 - Connection handle : PB=pb : BC=00 160 bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));160 little_endian_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14)); 161 161 // 6 - L2CAP LE Signaling channel = 5 162 bt_store_16(acl_buffer, 6, 5);162 little_endian_store_16(acl_buffer, 6, 5); 163 163 // 8 - Code 164 164 acl_buffer[8] = CONNECTION_PARAMETER_UPDATE_REQUEST; … … 166 166 acl_buffer[9] = 1; 167 167 uint16_t pos = 12; 168 bt_store_16(acl_buffer, pos, interval_min);169 pos += 2; 170 bt_store_16(acl_buffer, pos, interval_max);171 pos += 2; 172 bt_store_16(acl_buffer, pos, slave_latency);173 pos += 2; 174 bt_store_16(acl_buffer, pos, timeout_multiplier);168 little_endian_store_16(acl_buffer, pos, interval_min); 169 pos += 2; 170 little_endian_store_16(acl_buffer, pos, interval_max); 171 pos += 2; 172 little_endian_store_16(acl_buffer, pos, slave_latency); 173 pos += 2; 174 little_endian_store_16(acl_buffer, pos, timeout_multiplier); 175 175 pos += 2; 176 176 // 2 - ACL length 177 bt_store_16(acl_buffer, 2, pos - 4);177 little_endian_store_16(acl_buffer, 2, pos - 4); 178 178 // 4 - L2CAP packet length 179 bt_store_16(acl_buffer, 4, pos - 6 - 2);179 little_endian_store_16(acl_buffer, 4, pos - 6 - 2); 180 180 // 10 - L2CAP signaling parameter length 181 bt_store_16(acl_buffer, 10, pos - 12);181 little_endian_store_16(acl_buffer, 10, pos - 12); 182 182 return pos; 183 183 } … … 188 188 189 189 // 0 - Connection handle : PB=pb : BC=00 190 bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));190 little_endian_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14)); 191 191 // 6 - L2CAP LE Signaling channel = 5 192 bt_store_16(acl_buffer, 6, 5);192 little_endian_store_16(acl_buffer, 6, 5); 193 193 // 8 - Code 194 194 acl_buffer[8] = CONNECTION_PARAMETER_UPDATE_REQUEST; … … 196 196 acl_buffer[9] = 1; 197 197 uint16_t pos = 12; 198 bt_store_16(acl_buffer, pos, response);198 little_endian_store_16(acl_buffer, pos, response); 199 199 pos += 2; 200 200 // 2 - ACL length 201 bt_store_16(acl_buffer, 2, pos - 4);201 little_endian_store_16(acl_buffer, 2, pos - 4); 202 202 // 4 - L2CAP packet length 203 bt_store_16(acl_buffer, 4, pos - 6 - 2);203 little_endian_store_16(acl_buffer, 4, pos - 6 - 2); 204 204 // 10 - L2CAP signaling parameter length 205 bt_store_16(acl_buffer, 10, pos - 12);205 little_endian_store_16(acl_buffer, 10, pos - 12); 206 206 return pos; 207 207 } -
asp3_tinet_ecnl_rx/trunk/btstack/src/pan.c
r337 r374 80 80 81 81 // 0x0001 "Service Class ID List" 82 de_add_number(service, DE_UINT, DE_SIZE_16, SDP_ServiceClassIDList);82 de_add_number(service, DE_UINT, DE_SIZE_16, BLUETOOTH_ATTRIBUTE_SERVICE_CLASS_ID_LIST); 83 83 attribute = de_push_sequence(service); 84 84 { … … 89 89 90 90 // 0x0004 "Protocol Descriptor List" 91 de_add_number(service, DE_UINT, DE_SIZE_16, SDP_ProtocolDescriptorList);91 de_add_number(service, DE_UINT, DE_SIZE_16, BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST); 92 92 attribute = de_push_sequence(service); 93 93 { … … 95 95 { 96 96 de_add_number(l2cpProtocol, DE_UUID, DE_SIZE_16, 0x0100); 97 de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, SDP_BNEPProtocol); // l2cap psm97 de_add_number(l2cpProtocol, DE_UINT, DE_SIZE_16, BLUETOOTH_PROTOCOL_BNEP); // l2cap psm 98 98 } 99 99 de_pop_sequence(attribute, l2cpProtocol); -
asp3_tinet_ecnl_rx/trunk/btstack/src/rfcomm.c
r337 r374 136 136 event[0] = RFCOMM_EVENT_INCOMING_CONNECTION; 137 137 event[1] = sizeof(event) - 2; 138 bt_flip_addr(&event[2], channel->multiplexer->remote_addr);138 reverse_bd_addr(channel->multiplexer->remote_addr, &event[2]); 139 139 event[8] = channel->dlci >> 1; 140 bt_store_16(event, 9, channel->rfcomm_cid);140 little_endian_store_16(event, 9, channel->rfcomm_cid); 141 141 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); 142 142 (*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event)); … … 157 157 event[pos++] = sizeof(event) - 2; 158 158 event[pos++] = status; 159 bt_flip_addr(&event[pos], channel->multiplexer->remote_addr); pos += 6;160 bt_store_16(event, pos, channel->multiplexer->con_handle); pos += 2;159 reverse_bd_addr(channel->multiplexer->remote_addr, &event[pos]); pos += 6; 160 little_endian_store_16(event, pos, channel->multiplexer->con_handle); pos += 2; 161 161 event[pos++] = channel->dlci >> 1; 162 bt_store_16(event, pos, channel->rfcomm_cid); pos += 2; // channel ID163 bt_store_16(event, pos, channel->max_frame_size); pos += 2; // max frame size162 little_endian_store_16(event, pos, channel->rfcomm_cid); pos += 2; // channel ID 163 little_endian_store_16(event, pos, channel->max_frame_size); pos += 2; // max frame size 164 164 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); 165 165 (*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, pos); … … 175 175 event[pos++] = sizeof(event) - 2; 176 176 event[pos++] = BTSTACK_MEMORY_ALLOC_FAILED; 177 bt_flip_addr(&event[pos], *addr); pos += 6;178 bt_store_16(event, pos, 0); pos += 2;177 reverse_bd_addr(*addr, &event[pos]); pos += 6; 178 little_endian_store_16(event, pos, 0); pos += 2; 179 179 event[pos++] = server_channel; 180 bt_store_16(event, pos, 0); pos += 2; // channel ID181 bt_store_16(event, pos, 0); pos += 2; // max frame size180 little_endian_store_16(event, pos, 0); pos += 2; // channel ID 181 little_endian_store_16(event, pos, 0); pos += 2; // max frame size 182 182 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); 183 183 (*app_packet_handler)(connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, pos); … … 204 204 event[0] = RFCOMM_EVENT_CHANNEL_CLOSED; 205 205 event[1] = sizeof(event) - 2; 206 bt_store_16(event, 2, channel->rfcomm_cid);206 little_endian_store_16(event, 2, channel->rfcomm_cid); 207 207 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); 208 208 (*app_packet_handler)(channel->connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event)); … … 214 214 event[0] = RFCOMM_EVENT_CREDITS; 215 215 event[1] = sizeof(event) - 2; 216 bt_store_16(event, 2, channel->rfcomm_cid);216 little_endian_store_16(event, 2, channel->rfcomm_cid); 217 217 event[4] = credits; 218 218 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 237 237 event[0] = RFCOMM_EVENT_REMOTE_LINE_STATUS; 238 238 event[1] = sizeof(event) - 2; 239 bt_store_16(event, 2, channel->rfcomm_cid);239 little_endian_store_16(event, 2, channel->rfcomm_cid); 240 240 event[4] = line_status; 241 241 hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event)); … … 905 905 case L2CAP_EVENT_INCOMING_CONNECTION: 906 906 // data: event(8), len(8), address(48), handle (16), psm (16), source cid(16) dest cid(16) 907 bt_flip_addr(event_addr, &packet[2]);908 con_handle = READ_BT_16(packet, 8);909 psm = READ_BT_16(packet, 10);910 l2cap_cid = READ_BT_16(packet, 12);907 reverse_bd_addr(&packet[2], event_addr); 908 con_handle = little_endian_read_16(packet, 8); 909 psm = little_endian_read_16(packet, 10); 910 l2cap_cid = little_endian_read_16(packet, 12); 911 911 912 912 if (psm != PSM_RFCOMM) break; … … 939 939 case L2CAP_EVENT_CHANNEL_OPENED: 940 940 941 if ( READ_BT_16(packet, 11) != PSM_RFCOMM) break;941 if (little_endian_read_16(packet, 11) != PSM_RFCOMM) break; 942 942 943 943 status = packet[2]; … … 945 945 946 946 // get multiplexer for remote addr 947 con_handle = READ_BT_16(packet, 9);948 l2cap_cid = READ_BT_16(packet, 13);949 bt_flip_addr(event_addr, &packet[3]);947 con_handle = little_endian_read_16(packet, 9); 948 l2cap_cid = little_endian_read_16(packet, 13); 949 reverse_bd_addr(&packet[3], event_addr); 950 950 multiplexer = rfcomm_multiplexer_for_addr(&event_addr); 951 951 if (!multiplexer) { … … 990 990 991 991 // set max frame size based on l2cap MTU 992 multiplexer->max_frame_size = rfcomm_max_frame_size_for_l2cap_mtu( READ_BT_16(packet, 17));992 multiplexer->max_frame_size = rfcomm_max_frame_size_for_l2cap_mtu(little_endian_read_16(packet, 17)); 993 993 } 994 994 return 1; … … 998 998 case L2CAP_EVENT_CREDITS: 999 999 // data: event(8), len(8), local_cid(16), credits(8) 1000 l2cap_cid = READ_BT_16(packet, 2);1000 l2cap_cid = little_endian_read_16(packet, 2); 1001 1001 multiplexer = rfcomm_multiplexer_for_l2cap_cid(l2cap_cid); 1002 1002 if (!multiplexer) break; … … 1019 1019 case L2CAP_EVENT_CHANNEL_CLOSED: 1020 1020 // data: event (8), len(8), channel (16) 1021 l2cap_cid = READ_BT_16(packet, 2);1021 l2cap_cid = little_endian_read_16(packet, 2); 1022 1022 multiplexer = rfcomm_multiplexer_for_l2cap_cid(l2cap_cid); 1023 1023 log_info("L2CAP_EVENT_CHANNEL_CLOSED cid 0x%0x, mult %p", l2cap_cid, multiplexer); … … 1478 1478 event_pn.super.type = CH_EVT_RCVD_PN; 1479 1479 event_pn.priority = packet[payload_offset+4]; 1480 event_pn.max_frame_size = READ_BT_16(packet, payload_offset+6);1480 event_pn.max_frame_size = little_endian_read_16(packet, payload_offset+6); 1481 1481 event_pn.credits_outgoing = packet[payload_offset+9]; 1482 1482 log_info("Received UIH Parameter Negotiation Command for #%u, credits %u", … … 1489 1489 event_pn.super.type = CH_EVT_RCVD_PN_RSP; 1490 1490 event_pn.priority = packet[payload_offset+4]; 1491 event_pn.max_frame_size = READ_BT_16(packet, payload_offset+6);1491 event_pn.max_frame_size = little_endian_read_16(packet, payload_offset+6); 1492 1492 event_pn.credits_outgoing = packet[payload_offset+9]; 1493 1493 log_info("Received UIH Parameter Negotiation Response max frame %u, credits %u", -
asp3_tinet_ecnl_rx/trunk/btstack/src/sdp.c
r337 r374 90 90 if (de_get_element_type(serviceRecordHandleAttribute) != DE_UINT) return 0; 91 91 if (de_get_size_type(serviceRecordHandleAttribute) != DE_SIZE_32) return 0; 92 return READ_NET_32(serviceRecordHandleAttribute, 1);92 return big_endian_read_32(serviceRecordHandleAttribute, 1); 93 93 } 94 94 … … 100 100 event[1] = sizeof(event) - 2; 101 101 event[2] = status; 102 bt_store_32(event, 3, handle);102 little_endian_store_32(event, 3, handle); 103 103 hci_dump_packet(HCI_EVENT_PACKET, 0, event, sizeof(event)); 104 104 (*app_packet_handler)(connection, HCI_EVENT_PACKET, 0, (uint8_t *) event, sizeof(event)); … … 275 275 276 276 // get request details 277 uint16_t transaction_id = READ_NET_16(packet, 1);278 // not used yet - uint16_t param_len = READ_NET_16(packet, 3);277 uint16_t transaction_id = big_endian_read_16(packet, 1); 278 // not used yet - uint16_t param_len = big_endian_read_16(packet, 3); 279 279 uint8_t * serviceSearchPattern = &packet[5]; 280 280 uint16_t serviceSearchPatternLen = de_get_len(serviceSearchPattern); 281 uint16_t maximumServiceRecordCount = READ_NET_16(packet, 5 + serviceSearchPatternLen);281 uint16_t maximumServiceRecordCount = big_endian_read_16(packet, 5 + serviceSearchPatternLen); 282 282 uint8_t * continuationState = &packet[5+serviceSearchPatternLen+2]; 283 283 … … 297 297 continuation_index = 0; 298 298 if (continuationState[0] == 2){ 299 continuation_index = READ_NET_16(continuationState, 1);299 continuation_index = big_endian_read_16(continuationState, 1); 300 300 } 301 301 … … 359 359 360 360 // get request details 361 uint16_t transaction_id = READ_NET_16(packet, 1);362 // not used yet - uint16_t param_len = READ_NET_16(packet, 3);363 uint32_t serviceRecordHandle = READ_NET_32(packet, 5);364 uint16_t maximumAttributeByteCount = READ_NET_16(packet, 9);361 uint16_t transaction_id = big_endian_read_16(packet, 1); 362 // not used yet - uint16_t param_len = big_endian_read_16(packet, 3); 363 uint32_t serviceRecordHandle = big_endian_read_32(packet, 5); 364 uint16_t maximumAttributeByteCount = big_endian_read_16(packet, 9); 365 365 uint8_t * attributeIDList = &packet[11]; 366 366 uint16_t attributeIDListLen = de_get_len(attributeIDList); … … 383 383 continuation_offset = 0; 384 384 if (continuationState[0] == 2){ 385 continuation_offset = READ_NET_16(continuationState, 1);385 continuation_offset = big_endian_read_16(continuationState, 1); 386 386 } 387 387 … … 452 452 453 453 // get request details 454 uint16_t transaction_id = READ_NET_16(packet, 1);455 // not used yet - uint16_t param_len = READ_NET_16(packet, 3);454 uint16_t transaction_id = big_endian_read_16(packet, 1); 455 // not used yet - uint16_t param_len = big_endian_read_16(packet, 3); 456 456 uint8_t * serviceSearchPattern = &packet[5]; 457 457 uint16_t serviceSearchPatternLen = de_get_len(serviceSearchPattern); 458 uint16_t maximumAttributeByteCount = READ_NET_16(packet, 5 + serviceSearchPatternLen);458 uint16_t maximumAttributeByteCount = big_endian_read_16(packet, 5 + serviceSearchPatternLen); 459 459 uint8_t * attributeIDList = &packet[5+serviceSearchPatternLen+2]; 460 460 uint16_t attributeIDListLen = de_get_len(attributeIDList); … … 481 481 continuation_offset = 0; 482 482 if (continuationState[0] == 4){ 483 continuation_service_index = READ_NET_16(continuationState, 1);484 continuation_offset = READ_NET_16(continuationState, 3);483 continuation_service_index = big_endian_read_16(continuationState, 1); 484 continuation_offset = big_endian_read_16(continuationState, 3); 485 485 } 486 486 … … 593 593 case L2CAP_DATA_PACKET: 594 594 pdu_id = (SDP_PDU_ID_t) packet[0]; 595 transaction_id = READ_NET_16(packet, 1);596 // param_len = READ_NET_16(packet, 3);595 transaction_id = big_endian_read_16(packet, 1); 596 // param_len = big_endian_read_16(packet, 3); 597 597 remote_mtu = l2cap_get_remote_mtu_for_local_cid(channel); 598 598 // account for our buffer -
asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_client.c
r337 r374 151 151 static void parse_service_search_attribute_response(uint8_t* packet){ 152 152 uint16_t offset = 3; 153 uint16_t parameterLength = READ_NET_16(packet,offset);153 uint16_t parameterLength = big_endian_read_16(packet,offset); 154 154 uint16_t attributeListByteCount; 155 155 offset+=2; 156 156 // AttributeListByteCount <= mtu 157 attributeListByteCount = READ_NET_16(packet,offset);157 attributeListByteCount = big_endian_read_16(packet,offset); 158 158 offset+=2; 159 159 … … 185 185 // uint16_t handle; 186 186 if (packet_type == L2CAP_DATA_PACKET){ 187 uint16_t responseTransactionID = READ_NET_16(packet,1);187 uint16_t responseTransactionID = big_endian_read_16(packet,1); 188 188 if ( responseTransactionID != transactionID){ 189 189 log_error("Missmatching transaction ID, expected %u, found %u.", transactionID, responseTransactionID); … … 247 247 } 248 248 sdp_cid = channel; 249 mtu = READ_BT_16(packet, 17);250 // handle = READ_BT_16(packet, 9);249 mtu = little_endian_read_16(packet, 17); 250 // handle = little_endian_read_16(packet, 9); 251 251 log_info("SDP Client Connected, cid %x, mtu %u.", sdp_cid, mtu); 252 252 … … 261 261 case L2CAP_EVENT_CHANNEL_CLOSED: { 262 262 uint8_t status; 263 if (sdp_cid != READ_BT_16(packet, 2)) {264 // log_info("Received L2CAP_EVENT_CHANNEL_CLOSED for cid %x, current cid %x\n", READ_BT_16(packet, 2),sdp_cid);263 if (sdp_cid != little_endian_read_16(packet, 2)) { 264 // log_info("Received L2CAP_EVENT_CHANNEL_CLOSED for cid %x, current cid %x\n", little_endian_read_16(packet, 2),sdp_cid); 265 265 break; 266 266 } … … 402 402 static void parse_service_search_response(uint8_t* packet){ 403 403 uint16_t offset = 3; 404 uint16_t parameterLength = READ_NET_16(packet,offset);404 uint16_t parameterLength = big_endian_read_16(packet,offset); 405 405 uint16_t totalServiceRecordCount; 406 406 uint16_t currentServiceRecordCount; 407 407 offset+=2; 408 408 409 totalServiceRecordCount = READ_NET_16(packet,offset);410 offset+=2; 411 412 currentServiceRecordCount = READ_NET_16(packet,offset);409 totalServiceRecordCount = big_endian_read_16(packet,offset); 410 offset+=2; 411 412 currentServiceRecordCount = big_endian_read_16(packet,offset); 413 413 offset+=2; 414 414 if (currentServiceRecordCount > totalServiceRecordCount){ … … 436 436 static void parse_service_attribute_response(uint8_t* packet){ 437 437 uint16_t offset = 3; 438 uint16_t parameterLength = READ_NET_16(packet,offset);438 uint16_t parameterLength = big_endian_read_16(packet,offset); 439 439 uint16_t attributeListByteCount; 440 440 offset+=2; 441 441 442 442 // AttributeListByteCount <= mtu 443 attributeListByteCount = READ_NET_16(packet,offset);443 attributeListByteCount = big_endian_read_16(packet,offset); 444 444 offset+=2; 445 445 -
asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_parser.c
r337 r374 166 166 { 167 167 sdp_query_attribute_value_event_t attribute_value_event = { 168 SDP_ QUERY_ATTRIBUTE_VALUE,168 SDP_EVENT_QUERY_ATTRIBUTE_VALUE, 169 169 record_counter, 170 170 attribute_id, … … 186 186 { 187 187 sdp_query_attribute_value_event_t attribute_value_event = { 188 SDP_ QUERY_ATTRIBUTE_VALUE,188 SDP_EVENT_QUERY_ATTRIBUTE_VALUE, 189 189 record_counter, 190 190 attribute_id, … … 258 258 int i; 259 259 for (i=0;i<record_handle_count;i++){ 260 record_handle = READ_NET_32(data, i*4);260 record_handle = big_endian_read_32(data, i*4); 261 261 record_counter++; 262 262 { … … 275 275 void sdp_parser_handle_done(uint8_t status){ 276 276 sdp_query_complete_event_t complete_event = { 277 SDP_ QUERY_COMPLETE,277 SDP_EVENT_QUERY_COMPLETE, 278 278 status 279 279 }; -
asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_query_rfcomm.c
r337 r374 248 248 sdp_query_attribute_value_event_t * ve; 249 249 switch (event->type){ 250 case SDP_ QUERY_ATTRIBUTE_VALUE:250 case SDP_EVENT_QUERY_ATTRIBUTE_VALUE: 251 251 ve = (sdp_query_attribute_value_event_t*) event; 252 252 // log_info("handle_sdp_parser_event [ AID, ALen, DOff, Data] : [%x, %u, %u] BYTE %02x", … … 254 254 255 255 switch (ve->attribute_id){ 256 case SDP_ProtocolDescriptorList:256 case BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST: 257 257 // find rfcomm channel 258 258 handleProtocolDescriptorListData(ve->attribute_length, ve->data_offset, ve->data); … … 267 267 } 268 268 break; 269 case SDP_ QUERY_COMPLETE:269 case SDP_EVENT_QUERY_COMPLETE: 270 270 (*sdp_app_callback)(event, sdp_app_context); 271 271 break; -
asp3_tinet_ecnl_rx/trunk/btstack/src/sdp_util.c
r337 r374 98 98 break; 99 99 case DE_SIZE_VAR_16: 100 result = READ_NET_16(header,1);100 result = big_endian_read_16(header,1); 101 101 break; 102 102 case DE_SIZE_VAR_32: 103 result = READ_NET_32(header,1);103 result = big_endian_read_32(header,1); 104 104 break; 105 105 default: … … 122 122 int de_element_get_uint16(uint8_t * element, uint16_t * value){ 123 123 if (de_get_size_type(element) != DE_SIZE_16) return 0; 124 *value = READ_NET_16(element, de_get_header_size(element));124 *value = big_endian_read_16(element, de_get_header_size(element)); 125 125 return 1; 126 126 } … … 134 134 switch (uuidSize){ 135 135 case DE_SIZE_16: 136 shortUUID = READ_NET_16(element, 1);136 shortUUID = big_endian_read_16(element, 1); 137 137 break; 138 138 case DE_SIZE_32: 139 shortUUID = READ_NET_32(element, 1);139 shortUUID = big_endian_read_32(element, 1); 140 140 break; 141 141 case DE_SIZE_128: … … 157 157 hasBlueoothBaseUuid = sdp_has_blueooth_base_uuid(uuid128); 158 158 if (!hasBlueoothBaseUuid) return 0; 159 return READ_NET_32(uuid128, 0);159 return big_endian_read_32(uuid128, 0); 160 160 } 161 161 … … 199 199 void de_pop_sequence(uint8_t * parent, uint8_t * child){ 200 200 int child_len = de_get_len(child); 201 int data_size_parent = READ_NET_16(parent,1);201 int data_size_parent = big_endian_read_16(parent,1); 202 202 net_store_16(parent, 1, data_size_parent + child_len); 203 203 } … … 205 205 /* adds a single number value and 16+32 bit UUID to the sequence */ 206 206 void de_add_number(uint8_t *seq, de_type_t type, de_size_t size, uint32_t value){ 207 int data_size = READ_NET_16(seq,1);207 int data_size = big_endian_read_16(seq,1); 208 208 int element_size = 1; // e.g. for DE_TYPE_NIL 209 209 de_store_descriptor(seq+3+data_size, type, size); … … 231 231 /* add a single block of data, e.g. as DE_STRING, DE_URL */ 232 232 void de_add_data( uint8_t *seq, de_type_t type, uint16_t size, uint8_t *data){ 233 int data_size = READ_NET_16(seq,1);233 int data_size = big_endian_read_16(seq,1); 234 234 if (size > 0xff) { 235 235 // use 16-bit lengh information (3 byte header) … … 247 247 248 248 void de_add_uuid128(uint8_t * seq, uint8_t * uuid){ 249 int data_size = READ_NET_16(seq,1);249 int data_size = big_endian_read_16(seq,1); 250 250 de_store_descriptor(seq+3+data_size, DE_UUID, DE_SIZE_128); 251 251 memcpy( seq + 4 + data_size, uuid, 16); … … 326 326 uint8_t done; 327 327 if (idType != DE_UINT || idSize != DE_SIZE_16) break; // wrong type 328 attribute_id = READ_NET_16(element, pos + 1);328 attribute_id = big_endian_read_16(element, pos + 1); 329 329 pos += 3; 330 330 if (pos >= end_pos) break; // array out of bounds … … 349 349 switch (size) { 350 350 case DE_SIZE_16: 351 if ( READ_NET_16(element, 1) == context->attributeID) {351 if (big_endian_read_16(element, 1) == context->attributeID) { 352 352 context->result = 1; 353 353 return 1; … … 355 355 break; 356 356 case DE_SIZE_32: 357 if ( READ_NET_16(element, 1) <= context->attributeID358 && context->attributeID <= READ_NET_16(element, 3)) {357 if (big_endian_read_16(element, 1) <= context->attributeID 358 && context->attributeID <= big_endian_read_16(element, 3)) { 359 359 context->result = 1; 360 360 return 1; … … 388 388 if (sdp_attribute_list_constains_id(context->attributeIDList, attributeID)) { 389 389 // DES_HEADER(3) + DES_DATA + (UINT16(3) + attribute) 390 uint16_t data_size = READ_NET_16(context->buffer, 1);390 uint16_t data_size = big_endian_read_16(context->buffer, 1); 391 391 int attribute_len = de_get_len(attributeValue); 392 392 if (3 + data_size + (3 + attribute_len) <= context->maxBytes) { … … 662 662 break; 663 663 case DE_SIZE_VAR_16: 664 len = READ_NET_16(element, 1);664 len = big_endian_read_16(element, 1); 665 665 break; 666 666 default: … … 678 678 break; 679 679 case DE_SIZE_16: 680 value = READ_NET_16(element,pos);680 value = big_endian_read_16(element,pos); 681 681 break; 682 682 case DE_SIZE_32: 683 value = READ_NET_32(element,pos);683 value = big_endian_read_32(element,pos); 684 684 break; 685 685 default: … … 712 712 713 713 // 0x0001 "Service Class ID List" 714 de_add_number(service, DE_UINT, DE_SIZE_16, SDP_ServiceClassIDList);714 de_add_number(service, DE_UINT, DE_SIZE_16, BLUETOOTH_ATTRIBUTE_SERVICE_CLASS_ID_LIST); 715 715 attribute = de_push_sequence(service); 716 716 { … … 720 720 721 721 // 0x0004 "Protocol Descriptor List" 722 de_add_number(service, DE_UINT, DE_SIZE_16, SDP_ProtocolDescriptorList);722 de_add_number(service, DE_UINT, DE_SIZE_16, BLUETOOTH_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST); 723 723 attribute = de_push_sequence(service); 724 724 { -
asp3_tinet_ecnl_rx/trunk/btstack/src/utils.c
r337 r374 49 49 #include "debug.h" 50 50 51 void bt_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){51 void little_endian_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){ 52 52 buffer[pos++] = value; 53 53 buffer[pos++] = value >> 8; 54 54 } 55 55 56 void bt_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){56 void little_endian_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){ 57 57 buffer[pos++] = value; 58 58 buffer[pos++] = value >> 8; … … 73 73 } 74 74 75 void bt_flip_addr(bd_addr_t dest, bd_addr_t src){75 void reverse_bd_addr(bd_addr_t src, bd_addr_t dest){ 76 76 dest[0] = src[5]; 77 77 dest[1] = src[4]; -
asp3_tinet_ecnl_rx/trunk/curl-7.57.0/lib/security.c
r337 r374 8 8 * below. 9 9 * 10 * Copyright (c) 1998, 1999, 2017 Kungliga Tekniska H 旦gskolan10 * Copyright (c) 1998, 1999, 2017 Kungliga Tekniska Hogskolan 11 11 * (Royal Institute of Technology, Stockholm, Sweden). 12 12 * -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/include/bits/alltypes.h
r364 r374 23 23 #define open musl_open 24 24 #define perror musl_perror 25 #define printf musl_printf 25 26 #define read musl_read 26 27 #define realloc musl_realloc … … 31 32 #define tzset musl_tzset 32 33 #define unlink musl_unlink 34 #define strncmp musl_strncmp 35 #define strtol musl_strtol 36 #define strchr musl_strchr 33 37 #endif 34 38 #ifdef _MSC_VER -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/process/vfork.c
r337 r374 15 15 } 16 16 17 #ifndef __c2__ 17 18 weak_alias(__vfork, vfork); 19 #else 20 pid_t vfork(void) 21 { 22 return __vfork(); 23 } 24 #endif -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/signal/sigaction.c
r337 r374 61 61 } 62 62 63 #ifndef __c2__ 63 64 weak_alias(__sigaction, sigaction); 65 #else 66 int sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old) 67 { 68 return __sigaction(sig, sa, old); 69 } 70 #endif -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/stdlib/strtol.c
r364 r374 57 57 } 58 58 59 weak_alias(strtol, __strtol_internal);60 59 #if defined(_MSC_VER) || defined(__c2__) 60 weak_alias(musl_strtol, __strtol_internal); 61 61 weak_alias(musl_strtoul, __strtoul_internal); 62 62 #else 63 weak_alias(strtol, __strtol_internal); 63 64 weak_alias(strtoul, __strtoul_internal); 64 65 #endif -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/string/memrchr.c
r337 r374 10 10 } 11 11 12 #ifndef __c2__ 12 13 weak_alias(__memrchr, memrchr); 14 #else 15 void *memrchr(const void *m, int c, size_t n) 16 { 17 return __memrchr(m, c, n); 18 } 19 #endif -
asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/string/strchrnul.c
r337 r374 24 24 } 25 25 26 #ifndef __c2__ 26 27 weak_alias(__strchrnul, strchrnul); 28 #else 29 char *strchrnul(const char *s, int c) 30 { 31 return __strchrnul(s, c); 32 } 33 #endif -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/ccsbcs.c
r337 r374 25 25 26 26 27 #if _CODE_PAGE == 43727 #if FF_CODE_PAGE == 437 28 28 #define _TBLDEF 1 29 29 static … … 39 39 }; 40 40 41 #elif _CODE_PAGE == 72041 #elif FF_CODE_PAGE == 720 42 42 #define _TBLDEF 1 43 43 static … … 53 53 }; 54 54 55 #elif _CODE_PAGE == 73755 #elif FF_CODE_PAGE == 737 56 56 #define _TBLDEF 1 57 57 static … … 67 67 }; 68 68 69 #elif _CODE_PAGE == 77169 #elif FF_CODE_PAGE == 771 70 70 #define _TBLDEF 1 71 71 static … … 81 81 }; 82 82 83 #elif _CODE_PAGE == 77583 #elif FF_CODE_PAGE == 775 84 84 #define _TBLDEF 1 85 85 static … … 95 95 }; 96 96 97 #elif _CODE_PAGE == 85097 #elif FF_CODE_PAGE == 850 98 98 #define _TBLDEF 1 99 99 static … … 109 109 }; 110 110 111 #elif _CODE_PAGE == 852111 #elif FF_CODE_PAGE == 852 112 112 #define _TBLDEF 1 113 113 static … … 123 123 }; 124 124 125 #elif _CODE_PAGE == 855125 #elif FF_CODE_PAGE == 855 126 126 #define _TBLDEF 1 127 127 static … … 137 137 }; 138 138 139 #elif _CODE_PAGE == 857139 #elif FF_CODE_PAGE == 857 140 140 #define _TBLDEF 1 141 141 static … … 151 151 }; 152 152 153 #elif _CODE_PAGE == 860153 #elif FF_CODE_PAGE == 860 154 154 #define _TBLDEF 1 155 155 static … … 165 165 }; 166 166 167 #elif _CODE_PAGE == 861167 #elif FF_CODE_PAGE == 861 168 168 #define _TBLDEF 1 169 169 static … … 179 179 }; 180 180 181 #elif _CODE_PAGE == 862181 #elif FF_CODE_PAGE == 862 182 182 #define _TBLDEF 1 183 183 static … … 193 193 }; 194 194 195 #elif _CODE_PAGE == 863195 #elif FF_CODE_PAGE == 863 196 196 #define _TBLDEF 1 197 197 static … … 207 207 }; 208 208 209 #elif _CODE_PAGE == 864209 #elif FF_CODE_PAGE == 864 210 210 #define _TBLDEF 1 211 211 static … … 221 221 }; 222 222 223 #elif _CODE_PAGE == 865223 #elif FF_CODE_PAGE == 865 224 224 #define _TBLDEF 1 225 225 static … … 235 235 }; 236 236 237 #elif _CODE_PAGE == 866237 #elif FF_CODE_PAGE == 866 238 238 #define _TBLDEF 1 239 239 static … … 249 249 }; 250 250 251 #elif _CODE_PAGE == 869251 #elif FF_CODE_PAGE == 869 252 252 #define _TBLDEF 1 253 253 static … … 266 266 267 267 268 #if _CODE_PAGE != 65001 && (!_TBLDEF || !_USE_LFN)268 #if FF_CODE_PAGE != 65001 && (!_TBLDEF || !FF_USE_LFN) 269 269 #error This file is not needed at current configuration. Remove from the project. 270 270 #endif … … 272 272 273 273 274 #if _CODE_PAGE != 65001274 #if FF_CODE_PAGE != 65001 275 275 WCHAR ff_convert ( /* Converted character, Returns zero on error */ 276 276 WCHAR chr, /* Character code to be converted */ -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/diskio.c
r337 r374 34 34 int get_status(volatile RD_STAT *stat) { 35 35 stat->sz_sector = SS_RAMDISK; 36 if(stat->sz_sector < _MIN_SS || stat->sz_sector >_MAX_SS) return 0;36 if(stat->sz_sector < FF_MIN_SS || stat->sz_sector > FF_MAX_SS) return 0; 37 37 stat->n_sectors = SZ_RAMDISK * 1024 / SS_RAMDISK; 38 38 stat->status = 0; -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/diskio.h
r337 r374 60 60 61 61 /* Generic command (Used by FatFs) */ 62 #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */63 #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */64 #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS !=_MIN_SS) */65 #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */66 #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */62 #define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */ 63 #define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */ 64 #define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */ 65 #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */ 66 #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */ 67 67 68 68 /* Generic command (Not used by FatFs) */ -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/ff.c
r369 r374 20 20 #include "ff.h" /* Declarations of FatFs API */ 21 21 #include "diskio.h" /* Declarations of disk I/O functions */ 22 #include "util/ntstdio.h"22 #include <stdio.h> 23 23 24 24 /*-------------------------------------------------------------------------- … … 34 34 35 35 /* Reentrancy related */ 36 #if _FS_REENTRANT37 #if _USE_LFN == 136 #if FF_FS_REENTRANT 37 #if FF_USE_LFN == 1 38 38 #error Static LFN work area cannot be used at thread-safe configuration 39 39 #endif … … 49 49 50 50 /* Definitions of sector size */ 51 #if ( _MAX_SS < _MIN_SS) || (_MAX_SS != 512 && _MAX_SS != 1024 && _MAX_SS != 2048 && _MAX_SS != 4096) || (_MIN_SS != 512 && _MIN_SS != 1024 && _MIN_SS != 2048 &&_MIN_SS != 4096)51 #if (FF_MAX_SS < FF_MIN_SS) || (FF_MAX_SS != 512 && FF_MAX_SS != 1024 && FF_MAX_SS != 2048 && FF_MAX_SS != 4096) || (FF_MIN_SS != 512 && FF_MIN_SS != 1024 && FF_MIN_SS != 2048 && FF_MIN_SS != 4096) 52 52 #error Wrong sector size configuration 53 53 #endif 54 #if _MAX_SS ==_MIN_SS55 #define SS(fs) ((UINT) _MAX_SS) /* Fixed sector size */54 #if FF_MAX_SS == FF_MIN_SS 55 #define SS(fs) ((UINT)FF_MAX_SS) /* Fixed sector size */ 56 56 #else 57 57 #define SS(fs) ((fs)->ssize) /* Variable sector size */ … … 60 60 61 61 /* Timestamp feature */ 62 #if _FS_NORTC == 163 #if _NORTC_YEAR < 1980 || _NORTC_YEAR > 2107 || _NORTC_MON < 1 || _NORTC_MON > 12 || _NORTC_MDAY < 1 ||_NORTC_MDAY > 3164 #error Invalid _FS_NORTC settings65 #endif 66 #define GET_FATTIME() ((DWORD)( _NORTC_YEAR - 1980) << 25 | (DWORD)_NORTC_MON << 21 | (DWORD)_NORTC_MDAY << 16)62 #if FF_FS_NORTC == 1 63 #if FF_NORTC_YEAR < 1980 || FF_NORTC_YEAR > 2107 || FF_NORTC_MON < 1 || FF_NORTC_MON > 12 || FF_NORTC_MDAY < 1 || FF_NORTC_MDAY > 31 64 #error Invalid FF_FS_NORTC settings 65 #endif 66 #define GET_FATTIME() ((DWORD)(FF_NORTC_YEAR - 1980) << 25 | (DWORD)FF_NORTC_MON << 21 | (DWORD)FF_NORTC_MDAY << 16) 67 67 #else 68 68 #define GET_FATTIME() get_fattime() … … 71 71 72 72 /* File access control feature */ 73 #if _FS_LOCK74 #if _FS_READONLY75 #error _FS_LOCK must be 0 at read-only configuration73 #if FF_FS_LOCK != 0 74 #if FF_FS_READONLY 75 #error FF_FS_LOCK must be 0 at read-only configuration 76 76 #endif 77 77 typedef struct { … … 87 87 /* DBCS code ranges and SBCS upper conversion tables */ 88 88 89 #if _CODE_PAGE == 932 /* Japanese Shift-JIS */89 #if FF_CODE_PAGE == 932 /* Japanese Shift-JIS */ 90 90 #define _DF1S 0x81 /* DBC 1st byte range 1 start */ 91 91 #define _DF1E 0x9F /* DBC 1st byte range 1 end */ … … 97 97 #define _DS2E 0xFC /* DBC 2nd byte range 2 end */ 98 98 99 #elif _CODE_PAGE == 936 /* Simplified Chinese GBK */99 #elif FF_CODE_PAGE == 936 /* Simplified Chinese GBK */ 100 100 #define _DF1S 0x81 101 101 #define _DF1E 0xFE … … 105 105 #define _DS2E 0xFE 106 106 107 #elif _CODE_PAGE == 949 /* Korean */107 #elif FF_CODE_PAGE == 949 /* Korean */ 108 108 #define _DF1S 0x81 109 109 #define _DF1E 0xFE … … 115 115 #define _DS3E 0xFE 116 116 117 #elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */117 #elif FF_CODE_PAGE == 950 /* Traditional Chinese Big5 */ 118 118 #define _DF1S 0x81 119 119 #define _DF1E 0xFE … … 123 123 #define _DS2E 0xFE 124 124 125 #elif _CODE_PAGE == 437 /* U.S. */125 #elif FF_CODE_PAGE == 437 /* U.S. */ 126 126 #define _DF1S 0 127 127 #define _EXCVT {0x80,0x9A,0x45,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \ … … 134 134 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 135 135 136 #elif _CODE_PAGE == 720 /* Arabic */136 #elif FF_CODE_PAGE == 720 /* Arabic */ 137 137 #define _DF1S 0 138 138 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ … … 145 145 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 146 146 147 #elif _CODE_PAGE == 737 /* Greek */147 #elif FF_CODE_PAGE == 737 /* Greek */ 148 148 #define _DF1S 0 149 149 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ … … 156 156 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 157 157 158 #elif _CODE_PAGE == 771 /* KBL */158 #elif FF_CODE_PAGE == 771 /* KBL */ 159 159 #define _DF1S 0 160 160 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ … … 167 167 0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFE,0xFF} 168 168 169 #elif _CODE_PAGE == 775 /* Baltic */169 #elif FF_CODE_PAGE == 775 /* Baltic */ 170 170 #define _DF1S 0 171 171 #define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F, \ … … 178 178 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 179 179 180 #elif _CODE_PAGE == 850 /* Latin 1 */180 #elif FF_CODE_PAGE == 850 /* Latin 1 */ 181 181 #define _DF1S 0 182 182 #define _EXCVT {0x43,0x55,0x45,0x41,0x41,0x41,0x41,0x43,0x45,0x45,0x45,0x49,0x49,0x49,0x41,0x41, \ … … 189 189 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 190 190 191 #elif _CODE_PAGE == 852 /* Latin 2 */191 #elif FF_CODE_PAGE == 852 /* Latin 2 */ 192 192 #define _DF1S 0 193 193 #define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F, \ … … 200 200 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF} 201 201 202 #elif _CODE_PAGE == 855 /* Cyrillic */202 #elif FF_CODE_PAGE == 855 /* Cyrillic */ 203 203 #define _DF1S 0 204 204 #define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F, \ … … 211 211 0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF} 212 212 213 #elif _CODE_PAGE == 857 /* Turkish */213 #elif FF_CODE_PAGE == 857 /* Turkish */ 214 214 #define _DF1S 0 215 215 #define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x49,0x8E,0x8F, \ … … 222 222 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 223 223 224 #elif _CODE_PAGE == 860 /* Portuguese */224 #elif FF_CODE_PAGE == 860 /* Portuguese */ 225 225 #define _DF1S 0 226 226 #define _EXCVT {0x80,0x9A,0x90,0x8F,0x8E,0x91,0x86,0x80,0x89,0x89,0x92,0x8B,0x8C,0x98,0x8E,0x8F, \ … … 233 233 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 234 234 235 #elif _CODE_PAGE == 861 /* Icelandic */235 #elif FF_CODE_PAGE == 861 /* Icelandic */ 236 236 #define _DF1S 0 237 237 #define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x8B,0x8B,0x8D,0x8E,0x8F, \ … … 244 244 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 245 245 246 #elif _CODE_PAGE == 862 /* Hebrew */246 #elif FF_CODE_PAGE == 862 /* Hebrew */ 247 247 #define _DF1S 0 248 248 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ … … 255 255 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 256 256 257 #elif _CODE_PAGE == 863 /* Canadian-French */257 #elif FF_CODE_PAGE == 863 /* Canadian-French */ 258 258 #define _DF1S 0 259 259 #define _EXCVT {0x43,0x55,0x45,0x41,0x41,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x41,0x8F, \ … … 266 266 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 267 267 268 #elif _CODE_PAGE == 864 /* Arabic */268 #elif FF_CODE_PAGE == 864 /* Arabic */ 269 269 #define _DF1S 0 270 270 #define _EXCVT {0x80,0x9A,0x45,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \ … … 277 277 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 278 278 279 #elif _CODE_PAGE == 865 /* Nordic */279 #elif FF_CODE_PAGE == 865 /* Nordic */ 280 280 #define _DF1S 0 281 281 #define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, \ … … 288 288 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 289 289 290 #elif _CODE_PAGE == 866 /* Russian */290 #elif FF_CODE_PAGE == 866 /* Russian */ 291 291 #define _DF1S 0 292 292 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ … … 299 299 0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 300 300 301 #elif _CODE_PAGE == 869 /* Greek 2 */301 #elif FF_CODE_PAGE == 869 /* Greek 2 */ 302 302 #define _DF1S 0 303 303 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, \ … … 310 310 0xF0,0xF1,0xD1,0xD2,0xD3,0xF5,0xD4,0xF7,0xF8,0xF9,0xD5,0x96,0x95,0x98,0xFE,0xFF} 311 311 312 #elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */313 #if _USE_LFN312 #elif FF_CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */ 313 #if FF_USE_LFN 314 314 #error Cannot use LFN feature without valid code page. 315 315 #endif 316 316 #define _DF1S 0 317 317 318 #elif _CODE_PAGE == 65001 /* UTF-8 */319 #if _LFN_UNICODE318 #elif FF_CODE_PAGE == 65001 /* UTF-8 */ 319 #if FF_LFN_UNICODE 320 320 #error Cannot use LFN_UNICODE feature without valid code page. 321 321 #endif … … 532 532 */ 533 533 534 #if _VOLUMES < 1 ||_VOLUMES > 9535 #error Wrong _VOLUMES setting536 #endif 537 static FATFS *FatFs[ _VOLUMES]; /* Pointer to the file system objects (logical drives) */534 #if FF_VOLUMES < 1 || FF_VOLUMES > 9 535 #error Wrong FF_VOLUMES setting 536 #endif 537 static FATFS *FatFs[FF_VOLUMES]; /* Pointer to the file system objects (logical drives) */ 538 538 static WORD Fsid; /* File system mount ID */ 539 539 540 #if _FS_RPATH &&_VOLUMES >= 2540 #if FF_FS_RPATH && FF_VOLUMES >= 2 541 541 static BYTE CurrVol; /* Current drive */ 542 542 #endif 543 543 544 #if _FS_LOCK545 static FILESEM Files[ _FS_LOCK]; /* Open object lock semaphores */546 #endif 547 548 #if _USE_LFN == 0 /* Non LFN feature */544 #if FF_FS_LOCK != 0 545 static FILESEM Files[FF_FS_LOCK]; /* Open object lock semaphores */ 546 #endif 547 548 #if FF_USE_LFN == 0 /* Non LFN feature */ 549 549 #define DEFINE_NAMEBUF BYTE sfn[12] 550 550 #define INIT_BUF(dobj) (dobj).fn = sfn 551 551 #define FREE_BUF() 552 552 #else 553 #if _MAX_LFN < 12 ||_MAX_LFN > 255554 #error Wrong _MAX_LFN setting555 #endif 556 #if _USE_LFN == 1 /* LFN feature with static working buffer */557 static WCHAR LfnBuf[ _MAX_LFN + 1];553 #if FF_MAX_LFN < 12 || FF_MAX_LFN > 255 554 #error Wrong FF_MAX_LFN setting 555 #endif 556 #if FF_USE_LFN == 1 /* LFN feature with static working buffer */ 557 static WCHAR LfnBuf[FF_MAX_LFN + 1]; 558 558 #define DEFINE_NAMEBUF BYTE sfn[12] 559 559 #define INIT_BUF(dobj) { (dobj).fn = sfn; (dobj).lfn = LfnBuf; } 560 560 #define FREE_BUF() 561 #elif _USE_LFN == 2 /* LFN feature with dynamic working buffer on the stack */562 #define DEFINE_NAMEBUF BYTE sfn[12]; WCHAR lbuf[ _MAX_LFN + 1]561 #elif FF_USE_LFN == 2 /* LFN feature with dynamic working buffer on the stack */ 562 #define DEFINE_NAMEBUF BYTE sfn[12]; WCHAR lbuf[FF_MAX_LFN + 1] 563 563 #define INIT_BUF(dobj) { (dobj).fn = sfn; (dobj).lfn = lbuf; } 564 564 #define FREE_BUF() 565 #elif _USE_LFN == 3 /* LFN feature with dynamic working buffer on the heap */565 #elif FF_USE_LFN == 3 /* LFN feature with dynamic working buffer on the heap */ 566 566 #define DEFINE_NAMEBUF BYTE sfn[12]; WCHAR *lfn 567 #define INIT_BUF(dobj) { lfn = ff_memalloc(( _MAX_LFN + 1) * 2); if (!lfn) LEAVE_FF((dobj).fs, FR_NOT_ENOUGH_CORE); (dobj).lfn = lfn; (dobj).fn = sfn; }567 #define INIT_BUF(dobj) { lfn = ff_memalloc((FF_MAX_LFN + 1) * 2); if (!lfn) LEAVE_FF((dobj).fs, FR_NOT_ENOUGH_CORE); (dobj).lfn = lfn; (dobj).fn = sfn; } 568 568 #define FREE_BUF() ff_memfree(lfn) 569 569 #else 570 #error Wrong _USE_LFN setting570 #error Wrong FF_USE_LFN setting 571 571 #endif 572 572 #endif … … 598 598 const BYTE *s = (const BYTE*)src; 599 599 600 #if _WORD_ACCESS == 1600 #if FF_WORD_ACCESS == 1 601 601 while (cnt >= sizeof (int)) { 602 602 *(int*)d = *(int*)s; … … 641 641 /* Request/Release grant to access the volume */ 642 642 /*-----------------------------------------------------------------------*/ 643 #if _FS_REENTRANT643 #if FF_FS_REENTRANT 644 644 static 645 645 int lock_fs ( … … 673 673 /* File lock control functions */ 674 674 /*-----------------------------------------------------------------------*/ 675 #if _FS_LOCK675 #if FF_FS_LOCK != 0 676 676 677 677 static 678 678 FRESULT chk_lock ( /* Check if the file can be accessed */ 679 DIR* dp, /* Directory object pointing the file to be checked */679 FATFS_DIR* dp, /* Directory object pointing the file to be checked */ 680 680 int acc /* Desired access type (0:Read, 1:Write, 2:Delete/Rename) */ 681 681 ) … … 684 684 685 685 /* Search file semaphore table */ 686 for (i = be = 0; i < _FS_LOCK; i++) {686 for (i = be = 0; i < FF_FS_LOCK; i++) { 687 687 if (Files[i].fs) { /* Existing entry */ 688 688 if (Files[i].fs == dp->fs && /* Check if the object matched with an open object */ … … 693 693 } 694 694 } 695 if (i == _FS_LOCK) /* The object is not opened */695 if (i == FF_FS_LOCK) /* The object is not opened */ 696 696 return (be || acc == 2) ? FR_OK : FR_TOO_MANY_OPEN_FILES; /* Is there a blank entry for new object? */ 697 697 … … 706 706 UINT i; 707 707 708 for (i = 0; i < _FS_LOCK && Files[i].fs; i++) ;709 return (i == _FS_LOCK) ? 0 : 1;708 for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ; 709 return (i == FF_FS_LOCK) ? 0 : 1; 710 710 } 711 711 … … 713 713 static 714 714 UINT inc_lock ( /* Increment object open counter and returns its index (0:Internal error) */ 715 DIR* dp, /* Directory object pointing the file to register or increment */715 FATFS_DIR* dp, /* Directory object pointing the file to register or increment */ 716 716 int acc /* Desired access (0:Read, 1:Write, 2:Delete/Rename) */ 717 717 ) … … 720 720 721 721 722 for (i = 0; i < _FS_LOCK; i++) { /* Find the object */722 for (i = 0; i < FF_FS_LOCK; i++) { /* Find the object */ 723 723 if (Files[i].fs == dp->fs && 724 724 Files[i].clu == dp->sclust && … … 726 726 } 727 727 728 if (i == _FS_LOCK) { /* Not opened. Register it as new. */729 for (i = 0; i < _FS_LOCK && Files[i].fs; i++) ;730 if (i == _FS_LOCK) return 0; /* No free entry to register (int err) */728 if (i == FF_FS_LOCK) { /* Not opened. Register it as new. */ 729 for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ; 730 if (i == FF_FS_LOCK) return 0; /* No free entry to register (int err) */ 731 731 Files[i].fs = dp->fs; 732 732 Files[i].clu = dp->sclust; … … 752 752 753 753 754 if (--i < _FS_LOCK) { /* Shift index number origin from 0 */754 if (--i < FF_FS_LOCK) { /* Shift index number origin from 0 */ 755 755 n = Files[i].ctr; 756 756 if (n == 0x100) n = 0; /* If write mode open, delete the entry */ … … 773 773 UINT i; 774 774 775 for (i = 0; i < _FS_LOCK; i++) {775 for (i = 0; i < FF_FS_LOCK; i++) { 776 776 if (Files[i].fs == fs) Files[i].fs = 0; 777 777 } … … 785 785 /* Move/Flush disk access window in the file system object */ 786 786 /*-----------------------------------------------------------------------*/ 787 #if ! _FS_READONLY787 #if !FF_FS_READONLY 788 788 static 789 789 FRESULT sync_window ( /* FR_OK:succeeded, !=0:error */ … … 825 825 826 826 if (sector != fs->winsect) { /* Window offset changed? */ 827 #if ! _FS_READONLY827 #if !FF_FS_READONLY 828 828 res = sync_window(fs); /* Write-back changes */ 829 829 #endif … … 845 845 /* Synchronize file system and strage device */ 846 846 /*-----------------------------------------------------------------------*/ 847 #if ! _FS_READONLY847 #if !FF_FS_READONLY 848 848 static 849 849 FRESULT sync_fs ( /* FR_OK:succeeded, !=0:error */ … … 959 959 /* Hidden API for hacks and disk tools */ 960 960 961 #if ! _FS_READONLY961 #if !FF_FS_READONLY 962 962 FRESULT put_fat ( /* FR_OK(0):succeeded, !=0:error */ 963 963 FATFS* fs, /* File system object */ … … 1014 1014 return res; 1015 1015 } 1016 #endif /* ! _FS_READONLY */1016 #endif /* !FF_FS_READONLY */ 1017 1017 1018 1018 … … 1022 1022 /* FAT handling - Remove a cluster chain */ 1023 1023 /*-----------------------------------------------------------------------*/ 1024 #if ! _FS_READONLY1024 #if !FF_FS_READONLY 1025 1025 static 1026 1026 FRESULT remove_chain ( /* FR_OK(0):succeeded, !=0:error */ … … 1031 1031 FRESULT res; 1032 1032 DWORD nxt; 1033 #if _USE_TRIM1033 #if FF_USE_TRIM 1034 1034 DWORD scl = clst, ecl = clst, rt[2]; 1035 1035 #endif … … 1051 1051 fs->fsi_flag |= 1; 1052 1052 } 1053 #if _USE_TRIM1053 #if FF_USE_TRIM 1054 1054 if (ecl + 1 == nxt) { /* Is next cluster contiguous? */ 1055 1055 ecl = nxt; … … 1075 1075 /* FAT handling - Stretch or Create a cluster chain */ 1076 1076 /*-----------------------------------------------------------------------*/ 1077 #if ! _FS_READONLY1077 #if !FF_FS_READONLY 1078 1078 static 1079 1079 DWORD create_chain ( /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk error, >=2:New cluster# */ … … 1128 1128 return ncl; /* Return new cluster number or error code */ 1129 1129 } 1130 #endif /* ! _FS_READONLY */1130 #endif /* !FF_FS_READONLY */ 1131 1131 1132 1132 … … 1137 1137 /*-----------------------------------------------------------------------*/ 1138 1138 1139 #if _USE_FASTSEEK1139 #if FF_USE_FASTSEEK 1140 1140 static 1141 1141 DWORD clmt_clust ( /* <2:Error, >=2:Cluster number */ … … 1157 1157 return cl + *tbl; /* Return the cluster number */ 1158 1158 } 1159 #endif /* _USE_FASTSEEK */1159 #endif /* FF_USE_FASTSEEK */ 1160 1160 1161 1161 … … 1168 1168 static 1169 1169 FRESULT dir_sdi ( /* FR_OK(0):succeeded, !=0:error */ 1170 DIR* dp, /* Pointer to directory object */1170 FATFS_DIR* dp, /* Pointer to directory object */ 1171 1171 UINT idx /* Index of directory table */ 1172 1172 ) … … 1216 1216 static 1217 1217 FRESULT dir_next ( /* FR_OK(0):succeeded, FR_NO_FILE:End of table, FR_DENIED:Could not stretch */ 1218 DIR* dp, /* Pointer to the directory object */1218 FATFS_DIR* dp, /* Pointer to the directory object */ 1219 1219 int stretch /* 0: Do not stretch table, 1: Stretch table if needed */ 1220 1220 ) … … 1222 1222 DWORD clst; 1223 1223 UINT i; 1224 #if ! _FS_READONLY1224 #if !FF_FS_READONLY 1225 1225 UINT c; 1226 1226 #endif … … 1244 1244 if (clst == 0xFFFFFFFF) return FR_DISK_ERR; 1245 1245 if (clst >= dp->fs->n_fatent) { /* If it reached end of dynamic table, */ 1246 #if ! _FS_READONLY1246 #if !FF_FS_READONLY 1247 1247 if (!stretch) return FR_NO_FILE; /* If do not stretch, report EOT */ 1248 1248 clst = create_chain(dp->fs, dp->clust); /* Stretch cluster chain */ … … 1284 1284 /*-----------------------------------------------------------------------*/ 1285 1285 1286 #if ! _FS_READONLY1286 #if !FF_FS_READONLY 1287 1287 static 1288 1288 FRESULT dir_alloc ( /* FR_OK(0):succeeded, !=0:error */ 1289 DIR* dp, /* Pointer to the directory object */1289 FATFS_DIR* dp, /* Pointer to the directory object */ 1290 1290 UINT nent /* Number of contiguous entries to allocate (1-21) */ 1291 1291 ) … … 1337 1337 1338 1338 1339 #if ! _FS_READONLY1339 #if !FF_FS_READONLY 1340 1340 static 1341 1341 void st_clust ( … … 1355 1355 /* LFN handling - Test/Pick/Fit an LFN segment from/to directory entry */ 1356 1356 /*-----------------------------------------------------------------------*/ 1357 #if _USE_LFN1357 #if FF_USE_LFN 1358 1358 static 1359 1359 const BYTE LfnOfs[] = {1,3,5,7,9,14,16,18,20,22,24,28,30}; /* Offset of LFN characters in the directory entry */ … … 1377 1377 uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */ 1378 1378 if (wc) { 1379 if (i >= _MAX_LFN || ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++])) /* Compare it */1379 if (i >= FF_MAX_LFN || ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++])) /* Compare it */ 1380 1380 return 0; /* Not matched */ 1381 1381 wc = uc; … … 1410 1410 uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */ 1411 1411 if (wc) { 1412 if (i >= _MAX_LFN) return 0; /* Buffer overflow? */1412 if (i >= FF_MAX_LFN) return 0; /* Buffer overflow? */ 1413 1413 lfnbuf[i++] = wc = uc; /* Store it */ 1414 1414 } else { … … 1418 1418 1419 1419 if (dir[LDIR_Ord] & LLEF) { /* Put terminator if it is the last LFN part */ 1420 if (i >= _MAX_LFN) return 0; /* Buffer overflow? */1420 if (i >= FF_MAX_LFN) return 0; /* Buffer overflow? */ 1421 1421 lfnbuf[i] = 0; 1422 1422 } … … 1426 1426 1427 1427 1428 #if ! _FS_READONLY1428 #if !FF_FS_READONLY 1429 1429 static 1430 1430 void fit_lfn ( … … 1464 1464 /* Create numbered name */ 1465 1465 /*-----------------------------------------------------------------------*/ 1466 #if _USE_LFN1466 #if FF_USE_LFN 1467 1467 static 1468 1468 void gen_numname ( … … 1523 1523 /* Calculate checksum of an SFN entry */ 1524 1524 /*-----------------------------------------------------------------------*/ 1525 #if _USE_LFN1525 #if FF_USE_LFN 1526 1526 static 1527 1527 BYTE sum_sfn ( … … 1546 1546 static 1547 1547 FRESULT dir_find ( /* FR_OK(0):succeeded, !=0:error */ 1548 DIR* dp /* Pointer to the directory object linked to the file name */1548 FATFS_DIR* dp /* Pointer to the directory object linked to the file name */ 1549 1549 ) 1550 1550 { 1551 1551 FRESULT res; 1552 1552 BYTE c, *dir; 1553 #if _USE_LFN1553 #if FF_USE_LFN 1554 1554 BYTE a, ord, sum; 1555 1555 #endif … … 1558 1558 if (res != FR_OK) return res; 1559 1559 1560 #if _USE_LFN1560 #if FF_USE_LFN 1561 1561 ord = sum = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */ 1562 1562 #endif … … 1567 1567 c = dir[DIR_Name]; 1568 1568 if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */ 1569 #if _USE_LFN /* LFN configuration */1569 #if FF_USE_LFN /* LFN configuration */ 1570 1570 a = dir[DIR_Attr] & AM_MASK; 1571 1571 if (c == DDEM || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */ … … 1604 1604 /* Read an object from the directory */ 1605 1605 /*-----------------------------------------------------------------------*/ 1606 #if _FS_MINIMIZE <= 1 || _USE_LABEL ||_FS_RPATH >= 21606 #if FF_FS_MINIMIZE <= 1 || FF_USE_LABEL || FF_FS_RPATH >= 2 1607 1607 static 1608 1608 FRESULT dir_read ( 1609 DIR* dp, /* Pointer to the directory object */1609 FATFS_DIR* dp, /* Pointer to the directory object */ 1610 1610 int vol /* Filtered by 0:file/directory or 1:volume label */ 1611 1611 ) … … 1613 1613 FRESULT res; 1614 1614 BYTE a, c, *dir; 1615 #if _USE_LFN1615 #if FF_USE_LFN 1616 1616 BYTE ord = 0xFF, sum = 0xFF; 1617 1617 #endif … … 1625 1625 if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */ 1626 1626 a = dir[DIR_Attr] & AM_MASK; 1627 #if _USE_LFN /* LFN configuration */1628 if (c == DDEM || (! _FS_RPATH && c == '.') || (int)((a & ~AM_ARC) == AM_VOL) != vol) { /* An entry without valid data */1627 #if FF_USE_LFN /* LFN configuration */ 1628 if (c == DDEM || (!FF_FS_RPATH && c == '.') || (int)((a & ~AM_ARC) == AM_VOL) != vol) { /* An entry without valid data */ 1629 1629 ord = 0xFF; 1630 1630 } else { … … 1644 1644 } 1645 1645 #else /* Non LFN configuration */ 1646 if (c != DDEM && ( _FS_RPATH || c != '.') && a != AM_LFN && (int)((a & ~AM_ARC) == AM_VOL) == vol) /* Is it a valid entry? */1646 if (c != DDEM && (FF_FS_RPATH || c != '.') && a != AM_LFN && (int)((a & ~AM_ARC) == AM_VOL) == vol) /* Is it a valid entry? */ 1647 1647 break; 1648 1648 #endif … … 1655 1655 return res; 1656 1656 } 1657 #endif /* _FS_MINIMIZE <= 1 || _USE_LABEL ||_FS_RPATH >= 2 */1657 #endif /* FF_FS_MINIMIZE <= 1 || FF_USE_LABEL || FF_FS_RPATH >= 2 */ 1658 1658 1659 1659 … … 1663 1663 /* Register an object to the directory */ 1664 1664 /*-----------------------------------------------------------------------*/ 1665 #if ! _FS_READONLY1665 #if !FF_FS_READONLY 1666 1666 static 1667 1667 FRESULT dir_register ( /* FR_OK:succeeded, FR_DENIED:no free entry or too many SFN collision, FR_DISK_ERR:disk error */ 1668 DIR* dp /* Target directory with object name to be created */1668 FATFS_DIR* dp /* Target directory with object name to be created */ 1669 1669 ) 1670 1670 { 1671 1671 FRESULT res; 1672 #if _USE_LFN /* LFN configuration */1672 #if FF_USE_LFN /* LFN configuration */ 1673 1673 UINT n, nent; 1674 1674 BYTE sn[12], *fn, sum; … … 1679 1679 mem_cpy(sn, fn, 12); 1680 1680 1681 if ( _FS_RPATH && (sn[NSFLAG] & NS_DOT)) /* Cannot create dot entry */1681 if (FF_FS_RPATH && (sn[NSFLAG] & NS_DOT)) /* Cannot create dot entry */ 1682 1682 return FR_INVALID_NAME; 1683 1683 … … 1724 1724 mem_set(dp->dir, 0, SZ_DIRE); /* Clean the entry */ 1725 1725 mem_cpy(dp->dir, dp->fn, 11); /* Put SFN */ 1726 #if _USE_LFN1726 #if FF_USE_LFN 1727 1727 dp->dir[DIR_NTres] = dp->fn[NSFLAG] & (NS_BODY | NS_EXT); /* Put NT flag */ 1728 1728 #endif … … 1733 1733 return res; 1734 1734 } 1735 #endif /* ! _FS_READONLY */1735 #endif /* !FF_FS_READONLY */ 1736 1736 1737 1737 … … 1741 1741 /* Remove an object from the directory */ 1742 1742 /*-----------------------------------------------------------------------*/ 1743 #if ! _FS_READONLY && !_FS_MINIMIZE1743 #if !FF_FS_READONLY && !FF_FS_MINIMIZE 1744 1744 static 1745 1745 FRESULT dir_remove ( /* FR_OK:Succeeded, FR_DISK_ERR:A disk error */ 1746 DIR* dp /* Directory object pointing the entry to be removed */1746 FATFS_DIR* dp /* Directory object pointing the entry to be removed */ 1747 1747 ) 1748 1748 { 1749 1749 FRESULT res; 1750 #if _USE_LFN /* LFN configuration */1750 #if FF_USE_LFN /* LFN configuration */ 1751 1751 UINT i; 1752 1752 … … 1780 1780 return res; 1781 1781 } 1782 #endif /* ! _FS_READONLY */1782 #endif /* !FF_FS_READONLY */ 1783 1783 1784 1784 … … 1788 1788 /* Get file information from directory entry */ 1789 1789 /*-----------------------------------------------------------------------*/ 1790 #if _FS_MINIMIZE <= 1 ||_FS_RPATH >= 21790 #if FF_FS_MINIMIZE <= 1 || FF_FS_RPATH >= 2 1791 1791 static 1792 1792 void get_fileinfo ( /* No return code */ 1793 DIR* dp, /* Pointer to the directory object */1793 FATFS_DIR* dp, /* Pointer to the directory object */ 1794 1794 FILINFO* fno /* Pointer to the file information to be filled */ 1795 1795 ) … … 1798 1798 TCHAR *p, c; 1799 1799 BYTE *dir; 1800 #if _USE_LFN1800 #if FF_USE_LFN 1801 1801 WCHAR w, *lfn; 1802 1802 #endif 1803 #if _CODE_PAGE == 650011803 #if FF_CODE_PAGE == 65001 1804 1804 unsigned char utf8_code[6]; 1805 1805 int code_size; … … 1815 1815 if (c == RDDEM) c = (TCHAR)DDEM; /* Restore replaced DDEM character */ 1816 1816 if (i == 9) *p++ = '.'; /* Insert a . if extension is exist */ 1817 #if _USE_LFN1817 #if FF_USE_LFN 1818 1818 if (IsUpper(c) && (dir[DIR_NTres] & (i >= 9 ? NS_EXT : NS_BODY))) 1819 1819 c += 0x20; /* To lower */ 1820 #if _LFN_UNICODE1820 #if FF_LFN_UNICODE 1821 1821 if (IsDBCS1(c) && i != 8 && i != 11 && IsDBCS2(dir[i])) 1822 1822 c = c << 8 | dir[i++]; … … 1834 1834 *p = 0; /* Terminate SFN string by a \0 */ 1835 1835 1836 #if _USE_LFN1836 #if FF_USE_LFN 1837 1837 if (fno->lfname) { 1838 1838 i = 0; p = fno->lfname; … … 1840 1840 lfn = dp->lfn; 1841 1841 while ((w = *lfn++) != 0) { /* Get an LFN character */ 1842 #if ! _LFN_UNICODE1843 #if _CODE_PAGE == 650011842 #if !FF_LFN_UNICODE 1843 #if FF_CODE_PAGE == 65001 1844 1844 Utf16_to_Utf8(utf8_code, &code_size, w); 1845 1845 for (int j = 0; j < code_size - 1; j++) { … … 1862 1862 #endif 1863 1863 } 1864 #endif /* _FS_MINIMIZE <= 1 ||_FS_RPATH >= 2 */1864 #endif /* FF_FS_MINIMIZE <= 1 || FF_FS_RPATH >= 2 */ 1865 1865 1866 1866 … … 1870 1870 /* Pattern matching */ 1871 1871 /*-----------------------------------------------------------------------*/ 1872 #if _USE_FIND &&_FS_MINIMIZE <= 11872 #if FF_USE_FIND && FF_FS_MINIMIZE <= 1 1873 1873 static 1874 1874 WCHAR get_achar ( /* Get a character and advances ptr 1 or 2 */ … … 1878 1878 WCHAR chr; 1879 1879 1880 #if ! _LFN_UNICODE1881 #if _CODE_PAGE == 650011880 #if !FF_LFN_UNICODE 1881 #if FF_CODE_PAGE == 65001 1882 1882 int code_size; 1883 1883 chr = Utf8_to_Utf16(*ptr, &code_size); … … 1938 1938 return 0; 1939 1939 } 1940 #endif /* _USE_FIND &&_FS_MINIMIZE <= 1 */1940 #endif /* FF_USE_FIND && FF_FS_MINIMIZE <= 1 */ 1941 1941 1942 1942 … … 1949 1949 static 1950 1950 FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not create */ 1951 DIR* dp, /* Pointer to the directory object */1951 FATFS_DIR* dp, /* Pointer to the directory object */ 1952 1952 const TCHAR** path /* Pointer to pointer to the segment in the path string */ 1953 1953 ) 1954 1954 { 1955 #if _USE_LFN /* LFN configuration */1955 #if FF_USE_LFN /* LFN configuration */ 1956 1956 BYTE b, cf; 1957 1957 WCHAR w, *lfn; 1958 1958 UINT i, ni, si, di; 1959 1959 const TCHAR *p; 1960 #if _CODE_PAGE == 650011960 #if FF_CODE_PAGE == 65001 1961 1961 unsigned char utf8_code[6]; 1962 1962 int code_size; … … 1969 1969 w = p[si++]; /* Get a character */ 1970 1970 if (w < ' ' || w == '/' || w == '\\') break; /* Break on end of segment */ 1971 if (di >= _MAX_LFN) /* Reject too long name */1971 if (di >= FF_MAX_LFN) /* Reject too long name */ 1972 1972 return FR_INVALID_NAME; 1973 #if ! _LFN_UNICODE1974 #if _CODE_PAGE == 650011973 #if !FF_LFN_UNICODE 1974 #if FF_CODE_PAGE == 65001 1975 1975 w = Utf8_to_Utf16(&p[si - 1], &code_size); 1976 1976 si += code_size - 1; … … 1993 1993 *path = &p[si]; /* Return pointer to the next segment */ 1994 1994 cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ 1995 #if _FS_RPATH1995 #if FF_FS_RPATH 1996 1996 if ((di == 1 && lfn[di - 1] == '.') || 1997 1997 (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) { /* Is this segment a dot entry? */ … … 2040 2040 if (w) w = ExCvt[w - 0x80]; /* Convert extended character to upper (SBCS) */ 2041 2041 #else 2042 #if _CODE_PAGE == 650012042 #if FF_CODE_PAGE == 65001 2043 2043 Utf16_to_Utf8(utf8_code, &code_size, ff_wtoupper(w)); 2044 2044 #else … … 2048 2048 cf |= NS_LFN; /* Force create LFN entry */ 2049 2049 } 2050 #if _CODE_PAGE == 650012050 #if FF_CODE_PAGE == 65001 2051 2051 else 2052 2052 code_size = 1; 2053 2053 #endif 2054 2054 2055 #if _CODE_PAGE == 650012055 #if FF_CODE_PAGE == 65001 2056 2056 if (code_size > 1) { /* Is this DBC? (always false at SBCS cfg) */ 2057 2057 if (i >= ni - 1) { … … 2126 2126 mem_set(sfn, ' ', 11); 2127 2127 si = i = b = 0; ni = 8; 2128 #if _FS_RPATH2128 #if FF_FS_RPATH 2129 2129 if (p[si] == '.') { /* Is this a dot entry? */ 2130 2130 for (;;) { … … 2201 2201 static 2202 2202 FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */ 2203 DIR* dp, /* Directory object to return last directory and found object */2203 FATFS_DIR* dp, /* Directory object to return last directory and found object */ 2204 2204 const TCHAR* path /* Full-path string to find a file or directory */ 2205 2205 ) … … 2209 2209 2210 2210 2211 #if _FS_RPATH2211 #if FF_FS_RPATH 2212 2212 if (*path == '/' || *path == '\\') { /* There is a heading separator */ 2213 2213 path++; dp->sclust = 0; /* Strip it and start from the root directory */ … … 2232 2232 if (res != FR_OK) { /* Failed to find the object */ 2233 2233 if (res == FR_NO_FILE) { /* Object is not found */ 2234 if ( _FS_RPATH && (ns & NS_DOT)) { /* If dot entry is not exist, */2234 if (FF_FS_RPATH && (ns & NS_DOT)) { /* If dot entry is not exist, */ 2235 2235 dp->sclust = 0; dp->dir = 0; /* it is the root directory and stay there */ 2236 2236 if (!(ns & NS_LAST)) continue; /* Continue to follow if not last segment */ … … 2269 2269 UINT i; 2270 2270 int vol = -1; 2271 #if _STR_VOLUME_ID /* Find string drive id */2272 static const char* const str[] = { _VOLUME_STRS};2271 #if FF_STR_VOLUME_ID /* Find string drive id */ 2272 static const char* const str[] = {FF_VOLUME_STRS}; 2273 2273 const char *sp; 2274 2274 char c; … … 2278 2278 2279 2279 if (*path) { /* If the pointer is not a null */ 2280 for (tt = *path; (UINT)*tt >= ( _USE_LFN ? ' ' : '!') && *tt != ':'; tt++) ; /* Find ':' in the path */2280 for (tt = *path; (UINT)*tt >= (FF_USE_LFN ? ' ' : '!') && *tt != ':'; tt++) ; /* Find ':' in the path */ 2281 2281 if (*tt == ':') { /* If a ':' is exist in the path name */ 2282 2282 tp = *path; 2283 2283 i = *tp++ - '0'; 2284 2284 if (i < 10 && tp == tt) { /* Is there a numeric drive id? */ 2285 if (i < _VOLUMES) { /* If a drive id is found, get the value and strip it */2285 if (i < FF_VOLUMES) { /* If a drive id is found, get the value and strip it */ 2286 2286 vol = (int)i; 2287 2287 *path = ++tt; 2288 2288 } 2289 2289 } 2290 #if _STR_VOLUME_ID2290 #if FF_STR_VOLUME_ID 2291 2291 else { /* No numeric drive number, find string drive id */ 2292 2292 i = 0; tt++; … … 2297 2297 if (IsLower(tc)) tc -= 0x20; 2298 2298 } while (c && (TCHAR)c == tc); 2299 } while ((c || tp != tt) && ++i < _VOLUMES); /* Repeat for each id until pattern match */2300 if (i < _VOLUMES) { /* If a drive id is found, get the value and strip it */2299 } while ((c || tp != tt) && ++i < FF_VOLUMES); /* Repeat for each id until pattern match */ 2300 if (i < FF_VOLUMES) { /* If a drive id is found, get the value and strip it */ 2301 2301 vol = (int)i; 2302 2302 *path = tt; … … 2306 2306 return vol; 2307 2307 } 2308 #if _FS_RPATH &&_VOLUMES >= 22308 #if FF_FS_RPATH && FF_VOLUMES >= 2 2309 2309 vol = CurrVol; /* Current drive */ 2310 2310 #else … … 2381 2381 stat = disk_status(fs->drv); 2382 2382 if (!(stat & STA_NOINIT)) { /* and the physical drive is kept initialized */ 2383 if (! _FS_READONLY && wmode && (stat & STA_PROTECT)) /* Check write protection if needed */2383 if (!FF_FS_READONLY && wmode && (stat & STA_PROTECT)) /* Check write protection if needed */ 2384 2384 return FR_WRITE_PROTECTED; 2385 2385 return FR_OK; /* The file system object is valid */ … … 2395 2395 if (stat & STA_NOINIT) /* Check if the initialization succeeded */ 2396 2396 return FR_NOT_READY; /* Failed to initialize due to no medium or hard error */ 2397 if (! _FS_READONLY && wmode && (stat & STA_PROTECT)) /* Check disk write protection if needed */2397 if (!FF_FS_READONLY && wmode && (stat & STA_PROTECT)) /* Check disk write protection if needed */ 2398 2398 return FR_WRITE_PROTECTED; 2399 #if _MAX_SS !=_MIN_SS /* Get sector size (multiple sector size cfg only) */2399 #if FF_MAX_SS != FF_MIN_SS /* Get sector size (multiple sector size cfg only) */ 2400 2400 if (disk_ioctl(fs->drv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK 2401 || SS(fs) < _MIN_SS || SS(fs) >_MAX_SS) return FR_DISK_ERR;2401 || SS(fs) < FF_MIN_SS || SS(fs) > FF_MAX_SS) return FR_DISK_ERR; 2402 2402 #endif 2403 2403 /* Find an FAT partition on the drive. Supports only generic partitioning, FDISK and SFD. */ … … 2448 2448 2449 2449 /* Determine the FAT sub type */ 2450 sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZ_DIRE); /* RSV + FAT + DIR */2450 sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZ_DIRE); /* RSV + FAT + FATFS_DIR */ 2451 2451 if (tsect < sysect) return FR_NO_FILESYSTEM; /* (Invalid volume size) */ 2452 2452 nclst = (tsect - sysect) / fs->csize; /* Number of clusters */ … … 2474 2474 return FR_NO_FILESYSTEM; 2475 2475 2476 #if ! _FS_READONLY2476 #if !FF_FS_READONLY 2477 2477 /* Initialize cluster allocation information */ 2478 2478 fs->last_clust = fs->free_clust = 0xFFFFFFFF; … … 2480 2480 /* Get fsinfo if available */ 2481 2481 fs->fsi_flag = 0x80; 2482 #if ( _FS_NOFSINFO & 3) != 32482 #if (FF_FS_NOFSINFO & 3) != 3 2483 2483 if (fmt == FS_FAT32 /* Enable FSINFO only if FAT32 and BPB_FSInfo == 1 */ 2484 2484 && LD_WORD(fs->win + BPB_FSInfo) == 1 … … 2490 2490 && LD_DWORD(fs->win + FSI_StrucSig) == 0x61417272) 2491 2491 { 2492 #if ( _FS_NOFSINFO & 1) == 02492 #if (FF_FS_NOFSINFO & 1) == 0 2493 2493 fs->free_clust = LD_DWORD(fs->win + FSI_Free_Count); 2494 2494 #endif 2495 #if ( _FS_NOFSINFO & 2) == 02495 #if (FF_FS_NOFSINFO & 2) == 0 2496 2496 fs->last_clust = LD_DWORD(fs->win + FSI_Nxt_Free); 2497 2497 #endif … … 2502 2502 fs->fs_type = fmt; /* FAT sub-type */ 2503 2503 fs->id = ++Fsid; /* File system mount ID */ 2504 #if _FS_RPATH2504 #if FF_FS_RPATH 2505 2505 fs->cdir = 0; /* Set current directory to root */ 2506 2506 #endif 2507 #if _FS_LOCK/* Clear file lock semaphores */2507 #if FF_FS_LOCK != 0 /* Clear file lock semaphores */ 2508 2508 clear_lock(fs); 2509 2509 #endif … … 2521 2521 static 2522 2522 FRESULT validate ( /* FR_OK(0): The object is valid, !=0: Invalid */ 2523 void* obj /* Pointer to the object FIL/ DIR to check validity */2524 ) 2525 { 2526 FIL *fil = (FIL*)obj; /* Assuming offset of .fs and .id in the FIL/ DIR structure is identical */2523 void* obj /* Pointer to the object FIL/FATFS_DIR to check validity */ 2524 ) 2525 { 2526 FIL *fil = (FIL*)obj; /* Assuming offset of .fs and .id in the FIL/FATFS_DIR structure is identical */ 2527 2527 2528 2528 … … 2567 2567 2568 2568 if (cfs) { 2569 #if _FS_LOCK2569 #if FF_FS_LOCK != 0 2570 2570 clear_lock(cfs); 2571 2571 #endif 2572 #if _FS_REENTRANT /* Discard sync object of the current volume */2572 #if FF_FS_REENTRANT /* Discard sync object of the current volume */ 2573 2573 if (!ff_del_syncobj(cfs->sobj)) return FR_INT_ERR; 2574 2574 #endif … … 2578 2578 if (fs) { 2579 2579 fs->fs_type = 0; /* Clear new fs object */ 2580 #if _FS_REENTRANT /* Create sync object for the new volume */2580 #if FF_FS_REENTRANT /* Create sync object for the new volume */ 2581 2581 if (!ff_cre_syncobj((BYTE)vol, &fs->sobj)) return FR_INT_ERR; 2582 2582 #endif … … 2604 2604 { 2605 2605 FRESULT res; 2606 DIR dj;2606 FATFS_DIR dj; 2607 2607 BYTE *dir; 2608 2608 DEFINE_NAMEBUF; 2609 #if ! _FS_READONLY2609 #if !FF_FS_READONLY 2610 2610 DWORD dw, cl; 2611 2611 #endif … … 2616 2616 2617 2617 /* Get logical drive number */ 2618 #if ! _FS_READONLY2619 mode &= FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW ;2618 #if !FF_FS_READONLY 2619 mode &= FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW | FA_OPEN_APPEND; 2620 2620 res = find_volume(&dj.fs, &path, (BYTE)(mode & ~FA_READ)); 2621 2621 #else … … 2627 2627 res = follow_path(&dj, path); /* Follow the file path */ 2628 2628 dir = dj.dir; 2629 #if ! _FS_READONLY /* R/W configuration */2629 #if !FF_FS_READONLY /* R/W configuration */ 2630 2630 if (res == FR_OK) { 2631 2631 if (!dir) /* Default directory itself */ 2632 2632 res = FR_INVALID_NAME; 2633 #if _FS_LOCK2633 #if FF_FS_LOCK != 0 2634 2634 else 2635 2635 res = chk_lock(&dj, (mode & ~FA_READ) ? 1 : 0); … … 2640 2640 if (res != FR_OK) { /* No file, create new */ 2641 2641 if (res == FR_NO_FILE) /* There is no file to open, create a new entry */ 2642 #if _FS_LOCK2642 #if FF_FS_LOCK != 0 2643 2643 res = enq_lock() ? dir_register(&dj) : FR_TOO_MANY_OPEN_FILES; 2644 2644 #else … … 2649 2649 } 2650 2650 else { /* Any object is already existing */ 2651 if (dir[DIR_Attr] & (AM_RDO | AM_DIR)) { /* Cannot overwrite it (R/O or DIR) */2651 if (dir[DIR_Attr] & (AM_RDO | AM_DIR)) { /* Cannot overwrite it (R/O or FATFS_DIR) */ 2652 2652 res = FR_DENIED; 2653 2653 } else { … … 2687 2687 if (res == FR_OK) { 2688 2688 if (mode & FA_CREATE_ALWAYS) /* Set file change flag if created or overwritten */ 2689 mode |= FA_ _WRITTEN;2689 mode |= FA_MODIFIED; 2690 2690 fp->dir_sect = dj.fs->winsect; /* Pointer to the directory entry */ 2691 2691 fp->dir_ptr = dir; 2692 #if _FS_LOCK2692 #if FF_FS_LOCK != 0 2693 2693 fp->lockid = inc_lock(&dj, (mode & ~FA_READ) ? 1 : 0); 2694 2694 if (!fp->lockid) res = FR_INT_ERR; … … 2716 2716 fp->fptr = 0; /* File pointer */ 2717 2717 fp->dsect = 0; 2718 #if _USE_FASTSEEK2718 #if FF_USE_FASTSEEK 2719 2719 fp->cltbl = 0; /* Normal seek mode */ 2720 2720 #endif … … 2766 2766 clst = fp->sclust; /* Follow from the origin */ 2767 2767 } else { /* Middle or end of the file */ 2768 #if _USE_FASTSEEK2768 #if FF_USE_FASTSEEK 2769 2769 if (fp->cltbl) 2770 2770 clst = clmt_clust(fp, fp->fptr); /* Get cluster# from the CLMT */ … … 2786 2786 if (disk_read(fp->fs->drv, rbuff, sect, cc) != RES_OK) 2787 2787 ABORT(fp->fs, FR_DISK_ERR); 2788 #if ! _FS_READONLY &&_FS_MINIMIZE <= 2 /* Replace one of the read sectors with cached data if it contains a dirty sector */2789 #if _FS_TINY2788 #if !FF_FS_READONLY && FF_FS_MINIMIZE <= 2 /* Replace one of the read sectors with cached data if it contains a dirty sector */ 2789 #if FF_FS_TINY 2790 2790 if (fp->fs->wflag && fp->fs->winsect - sect < cc) 2791 2791 mem_cpy(rbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), fp->fs->win, SS(fp->fs)); 2792 2792 #else 2793 if ((fp->flag & FA_ _DIRTY) && fp->dsect - sect < cc)2793 if ((fp->flag & FA_DIRTY) && fp->dsect - sect < cc) 2794 2794 mem_cpy(rbuff + ((fp->dsect - sect) * SS(fp->fs)), fp->buf, SS(fp->fs)); 2795 2795 #endif … … 2798 2798 continue; 2799 2799 } 2800 #if ! _FS_TINY2800 #if !FF_FS_TINY 2801 2801 if (fp->dsect != sect) { /* Load data sector if not in cache */ 2802 #if ! _FS_READONLY2803 if (fp->flag & FA_ _DIRTY) { /* Write-back dirty sector cache */2802 #if !FF_FS_READONLY 2803 if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */ 2804 2804 if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK) 2805 2805 ABORT(fp->fs, FR_DISK_ERR); 2806 fp->flag &= ~FA_ _DIRTY;2806 fp->flag &= ~FA_DIRTY; 2807 2807 } 2808 2808 #endif … … 2815 2815 rcnt = SS(fp->fs) - ((UINT)fp->fptr % SS(fp->fs)); /* Get partial sector data from sector buffer */ 2816 2816 if (rcnt > btr) rcnt = btr; 2817 #if _FS_TINY2817 #if FF_FS_TINY 2818 2818 if (move_window(fp->fs, fp->dsect) != FR_OK) /* Move sector window */ 2819 2819 ABORT(fp->fs, FR_DISK_ERR); … … 2830 2830 2831 2831 2832 #if ! _FS_READONLY2832 #if !FF_FS_READONLY 2833 2833 /*-----------------------------------------------------------------------*/ 2834 2834 /* Write File */ … … 2869 2869 clst = create_chain(fp->fs, 0); /* Create a new cluster chain */ 2870 2870 } else { /* Middle or end of the file */ 2871 #if _USE_FASTSEEK2871 #if FF_USE_FASTSEEK 2872 2872 if (fp->cltbl) 2873 2873 clst = clmt_clust(fp, fp->fptr); /* Get cluster# from the CLMT */ … … 2882 2882 if (fp->sclust == 0) fp->sclust = clst; /* Set start cluster if the first write */ 2883 2883 } 2884 #if _FS_TINY2884 #if FF_FS_TINY 2885 2885 if (fp->fs->winsect == fp->dsect && sync_window(fp->fs)) /* Write-back sector cache */ 2886 2886 ABORT(fp->fs, FR_DISK_ERR); 2887 2887 #else 2888 if (fp->flag & FA_ _DIRTY) { /* Write-back sector cache */2888 if (fp->flag & FA_DIRTY) { /* Write-back sector cache */ 2889 2889 if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK) 2890 2890 ABORT(fp->fs, FR_DISK_ERR); 2891 fp->flag &= ~FA_ _DIRTY;2891 fp->flag &= ~FA_DIRTY; 2892 2892 } 2893 2893 #endif … … 2901 2901 if (disk_write(fp->fs->drv, wbuff, sect, cc) != RES_OK) 2902 2902 ABORT(fp->fs, FR_DISK_ERR); 2903 #if _FS_MINIMIZE <= 22904 #if _FS_TINY2903 #if FF_FS_MINIMIZE <= 2 2904 #if FF_FS_TINY 2905 2905 if (fp->fs->winsect - sect < cc) { /* Refill sector cache if it gets invalidated by the direct write */ 2906 2906 mem_cpy(fp->fs->win, wbuff + ((fp->fs->winsect - sect) * SS(fp->fs)), SS(fp->fs)); … … 2910 2910 if (fp->dsect - sect < cc) { /* Refill sector cache if it gets invalidated by the direct write */ 2911 2911 mem_cpy(fp->buf, wbuff + ((fp->dsect - sect) * SS(fp->fs)), SS(fp->fs)); 2912 fp->flag &= ~FA_ _DIRTY;2912 fp->flag &= ~FA_DIRTY; 2913 2913 } 2914 2914 #endif … … 2917 2917 continue; 2918 2918 } 2919 #if _FS_TINY2919 #if FF_FS_TINY 2920 2920 if (fp->fptr >= fp->fsize) { /* Avoid silly cache filling at growing edge */ 2921 2921 if (sync_window(fp->fs)) ABORT(fp->fs, FR_DISK_ERR); … … 2933 2933 wcnt = SS(fp->fs) - ((UINT)fp->fptr % SS(fp->fs));/* Put partial sector into file I/O buffer */ 2934 2934 if (wcnt > btw) wcnt = btw; 2935 #if _FS_TINY2935 #if FF_FS_TINY 2936 2936 if (move_window(fp->fs, fp->dsect) != FR_OK) /* Move sector window */ 2937 2937 ABORT(fp->fs, FR_DISK_ERR); … … 2940 2940 #else 2941 2941 mem_cpy(&fp->buf[fp->fptr % SS(fp->fs)], wbuff, wcnt); /* Fit partial sector */ 2942 fp->flag |= FA_ _DIRTY;2942 fp->flag |= FA_DIRTY; 2943 2943 #endif 2944 2944 } 2945 2945 2946 2946 if (fp->fptr > fp->fsize) fp->fsize = fp->fptr; /* Update file size if needed */ 2947 fp->flag |= FA_ _WRITTEN; /* Set file change flag */2947 fp->flag |= FA_MODIFIED; /* Set file change flag */ 2948 2948 2949 2949 LEAVE_FF(fp->fs, FR_OK); … … 2968 2968 res = validate(fp); /* Check validity of the object */ 2969 2969 if (res == FR_OK) { 2970 if (fp->flag & FA_ _WRITTEN) { /* Is there any change to the file? */2971 #if ! _FS_TINY2972 if (fp->flag & FA_ _DIRTY) { /* Write-back cached data if needed */2970 if (fp->flag & FA_MODIFIED) { /* Is there any change to the file? */ 2971 #if !FF_FS_TINY 2972 if (fp->flag & FA_DIRTY) { /* Write-back cached data if needed */ 2973 2973 if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK) 2974 2974 LEAVE_FF(fp->fs, FR_DISK_ERR); 2975 fp->flag &= ~FA_ _DIRTY;2975 fp->flag &= ~FA_DIRTY; 2976 2976 } 2977 2977 #endif … … 2986 2986 ST_DWORD(dir + DIR_WrtTime, tm); 2987 2987 ST_WORD(dir + DIR_LstAccDate, 0); 2988 fp->flag &= ~FA_ _WRITTEN;2988 fp->flag &= ~FA_MODIFIED; 2989 2989 fp->fs->wflag = 1; 2990 2990 res = sync_fs(fp->fs); … … 2996 2996 } 2997 2997 2998 #endif /* ! _FS_READONLY */2998 #endif /* !FF_FS_READONLY */ 2999 2999 3000 3000 … … 3012 3012 3013 3013 3014 #if ! _FS_READONLY3014 #if !FF_FS_READONLY 3015 3015 res = f_sync(fp); /* Flush cached data */ 3016 3016 if (res == FR_OK) … … 3019 3019 res = validate(fp); /* Lock volume */ 3020 3020 if (res == FR_OK) { 3021 #if _FS_REENTRANT3021 #if FF_FS_REENTRANT 3022 3022 FATFS *fs = fp->fs; 3023 3023 #endif 3024 #if _FS_LOCK3024 #if FF_FS_LOCK != 0 3025 3025 res = dec_lock(fp->lockid); /* Decrement file open counter */ 3026 3026 if (res == FR_OK) 3027 3027 #endif 3028 3028 fp->fs = 0; /* Invalidate file object */ 3029 #if _FS_REENTRANT3029 #if FF_FS_REENTRANT 3030 3030 unlock_fs(fs, FR_OK); /* Unlock volume */ 3031 3031 #endif … … 3042 3042 /*-----------------------------------------------------------------------*/ 3043 3043 3044 #if _FS_RPATH >= 13045 #if _VOLUMES >= 23044 #if FF_FS_RPATH >= 1 3045 #if FF_VOLUMES >= 2 3046 3046 FRESULT f_chdrive ( 3047 3047 const TCHAR* path /* Drive number */ … … 3066 3066 { 3067 3067 FRESULT res; 3068 DIR dj;3068 FATFS_DIR dj; 3069 3069 DEFINE_NAMEBUF; 3070 3070 … … 3093 3093 3094 3094 3095 #if _FS_RPATH >= 23095 #if FF_FS_RPATH >= 2 3096 3096 FRESULT f_getcwd ( 3097 3097 TCHAR* buff, /* Pointer to the directory path */ … … 3100 3100 { 3101 3101 FRESULT res; 3102 DIR dj;3102 FATFS_DIR dj; 3103 3103 UINT i, n; 3104 3104 DWORD ccl; … … 3131 3131 if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */ 3132 3132 if (res != FR_OK) break; 3133 #if _USE_LFN3133 #if FF_USE_LFN 3134 3134 fno.lfname = buff; 3135 3135 fno.lfsize = i; … … 3137 3137 get_fileinfo(&dj, &fno); /* Get the directory name and push it to the buffer */ 3138 3138 tp = fno.fname; 3139 #if _USE_LFN3139 #if FF_USE_LFN 3140 3140 if (*buff) tp = buff; 3141 3141 #endif … … 3149 3149 tp = buff; 3150 3150 if (res == FR_OK) { 3151 #if _VOLUMES >= 23151 #if FF_VOLUMES >= 2 3152 3152 *tp++ = '0' + CurrVol; /* Put drive number */ 3153 3153 *tp++ = ':'; … … 3167 3167 LEAVE_FF(dj.fs, res); 3168 3168 } 3169 #endif /* _FS_RPATH >= 2 */3170 #endif /* _FS_RPATH >= 1 */3171 3172 3173 3174 #if _FS_MINIMIZE <= 23169 #endif /* FF_FS_RPATH >= 2 */ 3170 #endif /* FF_FS_RPATH >= 1 */ 3171 3172 3173 3174 #if FF_FS_MINIMIZE <= 2 3175 3175 /*-----------------------------------------------------------------------*/ 3176 3176 /* Seek File R/W Pointer */ … … 3184 3184 FRESULT res; 3185 3185 DWORD clst, bcs, nsect, ifptr; 3186 #if _USE_FASTSEEK3186 #if FF_USE_FASTSEEK 3187 3187 DWORD cl, pcl, ncl, tcl, dsc, tlen, ulen, *tbl; 3188 3188 #endif … … 3194 3194 LEAVE_FF(fp->fs, (FRESULT)fp->err); 3195 3195 3196 #if _USE_FASTSEEK3196 #if FF_USE_FASTSEEK 3197 3197 if (fp->cltbl) { /* Fast seek */ 3198 3198 if (ofs == CREATE_LINKMAP) { /* Create CLMT */ … … 3231 3231 dsc += (ofs - 1) / SS(fp->fs) & (fp->fs->csize - 1); 3232 3232 if (fp->fptr % SS(fp->fs) && dsc != fp->dsect) { /* Refill sector cache if needed */ 3233 #if ! _FS_TINY3234 #if ! _FS_READONLY3235 if (fp->flag & FA_ _DIRTY) { /* Write-back dirty sector cache */3233 #if !FF_FS_TINY 3234 #if !FF_FS_READONLY 3235 if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */ 3236 3236 if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK) 3237 3237 ABORT(fp->fs, FR_DISK_ERR); 3238 fp->flag &= ~FA_ _DIRTY;3238 fp->flag &= ~FA_DIRTY; 3239 3239 } 3240 3240 #endif … … 3252 3252 { 3253 3253 if (ofs > fp->fsize /* In read-only mode, clip offset with the file size */ 3254 #if ! _FS_READONLY3254 #if !FF_FS_READONLY 3255 3255 && !(fp->flag & FA_WRITE) 3256 3256 #endif … … 3268 3268 } else { /* When seek to back cluster, */ 3269 3269 clst = fp->sclust; /* start from the first cluster */ 3270 #if ! _FS_READONLY3270 #if !FF_FS_READONLY 3271 3271 if (clst == 0) { /* If no cluster chain, create a new chain */ 3272 3272 clst = create_chain(fp->fs, 0); … … 3280 3280 if (clst != 0) { 3281 3281 while (ofs > bcs) { /* Cluster following loop */ 3282 #if ! _FS_READONLY3282 #if !FF_FS_READONLY 3283 3283 if (fp->flag & FA_WRITE) { /* Check if in write mode or not */ 3284 3284 clst = create_chain(fp->fs, clst); /* Force stretch if in write mode */ … … 3304 3304 } 3305 3305 if (fp->fptr % SS(fp->fs) && nsect != fp->dsect) { /* Fill sector cache if needed */ 3306 #if ! _FS_TINY3307 #if ! _FS_READONLY3308 if (fp->flag & FA_ _DIRTY) { /* Write-back dirty sector cache */3306 #if !FF_FS_TINY 3307 #if !FF_FS_READONLY 3308 if (fp->flag & FA_DIRTY) { /* Write-back dirty sector cache */ 3309 3309 if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK) 3310 3310 ABORT(fp->fs, FR_DISK_ERR); 3311 fp->flag &= ~FA_ _DIRTY;3311 fp->flag &= ~FA_DIRTY; 3312 3312 } 3313 3313 #endif … … 3317 3317 fp->dsect = nsect; 3318 3318 } 3319 #if ! _FS_READONLY3319 #if !FF_FS_READONLY 3320 3320 if (fp->fptr > fp->fsize) { /* Set file change flag if the file size is extended */ 3321 3321 fp->fsize = fp->fptr; 3322 fp->flag |= FA_ _WRITTEN;3322 fp->flag |= FA_MODIFIED; 3323 3323 } 3324 3324 #endif … … 3342 3342 } 3343 3343 3344 #if _FS_MINIMIZE <= 13344 #if FF_FS_MINIMIZE <= 1 3345 3345 /*-----------------------------------------------------------------------*/ 3346 3346 /* Create a Directory Object */ … … 3348 3348 3349 3349 FRESULT f_opendir ( 3350 DIR* dp, /* Pointer to directory object to create */3350 FATFS_DIR* dp, /* Pointer to directory object to create */ 3351 3351 const TCHAR* path /* Pointer to the directory path */ 3352 3352 ) … … 3376 3376 dp->id = fs->id; 3377 3377 res = dir_sdi(dp, 0); /* Rewind directory */ 3378 #if _FS_LOCK3378 #if FF_FS_LOCK != 0 3379 3379 if (res == FR_OK) { 3380 3380 if (dp->sclust) { … … 3404 3404 3405 3405 FRESULT f_closedir ( 3406 DIR *dp /* Pointer to the directory object to be closed */3406 FATFS_DIR *dp /* Pointer to the directory object to be closed */ 3407 3407 ) 3408 3408 { … … 3412 3412 res = validate(dp); 3413 3413 if (res == FR_OK) { 3414 #if _FS_REENTRANT3414 #if FF_FS_REENTRANT 3415 3415 FATFS *fs = dp->fs; 3416 3416 #endif 3417 #if _FS_LOCK3417 #if FF_FS_LOCK != 0 3418 3418 if (dp->lockid) /* Decrement sub-directory open counter */ 3419 3419 res = dec_lock(dp->lockid); … … 3421 3421 #endif 3422 3422 dp->fs = 0; /* Invalidate directory object */ 3423 #if _FS_REENTRANT3423 #if FF_FS_REENTRANT 3424 3424 unlock_fs(fs, FR_OK); /* Unlock volume */ 3425 3425 #endif … … 3436 3436 3437 3437 FRESULT f_readdir ( 3438 DIR* dp, /* Pointer to the open directory object */3438 FATFS_DIR* dp, /* Pointer to the open directory object */ 3439 3439 FILINFO* fno /* Pointer to file information to return */ 3440 3440 ) … … 3472 3472 3473 3473 3474 #if _USE_FIND3474 #if FF_USE_FIND 3475 3475 /*-----------------------------------------------------------------------*/ 3476 3476 /* Find next file */ … … 3478 3478 3479 3479 FRESULT f_findnext ( 3480 DIR* dp, /* Pointer to the open directory object */3480 FATFS_DIR* dp, /* Pointer to the open directory object */ 3481 3481 FILINFO* fno /* Pointer to the file information structure */ 3482 3482 ) … … 3488 3488 res = f_readdir(dp, fno); /* Get a directory item */ 3489 3489 if (res != FR_OK || !fno || !fno->fname[0]) break; /* Terminate if any error or end of directory */ 3490 #if _USE_LFN3490 #if FF_USE_LFN 3491 3491 if (fno->lfname && pattern_matching(dp->pat, fno->lfname, 0, 0)) break; /* Test for LFN if exist */ 3492 3492 #endif … … 3504 3504 3505 3505 FRESULT f_findfirst ( 3506 DIR* dp, /* Pointer to the blank directory object */3506 FATFS_DIR* dp, /* Pointer to the blank directory object */ 3507 3507 FILINFO* fno, /* Pointer to the file information structure */ 3508 3508 const TCHAR* path, /* Pointer to the directory to open */ … … 3520 3520 } 3521 3521 3522 #endif /* _USE_FIND */3523 3524 3525 3526 #if _FS_MINIMIZE == 03522 #endif /* FF_USE_FIND */ 3523 3524 3525 3526 #if FF_FS_MINIMIZE == 0 3527 3527 /*-----------------------------------------------------------------------*/ 3528 3528 /* Get File Status */ … … 3535 3535 { 3536 3536 FRESULT res; 3537 DIR dj;3537 FATFS_DIR dj; 3538 3538 DEFINE_NAMEBUF; 3539 3539 … … 3559 3559 3560 3560 3561 #if ! _FS_READONLY3561 #if !FF_FS_READONLY 3562 3562 /*-----------------------------------------------------------------------*/ 3563 3563 /* Get Number of Free Clusters */ … … 3650 3650 if (fp->fsize > fp->fptr) { 3651 3651 fp->fsize = fp->fptr; /* Set file size to current R/W point */ 3652 fp->flag |= FA_ _WRITTEN;3652 fp->flag |= FA_MODIFIED; 3653 3653 if (fp->fptr == 0) { /* When set file size to zero, remove entire cluster chain */ 3654 3654 res = remove_chain(fp->fs, fp->sclust); … … 3664 3664 } 3665 3665 } 3666 #if ! _FS_TINY3667 if (res == FR_OK && (fp->flag & FA_ _DIRTY)) {3666 #if !FF_FS_TINY 3667 if (res == FR_OK && (fp->flag & FA_DIRTY)) { 3668 3668 if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK) 3669 3669 res = FR_DISK_ERR; 3670 3670 else 3671 fp->flag &= ~FA_ _DIRTY;3671 fp->flag &= ~FA_DIRTY; 3672 3672 } 3673 3673 #endif … … 3691 3691 { 3692 3692 FRESULT res; 3693 DIR dj, sdj;3693 FATFS_DIR dj, sdj; 3694 3694 BYTE *dir; 3695 3695 DWORD dclst = 0; … … 3702 3702 INIT_BUF(dj); 3703 3703 res = follow_path(&dj, path); /* Follow the file path */ 3704 if ( _FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))3704 if (FF_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT)) 3705 3705 res = FR_INVALID_NAME; /* Cannot remove dot entry */ 3706 #if _FS_LOCK3706 #if FF_FS_LOCK != 0 3707 3707 if (res == FR_OK) res = chk_lock(&dj, 2); /* Cannot remove open object */ 3708 3708 #endif … … 3718 3718 dclst = ld_clust(dj.fs, dir); 3719 3719 if (dclst && (dir[DIR_Attr] & AM_DIR)) { /* Is it a sub-directory ? */ 3720 #if _FS_RPATH3720 #if FF_FS_RPATH 3721 3721 if (dclst == dj.fs->cdir) { /* Is it the current directory? */ 3722 3722 res = FR_DENIED; … … 3724 3724 #endif 3725 3725 { 3726 mem_cpy(&sdj, &dj, sizeof ( DIR)); /* Open the sub-directory */3726 mem_cpy(&sdj, &dj, sizeof (FATFS_DIR)); /* Open the sub-directory */ 3727 3727 sdj.sclust = dclst; 3728 3728 res = dir_sdi(&sdj, 2); … … 3760 3760 { 3761 3761 FRESULT res; 3762 DIR dj;3762 FATFS_DIR dj; 3763 3763 BYTE *dir, n; 3764 3764 DWORD dsc, dcl, pcl, tm = GET_FATTIME(); … … 3772 3772 res = follow_path(&dj, path); /* Follow the file path */ 3773 3773 if (res == FR_OK) res = FR_EXIST; /* Any object with same name is already existing */ 3774 if ( _FS_RPATH && res == FR_NO_FILE && (dj.fn[NSFLAG] & NS_DOT))3774 if (FF_FS_RPATH && res == FR_NO_FILE && (dj.fn[NSFLAG] & NS_DOT)) 3775 3775 res = FR_INVALID_NAME; 3776 3776 if (res == FR_NO_FILE) { /* Can create a new directory */ … … 3836 3836 { 3837 3837 FRESULT res; 3838 DIR dj;3838 FATFS_DIR dj; 3839 3839 BYTE *dir; 3840 3840 DEFINE_NAMEBUF; … … 3846 3846 res = follow_path(&dj, path); /* Follow the file path */ 3847 3847 FREE_BUF(); 3848 if ( _FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))3848 if (FF_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT)) 3849 3849 res = FR_INVALID_NAME; 3850 3850 if (res == FR_OK) { … … 3877 3877 { 3878 3878 FRESULT res; 3879 DIR djo, djn;3879 FATFS_DIR djo, djn; 3880 3880 BYTE buf[21], *dir; 3881 3881 DWORD dw; … … 3890 3890 INIT_BUF(djo); 3891 3891 res = follow_path(&djo, path_old); /* Check old object */ 3892 if ( _FS_RPATH && res == FR_OK && (djo.fn[NSFLAG] & NS_DOT))3892 if (FF_FS_RPATH && res == FR_OK && (djo.fn[NSFLAG] & NS_DOT)) 3893 3893 res = FR_INVALID_NAME; 3894 #if _FS_LOCK3894 #if FF_FS_LOCK != 0 3895 3895 if (res == FR_OK) res = chk_lock(&djo, 2); 3896 3896 #endif … … 3900 3900 } else { 3901 3901 mem_cpy(buf, djo.dir + DIR_Attr, 21); /* Save information about object except name */ 3902 mem_cpy(&djn, &djo, sizeof ( DIR)); /* Duplicate the directory object */3902 mem_cpy(&djn, &djo, sizeof (FATFS_DIR)); /* Duplicate the directory object */ 3903 3903 if (get_ldnumber(&path_new) >= 0) /* Snip drive number off and ignore it */ 3904 3904 res = follow_path(&djn, path_new); /* and make sure if new object name is not conflicting */ … … 3909 3909 dir = djn.dir; 3910 3910 if (dir[DIR_Attr] & AM_DIR) { /* The new object is a directory */ 3911 temp_new_path = (TCHAR *)ff_memalloc(( _MAX_LFN + 1) * sizeof(WCHAR));3912 ntstdio_snprintf(temp_new_path,_MAX_LFN, "%s/%s", path_new, basename((char *)path_old));3911 temp_new_path = (TCHAR *)ff_memalloc((FF_MAX_LFN + 1) * sizeof(WCHAR)); 3912 snprintf(temp_new_path, FF_MAX_LFN, "%s/%s", path_new, basename((char *)path_old)); 3913 3913 res = follow_path(&djn, temp_new_path); 3914 3914 } … … 3966 3966 { 3967 3967 FRESULT res; 3968 DIR dj;3968 FATFS_DIR dj; 3969 3969 BYTE *dir; 3970 3970 DEFINE_NAMEBUF; … … 3977 3977 res = follow_path(&dj, path); /* Follow the file path */ 3978 3978 FREE_BUF(); 3979 if ( _FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT))3979 if (FF_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT)) 3980 3980 res = FR_INVALID_NAME; 3981 3981 if (res == FR_OK) { … … 3995 3995 } 3996 3996 3997 #endif /* ! _FS_READONLY */3998 #endif /* _FS_MINIMIZE == 0 */3999 #endif /* _FS_MINIMIZE <= 1 */4000 #endif /* _FS_MINIMIZE <= 2 */4001 4002 4003 4004 4005 #if _USE_LABEL3997 #endif /* !FF_FS_READONLY */ 3998 #endif /* FF_FS_MINIMIZE == 0 */ 3999 #endif /* FF_FS_MINIMIZE <= 1 */ 4000 #endif /* FF_FS_MINIMIZE <= 2 */ 4001 4002 4003 4004 4005 #if FF_USE_LABEL 4006 4006 /*-----------------------------------------------------------------------*/ 4007 4007 /* Get volume label */ … … 4015 4015 { 4016 4016 FRESULT res; 4017 DIR dj;4017 FATFS_DIR dj; 4018 4018 UINT i, j; 4019 #if _USE_LFN &&_LFN_UNICODE4019 #if FF_USE_LFN && FF_LFN_UNICODE 4020 4020 WCHAR w; 4021 4021 #endif … … 4032 4032 res = dir_read(&dj, 1); /* Get an entry with AM_VOL */ 4033 4033 if (res == FR_OK) { /* A volume label is exist */ 4034 #if _USE_LFN &&_LFN_UNICODE4034 #if FF_USE_LFN && FF_LFN_UNICODE 4035 4035 i = j = 0; 4036 4036 do { … … 4070 4070 4071 4071 4072 #if ! _FS_READONLY4072 #if !FF_FS_READONLY 4073 4073 /*-----------------------------------------------------------------------*/ 4074 4074 /* Set volume label */ … … 4080 4080 { 4081 4081 FRESULT res; 4082 DIR dj;4082 FATFS_DIR dj; 4083 4083 BYTE vn[11]; 4084 4084 UINT i, j, sl; 4085 4085 WCHAR w; 4086 4086 DWORD tm; 4087 #if _CODE_PAGE == 650014087 #if FF_CODE_PAGE == 65001 4088 4088 int code_size; 4089 4089 unsigned char utf8_code[6]; … … 4101 4101 i = j = 0; 4102 4102 do { 4103 #if _CODE_PAGE == 650014103 #if FF_CODE_PAGE == 65001 4104 4104 w = ff_wtoupper(Utf8_to_Utf16(&label[i], &code_size)); 4105 4105 i += code_size; … … 4110 4110 vn[j++] = utf8_code[k]; 4111 4111 #else 4112 #if _USE_LFN &&_LFN_UNICODE4112 #if FF_USE_LFN && FF_LFN_UNICODE 4113 4113 w = ff_convert(ff_wtoupper(label[i++]), 0); 4114 4114 #else … … 4116 4116 if (IsDBCS1(w)) 4117 4117 w = (j < 10 && i < sl && IsDBCS2(label[i])) ? w << 8 | (BYTE)label[i++] : 0; 4118 #if _USE_LFN4118 #if FF_USE_LFN 4119 4119 w = ff_convert(ff_wtoupper(ff_convert(w, 1)), 0); 4120 4120 #else … … 4174 4174 } 4175 4175 4176 #endif /* ! _FS_READONLY */4177 #endif /* _USE_LABEL */4176 #endif /* !FF_FS_READONLY */ 4177 #endif /* FF_USE_LABEL */ 4178 4178 4179 4179 … … 4182 4182 /* Forward data to the stream directly (available on only tiny cfg) */ 4183 4183 /*-----------------------------------------------------------------------*/ 4184 #if _USE_FORWARD &&_FS_TINY4184 #if FF_USE_FORWARD && FF_FS_TINY 4185 4185 4186 4186 FRESULT f_forward ( … … 4235 4235 LEAVE_FF(fp->fs, FR_OK); 4236 4236 } 4237 #endif /* _USE_FORWARD */4238 4239 4240 4241 #if _USE_MKFS && !_FS_READONLY4237 #endif /* FF_USE_FORWARD */ 4238 4239 4240 4241 #if FF_USE_MKFS && !FF_FS_READONLY 4242 4242 /*-----------------------------------------------------------------------*/ 4243 4243 /* Create file system on the logical drive */ … … 4263 4263 FATFS *fs; 4264 4264 DSTATUS stat; 4265 #if _USE_TRIM4265 #if FF_USE_TRIM 4266 4266 DWORD eb[2]; 4267 4267 #endif … … 4282 4282 if (stat & STA_NOINIT) return FR_NOT_READY; 4283 4283 if (stat & STA_PROTECT) return FR_WRITE_PROTECTED; 4284 #if _MAX_SS !=_MIN_SS /* Get disk sector size */4285 if (disk_ioctl(pdrv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > _MAX_SS || SS(fs) <_MIN_SS)4284 #if FF_MAX_SS != FF_MIN_SS /* Get disk sector size */ 4285 if (disk_ioctl(pdrv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK || SS(fs) > FF_MAX_SS || SS(fs) < FF_MIN_SS) 4286 4286 return FR_DISK_ERR; 4287 4287 #endif 4288 if ( _MULTI_PARTITION && part) {4288 if (FF_MULTI_PARTITION && part) { 4289 4289 /* Get partition information from partition table in the MBR */ 4290 4290 if (disk_read(pdrv, fs->win, 0, 1) != RES_OK) return FR_DISK_ERR; … … 4308 4308 au = cst[i]; 4309 4309 } 4310 if (au >= _MIN_SS) au /= SS(fs); /* Number of sectors per cluster */4310 if (au >= FF_MIN_SS) au /= SS(fs); /* Number of sectors per cluster */ 4311 4311 if (!au) au = 1; 4312 4312 if (au > 128) au = 128; … … 4362 4362 } 4363 4363 4364 if ( _MULTI_PARTITION && part) {4364 if (FF_MULTI_PARTITION && part) { 4365 4365 /* Update system ID in the partition table */ 4366 4366 tbl = &fs->win[MBR_Table + (part - 1) * SZ_PTE]; … … 4465 4465 } while (--i); 4466 4466 4467 #if _USE_TRIM /* Erase data area if needed */4467 #if FF_USE_TRIM /* Erase data area if needed */ 4468 4468 { 4469 4469 eb[0] = wsect; eb[1] = wsect + (n_clst - ((fmt == FS_FAT32) ? 1 : 0)) * au - 1; … … 4488 4488 4489 4489 4490 #if _MULTI_PARTITION4490 #if FF_MULTI_PARTITION 4491 4491 /*-----------------------------------------------------------------------*/ 4492 4492 /* Create partition table on the physical drive */ … … 4518 4518 4519 4519 /* Create partition table */ 4520 mem_set(buf, 0, _MAX_SS);4520 mem_set(buf, 0, FF_MAX_SS); 4521 4521 p = buf + MBR_Table; b_cyl = 0; 4522 4522 for (i = 0; i < 4; i++, p += SZ_PTE) { … … 4555 4555 4556 4556 4557 #endif /* _MULTI_PARTITION */4558 #endif /* _USE_MKFS && !_FS_READONLY */4559 4560 4561 4562 4563 #if _USE_STRFUNC4557 #endif /* FF_MULTI_PARTITION */ 4558 #endif /* FF_USE_MKFS && !FF_FS_READONLY */ 4559 4560 4561 4562 4563 #if FF_USE_STRFUNC 4564 4564 /*-----------------------------------------------------------------------*/ 4565 4565 /* Get a string from the file */ … … 4579 4579 4580 4580 while (n < len - 1) { /* Read characters until buffer gets filled */ 4581 #if _USE_LFN &&_LFN_UNICODE4582 #if _STRF_ENCODE == 3 /* Read a character in UTF-8 */4581 #if FF_USE_LFN && FF_LFN_UNICODE 4582 #if FF_STRF_ENCODE == 3 /* Read a character in UTF-8 */ 4583 4583 f_read(fp, s, 1, &rc); 4584 4584 if (rc != 1) break; … … 4602 4602 } 4603 4603 } 4604 #elif _STRF_ENCODE == 2 /* Read a character in UTF-16BE */4604 #elif FF_STRF_ENCODE == 2 /* Read a character in UTF-16BE */ 4605 4605 f_read(fp, s, 2, &rc); 4606 4606 if (rc != 2) break; 4607 4607 c = s[1] + (s[0] << 8); 4608 #elif _STRF_ENCODE == 1 /* Read a character in UTF-16LE */4608 #elif FF_STRF_ENCODE == 1 /* Read a character in UTF-16LE */ 4609 4609 f_read(fp, s, 2, &rc); 4610 4610 if (rc != 2) break; … … 4627 4627 c = s[0]; 4628 4628 #endif 4629 if ( _USE_STRFUNC == 2 && c == '\r') continue; /* Strip '\r' */4629 if (FF_USE_STRFUNC == 2 && c == '\r') continue; /* Strip '\r' */ 4630 4630 *p++ = c; 4631 4631 n++; … … 4639 4639 4640 4640 4641 #if ! _FS_READONLY4641 #if !FF_FS_READONLY 4642 4642 /*-----------------------------------------------------------------------*/ 4643 4643 /* Put a character to the file */ … … 4661 4661 4662 4662 4663 if ( _USE_STRFUNC == 2 && c == '\n') /* LF -> CRLF conversion */4663 if (FF_USE_STRFUNC == 2 && c == '\n') /* LF -> CRLF conversion */ 4664 4664 putc_bfd(pb, '\r'); 4665 4665 … … 4667 4667 if (i < 0) return; 4668 4668 4669 #if _USE_LFN &&_LFN_UNICODE4670 #if _STRF_ENCODE == 3 /* Write a character in UTF-8 */4669 #if FF_USE_LFN && FF_LFN_UNICODE 4670 #if FF_STRF_ENCODE == 3 /* Write a character in UTF-8 */ 4671 4671 if (c < 0x80) { /* 7-bit */ 4672 4672 pb->buf[i++] = (BYTE)c; … … 4680 4680 pb->buf[i++] = (BYTE)(0x80 | (c & 0x3F)); 4681 4681 } 4682 #elif _STRF_ENCODE == 2 /* Write a character in UTF-16BE */4682 #elif FF_STRF_ENCODE == 2 /* Write a character in UTF-16BE */ 4683 4683 pb->buf[i++] = (BYTE)(c >> 8); 4684 4684 pb->buf[i++] = (BYTE)c; 4685 #elif _STRF_ENCODE == 1 /* Write a character in UTF-16LE */4685 #elif FF_STRF_ENCODE == 1 /* Write a character in UTF-16LE */ 4686 4686 pb->buf[i++] = (BYTE)c; 4687 4687 pb->buf[i++] = (BYTE)(c >> 8); … … 4866 4866 ret = f_vprintf(fp, fmt, arp); 4867 4867 va_end(arp); 4868 4868 4869 4869 return ret; 4870 4870 } 4871 4871 4872 #endif /* ! _FS_READONLY */4873 #endif /* _USE_STRFUNC */4872 #endif /* !FF_FS_READONLY */ 4873 #endif /* FF_USE_STRFUNC */ -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/ff.h
r337 r374 28 28 #include "ffconf.h" /* FatFs configuration options */ 29 29 #include "diskio.h" 30 #if _FATFS != _FFCONF30 #if _FATFS != FFCONF_DEF 31 31 #error Wrong configuration file (ffconf.h). 32 32 #endif … … 36 36 /* Definitions of volume management */ 37 37 38 #if _MULTI_PARTITION /* Multiple partition configuration */38 #if FF_MULTI_PARTITION /* Multiple partition configuration */ 39 39 typedef struct { 40 40 BYTE pd; /* Physical drive number */ … … 55 55 /* Type of path name strings on FatFs API */ 56 56 57 #if _LFN_UNICODE /* Unicode string */58 #if ! _USE_LFN59 #error _LFN_UNICODE must be 0 at non-LFN cfg.57 #if FF_LFN_UNICODE /* Unicode string */ 58 #if !FF_USE_LFN 59 #error FF_LFN_UNICODE must be 0 at non-LFN cfg. 60 60 #endif 61 61 #ifndef _INC_TCHAR … … 87 87 WORD id; /* File system mount ID */ 88 88 WORD n_rootdir; /* Number of root directory entries (FAT12/16) */ 89 #if _MAX_SS !=_MIN_SS89 #if FF_MAX_SS != FF_MIN_SS 90 90 WORD ssize; /* Bytes per sector (512, 1024, 2048 or 4096) */ 91 91 #endif 92 #if _FS_REENTRANT93 _SYNC_t sobj; /* Identifier of sync object */94 #endif 95 #if ! _FS_READONLY92 #if FF_FS_REENTRANT 93 FF_SYNC_t sobj; /* Identifier of sync object */ 94 #endif 95 #if !FF_FS_READONLY 96 96 DWORD last_clust; /* Last allocated cluster */ 97 97 DWORD free_clust; /* Number of free clusters */ 98 98 #endif 99 #if _FS_RPATH99 #if FF_FS_RPATH 100 100 DWORD cdir; /* Current directory start cluster (0:root) */ 101 101 #endif … … 107 107 DWORD database; /* Data start sector */ 108 108 DWORD winsect; /* Current sector appearing in the win[] */ 109 BYTE win[ _MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */109 BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */ 110 110 } FATFS; 111 111 … … 124 124 DWORD clust; /* Current cluster of fpter (not valid when fprt is 0) */ 125 125 DWORD dsect; /* Sector number appearing in buf[] (0:invalid) */ 126 #if ! _FS_READONLY126 #if !FF_FS_READONLY 127 127 DWORD dir_sect; /* Sector number containing the directory entry */ 128 128 BYTE* dir_ptr; /* Pointer to the directory entry in the win[] */ 129 129 #endif 130 #if _USE_FASTSEEK130 #if FF_USE_FASTSEEK 131 131 DWORD* cltbl; /* Pointer to the cluster link map table (Nulled on file open) */ 132 132 #endif 133 #if _FS_LOCK133 #if FF_FS_LOCK != 0 134 134 UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */ 135 135 #endif 136 #if ! _FS_TINY137 BYTE buf[ _MAX_SS]; /* File private data read/write window */136 #if !FF_FS_TINY 137 BYTE buf[FF_MAX_SS]; /* File private data read/write window */ 138 138 #endif 139 139 } FIL; … … 141 141 142 142 143 /* Directory object structure ( DIR) */143 /* Directory object structure (FATFS_DIR) */ 144 144 145 145 typedef struct __dirstream { … … 152 152 BYTE* dir; /* Pointer to the current SFN entry in the win[] */ 153 153 BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */ 154 #if _FS_LOCK154 #if FF_FS_LOCK != 0 155 155 UINT lockid; /* File lock ID (index of file semaphore table Files[]) */ 156 156 #endif 157 #if _USE_LFN157 #if FF_USE_LFN 158 158 WCHAR* lfn; /* Pointer to the LFN working buffer */ 159 159 WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */ 160 160 #endif 161 #if _USE_FIND161 #if FF_USE_FIND 162 162 const TCHAR* pat; /* Pointer to the name matching pattern */ 163 163 #endif 164 } DIR;164 } FATFS_DIR; 165 165 166 166 … … 174 174 BYTE fattrib; /* Attribute */ 175 175 TCHAR fname[13]; /* Short file name (8.3 format) */ 176 #if _USE_LFN176 #if FF_USE_LFN 177 177 TCHAR* lfname; /* Pointer to the LFN buffer */ 178 178 UINT lfsize; /* Size of LFN buffer in TCHAR */ … … 203 203 FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */ 204 204 FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */ 205 FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_LOCK */205 FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > FF_FS_LOCK */ 206 206 FR_INVALID_PARAMETER /* (19) Given parameter is invalid */ 207 207 } FRESULT; … … 220 220 FRESULT f_truncate (FIL* fp); /* Truncate file */ 221 221 FRESULT f_sync (FIL* fp); /* Flush cached data of a writing file */ 222 FRESULT f_opendir ( DIR* dp, const TCHAR* path); /* Open a directory */223 FRESULT f_closedir ( DIR* dp); /* Close an open directory */224 FRESULT f_readdir ( DIR* dp, FILINFO* fno); /* Read a directory item */225 FRESULT f_findfirst ( DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */226 FRESULT f_findnext ( DIR* dp, FILINFO* fno); /* Find next file */222 FRESULT f_opendir (FATFS_DIR* dp, const TCHAR* path); /* Open a directory */ 223 FRESULT f_closedir (FATFS_DIR* dp); /* Close an open directory */ 224 FRESULT f_readdir (FATFS_DIR* dp, FILINFO* fno); /* Read a directory item */ 225 FRESULT f_findfirst (FATFS_DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */ 226 FRESULT f_findnext (FATFS_DIR* dp, FILINFO* fno); /* Find next file */ 227 227 FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */ 228 228 FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */ … … 270 270 271 271 /* RTC function */ 272 #if ! _FS_READONLY && !_FS_NORTC272 #if !FF_FS_READONLY && !FF_FS_NORTC 273 273 DWORD get_fattime (void); 274 274 #endif 275 275 276 276 /* Unicode support functions */ 277 #if _USE_LFN /* Unicode - OEM code conversion */277 #if FF_USE_LFN /* Unicode - OEM code conversion */ 278 278 WCHAR ff_convert (WCHAR chr, UINT dir); /* OEM-Unicode bidirectional conversion */ 279 279 WCHAR ff_wtoupper (WCHAR chr); /* Unicode upper-case conversion */ 280 #if _USE_LFN == 3 /* Memory functions */280 #if FF_USE_LFN == 3 /* Memory functions */ 281 281 void* ff_memalloc (UINT msize); /* Allocate memory block */ 282 282 void ff_memfree (void* mblock); /* Free memory block */ … … 285 285 286 286 /* Sync functions */ 287 #if _FS_REENTRANT288 int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj); /* Create a sync object */289 int ff_req_grant ( _SYNC_t sobj); /* Lock sync object */290 void ff_rel_grant ( _SYNC_t sobj); /* Unlock sync object */291 int ff_del_syncobj ( _SYNC_t sobj); /* Delete a sync object */287 #if FF_FS_REENTRANT 288 int ff_cre_syncobj (BYTE vol, FF_SYNC_t* sobj); /* Create a sync object */ 289 int ff_req_grant (FF_SYNC_t sobj); /* Lock sync object */ 290 void ff_rel_grant (FF_SYNC_t sobj); /* Unlock sync object */ 291 int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */ 292 292 #endif 293 293 … … 304 304 #define FA_OPEN_EXISTING 0x00 305 305 306 #if ! _FS_READONLY306 #if !FF_FS_READONLY 307 307 #define FA_WRITE 0x02 308 308 #define FA_CREATE_NEW 0x04 309 309 #define FA_CREATE_ALWAYS 0x08 310 310 #define FA_OPEN_ALWAYS 0x10 311 #define FA__WRITTEN 0x20 312 #define FA__DIRTY 0x40 311 #define FA_OPEN_APPEND 0x30 312 #define FA_MODIFIED 0x20 313 #define FA_DIRTY 0x40 313 314 #endif 314 315 … … 341 342 /* Multi-byte word access macros */ 342 343 343 #if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */344 #if FF_WORD_ACCESS == 1 /* Enable word access to the FAT structure */ 344 345 #define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr)) 345 346 #define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr)) -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/ffarch.c
r364 r374 54 54 #include "ff.h" 55 55 #include "ffarch.h" 56 #include "util/ntstdio.h" 57 #include "mbed_api.h" 58 59 extern ntstdio_t ntstdio; 56 #include <stdio.h> 57 #include "gpio_api.h" 58 #include "rtc_api.h" 60 59 61 60 enum ffarch_state_t { … … 85 84 ret2 = get_tim(&now); 86 85 if (ret2 != E_OK){ 87 ntstdio_printf(&ntstdio,"[ffarch] get_tim error: %s",86 printf("[ffarch] get_tim error: %s", 88 87 itron_strerror(ret2)); 89 88 return; … … 99 98 ret = tslp_tsk(timer); 100 99 if ((ret != E_OK) && (ret != E_TMOUT)) { 101 ntstdio_printf(&ntstdio,"[ffarch] tslp_tsk error: %s %d",100 printf("[ffarch] tslp_tsk error: %s %d", 102 101 itron_strerror(ret), timer); 103 102 break; … … 106 105 ret2 = get_tim(&now); 107 106 if (ret2 != E_OK) { 108 ntstdio_printf(&ntstdio,"[ffarch] get_tim error: %s",107 printf("[ffarch] get_tim error: %s", 109 108 itron_strerror(ret2)); 110 109 break; … … 151 150 #endif 152 151 if (romdisk_init()) { 153 ntstdio_printf(&ntstdio,"ROM disk (0:) OK!\n");152 printf("ROM disk (0:) OK!\n"); 154 153 } 155 154 else { 156 ntstdio_printf(&ntstdio,"ROM disk (0:) NG!\n");155 printf("ROM disk (0:) NG!\n"); 157 156 } 158 157 } … … 304 303 case FFS_RETRY_WAIT: 305 304 if (ffarch_retry_count == 0) { 306 ntstdio_printf(&ntstdio,"SD card (1:) initialize tired...\n");305 printf("SD card (1:) initialize tired...\n"); 307 306 308 307 ffarch_state = FFS_IDLE; … … 316 315 /* SDカードが入れられた場合 */ 317 316 if (((mmc_rspi_prev_status & STA_NODISK) != 0) && ((mmc_rspi_status() & STA_NODISK) == 0)) { 318 ntstdio_printf(&ntstdio,"SD card initializing ...\n");317 printf("SD card initializing ...\n"); 319 318 320 319 Sd.FatFs.fs_type = 0; 321 320 if (SD_begin()) { 322 ntstdio_printf(&ntstdio,"SD card (1:) OK!\n");321 printf("SD card (1:) OK!\n"); 323 322 324 323 /* uploadディレクトリを作成しておく */ … … 330 329 } 331 330 else { 332 ntstdio_printf(&ntstdio,"SD card (1:) NG!\n");331 printf("SD card (1:) NG!\n"); 333 332 ffarch_state = FFS_RETRY_WAIT; 334 333 ffarch_timer = 1000 * 1000; … … 337 336 /* SDカードが抜かれた場合 */ 338 337 else if (((mmc_rspi_prev_status & STA_NODISK) == 0) && ((mmc_rspi_status() & STA_NODISK) != 0)) { 339 ntstdio_printf(&ntstdio,"SD card unmount\n");338 printf("SD card unmount\n"); 340 339 341 340 f_mount(&Sd.FatFs, "1:", 0); … … 349 348 } 350 349 351 int ff_cre_syncobj(BYTE vol, _SYNC_t* sobj)350 int ff_cre_syncobj(BYTE vol, FF_SYNC_t* sobj) 352 351 { 353 352 return 1; 354 353 } 355 354 356 int ff_req_grant( _SYNC_t sobj)355 int ff_req_grant(FF_SYNC_t sobj) 357 356 { 358 357 ER ret; … … 361 360 } 362 361 363 void ff_rel_grant( _SYNC_t sobj)362 void ff_rel_grant(FF_SYNC_t sobj) 364 363 { 365 364 sig_sem(SEM_FILESYSTEM); 366 365 } 367 366 368 int ff_del_syncobj( _SYNC_t sobj)367 int ff_del_syncobj(FF_SYNC_t sobj) 369 368 { 370 369 return 1; -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/ffconf.h
r337 r374 3 3 /---------------------------------------------------------------------------*/ 4 4 5 #define _FFCONF 64180 /* Revision ID */ 5 #define FFCONF_DEF 64180 /* Revision ID */ 6 7 #define FFS_DBG 0 6 8 7 9 /*---------------------------------------------------------------------------/ … … 9 11 /---------------------------------------------------------------------------*/ 10 12 11 #define _FS_READONLY 013 #define FF_FS_READONLY 0 12 14 /* This option switches read-only configuration. (0:Read/Write or 1:Read-only) 13 15 / Read-only configuration removes writing API functions, f_write(), f_sync(), … … 16 18 17 19 18 #define _FS_MINIMIZE 020 #define FF_FS_MINIMIZE 0 19 21 /* This option defines minimization level to remove some basic API functions. 20 22 / … … 26 28 27 29 28 #define _USE_STRFUNC 130 #define FF_USE_STRFUNC 1 29 31 /* This option switches string functions, f_gets(), f_putc(), f_puts() and 30 32 / f_printf(). … … 35 37 36 38 37 #define _USE_FIND 139 #define FF_USE_FIND 1 38 40 /* This option switches filtered directory read feature and related functions, 39 41 / f_findfirst() and f_findnext(). (0:Disable or 1:Enable) */ 40 42 41 43 42 #define _USE_MKFS 144 #define FF_USE_MKFS 1 43 45 /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ 44 46 45 47 46 #define _USE_FASTSEEK 048 #define FF_USE_FASTSEEK 0 47 49 /* This option switches fast seek feature. (0:Disable or 1:Enable) */ 48 50 49 51 50 #define _USE_LABEL 152 #define FF_USE_LABEL 1 51 53 /* This option switches volume label functions, f_getlabel() and f_setlabel(). 52 54 / (0:Disable or 1:Enable) */ 53 55 54 56 55 #define _USE_FORWARD 157 #define FF_USE_FORWARD 1 56 58 /* This option switches f_forward() function. (0:Disable or 1:Enable) 57 / To enable it, also _FS_TINY need to be set to 1. */59 / To enable it, also FF_FS_TINY need to be set to 1. */ 58 60 59 61 … … 62 64 /---------------------------------------------------------------------------*/ 63 65 64 #define _CODE_PAGE 6500166 #define FF_CODE_PAGE 65001 65 67 /* This option specifies the OEM code page to be used on the target system. 66 68 / Incorrect setting of the code page can cause a file open failure. … … 91 93 92 94 93 #define _USE_LFN 394 #define _MAX_LFN 25595 /* The _USE_LFN option switches the LFN feature.96 / 97 / 0: Disable LFN feature. _MAX_LFN has no effect.95 #define FF_USE_LFN 3 96 #define FF_MAX_LFN 255 97 /* The FF_USE_LFN option switches the LFN feature. 98 / 99 / 0: Disable LFN feature. FF_MAX_LFN has no effect. 98 100 / 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe. 99 101 / 2: Enable LFN with dynamic working buffer on the STACK. … … 101 103 / 102 104 / When enable the LFN feature, Unicode handling functions (option/unicode.c) must 103 / be added to the project. The LFN working buffer occupies ( _MAX_LFN + 1) * 2 bytes.105 / be added to the project. The LFN working buffer occupies (FF_MAX_LFN + 1) * 2 bytes. 104 106 / When use stack for the working buffer, take care on stack overflow. When use heap 105 107 / memory for the working buffer, memory management functions, ff_memalloc() and … … 107 109 108 110 109 #define _LFN_UNICODE 0111 #define FF_LFN_UNICODE 0 110 112 /* This option switches character encoding on the API. (0:ANSI/OEM or 1:Unicode) 111 / To use Unicode string for the path name, enable LFN feature and set _LFN_UNICODE113 / To use Unicode string for the path name, enable LFN feature and set FF_LFN_UNICODE 112 114 / to 1. This option also affects behavior of string I/O functions. */ 113 115 114 116 115 #define _STRF_ENCODE 3116 /* When _LFN_UNICODE is 1, this option selects the character encoding on the file to117 #define FF_STRF_ENCODE 3 118 /* When FF_LFN_UNICODE is 1, this option selects the character encoding on the file to 117 119 / be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf(). 118 120 / … … 122 124 / 3: UTF-8 123 125 / 124 / When _LFN_UNICODE is 0, this option has no effect. */ 125 126 127 #define _FS_RPATH 2 126 / When FF_LFN_UNICODE is 0, this option has no effect. */ 127 128 129 #define FF_LFN_BUF 255 130 #define FF_SFN_BUF 12 131 /* This set of options defines size of file name members in the FILINFO structure 132 / which is used to read out directory items. These values should be suffcient for 133 / the file names to read. The maximum possible length of the read file name depends 134 / on character encoding. When LFN is not enabled, these options have no effect. */ 135 136 137 #define FF_FS_RPATH 2 128 138 /* This option configures relative path feature. 129 139 / … … 139 149 /---------------------------------------------------------------------------*/ 140 150 141 #define _VOLUMES 2151 #define FF_VOLUMES 4 142 152 /* Number of volumes (logical drives) to be used. */ 143 153 144 154 145 #define _STR_VOLUME_ID 0146 #define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"147 /* _STR_VOLUME_ID option switches string volume ID feature.148 / When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive149 / number in the path name. _VOLUME_STRS defines the drive ID strings for each150 / logical drives. Number of items must be equal to _VOLUMES. Valid characters for155 #define FF_STR_VOLUME_ID 0 156 #define FF_VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3" 157 /* FF_STR_VOLUME_ID option switches string volume ID feature. 158 / When FF_STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive 159 / number in the path name. FF_VOLUME_STRS defines the drive ID strings for each 160 / logical drives. Number of items must be equal to FF_VOLUMES. Valid characters for 151 161 / the drive ID strings are: A-Z and 0-9. */ 152 162 153 163 154 #define _MULTI_PARTITION 0164 #define FF_MULTI_PARTITION 0 155 165 /* This option switches multi-partition feature. By default (0), each logical drive 156 166 / number is bound to the same physical drive number and only an FAT volume found on … … 160 170 161 171 162 #define _MIN_SS 512163 #define _MAX_SS 512172 #define FF_MIN_SS 512 173 #define FF_MAX_SS 512 164 174 /* These options configure the range of sector size to be supported. (512, 1024, 165 175 / 2048 or 4096) Always set both 512 for most systems, all type of memory cards and 166 176 / harddisk. But a larger value may be required for on-board flash memory and some 167 / type of optical media. When _MAX_SS is larger than_MIN_SS, FatFs is configured177 / type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured 168 178 / to variable sector size and GET_SECTOR_SIZE command must be implemented to the 169 179 / disk_ioctl() function. */ 170 180 171 181 172 #define _USE_TRIM 0182 #define FF_USE_TRIM 0 173 183 /* This option switches ATA-TRIM feature. (0:Disable or 1:Enable) 174 184 / To enable Trim feature, also CTRL_TRIM command should be implemented to the … … 176 186 177 187 178 #define _FS_NOFSINFO 0188 #define FF_FS_NOFSINFO 0 179 189 /* If you need to know correct free space on the FAT32 volume, set bit 0 of this 180 190 / option, and f_getfree() function at first time after volume mount will force … … 193 203 /---------------------------------------------------------------------------*/ 194 204 195 #define _FS_TINY 1205 #define FF_FS_TINY 1 196 206 /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny) 197 / At the tiny configuration, size of the file object (FIL) is reduced _MAX_SS207 / At the tiny configuration, size of the file object (FIL) is reduced FF_MAX_SS 198 208 / bytes. Instead of private sector buffer eliminated from the file object, 199 209 / common sector buffer in the file system object (FATFS) is used for the file … … 201 211 202 212 203 #define _FS_NORTC 0204 #define _NORTC_MON 1205 #define _NORTC_MDAY 1206 #define _NORTC_YEAR 2015207 /* The _FS_NORTC option switches timestamp feature. If the system does not have208 / an RTC function or valid timestamp is not needed, set _FS_NORTC to 1 to disable213 #define FF_FS_NORTC 0 214 #define FF_NORTC_MON 1 215 #define FF_NORTC_MDAY 1 216 #define FF_NORTC_YEAR 2015 217 /* The FF_FS_NORTC option switches timestamp feature. If the system does not have 218 / an RTC function or valid timestamp is not needed, set FF_FS_NORTC to 1 to disable 209 219 / the timestamp feature. All objects modified by FatFs will have a fixed timestamp 210 / defined by _NORTC_MON, _NORTC_MDAY and_NORTC_YEAR.211 / When timestamp feature is enabled ( _FS_NORTC == 0), get_fattime() function need212 / to be added to the project to read current time form RTC. _NORTC_MON,213 / _NORTC_MDAY and_NORTC_YEAR have no effect.214 / These options have no effect at read-only configuration ( _FS_READONLY == 1). */215 216 217 #define _FS_LOCK 0218 /* The _FS_LOCK option switches file lock feature to control duplicated file open219 / and illegal operation to open objects. This option must be 0 when _FS_READONLY220 / defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR. 221 / When timestamp feature is enabled (FF_FS_NORTC == 0), get_fattime() function need 222 / to be added to the project to read current time form RTC. FF_NORTC_MON, 223 / FF_NORTC_MDAY and FF_NORTC_YEAR have no effect. 224 / These options have no effect at read-only configuration (FF_FS_READONLY == 1). */ 225 226 227 #define FF_FS_LOCK 0 228 /* The FF_FS_LOCK option switches file lock feature to control duplicated file open 229 / and illegal operation to open objects. This option must be 0 when FF_FS_READONLY 220 230 / is 1. 221 231 / … … 227 237 228 238 229 #define _FS_REENTRANT 1230 #define _FS_TIMEOUT 1000231 #define _SYNC_t unsigned int232 /* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs239 #define FF_FS_REENTRANT 1 240 #define FF_FS_TIMEOUT 1000 241 #define FF_SYNC_t unsigned int 242 /* The FF_FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs 233 243 / module itself. Note that regardless of this option, file access to different 234 244 / volume is always re-entrant and volume control functions, f_mount(), f_mkfs() … … 236 246 / to the same volume is under control of this feature. 237 247 / 238 / 0: Disable re-entrancy. _FS_TIMEOUT and_SYNC_t have no effect.248 / 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect. 239 249 / 1: Enable re-entrancy. Also user provided synchronization handlers, 240 250 / ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj() … … 242 252 / option/syscall.c. 243 253 / 244 / The _FS_TIMEOUT defines timeout period in unit of time tick.245 / The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,254 / The FF_FS_TIMEOUT defines timeout period in unit of time tick. 255 / The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*, 246 256 / SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be 247 257 / included somewhere in the scope of ff.c. */ 248 258 249 259 250 #define _WORD_ACCESS 1251 /* The _WORD_ACCESS option is an only platform dependent option. It defines260 #define FF_WORD_ACCESS 1 261 /* The FF_WORD_ACCESS option is an only platform dependent option. It defines 252 262 / which access method is used to the word data on the FAT volume. 253 263 / … … 258 268 / * Byte order on the memory is little-endian. 259 269 / 260 / If it is the case, _WORD_ACCESS can also be set to 1 to reduce code size.270 / If it is the case, FF_WORD_ACCESS can also be set to 1 to reduce code size. 261 271 / Following table shows allowable settings of some type of processors. 262 272 / -
asp3_tinet_ecnl_rx/trunk/ntshell/fatfs/mmc_rspi.c
r359 r374 663 663 break; 664 664 665 case CTRL_TRIM: /* Erase a block of sectors (used when _USE_TRIM == 1) */665 case CTRL_TRIM: /* Erase a block of sectors (used when FF_USE_TRIM == 1) */ 666 666 if (!(CardType & CT_SDC)) break; /* Check if the card is SDC */ 667 667 if (mmc_rspi_ioctl(MMC_GET_CSD, csd)) break; /* Get CSD */ -
asp3_tinet_ecnl_rx/trunk/ntshell/ntshell/usrcmd.c
r340 r374 47 47 #include "core/ntshell.h" 48 48 #include "core/ntlibc.h" 49 #include "util/ntstdio.h"50 51 extern ntstdio_t ntstdio; 49 #include <stdio.h> 50 #include <getopt.h> 51 52 52 extern int ntshell_exit; 53 54 extern int mbtowc(wchar_t *__restrict wc, const char *__restrict src, size_t n);55 56 /* musl_getopt from msul */57 char *optarg;58 int optind=1, opterr=1, optopt, optpos, optreset=0;59 extern int optind, opterr;60 61 static void ntstdio_write(ntstdio_t *handle, const char *str, int l)62 {63 for (; *str && l >= 0; l--) {64 ntstdio_putc(handle, *str++);65 }66 }67 68 static void __getopt_msg(const char *a, const char *b, const char *c, size_t l)69 {70 ntstdio_puts(&ntstdio, a);71 ntstdio_write(&ntstdio, b, strlen(b));72 ntstdio_write(&ntstdio, c, l);73 ntstdio_putc(&ntstdio, '\n');74 }75 76 static int musl_getopt(int argc, char * const argv[], const char *optstring)77 {78 int i;79 wchar_t c, d;80 int k, l;81 char *optchar;82 83 if (!optind || optreset) {84 optreset = 0;85 optpos = 0;86 optind = 1;87 }88 89 if (optind >= argc || !argv[optind])90 return -1;91 92 if (argv[optind][0] != '-') {93 if (optstring[0] == '-') {94 optarg = argv[optind++];95 return 1;96 }97 return -1;98 }99 100 if (!argv[optind][1])101 return -1;102 103 if (argv[optind][1] == '-' && !argv[optind][2])104 return optind++, -1;105 106 if (!optpos) optpos++;107 if ((k = mbtowc(&c, argv[optind]+optpos, MB_LEN_MAX)) < 0) {108 k = 1;109 c = 0xfffd; /* replacement char */110 }111 optchar = argv[optind]+optpos;112 optopt = c;113 optpos += k;114 115 if (!argv[optind][optpos]) {116 optind++;117 optpos = 0;118 }119 120 if (optstring[0] == '-' || optstring[0] == '+')121 optstring++;122 123 i = 0;124 d = 0;125 do {126 l = mbtowc(&d, optstring+i, MB_LEN_MAX);127 if (l>0) i+=l; else i++;128 } while (l && d != c);129 130 if (d != c) {131 if (optstring[0] != ':' && opterr)132 __getopt_msg(argv[0], ": unrecognized option: ", optchar, k);133 return '?';134 }135 if (optstring[i] == ':') {136 if (optstring[i+1] == ':') optarg = 0;137 else if (optind >= argc) {138 if (optstring[0] == ':') return ':';139 if (opterr) __getopt_msg(argv[0],140 ": option requires an argument: ",141 optchar, k);142 return '?';143 }144 if (optstring[i+1] != ':' || optpos) {145 optarg = argv[optind++] + optpos;146 optpos = 0;147 }148 }149 return c;150 }151 152 int shell_kill(int pid, int sig)153 {154 DebugBreak();155 return -1;156 }157 158 int shell_gettimeofday(struct timeval *tv, void *tzvp)159 {160 SYSTIM time;161 if (!tv) return 0;162 get_tim(&time);163 tv->tv_sec = time / 1000000;164 tv->tv_usec = time - (tv->tv_sec * 1000000);165 return 0;166 }167 53 168 54 void put_rc(const char *func, FRESULT rc) … … 178 64 while (*p++); 179 65 } 180 ntstdio_printf(&ntstdio,"%s() =>%u FR_%s\n", func, (UINT)rc, p);66 printf("%s() =>%u FR_%s\n", func, (UINT)rc, p); 181 67 } 182 68 … … 190 76 while (*p++); 191 77 } 192 ntstdio_printf(&ntstdio,"%s() =>%u %s\n", func, (UINT)rc, p);78 printf("%s() =>%u %s\n", func, (UINT)rc, p); 193 79 } 194 80 … … 240 126 241 127 ntlibc_strlcat(path, "\n", sizeof(path)); 242 ntstdio_printf(&ntstdio,path);128 printf(path); 243 129 244 130 return 0; … … 252 138 char *fn; 253 139 254 #if _USE_LFN140 #if FF_USE_LFN 255 141 fn = *fno->lfname ? fno->lfname : fno->fname; 256 142 #else … … 263 149 264 150 if (list_option & LS_LONG) { 265 ntstdio_printf(&ntstdio,"%c%c%c%c%c %04d/%02d/%02d %02d:%02d:%02d ",151 printf("%c%c%c%c%c %04d/%02d/%02d %02d:%02d:%02d ", 266 152 (fno->fattrib & AM_DIR) ? 'd' : '-', 267 153 (fno->fattrib & AM_RDO) ? 'r' : '-', … … 277 163 278 164 if (fno->fattrib & AM_DIR) { /* It is a directory */ 279 ntstdio_printf(&ntstdio, "%10S", " ");165 printf("%10s ", " "); 280 166 } 281 167 else { 282 ntstdio_printf(&ntstdio, "%10d", fno->fsize);168 printf("%10lu ", fno->fsize); 283 169 } 284 170 } 285 171 286 172 if (fno->fattrib & AM_DIR) { /* It is a directory */ 287 ntstdio_printf(&ntstdio,"\x1B[32m%s\x1B[0m\n", fn);173 printf("\x1B[32m%s\x1B[0m\n", fn); 288 174 } 289 175 else { 290 ntstdio_printf(&ntstdio,"%s\n", fn);291 } 292 } 293 294 #define LFN_BUF_SIZE ( _MAX_LFN + 1)176 printf("%s\n", fn); 177 } 178 } 179 180 #define LFN_BUF_SIZE (FF_MAX_LFN + 1) 295 181 /* lsコマンド dir内 表示 */ 296 182 void print_ls(char *path_p, char *pattern_p, BYTE list_option) … … 298 184 FRESULT res; 299 185 FILINFO fno; 300 DIR dir;186 FATFS_DIR dir; 301 187 char *fn; /* This function assumes non-Unicode configuration */ 302 188 … … 307 193 path_backup = ff_memalloc(LFN_BUF_SIZE); 308 194 if (path_backup == NULL) { 309 ntstdio_printf(&ntstdio,"ff_memalloc err.\n");195 printf("ff_memalloc err.\n"); 310 196 return; 311 197 } 312 198 313 #if _USE_LFN199 #if FF_USE_LFN 314 200 char *lfn = NULL; 315 201 lfn = ff_memalloc(LFN_BUF_SIZE); 316 202 if (lfn == NULL) { 317 ntstdio_printf(&ntstdio,"ff_memalloc err.\n");203 printf("ff_memalloc err.\n"); 318 204 ff_memfree(path_backup); 319 205 return; … … 333 219 334 220 while ((res == FR_OK) && (fno.fname[0] != 0)) { 335 if (pattern_p != NULL && (fno.fattrib & AM_DIR) && ((fno.fname[0] == '.') ? (pattern_p[0] == '.') : 1)) {/* DIR とパターンマッチしている場合はDIR 内部を ls する */336 #if _USE_LFN221 if (pattern_p != NULL && (fno.fattrib & AM_DIR) && ((fno.fname[0] == '.') ? (pattern_p[0] == '.') : 1)) {/* FATFS_DIR とパターンマッチしている場合は FATFS_DIR 内部を ls する */ 222 #if FF_USE_LFN 337 223 fn = *fno.lfname ? fno.lfname : fno.fname; 338 224 #else … … 351 237 } 352 238 353 ntstdio_printf(&ntstdio,"\n%s/%s:\n", path_p, fn);239 printf("\n%s/%s:\n", path_p, fn); 354 240 355 241 print_ls(fn, NULL, list_option); 356 242 357 ntstdio_printf(&ntstdio,"\n");243 printf("\n"); 358 244 359 245 if ((res = f_chdrive(path_backup)) != FR_OK) { … … 384 270 { 385 271 char *pattern_p = NULL, *basename_p = NULL, *dirname_p = NULL; 386 char default_pattern[ _MAX_LFN] = "";272 char default_pattern[FF_MAX_LFN] = ""; 387 273 int c; 388 274 BYTE list_option = 0; 389 275 390 while ((c = musl_getopt(argc, argv, "al")) != -1) {276 while ((c = getopt(argc, argv, "al")) != -1) { 391 277 switch (c) { 392 278 case 'a': … … 446 332 return 0; 447 333 448 #if _USE_LFN334 #if FF_USE_LFN 449 335 /* LFN buffer alloc */ 450 336 lfn = ff_memalloc(LFN_BUF_SIZE); 451 337 if (lfn == NULL) { 452 ntstdio_printf(&ntstdio,"alloc err.\n");338 printf("alloc err.\n"); 453 339 goto cp_end; 454 340 } … … 460 346 local_buff = ff_memalloc(64); 461 347 if (local_buff == NULL) { 462 ntstdio_printf(&ntstdio,"alloc err.\n");348 printf("alloc err.\n"); 463 349 goto cp_end; 464 350 } … … 470 356 if (res != FR_OK) { 471 357 if (res == FR_NO_FILE) 472 ntstdio_printf(&ntstdio, "src no file.\n", res);358 printf("src no file.\n"); 473 359 else 474 ntstdio_printf(&ntstdio,"src stat err(%d).\n", res);360 printf("src stat err(%d).\n", res); 475 361 goto cp_end; 476 362 } … … 481 367 res = f_open(&src_fp, src_str_p, (FA_OPEN_EXISTING | FA_READ)); 482 368 if (res != FR_OK) { 483 ntstdio_printf(&ntstdio,"src open err(%d).\n", res);369 printf("src open err(%d).\n", res); 484 370 goto cp_end; 485 371 } … … 496 382 dst_mod_str_p = ff_memalloc(LFN_BUF_SIZE); 497 383 if (dst_mod_str_p == NULL) { 498 ntstdio_printf(&ntstdio,"alloc err.\n");384 printf("alloc err.\n"); 499 385 goto cp_end; 500 386 } 501 ntstdio_snprintf(dst_mod_str_p, LFN_BUF_SIZE, "%s/%s\0", dst_str_p, src_basename_p);387 snprintf(dst_mod_str_p, LFN_BUF_SIZE, "%s/%s\0", dst_str_p, src_basename_p); 502 388 dst_str_p = dst_mod_str_p; 503 389 } 504 390 else { 505 ntstdio_printf(&ntstdio,"dst file exists.\n");391 printf("dst file exists.\n"); 506 392 goto cp_end_1; 507 393 } 508 394 } 509 395 else { 510 ntstdio_printf(&ntstdio,"src stat err(%d).\n", res);396 printf("src stat err(%d).\n", res); 511 397 goto cp_end_1; 512 398 } … … 514 400 res = f_open(&dst_fp, dst_str_p, (FA_CREATE_NEW | FA_WRITE)); 515 401 if (res != FR_OK) { 516 ntstdio_printf(&ntstdio,"dst open err(%d).\n", res);402 printf("dst open err(%d).\n", res); 517 403 goto cp_end_1; 518 404 } … … 525 411 res = f_read(&src_fp, local_buff, sizeof(local_buff), &read_size); 526 412 if (res != FR_OK) { 527 ntstdio_printf(&ntstdio,"src read err(%d).\n", res);413 printf("src read err(%d).\n", res); 528 414 goto cp_end_2; 529 415 } … … 532 418 res = f_write(&dst_fp, local_buff, read_size, &write_size); 533 419 if (res != FR_OK) { 534 ntstdio_printf(&ntstdio,"dst write err(%d).\n", res);420 printf("dst write err(%d).\n", res); 535 421 goto cp_end_2; 536 422 } 537 423 if (read_size != write_size) { 538 ntstdio_printf(&ntstdio, "dst write err(disk full).\n", res);424 printf("dst write err(disk full).\n"); 539 425 goto cp_end_2; 540 426 } … … 622 508 unsigned int op_offset = 0, op_size = 0, op_end = 0; 623 509 624 while ((op = musl_getopt(argc, argv, "hduos0123456789xX")) != -1) {510 while ((op = getopt(argc, argv, "hduos0123456789xX")) != -1) { 625 511 switch (op) { 626 512 case 'h': /* help */ 627 ntstdio_printf(&ntstdio," hexdump [OPTION] file\n");628 ntstdio_printf(&ntstdio," -h : help\n");629 ntstdio_printf(&ntstdio," -d : print all byte with convert and color [in character area] (default)\n");630 ntstdio_printf(&ntstdio," -u : try print UTF-8 code [in character area]\n");631 ntstdio_printf(&ntstdio," -oOFFSET : print start offset address from top\n");632 ntstdio_printf(&ntstdio," -sSIZE : print size\n");513 printf(" hexdump [OPTION] file\n"); 514 printf(" -h : help\n"); 515 printf(" -d : print all byte with convert and color [in character area] (default)\n"); 516 printf(" -u : try print UTF-8 code [in character area]\n"); 517 printf(" -oOFFSET : print start offset address from top\n"); 518 printf(" -sSIZE : print size\n"); 633 519 break; 634 520 case 'd': /* print one byte character [in character area] (default) */ … … 661 547 /* position adjusting */ 662 548 if (op_offset >= fsrc.fsize) { 663 ntstdio_printf(&ntstdio, "error : input offset is bigger than file size(0x%X).\n", fsrc.fsize);549 printf("error : input offset is bigger than file size(0x%lX).\n", fsrc.fsize); 664 550 return 0; 665 551 } … … 674 560 char *pos = line; 675 561 int rst = sizeof(line); 676 int len = ntstdio_snprintf(pos, rst, "%08X: ", i);562 int len = snprintf(pos, rst, "%08X: ", i); 677 563 pos += len; 678 564 rst -= len; … … 693 579 char c = data[j]; 694 580 if (j != 7) 695 len = ntstdio_snprintf(pos, rst, "%02X ", c);581 len = snprintf(pos, rst, "%02X ", c); 696 582 else 697 len = ntstdio_snprintf(pos, rst, "%02X-", c);583 len = snprintf(pos, rst, "%02X-", c); 698 584 pos += len; 699 585 rst -= len; … … 723 609 break; 724 610 if (j + k != 7) 725 len = ntstdio_snprintf(pos, rst, "%02X ", data[j + k]);611 len = snprintf(pos, rst, "%02X ", data[j + k]); 726 612 else 727 len = ntstdio_snprintf(pos, rst, "%02X-", data[j + k]);613 len = snprintf(pos, rst, "%02X-", data[j + k]); 728 614 pos += len; 729 615 rst -= len; … … 743 629 apos += len; 744 630 arst -= len; 745 len = ntstdio_snprintf(apos, arst, "\x1B[%dm%c\x1B[0m", CCOLOR_RESET, ' ');631 len = snprintf(apos, arst, "\x1B[%dm%c\x1B[0m", CCOLOR_RESET, ' '); 746 632 utf8_odd_bytes--; 747 633 } … … 763 649 c = '?'; 764 650 } 765 len = ntstdio_snprintf(apos, arst, "\x1B[%dm%c\x1B[0m", ccolor, c);651 len = snprintf(apos, arst, "\x1B[%dm%c\x1B[0m", ccolor, c); 766 652 } 767 653 … … 772 658 for (int j = br; j < 16; j++) { 773 659 if (j != 7) 774 len = ntstdio_snprintf(pos, rst, " ");660 len = snprintf(pos, rst, " "); 775 661 else 776 len = ntstdio_snprintf(pos, rst, " -");662 len = snprintf(pos, rst, " -"); 777 663 pos += len; 778 664 rst -= len; 779 665 } 780 666 781 len = ntstdio_snprintf(pos, rst, ": %s\n", ascii);667 len = snprintf(pos, rst, ": %s\n", ascii); 782 668 pos += len; 783 669 rst -= len; 784 670 785 ntstdio_puts(&ntstdio,line);671 puts(line); 786 672 } 787 673 … … 796 682 char buf[30]; 797 683 798 ret = shell_clock_gettime(CLOCK_REALTIME, &tp);684 ret = clock_gettime(CLOCK_REALTIME, &tp); 799 685 if (ret != 0) { 800 ntstdio_printf(&ntstdio,"clock_gettime error %d", ret);686 printf("clock_gettime error %d", ret); 801 687 return 0; 802 688 } … … 804 690 memset(buf, 0, sizeof(buf)); 805 691 if (ctime_r(&tp.tv_sec, buf) == NULL) { 806 ntstdio_printf(&ntstdio,"ctime_r error");692 printf("ctime_r error"); 807 693 return 0; 808 694 } … … 812 698 buf[ret - 1] = '\0'; 813 699 814 ntstdio_printf(&ntstdio, "%s .%09u\n", buf, tp.tv_nsec);700 printf("%s .%09ld\n", buf, tp.tv_nsec); 815 701 return 0; 816 702 } … … 819 705 { 820 706 if (argc != 2) { 821 ntstdio_printf(&ntstdio,"info sys\n");822 ntstdio_printf(&ntstdio,"info ver\n");707 printf("info sys\n"); 708 printf("info ver\n"); 823 709 return 0; 824 710 } 825 711 if (strcmp(argv[1], "sys") == 0) { 826 ntstdio_printf(&ntstdio,TARGET_NAME" Monitor\n");712 printf(TARGET_NAME" Monitor\n"); 827 713 return 0; 828 714 } … … 830 716 int mj, mn, bd; 831 717 ntshell_version(&mj, &mn, &bd); 832 ntstdio_printf(&ntstdio,"Version %d.%d.%d\n", mj, mn, bd);833 return 0; 834 } 835 ntstdio_printf(&ntstdio,"Unknown sub command found\n");718 printf("Version %d.%d.%d\n", mj, mn, bd); 719 return 0; 720 } 721 printf("Unknown sub command found\n"); 836 722 return -1; 837 723 } -
asp3_tinet_ecnl_rx/trunk/ntshell/ntshell/usrcmd.h
r340 r374 56 56 int usrcmd_exit(int argc, char **argv); 57 57 58 void shell_abort();59 void shell_exit(int exitcd);60 int shell_kill(int pid, int sig);61 62 58 #endif 63 59 -
asp3_tinet_ecnl_rx/trunk/ntshell/ntshell/util/ntstdio.h
r337 r374 78 78 int pos; 79 79 unsigned int option; 80 void *exinf; 80 81 } ntstdio_t; 81 82 -
asp3_tinet_ecnl_rx/trunk/ntshell/src/fdtable.c
r364 r374 68 68 #include "kernel_cfg.h" 69 69 #include <string.h> 70 71 #define IO_TYPE_FREE 0 72 #define IO_TYPE_SIO 1 73 #define IO_TYPE_FILE 2 74 #define IO_TYPE_DIR 3 75 #define IO_TYPE_TCP 4 76 #define IO_TYPE_UDP 5 77 78 static struct _IO_FILE fd_table[8 * sizeof(FLGPTN)] = { 79 { 0, IO_TYPE_SIO, 0, stdio_close, stdin_read, stdio_write, sio_seek, sio_ioctl }, 80 { 1, IO_TYPE_SIO, 0, stdio_close, stdio_read, stdout_write, sio_seek, sio_ioctl }, 81 { 2, IO_TYPE_SIO, 0, stdio_close, stdio_read, stderr_write, sio_seek, sio_ioctl }, 70 #include "util/ntstdio.h" 71 #include "hal/serial_api.h" 72 73 static int stdio_close(struct SHELL_FILE *fp); 74 static size_t stdio_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 75 static size_t stdio_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 76 static size_t stdin_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 77 static size_t stdout_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 78 static size_t stderr_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 79 static void stdio_delete(struct SHELL_FILE *fp); 80 81 static int sio_close(struct SHELL_FILE *fp); 82 static size_t sio_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 83 static size_t sio_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 84 static off_t sio_seek(struct SHELL_FILE *fp, off_t ofs, int org); 85 static int sio_ioctl(struct SHELL_FILE *fp, int req, void *arg); 86 static bool_t sio_readable(struct SHELL_FILE *fp); 87 static void sio_delete(struct SHELL_FILE *fp); 88 89 IO_TYPE IO_TYPE_STDIN = { stdio_close, stdin_read, stdio_write, sio_seek, sio_ioctl, sio_readable, stdio_delete }; 90 IO_TYPE IO_TYPE_STDOUT = { stdio_close, stdio_read, stdout_write, sio_seek, sio_ioctl, sio_readable, stdio_delete }; 91 IO_TYPE IO_TYPE_STDERR = { stdio_close, stdio_read, stderr_write, sio_seek, sio_ioctl, sio_readable, stdio_delete }; 92 IO_TYPE IO_TYPE_SIO = { sio_close, sio_read, sio_write, sio_seek, sio_ioctl, sio_readable, sio_delete }; 93 ntstdio_t ntstdio; 94 95 static struct SHELL_FILE fd_table[8 * sizeof(FLGPTN)] = { 96 { 0, &IO_TYPE_STDIN, 0, .exinf = &ntstdio }, 97 { 1, &IO_TYPE_STDOUT, 0, .exinf = &ntstdio }, 98 { 2, &IO_TYPE_STDERR, 0,.exinf = &ntstdio }, 82 99 }; 83 100 #define fd_table_count (sizeof(fd_table) / sizeof(fd_table[0])) 84 101 85 static int new_fd(int type, int id) 86 { 102 extern ntstdio_t ntstdio; 103 serial_t stdio_uart; 104 105 unsigned char ntstdio_xi(struct ntstdio_t *handle) 106 { 107 return serial_getc((serial_t *)handle->exinf); 108 } 109 110 void ntstdio_xo(struct ntstdio_t *handle, unsigned char c) 111 { 112 serial_putc((serial_t *)handle->exinf, c); 113 } 114 115 void sys_init(intptr_t exinf) 116 { 117 sys_tlsf_init(); 118 119 serial_init(&stdio_uart, STDIO_UART_TX, STDIO_UART_RX); 120 serial_baud(&stdio_uart, UART_BAUDRATE); 121 serial_format(&stdio_uart, 8, ParityNone, 1); 122 123 ntstdio_init(&ntstdio, NTSTDIO_OPTION_LINE_ECHO | NTSTDIO_OPTION_CANON | NTSTDIO_OPTION_LF_CRLF | NTSTDIO_OPTION_LF_CR, ntstdio_xi, ntstdio_xo); 124 ntstdio.exinf = (void *)&stdio_uart; 125 } 126 127 int stdio_close(struct SHELL_FILE *fp) 128 { 129 return -EPERM; 130 } 131 132 size_t stdio_read(struct SHELL_FILE *fp, unsigned char *data, size_t len) 133 { 134 return -EPERM; 135 } 136 137 size_t stdio_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len) 138 { 139 return -EPERM; 140 } 141 142 size_t stdin_read(struct SHELL_FILE *fp, unsigned char *data, size_t len) 143 { 144 int i = 0; 145 while (i < len) { 146 int c = ntstdio_getc((struct ntstdio_t *)fp->exinf); 147 data[i++] = c; 148 if ((c == EOF) || (c == '\n')) 149 break; 150 } 151 return i; 152 } 153 154 size_t stdout_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len) 155 { 156 for (int i = 0; i < len; i++) { 157 ntstdio_putc((struct ntstdio_t *)fp->exinf, data[i]); 158 } 159 return len; 160 } 161 162 size_t stderr_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len) 163 { 164 for (int i = 0; i < len; i++) { 165 ntstdio_putc((struct ntstdio_t *)fp->exinf, data[i]); 166 } 167 return len; 168 } 169 170 void stdio_delete(struct SHELL_FILE *fp) 171 { 172 } 173 174 int sio_close(struct SHELL_FILE *fp) 175 { 176 return -EPERM; 177 } 178 179 size_t sio_read(struct SHELL_FILE *fp, unsigned char *data, size_t len) 180 { 181 return -EPERM; 182 } 183 184 size_t sio_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len) 185 { 186 return -EPERM; 187 } 188 189 off_t sio_seek(struct SHELL_FILE *fp, off_t ofs, int org) 190 { 191 return -EPERM; 192 } 193 194 int sio_ioctl(struct SHELL_FILE *fp, int request, void *arg) 195 { 196 switch (request) { 197 case TIOCGWINSZ: 198 return 0; 199 case TCGETS: 200 return sio_tcgetattr(fp->fd, (struct termios *)arg); 201 case TCSETS + TCSANOW: 202 case TCSETS + TCSADRAIN: 203 case TCSETS + TCSAFLUSH: 204 return sio_tcsetattr(fp->fd, request - TCSETS, (const struct termios *)arg); 205 } 206 207 return -EINVAL; 208 } 209 210 bool_t sio_readable(struct SHELL_FILE *fp) 211 { 212 return fp->readevt_w != fp->readevt_r; 213 } 214 215 void sio_delete(struct SHELL_FILE *fp) 216 { 217 free((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf); 218 ((struct ntstdio_t *)fp->exinf)->exinf = NULL; 219 free((struct ntstdio_t *)fp->exinf); 220 fp->exinf = NULL; 221 } 222 223 struct SHELL_FILE *new_fp(IO_TYPE *type, int id, int writable) 224 { 225 struct SHELL_FILE *fp = NULL; 226 ER ret; 227 228 ret = wai_sem(SEM_FILEDESC); 229 if (ret < 0) { 230 syslog(LOG_ERROR, "wai_sem => %d", ret); 231 } 232 87 233 for (int fd = 3; fd < fd_table_count; fd++) { 88 struct _IO_FILE *fp = &fd_table[fd];89 if (fp->type != IO_TYPE_FREE)234 fp = &fd_table[fd]; 235 if (fp->type != NULL) 90 236 continue; 91 237 92 memset(fp, 0, sizeof(struct _IO_FILE));238 memset(fp, 0, sizeof(struct SHELL_FILE)); 93 239 fp->fd = fd; 94 240 fp->type = type; 95 241 fp->handle = id; 96 return fd; 97 } 98 99 return -ENOMEM; 100 } 101 102 static struct _IO_FILE *id_to_fd(int type, int id) 103 { 242 fp->writable = writable; 243 break; 244 } 245 246 ret = sig_sem(SEM_FILEDESC); 247 if (ret < 0) { 248 syslog(LOG_ERROR, "sig_sem => %d", ret); 249 } 250 251 return fp; 252 } 253 254 struct SHELL_FILE *id_to_fd(IO_TYPE *type, int id) 255 { 256 struct SHELL_FILE *fp = NULL; 257 ER ret; 258 259 ret = wai_sem(SEM_FILEDESC); 260 if (ret < 0) { 261 syslog(LOG_ERROR, "wai_sem => %d", ret); 262 } 263 104 264 for (int fd = 3; fd < fd_table_count; fd++) { 105 struct _IO_FILE *fp = &fd_table[fd];265 fp = &fd_table[fd]; 106 266 if ((fp->type == type) && (fp->handle == id)) 107 return fp; 108 } 109 110 return NULL; 111 } 112 113 static int delete_fd(int type, int id) 114 { 115 struct _IO_FILE *fp = id_to_fd(type, id); 267 break; 268 } 269 270 ret = sig_sem(SEM_FILEDESC); 271 if (ret < 0) { 272 syslog(LOG_ERROR, "sig_sem => %d", ret); 273 } 274 275 return fp; 276 } 277 278 int delete_fd_by_id(IO_TYPE *type, int id) 279 { 280 struct SHELL_FILE *fp = id_to_fd(type, id); 116 281 if (fp == NULL) 117 282 return -EBADF; … … 120 285 } 121 286 122 int delete_fp(struct _IO_FILE *fp) 123 { 124 free(fp->pfile); 125 fp->pfile = NULL; 126 free(fp->pdir); 127 fp->pdir = NULL; 128 free(fp->psock); 129 fp->psock = NULL; 130 memset(fp, 0, sizeof(struct _IO_FILE)); 287 int delete_fp(struct SHELL_FILE *fp) 288 { 289 ER ret; 290 291 fp->type->delete(fp); 292 293 ret = wai_sem(SEM_FILEDESC); 294 if (ret < 0) { 295 syslog(LOG_ERROR, "wai_sem => %d", ret); 296 } 297 298 memset(fp, 0, sizeof(struct SHELL_FILE)); 299 300 ret = sig_sem(SEM_FILEDESC); 301 if (ret < 0) { 302 syslog(LOG_ERROR, "sig_sem => %d", ret); 303 } 131 304 132 305 return 0; 133 306 } 134 307 135 struct _IO_FILE *fd_to_fp(int fd)308 struct SHELL_FILE *fd_to_fp(int fd) 136 309 { 137 310 if ((fd < 0) || (fd >= fd_table_count)) … … 140 313 } 141 314 142 struct _IO_FILE *new_sio_fd(int sioid) 143 { 144 int fd = new_fd(IO_TYPE_SIO, sioid); 145 if ((fd < 0) || (fd >= fd_table_count)) 146 return NULL; 147 148 struct _IO_FILE *fp = &fd_table[fd]; 149 fp->close = sio_close; 150 fp->read = sio_read; 151 fp->write = sio_write; 152 fp->seek = sio_seek; 153 fp->ioctl = sio_ioctl; 154 fp->writable = 1; 155 156 return fp; 157 } 158 159 int delete_sio_fd(int sioid) 160 { 161 return delete_fd(IO_TYPE_SIO, sioid); 162 } 163 164 struct _IO_FILE *sioid_to_fd(int sioid) 165 { 166 return id_to_fd(IO_TYPE_SIO, sioid); 167 } 168 169 struct _IO_FILE *new_file_fd(int fileid) 170 { 171 int fd = new_fd(IO_TYPE_FILE, fileid); 172 if ((fd < 0) || (fd >= fd_table_count)) 173 return NULL; 174 175 struct _IO_FILE *fp = &fd_table[fd]; 176 fp->close = file_close; 177 fp->read = file_read; 178 fp->write = file_write; 179 fp->seek = file_seek; 180 fp->ioctl = file_ioctl; 181 fp->writable = 1; 182 fp->pfile = malloc(sizeof(FIL)); 183 memset(fp->pfile, 0, sizeof(FIL)); 184 185 return fp; 186 } 187 188 int delete_file_fd(int fileid) 189 { 190 return delete_fd(IO_TYPE_FILE, fileid); 191 } 192 193 struct _IO_FILE *fileid_to_fd(int fileid) 194 { 195 return id_to_fd(IO_TYPE_FILE, fileid); 196 } 197 198 struct _IO_FILE *new_dir_fd(int fileid) 199 { 200 int fd = new_fd(IO_TYPE_DIR, fileid); 201 if ((fd < 0) || (fd >= fd_table_count)) 202 return NULL; 203 204 struct _IO_FILE *fp = &fd_table[fd]; 205 fp->close = dir_close; 206 fp->read = dir_read; 207 fp->write = dir_write; 208 fp->seek = dir_seek; 209 fp->ioctl = dir_ioctl; 210 fp->writable = 0; 211 fp->pdir = malloc(sizeof(struct _IO_DIR)); 212 memset(fp->pdir, 0, sizeof(struct _IO_DIR)); 213 214 return fp; 215 } 216 217 int delete_dir_fd(int dirid) 218 { 219 return delete_fd(IO_TYPE_DIR, dirid); 220 } 221 222 struct _IO_FILE *dirid_to_fd(int dirid) 223 { 224 return id_to_fd(IO_TYPE_DIR, dirid); 225 } 226 227 #ifndef NTSHELL_NO_SOCKET 228 struct _IO_FILE *new_tcp_fd(int tcpid) 229 { 230 int fd = new_fd(IO_TYPE_TCP, tcpid); 231 if ((fd < 0) || (fd >= fd_table_count)) 232 return NULL; 233 234 struct _IO_FILE *fp = &fd_table[fd]; 235 fp->close = tcp_fd_close; 236 fp->read = tcp_fd_read; 237 fp->write = tcp_fd_write; 238 fp->seek = tcp_fd_seek; 239 fp->ioctl = tcp_fd_ioctl; 240 fp->writable = 0; 241 fp->psock = malloc(sizeof(socket_t)); 242 memset(fp->psock, 0, sizeof(socket_t)); 243 244 return fp; 245 } 246 247 int delete_tcp_fd(int tcpid) 248 { 249 return delete_fd(IO_TYPE_TCP, tcpid); 250 } 251 252 struct _IO_FILE *tcpid_to_fd(int tcpid) 253 { 254 return id_to_fd(IO_TYPE_TCP, tcpid); 255 } 256 257 struct _IO_FILE *new_udp_fd(int udpid) 258 { 259 int fd = new_fd(IO_TYPE_UDP, udpid); 260 if ((fd < 0) || (fd >= fd_table_count)) 261 return NULL; 262 263 struct _IO_FILE *fp = &fd_table[fd]; 264 fp->close = udp_fd_close; 265 fp->read = udp_fd_read; 266 fp->write = udp_fd_write; 267 fp->seek = udp_fd_seek; 268 fp->ioctl = udp_fd_ioctl; 269 fp->writable = 1; 270 fp->psock = malloc(sizeof(socket_t)); 271 memset(fp->psock, 0, sizeof(socket_t)); 272 273 return fp; 274 } 275 276 int delete_udp_fd(int udpid) 277 { 278 return delete_fd(IO_TYPE_UDP, udpid); 279 } 280 281 struct _IO_FILE *udpid_to_fd(int udpid) 282 { 283 return id_to_fd(IO_TYPE_UDP, udpid); 284 } 285 286 #endif 287 288 void memor(void *dst, void *src, size_t len) 315 void memand(void *dst, void *src, size_t len) 289 316 { 290 317 uint8_t *d = (uint8_t *)dst; … … 293 320 294 321 while (s < e) { 295 *d++ |= *s++;322 *d++ &= *s++; 296 323 } 297 324 } … … 336 363 337 364 ret = shell_get_evts(&evts, tmout); 338 if (rfds != NULL)339 memset(rfds, 0, sizeof(fd_set));340 if (wfds != NULL)341 memset(wfds, 0, sizeof(fd_set));342 if (efds != NULL)343 memset(efds, 0, sizeof(fd_set));344 365 if (ret == E_OK) { 345 366 if (rfds != NULL) 346 mem or(rfds, &evts.readfds, sizeof(fd_set));367 memand(rfds, &evts.readfds, sizeof(fd_set)); 347 368 if (wfds != NULL) 348 mem or(wfds, &evts.writefds, sizeof(fd_set));369 memand(wfds, &evts.writefds, sizeof(fd_set)); 349 370 if (efds != NULL) 350 mem or(efds, &evts.errorfds, sizeof(fd_set));371 memand(efds, &evts.errorfds, sizeof(fd_set)); 351 372 return evts.count; 352 373 } 353 374 if (ret == E_TMOUT) { 375 if (rfds != NULL) 376 memset(rfds, 0, sizeof(fd_set)); 377 if (wfds != NULL) 378 memset(wfds, 0, sizeof(fd_set)); 379 if (efds != NULL) 380 memset(efds, 0, sizeof(fd_set)); 354 381 return 0; 355 382 } … … 419 446 { 420 447 int fd = STDIN_FILENO; 421 struct _IO_FILE *fp = &fd_table[fd]; 422 T_SERIAL_RPOR rpor; 448 struct SHELL_FILE *fp = &fd_table[fd]; 423 449 FLGPTN flgptn = 0; 424 450 425 ER ret = serial_ref_por(SIO_PORTID, &rpor); 426 if (ret != E_OK) 427 return; 428 429 if (rpor.reacnt != 0) { 451 if (serial_readable((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf)) { 430 452 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 431 453 432 454 FD_SET(fd, (fd_set *)&flgptn); 433 455 } 434 if ( rpor.wricnt != 0) {456 if (serial_writable((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf)) { 435 457 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++; 436 458 … … 447 469 { 448 470 int fd = STDIN_FILENO; 449 struct _IO_FILE *fp = &fd_table[fd]; 450 T_SERIAL_RPOR rpor; 471 struct SHELL_FILE *fp = &fd_table[fd]; 451 472 *flgptn = 0; 452 473 453 ER ret = serial_ref_por(SIO_PORTID, &rpor); 454 if (ret != E_OK) 455 return; 456 457 if (rpor.reacnt != 0) { 474 if (serial_readable((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf)) { 458 475 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 459 476 460 477 FD_SET(fd, (fd_set *)flgptn); 461 478 } 462 if ( rpor.wricnt != 0) {479 if (serial_writable((serial_t *)((struct ntstdio_t *)fp->exinf)->exinf)) { 463 480 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++; 464 481 … … 466 483 } 467 484 } 468 469 #ifndef NTSHELL_NO_SOCKET470 471 ER socket_tcp_callback(ID cepid, FN fncd, void *p_parblk)472 {473 struct _IO_FILE *fp = tcpid_to_fd(cepid);474 FLGPTN flgptn = 0;475 ER ret;476 int len;477 478 if (fp == NULL)479 return E_PAR;480 481 int fd = fp->fd;482 FD_SET(fd, (fd_set *)&flgptn);483 484 switch (fncd) {485 case TFN_TCP_RCV_BUF:486 len = *(int *)p_parblk;487 if (len <= 0)488 return E_OK;489 490 ret = wai_sem(SEM_FILEDESC);491 if (ret < 0) {492 syslog(LOG_ERROR, "wai_sem => %d", ret);493 }494 fp->psock->len += len;495 ret = sig_sem(SEM_FILEDESC);496 if (ret < 0) {497 syslog(LOG_ERROR, "sig_sem => %d", ret);498 }499 500 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;501 502 set_flg(FLG_SELECT_WAIT, flgptn);503 return E_OK;504 505 case TFN_TCP_RCV_DAT:506 len = *(int *)p_parblk;507 if (len <= 0)508 return E_OK;509 510 ret = wai_sem(SEM_FILEDESC);511 if (ret < 0) {512 syslog(LOG_ERROR, "wai_sem => %d", ret);513 }514 fp->psock->len += len;515 ret = sig_sem(SEM_FILEDESC);516 if (ret < 0) {517 syslog(LOG_ERROR, "sig_sem => %d", ret);518 }519 520 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;521 522 set_flg(FLG_SELECT_WAIT, flgptn);523 return E_OK;524 525 case TFN_TCP_SND_DAT:526 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++;527 528 set_flg(FLG_SELECT_WAIT, flgptn);529 return E_OK;530 531 case TFN_TCP_CAN_CEP:532 if (fp->errorevt_w == fp->errorevt_r) fp->errorevt_w++;533 534 set_flg(FLG_SELECT_WAIT, flgptn);535 return E_OK;536 537 case TFN_TCP_DEL_REP:538 delete_tcp_rep(cepid);539 return E_OK;540 541 case TFN_TCP_DEL_CEP:542 delete_tcp_fd(cepid);543 return E_OK;544 545 default:546 return E_OK;547 }548 }549 550 ER socket_udp_callback(ID cepid, FN fncd, void *p_parblk)551 {552 struct _IO_FILE *fp = udpid_to_fd(cepid);553 FLGPTN flgptn = 0;554 int len;555 556 if (fp == NULL)557 return E_PAR;558 559 int fd = fp->fd;560 FD_SET(fd, (fd_set *)&flgptn);561 562 switch (fncd) {563 case TEV_UDP_RCV_DAT:564 {565 T_UDP_RCV_DAT_PARA *udppara = (T_UDP_RCV_DAT_PARA *)p_parblk;566 len = udppara->len;567 if (len <= 0)568 return E_OK;569 570 ER ret = wai_sem(SEM_FILEDESC);571 if (ret < 0) {572 syslog(LOG_ERROR, "wai_sem => %d", ret);573 }574 fp->psock->len = len;575 if (fp->psock->input != NULL) {576 ret = rel_net_buf(fp->psock->input);577 if (ret < 0) {578 syslog(LOG_ERROR, "rel_net_buf => %d", ret);579 }580 }581 fp->psock->input = udppara->input;582 fp->psock->buf = GET_UDP_SDU(udppara->input, udppara->off);583 memset(&fp->psock->raddr4, 0, sizeof(fp->psock->raddr4));584 fp->psock->raddr4.sin_family = AF_INET;585 fp->psock->raddr4.sin_port = htons(udppara->rep4.portno);586 fp->psock->raddr4.sin_addr.s_addr = htonl(udppara->rep4.ipaddr);587 udppara->input->flags |= NB_FLG_NOREL_IFOUT;588 ret = sig_sem(SEM_FILEDESC);589 if (ret < 0) {590 syslog(LOG_ERROR, "sig_sem => %d", ret);591 }592 593 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;594 595 set_flg(FLG_SELECT_WAIT, flgptn);596 return E_OK;597 }598 case TFN_UDP_CRE_CEP:599 return E_OK;600 601 case TFN_UDP_RCV_DAT:602 len = *(int *)p_parblk;603 if (len <= 0)604 return E_OK;605 606 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++;607 608 set_flg(FLG_SELECT_WAIT, flgptn);609 return E_OK;610 611 case TFN_UDP_SND_DAT:612 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++;613 614 set_flg(FLG_SELECT_WAIT, flgptn);615 return E_OK;616 617 case TFN_UDP_CAN_CEP:618 if (fp->errorevt_w == fp->errorevt_r) fp->errorevt_w++;619 620 set_flg(FLG_SELECT_WAIT, flgptn);621 return E_OK;622 623 case TFN_UDP_DEL_CEP:624 delete_udp_fd(cepid);625 return E_OK;626 627 default:628 return E_OK;629 }630 }631 632 #endif633 485 634 486 ER shell_get_evts(struct fd_events *evts, TMO tmout) … … 642 494 ER ret; 643 495 FLGPTN waitptn, flgptn, readfds = 0, writefds = 0; 644 struct _IO_FILE *fp = NULL;496 struct SHELL_FILE *fp = NULL; 645 497 646 498 stdio_update_evts(); … … 656 508 #ifndef NTSHELL_NO_SOCKET 657 509 if (FD_ISSET(fd, &evts->readfds)) { 658 if ((fp->type == IO_TYPE_TCP) && (fp->psock->cepid != 0)) { 659 if (fp->psock->len == 0) { 660 ret = tcp_rcv_buf(fp->psock->cepid, &fp->psock->input, TMO_NBLK); 661 if ((ret != E_WBLK) && (ret != E_OBJ) && (ret < 0)) { 662 syslog(LOG_ERROR, "tcp_rcv_buf => %d", ret); 663 //return ret; 664 } 665 if (ret > 0) { 666 ret = wai_sem(SEM_FILEDESC); 667 if (ret < 0) { 668 syslog(LOG_ERROR, "wai_sem => %d", ret); 669 } 670 fp->psock->len += ret; 671 ret = sig_sem(SEM_FILEDESC); 672 if (ret < 0) { 673 syslog(LOG_ERROR, "sig_sem => %d", ret); 674 } 675 } 676 } 677 else ret = 1; 678 if (ret > 0) { 679 FD_SET(fd, (fd_set *)&readfds); 680 count++; 681 if (fp->readevt_w == fp->readevt_r) fp->readevt_r--; 682 } 683 } 684 else if ((fp->type == IO_TYPE_UDP) && (fp->psock->cepid != 0)) { 685 if (fp->psock->input != NULL) { 686 FD_SET(fd, (fd_set *)&readfds); 687 count++; 688 if (fp->readevt_w == fp->readevt_r) fp->readevt_r--; 689 } 510 if (fp->type->readable(fp)) { 511 FD_SET(fd, (fd_set *)&readfds); 512 count++; 513 if (fp->readevt_w == fp->readevt_r) fp->readevt_r--; 690 514 } 691 515 else { … … 786 610 void clean_fd() 787 611 { 788 struct _IO_FILE *fp = NULL;612 struct SHELL_FILE *fp = NULL; 789 613 for (int fd = 3; fd < fd_table_count; fd++) { 790 614 fp = &fd_table[fd]; … … 792 616 continue; 793 617 794 fp-> close(fp);618 fp->type->close(fp); 795 619 796 620 delete_fp(fp); … … 800 624 int shell_ioctl(int fd, int request, void *arg) 801 625 { 802 struct _IO_FILE *fp = fd_to_fp(fd);626 struct SHELL_FILE *fp = fd_to_fp(fd); 803 627 if (fp == NULL) 804 628 return -EBADF; 805 629 806 return fp-> ioctl(fp, request, arg);630 return fp->type->ioctl(fp, request, arg); 807 631 } 808 632 -
asp3_tinet_ecnl_rx/trunk/ntshell/src/io_stub.c
r337 r374 1 1 /* 2 2 * TOPPERS ECHONET Lite Communication Middleware 3 * 3 * 4 4 * Copyright (C) 2017 Cores Co., Ltd. Japan 5 * 5 * 6 6 * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ 7 7 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改 … … 26 26 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを 27 27 * 免責すること. 28 * 28 * 29 29 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お 30 30 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的 … … 32 32 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ 33 33 * の責任を負わない. 34 * 34 * 35 35 * @(#) $Id$ 36 36 */ … … 43 43 #include <sil.h> 44 44 #include <string.h> 45 #include "syssvc/serial.h" 45 46 #include "syssvc/syslog.h" 46 47 #include "socket_stub.h" … … 49 50 #include "core/ntlibc.h" 50 51 #include "kernel_cfg.h" 52 #include "target_syssvc.h" 51 53 52 54 int fresult2errno(FRESULT res) … … 77 79 } 78 80 79 int shell_open(const char * path, int flags, void *arg) 80 { 81 FRESULT res; 82 struct _IO_FILE *fp; 81 static int file_close(struct SHELL_FILE *fp); 82 static size_t file_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 83 static size_t file_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 84 static off_t file_seek(struct SHELL_FILE *fp, off_t ofs, int org); 85 static int file_ioctl(struct SHELL_FILE *fp, int req, void *arg); 86 static bool_t file_readable(struct SHELL_FILE *fp); 87 static void file_delete(struct SHELL_FILE *fp); 88 89 static int dir_close(struct SHELL_FILE *fp); 90 static size_t dir_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 91 static size_t dir_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 92 static off_t dir_seek(struct SHELL_FILE *fp, off_t ofs, int org); 93 static int dir_ioctl(struct SHELL_FILE *fp, int req, void *arg); 94 static bool_t dir_readable(struct SHELL_FILE *fp); 95 static void dir_delete(struct SHELL_FILE *fp); 96 97 IO_TYPE IO_TYPE_FILE = { file_close, file_read, file_write, file_seek, file_ioctl, file_readable, file_delete }; 98 IO_TYPE IO_TYPE_DIR = { dir_close, dir_read, dir_write, dir_seek, dir_ioctl, dir_readable, dir_delete }; 99 100 int shell_open(const char *path, int flags, void *arg) 101 { 102 FRESULT res; 103 struct SHELL_FILE *fp; 83 104 84 105 if (flags & O_DIRECTORY) { 85 fp = new_ dir_fd(0);106 fp = new_fp(&IO_TYPE_DIR, 0, 0); 86 107 if (fp == NULL) 87 108 return -ENOMEM; 88 109 89 DIR *dir = &fp->pdir->dir; 110 fp->exinf = malloc(sizeof(struct SHELL_DIR)); 111 memset(fp->exinf, 0, sizeof(struct SHELL_DIR)); 112 113 FATFS_DIR *dir = &((struct SHELL_DIR *)fp->exinf)->dir; 90 114 FRESULT res; 91 115 if ((res = f_opendir(dir, path)) != FR_OK) { … … 95 119 } 96 120 97 fp = new_f ile_fd(0);121 fp = new_fp(&IO_TYPE_FILE, 0, 1); 98 122 if (fp == NULL) 99 123 return -ENOMEM; 124 125 fp->exinf = malloc(sizeof(FIL)); 126 memset(fp->exinf, 0, sizeof(FIL)); 100 127 101 128 BYTE fmd = 0; … … 133 160 } 134 161 135 if ((res = f_open( fp->pfile, path, fmd)) == FR_OK) {162 if ((res = f_open((FIL *)fp->exinf, path, fmd)) == FR_OK) { 136 163 fp->handle = fp->fd; 137 164 return fp->fd; … … 141 168 } 142 169 143 int file_close(struct _IO_FILE *fp)144 { 145 FRESULT res; 146 147 if ((res = f_close( fp->pfile)) == FR_OK) {170 int file_close(struct SHELL_FILE *fp) 171 { 172 FRESULT res; 173 174 if ((res = f_close((FIL *)fp->exinf)) == FR_OK) { 148 175 return 0; 149 176 } … … 152 179 } 153 180 154 size_t file_read(struct _IO_FILE *fp, unsigned char *data, size_t len)181 size_t file_read(struct SHELL_FILE *fp, unsigned char *data, size_t len) 155 182 { 156 183 unsigned int ret = 0; 157 184 FRESULT res; 158 185 159 if ((res = f_read( fp->pfile, data, len, &ret)) != FR_OK)186 if ((res = f_read((FIL *)fp->exinf, data, len, &ret)) != FR_OK) 160 187 return -EIO; 161 188 … … 163 190 } 164 191 165 size_t file_write(struct _IO_FILE *fp, const unsigned char *data, size_t len)192 size_t file_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len) 166 193 { 167 194 unsigned int ret = 0; 168 195 FRESULT res; 169 196 170 if ((res = f_write( fp->pfile, data, len, &ret)) != FR_OK)197 if ((res = f_write((FIL *)fp->exinf, data, len, &ret)) != FR_OK) 171 198 return -EIO; 172 199 … … 174 201 } 175 202 176 off_t file_seek(struct _IO_FILE *fp, off_t ptr, int dir)203 off_t file_seek(struct SHELL_FILE *fp, off_t ptr, int dir) 177 204 { 178 205 switch (dir) { … … 191 218 192 219 FRESULT res; 193 if ((res = f_seek( fp->pfile, ptr, dir)) != FR_OK)220 if ((res = f_seek((FIL *)fp->exinf, ptr, dir)) != FR_OK) 194 221 return -EIO; 195 222 196 return fp->pfile->fptr;197 } 198 199 int file_ioctl(struct _IO_FILE *fp, int req, void *arg)223 return ((FIL *)fp->exinf)->fptr; 224 } 225 226 int file_ioctl(struct SHELL_FILE *fp, int req, void *arg) 200 227 { 201 228 DRESULT res; 202 229 203 if ((res = disk_ioctl( fp->pfile->fs->drv, req, arg) != RES_OK))230 if ((res = disk_ioctl(((FIL *)fp->exinf)->fs->drv, req, arg) != RES_OK)) 204 231 return -EINVAL; 205 232 … … 207 234 } 208 235 236 bool_t file_readable(struct SHELL_FILE *fp) 237 { 238 return fp->readevt_w != fp->readevt_r; 239 } 240 241 void file_delete(struct SHELL_FILE *fp) 242 { 243 free((FIL *)fp->exinf); 244 fp->exinf = NULL; 245 } 246 209 247 int shell_close(int fd) 210 248 { 211 struct _IO_FILE *fp = fd_to_fp(fd);212 if (fp == NULL) 213 return -EBADF; 214 215 int ret = fp-> close(fp);249 struct SHELL_FILE *fp = fd_to_fp(fd); 250 if (fp == NULL) 251 return -EBADF; 252 253 int ret = fp->type->close(fp); 216 254 217 255 delete_fp(fp); … … 222 260 ssize_t shell_read(int fd, void *data, size_t len) 223 261 { 224 struct _IO_FILE *fp = fd_to_fp(fd);225 if (fp == NULL) 226 return -EBADF; 227 228 return fp-> read(fp, (unsigned char *)data, len);262 struct SHELL_FILE *fp = fd_to_fp(fd); 263 if (fp == NULL) 264 return -EBADF; 265 266 return fp->type->read(fp, (unsigned char *)data, len); 229 267 } 230 268 … … 232 270 { 233 271 int result = 0; 234 struct _IO_FILE *fp = fd_to_fp(fd);272 struct SHELL_FILE *fp = fd_to_fp(fd); 235 273 if (fp == NULL) 236 274 return -EBADF; … … 238 276 const struct iovec *end = &iov[iovcnt]; 239 277 for (; iov < end; iov++) { 240 result += fp-> read(fp, (unsigned char *)iov->iov_base, iov->iov_len);278 result += fp->type->read(fp, (unsigned char *)iov->iov_base, iov->iov_len); 241 279 } 242 280 … … 246 284 ssize_t shell_write(int fd, const void *data, size_t len) 247 285 { 248 struct _IO_FILE *fp = fd_to_fp(fd);249 if (fp == NULL) 250 return -EBADF; 251 252 return fp-> write(fp, (unsigned char *)data, len);286 struct SHELL_FILE *fp = fd_to_fp(fd); 287 if (fp == NULL) 288 return -EBADF; 289 290 return fp->type->write(fp, (unsigned char *)data, len); 253 291 } 254 292 … … 256 294 { 257 295 int result = 0; 258 struct _IO_FILE *fp = fd_to_fp(fd);296 struct SHELL_FILE *fp = fd_to_fp(fd); 259 297 if (fp == NULL) 260 298 return -EBADF; … … 262 300 const struct iovec *end = &iov[iovcnt]; 263 301 for (; iov < end; iov++) { 264 result += fp-> write(fp, (unsigned char *)iov->iov_base, iov->iov_len);302 result += fp->type->write(fp, (unsigned char *)iov->iov_base, iov->iov_len); 265 303 } 266 304 … … 270 308 int shell_llseek(int fd, off_t ptr, off_t *result, int dir) 271 309 { 272 struct _IO_FILE *fp = fd_to_fp(fd);273 if (fp == NULL) 274 return -EBADF; 275 276 off_t ret = fp-> seek(fp, ptr, dir);310 struct SHELL_FILE *fp = fd_to_fp(fd); 311 if (fp == NULL) 312 return -EBADF; 313 314 off_t ret = fp->type->seek(fp, ptr, dir); 277 315 if (ret < 0) 278 316 return ret; … … 284 322 int shell_fstat(int fd, struct stat * st) 285 323 { 286 struct _IO_FILE *fp = fd_to_fp(fd);324 struct SHELL_FILE *fp = fd_to_fp(fd); 287 325 if (fp == NULL) 288 326 return -EBADF; … … 296 334 int shell_fsync(int fd) 297 335 { 298 struct _IO_FILE *fp = fd_to_fp(fd);336 struct SHELL_FILE *fp = fd_to_fp(fd); 299 337 if (fp == NULL) 300 338 return -EBADF; … … 304 342 int shell_ftruncate(int fd, off_t length) 305 343 { 306 struct _IO_FILE *fp = fd_to_fp(fd);307 if (fp == NULL) 308 return -EBADF; 309 310 FRESULT res; 311 if ((res = f_truncate( fp->pfile)) != FR_OK)344 struct SHELL_FILE *fp = fd_to_fp(fd); 345 if (fp == NULL) 346 return -EBADF; 347 348 FRESULT res; 349 if ((res = f_truncate((FIL *)fp->exinf)) != FR_OK) 312 350 return fresult2errno(res); 313 351 … … 320 358 } 321 359 360 extern IO_TYPE IO_TYPE_SIO; 361 322 362 int sio_tcgetattr(int fd, struct termios *termios) 323 363 { 324 extern ntstdio_t ntstdio; 325 326 if (fd == STDIN_FILENO) { 327 memset(termios, 0, sizeof(*termios)); 328 329 if (ntstdio.option & NTSTDIO_OPTION_LINE_ECHO) { 330 termios->c_lflag |= ECHO; 364 struct SHELL_FILE *fp = fd_to_fp(fd); 365 if ((fp == NULL) || (fp->type != &IO_TYPE_SIO)) 366 return -EBADF; 367 368 ntstdio_t *ntstdio = (ntstdio_t *)fp->exinf; 369 370 memset(termios, 0, sizeof(*termios)); 371 372 if (ntstdio->option & NTSTDIO_OPTION_LINE_ECHO) { 373 termios->c_lflag |= ECHO; 374 } 375 else { 376 termios->c_lflag &= ~ECHO; 377 } 378 if (ntstdio->option & NTSTDIO_OPTION_CANON) { 379 termios->c_lflag |= ICANON; 380 } 381 else { 382 termios->c_lflag &= ~ICANON; 383 } 384 if (ntstdio->option & NTSTDIO_OPTION_LF_CR) { 385 termios->c_iflag |= INLCR; 386 } 387 else { 388 termios->c_iflag &= ~INLCR; 389 } 390 if (ntstdio->option & NTSTDIO_OPTION_LF_CRLF) { 391 termios->c_oflag |= ONLCR; 392 } 393 else { 394 termios->c_oflag &= ~ONLCR; 395 } 396 397 return 0; 398 } 399 400 int sio_tcsetattr(int fd, int optional_actions, const struct termios *termios) 401 { 402 struct SHELL_FILE *fp = fd_to_fp(fd); 403 if ((fp == NULL) || (fp->type != &IO_TYPE_SIO)) 404 return -EBADF; 405 406 ntstdio_t *ntstdio = (ntstdio_t *)fp->exinf; 407 408 if (optional_actions == TCSANOW) { 409 if (termios->c_lflag & ECHO) { 410 ntstdio->option |= NTSTDIO_OPTION_LINE_ECHO; 331 411 } 332 412 else { 333 termios->c_lflag &= ~ECHO;334 } 335 if ( ntstdio.option & NTSTDIO_OPTION_CANON) {336 termios->c_lflag |= ICANON;413 ntstdio->option &= ~NTSTDIO_OPTION_LINE_ECHO; 414 } 415 if (termios->c_lflag & ICANON) { 416 ntstdio->option |= NTSTDIO_OPTION_CANON; 337 417 } 338 418 else { 339 termios->c_lflag &= ~ICANON;340 } 341 if ( ntstdio.option & NTSTDIO_OPTION_LF_CR) {342 termios->c_iflag |= INLCR;419 ntstdio->option &= ~NTSTDIO_OPTION_CANON; 420 } 421 if (termios->c_iflag & INLCR) { 422 ntstdio->option |= NTSTDIO_OPTION_LF_CR; 343 423 } 344 424 else { 345 termios->c_iflag &= ~INLCR;346 } 347 if ( ntstdio.option & NTSTDIO_OPTION_LF_CRLF) {348 termios->c_oflag |= ONLCR;425 ntstdio->option &= ~NTSTDIO_OPTION_LF_CR; 426 } 427 if (termios->c_oflag & ONLCR) { 428 ntstdio->option |= NTSTDIO_OPTION_LF_CRLF; 349 429 } 350 430 else { 351 termios->c_oflag &= ~ONLCR;431 ntstdio->option &= ~NTSTDIO_OPTION_LF_CRLF; 352 432 } 353 433 return 0; 354 434 } 355 shell_abort(); 356 return 0; 357 } 358 359 int sio_tcsetattr(int fd, int optional_actions, const struct termios *termios) 360 { 361 extern ntstdio_t ntstdio; 362 363 if ((fd == STDIN_FILENO) && (optional_actions == TCSANOW)) { 364 if (termios->c_lflag & ECHO) { 365 ntstdio.option |= NTSTDIO_OPTION_LINE_ECHO; 366 } 367 else { 368 ntstdio.option &= ~NTSTDIO_OPTION_LINE_ECHO; 369 } 370 if (termios->c_lflag & ICANON) { 371 ntstdio.option |= NTSTDIO_OPTION_CANON; 372 } 373 else { 374 ntstdio.option &= ~NTSTDIO_OPTION_CANON; 375 } 376 if (termios->c_iflag & INLCR) { 377 ntstdio.option |= NTSTDIO_OPTION_LF_CR; 378 } 379 else{ 380 ntstdio.option &= ~NTSTDIO_OPTION_LF_CR; 381 } 382 if (termios->c_oflag & ONLCR) { 383 ntstdio.option |= NTSTDIO_OPTION_LF_CRLF; 384 } 385 else { 386 ntstdio.option &= ~NTSTDIO_OPTION_LF_CRLF; 387 } 388 return 0; 389 } 435 390 436 shell_abort(); 391 437 return 0; … … 396 442 FILINFO fi; 397 443 FRESULT ret; 398 #if _USE_LFN399 static char lfn[ _MAX_LFN + 1]; /* Buffer to store the LFN */444 #if FF_USE_LFN 445 static char lfn[FF_MAX_LFN + 1]; /* Buffer to store the LFN */ 400 446 fi.lfname = lfn; 401 447 fi.lfsize = sizeof lfn; 402 448 #endif 403 449 if (strcmp(path, ".") == 0) { 404 char cwd[ _MAX_LFN];450 char cwd[FF_MAX_LFN]; 405 451 if ((ret = f_getcwd(cwd, sizeof(cwd))) != FR_OK) { 406 452 return fresult2errno(ret); … … 426 472 st->st_mtim.tv_nsec = 0; 427 473 st->st_mtim.tv_sec = fi.fdate + fi.ftime; 428 st->st_mode 474 st->st_mode = (S_IRUSR | S_IRGRP | S_IROTH); 429 475 st->st_mode |= (fi.fattrib & AM_RDO) ? 0 : (S_IWUSR | S_IWGRP | S_IWOTH); 430 476 st->st_mode |= (fi.fattrib & (AM_DIR | AM_VOL)) ? S_IFDIR : S_IFREG; … … 485 531 BYTE mask = AM_RDO | AM_SYS; // AM_ARC, AM_HID 486 532 487 if (mode & S_IREAD) {488 if ((mode & S_IWRITE) == 0) {533 if (mode & S_IREAD) { 534 if ((mode & S_IWRITE) == 0) { 489 535 attr |= AM_RDO; 490 536 } … … 494 540 } 495 541 496 if ((res = f_chmod(path, attr, mask)) != FR_OK) {542 if ((res = f_chmod(path, attr, mask)) != FR_OK) { 497 543 return fresult2errno(res); 498 544 } … … 507 553 BYTE mask = AM_RDO | AM_SYS; // AM_ARC, AM_HID 508 554 509 if (mode & S_IREAD) {510 if ((mode & S_IWRITE) == 0) {555 if (mode & S_IREAD) { 556 if ((mode & S_IWRITE) == 0) { 511 557 attr |= AM_RDO; 512 558 } … … 516 562 } 517 563 518 if ((res = f_chmod(path, attr, mask)) != FR_OK) {564 if ((res = f_chmod(path, attr, mask)) != FR_OK) { 519 565 return fresult2errno(res); 520 566 } … … 526 572 { 527 573 FRESULT ret; 528 if ((ret = f_getcwd(buf, size)) != FR_OK) {574 if ((ret = f_getcwd(buf, size)) != FR_OK) { 529 575 return NULL; 530 576 } … … 549 595 } 550 596 551 int dir_close(struct _IO_FILE *fp)552 { 553 FRESULT res; 554 if ((res = f_closedir(& fp->pdir->dir)) != FR_OK) {597 int dir_close(struct SHELL_FILE *fp) 598 { 599 FRESULT res; 600 if ((res = f_closedir(&((struct SHELL_DIR *)fp->exinf)->dir)) != FR_OK) { 555 601 return fresult2errno(res); 556 602 } … … 564 610 return -EINVAL; 565 611 566 struct _IO_FILE *fp = fd_to_fp(fd);612 struct SHELL_FILE *fp = fd_to_fp(fd); 567 613 if (fp == NULL) 568 614 return -EBADF; 569 615 570 616 FILINFO fno; 571 #if _USE_LFN572 static char lfn[ _MAX_LFN + 1]; /* Buffer to store the LFN */617 #if FF_USE_LFN 618 static char lfn[FF_MAX_LFN + 1]; /* Buffer to store the LFN */ 573 619 fno.lfname = lfn; 574 620 fno.lfsize = sizeof lfn; 575 621 #endif 576 622 FRESULT res; 577 if ((res = f_readdir(& fp->pdir->dir, &fno)) != FR_OK || fno.fname[0] == '\0') {623 if ((res = f_readdir(&((struct SHELL_DIR *)fp->exinf)->dir, &fno)) != FR_OK || fno.fname[0] == '\0') { 578 624 return fresult2errno(res); 579 625 } 580 626 581 627 memset(de, 0, sizeof(*de)); 582 #if _USE_LFN628 #if FF_USE_LFN 583 629 ntlibc_strlcpy(de->d_name, *fno.lfname ? fno.lfname : fno.fname, sizeof(de->d_name)); 584 630 #else … … 589 635 } 590 636 591 size_t dir_read(struct _IO_FILE *fp, unsigned char *data, size_t len)637 size_t dir_read(struct SHELL_FILE *fp, unsigned char *data, size_t len) 592 638 { 593 639 return -EPERM; 594 640 } 595 641 596 size_t dir_write(struct _IO_FILE *fp, const unsigned char *data, size_t len)642 size_t dir_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len) 597 643 { 598 644 return -EPERM; 599 645 } 600 646 601 off_t dir_seek(struct _IO_FILE *fp, off_t ptr, int dir)647 off_t dir_seek(struct SHELL_FILE *fp, off_t ptr, int dir) 602 648 { 603 649 FRESULT res; … … 607 653 608 654 if (ptr == 0) { 609 if ((res = f_rewinddir(& fp->pdir->dir)) != FR_OK) {655 if ((res = f_rewinddir(&((struct SHELL_DIR *)fp->exinf)->dir)) != FR_OK) { 610 656 return fresult2errno(res); 611 657 } … … 613 659 else { 614 660 FILINFO fno; 615 #if _USE_LFN616 static char lfn[ _MAX_LFN + 1]; /* Buffer to store the LFN */661 #if FF_USE_LFN 662 static char lfn[FF_MAX_LFN + 1]; /* Buffer to store the LFN */ 617 663 fno.lfname = lfn; 618 664 fno.lfsize = sizeof lfn; 619 665 #endif 620 if ((res = f_rewinddir(& fp->pdir->dir)) != FR_OK) {666 if ((res = f_rewinddir(&((struct SHELL_DIR *)fp->exinf)->dir)) != FR_OK) { 621 667 return fresult2errno(res); 622 668 } 623 669 624 670 for (int i = 0; i < ptr; i++) { 625 if ((res = f_readdir(& fp->pdir->dir, &fno)) != FR_OK || fno.fname[0] == '\0') {671 if ((res = f_readdir(&((struct SHELL_DIR *)fp->exinf)->dir, &fno)) != FR_OK || fno.fname[0] == '\0') { 626 672 return fresult2errno(res); 627 673 } … … 632 678 } 633 679 634 int dir_ioctl(struct _IO_FILE *fp, int req, void *arg)680 int dir_ioctl(struct SHELL_FILE *fp, int req, void *arg) 635 681 { 636 682 return -EINVAL; 683 } 684 685 bool_t dir_readable(struct SHELL_FILE *fp) 686 { 687 return fp->readevt_w != fp->readevt_r; 688 } 689 690 void dir_delete(struct SHELL_FILE *fp) 691 { 692 free((struct SHELL_DIR *)fp->exinf); 693 fp->exinf = NULL; 637 694 } 638 695 … … 687 744 { 688 745 //if ((addr >= (void *)&_HeapBase) && (addr + len < (void *)&_HeapLimit)) { 689 690 691 746 return 0; 747 //} 748 //return -1; 692 749 } 693 750 … … 697 754 static pool_t sys_pool; 698 755 699 void sys_ init(void)756 void sys_tlsf_init(void) 700 757 { 701 758 sys_tlsf = tlsf_create(&_HeapBase); -
asp3_tinet_ecnl_rx/trunk/ntshell/src/net_misc.c
r359 r374 60 60 #include "kernel_cfg.h" 61 61 #include "tinet_cfg.h" 62 #include "util/ntstdio.h" 63 64 extern ntstdio_t ntstdio; 62 #include <stdio.h> 65 63 66 64 T_DHCP4_CLI_CONTEXT *dhcp4_cli_initialize(ID tskid, ID cepid); … … 97 95 98 96 get_tid(&nc->tskid); 99 ntstdio_printf(&ntstdio,"[NET MISC:%d,%d] started.", nc->tskid, (ID)exinf);97 printf("[NET MISC:%d,%d] started.", nc->tskid, (ID)exinf); 100 98 101 99 /* 初期化 */ … … 105 103 ret = get_tim(&time); 106 104 if (ret != E_OK) { 107 ntstdio_printf(&ntstdio,"[NET MISC,%d] get_tim error: %7lu,%s",105 printf("[NET MISC,%d] get_tim error: %7lu,%s", 108 106 nc->cepid, time / SYSTIM_HZ, itron_strerror(ret)); 109 107 return; … … 119 117 error = tslp_tsk(timer); 120 118 if ((error != E_OK) && (error != E_TMOUT)) { 121 ntstdio_printf(&ntstdio,"[NET MISC,%d] tslp_tsk error: %s %d",119 printf("[NET MISC,%d] tslp_tsk error: %s %d", 122 120 nc->cepid, itron_strerror(error), timer); 123 121 break; … … 126 124 ret = get_tim(&time); 127 125 if (ret != E_OK) { 128 ntstdio_printf(&ntstdio,"[NET MISC,%d] get_tim error: %s",126 printf("[NET MISC,%d] get_tim error: %s", 129 127 nc->cepid, itron_strerror(ret)); 130 128 break; -
asp3_tinet_ecnl_rx/trunk/ntshell/src/netcmd.c
r364 r374 59 59 #include <netapp/resolver.h> 60 60 #include "core/ntlibc.h" 61 #include "util/ntstdio.h"61 #include <stdio.h> 62 62 #include "ntp_cli.h" 63 63 #include "kernel_cfg.h" 64 65 extern ntstdio_t ntstdio;66 64 67 65 #if defined(SUPPORT_INET6) … … 280 278 281 279 if ((line = lookup_ipaddr(&addr, line, apip)) == NULL) { 282 ntstdio_printf(&ntstdio,"[PING] unknown host.\n");280 printf("[PING] unknown host.\n"); 283 281 return 0; 284 282 } … … 299 297 #if defined(SUPPORT_INET4) 300 298 if (apip == API_PROTO_IPV6) { 301 ntstdio_printf(&ntstdio,"[PING6] size: %d, tmo: %d, host: %s\n", size, tmo, ipv62str(NULL, &addr));299 printf("[PING6] size: %d, tmo: %d, host: %s\n", size, tmo, ipv62str(NULL, &addr)); 302 300 ping6(&addr, (uint_t)tmo, (uint_t)size); 303 301 } 304 302 else { 305 303 addr4 = ntohl(addr.s6_addr32[3]); 306 ntstdio_printf(&ntstdio,"[PING4] size: %d, tmo: %d, host: %s\n", size, tmo, ip2str(NULL, &addr4));304 printf("[PING4] size: %d, tmo: %d, host: %s\n", size, tmo, ip2str(NULL, &addr4)); 307 305 ping4(&addr4, (uint_t)tmo, (uint_t)size); 308 306 } 309 307 #else /* of #if defined(SUPPORT_INET4) */ 310 ntstdio_printf(&ntstdio,"[PING6] size: %d, tmo: %d, host: %s\n", size, tmo, ipv62str(NULL, &addr));308 printf("[PING6] size: %d, tmo: %d, host: %s\n", size, tmo, ipv62str(NULL, &addr)); 311 309 ping6(&addr, (uint_t)tmo, (uint_t)size); 312 310 #endif /* of #if defined(SUPPORT_INET4) */ 313 311 #else /* of #if defined(SUPPORT_INET6) */ 314 ntstdio_printf(&ntstdio,"[PING4] size: %d, tmo: %d, host: %s\n", size, tmo, ip2str(NULL, &addr));312 printf("[PING4] size: %d, tmo: %d, host: %s\n", size, tmo, ip2str(NULL, &addr)); 315 313 ping4(&addr, (uint_t)tmo, (uint_t)size); 316 314 #endif /* of #if defined(SUPPORT_INET6) */ … … 331 329 pos = str_ipv4addr(temp, sizeof(temp), &svaddr, 0); 332 330 temp[pos] = '\0'; 333 ntstdio_printf(&ntstdio,"DHCPv4 server: %s,\n", temp);334 ntstdio_printf(&ntstdio," Renew: %u:%02u:%02u,\n",331 printf("DHCPv4 server: %s,\n", temp); 332 printf(" Renew: %u:%02u:%02u,\n", 335 333 renew / 3600, (renew / 60) % 60, renew % 60); 336 ntstdio_printf(&ntstdio," Rebind: %u:%02u:%02u, Expire: %u:%02u:%02u.\n",334 printf(" Rebind: %u:%02u:%02u, Expire: %u:%02u:%02u.\n", 337 335 rebind / 3600, (rebind / 60) % 60, rebind % 60, 338 336 expire / 3600, (expire / 60) % 60, expire % 60); 339 337 } 340 338 else if (ret == E_OBJ) 341 ntstdio_printf(&ntstdio,"DHCPv4 server: not available.\n");339 printf("DHCPv4 server: not available.\n"); 342 340 } 343 341 … … 351 349 if (ntlibc_strcmp(argv[1], "rel") == 0) { 352 350 ret = dhcp4c_rel_info(); 353 ntstdio_printf(&ntstdio,"dhcp4c_rel_info %d\n", ret);351 printf("dhcp4c_rel_info %d\n", ret); 354 352 } 355 353 else if (ntlibc_strcmp(argv[1], "renew") == 0) { 356 354 ret = dhcp4c_renew_info(); 357 ntstdio_printf(&ntstdio,"dhcp4c_renew_info %d\n", ret);355 printf("dhcp4c_renew_info %d\n", ret); 358 356 } 359 357 else { … … 383 381 else { 384 382 for (c = 1; c <= *ptr; c++) 385 ntstdio_printf(&ntstdio,"%c", *(ptr + c));383 printf("%c", *(ptr + c)); 386 384 ptr += *ptr + 1; 387 385 if (*ptr) 388 ntstdio_printf(&ntstdio,".");386 printf("."); 389 387 } 390 388 } … … 406 404 return error; 407 405 408 ntstdio_printf(&ntstdio," mname: ");406 printf(" mname: "); 409 407 rn_offset = s_show_dns_domain_name(msg, offset); 410 ntstdio_putc(&ntstdio,'\n');411 ntstdio_printf(&ntstdio," rname: ");408 putchar('\n'); 409 printf(" rname: "); 412 410 s_show_dns_domain_name(msg, rn_offset); 413 ntstdio_putc(&ntstdio,'\n');414 415 ntstdio_printf(&ntstdio," serial: %d\n", soa.serial);416 ntstdio_printf(&ntstdio," refresh: %d\n", soa.refresh);417 ntstdio_printf(&ntstdio," retry: %d\n", soa.retry);418 ntstdio_printf(&ntstdio," expirel: %d\n", soa.expire);419 ntstdio_printf(&ntstdio," minimum: %d\n", soa.minimum);411 putchar('\n'); 412 413 printf(" serial: %d\n", soa.serial); 414 printf(" refresh: %d\n", soa.refresh); 415 printf(" retry: %d\n", soa.retry); 416 printf(" expirel: %d\n", soa.expire); 417 printf(" minimum: %d\n", soa.minimum); 420 418 421 419 return E_OK; … … 433 431 int scount; 434 432 435 ntstdio_printf(&ntstdio,"question section: %d\n", rslv->dns_hdr.qdcount);433 printf("question section: %d\n", rslv->dns_hdr.qdcount); 436 434 offset = rslv->qd_offset; 437 435 for (scount = 1; scount <= rslv->dns_hdr.qdcount; scount++) { … … 439 437 return error; 440 438 441 ntstdio_printf(&ntstdio,"%2d: ", scount);439 printf("%2d: ", scount); 442 440 s_show_dns_domain_name(msg, offset); 443 ntstdio_printf(&ntstdio,"\n type: %-4s, class: %2s\n", dns_strtype(qd.type), dns_strclass(qd.class));441 printf("\n type: %-4s, class: %2s\n", dns_strtype(qd.type), dns_strclass(qd.class)); 444 442 offset = error; 445 443 } … … 463 461 int pos; 464 462 465 ntstdio_printf(&ntstdio,"%10s section: %d\n", title, scount);463 printf("%10s section: %d\n", title, scount); 466 464 for (count = 1; count <= scount; count++) { 467 465 if ((error = dns_analyze_rr(&rr, offset, msg, length)) < 0) 468 466 return error; 469 467 470 ntstdio_printf(&ntstdio,"%2d: ", count);468 printf("%2d: ", count); 471 469 s_show_dns_domain_name(msg, offset); 472 ntstdio_printf(&ntstdio,"\n type: %-4s, class: %2s, TTL: %2d, len: %3d, offset: 0x%02x\n",470 printf("\n type: %-4s, class: %2s, TTL: %2d, len: %3d, offset: 0x%02x\n", 473 471 dns_strtype(rr.type), dns_strclass(rr.class), rr.ttl, rr.rdlength, rr.rdata_offset); 474 472 … … 479 477 pos = str_ipv4addr(temp, sizeof(temp), &in4_addr, 0); 480 478 temp[pos] = '\0'; 481 ntstdio_printf(&ntstdio," IPv4 addr: %s\n", temp);479 printf(" IPv4 addr: %s\n", temp); 482 480 break; 483 481 case DNS_TYPE_NS: 484 ntstdio_printf(&ntstdio," host: ");482 printf(" host: "); 485 483 s_show_dns_domain_name(msg, rr.rdata_offset); 486 ntstdio_putc(&ntstdio,'\n');484 putchar('\n'); 487 485 break; 488 486 case DNS_TYPE_CNAME: 489 ntstdio_printf(&ntstdio," host: ");487 printf(" host: "); 490 488 s_show_dns_domain_name(msg, rr.rdata_offset); 491 ntstdio_putc(&ntstdio,'\n');489 putchar('\n'); 492 490 break; 493 491 case DNS_TYPE_SOA: … … 495 493 break; 496 494 case DNS_TYPE_PTR: 497 ntstdio_printf(&ntstdio," PTR: ");495 printf(" PTR: "); 498 496 s_show_dns_domain_name(msg, rr.rdata_offset); 499 ntstdio_putc(&ntstdio,'\n');497 putchar('\n'); 500 498 break; 501 499 case DNS_TYPE_AAAA: … … 503 501 pos = str_ipv6addr(temp, sizeof(temp), &in6_addr, 0); 504 502 temp[pos] = '\0'; 505 ntstdio_printf(&ntstdio," IPv6 addr: %s\n", temp);503 printf(" IPv6 addr: %s\n", temp); 506 504 break; 507 505 default: 508 ntstdio_printf(&ntstdio," data: ");506 printf(" data: "); 509 507 col = 32; 510 508 for (dcount = 0; dcount < rr.rdlength; dcount++) { 511 ntstdio_printf(&ntstdio,"%02x", *(msg + rr.rdata_offset + dcount));509 printf("%02x", *(msg + rr.rdata_offset + dcount)); 512 510 if (--col == 0) { 513 ntstdio_printf(&ntstdio,"\n ");511 printf("\n "); 514 512 col = 32; 515 513 } 516 514 } 517 ntstdio_putc(&ntstdio,'\n');515 putchar('\n'); 518 516 break; 519 517 } … … 539 537 #if defined(SUPPORT_INET6) 540 538 541 ntstdio_printf(&ntstdio,"domain name: %s\n", dns_in6_get_dname());539 printf("domain name: %s\n", dns_in6_get_dname()); 542 540 543 541 #else /* of #if defined(SUPPORT_INET6) */ 544 542 545 ntstdio_printf(&ntstdio,"domain name: %s\n", dns_in4_get_dname());543 printf("domain name: %s\n", dns_in4_get_dname()); 546 544 547 545 #endif /* of #if defined(SUPPORT_INET6) */ … … 549 547 #if defined(SUPPORT_INET6) 550 548 dns_in6_get_addr(&in6_addr); 551 ntstdio_printf(&ntstdio,"IPv6 DNS server: ");549 printf("IPv6 DNS server: "); 552 550 if (IN6_IS_ADDR_UNSPECIFIED(&in6_addr)) 553 ntstdio_printf(&ntstdio,"not available.\n");551 printf("not available.\n"); 554 552 else { 555 553 pos = str_ipv6addr(temp, sizeof(temp), &in6_addr, 0); 556 554 temp[pos] = '\0'; 557 ntstdio_printf(&ntstdio,"%s.\n", temp);555 printf("%s.\n", temp); 558 556 } 559 557 #endif /* of #if defined(SUPPORT_INET6) */ … … 561 559 #if defined(SUPPORT_INET4) 562 560 dns_in4_get_addr(&in4_addr); 563 ntstdio_printf(&ntstdio,"IPv4 DNS server: ");561 printf("IPv4 DNS server: "); 564 562 if (in4_addr == IPV4_ADDRANY) 565 ntstdio_printf(&ntstdio,"not available.\n");563 printf("not available.\n"); 566 564 else { 567 565 pos = str_ipv4addr(temp, sizeof(temp), &in4_addr, 0); 568 566 temp[pos] = '\0'; 569 ntstdio_printf(&ntstdio,"%s.\n", temp);567 printf("%s.\n", temp); 570 568 } 571 569 #endif /* of #if defined(SUPPORT_INET4) */ … … 604 602 line = skip_blanks(resolv_options(&flags, line, DEFAULT_API_PROTO)); 605 603 if ((flags & (DNS_LUP_FLAGS_PROTO_IPV6 | DNS_LUP_FLAGS_PROTO_IPV4)) == 0) { 606 ntstdio_printf(&ntstdio,"DNS server not available.\n");604 printf("DNS server not available.\n"); 607 605 return 0; 608 606 } … … 620 618 621 619 if ((error = tget_mpf(MPF_RSLV_SRBUF, (void*)&msg, TMO_FEVR)) != E_OK) { 622 ntstdio_printf(&ntstdio,"get buffer error: %s.\n", itron_strerror(error));620 printf("get buffer error: %s.\n", itron_strerror(error)); 623 621 return 0; 624 622 } 625 623 626 624 if ((length = dns_lookup_host(flags | DNS_LUP_FLAGS_MSG, line, msg, DNS_UDP_MSG_LENGTH, &rslv)) < 0) { 627 // ntstdio_printf(&ntstdio,"error: %s.\n", itron_strerror(length));625 //printf("error: %s.\n", itron_strerror(length)); 628 626 goto err_ret; 629 627 } 630 628 631 629 dly_tsk(1 * 1000); 632 ntstdio_printf(&ntstdio,"DNS header: flags: ");630 printf("DNS header: flags: "); 633 631 if (rslv.dns_hdr.code & (DNS_QR_RESPONSE | DNS_AUTHORITATIVE | 634 632 DNS_TRUN_CATION | DNS_RECURSION_DESIRED | DNS_RECURSION_AVAILABLE)) { 635 ntstdio_printf(&ntstdio,(rslv.dns_hdr.code & DNS_QR_RESPONSE) ? "QR," : "");636 ntstdio_printf(&ntstdio,(rslv.dns_hdr.code & DNS_AUTHORITATIVE) ? "AA," : "");637 ntstdio_printf(&ntstdio,(rslv.dns_hdr.code & DNS_TRUN_CATION) ? "TC," : "");638 ntstdio_printf(&ntstdio,(rslv.dns_hdr.code & DNS_RECURSION_DESIRED) ? "RD," : "");639 ntstdio_printf(&ntstdio,(rslv.dns_hdr.code & DNS_RECURSION_AVAILABLE) ? "RA," : "");640 ntstdio_printf(&ntstdio," ");641 } 642 ntstdio_printf(&ntstdio,"opcode: ");643 ntstdio_printf(&ntstdio,(rslv.dns_hdr.code & DNS_OPCODE_REVERSE) ? "RV" : "FW");644 ntstdio_printf(&ntstdio,(rslv.dns_hdr.code & DNS_OPCODE_STATUS) ? ",ST" : "");645 ntstdio_printf(&ntstdio,", rcode: %s.\n",633 printf((rslv.dns_hdr.code & DNS_QR_RESPONSE) ? "QR," : ""); 634 printf((rslv.dns_hdr.code & DNS_AUTHORITATIVE) ? "AA," : ""); 635 printf((rslv.dns_hdr.code & DNS_TRUN_CATION) ? "TC," : ""); 636 printf((rslv.dns_hdr.code & DNS_RECURSION_DESIRED) ? "RD," : ""); 637 printf((rslv.dns_hdr.code & DNS_RECURSION_AVAILABLE) ? "RA," : ""); 638 printf(" "); 639 } 640 printf("opcode: "); 641 printf((rslv.dns_hdr.code & DNS_OPCODE_REVERSE) ? "RV" : "FW"); 642 printf((rslv.dns_hdr.code & DNS_OPCODE_STATUS) ? ",ST" : ""); 643 printf(", rcode: %s.\n", 646 644 (rslv.dns_hdr.code & DNS_RCODE_MASK) > DNS_RCODE_REFUSED 647 645 ? "6" : rcode_str[rslv.dns_hdr.code & DNS_RCODE_MASK]); 648 646 649 647 if ((offset = show_dns_qdsection(msg, length, &rslv)) < 0) { 650 ntstdio_printf(&ntstdio,"msg error: %s.\n", itron_strerror(offset));648 printf("msg error: %s.\n", itron_strerror(offset)); 651 649 } 652 650 if ((offset = show_dns_section(msg, length, rslv.dns_hdr.ancount, rslv.an_offset, "answer")) < 0) { 653 ntstdio_printf(&ntstdio,"msg error: %s.\n", itron_strerror(offset));651 printf("msg error: %s.\n", itron_strerror(offset)); 654 652 } 655 653 if ((offset = show_dns_section(msg, length, rslv.dns_hdr.nscount, rslv.ns_offset, "authority")) < 0) { 656 ntstdio_printf(&ntstdio,"msg error: %s.\n", itron_strerror(offset));654 printf("msg error: %s.\n", itron_strerror(offset)); 657 655 } 658 656 if ((offset = show_dns_section(msg, length, rslv.dns_hdr.arcount, rslv.ar_offset, "additional")) < 0) { 659 ntstdio_printf(&ntstdio,"msg error: %s.\n", itron_strerror(offset));657 printf("msg error: %s.\n", itron_strerror(offset)); 660 658 } 661 659 662 660 err_ret: 663 661 if ((error = rel_mpf(MPF_RSLV_SRBUF, msg)) != E_OK) 664 ntstdio_printf(&ntstdio,"release buffer error: %s.\n", itron_strerror(error));662 printf("release buffer error: %s.\n", itron_strerror(error)); 665 663 return 0; 666 664 } -
asp3_tinet_ecnl_rx/trunk/ntshell/src/ntp_cli.c
r364 r374 50 50 #include <t_syslog.h> 51 51 #include "kernel_cfg.h" 52 #include "util/ntstdio.h" 53 54 extern ntstdio_t ntstdio; 52 #include <stdio.h> 55 53 56 54 #endif /* of #if defined(TARGET_KERNEL_ASP) */ … … 279 277 } 280 278 281 ntstdio_printf(&ntstdio,"[NTP CLI,%d] recv time: %s .%09u\n",279 printf("[NTP CLI,%d] recv time: %s .%09u\n", 282 280 nc->cepid, nc->buf, tp.tv_nsec); 283 281 } … … 311 309 line = lookup_ipaddr(&nc->ipaddr6, NTP_SRV_URL, API_PROTO_IPV4); 312 310 if (line == NULL || !in6_is_addr_ipv4mapped(&nc->ipaddr6)) { 313 ntstdio_printf(&ntstdio,"[NTP CLI,%d] sleep %d.%03u[s], unknown host.",311 printf("[NTP CLI,%d] sleep %d.%03u[s], unknown host.", 314 312 nc->cepid, SLP_ITV / SYSTIM_HZ, SLP_ITV % SYSTIM_HZ); 315 313 nc->timer = SLP_ITV; … … 319 317 #else /* of #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4) */ 320 318 if ((line = lookup_ipaddr(&nc->snd_rmt.ipaddr, NTP_SRV_URL, DEFAULT_API_PROTO)) == NULL) { 321 ntstdio_printf(&ntstdio,"[NTP CLI,%d] sleep %d.%03u[s], unknown host.",319 printf("[NTP CLI,%d] sleep %d.%03u[s], unknown host.", 322 320 nc->cepid, SLP_ITV / SYSTIM_HZ, SLP_ITV % SYSTIM_HZ); 323 321 nc->timer = SLP_ITV; … … 423 421 424 422 if ((error = udp_snd_dat(nc->cepid, &nc->snd_rmt, ntp, len, TMO_NBLK)) != E_WBLK) { 425 ntstdio_printf(&ntstdio,"[NTP CLI,%d] udp_snd_dat error: %s",423 printf("[NTP CLI,%d] udp_snd_dat error: %s", 426 424 nc->cepid, itron_strerror(error)); 427 425 return error; … … 441 439 ret = get_tim(&time); 442 440 if (ret != E_OK) { 443 ntstdio_printf(&ntstdio,"[NTP CLI,%d] get_tim error: %s",441 printf("[NTP CLI,%d] get_tim error: %s", 444 442 nc->cepid, itron_strerror(ret)); 445 443 tp->tv_sec = 0; … … 461 459 ret = set_tim(time); 462 460 if (ret != E_OK) { 463 ntstdio_printf(&ntstdio,"[NTP CLI,%d] set_tim error: %s",461 printf("[NTP CLI,%d] set_tim error: %s", 464 462 nc->cepid, itron_strerror(ret)); 465 463 } … … 479 477 if (len < 0 && len != E_RLWAI) { 480 478 /* E_RLWAI 以外で、0 以下の場合は、エラーを意味している。*/ 481 ntstdio_printf(&ntstdio,"[NTP CLI,%d] callback error: %s, fncd: %s", nc->cepid,479 printf("[NTP CLI,%d] callback error: %s, fncd: %s", nc->cepid, 482 480 itron_strerror(len), in_strtfn(fncd)); 483 481 } … … 486 484 if ((len = udp_rcv_dat(nc->cepid, &nc->rcv_rmt, &nc->ntp_msg, len, TMO_POL)) < 0) 487 485 { 488 ntstdio_printf(&ntstdio,"[NTP CLI,%d] udp_rcv_dat error: %s", nc->cepid,486 printf("[NTP CLI,%d] udp_rcv_dat error: %s", nc->cepid, 489 487 itron_strerror(len)); 490 488 } … … 518 516 519 517 get_tid(&nc->tskid); 520 ntstdio_printf(&ntstdio,"[NTP CLI:%d,%d] started.", nc->tskid, (ID)exinf);518 printf("[NTP CLI:%d,%d] started.", nc->tskid, (ID)exinf); 521 519 522 520 /* 初期化 */ … … 525 523 ret = get_tim(&time); 526 524 if (ret != E_OK) { 527 ntstdio_printf(&ntstdio,"[NTP CLI,%d] get_tim error: %7lu,%s",525 printf("[NTP CLI,%d] get_tim error: %7lu,%s", 528 526 nc->cepid, time / SYSTIM_HZ, itron_strerror(ret)); 529 527 return; … … 539 537 error = tslp_tsk(timer); 540 538 if ((error != E_OK) && (error != E_TMOUT)) { 541 ntstdio_printf(&ntstdio,"[NTP CLI,%d] tslp_tsk error: %s %d",539 printf("[NTP CLI,%d] tslp_tsk error: %s %d", 542 540 nc->cepid, itron_strerror(error), timer); 543 541 break; … … 546 544 ret = get_tim(&time); 547 545 if (ret != E_OK) { 548 ntstdio_printf(&ntstdio,"[NTP CLI,%d] get_tim error: %s",546 printf("[NTP CLI,%d] get_tim error: %s", 549 547 nc->cepid, itron_strerror(ret)); 550 548 break; -
asp3_tinet_ecnl_rx/trunk/ntshell/src/ntshell_main.c
r364 r374 59 59 #include "ntshell_main.h" 60 60 #include "socket_stub.h" 61 #include "usb_hbth.h"62 #include "mbed_api.h"63 64 extern int bt_bnep_mode;65 61 66 62 char command[NTOPT_TEXT_MAXLEN]; 67 ntstdio_t ntstdio;68 63 69 64 extern uint8_t mac_addr[6]; … … 88 83 volatile int ntshell_state; 89 84 jmp_buf process_exit; 90 void sys_init(void); 91 NTSHELL_SERIAL_READ ntshell_serial_read = 0; 92 NTSHELL_SERIAL_WRITE ntshell_serial_write = 0; 93 void *ntshell_serial_extobj; 94 95 unsigned char ntstdio_xi(struct ntstdio_t *handle) 96 { 97 unsigned char buf[1]; 98 ntshell_serial_read((char *)buf, 1, ntshell_serial_extobj); 99 return buf[0]; 100 } 101 102 void ntstdio_xo(struct ntstdio_t *handle, unsigned char c) 103 { 104 char buf[1]; 105 buf[0] = c; 106 ntshell_serial_write(buf, 1, ntshell_serial_extobj); 107 } 108 109 void ntshell_task_init(NTSHELL_SERIAL_READ func_read, 110 NTSHELL_SERIAL_WRITE func_write, void *extobj) 111 { 112 ntshell_serial_read = func_read; 113 ntshell_serial_write = func_write; 114 ntshell_serial_extobj = extobj; 115 116 sys_init(); 117 118 ntstdio_init(&ntstdio, NTSTDIO_OPTION_LINE_ECHO | NTSTDIO_OPTION_CANON | NTSTDIO_OPTION_LF_CRLF | NTSTDIO_OPTION_LF_CR, ntstdio_xi, ntstdio_xo); 85 86 void ntshell_task_init(ID portid) 87 { 88 serial_ctl_por(portid, IOCTL_CRLF | IOCTL_FCSND | IOCTL_FCRCV); 119 89 } 120 90 … … 178 148 const cmd_table_t *p = cmd_table_info.table; 179 149 for (int i = 0; i < cmd_table_info.count; i++) { 180 ntstdio_puts(&ntstdio, p->cmd); 181 ntstdio_puts(&ntstdio, "\t:"); 182 ntstdio_puts(&ntstdio, p->desc); 183 ntstdio_puts(&ntstdio, "\n"); 150 fwrite(p->cmd, strlen(p->cmd), 1, stdout); 151 fwrite("\t:", strlen("\t:"), 1, stdout); 152 puts(p->desc); 184 153 p++; 185 154 } … … 207 176 int execute_command(int wait) 208 177 { 178 T_RTSK rtsk; 209 179 ER ret; 210 180 … … 229 199 do { 230 200 tslp_tsk(100000); 201 202 ret = ref_tsk(NTSHELL_TASK, &rtsk); 203 if ((ret != E_OK) || (rtsk.tskstat == TTS_DMT)) 204 ntshell_state = 3; 231 205 } while(ntshell_state == 1); 232 206 … … 238 212 ntlibc_strlcpy(command, text, sizeof(command)); 239 213 return execute_command(1); 240 }241 242 int stdio_close(struct _IO_FILE *fp)243 {244 return -EPERM;245 }246 247 size_t stdio_read(struct _IO_FILE *fp, unsigned char *data, size_t len)248 {249 return -EPERM;250 }251 252 size_t stdio_write(struct _IO_FILE *fp, const unsigned char *data, size_t len)253 {254 return -EPERM;255 }256 257 size_t stdin_read(struct _IO_FILE *fp, unsigned char *data, size_t len)258 {259 int i = 0;260 while (i < len) {261 int c = ntstdio_getc(&ntstdio);262 data[i++] = c;263 if ((c == EOF) || (c == '\n'))264 break;265 }266 return i;267 }268 269 size_t stdout_write(struct _IO_FILE *fp, const unsigned char *data, size_t len)270 {271 for (int i = 0; i < len; i++) {272 ntstdio_putc(&ntstdio, data[i]);273 }274 return len;275 }276 277 size_t stderr_write(struct _IO_FILE *fp, const unsigned char *data, size_t len)278 {279 for (int i = 0; i < len; i++) {280 ntstdio_putc(&ntstdio, data[i]);281 }282 return len;283 }284 285 int sio_close(struct _IO_FILE *fp)286 {287 return -EPERM;288 }289 290 size_t sio_read(struct _IO_FILE *fp, unsigned char *data, size_t len)291 {292 return -EPERM;293 }294 295 size_t sio_write(struct _IO_FILE *fp, const unsigned char *data, size_t len)296 {297 return -EPERM;298 }299 300 off_t sio_seek(struct _IO_FILE *fp, off_t ofs, int org)301 {302 return -EPERM;303 }304 305 int sio_ioctl(struct _IO_FILE *fp, int request, void *arg)306 {307 switch (request) {308 case TIOCGWINSZ:309 return 0;310 case TCGETS:311 return sio_tcgetattr(fp->fd, (struct termios *)arg);312 case TCSETS + TCSANOW:313 case TCSETS + TCSADRAIN:314 case TCSETS + TCSAFLUSH:315 return sio_tcsetattr(fp->fd, request - TCSETS, (const struct termios *)arg);316 }317 318 return -EINVAL;319 214 } 320 215 … … 457 352 } 458 353 354 int shell_kill(int pid, int sig) 355 { 356 DebugBreak(); 357 return -1; 358 } 359 360 int shell_gettimeofday(struct timeval *tv, void *tzvp) 361 { 362 SYSTIM time; 363 if (!tv) return 0; 364 get_tim(&time); 365 tv->tv_sec = time / 1000000; 366 tv->tv_usec = time - (tv->tv_sec * 1000000); 367 return 0; 368 } 369 -
asp3_tinet_ecnl_rx/trunk/ntshell/src/ntshell_main.cfg
r364 r374 41 41 #include "ntshell_main.h" 42 42 43 ATT_INI({ TA_NULL, 0, sys_init }); 44 43 45 CRE_TSK(NTSHELL_TASK, { TA_NULL, 0, ntshell_task, NTSHELL_PRIORITY, NTSHELL_STACK_SIZE, NULL }); 44 46 CRE_FLG(FLG_SELECT_WAIT, { TA_WMUL, 0x00 }); -
asp3_tinet_ecnl_rx/trunk/ntshell/src/ntshell_main.h
r367 r374 76 76 extern PRI main_task_priority; 77 77 78 /* ntshellの初期化 */ 79 void sys_init(intptr_t exinf); 80 78 81 /* ntshellタスク初期化 */ 79 void ntshell_task_init(NTSHELL_SERIAL_READ func_read, 80 NTSHELL_SERIAL_WRITE func_write, void *extobj); 82 void ntshell_task_init(ID portid); 81 83 82 84 /* ntshellタスク */ -
asp3_tinet_ecnl_rx/trunk/ntshell/src/shellif.h
r364 r374 134 134 135 135 // dirent.h 136 typedef struct __dirstream DIR;136 typedef struct __dirstream FATFS_DIR; 137 137 138 138 int shell_getdents(int, struct dirent *, size_t); -
asp3_tinet_ecnl_rx/trunk/ntshell/src/socket_stub.c
r364 r374 57 57 #include <netinet/udp_var.h> 58 58 #include <net/net_buf.h> 59 //#include <netinet/tcp_var.h> 59 #include <netinet/udp.h> 60 #include <netinet/udp_var.h> 61 #include <netinet/tcp.h> 62 #include <netinet/tcp_var.h> 60 63 #include <netapp/resolver.h> 61 64 extern const ID tmax_tcp_cepid; … … 65 68 66 69 #define SOCKET_TIMEOUT 2000000 70 71 #define tcp6_cre_cep tcp_cre_cep 72 #define tcp6_del_cep tcp_del_cep 73 #define tcp6_del_rep tcp_del_rep 74 #define tcp6_sht_cep tcp_sht_cep 75 #define tcp6_cls_cep tcp_cls_cep 76 #define tcp6_snd_oob tcp_snd_oob 77 #define tcp6_snd_dat tcp_snd_dat 78 #define tcp6_rcv_oob tcp_rcv_oob 79 #define tcp6_rcv_buf tcp_rcv_buf 80 #define tcp6_rel_buf tcp_rel_buf 81 #define tcp6_get_opt tcp_get_opt 82 #define tcp6_set_opt tcp_set_opt 83 84 #define udp6_del_cep udp_del_cep 85 #define udp6_get_opt udp_get_opt 86 #define udp6_set_opt udp_set_opt 87 88 #ifndef SUPPORT_INET6 89 90 ER tcp6_cre_rep (ID repid, T_TCP6_CREP *pk_crep) { return E_SYS; } 91 ER tcp6_acp_cep (ID cepid, ID repid, T_IPV6EP *p_dstaddr, TMO tmout) { return E_SYS; } 92 ER tcp6_con_cep (ID cepid, T_IPV6EP *p_myaddr, T_IPV6EP *p_dstaddr, TMO tmout) { return E_SYS; } 93 94 ER udp6_cre_cep (ID cepid, T_UDP6_CCEP *pk_ccep) { return E_SYS; } 95 ER_UINT udp6_snd_dat (ID cepid, T_IPV6EP *p_dstaddr, void *data, int_t len, TMO tmout) { return E_SYS; } 96 ER_UINT udp6_rcv_dat (ID cepid, T_IPV6EP *p_dstaddr, void *data, int_t len, TMO tmout) { return E_SYS; } 97 98 const T_IN6_ADDR *in6_get_ifaddr (int_t index) { return NULL; } 99 100 #endif 101 102 ER socket_tcp_callback(ID cepid, FN fncd, void *p_parblk); 103 ER socket_tcp6_callback(ID cepid, FN fncd, void *p_parblk); 104 ER socket_udp_callback(ID cepid, FN fncd, void *p_parblk); 105 ER socket_udp6_callback(ID cepid, FN fncd, void *p_parblk); 106 107 static int tcp_fd_close(struct SHELL_FILE *fp); 108 static size_t tcp_fd_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 109 static size_t tcp_fd_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 110 static off_t tcp_fd_seek(struct SHELL_FILE *fp, off_t ofs, int org); 111 static int tcp_fd_ioctl(struct SHELL_FILE *fp, int req, void *arg); 112 static bool_t tcp_fd_readable(struct SHELL_FILE *fp); 113 static void tcp_fd_delete(struct SHELL_FILE *fp); 114 115 static int udp_fd_close(struct SHELL_FILE *fp); 116 static size_t udp_fd_read(struct SHELL_FILE *fp, unsigned char *data, size_t len); 117 static size_t udp_fd_write(struct SHELL_FILE *fp, const unsigned char *data, size_t len); 118 static off_t udp_fd_seek(struct SHELL_FILE *fp, off_t ofs, int org); 119 static int udp_fd_ioctl(struct SHELL_FILE *fp, int req, void *arg); 120 static bool_t udp_fd_readable(struct SHELL_FILE *fp); 121 static void udp_fd_delete(struct SHELL_FILE *fp); 122 123 IO_TYPE IO_TYPE_TCP = { tcp_fd_close, tcp_fd_read, tcp_fd_write, tcp_fd_seek, tcp_fd_ioctl, tcp_fd_readable, tcp_fd_delete }; 124 IO_TYPE IO_TYPE_UDP = { udp_fd_close, udp_fd_read, udp_fd_write, udp_fd_seek, udp_fd_ioctl, udp_fd_readable, udp_fd_delete }; 67 125 68 126 typedef struct id_table_t { … … 84 142 #define tcp_cepid_table_count (sizeof(tcp_cepid_table) / sizeof(tcp_cepid_table[0])) 85 143 144 #ifdef SUPPORT_INET6 145 146 id_table_t tcp6_repid_table[] = { 147 {0, USR_TCP6_REP1}, {0, USR_TCP6_REP2}, {0, USR_TCP6_REP3}, {0, USR_TCP6_REP4} 148 }; 149 #define tcp6_repid_table_count (sizeof(tcp6_repid_table) / sizeof(tcp6_repid_table[0])) 150 151 id_table_t tcp6_cepid_table[] = { 152 {0, USR_TCP6_CEP1}, {0, USR_TCP6_CEP2}, {0, USR_TCP6_CEP3}, {0, USR_TCP6_CEP4}, 153 #ifndef TOPPERS_GRSAKURA 154 {0, USR_TCP6_CEP5}, {0, USR_TCP6_CEP6}, {0, USR_TCP6_CEP7}, {0, USR_TCP6_CEP8} 155 #endif 156 }; 157 #define tcp6_cepid_table_count (sizeof(tcp6_cepid_table) / sizeof(tcp6_cepid_table[0])) 158 159 #else 160 161 #define tcp6_repid_table NULL 162 #define tcp6_repid_table_count 0 163 164 #define tcp6_cepid_table NULL 165 #define tcp6_cepid_table_count 0 166 167 #endif 168 86 169 id_table_t udp_cepid_table[] = { 87 170 {0, USR_UDP_CEP1}, {0, USR_UDP_CEP2}, {0, USR_UDP_CEP3}, {0, USR_UDP_CEP4} … … 89 172 #define udp_cepid_table_count (sizeof(udp_cepid_table) / sizeof(udp_cepid_table[0])) 90 173 174 #ifdef SUPPORT_INET6 175 176 id_table_t udp6_cepid_table[] = { 177 {0, USR_UDP6_CEP1}, {0, USR_UDP6_CEP2}, {0, USR_UDP6_CEP3}, {0, USR_UDP6_CEP4} 178 }; 179 #define udp6_cepid_table_count (sizeof(udp6_cepid_table) / sizeof(udp6_cepid_table[0])) 180 181 #else 182 183 #define udp6_cepid_table NULL 184 #define udp6_cepid_table_count 0 185 186 #endif 187 91 188 ID new_id(id_table_t *table, int count) 92 189 { … … 116 213 } 117 214 118 int delete_tcp_rep(int repid) 119 { 120 return delete_tcp_fd(tmax_tcp_cepid + repid); 121 } 122 123 typedef struct _IO_FILE SOCKET; 215 typedef struct SHELL_FILE SOCKET; 124 216 125 217 int shell_socket(int family, int type, int protocol) … … 141 233 switch (type) { 142 234 case SOCK_STREAM: 143 fp = new_tcp_fd(0); 235 fp = new_fp(&IO_TYPE_TCP, 0, 0); 236 if (fp == NULL) 237 return -ENOMEM; 238 239 fp->exinf = malloc(sizeof(socket_t)); 240 memset(fp->exinf, 0, sizeof(socket_t)); 144 241 break; 145 242 case SOCK_DGRAM: 146 fp = new_udp_fd(0); 243 fp = new_fp(&IO_TYPE_UDP, 0, 1); 244 if (fp == NULL) 245 return -ENOMEM; 246 247 fp->exinf = malloc(sizeof(socket_t)); 248 memset(fp->exinf, 0, sizeof(socket_t)); 147 249 break; 148 250 default: … … 150 252 } 151 253 152 if (fp == NULL) { 153 return -ENOMEM; 154 } 155 156 fp->psock->family = family; 157 fp->psock->type = type; 158 fp->psock->protocol = protocol; 159 fp->psock->flags = flags; 254 socket_t *socket = (socket_t *)fp->exinf; 255 socket->family = family; 256 socket->type = type; 257 socket->protocol = protocol; 258 socket->flags = flags; 160 259 161 260 return fp->fd; … … 167 266 if (fp == NULL) 168 267 return -EBADF; 169 if (fp->psock->family != addr->sa_family) 268 socket_t *socket = (socket_t *)fp->exinf; 269 if (socket->family != addr->sa_family) 170 270 return -EINVAL; 171 271 … … 177 277 } 178 278 struct sockaddr_in *addr_in = (struct sockaddr_in *)addr; 179 memcpy(& fp->psock->laddr4, addr, len);180 switch ( fp->psock->type) {279 memcpy(&socket->laddr4, addr, len); 280 switch (socket->type) { 181 281 case SOCK_STREAM: { 182 282 ID cepid = new_id(tcp_cepid_table, tcp_cepid_table_count); … … 184 284 return -ENOMEM; 185 285 186 fp->psock->buf_size = 512 + 512;187 fp->psock->buf = malloc(fp->psock->buf_size);286 socket->buf_size = 512 + 512; 287 socket->buf = malloc(socket->buf_size); 188 288 #ifdef _DEBUG 189 memset( fp->psock->buf, 0, fp->psock->buf_size);289 memset(socket->buf, 0, socket->buf_size); 190 290 #endif 191 T_TCP_CCEP ccep = { 0, fp->psock->buf, 512, &fp->psock->buf[512], 512, (FP)socket_tcp_callback };291 T_TCP_CCEP ccep = { 0, socket->buf, 512, &socket->buf[512], 512, (FP)socket_tcp_callback }; 192 292 ret = tcp_cre_cep(cepid, &ccep); 193 293 if (ret != E_OK) { … … 196 296 } 197 297 fp->handle = cepid; 198 fp->psock->cepid = cepid;298 socket->cepid = cepid; 199 299 break; 200 300 } … … 211 311 } 212 312 fp->handle = cepid; 213 fp->psock->cepid = cepid;313 socket->cepid = cepid; 214 314 break; 215 315 } … … 223 323 return -EINVAL; 224 324 } 225 memcpy(&fp->psock->laddr4, addr, len); 226 break; 227 } 325 struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)addr; 326 memcpy(&socket->laddr6, addr, len); 327 switch (socket->type) { 328 case SOCK_STREAM: { 329 ID cepid = new_id(tcp6_cepid_table, tcp6_cepid_table_count); 330 if (cepid < 0) 331 return -ENOMEM; 332 333 socket->buf_size = 512 + 512; 334 socket->buf = malloc(socket->buf_size); 335 #ifdef _DEBUG 336 memset(socket->buf, 0, socket->buf_size); 337 #endif 338 T_TCP6_CCEP ccep = { 0, socket->buf, 512, &socket->buf[512], 512, (FP)socket_tcp6_callback }; 339 ret = tcp6_cre_cep(cepid, &ccep); 340 if (ret != E_OK) { 341 delete_id(tcp6_cepid_table, tcp6_cepid_table_count, cepid); 342 return -ENOMEM; 343 } 344 fp->handle = cepid; 345 socket->cepid = cepid; 346 break; 347 } 348 case SOCK_DGRAM: { 349 ID cepid = new_id(udp_cepid_table, udp_cepid_table_count); 350 if (cepid < 0) 351 return -ENOMEM; 352 353 T_UDP6_CCEP ccep = { 0, {ntohl(addr_in6->sin6_addr.__in6_union.__s6_addr), ntohs(addr_in6->sin6_port)}, (FP)socket_udp6_callback }; 354 ret = udp6_cre_cep(cepid, &ccep); 355 if (ret != E_OK) { 356 delete_id(udp_cepid_table, udp_cepid_table_count, cepid); 357 return -ENOMEM; 358 } 359 fp->handle = cepid; 360 socket->cepid = cepid; 361 break; 362 } 363 default: 364 return -ENOPROTOOPT; 365 } 366 break; 367 } 368 default: 369 return -ENOPROTOOPT; 228 370 } 229 371 … … 236 378 if (fp == NULL) 237 379 return -EBADF; 238 if (fp->psock->type != SOCK_STREAM) 380 socket_t *socket = (socket_t *)fp->exinf; 381 if (socket->type != SOCK_STREAM) 239 382 return -EINVAL; 240 383 241 fp->psock->backlog = backlog;384 socket->backlog = backlog; 242 385 243 386 ER ret; 244 switch ( fp->psock->family) {387 switch (socket->family) { 245 388 case AF_INET: { 246 389 ID repid = new_id(tcp_repid_table, tcp_repid_table_count); … … 248 391 return -ENOMEM; 249 392 250 struct sockaddr_in *laddr = & fp->psock->laddr4;393 struct sockaddr_in *laddr = &socket->laddr4; 251 394 T_TCP_CREP crep = { 0, {ntohl(laddr->sin_addr.s_addr), ntohs(laddr->sin_port)} }; 252 395 ret = tcp_cre_rep(repid, &crep); … … 255 398 return -ENOMEM; 256 399 } 257 fp->psock->repid = repid;400 socket->repid = repid; 258 401 break; 259 402 } 260 403 case AF_INET6: { 261 break; 262 } 404 ID repid = new_id(tcp6_repid_table, tcp6_repid_table_count); 405 if (repid < 0) 406 return -ENOMEM; 407 408 struct sockaddr_in6 *laddr = &socket->laddr6; 409 T_TCP6_CREP crep = { 0, {ntohl(laddr->sin6_addr.__in6_union.__s6_addr), ntohs(laddr->sin6_port)} }; 410 ret = tcp6_cre_rep(repid, &crep); 411 if (ret != E_OK) { 412 delete_id(tcp6_repid_table, tcp6_repid_table_count, repid); 413 return -ENOMEM; 414 } 415 socket->repid = repid; 416 break; 417 } 418 default: 419 return -ENOPROTOOPT; 263 420 } 264 421 … … 271 428 if (fp == NULL) 272 429 return -EBADF; 273 if (fp->psock->type != SOCK_STREAM) 430 socket_t *socket = (socket_t *)fp->exinf; 431 if (socket->type != SOCK_STREAM) 274 432 return -EINVAL; 275 433 276 434 ER ret; 277 switch ( fp->psock->family) {435 switch (socket->family) { 278 436 case AF_INET: { 279 437 if (len < 8) { 280 438 return -EINVAL; 281 439 } 282 if ( fp->psock->cepid == 0) {440 if (socket->cepid == 0) { 283 441 ID cepid = new_id(tcp_cepid_table, tcp_cepid_table_count); 284 442 if (cepid < 0) 285 443 return -ENOMEM; 286 444 287 fp->psock->buf_size = 512 + 512;288 fp->psock->buf = malloc(fp->psock->buf_size);445 socket->buf_size = 512 + 512; 446 socket->buf = malloc(socket->buf_size); 289 447 #ifdef _DEBUG 290 memset( fp->psock->buf, 0, fp->psock->buf_size);448 memset(socket->buf, 0, socket->buf_size); 291 449 #endif 292 T_TCP_CCEP ccep = { 0, fp->psock->buf, 512, &fp->psock->buf[512], 512, (FP)socket_tcp_callback };450 T_TCP_CCEP ccep = { 0, socket->buf, 512, &socket->buf[512], 512, (FP)socket_tcp_callback }; 293 451 ret = tcp_cre_cep(cepid, &ccep); 294 452 if (ret != E_OK) { … … 297 455 } 298 456 fp->handle = cepid; 299 fp->psock->cepid = cepid;300 } 301 struct sockaddr_in *laddr = & fp->psock->laddr4;302 struct sockaddr_in *raddr = & fp->psock->raddr4;457 socket->cepid = cepid; 458 } 459 struct sockaddr_in *laddr = &socket->laddr4; 460 struct sockaddr_in *raddr = &socket->raddr4; 303 461 memset(raddr, 0, sizeof(*raddr)); 304 462 memcpy(raddr, addr, len); 305 463 T_IPV4EP lep = { ntohl(laddr->sin_addr.s_addr), ntohs(laddr->sin_port) }; 306 464 T_IPV4EP rep = { ntohl(raddr->sin_addr.s_addr), ntohs(raddr->sin_port) }; 307 ret = tcp_con_cep( fp->psock->cepid, &lep, &rep, SOCKET_TIMEOUT);465 ret = tcp_con_cep(socket->cepid, &lep, &rep, SOCKET_TIMEOUT); 308 466 if (ret < 0) { 309 467 return -EHOSTUNREACH; … … 312 470 } 313 471 case AF_INET6: { 314 break; 315 } 472 if (len < 20) { 473 return -EINVAL; 474 } 475 if (socket->cepid == 0) { 476 ID cepid = new_id(tcp6_cepid_table, tcp6_cepid_table_count); 477 if (cepid < 0) 478 return -ENOMEM; 479 480 socket->buf_size = 512 + 512; 481 socket->buf = malloc(socket->buf_size); 482 #ifdef _DEBUG 483 memset(socket->buf, 0, socket->buf_size); 484 #endif 485 T_TCP6_CCEP ccep = { 0, socket->buf, 512, &socket->buf[512], 512, (FP)socket_tcp6_callback }; 486 ret = tcp6_cre_cep(cepid, &ccep); 487 if (ret != E_OK) { 488 delete_id(tcp6_cepid_table, tcp6_cepid_table_count, cepid); 489 return -ENOMEM; 490 } 491 fp->handle = cepid; 492 socket->cepid = cepid; 493 } 494 struct sockaddr_in6 *laddr = &socket->laddr6; 495 struct sockaddr_in6 *raddr = &socket->raddr6; 496 memset(raddr, 0, sizeof(*raddr)); 497 memcpy(raddr, addr, len); 498 T_IPV6EP lep = { ntohl(laddr->sin6_addr.__in6_union.__s6_addr), ntohs(laddr->sin6_port) }; 499 T_IPV6EP rep = { ntohl(raddr->sin6_addr.__in6_union.__s6_addr), ntohs(raddr->sin6_port) }; 500 ret = tcp6_con_cep(socket->cepid, &lep, &rep, SOCKET_TIMEOUT); 501 if (ret < 0) { 502 return -EHOSTUNREACH; 503 } 504 break; 505 } 506 default: 507 return -ENOPROTOOPT; 316 508 } 317 509 … … 324 516 if (lfp == NULL) 325 517 return -EBADF; 326 if ( lfp->psock->type != SOCK_STREAM)518 if (((socket_t *)lfp->exinf)->type != SOCK_STREAM) 327 519 return -EINVAL; 328 520 329 SOCKET *fp = new_ tcp_fd(0);330 if (fp == NULL) {521 SOCKET *fp = new_fp(&IO_TYPE_TCP, 0, 0); 522 if (fp == NULL) 331 523 return -ENOMEM; 332 } 333 334 memcpy(fp->psock, lfp->psock, offsetof(socket_t, buf_size)); 524 525 fp->exinf = malloc(sizeof(socket_t)); 526 memset(fp->exinf, 0, sizeof(socket_t)); 527 528 memcpy(fp->exinf, lfp->exinf, offsetof(socket_t, buf_size)); 335 529 336 530 ER ret; 337 switch (fp->psock->family) { 531 socket_t *socket = (socket_t *)fp->exinf; 532 switch (socket->family) { 338 533 case AF_INET: { 339 534 ID cepid; 340 if ( fp->psock->cepid == 0) {535 if (socket->cepid == 0) { 341 536 cepid = new_id(tcp_cepid_table, tcp_cepid_table_count); 342 537 if (cepid < 0) 343 538 return -ENOMEM; 344 539 345 fp->psock->buf_size = 512 + 512;346 fp->psock->buf = malloc(fp->psock->buf_size);540 socket->buf_size = 512 + 512; 541 socket->buf = malloc(socket->buf_size); 347 542 #ifdef _DEBUG 348 memset( fp->psock->buf, 0, fp->psock->buf_size);543 memset(socket->buf, 0, socket->buf_size); 349 544 #endif 350 T_TCP_CCEP ccep = { 0, fp->psock->buf, 512, &fp->psock->buf[512], 512, (FP)socket_tcp_callback };545 T_TCP_CCEP ccep = { 0, socket->buf, 512, &socket->buf[512], 512, (FP)socket_tcp_callback }; 351 546 ret = tcp_cre_cep(cepid, &ccep); 352 547 if (ret != E_OK) { … … 355 550 } 356 551 fp->handle = cepid; 357 fp->psock->cepid = cepid;552 socket->cepid = cepid; 358 553 } 359 554 else { 360 cepid = lfp->psock->cepid;555 cepid = ((socket_t *)lfp->exinf)->cepid; 361 556 fp->handle = cepid; 362 lfp->handle = tmax_tcp_cepid + lfp->psock->repid;363 lfp->psock->cepid = 0;364 lfp->psock->buf_size = 0;365 lfp->psock->buf = 0;557 lfp->handle = tmax_tcp_cepid + ((socket_t *)lfp->exinf)->repid; 558 ((socket_t *)lfp->exinf)->cepid = 0; 559 ((socket_t *)lfp->exinf)->buf_size = 0; 560 ((socket_t *)lfp->exinf)->buf = 0; 366 561 } 367 562 T_IPV4EP rep = { 0, 0 }; 368 ret = tcp_acp_cep( fp->psock->cepid, fp->psock->repid, &rep, TMO_FEVR);563 ret = tcp_acp_cep(socket->cepid, socket->repid, &rep, TMO_FEVR); 369 564 if (ret < 0) { 370 565 return -ENOMEM; 371 566 } 372 struct sockaddr_in *raddr = & fp->psock->raddr4;567 struct sockaddr_in *raddr = &socket->raddr4; 373 568 memset(raddr, 0, sizeof(*raddr)); 374 569 raddr->sin_family = AF_INET; 375 570 raddr->sin_port = htons(rep.portno); 376 571 raddr->sin_addr.s_addr = htonl(rep.ipaddr); 572 573 if (addr != NULL && len != NULL) { 574 int sz = *len; 575 if (sz < 8) { 576 return -EINVAL; 577 } 578 struct sockaddr_in *raddr = &socket->raddr4; 579 if (sz > sizeof(*raddr)) 580 sz = sizeof(*raddr); 581 memcpy(addr, raddr, sz); 582 *len = sizeof(*raddr); 583 } 377 584 break; 378 585 } 379 586 case AF_INET6: { 380 return -EAFNOSUPPORT; 381 } 382 } 383 384 if (addr != NULL && len != NULL) { 385 int sz = *len; 386 if (sz < 8) { 387 return -EINVAL; 388 } 389 struct sockaddr_in *raddr = &fp->psock->raddr4; 390 if (sz > sizeof(*raddr)) 391 sz = sizeof(*raddr); 392 memcpy(addr, raddr, sz); 393 *len = sizeof(*raddr); 587 ID cepid; 588 if (socket->cepid == 0) { 589 cepid = new_id(tcp6_cepid_table, tcp6_cepid_table_count); 590 if (cepid < 0) 591 return -ENOMEM; 592 593 socket->buf_size = 512 + 512; 594 socket->buf = malloc(socket->buf_size); 595 #ifdef _DEBUG 596 memset(socket->buf, 0, socket->buf_size); 597 #endif 598 T_TCP6_CCEP ccep = { 0, socket->buf, 512, &socket->buf[512], 512, (FP)socket_tcp6_callback }; 599 ret = tcp6_cre_cep(cepid, &ccep); 600 if (ret != E_OK) { 601 delete_id(tcp6_cepid_table, tcp6_cepid_table_count, cepid); 602 return -ENOMEM; 603 } 604 fp->handle = cepid; 605 socket->cepid = cepid; 606 } 607 else { 608 cepid = ((socket_t *)lfp->exinf)->cepid; 609 fp->handle = cepid; 610 lfp->handle = tmax_tcp6_cepid + ((socket_t *)lfp->exinf)->repid; 611 ((socket_t *)lfp->exinf)->cepid = 0; 612 ((socket_t *)lfp->exinf)->buf_size = 0; 613 ((socket_t *)lfp->exinf)->buf = 0; 614 } 615 T_IPV6EP rep = { 0, 0 }; 616 ret = tcp6_acp_cep(socket->cepid, socket->repid, &rep, TMO_FEVR); 617 if (ret < 0) { 618 return -ENOMEM; 619 } 620 struct sockaddr_in6 *raddr = &socket->raddr6; 621 memset(raddr, 0, sizeof(*raddr)); 622 raddr->sin6_family = AF_INET; 623 raddr->sin6_port = htons(rep.portno); 624 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 625 memcpy(raddr->sin6_addr.__in6_union.__s6_addr, rep.ipaddr.__u6_addr.__u6_addr8, 16); 626 #else 627 for (int i = 0; i < 16; i++) 628 raddr->sin6_addr.__in6_union.__s6_addr[i] = rep.ipaddr.__u6_addr.__u6_addr8[i]; 629 #endif 630 631 if (addr != NULL && len != NULL) { 632 int sz = *len; 633 if (sz < 8) { 634 return -EINVAL; 635 } 636 struct sockaddr_in6 *raddr = &socket->raddr6; 637 if (sz > sizeof(*raddr)) 638 sz = sizeof(*raddr); 639 memcpy(addr, raddr, sz); 640 *len = sizeof(*raddr); 641 } 642 break; 643 } 644 default: 645 return -ENOPROTOOPT; 394 646 } 395 647 … … 405 657 406 658 int ret = 0; 407 switch (fp->psock->family) { 659 socket_t *socket = (socket_t *)fp->exinf; 660 switch (socket->family) { 408 661 case AF_INET: { 409 switch ( fp->psock->type) {662 switch (socket->type) { 410 663 case SOCK_STREAM: { 411 664 if ((addr != NULL) || (alen != 0)) { … … 414 667 415 668 if (flags & MSG_OOB) { 416 ret = tcp_snd_oob( fp->psock->cepid, (void *)buf, len, SOCKET_TIMEOUT);669 ret = tcp_snd_oob(socket->cepid, (void *)buf, len, SOCKET_TIMEOUT); 417 670 if (ret < 0) { 418 671 return -ECOMM; … … 421 674 else { 422 675 for (;;) { 423 ret = tcp_snd_dat( fp->psock->cepid, (void *)buf, len, SOCKET_TIMEOUT);676 ret = tcp_snd_dat(socket->cepid, (void *)buf, len, SOCKET_TIMEOUT); 424 677 if (ret < 0) { 425 678 if (ret == E_TMOUT) … … 440 693 return -EINVAL; 441 694 } 442 struct sockaddr_in *raddr = & fp->psock->raddr4;695 struct sockaddr_in *raddr = &socket->raddr4; 443 696 memset(raddr, 0, sizeof(*raddr)); 444 697 memcpy(raddr, addr, sz); 445 698 T_IPV4EP rep = { ntohl(raddr->sin_addr.s_addr), ntohs(raddr->sin_port) }; 446 ret = udp_snd_dat( fp->psock->cepid, &rep, (void *)buf, len,447 ( fp->psock->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT);699 ret = udp_snd_dat(socket->cepid, &rep, (void *)buf, len, 700 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); 448 701 if (ret < 0) { 449 702 return (ret == E_TMOUT) ? -ETIME : -ECOMM; … … 455 708 } 456 709 case AF_INET6: { 457 return -EAFNOSUPPORT; 458 } 710 switch (socket->type) { 711 case SOCK_STREAM: { 712 if ((addr != NULL) || (alen != 0)) { 713 return -EISCONN; 714 } 715 716 if (flags & MSG_OOB) { 717 ret = tcp6_snd_oob(socket->cepid, (void *)buf, len, SOCKET_TIMEOUT); 718 if (ret < 0) { 719 return -ECOMM; 720 } 721 } 722 else { 723 for (;;) { 724 ret = tcp6_snd_dat(socket->cepid, (void *)buf, len, SOCKET_TIMEOUT); 725 if (ret < 0) { 726 if (ret == E_TMOUT) 727 return -ETIME; 728 return -ECOMM; 729 } 730 len -= ret; 731 if (len <= 0) 732 break; 733 buf = (const void *)&((uint8_t *)buf)[ret]; 734 } 735 } 736 break; 737 } 738 case SOCK_DGRAM: { 739 int sz = alen; 740 if ((addr == NULL) || (sz < 8)) { 741 return -EINVAL; 742 } 743 struct sockaddr_in6 *raddr = &socket->raddr6; 744 memset(raddr, 0, sizeof(*raddr)); 745 memcpy(raddr, addr, sz); 746 T_IPV6EP rep = { ntohl(raddr->sin6_addr.__in6_union.__s6_addr), ntohs(raddr->sin6_port) }; 747 ret = udp6_snd_dat(socket->cepid, &rep, (void *)buf, len, 748 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); 749 if (ret < 0) { 750 return (ret == E_TMOUT) ? -ETIME : -ECOMM; 751 } 752 break; 753 } 754 } 755 break; 756 } 757 default: 758 return -ENOPROTOOPT; 459 759 } 460 760 … … 476 776 477 777 int ret = 0; 478 switch (fp->psock->family) { 778 socket_t *socket = (socket_t *)fp->exinf; 779 switch (socket->family) { 479 780 case AF_INET: { 480 switch ( fp->psock->type) {781 switch (socket->type) { 481 782 case SOCK_STREAM: { 482 783 if (flags & MSG_OOB) { 483 ret = tcp_rcv_oob( fp->psock->cepid, buf, len);784 ret = tcp_rcv_oob(socket->cepid, buf, len); 484 785 if (ret < 0) { 485 786 syslog(LOG_ERROR, "tcp_rcv_oob => %d", ret); … … 489 790 else { 490 791 int rsz, tmp; 491 if ( fp->psock->input == NULL) {792 if (socket->input == NULL) { 492 793 ret = wai_sem(SEM_FILEDESC); 493 794 if (ret < 0) { 494 795 syslog(LOG_ERROR, "wai_sem => %d", ret); 495 796 } 496 fp->psock->len = 0;797 socket->len = 0; 497 798 ret = sig_sem(SEM_FILEDESC); 498 799 if (ret < 0) { 499 800 syslog(LOG_ERROR, "sig_sem => %d", ret); 500 801 } 501 ret = tcp_rcv_buf( fp->psock->cepid, &fp->psock->input, TMO_FEVR);802 ret = tcp_rcv_buf(socket->cepid, &socket->input, TMO_FEVR); 502 803 if (ret < 0) { 503 804 syslog(LOG_ERROR, "tcp_rcv_buf => %d", ret); … … 507 808 } 508 809 else 509 rsz = fp->psock->len;810 rsz = socket->len; 510 811 tmp = rsz; 511 812 if (rsz > len) 512 813 rsz = len; 513 814 if (rsz >= 0) { 514 memcpy(buf, fp->psock->input, rsz);815 memcpy(buf, socket->input, rsz); 515 816 ret = wai_sem(SEM_FILEDESC); 516 817 if (ret < 0) { 517 818 syslog(LOG_ERROR, "wai_sem => %d", ret); 518 819 } 519 fp->psock->len = tmp - rsz;820 socket->len = tmp - rsz; 520 821 ret = sig_sem(SEM_FILEDESC); 521 822 if (ret < 0) { … … 523 824 } 524 825 if (tmp - rsz == 0) { 525 fp->psock->input = NULL;826 socket->input = NULL; 526 827 } 527 828 else 528 fp->psock->input = (void *)&((uint8_t *)fp->psock->input)[rsz];529 ret = tcp_rel_buf( fp->psock->cepid, rsz);829 socket->input = (void *)&((uint8_t *)socket->input)[rsz]; 830 ret = tcp_rel_buf(socket->cepid, rsz); 530 831 if ((ret != E_OBJ) && (ret < 0)) { 531 832 syslog(LOG_ERROR, "tcp_rel_buf => %d", ret); … … 538 839 } 539 840 case SOCK_DGRAM: { 540 struct sockaddr_in *raddr = & fp->psock->raddr4;841 struct sockaddr_in *raddr = &socket->raddr4; 541 842 int rsz; 542 843 ret = wai_sem(SEM_FILEDESC); … … 544 845 syslog(LOG_ERROR, "wai_sem => %d", ret); 545 846 } 546 T_NET_BUF *input = fp->psock->input;847 T_NET_BUF *input = socket->input; 547 848 if (input == NULL) { 548 849 ret = sig_sem(SEM_FILEDESC); … … 552 853 553 854 T_IPV4EP rep = { 0, 0 }; 554 ret = udp_rcv_dat( fp->psock->cepid, &rep, buf, len,555 ( fp->psock->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT);855 ret = udp_rcv_dat(socket->cepid, &rep, buf, len, 856 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); 556 857 if (ret < 0) { 557 syslog(LOG_ERROR, "udp_rcv_buf => %d", ret); 858 if ((socket->flags & O_NONBLOCK) == 0) 859 syslog(LOG_ERROR, "udp_rcv_buf => %d", ret); 558 860 return (ret == E_TMOUT) ? -ETIME : -ECOMM; 559 861 } … … 565 867 } 566 868 int sz = *alen; 567 memset(raddr, 0, sizeof( fp->psock->raddr4));869 memset(raddr, 0, sizeof(socket->raddr4)); 568 870 raddr->sin_family = AF_INET; 569 871 raddr->sin_port = htons(rep.portno); 570 872 raddr->sin_addr.s_addr = htonl(rep.ipaddr); 571 if (sz > sizeof( fp->psock->raddr4))572 sz = sizeof( fp->psock->raddr4);873 if (sz > sizeof(socket->raddr4)) 874 sz = sizeof(socket->raddr4); 573 875 memcpy(addr, raddr, sz); 574 876 *alen = sz; … … 580 882 } 581 883 else { 582 rsz = fp->psock->len;583 void *pbuf = fp->psock->buf;584 fp->psock->input = NULL;585 fp->psock->len = 0;586 fp->psock->buf = NULL;884 rsz = socket->len; 885 void *pbuf = socket->buf; 886 socket->input = NULL; 887 socket->len = 0; 888 socket->buf = NULL; 587 889 if ((addr != NULL) && (alen != NULL)) { 588 890 int sz = *alen; 589 if (sz > sizeof( fp->psock->raddr4))590 sz = sizeof( fp->psock->raddr4);891 if (sz > sizeof(socket->raddr4)) 892 sz = sizeof(socket->raddr4); 591 893 memcpy(addr, raddr, sz); 592 894 *alen = sz; … … 611 913 } 612 914 case AF_INET6: { 613 return -EAFNOSUPPORT; 614 } 915 switch (socket->type) { 916 case SOCK_STREAM: { 917 if (flags & MSG_OOB) { 918 ret = tcp6_rcv_oob(socket->cepid, buf, len); 919 if (ret < 0) { 920 syslog(LOG_ERROR, "tcp6_rcv_oob => %d", ret); 921 return -ECOMM; 922 } 923 } 924 else { 925 int rsz, tmp; 926 if (socket->input == NULL) { 927 ret = wai_sem(SEM_FILEDESC); 928 if (ret < 0) { 929 syslog(LOG_ERROR, "wai_sem => %d", ret); 930 } 931 socket->len = 0; 932 ret = sig_sem(SEM_FILEDESC); 933 if (ret < 0) { 934 syslog(LOG_ERROR, "sig_sem => %d", ret); 935 } 936 ret = tcp6_rcv_buf(socket->cepid, &socket->input, TMO_FEVR); 937 if (ret < 0) { 938 syslog(LOG_ERROR, "tcp6_rcv_buf => %d", ret); 939 return -ECOMM; 940 } 941 rsz = ret; 942 } 943 else 944 rsz = socket->len; 945 tmp = rsz; 946 if (rsz > len) 947 rsz = len; 948 if (rsz >= 0) { 949 memcpy(buf, socket->input, rsz); 950 ret = wai_sem(SEM_FILEDESC); 951 if (ret < 0) { 952 syslog(LOG_ERROR, "wai_sem => %d", ret); 953 } 954 socket->len = tmp - rsz; 955 ret = sig_sem(SEM_FILEDESC); 956 if (ret < 0) { 957 syslog(LOG_ERROR, "sig_sem => %d", ret); 958 } 959 if (tmp - rsz == 0) { 960 socket->input = NULL; 961 } 962 else 963 socket->input = (void *)&((uint8_t *)socket->input)[rsz]; 964 ret = tcp6_rel_buf(socket->cepid, rsz); 965 if ((ret != E_OBJ) && (ret < 0)) { 966 syslog(LOG_ERROR, "tcp6_rel_buf => %d", ret); 967 //return -ECOMM; 968 } 969 } 970 ret = rsz; 971 } 972 break; 973 } 974 case SOCK_DGRAM: { 975 struct sockaddr_in6 *raddr = &socket->raddr6; 976 int rsz; 977 ret = wai_sem(SEM_FILEDESC); 978 if (ret < 0) { 979 syslog(LOG_ERROR, "wai_sem => %d", ret); 980 } 981 T_NET_BUF *input = socket->input; 982 if (input == NULL) { 983 ret = sig_sem(SEM_FILEDESC); 984 if (ret < 0) { 985 syslog(LOG_ERROR, "sig_sem => %d", ret); 986 } 987 988 T_IPV6EP rep = { 0, 0 }; 989 ret = udp6_rcv_dat(socket->cepid, &rep, buf, len, 990 (socket->flags & O_NONBLOCK) ? TMO_POL : SOCKET_TIMEOUT); 991 if (ret < 0) { 992 if ((socket->flags & O_NONBLOCK) == 0) 993 syslog(LOG_ERROR, "udp6_rcv_buf => %d", ret); 994 return (ret == E_TMOUT) ? -ETIME : -ECOMM; 995 } 996 rsz = ret; 997 if ((addr != NULL) && (alen != NULL)) { 998 ret = wai_sem(SEM_FILEDESC); 999 if (ret < 0) { 1000 syslog(LOG_ERROR, "wai_sem => %d", ret); 1001 } 1002 int sz = *alen; 1003 memset(raddr, 0, sizeof(socket->raddr6)); 1004 raddr->sin6_family = AF_INET; 1005 raddr->sin6_port = htons(rep.portno); 1006 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 1007 memcpy(raddr->sin6_addr.__in6_union.__s6_addr, rep.ipaddr.__u6_addr.__u6_addr8, 16); 1008 #else 1009 for (int i = 0; i < 16; i++) 1010 raddr->sin6_addr.__in6_union.__s6_addr[i] = rep.ipaddr.__u6_addr.__u6_addr8[i]; 1011 #endif 1012 if (sz > sizeof(socket->raddr6)) 1013 sz = sizeof(socket->raddr6); 1014 memcpy(addr, raddr, sz); 1015 *alen = sz; 1016 ret = sig_sem(SEM_FILEDESC); 1017 if (ret < 0) { 1018 syslog(LOG_ERROR, "sig_sem => %d", ret); 1019 } 1020 } 1021 } 1022 else { 1023 rsz = socket->len; 1024 void *pbuf = socket->buf; 1025 socket->input = NULL; 1026 socket->len = 0; 1027 socket->buf = NULL; 1028 if ((addr != NULL) && (alen != NULL)) { 1029 int sz = *alen; 1030 if (sz > sizeof(socket->raddr6)) 1031 sz = sizeof(socket->raddr6); 1032 memcpy(addr, raddr, sz); 1033 *alen = sz; 1034 } 1035 ret = sig_sem(SEM_FILEDESC); 1036 if (ret < 0) { 1037 syslog(LOG_ERROR, "sig_sem => %d", ret); 1038 } 1039 if (rsz > len) 1040 rsz = len; 1041 memcpy(buf, pbuf, rsz); 1042 ret = rel_net_buf(input); 1043 if (ret < 0) { 1044 syslog(LOG_ERROR, "rel_net_buf => %d", ret); 1045 //return -ECOMM; 1046 } 1047 } 1048 ret = rsz; 1049 } 1050 } 1051 break; 1052 } 1053 default: 1054 return -ENOPROTOOPT; 615 1055 } 616 1056 … … 632 1072 633 1073 ER ret; 634 switch (fp->psock->family) { 1074 socket_t *socket = (socket_t *)fp->exinf; 1075 switch (socket->family) { 635 1076 case AF_INET: { 636 switch ( fp->psock->type) {1077 switch (socket->type) { 637 1078 case SOCK_STREAM: { 638 ret = tcp_sht_cep( fp->psock->cepid);1079 ret = tcp_sht_cep(socket->cepid); 639 1080 if (ret < 0) { 640 1081 return -ECOMM; … … 646 1087 } 647 1088 case AF_INET6: { 648 return -EAFNOSUPPORT; 649 } 1089 switch (socket->type) { 1090 case SOCK_STREAM: { 1091 ret = tcp6_sht_cep(socket->cepid); 1092 if (ret < 0) { 1093 return -ECOMM; 1094 } 1095 break; 1096 } 1097 } 1098 break; 1099 } 1100 default: 1101 return -ENOPROTOOPT; 650 1102 } 651 1103 … … 661 1113 662 1114 ER ret; 663 switch (fp->psock->family) { 1115 socket_t *socket = (socket_t *)fp->exinf; 1116 switch (socket->family) { 664 1117 case AF_INET: { 665 switch ( fp->psock->type) {1118 switch (socket->type) { 666 1119 case SOCK_STREAM: { 667 1120 switch (level) { … … 669 1122 switch (optname) { 670 1123 case SO_REUSEADDR: 671 if ( fp->psock->flags & SO_REUSEADDR) {1124 if (socket->flags & SO_REUSEADDR) { 672 1125 *(bool *)optval = true; 673 1126 } … … 677 1130 break; 678 1131 case SO_KEEPALIVE: 679 if ( fp->psock->flags & SO_KEEPALIVE) {1132 if (socket->flags & SO_KEEPALIVE) { 680 1133 *(bool *)optval = true; 681 1134 } … … 692 1145 break; 693 1146 case IPPROTO_TCP: 694 ret = tcp_get_opt( fp->psock->cepid, optname, (void *)optval, *optlen);1147 ret = tcp_get_opt(socket->cepid, optname, (void *)optval, *optlen); 695 1148 if (ret < 0) { 696 1149 return -EINVAL; … … 706 1159 switch (level) { 707 1160 case IPPROTO_UDP: 708 ret = udp_get_opt( fp->psock->cepid, optname, (void *)optval, *optlen);1161 ret = udp_get_opt(socket->cepid, optname, (void *)optval, *optlen); 709 1162 if (ret < 0) { 710 1163 return -EINVAL; … … 721 1174 } 722 1175 case AF_INET6: { 723 return -EAFNOSUPPORT; 724 } 1176 switch (socket->type) { 1177 case SOCK_STREAM: { 1178 switch (level) { 1179 case SOL_SOCKET: 1180 switch (optname) { 1181 case SO_REUSEADDR: 1182 if (socket->flags & SO_REUSEADDR) { 1183 *(bool *)optval = true; 1184 } 1185 else { 1186 *(bool *)optval = false; 1187 } 1188 break; 1189 case SO_KEEPALIVE: 1190 if (socket->flags & SO_KEEPALIVE) { 1191 *(bool *)optval = true; 1192 } 1193 else { 1194 *(bool *)optval = false; 1195 } 1196 break; 1197 case SO_ERROR: 1198 *(int *)optval = 0; 1199 break; 1200 default: 1201 return -EINVAL; 1202 } 1203 break; 1204 case IPPROTO_TCP: 1205 ret = tcp6_get_opt(socket->cepid, optname, (void *)optval, *optlen); 1206 if (ret < 0) { 1207 return -EINVAL; 1208 } 1209 *optlen = ret; 1210 break; 1211 default: 1212 return -EINVAL; 1213 } 1214 break; 1215 } 1216 case SOCK_DGRAM: { 1217 switch (level) { 1218 case IPPROTO_UDP: 1219 ret = udp6_get_opt(socket->cepid, optname, (void *)optval, *optlen); 1220 if (ret < 0) { 1221 return -EINVAL; 1222 } 1223 *optlen = ret; 1224 break; 1225 default: 1226 return -EINVAL; 1227 } 1228 break; 1229 } 1230 } 1231 break; 1232 } 1233 default: 1234 return -ENOPROTOOPT; 725 1235 } 726 1236 … … 736 1246 737 1247 ER ret; 738 switch (fp->psock->family) { 1248 socket_t *socket = (socket_t *)fp->exinf; 1249 switch (socket->family) { 739 1250 case AF_INET: { 740 switch ( fp->psock->type) {1251 switch (socket->type) { 741 1252 case SOCK_STREAM: { 742 1253 switch (level){ … … 745 1256 case SO_REUSEADDR: 746 1257 if (*(bool *)optval) { 747 fp->psock->flags |= SO_REUSEADDR;1258 socket->flags |= SO_REUSEADDR; 748 1259 } 749 1260 else { 750 fp->psock->flags &= ~SO_REUSEADDR;1261 socket->flags &= ~SO_REUSEADDR; 751 1262 } 752 1263 break; 753 1264 case SO_KEEPALIVE: 754 1265 if (*(bool *)optval) { 755 fp->psock->flags |= SO_KEEPALIVE;1266 socket->flags |= SO_KEEPALIVE; 756 1267 } 757 1268 else { 758 fp->psock->flags &= ~SO_KEEPALIVE;1269 socket->flags &= ~SO_KEEPALIVE; 759 1270 } 760 1271 break; … … 764 1275 break; 765 1276 case IPPROTO_TCP: 766 ret = tcp_set_opt( fp->psock->cepid, optname, (void *)optval, optlen);1277 ret = tcp_set_opt(socket->cepid, optname, (void *)optval, optlen); 767 1278 if (ret < 0) { 768 1279 return -EINVAL; … … 777 1288 switch (level){ 778 1289 case IPPROTO_UDP: 779 ret = udp_set_opt( fp->psock->cepid, optname, (void *)optval, optlen);1290 ret = udp_set_opt(socket->cepid, optname, (void *)optval, optlen); 780 1291 if (ret < 0) { 781 1292 return -EINVAL; … … 791 1302 } 792 1303 case AF_INET6: { 793 return -EAFNOSUPPORT; 794 } 1304 switch (socket->type) { 1305 case SOCK_STREAM: { 1306 switch (level){ 1307 case SOL_SOCKET: 1308 switch (optname) { 1309 case SO_REUSEADDR: 1310 if (*(bool *)optval) { 1311 socket->flags |= SO_REUSEADDR; 1312 } 1313 else { 1314 socket->flags &= ~SO_REUSEADDR; 1315 } 1316 break; 1317 case SO_KEEPALIVE: 1318 if (*(bool *)optval) { 1319 socket->flags |= SO_KEEPALIVE; 1320 } 1321 else { 1322 socket->flags &= ~SO_KEEPALIVE; 1323 } 1324 break; 1325 default: 1326 return -EINVAL; 1327 } 1328 break; 1329 case IPPROTO_TCP: 1330 ret = tcp6_set_opt(socket->cepid, optname, (void *)optval, optlen); 1331 if (ret < 0) { 1332 return -EINVAL; 1333 } 1334 break; 1335 default: 1336 return -EINVAL; 1337 } 1338 break; 1339 } 1340 case SOCK_DGRAM: { 1341 switch (level){ 1342 case IPPROTO_UDP: 1343 ret = udp6_set_opt(socket->cepid, optname, (void *)optval, optlen); 1344 if (ret < 0) { 1345 return -EINVAL; 1346 } 1347 break; 1348 default: 1349 return -EINVAL; 1350 } 1351 break; 1352 } 1353 } 1354 break; 1355 } 1356 default: 1357 return -ENOPROTOOPT; 795 1358 } 796 1359 … … 809 1372 810 1373 socklen_t size = *len; 811 switch (fp->psock->family) { 1374 socket_t *socket = (socket_t *)fp->exinf; 1375 switch (socket->family) { 812 1376 case AF_INET: { 813 struct sockaddr_in *raddr = & fp->psock->raddr4;1377 struct sockaddr_in *raddr = &socket->raddr4; 814 1378 *len = sizeof(struct sockaddr_in); 815 1379 if (size > sizeof(struct sockaddr_in)) … … 819 1383 } 820 1384 case AF_INET6: { 821 return -EAFNOSUPPORT; 822 } 1385 struct sockaddr_in6 *raddr = &socket->raddr6; 1386 *len = sizeof(struct sockaddr_in6); 1387 if (size > sizeof(struct sockaddr_in6)) 1388 size = sizeof(struct sockaddr_in6); 1389 memcpy(addr, raddr, size); 1390 break; 1391 } 1392 default: 1393 return -ENOPROTOOPT; 823 1394 } 824 1395 … … 837 1408 838 1409 socklen_t size = *len; 839 switch (fp->psock->family) { 1410 socket_t *socket = (socket_t *)fp->exinf; 1411 switch (socket->family) { 840 1412 case AF_INET: { 841 1413 const T_IN4_ADDR *laddr4 = in4_get_ifaddr(0); … … 843 1415 laddr.sin_family = AF_INET; 844 1416 laddr.sin_addr.s_addr = htonl(*laddr4); 845 laddr.sin_port = fp->psock->laddr4.sin_port;1417 laddr.sin_port = socket->laddr4.sin_port; 846 1418 memset(&laddr.sin_zero, 0, sizeof(laddr.sin_zero)); 847 1419 *len = sizeof(struct sockaddr_in); … … 852 1424 } 853 1425 case AF_INET6: { 854 return -EAFNOSUPPORT; 855 } 1426 const T_IN6_ADDR *laddr6 = in6_get_ifaddr(0); 1427 struct sockaddr_in6 laddr; 1428 laddr.sin6_family = AF_INET; 1429 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 1430 memcpy(laddr.sin6_addr.__in6_union.__s6_addr, laddr6->__u6_addr.__u6_addr8, 16); 1431 #else 1432 for (int i = 0; i < 16; i++) 1433 laddr.sin6_addr.__in6_union.__s6_addr[i] = laddr6->__u6_addr.__u6_addr8[i]; 1434 #endif 1435 laddr.sin6_port = socket->laddr6.sin6_port; 1436 *len = sizeof(struct sockaddr_in6); 1437 if (size > sizeof(struct sockaddr_in6)) 1438 size = sizeof(struct sockaddr_in6); 1439 memcpy(addr, &laddr, size); 1440 break; 1441 } 1442 default: 1443 return -ENOPROTOOPT; 856 1444 } 857 1445 … … 859 1447 } 860 1448 861 int tcp_fd_close(struct _IO_FILE *fp)1449 int tcp_fd_close(struct SHELL_FILE *fp) 862 1450 { 863 1451 ER ret, ret2; 864 1452 865 switch (fp->psock->family) { 1453 socket_t *socket = (socket_t *)fp->exinf; 1454 switch (socket->family) { 866 1455 case AF_INET: { 867 if ( fp->psock->cepid != 0) {868 ID cepid = fp->psock->cepid;1456 if (socket->cepid != 0) { 1457 ID cepid = socket->cepid; 869 1458 ret = tcp_sht_cep(cepid); 870 1459 if (ret < 0) { 871 1460 //return -1; 872 1461 } 873 ret = tcp_cls_cep(cepid, ( fp->psock->repid != 0) ? 0 : SOCKET_TIMEOUT);1462 ret = tcp_cls_cep(cepid, (socket->repid != 0) ? 0 : SOCKET_TIMEOUT); 874 1463 ret2 = tcp_del_cep(cepid); 875 free(fp->psock->buf); 876 fp->psock->buf = NULL; 877 delete_tcp_fd(cepid); 1464 //delete_fd_by_id(&IO_TYPE_TCP, cepid); 878 1465 delete_id(tcp_cepid_table, tcp_cepid_table_count, cepid); 879 1466 if ((ret < 0) || (ret2 < 0)) { … … 881 1468 } 882 1469 } 883 else if ( fp->psock->repid != 0) {884 ID repid = fp->psock->repid;1470 else if (socket->repid != 0) { 1471 ID repid = socket->repid; 885 1472 ret = tcp_del_rep(repid); 886 free(fp->psock->buf); 887 fp->psock->buf = NULL; 888 delete_tcp_fd(tmax_tcp_cepid + repid); 1473 //delete_fd_by_id(&IO_TYPE_TCP, tmax_tcp_cepid + repid); 889 1474 delete_id(tcp_repid_table, tcp_repid_table_count, repid); 890 1475 if (ret < 0) { … … 893 1478 } 894 1479 else { 895 free(fp->psock->buf);896 fp->psock->buf = NULL;897 1480 return -EINVAL; 898 1481 } … … 900 1483 } 901 1484 case AF_INET6: { 902 return -EAFNOSUPPORT; 903 } 1485 if (socket->cepid != 0) { 1486 ID cepid = socket->cepid; 1487 ret = tcp6_sht_cep(cepid); 1488 if (ret < 0) { 1489 //return -1; 1490 } 1491 ret = tcp6_cls_cep(cepid, (socket->repid != 0) ? 0 : SOCKET_TIMEOUT); 1492 ret2 = tcp6_del_cep(cepid); 1493 //delete_fd_by_id(&IO_TYPE_TCP, cepid); 1494 delete_id(tcp6_cepid_table, tcp6_cepid_table_count, cepid); 1495 if ((ret < 0) || (ret2 < 0)) { 1496 return (ret == E_TMOUT) ? -ETIME : -EINVAL; 1497 } 1498 } 1499 else if (socket->repid != 0) { 1500 ID repid = socket->repid; 1501 ret = tcp6_del_rep(repid); 1502 //delete_fd_by_id(&IO_TYPE_TCP, tmax_tcp6_cepid + repid); 1503 delete_id(tcp6_repid_table, tcp6_repid_table_count, repid); 1504 if (ret < 0) { 1505 return -EINVAL; 1506 } 1507 } 1508 else { 1509 return -EINVAL; 1510 } 1511 break; 1512 } 1513 default: 1514 return -ENOPROTOOPT; 904 1515 } 905 1516 … … 907 1518 } 908 1519 909 size_t tcp_fd_read(struct _IO_FILE *fp, unsigned char *dst, size_t dstsz)1520 size_t tcp_fd_read(struct SHELL_FILE *fp, unsigned char *dst, size_t dstsz) 910 1521 { 911 1522 return shell_recvfrom(fp->fd, dst, dstsz, 0, NULL, NULL); 912 1523 } 913 1524 914 size_t tcp_fd_write(struct _IO_FILE *fp, const unsigned char *src, size_t srcsz)1525 size_t tcp_fd_write(struct SHELL_FILE *fp, const unsigned char *src, size_t srcsz) 915 1526 { 916 1527 return shell_sendto(fp->fd, src, srcsz, 0, NULL, 0); 917 1528 } 918 1529 919 off_t tcp_fd_seek(struct _IO_FILE *fp, off_t ofs, int org)1530 off_t tcp_fd_seek(struct SHELL_FILE *fp, off_t ofs, int org) 920 1531 { 921 1532 return -EPERM; 922 1533 } 923 1534 924 int tcp_fd_ioctl(struct _IO_FILE *fp, int req, void *arg)1535 int tcp_fd_ioctl(struct SHELL_FILE *fp, int req, void *arg) 925 1536 { 926 1537 return -EINVAL; 927 1538 } 928 1539 929 int udp_fd_close(struct _IO_FILE *fp) 1540 bool_t tcp_fd_readable(struct SHELL_FILE *fp) 1541 { 1542 ER ret; 1543 1544 socket_t *socket = (socket_t *)fp->exinf; 1545 if (socket->cepid != 0) { 1546 if (socket->len == 0) { 1547 ret = tcp_rcv_buf(socket->cepid, &socket->input, TMO_NBLK); 1548 if ((ret != E_WBLK) && (ret != E_OBJ) && (ret < 0)) { 1549 syslog(LOG_ERROR, "tcp_rcv_buf => %d", ret); 1550 //return ret; 1551 } 1552 if (ret > 0) { 1553 ret = wai_sem(SEM_FILEDESC); 1554 if (ret < 0) { 1555 syslog(LOG_ERROR, "wai_sem => %d", ret); 1556 } 1557 socket->len += ret; 1558 ret = sig_sem(SEM_FILEDESC); 1559 if (ret < 0) { 1560 syslog(LOG_ERROR, "sig_sem => %d", ret); 1561 } 1562 } 1563 } 1564 else ret = 1; 1565 if (ret > 0) { 1566 return true; 1567 } 1568 } 1569 1570 return false; 1571 } 1572 1573 void tcp_fd_delete(struct SHELL_FILE *fp) 1574 { 1575 socket_t *socket = (socket_t *)fp->exinf; 1576 free(socket->buf); 1577 socket->buf = NULL; 1578 free(fp->exinf); 1579 fp->exinf = NULL; 1580 } 1581 1582 ER socket_tcp_callback(ID cepid, FN fncd, void *p_parblk) 1583 { 1584 struct SHELL_FILE *fp = id_to_fd(&IO_TYPE_TCP, cepid); 1585 FLGPTN flgptn = 0; 1586 ER ret; 1587 int len; 1588 1589 if (fp == NULL) 1590 return E_PAR; 1591 1592 int fd = fp->fd; 1593 FD_SET(fd, (fd_set *)&flgptn); 1594 1595 switch (fncd) { 1596 case TFN_TCP_RCV_BUF: 1597 len = *(int *)p_parblk; 1598 if ((len <= 0) || (fp->exinf == NULL)) 1599 return E_OK; 1600 1601 ret = wai_sem(SEM_FILEDESC); 1602 if (ret < 0) { 1603 syslog(LOG_ERROR, "wai_sem => %d", ret); 1604 } 1605 socket_t *socket = (socket_t *)fp->exinf; 1606 socket->len += len; 1607 ret = sig_sem(SEM_FILEDESC); 1608 if (ret < 0) { 1609 syslog(LOG_ERROR, "sig_sem => %d", ret); 1610 } 1611 1612 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 1613 1614 set_flg(FLG_SELECT_WAIT, flgptn); 1615 return E_OK; 1616 1617 case TFN_TCP_RCV_DAT: 1618 len = *(int *)p_parblk; 1619 if ((len <= 0) || (fp->exinf == NULL)) 1620 return E_OK; 1621 1622 ret = wai_sem(SEM_FILEDESC); 1623 if (ret < 0) { 1624 syslog(LOG_ERROR, "wai_sem => %d", ret); 1625 } 1626 socket->len += len; 1627 ret = sig_sem(SEM_FILEDESC); 1628 if (ret < 0) { 1629 syslog(LOG_ERROR, "sig_sem => %d", ret); 1630 } 1631 1632 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 1633 1634 set_flg(FLG_SELECT_WAIT, flgptn); 1635 return E_OK; 1636 1637 case TFN_TCP_SND_DAT: 1638 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++; 1639 1640 set_flg(FLG_SELECT_WAIT, flgptn); 1641 return E_OK; 1642 1643 case TFN_TCP_CAN_CEP: 1644 if (fp->errorevt_w == fp->errorevt_r) fp->errorevt_w++; 1645 1646 set_flg(FLG_SELECT_WAIT, flgptn); 1647 return E_OK; 1648 1649 case TFN_TCP_DEL_REP: 1650 delete_fd_by_id(&IO_TYPE_TCP, tmax_tcp_cepid + cepid); 1651 return E_OK; 1652 1653 case TFN_TCP_DEL_CEP: 1654 delete_fd_by_id(&IO_TYPE_TCP, cepid); 1655 return E_OK; 1656 1657 default: 1658 return E_OK; 1659 } 1660 } 1661 1662 ER socket_tcp6_callback(ID cepid, FN fncd, void *p_parblk) 1663 { 1664 struct SHELL_FILE *fp = id_to_fd(&IO_TYPE_TCP, cepid); 1665 FLGPTN flgptn = 0; 1666 ER ret; 1667 int len; 1668 1669 if (fp == NULL) 1670 return E_PAR; 1671 1672 int fd = fp->fd; 1673 FD_SET(fd, (fd_set *)&flgptn); 1674 1675 switch (fncd) { 1676 case TFN_TCP_RCV_BUF: 1677 len = *(int *)p_parblk; 1678 if ((len <= 0) || (fp->exinf == NULL)) 1679 return E_OK; 1680 1681 ret = wai_sem(SEM_FILEDESC); 1682 if (ret < 0) { 1683 syslog(LOG_ERROR, "wai_sem => %d", ret); 1684 } 1685 socket_t *socket = (socket_t *)fp->exinf; 1686 socket->len += len; 1687 ret = sig_sem(SEM_FILEDESC); 1688 if (ret < 0) { 1689 syslog(LOG_ERROR, "sig_sem => %d", ret); 1690 } 1691 1692 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 1693 1694 set_flg(FLG_SELECT_WAIT, flgptn); 1695 return E_OK; 1696 1697 case TFN_TCP_RCV_DAT: 1698 len = *(int *)p_parblk; 1699 if ((len <= 0) || (fp->exinf == NULL)) 1700 return E_OK; 1701 1702 ret = wai_sem(SEM_FILEDESC); 1703 if (ret < 0) { 1704 syslog(LOG_ERROR, "wai_sem => %d", ret); 1705 } 1706 socket->len += len; 1707 ret = sig_sem(SEM_FILEDESC); 1708 if (ret < 0) { 1709 syslog(LOG_ERROR, "sig_sem => %d", ret); 1710 } 1711 1712 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 1713 1714 set_flg(FLG_SELECT_WAIT, flgptn); 1715 return E_OK; 1716 1717 case TFN_TCP_SND_DAT: 1718 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++; 1719 1720 set_flg(FLG_SELECT_WAIT, flgptn); 1721 return E_OK; 1722 1723 case TFN_TCP_CAN_CEP: 1724 if (fp->errorevt_w == fp->errorevt_r) fp->errorevt_w++; 1725 1726 set_flg(FLG_SELECT_WAIT, flgptn); 1727 return E_OK; 1728 1729 case TFN_TCP_DEL_REP: 1730 delete_fd_by_id(&IO_TYPE_TCP, tmax_tcp_cepid + cepid); 1731 return E_OK; 1732 1733 case TFN_TCP_DEL_CEP: 1734 delete_fd_by_id(&IO_TYPE_TCP, cepid); 1735 return E_OK; 1736 1737 default: 1738 return E_OK; 1739 } 1740 } 1741 1742 int udp_fd_close(struct SHELL_FILE *fp) 930 1743 { 931 1744 ER ret; 932 1745 ID cepid; 933 1746 934 switch (fp->psock->family) { 1747 socket_t *socket = (socket_t *)fp->exinf; 1748 switch (socket->family) { 935 1749 case AF_INET: { 936 cepid = fp->psock->cepid;1750 cepid = socket->cepid; 937 1751 ret = udp_del_cep(cepid); 938 //free(fp->psock->buf); 939 //fp->psock->buf = NULL; 940 delete_udp_fd(cepid); 1752 //delete_fd_by_id(&IO_TYPE_UDP, cepid); 941 1753 delete_id(udp_cepid_table, udp_cepid_table_count, cepid); 942 1754 if (ret < 0) { … … 946 1758 } 947 1759 case AF_INET6: { 948 return -EAFNOSUPPORT; 949 } 1760 cepid = socket->cepid; 1761 ret = udp6_del_cep(cepid); 1762 //delete_fd_by_id(&IO_TYPE_UDP, cepid); 1763 delete_id(udp6_cepid_table, udp6_cepid_table_count, cepid); 1764 if (ret < 0) { 1765 return -EINVAL; 1766 } 1767 break; 1768 } 1769 default: 1770 return -ENOPROTOOPT; 950 1771 } 951 1772 … … 953 1774 } 954 1775 955 size_t udp_fd_read(struct _IO_FILE *fp, unsigned char *dst, size_t dstsz)1776 size_t udp_fd_read(struct SHELL_FILE *fp, unsigned char *dst, size_t dstsz) 956 1777 { 957 1778 return shell_recvfrom(fp->fd, dst, dstsz, 0, NULL, NULL); 958 1779 } 959 1780 960 size_t udp_fd_write(struct _IO_FILE *fp, const unsigned char *src, size_t srcsz)1781 size_t udp_fd_write(struct SHELL_FILE *fp, const unsigned char *src, size_t srcsz) 961 1782 { 962 1783 return shell_sendto(fp->fd, src, srcsz, 0, NULL, 0); 963 1784 } 964 1785 965 off_t udp_fd_seek(struct _IO_FILE *fp, off_t ofs, int org)1786 off_t udp_fd_seek(struct SHELL_FILE *fp, off_t ofs, int org) 966 1787 { 967 1788 return -EPERM; 968 1789 } 969 1790 970 int udp_fd_ioctl(struct _IO_FILE *fp, int req, void *arg)1791 int udp_fd_ioctl(struct SHELL_FILE *fp, int req, void *arg) 971 1792 { 972 1793 return -EINVAL; 1794 } 1795 1796 bool_t udp_fd_readable(struct SHELL_FILE *fp) 1797 { 1798 socket_t *socket = (socket_t *)fp->exinf; 1799 if (socket->cepid != 0) { 1800 if (socket->input != NULL) { 1801 return true; 1802 } 1803 } 1804 1805 return false; 1806 } 1807 1808 void udp_fd_delete(struct SHELL_FILE *fp) 1809 { 1810 //socket_t *socket = (socket_t *)fp->exinf; 1811 //free(socket->buf); 1812 //socket->buf = NULL; 1813 free(fp->exinf); 1814 fp->exinf = NULL; 1815 } 1816 1817 ER socket_udp_callback(ID cepid, FN fncd, void *p_parblk) 1818 { 1819 struct SHELL_FILE *fp = id_to_fd(&IO_TYPE_UDP, cepid); 1820 FLGPTN flgptn = 0; 1821 int len; 1822 1823 if (fp == NULL) 1824 return E_PAR; 1825 1826 int fd = fp->fd; 1827 FD_SET(fd, (fd_set *)&flgptn); 1828 1829 switch (fncd) { 1830 case TEV_UDP_RCV_DAT: 1831 { 1832 T_UDP_RCV_DAT_PARA *udppara = (T_UDP_RCV_DAT_PARA *)p_parblk; 1833 len = udppara->len; 1834 if ((len <= 0) || (fp->exinf == NULL)) 1835 return E_OK; 1836 1837 ER ret = wai_sem(SEM_FILEDESC); 1838 if (ret < 0) { 1839 syslog(LOG_ERROR, "wai_sem => %d", ret); 1840 } 1841 socket_t *socket = (socket_t *)fp->exinf; 1842 socket->len = len; 1843 if (socket->input != NULL) { 1844 ret = rel_net_buf(socket->input); 1845 if (ret < 0) { 1846 syslog(LOG_ERROR, "rel_net_buf => %d", ret); 1847 } 1848 } 1849 socket->input = udppara->input; 1850 socket->buf = GET_UDP_SDU(udppara->input, udppara->off); 1851 memset(&socket->raddr4, 0, sizeof(socket->raddr4)); 1852 socket->raddr4.sin_family = AF_INET; 1853 socket->raddr4.sin_port = htons(udppara->rep4.portno); 1854 socket->raddr4.sin_addr.s_addr = htonl(udppara->rep4.ipaddr); 1855 udppara->input->flags |= NB_FLG_NOREL_IFOUT; 1856 ret = sig_sem(SEM_FILEDESC); 1857 if (ret < 0) { 1858 syslog(LOG_ERROR, "sig_sem => %d", ret); 1859 } 1860 1861 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 1862 1863 set_flg(FLG_SELECT_WAIT, flgptn); 1864 return E_OK; 1865 } 1866 case TFN_UDP_CRE_CEP: 1867 return E_OK; 1868 1869 case TFN_UDP_RCV_DAT: 1870 len = *(int *)p_parblk; 1871 if ((len <= 0) || (fp->exinf == NULL)) 1872 return E_OK; 1873 1874 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 1875 1876 set_flg(FLG_SELECT_WAIT, flgptn); 1877 return E_OK; 1878 1879 case TFN_UDP_SND_DAT: 1880 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++; 1881 1882 set_flg(FLG_SELECT_WAIT, flgptn); 1883 return E_OK; 1884 1885 case TFN_UDP_CAN_CEP: 1886 if (fp->errorevt_w == fp->errorevt_r) fp->errorevt_w++; 1887 1888 set_flg(FLG_SELECT_WAIT, flgptn); 1889 return E_OK; 1890 1891 case TFN_UDP_DEL_CEP: 1892 delete_fd_by_id(&IO_TYPE_UDP, cepid); 1893 return E_OK; 1894 1895 default: 1896 return E_OK; 1897 } 1898 } 1899 1900 ER socket_udp6_callback(ID cepid, FN fncd, void *p_parblk) 1901 { 1902 struct SHELL_FILE *fp = id_to_fd(&IO_TYPE_UDP, cepid); 1903 FLGPTN flgptn = 0; 1904 int len; 1905 1906 if (fp == NULL) 1907 return E_PAR; 1908 1909 int fd = fp->fd; 1910 FD_SET(fd, (fd_set *)&flgptn); 1911 1912 switch (fncd) { 1913 case TEV_UDP_RCV_DAT: 1914 { 1915 T_UDP_RCV_DAT_PARA *udppara = (T_UDP_RCV_DAT_PARA *)p_parblk; 1916 len = udppara->len; 1917 if ((len <= 0) || (fp->exinf == NULL)) 1918 return E_OK; 1919 1920 ER ret = wai_sem(SEM_FILEDESC); 1921 if (ret < 0) { 1922 syslog(LOG_ERROR, "wai_sem => %d", ret); 1923 } 1924 socket_t *socket = (socket_t *)fp->exinf; 1925 socket->len = len; 1926 if (socket->input != NULL) { 1927 ret = rel_net_buf(socket->input); 1928 if (ret < 0) { 1929 syslog(LOG_ERROR, "rel_net_buf => %d", ret); 1930 } 1931 } 1932 socket->input = udppara->input; 1933 socket->buf = GET_UDP_SDU(udppara->input, udppara->off); 1934 memset(&socket->raddr6, 0, sizeof(socket->raddr6)); 1935 socket->raddr6.sin6_family = AF_INET; 1936 socket->raddr6.sin6_port = htons(udppara->rep6.portno); 1937 #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN 1938 memcpy(socket->raddr6.sin6_addr.__in6_union.__s6_addr, udppara->rep6.ipaddr.__u6_addr.__u6_addr8, 16); 1939 #else 1940 for (int i = 0; i < 16; i++) 1941 socket->raddr6.sin6_addr.__in6_union.__s6_addr[i] = udppara->rep6.ipaddr.__u6_addr.__u6_addr8[i]; 1942 #endif 1943 udppara->input->flags |= NB_FLG_NOREL_IFOUT; 1944 ret = sig_sem(SEM_FILEDESC); 1945 if (ret < 0) { 1946 syslog(LOG_ERROR, "sig_sem => %d", ret); 1947 } 1948 1949 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 1950 1951 set_flg(FLG_SELECT_WAIT, flgptn); 1952 return E_OK; 1953 } 1954 case TFN_UDP_CRE_CEP: 1955 return E_OK; 1956 1957 case TFN_UDP_RCV_DAT: 1958 len = *(int *)p_parblk; 1959 if ((len <= 0) || (fp->exinf == NULL)) 1960 return E_OK; 1961 1962 if (fp->readevt_w == fp->readevt_r) fp->readevt_w++; 1963 1964 set_flg(FLG_SELECT_WAIT, flgptn); 1965 return E_OK; 1966 1967 case TFN_UDP_SND_DAT: 1968 if (fp->writeevt_w == fp->writeevt_r) fp->writeevt_w++; 1969 1970 set_flg(FLG_SELECT_WAIT, flgptn); 1971 return E_OK; 1972 1973 case TFN_UDP_CAN_CEP: 1974 if (fp->errorevt_w == fp->errorevt_r) fp->errorevt_w++; 1975 1976 set_flg(FLG_SELECT_WAIT, flgptn); 1977 return E_OK; 1978 1979 case TFN_UDP_DEL_CEP: 1980 delete_fd_by_id(&IO_TYPE_UDP, cepid); 1981 return E_OK; 1982 1983 default: 1984 return E_OK; 1985 } 973 1986 } 974 1987 -
asp3_tinet_ecnl_rx/trunk/ntshell/src/socket_stub.h
r364 r374 103 103 } socket_t; 104 104 105 struct _IO_DIR {106 DIR dir;105 struct SHELL_DIR { 106 FATFS_DIR dir; 107 107 struct dirent dirent; 108 108 }; 109 109 110 struct _IO_FILE { 110 typedef const struct io_type_s IO_TYPE; 111 112 struct SHELL_FILE { 111 113 int fd; 112 inttype;114 IO_TYPE *type; 113 115 int handle; 114 int (*close)(struct _IO_FILE *);115 size_t (*read)(struct _IO_FILE *, unsigned char *, size_t);116 size_t (*write)(struct _IO_FILE *, const unsigned char *, size_t);117 off_t (*seek)(struct _IO_FILE *, off_t, int);118 int (*ioctl)(struct _IO_FILE *, int, void *);119 116 int readevt_r; 120 117 int readevt_w; … … 124 121 int errorevt_r; 125 122 int errorevt_w; 126 union { 127 FIL *pfile; 128 struct _IO_DIR *pdir; 129 socket_t *psock; 130 }; 123 void *exinf; 124 }; 125 126 struct io_type_s { 127 int (*close)(struct SHELL_FILE *); 128 size_t (*read)(struct SHELL_FILE *, unsigned char *, size_t); 129 size_t (*write)(struct SHELL_FILE *, const unsigned char *, size_t); 130 off_t (*seek)(struct SHELL_FILE *, off_t, int); 131 int (*ioctl)(struct SHELL_FILE *, int, void *); 132 bool_t (*readable)(struct SHELL_FILE *); 133 void (*delete)(struct SHELL_FILE *); 131 134 }; 132 135 … … 141 144 #endif 142 145 143 extern int stdio_close(struct _IO_FILE *fp); 144 extern size_t stdio_read(struct _IO_FILE *fp, unsigned char *data, size_t len); 145 extern size_t stdio_write(struct _IO_FILE *fp, const unsigned char *data, size_t len); 146 extern size_t stdin_read(struct _IO_FILE *fp, unsigned char *data, size_t len); 147 extern size_t stdout_write(struct _IO_FILE *fp, const unsigned char *data, size_t len); 148 extern size_t stderr_write(struct _IO_FILE *fp, const unsigned char *data, size_t len); 146 struct SHELL_FILE *new_fp(IO_TYPE *type, int id, int writable); 147 int delete_fd_by_id(IO_TYPE *type, int id); 148 struct SHELL_FILE *fd_to_fp(int fd); 149 struct SHELL_FILE *id_to_fd(IO_TYPE *type, int id); 149 150 150 extern int sio_close(struct _IO_FILE *fp); 151 extern size_t sio_read(struct _IO_FILE *fp, unsigned char *data, size_t len); 152 extern size_t sio_write(struct _IO_FILE *fp, const unsigned char *data, size_t len); 153 extern off_t sio_seek(struct _IO_FILE *fp, off_t ofs, int org); 154 extern int sio_ioctl(struct _IO_FILE *fp, int req, void *arg); 155 156 extern int file_close(struct _IO_FILE *fp); 157 extern size_t file_read(struct _IO_FILE *fp, unsigned char *data, size_t len); 158 extern size_t file_write(struct _IO_FILE *fp, const unsigned char *data, size_t len); 159 extern off_t file_seek(struct _IO_FILE *fp, off_t ofs, int org); 160 extern int file_ioctl(struct _IO_FILE *fp, int req, void *arg); 161 162 extern int dir_close(struct _IO_FILE *fp); 163 extern size_t dir_read(struct _IO_FILE *fp, unsigned char *data, size_t len); 164 extern size_t dir_write(struct _IO_FILE *fp, const unsigned char *data, size_t len); 165 extern off_t dir_seek(struct _IO_FILE *fp, off_t ofs, int org); 166 extern int dir_ioctl(struct _IO_FILE *fp, int req, void *arg); 167 168 extern int tcp_fd_close(struct _IO_FILE *fp); 169 extern size_t tcp_fd_read(struct _IO_FILE *fp, unsigned char *data, size_t len); 170 extern size_t tcp_fd_write(struct _IO_FILE *fp, const unsigned char *data, size_t len); 171 extern off_t tcp_fd_seek(struct _IO_FILE *fp, off_t ofs, int org); 172 extern int tcp_fd_ioctl(struct _IO_FILE *fp, int req, void *arg); 173 174 extern int udp_fd_close(struct _IO_FILE *fp); 175 extern size_t udp_fd_read(struct _IO_FILE *fp, unsigned char *data, size_t len); 176 extern size_t udp_fd_write(struct _IO_FILE *fp, const unsigned char *data, size_t len); 177 extern off_t udp_fd_seek(struct _IO_FILE *fp, off_t ofs, int org); 178 extern int udp_fd_ioctl(struct _IO_FILE *fp, int req, void *arg); 179 180 struct _IO_FILE *fd_to_fp(int fd); 181 182 struct _IO_FILE *new_sio_fd(int sioid); 183 int delete_sio_fd(int sioid); 184 struct _IO_FILE *sioid_to_fd(int sioid); 185 186 struct _IO_FILE *new_file_fd(int fileid); 187 int delete_file_fd(int fileid); 188 struct _IO_FILE *fileid_to_fd(int fileid); 189 190 struct _IO_FILE *new_dir_fd(int dirid); 191 int delete_dir_fd(int dirid); 192 struct _IO_FILE *dirid_to_fd(int dirid); 193 194 struct _IO_FILE *new_tcp_fd(int tcpid); 195 int delete_tcp_fd(int tcpid); 196 struct _IO_FILE *tcpid_to_fd(int tcpid); 197 198 struct _IO_FILE *new_udp_fd(int udpid); 199 int delete_udp_fd(int udpid); 200 struct _IO_FILE *udpid_to_fd(int udpid); 201 202 int delete_fp(struct _IO_FILE *fp); 203 int delete_tcp_rep(int repid); 151 int delete_fp(struct SHELL_FILE *fp); 204 152 void clean_fd(); 205 153 206 ER socket_tcp_callback(ID cepid, FN fncd, void *p_parblk); 207 ER socket_udp_callback(ID cepid, FN fncd, void *p_parblk); 154 void sys_tlsf_init(void); 208 155 209 156 #endif // !SOCKET_STUB_H -
asp3_tinet_ecnl_rx/trunk/ntshell/src/syscall.c
r364 r374 442 442 return no_implement("flock\n"); 443 443 } 444 445 long SYS_fchdir() 446 { 447 return no_implement("fchdir\n"); 448 } 449 450 long SYS_getegid32() 451 { 452 return no_implement("getegid32\n"); 453 } 454 455 long SYS_geteuid32() 456 { 457 return no_implement("geteuid32\n"); 458 } 459 460 long SYS_getgid32() 461 { 462 return no_implement("getgid32\n"); 463 } 464 465 long SYS_pipe2() 466 { 467 return no_implement("pipe2\n"); 468 } 469 470 long SYS_setgid32() 471 { 472 return no_implement("setgid32\n"); 473 } 474 475 long SYS_setpgid() 476 { 477 return no_implement("setpgid\n"); 478 } 479 480 long SYS_setsid() 481 { 482 return no_implement("setsid\n"); 483 } 484 485 long SYS_setuid32() 486 { 487 return no_implement("setuid32\n"); 488 } 489 490 long SYS_tgkill() 491 { 492 return no_implement("tgkill\n"); 493 } -
asp3_tinet_ecnl_rx/trunk/ntshell/tlsf/tlsf.c
r337 r374 5 5 #include <stdlib.h> 6 6 #include <string.h> 7 #include "util/ntstdio.h"7 #include <stdio.h> 8 8 9 9 #include "tlsf.h" … … 16 16 #define tlsf_decl static 17 17 #endif 18 19 extern ntstdio_t ntstdio;20 18 21 19 /* … … 889 887 { 890 888 (void)user; 891 ntstdio_printf(&ntstdio,"\t%p %s size: %x (%p)\n", ptr, used ? "used" : "free", (unsigned int)size, block_from_ptr(ptr));889 printf("\t%p %s size: %x (%p)\n", ptr, used ? "used" : "free", (unsigned int)size, block_from_ptr(ptr)); 892 890 } 893 891 … … 978 976 if (((ptrdiff_t)mem % ALIGN_SIZE) != 0) 979 977 { 980 ntstdio_printf(&ntstdio,"tlsf_add_pool: Memory must be aligned by %u bytes.\n",978 printf("tlsf_add_pool: Memory must be aligned by %u bytes.\n", 981 979 (unsigned int)ALIGN_SIZE); 982 980 return 0; … … 986 984 { 987 985 #if defined (TLSF_64BIT) 988 ntstdio_printf(&ntstdio,"tlsf_add_pool: Memory size must be between 0x%x and 0x%x00 bytes.\n",986 printf("tlsf_add_pool: Memory size must be between 0x%x and 0x%x00 bytes.\n", 989 987 (unsigned int)(pool_overhead + block_size_min), 990 988 (unsigned int)((pool_overhead + block_size_max) / 256)); 991 989 #else 992 ntstdio_printf(&ntstdio,"tlsf_add_pool: Memory size must be between %u and %u bytes.\n",990 printf("tlsf_add_pool: Memory size must be between %u and %u bytes.\n", 993 991 (unsigned int)(pool_overhead + block_size_min), 994 992 (unsigned int)(pool_overhead + block_size_max)); … … 1058 1056 if (rv) 1059 1057 { 1060 ntstdio_printf(&ntstdio,"test_ffs_fls: %x ffs/fls tests failed.\n", rv);1058 printf("test_ffs_fls: %x ffs/fls tests failed.\n", rv); 1061 1059 } 1062 1060 return rv; … … 1075 1073 if (((tlsfptr_t)mem % ALIGN_SIZE) != 0) 1076 1074 { 1077 ntstdio_printf(&ntstdio,"tlsf_create: Memory must be aligned to %u bytes.\n",1075 printf("tlsf_create: Memory must be aligned to %u bytes.\n", 1078 1076 (unsigned int)ALIGN_SIZE); 1079 1077 return 0; -
asp3_tinet_ecnl_rx/trunk/usbhost/src/usb_hbth.h
r337 r374 11 11 #define USBHOST_STACK_SIZE 2048 12 12 13 extern void usbhost_init(ID tskid); 14 extern void usbhost_main(intptr_t exinf); 13 enum task_event_t { 14 TASK_EVENT_START, 15 TASK_EVENT_TERMINATE, 16 TASK_EVENT_WAKEUP, 17 TASK_EVENT_TIMEOUT, 18 TASK_EVENT_TICK = 0x80, 19 }; 20 21 struct task_if_t { 22 void (*on_start)(struct task_if_t *task, ID tskid); 23 void (*on_end)(struct task_if_t *task); 24 int (*get_timer)(struct task_if_t *task); 25 void (*progress)(struct task_if_t *task, int elapse); 26 void (*process)(struct task_if_t *task, enum task_event_t event); 27 }; 28 29 extern struct task_if_t bt_task; 30 31 void usbhost_init(ID tskid); 32 void usbhost_main(intptr_t exinf); 15 33 16 34 /*
Note:
See TracChangeset
for help on using the changeset viewer.